Attach - Maple Help

Database[SQLite]

 Attach
 attach a new database to the opened connection

 Calling Sequence Attach( connection, filename, name )

Parameters

 connection - database connection obtained using the Open command filename - string; URI file name name - string; name of database

Description

 • The Attach command adds a database file to the current database connection. It is a convenience command implementing the ATTACH DATABASE statement.
 • The database-names main and temp refer to the main database and the database used for temporary tables, respectively. The main and temp databases cannot be attached or detached.
 • The Attach command can open an existing database from Workbook if the filename is a valid Workbook URI.

Examples

 > $\mathrm{with}\left(\mathrm{Database}\left[\mathrm{SQLite}\right]\right):$

Create in memory database

 > $\mathrm{db}≔\mathrm{Open}\left(":memory:"\right):$

Create and attach another in memory database

 > $\mathrm{Attach}\left(\mathrm{db},":memory:","database2"\right):$

Opened databases

 > $\mathrm{Opened}\left(\mathrm{db}\right)$
 ${table}{}\left(\left[{"database2"}{=}{""}{,}{"main"}{=}{""}\right]\right)$ (1)

Close database connection

 > $\mathrm{Close}\left(\mathrm{db}\right):$

Compatibility

 • The Database[SQLite][Attach] command was introduced in Maple 18.