Browse Source

--- Merging r22232 into '.':
U packages/fcl-db/tests/testfieldtypes.pas
U packages/fcl-db/src/sqldb/interbase/ibconnection.pp
--- Merging r22403 into '.':
U packages/fcl-db/src/sql/fpsqltree.pp
--- Merging r22468 into '.':
U packages/fcl-db/src/sqldb/sqldblib.pp

# revisions: 22232,22403,22468
r22232 | joost | 2012-08-24 17:56:37 +0200 (Fri, 24 Aug 2012) | 4 lines
Changed paths:
M /trunk/packages/fcl-db/src/sqldb/interbase/ibconnection.pp
M /trunk/packages/fcl-db/tests/testfieldtypes.pas

* Support Interbase 7 and Firebird 3 boolean fields
* Minor optimization using local VSQLVar variable
Patch by Lacak2, mantis 22698
r22403 | michael | 2012-09-16 16:05:37 +0200 (Sun, 16 Sep 2012) | 1 line
Changed paths:
M /trunk/packages/fcl-db/src/sql/fpsqltree.pp

* Fixed uninitialized string results
r22468 | michael | 2012-09-27 10:09:20 +0200 (Thu, 27 Sep 2012) | 1 line
Changed paths:
M /trunk/packages/fcl-db/src/sqldb/sqldblib.pp

Patch to fix type (Bug ID 22994)

git-svn-id: branches/fixes_2_6@22673 -

marco 13 years ago
parent
commit
fe44a93ca5

+ 30 - 8
packages/fcl-db/src/sql/fpsqltree.pp

@@ -1940,6 +1940,7 @@ Var
     I,Ind : Integer;
     I,Ind : Integer;
 
 
   begin
   begin
+    S:='';
     if Not Assigned(List) or (List.Count=0) then
     if Not Assigned(List) or (List.Count=0) then
       exit;
       exit;
     If (AkeyWord<>'') then
     If (AkeyWord<>'') then
@@ -2039,6 +2040,7 @@ Var
   UseNewLine : Boolean;
   UseNewLine : Boolean;
 
 
 begin
 begin
+  S:='';
   Result:=SQLKeyword('INSERT INTO ',Options);
   Result:=SQLKeyword('INSERT INTO ',Options);
   If Assigned(FTableName) then
   If Assigned(FTableName) then
     Result:=Result+TableName.GetAsSQL(Options,AIndent);
     Result:=Result+TableName.GetAsSQL(Options,AIndent);
@@ -2308,6 +2310,7 @@ Var
   Sep : String;
   Sep : String;
 
 
 begin
 begin
+  Result:='';
   Sep:=SQLListSeparator(Options);
   Sep:=SQLListSeparator(Options);
   If Assigned(FArguments) and (FArguments.Count>0) then
   If Assigned(FArguments) and (FArguments.Count>0) then
     For I:=0 to FArguments.Count-1 do
     For I:=0 to FArguments.Count-1 do
@@ -2317,7 +2320,6 @@ begin
       Result:=Result+Farguments[i].GetAsSQL(Options,AIndent);
       Result:=Result+Farguments[i].GetAsSQL(Options,AIndent);
       end;
       end;
   Result:=SQLKeyWord(Identifier,Options)+'('+Result+')';
   Result:=SQLKeyWord(Identifier,Options)+'('+Result+')';
-
 end;
 end;
 
 
 { TSQLTernaryExpression }
 { TSQLTernaryExpression }
@@ -2487,6 +2489,7 @@ Var
   S : String;
   S : String;
 
 
 begin
 begin
+  Result:='';
   GetSepPrefixIndent(sfoOneFieldPerLine in Options,sfoIndentfields in Options,Sep,Pref,Ind);
   GetSepPrefixIndent(sfoOneFieldPerLine in Options,sfoIndentfields in Options,Sep,Pref,Ind);
   For I:=0 to FieldDefs.Count-1 do
   For I:=0 to FieldDefs.Count-1 do
     begin
     begin
@@ -2541,6 +2544,7 @@ end;
 function TSQLConstraintDef.GetAsSQL(Options: TSQLFormatOptions; AIndent: Integer
 function TSQLConstraintDef.GetAsSQL(Options: TSQLFormatOptions; AIndent: Integer
   ): TSQLStringType;
   ): TSQLStringType;
 begin
 begin
+  Result:='';
   If Assigned(FConstraintName) then
   If Assigned(FConstraintName) then
     Result:=SQLKeyWord('CONSTRAINT ',Options)+FConstraintname.GetAsSQl(Options,AIndent);
     Result:=SQLKeyWord('CONSTRAINT ',Options)+FConstraintname.GetAsSQl(Options,AIndent);
 end;
 end;
@@ -2589,6 +2593,7 @@ Var
   I : Integer;
   I : Integer;
 
 
 begin
 begin
+  Result:='';
   Sep:=SQLListSeparator(Options);
   Sep:=SQLListSeparator(Options);
   For I:=0 to FieldList.Count-1 do
   For I:=0 to FieldList.Count-1 do
     begin
     begin
@@ -2713,6 +2718,7 @@ Var
 
 
 
 
 begin
 begin
+  Result:='';
   GetSepPrefixIndent(sfoOneFieldPerLine in Options,sfoIndentFields in Options,Sep,Pref,Ind);
   GetSepPrefixIndent(sfoOneFieldPerLine in Options,sfoIndentFields in Options,Sep,Pref,Ind);
   For I:=0 to Operations.Count-1 do
   For I:=0 to Operations.Count-1 do
     begin
     begin
@@ -2985,6 +2991,7 @@ Var
   I : integer;
   I : integer;
 
 
 begin
 begin
+  Result:='';
   If Assigned(FParams) and (FParams.Count>0) then
   If Assigned(FParams) and (FParams.Count>0) then
     begin
     begin
     For I:=0 to FParams.Count-1 do
     For I:=0 to FParams.Count-1 do
@@ -3167,6 +3174,7 @@ Var
   I : Integer;
   I : Integer;
   Sep : TSQLStringType;
   Sep : TSQLStringType;
 begin
 begin
+  Result:='';
   Sep:=SQLListSeparator(Options);
   Sep:=SQLListSeparator(Options);
   For I:=0 to FIndexes.Count-1 do
   For I:=0 to FIndexes.Count-1 do
     begin
     begin
@@ -3233,6 +3241,7 @@ Var
   I : Integer;
   I : Integer;
   Sep : String;
   Sep : String;
 begin
 begin
+  Result:='';
   Sep:=SQLListSeparator(Options);
   Sep:=SQLListSeparator(Options);
   For I:=0 to Fitems.Count-1 do
   For I:=0 to Fitems.Count-1 do
     begin
     begin
@@ -3281,6 +3290,7 @@ Var
   Sep : String;
   Sep : String;
 
 
 begin
 begin
+  Result:='';
   Sep:=SQLListSeparator(Options);
   Sep:=SQLListSeparator(Options);
   For I:=0 to List.Count-1 do
   For I:=0 to List.Count-1 do
     begin
     begin
@@ -3336,6 +3346,7 @@ Var
   I: Integer;
   I: Integer;
 
 
 begin
 begin
+  S:='';
   Result:=SQLKeyWord('EXECUTE PROCEDURE',Options);
   Result:=SQLKeyWord('EXECUTE PROCEDURE',Options);
   If Assigned(FTN) then
   If Assigned(FTN) then
     Result:=Result+' '+TransactionName.GetAsSQl(Options,AIndent);
     Result:=Result+' '+TransactionName.GetAsSQl(Options,AIndent);
@@ -3528,6 +3539,8 @@ Var
   I : Integer;
   I : Integer;
 
 
 begin
 begin
+  S:='';
+  Result:='';
   If Self is TSQLAlterProcedureStatement then
   If Self is TSQLAlterProcedureStatement then
     Result:=SQLKeyword('ALTER ',Options)
     Result:=SQLKeyword('ALTER ',Options)
   else
   else
@@ -3619,6 +3632,7 @@ Var
   I,J : Integer;
   I,J : Integer;
   S : String;
   S : String;
 begin
 begin
+  S:='';
   Result:=SQLKeyword('BEGIN',Options)+slineBreak;
   Result:=SQLKeyword('BEGIN',Options)+slineBreak;
   For I:=0 to Statements.Count-1 do
   For I:=0 to Statements.Count-1 do
     begin
     begin
@@ -3683,6 +3697,7 @@ Var
   DoNewLine : Boolean;
   DoNewLine : Boolean;
 
 
 begin
 begin
+  S:='';
   Result:=SQLKeyWord('FOR ',Options);
   Result:=SQLKeyWord('FOR ',Options);
   If Assigned(FSelect) then
   If Assigned(FSelect) then
     Result:=Result+Select.GetAsSQL(Options,AIndent)+sLineBreak;
     Result:=Result+Select.GetAsSQL(Options,AIndent)+sLineBreak;
@@ -3856,6 +3871,7 @@ Var
   S : TSQLStringType;
   S : TSQLStringType;
 
 
 begin
 begin
+  Result:='';
   For I:=0 to LocalVariables.Count-1 do
   For I:=0 to LocalVariables.Count-1 do
     begin
     begin
     Result:=Result+SQLKeyWord('DECLARE VARIABLE ',Options);
     Result:=Result+SQLKeyWord('DECLARE VARIABLE ',Options);
@@ -4489,6 +4505,7 @@ Var
   I : Integer;
   I : Integer;
 
 
 begin
 begin
+  Result:='';
   For I:=0 to List.Count-1 do
   For I:=0 to List.Count-1 do
     begin
     begin
     If (Result<>'') then
     If (Result<>'') then
@@ -4513,6 +4530,7 @@ Var
   Sep : TSQLStringType;
   Sep : TSQLStringType;
   I : Integer;
   I : Integer;
 begin
 begin
+  Result:='';
   If Assigned(FColumns) then
   If Assigned(FColumns) then
     begin
     begin
     Sep:=SQLListSeparator(Options);
     Sep:=SQLListSeparator(Options);
@@ -4536,6 +4554,7 @@ Var
   I : Integer;
   I : Integer;
 
 
 begin
 begin
+  Result:='';
   Sep:=SQLListSeparator(Options);
   Sep:=SQLListSeparator(Options);
   For I:=0 to Grantees.Count-1 do
   For I:=0 to Grantees.Count-1 do
     begin
     begin
@@ -4584,6 +4603,7 @@ Var
   I : Integer;
   I : Integer;
 
 
 begin
 begin
+  Result:='';
   Sep:=SQLListSeparator(Options);
   Sep:=SQLListSeparator(Options);
   For I:=0 to Privileges.Count-1 do
   For I:=0 to Privileges.Count-1 do
     begin
     begin
@@ -4637,13 +4657,14 @@ Var
   Sep : TSQLStringType;
   Sep : TSQLStringType;
   I : Integer;
   I : Integer;
 begin
 begin
-   Sep:=SQLListSeparator(Options);
-   For I:=0 to Roles.Count-1 do
-      begin
-      If (Result<>'') then
-        Result:=Result+Sep;
-      Result:=Result+Roles[i].GetAsSQl(Options,AIndent);
-      end;
+  Result:='';
+  Sep:=SQLListSeparator(Options);
+  For I:=0 to Roles.Count-1 do
+    begin
+    If (Result<>'') then
+      Result:=Result+Sep;
+     Result:=Result+Roles[i].GetAsSQl(Options,AIndent);
+    end;
   Result:=SQLKeyWord('GRANT ',Options)+Result;
   Result:=SQLKeyWord('GRANT ',Options)+Result;
   Result:=Result+GranteesAsSQL(Options,AIndent);
   Result:=Result+GranteesAsSQL(Options,AIndent);
   If AdminOption then
   If AdminOption then
@@ -4791,6 +4812,7 @@ Var
   Sep : TSQLStringType;
   Sep : TSQLStringType;
   I : Integer;
   I : Integer;
 begin
 begin
+  Result:='';
   Sep:=SQLListSeparator(Options);
   Sep:=SQLListSeparator(Options);
   For I:=0 to Roles.Count-1 do
   For I:=0 to Roles.Count-1 do
     begin
     begin

+ 36 - 22
packages/fcl-db/src/sqldb/interbase/ibconnection.pp

@@ -128,6 +128,10 @@ implementation
 uses
 uses
   strutils, FmtBCD;
   strutils, FmtBCD;
 
 
+const
+  SQL_BOOLEAN_INTERBASE = 590;
+  SQL_BOOLEAN_FIREBIRD = 32764;
+
 type
 type
   TTm = packed record
   TTm = packed record
     tm_sec : longint;
     tm_sec : longint;
@@ -474,7 +478,7 @@ begin
       end;
       end;
     SQL_BLOB :
     SQL_BLOB :
       begin
       begin
-        if SQLSubType = 1 then
+        if SQLSubType = isc_blob_text then
            TrType := ftMemo
            TrType := ftMemo
         else
         else
            TrType := ftBlob;
            TrType := ftBlob;
@@ -490,6 +494,8 @@ begin
         TrType := ftFloat;
         TrType := ftFloat;
     SQL_FLOAT :
     SQL_FLOAT :
         TrType := ftFloat;
         TrType := ftFloat;
+    SQL_BOOLEAN_INTERBASE, SQL_BOOLEAN_FIREBIRD :
+        TrType := ftBoolean;
     else
     else
         TrType := ftUnknown;
         TrType := ftUnknown;
   end;
   end;
@@ -844,7 +850,7 @@ begin
               i := Round(AParams[ParNr].AsCurrency * IntPower10(-VSQLVar^.sqlscale));
               i := Round(AParams[ParNr].AsCurrency * IntPower10(-VSQLVar^.sqlscale));
             Move(i, VSQLVar^.SQLData^, VSQLVar^.SQLLen);
             Move(i, VSQLVar^.SQLData^, VSQLVar^.SQLLen);
           end;
           end;
-        SQL_SHORT :
+        SQL_SHORT, SQL_BOOLEAN_INTERBASE :
           begin
           begin
             if VSQLVar^.sqlscale = 0 then
             if VSQLVar^.sqlscale = 0 then
               si := AParams[ParNr].AsSmallint
               si := AParams[ParNr].AsSmallint
@@ -892,6 +898,8 @@ begin
           end;
           end;
         SQL_DOUBLE, SQL_FLOAT:
         SQL_DOUBLE, SQL_FLOAT:
           SetFloat(VSQLVar^.SQLData, AParams[ParNr].AsFloat, VSQLVar^.SQLLen);
           SetFloat(VSQLVar^.SQLData, AParams[ParNr].AsFloat, VSQLVar^.SQLLen);
+        SQL_BOOLEAN_FIREBIRD:
+          PByte(VSQLVar^.SQLData)^ := Byte(AParams[ParNr].AsBoolean);
       else
       else
         DatabaseErrorFmt(SUnsupportedParameter,[Fieldtypenames[AParams[ParNr].DataType]],self);
         DatabaseErrorFmt(SUnsupportedParameter,[Fieldtypenames[AParams[ParNr].DataType]],self);
       end {case}
       end {case}
@@ -903,7 +911,7 @@ end;
 function TIBConnection.LoadField(cursor : TSQLCursor;FieldDef : TfieldDef;buffer : pointer; out CreateBlob : boolean) : boolean;
 function TIBConnection.LoadField(cursor : TSQLCursor;FieldDef : TfieldDef;buffer : pointer; out CreateBlob : boolean) : boolean;
 
 
 var
 var
-  x          : integer;
+  VSQLVar    : PXSQLVAR;
   VarcharLen : word;
   VarcharLen : word;
   CurrBuff     : pchar;
   CurrBuff     : pchar;
   c            : currency;
   c            : currency;
@@ -921,21 +929,21 @@ begin
   with cursor as TIBCursor do
   with cursor as TIBCursor do
     begin
     begin
 {$R-}
 {$R-}
-    x := FieldBinding[FieldDef.FieldNo-1];
+    VSQLVar := @SQLDA^.SQLVar[ FieldBinding[FieldDef.FieldNo-1] ];
 
 
     // Joost, 5 jan 2006: I disabled the following, since it's useful for
     // Joost, 5 jan 2006: I disabled the following, since it's useful for
     // debugging, but it also slows things down. In principle things can only go
     // debugging, but it also slows things down. In principle things can only go
     // wrong when FieldDefs is changed while the dataset is opened. A user just
     // wrong when FieldDefs is changed while the dataset is opened. A user just
     // shoudn't do that. ;) (The same is done in PQConnection)
     // shoudn't do that. ;) (The same is done in PQConnection)
 
 
-    // if SQLDA^.SQLVar[x].AliasName <> FieldDef.Name then
+    // if VSQLVar^.AliasName <> FieldDef.Name then
     // DatabaseErrorFmt(SFieldNotFound,[FieldDef.Name],self);
     // DatabaseErrorFmt(SFieldNotFound,[FieldDef.Name],self);
-    if assigned(SQLDA^.SQLVar[x].SQLInd) and (SQLDA^.SQLVar[x].SQLInd^ = -1) then
+    if assigned(VSQLVar^.SQLInd) and (VSQLVar^.SQLInd^ = -1) then
       result := false
       result := false
     else
     else
       begin
       begin
 
 
-      with SQLDA^.SQLVar[x] do
+      with VSQLVar^ do
         if ((SQLType and not 1) = SQL_VARYING) then
         if ((SQLType and not 1) = SQL_VARYING) then
           begin
           begin
           Move(SQLData^, VarcharLen, 2);
           Move(SQLData^, VarcharLen, 2);
@@ -951,13 +959,13 @@ begin
       case FieldDef.DataType of
       case FieldDef.DataType of
         ftBCD :
         ftBCD :
           begin
           begin
-            case SQLDA^.SQLVar[x].SQLLen of
-              2 : c := PSmallint(CurrBuff)^ / IntPower10(-SQLDA^.SQLVar[x].SQLScale);
-              4 : c := PLongint(CurrBuff)^  / IntPower10(-SQLDA^.SQLVar[x].SQLScale);
+            case VSQLVar^.SQLLen of
+              2 : c := PSmallint(CurrBuff)^ / IntPower10(-VSQLVar^.SQLScale);
+              4 : c := PLongint(CurrBuff)^  / IntPower10(-VSQLVar^.SQLScale);
               8 : if Dialect < 3 then
               8 : if Dialect < 3 then
                     c := PDouble(CurrBuff)^
                     c := PDouble(CurrBuff)^
                   else
                   else
-                    c := PLargeint(CurrBuff)^ / IntPower10(-SQLDA^.SQLVar[x].SQLScale);
+                    c := PLargeint(CurrBuff)^ / IntPower10(-VSQLVar^.SQLScale);
               else
               else
                 Result := False; // Just to be sure, in principle this will never happen
                 Result := False; // Just to be sure, in principle this will never happen
             end; {case}
             end; {case}
@@ -965,13 +973,13 @@ begin
           end;
           end;
         ftFMTBcd :
         ftFMTBcd :
           begin
           begin
-            case SQLDA^.SQLVar[x].SQLLen of
-              2 : AFmtBcd := BcdDivPower10(PSmallint(CurrBuff)^, -SQLDA^.SQLVar[x].SQLScale);
-              4 : AFmtBcd := BcdDivPower10(PLongint(CurrBuff)^,  -SQLDA^.SQLVar[x].SQLScale);
+            case VSQLVar^.SQLLen of
+              2 : AFmtBcd := BcdDivPower10(PSmallint(CurrBuff)^, -VSQLVar^.SQLScale);
+              4 : AFmtBcd := BcdDivPower10(PLongint(CurrBuff)^,  -VSQLVar^.SQLScale);
               8 : if Dialect < 3 then
               8 : if Dialect < 3 then
                     AFmtBcd := PDouble(CurrBuff)^
                     AFmtBcd := PDouble(CurrBuff)^
                   else
                   else
-                    AFmtBcd := BcdDivPower10(PLargeint(CurrBuff)^, -SQLDA^.SQLVar[x].SQLScale);
+                    AFmtBcd := BcdDivPower10(PLargeint(CurrBuff)^, -VSQLVar^.SQLScale);
               else
               else
                 Result := False; // Just to be sure, in principle this will never happen
                 Result := False; // Just to be sure, in principle this will never happen
             end; {case}
             end; {case}
@@ -980,34 +988,40 @@ begin
         ftInteger :
         ftInteger :
           begin
           begin
             FillByte(buffer^,sizeof(Longint),0);
             FillByte(buffer^,sizeof(Longint),0);
-            Move(CurrBuff^, Buffer^, SQLDA^.SQLVar[x].SQLLen);
+            Move(CurrBuff^, Buffer^, VSQLVar^.SQLLen);
           end;
           end;
         ftLargeint :
         ftLargeint :
           begin
           begin
             FillByte(buffer^,sizeof(LargeInt),0);
             FillByte(buffer^,sizeof(LargeInt),0);
-            Move(CurrBuff^, Buffer^, SQLDA^.SQLVar[x].SQLLen);
+            Move(CurrBuff^, Buffer^, VSQLVar^.SQLLen);
           end;
           end;
         ftSmallint :
         ftSmallint :
           begin
           begin
             FillByte(buffer^,sizeof(Smallint),0);
             FillByte(buffer^,sizeof(Smallint),0);
-            Move(CurrBuff^, Buffer^, SQLDA^.SQLVar[x].SQLLen);
+            Move(CurrBuff^, Buffer^, VSQLVar^.SQLLen);
           end;
           end;
         ftDate, ftTime, ftDateTime:
         ftDate, ftTime, ftDateTime:
-          GetDateTime(CurrBuff, Buffer, SQLDA^.SQLVar[x].SQLType);
+          GetDateTime(CurrBuff, Buffer, VSQLVar^.SQLType);
         ftString, ftFixedChar  :
         ftString, ftFixedChar  :
           begin
           begin
             Move(CurrBuff^, Buffer^, VarCharLen);
             Move(CurrBuff^, Buffer^, VarCharLen);
             PChar(Buffer + VarCharLen)^ := #0;
             PChar(Buffer + VarCharLen)^ := #0;
           end;
           end;
         ftFloat   :
         ftFloat   :
-          GetFloat(CurrBuff, Buffer, SQLDA^.SQLVar[x].SQLLen);
+          GetFloat(CurrBuff, Buffer, VSQLVar^.SQLLen);
         ftBlob,
         ftBlob,
         ftMemo :
         ftMemo :
           begin  // load the BlobIb in field's buffer
           begin  // load the BlobIb in field's buffer
             FillByte(buffer^,sizeof(TBufBlobField),0);
             FillByte(buffer^,sizeof(TBufBlobField),0);
-            Move(CurrBuff^, Buffer^, SQLDA^.SQLVar[x].SQLLen);
+            Move(CurrBuff^, Buffer^, VSQLVar^.SQLLen);
           end;
           end;
-
+        ftBoolean :
+          begin
+            case VSQLVar^.SQLLen of
+              1: PWordBool(Buffer)^ := PByte(CurrBuff)^ <> 0; // Firebird
+              2: PWordBool(Buffer)^ := PSmallint(CurrBuff)^ <> 0; // Interbase
+            end;
+          end
         else
         else
           begin
           begin
             result := false;
             result := false;

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

@@ -13,11 +13,11 @@ Type
 
 
   TSQLDBLibraryLoader = Class(TComponent)
   TSQLDBLibraryLoader = Class(TComponent)
   private
   private
-    FCtype: String;
+    FCType: String;
     FEnabled: Boolean;
     FEnabled: Boolean;
     FLibraryName: String;
     FLibraryName: String;
     procedure CheckDisabled;
     procedure CheckDisabled;
-    procedure SetCype(AValue: String);
+    procedure SetCType(AValue: String);
     procedure SetEnabled(AValue: Boolean);
     procedure SetEnabled(AValue: Boolean);
     procedure SetLibraryName(AValue: String);
     procedure SetLibraryName(AValue: String);
   Protected
   Protected
@@ -29,7 +29,7 @@ Type
     Procedure UnloadLibrary;
     Procedure UnloadLibrary;
   Published
   Published
     Property Enabled : Boolean Read FEnabled Write SetEnabled;
     Property Enabled : Boolean Read FEnabled Write SetEnabled;
-    Property ConnectionType : String Read FCtype Write SetCype;
+    Property ConnectionType : String Read FCType Write SetCType;
     Property LibraryName : String Read FLibraryName Write SetLibraryName;
     Property LibraryName : String Read FLibraryName Write SetLibraryName;
   end;
   end;
 
 
@@ -47,11 +47,11 @@ begin
     DatabaseError(SErrConnnected,Self);
     DatabaseError(SErrConnnected,Self);
 end;
 end;
 
 
-procedure TSQLDBLibraryLoader.SetCype(AValue: String);
+procedure TSQLDBLibraryLoader.SetCType(AValue: String);
 begin
 begin
-  if FCtype=AValue then Exit;
+  if FCType=AValue then Exit;
   CheckDisabled;
   CheckDisabled;
-  FCtype:=AValue;
+  FCType:=AValue;
   if (FCType<>'') then
   if (FCType<>'') then
     SetDefaultLibraryName;
     SetDefaultLibraryName;
 end;
 end;
@@ -79,7 +79,7 @@ function TSQLDBLibraryLoader.GetConnectionDef: TConnectionDef;
 begin
 begin
   Result:=sqldb.GetConnectionDef(ConnectionType);
   Result:=sqldb.GetConnectionDef(ConnectionType);
   if (Result=Nil) then
   if (Result=Nil) then
-    DatabaseErrorFmt(SErrInvalidConnectionType,[FCTYpe],Self)
+    DatabaseErrorFmt(SErrInvalidConnectionType,[FCType],Self)
 end;
 end;
 
 
 procedure TSQLDBLibraryLoader.Loaded;
 procedure TSQLDBLibraryLoader.Loaded;

+ 10 - 2
packages/fcl-db/tests/testfieldtypes.pas

@@ -95,6 +95,7 @@ type
     procedure TestBCDParamQuery;
     procedure TestBCDParamQuery;
     procedure TestBytesParamQuery;
     procedure TestBytesParamQuery;
     procedure TestVarBytesParamQuery;
     procedure TestVarBytesParamQuery;
+    procedure TestBooleanParamQuery;
     procedure TestAggregates;
     procedure TestAggregates;
 
 
     procedure TestStringLargerThen8192;
     procedure TestStringLargerThen8192;
@@ -826,6 +827,11 @@ begin
   TestXXParamQuery(ftVarBytes, FieldtypeDefinitions[ftVarBytes], testVarBytesValuesCount, SQLDbType<>mssql);
   TestXXParamQuery(ftVarBytes, FieldtypeDefinitions[ftVarBytes], testVarBytesValuesCount, SQLDbType<>mssql);
 end;
 end;
 
 
+procedure TTestFieldTypes.TestBooleanParamQuery;
+begin
+  TestXXParamQuery(ftBoolean, FieldtypeDefinitions[ftBoolean], testValuesCount);
+end;
+
 procedure TTestFieldTypes.TestStringParamQuery;
 procedure TTestFieldTypes.TestStringParamQuery;
 
 
 begin
 begin
@@ -838,7 +844,7 @@ begin
 end;
 end;
 
 
 
 
-procedure TTestFieldTypes.TestXXParamQuery(ADatatype : TFieldType; ASQLTypeDecl : string; testValuescount : integer; Cross : boolean = false);
+procedure TTestFieldTypes.TestXXParamQuery(ADatatype : TFieldType; ASQLTypeDecl : string; testValuesCount : integer; Cross : boolean = false);
 
 
 var i : integer;
 var i : integer;
 
 
@@ -864,7 +870,8 @@ begin
       begin
       begin
       Params.ParamByName('id').AsInteger := i;
       Params.ParamByName('id').AsInteger := i;
       case ADataType of
       case ADataType of
-        ftInteger: Params.ParamByName('field1').asinteger := testIntValues[i];
+        ftInteger: Params.ParamByName('field1').asInteger := testIntValues[i];
+        ftBoolean: Params.ParamByName('field1').AsBoolean := testBooleanValues[i];
         ftFloat  : Params.ParamByName('field1').AsFloat   := testFloatValues[i];
         ftFloat  : Params.ParamByName('field1').AsFloat   := testFloatValues[i];
         ftBCD    : Params.ParamByName('field1').AsCurrency:= testBCDValues[i];
         ftBCD    : Params.ParamByName('field1').AsCurrency:= testBCDValues[i];
         ftFixedChar,
         ftFixedChar,
@@ -900,6 +907,7 @@ begin
       AssertEquals(i,FieldByName('ID').AsInteger);
       AssertEquals(i,FieldByName('ID').AsInteger);
       case ADataType of
       case ADataType of
         ftInteger: AssertEquals(testIntValues[i],FieldByName('FIELD1').AsInteger);
         ftInteger: AssertEquals(testIntValues[i],FieldByName('FIELD1').AsInteger);
+        ftBoolean: AssertEquals(testBooleanValues[i],FieldByName('FIELD1').AsBoolean);
         ftFloat  : AssertEquals(testFloatValues[i],FieldByName('FIELD1').AsFloat);
         ftFloat  : AssertEquals(testFloatValues[i],FieldByName('FIELD1').AsFloat);
         ftBCD    : AssertEquals(testBCDValues[i],FieldByName('FIELD1').AsCurrency);
         ftBCD    : AssertEquals(testBCDValues[i],FieldByName('FIELD1').AsCurrency);
         ftFixedChar : AssertEquals(PadRight(testStringValues[i],10),FieldByName('FIELD1').AsString);
         ftFixedChar : AssertEquals(PadRight(testStringValues[i],10),FieldByName('FIELD1').AsString);