TSQLConnection¶
An abstract class representing a connection to a SQL Database.
Declaration¶
Source position: sqldb.pp line 208
type
TSQLConnection = class(TDatabase)
public
constructor Create;
destructor Destroy;
procedure StartTransaction;
procedure EndTransaction;
procedure ExecuteDirect(SQL: string); overload;
procedure ExecuteDirect(SQL: string; ATransaction: TSQLTransaction); overload;
function GetObjectNames : Integer;
function HasTable : Boolean;
procedure GetTableNames;
procedure GetProcedureNames;
procedure GetFieldNames;
procedure GetSchemaNames;
procedure GetSequenceNames;
function GetConnectionInfo : string;
function GetStatementInfo : TSQLStatementInfo;
procedure CreateDB;
procedure DropDB;
function GetNextValue : Int64;
property ConnOptions: TConnOptions; {r}
property Handle: Pointer; {r}
property FieldNameQuoteChars: TQuoteChars; {rw}
published
property Password: string; {rw}
property Transaction: TSQLTransaction; {rw}
property UserName: string; {rw}
property CharSet: string; {rw}
property HostName: string; {rw}
property OnLog: TDBLogNotifyEvent; {rw}
property LogEvents: TDBEventTypes; {rwd}
property Options: TSQLConnectionOptions; {rwd}
property Role: string; {rw}
property Connected;
property DatabaseName;
property KeepConnection;
property LoginPrompt;
property Params;
property OnLogin;
end;
Description¶
TSQLConnection is an abstract class for making a connection to a SQL Database. This class will never be instantiated directly, for each database type a descendent class specific for this database type must be created.
Most of common properties to SQL databases are implemented in this class.
Properties¶
| Member | Visibility | Description |
|---|---|---|
| CharSet | published | The character set to be used in this database. |
| Connected read only | published | Is a connection to the server active or not. |
| ConnOptions read only | public | The set of Connection options being used in the Connection. |
| DatabaseName read only | published | The name of the database to which connection is required. |
| FieldNameQuoteChars | public | Characters used to quote field names. |
| Handle read only | public | Low level handle used by the connection. |
| HostName | published | The name of the host computer where the database resides. |
| KeepConnection read only | published | Attempt to keep the connection open once it is established. |
| LogEvents | published | Filter for events to log. |
| LoginPrompt read only | published | Should SQLDB prompt for user credentials when a connection is activated. |
| Options | published | Options to observe for this connection. |
| Params read only | published | Extra connection parameters. |
| Password | published | Password used when authenticating on the database server. |
| Role | published | Role in which the user is connecting to the database. |
| Transaction | published | Default transaction to be used for this connection. |
| UserName | published | The username for authentication on the database server. |
Methods¶
| Member | Visibility | Description |
|---|---|---|
| Create | public | Create a new instance of TSQLConnection. |
| CreateDB | public | Create a new Database on the server. |
| Destroy | public | Destroys the instance of the connection. |
| DropDB | public | Procedure to drop or remove a Database. |
| EndTransaction | public | End the Transaction associated with this connection. |
| ExecuteDirect | public | Execute a piece of SQL code directly, using a Transaction if specified. |
| GetConnectionInfo | public | Return some information about the connection. |
| GetFieldNames | public | Gets a list of the field names in the specified table. |
| GetNextValue | public | Get next value for a sequence. |
| GetObjectNames | public | Return a collection of object names for a given type of object. |
| GetProcedureNames | public | Gets a list of Stored Procedures in the Database. |
| GetSchemaNames | public | Get database schema names. |
| GetSequenceNames | public | Return a list of sequence names. |
| GetStatementInfo | public | Get statement information. |
| GetTableNames | public | Get a list of the tables in the specified database. |
| HasTable | public | |
| StartTransaction | public | Start the Transaction associated with this Connection. |
Events¶
| Member | Visibility | Description |
|---|---|---|
| OnLog | published | Event handler for logging events. |
| OnLogin read only | published | Event handler for login process. |
See also¶
| Name | Description |
|---|---|
| TSQLQuery | Class to handle SQL commands (with or without result set). |
| TSQLTransaction | Transaction in which a TSQLQuery is handled. |