Database[SQLite] - Maple Programming Help

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

Database[SQLite]

 Opened
 List Opened Databases

 Calling Sequence Opened( connection )

Parameters

 connection - database connection obtained using Open command

Description

 • The Opened command returns a table that lists all opened databases for the given connection. Key in the table is the name of the database and value is the file name.
 • For in memory or temporary databases the file name is an empty string.

Examples

 > $\mathrm{with}\left({\mathrm{Database}}_{\mathrm{SQLite}}\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)
 > $\mathrm{db}≔{\mathrm{FileTools}}_{\mathrm{JoinPath}}\left(\left[\mathrm{kernelopts}\left('\mathrm{datadir}'\right),"SQLite","G20-Population.db"\right]\right):$
 > $\mathrm{connection}≔\mathrm{Open}\left(\mathrm{db}\right)$
 ${"SQLite database"}{,}{table}{}\left(\left[{"main"}{=}{"C:\Program Files\Maple 2019\data\SQLite\G20-Population.db"}\right]\right)$ (2)

Create and attach another in memory database

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

Opened databases

 > $\mathrm{Opened}\left(\mathrm{connection}\right)$
 ${"SQLite database"}{,}{table}{}\left(\left[{"database2"}{=}{""}{,}{"main"}{=}{"C:\Program Files\Maple 201\data\SQLite\G20-Population.db"}\right]\right)$ (3)
 > $\mathrm{Close}\left(\mathrm{connection}\right)$
 ${"SQLite database: connection closed"}$ (4)

Compatibility

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