Database[SQLite] - Maple Programming Help

Home : Support : Online Help : Connectivity : Database Package : SQLite : Database/SQLite/Attach

Database[SQLite]

 Attach
 attach a new database to the opened connection

 Calling Sequence Attach( connection, filename, name )

Parameters

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

Description

 • The Attach command adds another database file to the current database connection and 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. 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)$
 $\left[{\mathrm{Attach}}{,}{\mathrm{Bind}}{,}{\mathrm{ClearBindings}}{,}{\mathrm{Close}}{,}{\mathrm{ColumnCount}}{,}{\mathrm{ColumnNames}}{,}{\mathrm{Execute}}{,}{\mathrm{Fetch}}{,}{\mathrm{FetchAll}}{,}{\mathrm{FetchRow}}{,}{\mathrm{Finalize}}{,}{\mathrm{Open}}{,}{\mathrm{Opened}}{,}{\mathrm{Prepare}}{,}{\mathrm{RESULT_BUSY}}{,}{\mathrm{RESULT_DONE}}{,}{\mathrm{RESULT_ROW}}{,}{\mathrm{Reset}}{,}{\mathrm{Step}}\right]$ (1)

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)$ (2)

Close database connection

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

Compatibility

 • The Database[SQLite][Attach] command was introduced in Maple 18.
 • For more information on Maple 18 changes, see Updates in Maple 18.
 • The Database[SQLite][Attach] command was updated in Maple 2016.