- Feb 1, 2021
- 38
- 11
- 8
- Customer Identifier
- E074775
The Xbase++ runtime contains an embedded SQLite engine which it uses for executing local SQL statements. By default, a global in-memory database is used as the data source for local queries and commands.
Methods of the USQLStatement class, such as :createVirtualTableFromWorkArea(), can be used to augment this local data set. In addition, an external SQlite database can be opened and attached to the in-memory database using :attachDatabase().
In addition to the global in-memory database, the embedded SQLite engine also supports using an external SQlite database as the data source. To do this, the database must be opened using the method openDatabase( <cFile> ). If the specified database does not exist, it is created. This can be used for creating a new SQLite database from scratch.
Note that using openDatabase() causes the global in-memory database to be closed.
Example:
Methods of the USQLStatement class, such as :createVirtualTableFromWorkArea(), can be used to augment this local data set. In addition, an external SQlite database can be opened and attached to the in-memory database using :attachDatabase().
In addition to the global in-memory database, the embedded SQLite engine also supports using an external SQlite database as the data source. To do this, the database must be opened using the method openDatabase( <cFile> ). If the specified database does not exist, it is created. This can be used for creating a new SQLite database from scratch.
Note that using openDatabase() causes the global in-memory database to be closed.
Example:
Xbase++:
// Open a SQLite database as the storage for the embedded SQLite engine
USQLStatement():openDatabase( "c:\driverlog.db")
// Execute a query on the "route" table
oStmt := USQLStatement():new():fromChar( "SELECT * FROM route" )
oStmt:build()
oStmt:query(USQL_RESULT_OBJECTS, @aData)
? aData[1]:start_poi
? aData[1]:end_poi