Content-type: text/html; charset=UTF-8
qread Relation Start Length Number Type
{ $NUMBER$ 10654 Author,1 {The first author} Author,2 {The second author} Title,1 {The Title to "Some Juicy Book"} ISBN,1 {ISBN X-XXX-XXXXX-X} Description,1 {This is a really great book!!! Everyone should read this book.} }
The first two elements of this list describe the unique identifier of the record. The line $NUMBER$ 10654 indicates that this is record number 10654. This information might be used by qdel(1) to delete the record. The remainder of the list contains elements describing the attribute name/instance and value of each non-empty attribute in the record. Even-numbered elements X, excluding the first two elements, contain the name of the attribute and its instance number separated by a comma. Odd-numbered elements X+1 contain the value of the attribute described by element X.
# Example TCL/TK usage of query/qread. set query_result [exec query Relation -tcl -norows -any 'my words' -print Attr1:10 Attr2:10] foreach i $query_result { # Display each 20-character row referenced by [lindex $i 0]. } # Read all the records, calling do_something for each field in each record. foreach i $query_result { set keylist [lindex $i 1] set record [eval "exec qread $keylist"] set record_number [lindex $record 1] set fields [lreplace $record 0 1] set len [llength $fields] for {set j 0} {$j < $len} {incr j 2} { set tmp [split [lindex $fields $j] ","] set attribute_name [lindex $tmp 0] set attribute_instance [lindex $tmp 1] set attribute_value [lindex $fields [expr $j + 1]] # display the attribute or whatever do_something $attribute_name $attribute_instance $attribute_value } }
A Guide to QDDB Eric H. Herrin II and Raphael A. Finkel Qddb User's Guide An ASCII Database for Fast Queries of Relatively Stable Data Eric H. Herrin II and Raphael A. Finkel Computing Systems, Volume 4 Number 2 University of California Press, Berkeley CA Schema and Tuple Trees: An Intuitive Structure for Representing Relational Data Eric H. Herrin, II and Raphael A. Finkel Computing Systems, Volume 9, Number 2 MIT Press, Cambridge MA