Next: , Previous: Table Operations, Up: Table Operations


6.1.2.1 Single Row Operations

The term row used below refers to a Scheme list of values (one for each column) in the order specified in the descriptor (table) for this table. Missing values appear as #f. Primary keys must not be missing.

— Operation on relational-table: row:insert

Adds the row row to this table. If a row for the primary key(s) specified by row already exists in this table an error is signaled. The value returned is unspecified.

     (define telephone-table-desc
             ((my-database 'create-table) 'telephone-table-desc))
     (define ndrp (telephone-table-desc 'row:insert))
     (ndrp '(1 #t name #f string))
     (ndrp '(2 #f telephone
               (lambda (d)
                 (and (string? d) (> (string-length d) 2)
                      (every
                       (lambda (c)
                         (memv c '(#\0 #\1 #\2 #\3 #\4 #\5 #\6 #\7 #\8 #\9
                                       #\+ #\( #\space #\) #\-)))
                       (string->list d))))
               string))
— Operation on relational-table: row:update

Returns a procedure of one argument, row, which adds the row, row, to this table. If a row for the primary key(s) specified by row already exists in this table, it will be overwritten. The value returned is unspecified.

— Operation on relational-table: row:retrieve

Returns a procedure of arguments key1 key2 ... which returns the row associated with primary keys key1, key2 ... if it exists, or #f otherwise.

     ((plat 'row:retrieve) 'linux) ⇒ (linux i386 linux gcc)
     ((plat 'row:retrieve) 'multics) ⇒ #f
— Operation on relational-table: row:remove

Returns a procedure of arguments key1 key2 ... which removes and returns the row associated with primary keys key1, key2 ... if it exists, or #f otherwise.

— Operation on relational-table: row:delete

Returns a procedure of arguments key1 key2 ... which deletes the row associated with primary keys key1, key2 ... if it exists. The value returned is unspecified.