Pascal scripting API¶
This is the reference for the classes available to Pascal scripts. The API centres on two classes — TSQLiteDatabase, which represents a connection to a database, and TSQLiteQuery, which runs SQL and exposes its result set — together with helper routines such as DisplayData(). For complete, runnable examples, see Scripting examples.
The TSQLiteDatabase class¶
Creates and returns a new instance of a TSQLiteDatabase object.
Sets or retrieves the value of the filename associated with the database object. The filename must point to an existing SQLite3 database, or :memory: for opening an in- memory database.
When called with an argument, connects or disconnects the database to the filename set by the FileName property. Returns True if connected to the database.
Connects to the database. Similar to calling Connected(True) except it does not return a value.
Disconnects from database. Similar to calling Connected(False) except it does not return a value.
Executes an SQL statement in the current database.
Starts a transaction.
Commits the current transaction.
Rolls back the current transaction.
Returns True if a transaction is active, and False otherwise.
Destroys the object and frees its associated memory.
The TSQLiteQuery class¶
TSQLiteQuery represents a dataset with a result set that is based on an SQL statement.
Creates and returns a new instance of a sqlitequery object.
Specifies the database object associated with the query.
Specifies whether or not the dataset is open.
Opens the query by executing the SQL statement. Similar to calling
If the SQL statement returns a cursor the following functions and properties can be used to iterate through the result set: First, Last, Next, Prior, Eof, Bof.
Closes the query.
Test eof (end of file) to determine if the dataset is positioned at the last record.
Test bof (beginning of file) to determine if the dataset is positioned at the first record.
procedure F``irst;
Moves to the first record in the dataset.
Moves to the last record in the dataset.
Moves to the next record in the dataset.
Moves to the previous record in the dataset.
Enables editing of data in the dataset.
Writes the modified record to the database.
Inserts a new, empty record in the dataset.
procedure D``elete;
Deletes the active record and positions the dataset on the next record.
Cancels modifications to the active record if those changes are not yet posted.
Indicates the total number of records associated with the dataset. Note: the value returned by this property is only valid after reaching the last record in the dataset.
Indicates the active record in the dataset.
Indicates the number of field components associated with the dataset.
Finds a field based on its name. Returns a TField object, or nil if the field was not found.
Finds a field based on its index. Returns a TField object. An 'index out of range' error occurs if the Index is < 0 or >= FieldCount.
Sets or retrieves the text of the SQL statement to execute for the query.
Destroys the object and frees its associated memory.
The TField class¶
Returns the name of the field.
Sets or retrieves the value of the field in the current record, as a variant. To set the value of the field, the dataset must be in the Edit mode, set by a previous call to Insert or Edit.
Sets or retrieves the value of the field in the current record, as string. To set the value of the field, the dataset must be in the Edit mode, set by a previous call to Insert or Edit.
Sets or retrieves the value of the field in the current record, as a floating point number. To set the value of the field, the dataset must be in the Edit mode, set by a previous call to Insert or Edit.
Sets or retrieves the value of the field in the current record, as a boolean value. To set the value of the field, the dataset must be in the Edit mode, set by a previous call to Insert or Edit.
Indicates the size used in the definition of the physical database field for data types that support different sizes.