SQLDB unit
A set of classes for connecting to SQL databases and running SQL commands on them.
The SQLDB unit defines four main classes to handle data in SQL based databases.
- TSQLConnection represents the connection to the database. Here, properties pertaining to the connection (machine, database, user password) must be set. This is an abstract class, which should not be used directly. Per database type (mysql, firebird, postgres, oracle, sqlite) a descendent should be made and used.
- TSQLQuery is a TDataset descendent which can be used to view and manipulate the result of an SQL select query. It can also be used to execute all kinds of SQL statements.
- TSQLTransaction represents the transaction in which an SQL command is running. SQLDB supports multiple simultaneous transactions in a database connection. For databases that do not support this functionality natively, it is simulated by maintaining multiple connections to the database.
- TSQLScript can be used when many SQL commands must be executed on a database, for example when creating a database.
There is also a unified way to retrieve schema information, and a registration for connector types. More information on how to use these components can be found in UsingSQLDB.
Classes and records
ESQLDatabaseError | class | SQL database error class. |
TConnectionDef | class | Connection type definition class. |
TCustomSQLQuery | class | Custom Class to handle SQL commands (with or without result set). |
TCustomSQLStatement | class | Object to execute SQL statements without result set. |
TServerIndexDefs | class | SQLDB specific descendant of the TIndexDefs. |
TSQLConnection | class | An abstract class representing a connection to a SQL Database. |
TSQLConnector | class | Universal connection component. |
TSQLCursor | class | Internal object representing a database result set. |
TSQLDBFieldDef | class | TFieldDef descendant with room to store engine-specific data. |
TSQLDBFieldDefs | class | TFieldDefs descendant with room to store engine-specific data. |
TSQLDBParam | class | TParam descendent used in SQLDB. |
TSQLDBParams | class | TParams descendant with room to store engine-specific data. |
TSQLHandle | class | Internal object representing a database internal handle. |
TSQLQuery | class | Class to handle SQL commands (with or without result set). |
TSQLScript | class | Component to execute various SQL statements. |
TSQLSequence | class | Support for applying sequences to fields. |
TSQLStatement | class | Class to execute non-select SQL statements. |
TSQLStatementInfo | record | Record to describe a SQL statement. |
TSQLTransaction | class | Transaction in which a TSQLQuery is handled. |
Procedures and functions
GetConnectionDef | function | Search for a connection definition by name. |
GetConnectionList | procedure | Return a list of connection definition names. |
RegisterConnection | procedure | Register a new connection type for use in the universal connector. |
UnRegisterConnection | procedure | Unregister a registered connection type. |
Types
TCommitRollbackAction | enumeration | Transaction actions (unused). |
TConnectionDefClass | type | Class of TConnectionDef. |
TConnInfoType | enumeration | Connection information to be retrieved. |
TConnOption | enumeration | Connection options. |
TConnOptions | set | Set of TConnOption. |
TDBEventType | type | Type of database event. |
TDBEventTypes | type | Set of database event types. |
TDBLogNotifyEvent | procedure type | Event handler prototype for handling events. |
TLibraryLoadFunction | procedure type | Library loading function prototype. |
TLibraryUnLoadFunction | procedure type | Library unloading function prototype. |
TQuoteChars | type | Type to describe quote characters. |
TRowsCount | type | A type to contain a result row count. |
TSchemaType | type | Schema type to retrieve. |
TSQLConnectionClass | type | Class of TSQLConnection type. |
TSQLConnectionOption | enumeration | Connection handling options. |
TSQLConnectionOptions | set | Set of TSQLConnectionOption. |
TSQLQueryOption | enumeration | SQL Query options. |
TSQLQueryOptions | set | Set of TSQLQueryOption. |
TSQLSequenceApplyEvent | enumeration | When to fetch a new sequence number. |
TSQLTransactionOption | enumeration | Transaction control options. |
TSQLTransactionOptions | set | Set of TSQLTransactionOption. |
TStatementType | type | Type describing the kind of SQL statement. |
Constants
DefaultMacroChar | constant | Default character to use as a macro delimiter. |
DefaultSQLFormatSettings | constant | Default settings to be used in SQL. |
detActualSQL | constant | Alias for sqltypes.detActualSQL. |
detCommit | constant | Alias for sqltypes.detCommit. |
detCustom | constant | Alias for sqltypes.detCustom. |
detExecute | constant | Alias for sqltypes.detExecute. |
detFetch | constant | Alias for sqltypes.detFetch. |
detParamValue | constant | Alias for sqltypes.detParamValue. |
detPrepare | constant | Alias for sqltypes.detPrepare. |
detRollBack | constant | Alias for sqltypes.detRollBack. |
DoubleQuotes | constant | Double quote delimiters. |
LogAllEvents | constant | Constant that can be used to select all events. |
LogAllEventsExtra | constant | All possible event types that must be reported. |
SingleQuotes | constant | Single quote delimiters. |
StatementTokens | constant | Array of tokens used to determine the statement type. |
stColumns | constant | Alias for sqltypes.stColumns. |
stCommit | constant | Alias for sqltypes.stCommit. |
stDDL | constant | Alias for sqltypes.stDDL. |
stDelete | constant | Alias for sqltypes.stDelete. |
stExecProcedure | constant | Alias for sqltypes.stExecProcedure. |
stGetSegment | constant | Alias for sqltypes.stGetSegment. |
stIndexes | constant | Alias for sqltypes.stIndexes. |
stInsert | constant | Alias for sqltypes.stInsert. |
stNoSchema | constant | Alias for sqltypes.stUnknown. |
stPackages | constant | Alias for sqltypes.stPackages. |
stProcedureParams | constant | Alias for sqltypes.stProcedureParams. |
stProcedures | constant | Alias for sqltypes.stProcedures. |
stPutSegment | constant | Alias for sqltypes.stPutSegment. |
stRollback | constant | Alias for sqltypes.stRollback. |
stSchemata | constant | Alias for sqlTypes.stSchemata. |
stSelect | constant | Alias for sqltypes.stSelect. |
stSelectForUpd | constant | Alias for sqltypes.stSelectForUpd. |
stSequences | constant | Alias for sqltypes.stSequences. |
stStartTrans | constant | Alias for sqltypes.stStartTrans. |
stSysTables | constant | Alias for sqltypes.stSysTables. |
stTables | constant | Alias for sqltypes.stTables. |
stUnknown | constant | Alias for sqltypes.stUnknown. |
stUpdate | constant | Alias for sqltypes.stUpdate. |
TSchemaObjectNames | constant | Names of the various types of objects. |
Variables
GlobalDBLogHook | variable | Global logging hook. |
Topics
RetrievingSchemaInformation | topic | Retrieving Schema Information. |
UniversalConnectors | topic | Using the universal TSQLConnector type. |
UpdateSQLs | topic | Automatic generation of update SQL statements. |
UsingParams | topic | Using parameters. |
UsingSQLDB | topic | Using SQLDB to access databases. |
Uses
SysUtilsClassesDBBufDatasetsqlscriptSQLTypes
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
