Database[SQLite] - Maple Programming Help

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

Database[SQLite]

 Open
 open a new database connection

 Calling Sequence Open( filename, create, readonly )

Parameters

 filename - URI file name create - (optional) create database if it does not exist, default is true readonly - (optional) open database in read-only mode, default is false

Description

 • The Open command opens a new database connection.
 • If the filename is :memory:, then a private, temporary in-memory database is created for the connection. This in-memory database will vanish when the database connection is closed.
 • If the filename is an empty string, then a private, temporary on-disk database will be created. This private database will be automatically deleted as soon as the database connection is closed.
 • The Open 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)
 > $\mathrm{db}≔\mathrm{FileTools}\left[\mathrm{JoinPath}\right]\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 2020\data\SQLite\G20-Population.db"}\right]\right)$ (2)
 > $\mathrm{Close}\left(\mathrm{connection}\right)$
 ${"SQLite database: connection closed"}$ (3)

Compatibility

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