chickadee » pandora » DATASTORE

(DATASTORE 'connect URI) => DATASTOREmethod

Establish a connection to a real database.

Depending on the scheme of the URI, a registered prototype to clone is selected and the URI is passed on to the clone call. The new object is returned.

URI may be a string or a uri-generic record, but is always passed to the connection prototype's clone method as a record.

The drivers bundled with pandora will handle the URI schemes sqlite3 or memory for access to SQLite3 databases (the latter always creates a database in memory) and postgresql or psql for access to PostgreSQL databases.

The SQLite3 driver also supports a URI parameter cache that determines the size of the prepared statement cache, which defaults to 64.

Before using a backend, it must be loaded, but it doesn't have to be imported.

;; Example using SQLite3:
(require-extension pandora)
(require-library pandora-sqlite3)
(define store (*sql-datastore* 'connect "sqlite3:test.db?cache=16"))

;; Example using PostgreSQL:
(require-extension pandora)
(require-library pandora-postgresql)
(define store (*sql-datastore* 'connect "psql:"))

<method>(DATASTORE 'disconnect!) => VOID</enscript>

Close the connection this datastore holds to a real database. The default implementation does nothing.