Browse Source

* Fixed parameters if a query is executed for the second time
* Truncate stringfields at dsMaxStringSize

git-svn-id: trunk@9091 -

joost 18 years ago
parent
commit
306670c74a

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

@@ -363,6 +363,7 @@ begin
                   System.Delete(FD,1,fi);
                   System.Delete(FD,1,fi);
                   fi:=pos(')',FD);
                   fi:=pos(')',FD);
                   size1:=StrToIntDef(trim(copy(FD,1,fi-1)),255);
                   size1:=StrToIntDef(trim(copy(FD,1,fi-1)),255);
+                  if size1 > dsMaxStringSize then size1 := dsMaxStringSize;
                   end
                   end
                 else size1 := 255;
                 else size1 := 255;
                 end;
                 end;
@@ -388,7 +389,7 @@ var
             
             
 begin
 begin
   SC:=TSQLite3Cursor(cursor);
   SC:=TSQLite3Cursor(cursor);
-  If (AParams<>Nil) then
+  If (AParams<>Nil) and (AParams.count > 0) then
     SC.BindParams(AParams);
     SC.BindParams(AParams);
   SC.Execute;    
   SC.Execute;    
 end;
 end;

+ 1 - 1
packages/fcl-db/tests/testsqlfieldtypes.pas

@@ -27,10 +27,10 @@ type
     procedure RunTest; override;
     procedure RunTest; override;
   published
   published
     procedure TestInsertLargeStrFields; // bug 9600
     procedure TestInsertLargeStrFields; // bug 9600
+    procedure Test11Params;
     procedure TestRowsAffected; // bug 9758
     procedure TestRowsAffected; // bug 9758
     procedure TestStringsReplace;
     procedure TestStringsReplace;
     procedure TestCircularParams;
     procedure TestCircularParams;
-    procedure Test11Params;
     procedure TestBug9744;
     procedure TestBug9744;
     procedure TestCrossStringDateParam;
     procedure TestCrossStringDateParam;
     procedure TestGetFieldNames;
     procedure TestGetFieldNames;