Componentes.Terceros.RemObj.../official/5.0.24.615/Data Abstract for Delphi/Source/uDAADOInterfaces.pas

613 lines
22 KiB
ObjectPascal

unit uDAADOInterfaces;
{----------------------------------------------------------------------------}
{ Data Abstract Library - Core Library }
{ }
{ compiler: Delphi 6 and up }
{ platform: Win32 }
{ }
{ (c)opyright RemObjects Software. all rights reserved. }
{ }
{ Using this code requires a valid license of the Data Abstract }
{ which can be obtained at http://www.remobjects.com. }
{----------------------------------------------------------------------------}
{$I DataAbstract.inc}
interface
uses
uDAInterfaces, uDAEngine, uROClasses;
const
stdMSSQL_ConnectionString = 'User ID=%s;Password=%s;Initial Catalog=%s;Data Source=%s';
// OLE DB Services = -2 means we don't want ADO Connection pooling done for us!
stdADO_ConnectionString = 'Provider=%s;' + stdMSSQL_ConnectionString + ';OLE DB SERVICES=-2';
MSSQL_DriverType = 'MSSQL';
Access_DriverType = 'Access';
FoxPro_DriverType ='FoxPro';
ODBC_DriverType = '';//'ODBC';
ASA_DriverType = 'ASA';
Sybase_DriverType = 'Sybase';
Informix_DriverType = 'Informix';
DB2_DriverType = 'DB2';
Paradox_DriverType = 'Paradox';
const
// Standard OLEDB providers identifiers
oledb_UnknownId = '???';
oledb_MSSQLId = 'SQLOLEDB.1';
oledb_JetId = 'Microsoft.Jet.OLEDB.4.0';
oledb_OracleId = 'MSDAORA.1';
oledb_ODBCId = 'MSDASQL.1';
oledb_MSSQL2005Id ='SQLNCLI.1';
oledb_PostgresqlId = 'PostgreSQL.1';
oleDb_VisualFoxProId = 'VFPOLEDB.1';
type
// Standard OLEDB providers enumerated
TDAOleDBProviderType = (oledb_Unknown,
oledb_MSSQL,
oledb_Jet,
oledb_Oracle,
oledb_ODBC,
oledb_MSSQL2005,
oledb_Postgresql,
oleDb_VisualFoxPro);
const
// Standard OLEDB providers identifier array (useful for lookups)
OleDBProviders: array[TDAOleDBProviderType] of string = (
oledb_UnknownId,
oledb_MSSQLId,
oledb_JetId,
oledb_OracleId,
oledb_ODBCId,
oledb_MSSQL2005Id,
oledb_PostgresqlId,
oleDb_VisualFoxProId);
type
{ IADOConnection
For identification purposes. Implemented by all ADO connections and also those that target MSSQL-only such as SDAC }
IDAADOConnection = interface(IDAConnection)
['{979D10CF-FD56-4C16-8074-338CADA9F1CD}']
function GetProviderName: string; safecall;
function GetProviderType: TDAOleDBProviderType; safecall;
property ProviderName: string read GetProviderName;
property ProviderType: TDAOleDBProviderType read GetProviderType;
function GetCommandTimeout: Integer; safecall;
procedure SetCommandTimeout(const Value: Integer); safecall;
property CommandTimeout: Integer read GetCommandTimeout write SetCommandTimeout;
end;
TDAMSConnection = class(TDAEConnection,IDACanQueryDatabaseNames)
protected
fMSSQLSchemaEnabled: Boolean;
procedure DoGetTableNames(out List: IROStrings); override;
procedure DoGetStoredProcedureNames(out List: IROStrings); override;
procedure DoGetViewNames(out List: IROStrings); override;
function DoGetLastAutoInc(const GeneratorName: string): integer; override;
function CreateMacroProcessor: TDASQLMacroProcessor; override;
procedure DoGetTableFields(const aTableName: string; out Fields: TDAFieldCollection); override;
procedure DoGetForeignKeys(out ForeignKeys: TDADriverForeignKeyCollection); override;
function GetSPSelectSyntax(HasArguments: Boolean): String; override;safecall;
function IdentifierNeedsQuoting(const iIdentifier: string): boolean; override; safecall;
// IDACanQueryDatabaseNames
function GetDatabaseNames: IROStrings;
public
property MSSQLSchemaEnabled: Boolean read fMSSQLSchemaEnabled write fMSSQLSchemaEnabled;
end;
TDAMSSQLDriver = class(TDAEDriver)
protected
function GetDefaultConnectionType(const AuxDriver: string): string; override; safecall;
end;
function OleDBDriverIdToOleDBProviderType(const anID: string): TDAOleDBProviderType;
procedure MSSQL_GetAuxParams(const List: IROStrings);
procedure MSSQL_DoGetNames(Query: IDADataset; AList: IROStrings; AObjectType: TDAObjecttype; SchemaEnabled: Boolean);
function MSSQL_DoGetLastAutoInc(const GeneratorName: string;Query: IDADataset): integer;
function MSSQL_CreateMacroProcessor: TDASQLMacroProcessor;
procedure MSSQL_DoGetTableFields(const aTableName: string; Query: IDADataset; out Fields: TDAFieldCollection);
procedure MSSQL_DoGetForeignKeys(Query: IDADataset; ForeignKeys: TDADriverForeignKeyCollection; SchemaEnabled: Boolean);
function MSSQL_GetSPSelectSyntax(HasArguments: Boolean): String;
function MSSQL_IdentifierNeedsQuoting(const iIdentifier: string): boolean;
function MSSQL_GetQuoteChars: TDAQuoteCharArray;
function MSSQL_GetDatabaseNames(aConnection:TDAEConnection): IROStrings;
implementation
uses
SysUtils, Windows,
uDAMacroProcessors;
const
MSSQL_MasterDatabase = 'master';
MSSQL_GetDatabaseNames_SQL = 'select Name from sysdatabases order by Name';
var
ado_reservedwords: array of string;
function OleDBDriverIdToOleDBProviderType(const anID: string): TDAOleDBProviderType;
var
x: TDAOleDBProviderType;
begin
result := oledb_Unknown;
for x := Low(TDAOleDBProviderType) to High(TDAOleDBProviderType) do
if SameText(OleDBProviders[x], anID) then begin
result := x;
Exit;
end;
end;
procedure MSSQL_GetAuxParams(const List: IROStrings);
begin
List.Add('Integrated Security=SSPI');
List.Add('Schemas=0,1');
end;
procedure MSSQL_DoGetNames(Query: IDADataset; AList: IROStrings; AObjectType: TDAObjecttype; SchemaEnabled: Boolean);
var
fWhere: string;
begin
try
case AObjectType of
dotTable: begin
if not SchemaEnabled then fWhere:='AND (TABLE_SCHEMA = ''dbo'') ';
Query.SQL := 'SELECT TABLE_SCHEMA, TABLE_NAME FROM INFORMATION_SCHEMA.TABLES ' +
'WHERE (OBJECTPROPERTY(OBJECT_ID(TABLE_SCHEMA + ''.'' + TABLE_NAME), ''IsMsShipped'') = 0) ' +
'AND (TABLE_TYPE = ''BASE TABLE'') ' +fWhere+
'ORDER BY 1, 2';
end;
dotProcedure: begin
if not SchemaEnabled then fWhere:='AND (ROUTINE_SCHEMA = ''dbo'') ';
Query.SQL := 'SELECT ROUTINE_SCHEMA, ROUTINE_NAME ' +
'FROM INFORMATION_SCHEMA.ROUTINES ' +
'WHERE (OBJECTPROPERTY(OBJECT_ID(ROUTINE_SCHEMA + ''.'' + ROUTINE_NAME), ''IsMsShipped'') = 0) AND (ROUTINE_TYPE = ''PROCEDURE'') ' +fWhere+
'ORDER BY 1, 2';
end;
dotView: begin
if not SchemaEnabled then fWhere:='AND (TABLE_SCHEMA = ''dbo'') ';
Query.SQL := 'SELECT TABLE_SCHEMA, TABLE_NAME FROM INFORMATION_SCHEMA.TABLES ' +
'WHERE (OBJECTPROPERTY(OBJECT_ID(TABLE_SCHEMA + ''.'' + TABLE_NAME), ''IsMsShipped'') = 0) ' +
'AND (TABLE_TYPE = ''VIEW'') ' +
'ORDER BY 1, 2';
end;
else
end;
Query.Open;
while not Query.EOF do begin
if SchemaEnabled then
AList.Add(Format('%s.%s', [Trim(Query.Fields[0].AsString), Trim(Query.Fields[1].AsString)]))
else
AList.Add(Trim(Query.Fields[1].AsString));
Query.Next;
end;
Query.Close;
finally
Query := nil;
end;
end;
function MSSQL_DoGetLastAutoInc(const GeneratorName: string;Query: IDADataset): integer;
begin
try
if Trim(GeneratorName) <> '' then
Query.SQL := 'SELECT IsNull(Ident_Current(' + QuotedStr(GeneratorName) + '), 0) as LastInc'
else
Query.SQL := 'SELECT IsNull(@@Identity, 0) as LastInc';
Query.Open;
result := Query.Fields[0].Value;
finally
Query := nil;
end;
end;
function MSSQL_CreateMacroProcessor: TDASQLMacroProcessor;
begin
Result := TDAMSSQLMacroProcessor.Create;
end;
procedure MSSQL_DoGetTableFields(const aTableName: string; Query: IDADataset; out Fields: TDAFieldCollection);
var
dra: TDAField;
schema, tbl, fwhere: string;
begin
Fields := TDAFieldCollection.Create(nil);
try
Query.SQL := 'SELECT * FROM ' + aTableName + ' WHERE 1=0';
Query.Open;
Fields.Assign(Query.Fields);
Query.Close;
if Pos('.', aTableName) > 0 then
begin
schema := Trim(Copy(aTableName, 1, Pos('.', aTableName) - 1));
tbl := Trim(Copy(aTableName, Pos('.', aTableName) + 1, Length(aTableName)));
fwhere:=' AND (INFORMATION_SCHEMA.COLUMNS.TABLE_SCHEMA = ' + QuotedStr(schema) + ') '
end else
begin
schema := '';
tbl := aTableName;
end;
Query.SQL := 'exec sp_MShelpcolumns '+QuotedStr(aTableName)+', null, ''id'', 1;';
Query.Open;
try
while not Query.Eof do begin
dra := Fields.FindField(Trim(Query.FieldByName('COL_NAME').AsString));
if Assigned(dra) then
begin
dra.InPrimaryKey := (Query.FieldByName('COL_FLAGS').AsInteger and $04) = $04;
dra.Required := not Query.FieldByName('COL_NULL').AsBoolean;
if Query.FieldByName('COL_IDENTITY').AsBoolean then begin
if (dra.DataType = datLargeInt) or (dra.DataType = datLargeUInt) then
dra.DataType := datLargeAutoInc
else
dra.DataType := datAutoInc;
dra.GeneratorName := aTableName;
end;
if
(AnsiCompareText(Query.FieldByName('COL_BASETYPENAME').asString,'uniqueidentifier') =0) then
dra.DataType := datGuid
else
if
(AnsiCompareText(Query.FieldByName('COL_BASETYPENAME').asString,'money') =0) or
(AnsiCompareText(Query.FieldByName('COL_BASETYPENAME').asString,'smallmoney') =0) then
dra.DataType := datDecimal;
end;
Query.Next;
end;
finally
Query.Close;
end;
finally
Query:=nil;
end;
end;
procedure MSSQL_DoGetForeignKeys(Query: IDADataset; ForeignKeys: TDADriverForeignKeyCollection; SchemaEnabled: Boolean);
var
fWhere: String;
begin
try
if not SchemaEnabled then fWhere:=' AND (KCU1.TABLE_SCHEMA = ''dbo'') AND (KCU2.TABLE_SCHEMA = ''dbo'') ';
Query.SQL := 'SELECT ' +
'KCU1.CONSTRAINT_NAME AS CONSTRAINT_NAME, ' +
'KCU1.TABLE_SCHEMA AS FK_TABLE_SCHEMA, ' +
'KCU1.TABLE_NAME AS FK_TABLE_NAME, ' +
'KCU1.COLUMN_NAME AS FK_COLUMN_NAME, ' +
'KCU2.TABLE_SCHEMA AS PK_TABLE_SCHEMA, ' +
'KCU2.TABLE_NAME AS PK_TABLE_NAME, ' +
'KCU2.COLUMN_NAME AS PK_COLUMN_NAME ' +
'FROM ' +
'INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS RC ' +
'JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE KCU1 ON ' +
'KCU1.CONSTRAINT_CATALOG = RC.CONSTRAINT_CATALOG AND KCU1.CONSTRAINT_SCHEMA = RC.CONSTRAINT_SCHEMA AND KCU1.CONSTRAINT_NAME = RC.CONSTRAINT_NAME ' +
'JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE KCU2 ON ' +
'KCU2.CONSTRAINT_CATALOG = RC.UNIQUE_CONSTRAINT_CATALOG AND KCU2.CONSTRAINT_SCHEMA = RC.UNIQUE_CONSTRAINT_SCHEMA AND KCU2.CONSTRAINT_NAME = RC.UNIQUE_CONSTRAINT_NAME AND KCU2.ORDINAL_POSITION = KCU1.ORDINAL_POSITION ' + fWhere+
'ORDER BY ' +
'KCU1.TABLE_NAME, KCU1.CONSTRAINT_NAME, KCU2.TABLE_NAME, KCU1.ORDINAL_POSITION';
Query.Open;
while not Query.Eof do
begin
with ForeignKeys.Add() do begin
Name := Trim(Query.FieldByName('CONSTRAINT_NAME').AsString);
FKField := Trim(Query.FieldByName('FK_COLUMN_NAME').AsString);
PKField := Trim(Query.FieldByName('PK_COLUMN_NAME').AsString);
if SchemaEnabled then begin
FKTable := Format('%s.%s', [Trim(Query.FieldByName('FK_TABLE_SCHEMA').AsString), Trim(Query.FieldByName('FK_TABLE_NAME').AsString)]);
PKTable := Format('%s.%s', [Trim(Query.FieldByName('PK_TABLE_SCHEMA').AsString), Trim(Query.FieldByName('PK_TABLE_NAME').AsString)]);
end else
begin
FKTable := Trim(Query.FieldByName('FK_TABLE_NAME').AsString);
PKTable := Trim(Query.FieldByName('PK_TABLE_NAME').AsString);
end;
end;
Query.Next;
end;
Query.Close;
finally
Query := nil;
end;
end;
function MSSQL_GetSPSelectSyntax(HasArguments: Boolean): String;
begin
Result := 'EXEC {0} {1}';
end;
function MSSQL_IdentifierNeedsQuoting(const iIdentifier: string): boolean;
var
L,H,I, r: Integer;
begin
result := False;
l := 0;
h := Length(ado_reservedwords) -1;
while l <= h do begin
i := (L + H) shr 1;
r := CompareText(iIdentifier, ado_reservedwords[i]);
if r < 0 then h := i - 1 else
if r > 0 then l := i + 1 else
begin
result := true;
exit;
end;
end;
end;
function MSSQL_GetQuoteChars: TDAQuoteCharArray;
begin
result[0] := '[';
result[1] := ']';
end;
function MSSQL_GetDatabaseNames(aConnection:TDAEConnection): IROStrings;
begin
Result := Engine_GetDatabaseNames(aConnection, MSSQL_MasterDatabase, MSSQL_GetDatabaseNames_SQL);
end;
{ TDAMSConnection }
function TDAMSConnection.CreateMacroProcessor: TDASQLMacroProcessor;
begin
Result := MSSQL_CreateMacroProcessor;
end;
procedure TDAMSConnection.DoGetForeignKeys(
out ForeignKeys: TDADriverForeignKeyCollection);
begin
inherited;
MSSQL_DoGetForeignKeys(GetDatasetClass.Create(Self), ForeignKeys, MSSQLSchemaEnabled);
end;
function TDAMSConnection.DoGetLastAutoInc(const GeneratorName: string): integer;
begin
Result := MSSQL_DoGetLastAutoInc(GeneratorName,GetDatasetClass.Create(Self));
end;
procedure TDAMSConnection.DoGetStoredProcedureNames(out List: IROStrings);
begin
inherited DoGetStoredProcedureNames(List);
MSSQL_DoGetNames(GetDatasetClass.Create(Self),List,dotProcedure,MSSQLSchemaEnabled);
end;
procedure TDAMSConnection.DoGetTableFields(const aTableName: string;
out Fields: TDAFieldCollection);
begin
MSSQL_DoGetTableFields(QuoteIdentifierIfNeeded(aTableName),GetDatasetClass.Create(Self),Fields);
end;
procedure TDAMSConnection.DoGetTableNames(out List: IROStrings);
begin
inherited DoGetTableNames(List);
MSSQL_DoGetNames(GetDatasetClass.Create(Self),List,dotTable,MSSQLSchemaEnabled);
end;
procedure TDAMSConnection.DoGetViewNames(out List: IROStrings);
begin
inherited DoGetViewNames(List);
MSSQL_DoGetNames(GetDatasetClass.Create(Self),List,dotView,MSSQLSchemaEnabled);
end;
function TDAMSConnection.GetDatabaseNames: IROStrings;
begin
Result := MSSQL_GetDatabaseNames(Self);
end;
function TDAMSConnection.GetSPSelectSyntax(HasArguments: Boolean): String;
begin
Result := MSSQL_GetSPSelectSyntax(HasArguments);
end;
procedure ADO_InitializeReservedWords;
begin
SetLength(ado_reservedwords, 179);
ado_reservedwords[0] := 'ADD';
ado_reservedwords[1] := 'ALL';
ado_reservedwords[2] := '179';
ado_reservedwords[3] := 'AND';
ado_reservedwords[4] := 'ANY';
ado_reservedwords[5] := 'AS';
ado_reservedwords[6] := 'ASC';
ado_reservedwords[7] := 'AUTHORIZATION';
ado_reservedwords[8] := 'BACKUP';
ado_reservedwords[9] := 'BEGIN';
ado_reservedwords[10] := 'BETWEEN';
ado_reservedwords[11] := 'BREAK';
ado_reservedwords[12] := 'BROWSE';
ado_reservedwords[13] := 'BULK';
ado_reservedwords[14] := 'BY';
ado_reservedwords[15] := 'CASCADE';
ado_reservedwords[16] := 'CASE';
ado_reservedwords[17] := 'CHECK';
ado_reservedwords[18] := 'CHECKPOINT';
ado_reservedwords[19] := 'CLOSE';
ado_reservedwords[20] := 'CLUSTERED';
ado_reservedwords[21] := 'COALESCE';
ado_reservedwords[22] := 'COLLATE';
ado_reservedwords[23] := 'COLUMN';
ado_reservedwords[24] := 'COMMIT';
ado_reservedwords[25] := 'COMPUTE';
ado_reservedwords[26] := 'CONSTRAINT';
ado_reservedwords[27] := 'CONTAINS';
ado_reservedwords[28] := 'CONTAINSTABLE';
ado_reservedwords[29] := 'CONTINUE';
ado_reservedwords[30] := 'CONVERT';
ado_reservedwords[31] := 'CREATE';
ado_reservedwords[32] := 'CROSS';
ado_reservedwords[33] := 'CURRENT';
ado_reservedwords[34] := 'CURRENT_DATE';
ado_reservedwords[35] := 'CURRENT_TIME';
ado_reservedwords[36] := 'CURRENT_TIMESTAMP';
ado_reservedwords[37] := 'CURRENT_USER';
ado_reservedwords[38] := 'CURSOR';
ado_reservedwords[39] := 'DATABASE';
ado_reservedwords[40] := 'DBCC';
ado_reservedwords[41] := 'DEALLOCATE';
ado_reservedwords[42] := 'DECLARE';
ado_reservedwords[43] := 'DEFAULT';
ado_reservedwords[44] := 'DELETE';
ado_reservedwords[45] := 'DENY';
ado_reservedwords[46] := 'DESC';
ado_reservedwords[47] := 'DISK';
ado_reservedwords[48] := 'DISTINCT';
ado_reservedwords[49] := 'DISTRIBUTED';
ado_reservedwords[50] := 'DOUBLE';
ado_reservedwords[51] := 'DROP';
ado_reservedwords[52] := 'DUMMY';
ado_reservedwords[53] := 'DUMP';
ado_reservedwords[54] := 'ELSE';
ado_reservedwords[55] := 'END';
ado_reservedwords[56] := 'ERRLVL';
ado_reservedwords[57] := 'ESCAPE';
ado_reservedwords[58] := 'EXCEPT';
ado_reservedwords[59] := 'EXEC';
ado_reservedwords[60] := 'EXECUTE';
ado_reservedwords[61] := 'EXISTS';
ado_reservedwords[62] := 'EXIT';
ado_reservedwords[63] := 'EXTERNAL';
ado_reservedwords[64] := 'FETCH';
ado_reservedwords[65] := 'FILE';
ado_reservedwords[66] := 'FILLFACTOR';
ado_reservedwords[67] := 'FOR';
ado_reservedwords[68] := 'FOREIGN';
ado_reservedwords[69] := 'FREETEXT';
ado_reservedwords[70] := 'FREETEXTTABLE';
ado_reservedwords[71] := 'FROM';
ado_reservedwords[72] := 'FULL';
ado_reservedwords[73] := 'FUNCTION';
ado_reservedwords[74] := 'GOTO';
ado_reservedwords[75] := 'GRANT';
ado_reservedwords[76] := 'GROUP';
ado_reservedwords[77] := 'HAVING';
ado_reservedwords[78] := 'HOLDLOCK';
ado_reservedwords[79] := 'IDENTITY';
ado_reservedwords[80] := 'IDENTITY_INSERT';
ado_reservedwords[81] := 'IDENTITYCOL';
ado_reservedwords[82] := 'IF';
ado_reservedwords[83] := 'IN';
ado_reservedwords[84] := 'INDEX';
ado_reservedwords[85] := 'INNER';
ado_reservedwords[86] := 'INSERT';
ado_reservedwords[87] := 'INTERSECT';
ado_reservedwords[88] := 'INTO';
ado_reservedwords[89] := 'IS';
ado_reservedwords[90] := 'JOIN';
ado_reservedwords[91] := 'KEY';
ado_reservedwords[92] := 'KILL';
ado_reservedwords[93] := 'LEFT';
ado_reservedwords[94] := 'LIKE';
ado_reservedwords[95] := 'LINENO';
ado_reservedwords[96] := 'LOAD';
ado_reservedwords[97] := 'NATIONAL';
ado_reservedwords[98] := 'NOCHECK';
ado_reservedwords[99] := 'NONCLUSTERED';
ado_reservedwords[100] := 'NOT';
ado_reservedwords[101] := 'NULL';
ado_reservedwords[102] := 'NULLIF';
ado_reservedwords[103] := 'OF';
ado_reservedwords[104] := 'OFF';
ado_reservedwords[105] := 'OFFSETS';
ado_reservedwords[106] := 'ON';
ado_reservedwords[107] := 'OPEN';
ado_reservedwords[108] := 'OPENDATASOURCE';
ado_reservedwords[109] := 'OPENQUERY';
ado_reservedwords[110] := 'OPENROWSET';
ado_reservedwords[111] := 'OPENXML';
ado_reservedwords[112] := 'OPTION';
ado_reservedwords[113] := 'OR';
ado_reservedwords[114] := 'ORDER';
ado_reservedwords[115] := 'OUTER';
ado_reservedwords[116] := 'OVER';
ado_reservedwords[117] := 'PERCENT';
ado_reservedwords[118] := 'PIVOT';
ado_reservedwords[119] := 'PLAN';
ado_reservedwords[120] := 'PRECISION';
ado_reservedwords[121] := 'PRIMARY';
ado_reservedwords[122] := 'PRINT';
ado_reservedwords[123] := 'PROC';
ado_reservedwords[124] := 'PROCEDURE';
ado_reservedwords[125] := 'PUBLIC';
ado_reservedwords[126] := 'RAISERROR';
ado_reservedwords[127] := 'READ';
ado_reservedwords[128] := 'READTEXT';
ado_reservedwords[129] := 'RECONFIGURE';
ado_reservedwords[130] := 'REFERENCES';
ado_reservedwords[131] := 'REPLICATION';
ado_reservedwords[132] := 'RESTORE';
ado_reservedwords[133] := 'RESTRICT';
ado_reservedwords[134] := 'RETURN';
ado_reservedwords[135] := 'REVERT';
ado_reservedwords[136] := 'REVOKE';
ado_reservedwords[137] := 'RIGHT';
ado_reservedwords[138] := 'ROLLBACK';
ado_reservedwords[139] := 'ROWCOUNT';
ado_reservedwords[140] := 'ROWGUIDCOL';
ado_reservedwords[141] := 'RULE';
ado_reservedwords[142] := 'SAVE';
ado_reservedwords[143] := 'SCHEMA';
ado_reservedwords[144] := 'SELECT';
ado_reservedwords[145] := 'SESSION_USER';
ado_reservedwords[146] := 'SET';
ado_reservedwords[147] := 'SETUSER';
ado_reservedwords[148] := 'SHUTDOWN';
ado_reservedwords[149] := 'SOME';
ado_reservedwords[150] := 'STATISTICS';
ado_reservedwords[151] := 'SYSTEM_USER';
ado_reservedwords[152] := 'TABLE';
ado_reservedwords[153] := 'TABLESAMPLE';
ado_reservedwords[154] := 'TEXTSIZE';
ado_reservedwords[155] := 'THEN';
ado_reservedwords[156] := 'TO';
ado_reservedwords[157] := 'TOP';
ado_reservedwords[158] := 'TRAN';
ado_reservedwords[159] := 'TRANSACTION';
ado_reservedwords[160] := 'TRIGGER';
ado_reservedwords[161] := 'TRUNCATE';
ado_reservedwords[162] := 'TSEQUAL';
ado_reservedwords[163] := 'UNION';
ado_reservedwords[164] := 'UNIQUE';
ado_reservedwords[165] := 'UNPIVOT';
ado_reservedwords[166] := 'UPDATE';
ado_reservedwords[167] := 'UPDATETEXT';
ado_reservedwords[168] := 'USE';
ado_reservedwords[169] := 'USER';
ado_reservedwords[170] := 'VALUES';
ado_reservedwords[171] := 'VARYING';
ado_reservedwords[172] := 'VIEW';
ado_reservedwords[173] := 'WAITFOR';
ado_reservedwords[174] := 'WHEN';
ado_reservedwords[175] := 'WHERE';
ado_reservedwords[176] := 'WHILE';
ado_reservedwords[177] := 'WITH';
ado_reservedwords[178] := 'WRITETEXT';
end;
function TDAMSConnection.IdentifierNeedsQuoting(
const iIdentifier: string): boolean;
begin
Result := inherited IdentifierNeedsQuoting(iIdentifier) or MSSQL_IdentifierNeedsQuoting(iIdentifier);
end;
{ TDAMSSQLDriver }
function TDAMSSQLDriver.GetDefaultConnectionType(
const AuxDriver: string): string;
begin
Result := MSSQL_DriverType;
end;
initialization
ado_InitializeReservedWords;
finalization
ado_reservedwords := nil;
end.