Kaynağa Gözat

Merged revisions 9261-9262,9266,9269-9272,9276-9278,9295,9307-9308,9310,9322,9337,9340,9343-9344,9359,9373-9375,9387,9396,9399,9401-9402,9433-9434,9450-9456,9459-9463,9466,9468-9469,9472-9473,9476-9477,9480,9491-9492,9529,9536,9550,9566-9568,9571,9573,9576-9577,9579,9583,9587,9609 via svnmerge from
svn+ssh://[email protected]/FPC/svn/fpc/trunk

........
r9261 | joost | 2007-11-15 10:49:14 +0100 (Thu, 15 Nov 2007) | 1 line

* Patch from Leonardo M. Ram?\195?\169 which adds sqlite3 to the example
........
r9433 | michael | 2007-12-12 20:46:09 +0100 (Wed, 12 Dec 2007) | 1 line

* Setting TSQLQuery.Transaction sets TSQLQuery.Database and vice versa. Same for TSQLTransaction.Database and Database.Transaction
........
r9609 | joost | 2008-01-01 20:44:00 +0100 (Tue, 01 Jan 2008) | 1 line

* Fixed mysql ftLargeIntField + enabled test
........

git-svn-id: branches/fixes_2_2@9757 -

joost 17 yıl önce
ebeveyn
işleme
b095e1f1b5

+ 4 - 3
packages/fcl-db/src/sqldb/mysql/mysqlconn.inc

@@ -717,6 +717,7 @@ function TConnectionName.MySQLWriteData(AType: enum_field_types;ASize: Integer;
 
 var
   VI: Integer;
+  VL: LargeInt;
   VS: Smallint;
   VF: Double;
   VC: Currency;
@@ -749,10 +750,10 @@ begin
     FIELD_TYPE_LONGLONG:
       begin
       if (Src<>'') then
-        VI := StrToInt64(Src)
+        VL := StrToInt64(Src)
       else
-        VI := 0;
-      Move(VI, Dest^, SizeOf(LargeInt));
+        VL := 0;
+      Move(VL, Dest^, SizeOf(LargeInt));
       end;
 {$ifdef mysql50}
     FIELD_TYPE_NEWDECIMAL,

+ 7 - 0
packages/fcl-db/src/sqldb/sqldb.pp

@@ -454,6 +454,8 @@ begin
     if Assigned(Value) then
       Value.Database := Self;
     FTransaction := Value;
+    If Assigned(FTransaction) and (FTransaction.Database=Nil) then
+      FTransaction.Database:=Self;
     end;
 end;
 
@@ -726,6 +728,9 @@ begin
       with TSQLConnection(DataBase) do
         if Transaction = self then Transaction := nil;
     inherited SetDatabase(Value);
+    If Assigned(Database) then
+      If (TSQLConnection(DataBase).Transaction=Nil) then
+        TSQLConnection(DataBase).Transaction:=Self;
     end;
 end;
 
@@ -759,6 +764,8 @@ Procedure TCustomSQLQuery.SetTransaction(Value : TDBTransaction);
 begin
   UnPrepare;
   inherited;
+  If (Transaction<>Nil) and (Database=Nil) then
+    Database:=TSQLTransaction(Transaction).Database;
 end;
 
 procedure TCustomSQLQuery.SetDatabase(Value : TDatabase);

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

@@ -24,6 +24,7 @@ uses
   pqconnection,
   mysql4conn,
   IBConnection,
+  sqlite3conn,
   sqldb;
 
 var connection  : tSQLConnection;
@@ -37,6 +38,7 @@ begin
   if dbtype = 'mysql' then connection := tMySQLConnection.Create(nil);
   if dbtype = 'postgresql' then connection := tpqConnection.Create(nil);
   if dbtype = 'interbase' then connection := tIBConnection.Create(nil);
+  if dbtype = 'sqlite3' then connection := tSQLite3Connection.Create(nil);
 
   if not assigned(connection) then exit; // probably an invalid database type given
 

+ 2 - 0
packages/fcl-db/tests/sqldbtoolsunit.pas

@@ -103,6 +103,8 @@ begin
   if SQLDbType = MYSQL40 then Fconnection := tMySQL40Connection.Create(nil);
   if SQLDbType = MYSQL41 then Fconnection := tMySQL41Connection.Create(nil);
   if SQLDbType = MYSQL50 then Fconnection := tMySQL50Connection.Create(nil);
+  if SQLDbType in MySQLdbTypes then
+    FieldtypeDefinitions[ftLargeint] := 'BIGINT';
   if SQLDbType = sqlite3 then
     begin
     Fconnection := TSQLite3Connection.Create(nil);