mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-18 02:09:14 +02:00
* implementation of sqSupportEmptyDatabaseName from Laco, used in PostGres and MSSQL
git-svn-id: trunk@25584 -
This commit is contained in:
parent
d801548604
commit
48250dcafd
@ -314,7 +314,7 @@ end;
|
|||||||
constructor TMSSQLConnection.Create(AOwner: TComponent);
|
constructor TMSSQLConnection.Create(AOwner: TComponent);
|
||||||
begin
|
begin
|
||||||
inherited Create(AOwner);
|
inherited Create(AOwner);
|
||||||
FConnOptions := FConnOptions + [sqEscapeRepeat];
|
FConnOptions := FConnOptions + [sqSupportEmptyDatabaseName, sqEscapeRepeat];
|
||||||
//FieldNameQuoteChars:=DoubleQuotes; //default
|
//FieldNameQuoteChars:=DoubleQuotes; //default
|
||||||
Ftds := DBTDS_UNKNOWN;
|
Ftds := DBTDS_UNKNOWN;
|
||||||
end;
|
end;
|
||||||
@ -397,21 +397,9 @@ const
|
|||||||
CURSOR_CLOSE_ON_COMMIT_OFF: array[boolean] of shortstring = ('SET CURSOR_CLOSE_ON_COMMIT OFF', 'SET CLOSE ON ENDTRAN OFF');
|
CURSOR_CLOSE_ON_COMMIT_OFF: array[boolean] of shortstring = ('SET CURSOR_CLOSE_ON_COMMIT OFF', 'SET CLOSE ON ENDTRAN OFF');
|
||||||
VERSION_NUMBER: array[boolean] of shortstring = ('SERVERPROPERTY(''ProductVersion'')', '@@version_number');
|
VERSION_NUMBER: array[boolean] of shortstring = ('SERVERPROPERTY(''ProductVersion'')', '@@version_number');
|
||||||
|
|
||||||
Var
|
|
||||||
B : Boolean;
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
// Do not call the inherited method as it checks for a non-empty DatabaseName, empty DatabaseName=default database defined for login
|
// empty DatabaseName=default database defined for login
|
||||||
// MVC: Inherited MUST be called to do housekeeping.
|
inherited DoInternalConnect;
|
||||||
B:=DatabaseName='';
|
|
||||||
if B then
|
|
||||||
DatabaseName:='Dummy';
|
|
||||||
try
|
|
||||||
inherited DoInternalConnect;
|
|
||||||
finally
|
|
||||||
if B then
|
|
||||||
DatabaseName:='';
|
|
||||||
end;
|
|
||||||
|
|
||||||
InitialiseDBLib(DBLibLibraryName);
|
InitialiseDBLib(DBLibLibraryName);
|
||||||
|
|
||||||
|
@ -224,7 +224,7 @@ constructor TPQConnection.Create(AOwner : TComponent);
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
FConnOptions := FConnOptions + [sqSupportParams] + [sqEscapeRepeat] + [sqEscapeSlash];
|
FConnOptions := FConnOptions + [sqSupportParams, sqSupportEmptyDatabaseName, sqEscapeRepeat, sqEscapeSlash];
|
||||||
FieldNameQuoteChars:=DoubleQuotes;
|
FieldNameQuoteChars:=DoubleQuotes;
|
||||||
VerboseErrors:=True;
|
VerboseErrors:=True;
|
||||||
FConnectionPool:=TThreadlist.Create;
|
FConnectionPool:=TThreadlist.Create;
|
||||||
|
@ -24,7 +24,7 @@ uses SysUtils, Classes, DB, bufdataset, sqlscript;
|
|||||||
|
|
||||||
type
|
type
|
||||||
TSchemaType = (stNoSchema, stTables, stSysTables, stProcedures, stColumns, stProcedureParams, stIndexes, stPackages, stSchemata);
|
TSchemaType = (stNoSchema, stTables, stSysTables, stProcedures, stColumns, stProcedureParams, stIndexes, stPackages, stSchemata);
|
||||||
TConnOption = (sqSupportParams,sqEscapeSlash,sqEscapeRepeat);
|
TConnOption = (sqSupportParams, sqSupportEmptyDatabaseName, sqEscapeSlash, sqEscapeRepeat);
|
||||||
TConnOptions= set of TConnOption;
|
TConnOptions= set of TConnOption;
|
||||||
TConnInfoType=(citAll=-1, citServerType, citServerVersion, citServerVersionString, citClientName, citClientVersion);
|
TConnInfoType=(citAll=-1, citServerType, citServerVersion, citServerVersionString, citClientName, citClientVersion);
|
||||||
TStatementType = (stUnknown, stSelect, stInsert, stUpdate, stDelete,
|
TStatementType = (stUnknown, stSelect, stInsert, stUpdate, stDelete,
|
||||||
@ -976,7 +976,7 @@ end;
|
|||||||
|
|
||||||
procedure TSQLConnection.DoInternalConnect;
|
procedure TSQLConnection.DoInternalConnect;
|
||||||
begin
|
begin
|
||||||
if (DatabaseName = '') then
|
if (DatabaseName = '') and not(sqSupportEmptyDatabaseName in FConnOptions) then
|
||||||
DatabaseError(SErrNoDatabaseName,self);
|
DatabaseError(SErrNoDatabaseName,self);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user