Declaration¶
Source position: mssqlconn.pp line 57
type
TMSSQLConnection = class(TSQLConnection)
public
constructor Create;
function GetConnectionInfo : string;
procedure CreateDB;
procedure DropDB;
published
property Password;
property Transaction;
property UserName;
property CharSet;
property HostName;
property Connected;
property Role;
property DatabaseName;
property KeepConnection;
property LoginPrompt;
property Params;
property OnLogin;
end;
Inheritance¶
Description¶
Connector to Microsoft SQL Server databases.
Requirements:
MS SQL Server Client Library is required (ntwdblib.dll)
- or -
FreeTDS (dblib.dll)
Older FreeTDS libraries may require freetds.conf: (http://www.freetds.org/userguide/freetdsconf.htm)
[global]
tds version = 7.1
client charset = UTF-8
port = 1433 or instance = ... (optional)
dump file = freetds.log (optional)
text size = 2147483647 (optional)
Known problems:
- CHAR/VARCHAR data truncated to column length when encoding to UTF-8 (use NCHAR/NVARCHAR instead or CAST char/varchar to nchar/nvarchar)
- Multiple result sets (MARS) are not supported (for example when SP returns more than 1 result set only 1st is processed)
- DB-Library error 10038 "Results Pending": set TSQLQuery.PacketRecords=-1 to fetch all pending rows
- BLOB data (IMAGE/TEXT columns) larger than 16MB are truncated to 16MB: (set TMSSQLConnection.Params: 'TEXTSIZE=2147483647' or execute 'SET TEXTSIZE 2147483647')
Properties¶
| Member | Visibility | Description |
|---|---|---|
| CharSet read only | published | |
| Connected read only | published | Is the connection active. |
| DatabaseName read only | published | |
| HostName read only | published | Host and optionally port or instance. |
| KeepConnection read only | published | Keep connection alive. |
| LoginPrompt read only | published | Show login prompt. |
| Params read only | published | |
| Password read only | published | |
| Role read only | published | Role for user. |
| Transaction read only | published | Default transaction. |
| UserName read only | published |
Methods¶
| Member | Visibility | Description |
|---|---|---|
| Create | public | Create a new instance of TMSSQLConnection. |
| CreateDB | public | Create a new MS SQL database. |
| DropDB | public | Drop a MS SQL database. |
| GetConnectionInfo | public | Return some information about the connection. |
Events¶
| Member | Visibility | Description |
|---|---|---|
| OnLogin read only | published | Called when logging in. |