TSqlDatabaseConnector
Abstract base class for facilities that can create connections to an SQL database.
Inheritance
Level | Ancestor | Description |
---|---|---|
1 | TObject | Ultimate ancestor in a class hierarchy |
2 | TBaseObject | A base class for objects that can be used instead of TObject . |
3 | TSqlDatabaseConnector |
Source
Sql.Database.Connector.pas (31)
Description
Use OpenConnection
to aquire a connection to an SQL database. Every call to OpenConnection
should
be matched with a call to CloseConnection
to allow specific implementations to properly keep track of the connections
that have been published and not have been returned. Please use the following skeleton to protect database connections in case of
an exception:
1
2
3
4
5
6
7
Connection := Connector.OpenConnection();
try
DoSomethingWith(Connection);
finally
Connector.CloseConnection(Connection);
end;
Implementations of TSqlDatabaseConnector
are free to reuse existing connections as long as those connections have been
properly returned using a call to CloseConnection
.
Methods
Scope | Visibility | Result | Name | Description |
---|---|---|---|---|
Instance | protected | TSqlConnectionSettings | GetSettings() | |
Instance | public | TText | ToText() | |
Instance | public | TSqlDatabase | OpenConnection() | |
Instance | public | CloseConnection(Database: TSqlDatabase) | ||
Instance | public | TBoolean | IsFileBased() | |
Instance | public | TBoolean | CanConnect() | |
Type | public | TSqlDatabaseConnector | CreateFor(Settings: TSqlConnectionSettings; Pooling: TBoolean) |