Browse Source

* Inherited must be called for Internal(Dis)Connect for housekeeping

git-svn-id: trunk@25056 -
michael 12 years ago
parent
commit
af1d33767d

+ 14 - 1
packages/fcl-db/src/sqldb/mssql/mssqlconn.pp

@@ -396,9 +396,22 @@ const
   ANSI_DEFAULTS_ON: array[boolean] of shortstring = ('SET ANSI_DEFAULTS ON', 'SET QUOTED_IDENTIFIER ON');
   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');
+  
+Var
+  B : Boolean;
+    
 begin
   // Do not call the inherited method as it checks for a non-empty DatabaseName, empty DatabaseName=default database defined for login
-  //inherited DoInternalConnect;
+  // MVC: Inherited MUST be called to do housekeeping.
+  B:=DatabaseName='';
+  if B then
+    DatabaseName:='Dummy';
+  try  
+    inherited DoInternalConnect;
+  finally
+    if B then 
+      DatabaseName:='';
+  end;
 
   InitialiseDBLib(DBLibLibraryName);
 

+ 1 - 0
packages/fcl-db/src/sqldb/postgres/pqconnection.pp

@@ -375,6 +375,7 @@ end;
 procedure TPQConnection.DoInternalDisconnect;
 var i:integer;
 begin
+  Inherited;
   for i:=0 to length(FConnectionPool)-1 do
     begin
     if assigned(FConnectionPool[i].FPGConn) then

+ 2 - 0
packages/fcl-db/src/sqldb/sqlite/sqlite3conn.pp

@@ -732,6 +732,7 @@ procedure TSQLite3Connection.DoInternalConnect;
 var
   str1: string;
 begin
+  Inherited;
   if Length(databasename)=0 then
     DatabaseError(SErrNoDatabaseName,self);
   InitializeSqlite(SQLiteDefaultLibrary);
@@ -746,6 +747,7 @@ end;
 procedure TSQLite3Connection.DoInternalDisconnect;
 
 begin
+  Inherited;
   if fhandle <> nil then 
     begin
     checkerror(sqlite3_close(fhandle));