Method USqlStatement():attachDatabase() Foundation

Attaches a SQLite database.

Syntax
:attachDatabase( <cFile> [,<cSchema>] ) -> lSuccess
Parameters
<cFile>
Filename and path of the SQLite database to be attached.
<cSchema>
Schema name of the attached database. This parameter is optional. If no schema name is given, the name of the SQLite database is used.
Return

The method returns a logical value indicating whether the database was attached (.T.) or not (.F.).

Description

This method attaches a SQLite database on disk to the embedded SQL engine and optionally assigns a schema name to the attached database. Attaching a database via :attachDatabase() leaves the current state/data of the global in-memory database intact.

To access tables from different attached databases, use the SQL schema qualifier <schema-name>.<table-name> in the FROM clause of your SQL statements.

The method returns .F. if the SQLite database file is not found. A runtime error is raised in case of database corruption or an unsupported SQLite version.

The maximum number of attached databases supported is 10.

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.