Previous: Relational Database Objects, Up: Relational Infrastructure


6.2.4 Database Operations

This object-oriented interface is deprecated for typical database applications; Using Databases provides an application programmer interface which is easier to understand and use.

These are the descriptions of the methods available from an open relational database. A method is retrieved from a database by calling the database with the symbol name of the operation. For example:

     (define my-database
             (create-alist-database "mydata.db"))
     (define telephone-table-desc
             ((my-database 'create-table) 'telephone-table-desc))
— Operation on relational-database: close-database

Causes the relational database to be written to its associated file (if any). If the write is successful, subsequent operations to this database will signal an error. If the operations completed successfully, #t is returned. Otherwise, #f is returned.

— Operation on relational-database: write-database filename

Causes the relational database to be written to filename. If the write is successful, also causes the database to henceforth be associated with filename. Calling the close-database (and possibly other) method on this database will cause filename to be written to. If filename is #f this database will be changed to a temporary, non-disk based database if such can be supported by the underlying base table implelentation. If the operations completed successfully, #t is returned. Otherwise, #f is returned.

— Operation on relational-database: sync-database

Causes any pending updates to the database file to be written out. If the operations completed successfully, #t is returned. Otherwise, #f is returned.

— Operation on relational-database: solidify-database

Causes any pending updates to the database file to be written out. If the writes completed successfully, then the database is changed to be immutable and #t is returned. Otherwise, #f is returned.

— Operation on relational-database: table-exists? table-name

Returns #t if table-name exists in the system catalog, otherwise returns #f.

— Operation on relational-database: open-table table-name mutable?

Returns a methods procedure for an existing relational table in this database if it exists and can be opened in the mode indicated by mutable?, otherwise returns #f.

These methods will be present only in mutable databases.

— Operation on relational-database: delete-table table-name

Removes and returns the table-name row from the system catalog if the table or view associated with table-name gets removed from the database, and #f otherwise.

— Operation on relational-database: create-table table-desc-name

Returns a methods procedure for a new (open) relational table for describing the columns of a new base table in this database, otherwise returns #f. For the fields and layout of descriptor tables, See Catalog Representation.

— Operation on relational-database: create-table table-name table-desc-name

Returns a methods procedure for a new (open) relational table with columns as described by table-desc-name, otherwise returns #f.

— Operation on relational-database: create-view ??
— Operation on relational-database: project-table ??
— Operation on relational-database: restrict-table ??
— Operation on relational-database: cart-prod-tables ??

Not yet implemented.