Browse Source

--- Merging r22993 into '.':
U packages/fcl-db/src/sqldb/sqlite/sqlite3conn.pp
U packages/fcl-db/tests/testfieldtypes.pas
U packages/fcl-db/tests/sqldbtoolsunit.pas
--- Merging r22996 into '.':
G packages/fcl-db/tests/sqldbtoolsunit.pas
--- Merging r22998 into '.':
G packages/fcl-db/tests/sqldbtoolsunit.pas
--- Merging r23037 into '.':
U packages/fcl-db/tests/toolsunit.pas
G packages/fcl-db/tests/sqldbtoolsunit.pas
--- Merging r23048 into '.':
G packages/fcl-db/tests/testfieldtypes.pas

# revisions: 22993,22996,22998,23037,23048
r22993 | reiniero | 2012-11-16 12:17:21 +0100 (Fri, 16 Nov 2012) | 1 line
Changed paths:
M /trunk/packages/fcl-db/src/sqldb/sqlite/sqlite3conn.pp
M /trunk/packages/fcl-db/tests/sqldbtoolsunit.pas
M /trunk/packages/fcl-db/tests/testfieldtypes.pas

fcl-db: cosmetic change due to new variable names too similar to existing ones in r22988
r22996 | reiniero | 2012-11-16 13:54:22 +0100 (Fri, 16 Nov 2012) | 1 line
Changed paths:
M /trunk/packages/fcl-db/tests/sqldbtoolsunit.pas

* fcl-db: forgot rename in {$IFNDEF Win64} section in r22993
r22998 | lacak | 2012-11-16 14:36:53 +0100 (Fri, 16 Nov 2012) | 2 lines
Changed paths:
M /trunk/packages/fcl-db/tests/sqldbtoolsunit.pas

fcl-db: tests: MS SQL Server and Sybase do not support dates before 1753 for their DATETIME data type so do not try insert these dates into test tables.
(MS SQL 2008 introduced DATETIME2, which support full range of years 0000-9999).
r23037 | lacak | 2012-11-20 13:44:12 +0100 (Tue, 20 Nov 2012) | 1 line
Changed paths:
M /trunk/packages/fcl-db/tests/sqldbtoolsunit.pas
M /trunk/packages/fcl-db/tests/toolsunit.pas

fcl-db: tests: basic test for ftWideString and ftWideMemo for SQLite. Tests if these field types are recognized when saving/restoring to XML format. See rev.22997
r23048 | lacak | 2012-11-23 13:52:42 +0100 (Fri, 23 Nov 2012) | 3 lines
Changed paths:
M /trunk/packages/fcl-db/tests/testfieldtypes.pas

fcl-db: tests: use SQLServerType instead of SQLConnType.
To allow correctly testing TODBCConnection.
(we need know remote DB server to setup some tests)

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

marco 12 years ago
parent
commit
813deb6cdd

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

@@ -76,7 +76,7 @@ type
  
     procedure FreeFldBuffers(cursor : TSQLCursor); override;
     function LoadField(cursor : TSQLCursor;FieldDef : TfieldDef;buffer : pointer; out CreateBlob : boolean) : boolean; override;
-           //if bufsize < 0 -> buffer was to small, should be -bufsize
+           //if bufsize < 0 -> buffer was too small, should be -bufsize
     function GetTransactionHandle(trans : TSQLHandle): pointer; override;
     function Commit(trans : TSQLHandle) : boolean; override;
     function RollBack(trans : TSQLHandle) : boolean; override;

+ 39 - 29
packages/fcl-db/tests/sqldbtoolsunit.pas

@@ -25,11 +25,11 @@ uses
   ;
 
 type
-  TSQLDBType = (mysql40,mysql41,mysql50,mysql51,mysql55,postgresql,interbase,odbc,oracle,sqlite3,mssql,sybase);
+  TSQLConnType = (mysql40,mysql41,mysql50,mysql51,mysql55,postgresql,interbase,odbc,oracle,sqlite3,mssql,sybase);
   TSQLServerType = (ssFirebird, ssInterbase, ssMSSQL, ssMySQL, ssOracle, ssPostgreSQL, ssSQLite, ssSybase, ssUnknown);
 
-const MySQLdbTypes = [mysql40,mysql41,mysql50,mysql51,mysql55];
-      DBTypesNames : Array [TSQLDBType] of String[19] =
+const MySQLConnTypes = [mysql40,mysql41,mysql50,mysql51,mysql55];
+      SQLConnTypesNames : Array [TSQLConnType] of String[19] =
         ('MYSQL40','MYSQL41','MYSQL50','MYSQL51','MYSQL55','POSTGRESQL','INTERBASE','ODBC','ORACLE','SQLITE3','MSSQL','SYBASE');
              
       FieldtypeDefinitionsConst : Array [TFieldType] of String[20] =
@@ -106,7 +106,7 @@ type
     property Query : TSQLQuery read FQuery;
   end;
 
-var SQLDbType : TSQLDBType;
+var SQLConnType : TSQLConnType;
     SQLServerType : TSQLServerType;
     FieldtypeDefinitions : Array [TFieldType] of String[20];
     
@@ -133,35 +133,35 @@ const
     (s: 'ASE'; t: ssSybase)
   );
 
-  // fall back mapping
-  SQLDBTypeToServerTypeMap : array[TSQLDbType] of TSQLServerType =
-    (ssMySQL,ssMySQL,ssMySQL,ssMySQL,ssMySQL,ssPostgreSQL,ssInterbase,ssUnknown,ssOracle,ssSQLite,ssMSSQL,ssSybase);
+  // fall back mapping (e.g. in case GetConnectionInfo(citServerType) is not implemented)
+  SQLConnTypeToServerTypeMap : array[TSQLConnType] of TSQLServerType =
+    (ssMySQL,ssMySQL,ssMySQL,ssMySQL,ssMySQL,ssPostgreSQL,ssFirebird,ssUnknown,ssOracle,ssSQLite,ssMSSQL,ssSybase);
 
 
 { TSQLDBConnector }
 
 procedure TSQLDBConnector.CreateFConnection;
-var t : TSQLDBType;
+var t : TSQLConnType;
     i : integer;
     s : string;
 begin
-  for t := low(DBTypesNames) to high(DBTypesNames) do
-    if UpperCase(dbconnectorparams) = DBTypesNames[t] then SQLDbType := t;
-
-  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 = MYSQL51 then Fconnection := TMySQL51Connection.Create(nil);
-  if SQLDbType = MYSQL55 then Fconnection := TMySQL55Connection.Create(nil);
-  if SQLDbType = SQLITE3 then Fconnection := TSQLite3Connection.Create(nil);
-  if SQLDbType = POSTGRESQL then Fconnection := TPQConnection.Create(nil);
-  if SQLDbType = INTERBASE then Fconnection := TIBConnection.Create(nil);
-  if SQLDbType = ODBC then Fconnection := TODBCConnection.Create(nil);
+  for t := low(SQLConnTypesNames) to high(SQLConnTypesNames) do
+    if UpperCase(dbconnectorparams) = SQLConnTypesNames[t] then SQLConnType := t;
+
+  if SQLConnType = MYSQL40 then Fconnection := TMySQL40Connection.Create(nil);
+  if SQLConnType = MYSQL41 then Fconnection := TMySQL41Connection.Create(nil);
+  if SQLConnType = MYSQL50 then Fconnection := TMySQL50Connection.Create(nil);
+  if SQLConnType = MYSQL51 then Fconnection := TMySQL51Connection.Create(nil);
+  if SQLConnType = MYSQL55 then Fconnection := TMySQL55Connection.Create(nil);
+  if SQLConnType = SQLITE3 then Fconnection := TSQLite3Connection.Create(nil);
+  if SQLConnType = POSTGRESQL then Fconnection := TPQConnection.Create(nil);
+  if SQLConnType = INTERBASE then Fconnection := TIBConnection.Create(nil);
+  if SQLConnType = ODBC then Fconnection := TODBCConnection.Create(nil);
   {$IFNDEF Win64}
-  if SQLDbType = ORACLE then Fconnection := TOracleConnection.Create(nil);
+  if SQLConnType = ORACLE then Fconnection := TOracleConnection.Create(nil);
   {$ENDIF Win64}
-  if SQLDbType = MSSQL then Fconnection := TMSSQLConnection.Create(nil);
-  if SQLDbType = SYBASE then Fconnection := TSybaseConnection.Create(nil);
+  if SQLConnType = MSSQL then Fconnection := TMSSQLConnection.Create(nil);
+  if SQLConnType = SYBASE then Fconnection := TSybaseConnection.Create(nil);
 
   if not assigned(Fconnection) then writeln('Invalid database type, check if a valid database type for your achitecture was provided in the file ''database.ini''');
 
@@ -171,7 +171,7 @@ begin
     UserName := dbuser;
     Password := dbpassword;
     HostName := dbhostname;
-    if (dbhostname='') and (SQLDbType=interbase) then
+    if (dbhostname='') and (SQLConnType=interbase) then
     begin
       // Firebird embedded: create database file if it doesn't yet exist
       // Note: pagesize parameter has influence on behavior. We're using
@@ -191,7 +191,7 @@ begin
   // determine remote SQL Server to which we are connected
   s := Fconnection.GetConnectionInfo(citServerType);
   if s = '' then
-    SQLServerType := SQLDbTypeToServerTypeMap[SQLDbType] // if citServerType isn't implemented
+    SQLServerType := SQLConnTypeToServerTypeMap[SQLConnType] // if citServerType isn't implemented
   else
     for i := low(SQLServerTypesMap) to high(SQLServerTypesMap) do
       if SQLServerTypesMap[i].s = s then
@@ -251,10 +251,12 @@ begin
       FieldtypeDefinitions[ftBytes] := 'BINARY(5)';
       FieldtypeDefinitions[ftVarBytes] := 'VARBINARY(10)';
       FieldtypeDefinitions[ftMemo] := 'CLOB'; //or TEXT SQLite supports both, but CLOB is sql standard (TEXT not)
+      FieldtypeDefinitions[ftWideString] := 'NVARCHAR(10)';
+      FieldtypeDefinitions[ftWideMemo] := 'NCLOB';
       end;
   end;
 
-  if SQLDbType in [mysql40,mysql41] then
+  if SQLConnType in [mysql40,mysql41] then
     begin
     // Mysql versions prior to 5.0.3 removes the trailing spaces on varchar
     // fields on insertion. So to test properly, we have to do the same
@@ -287,6 +289,14 @@ begin
       end;
     end;
 
+  if SQLServerType in [ssMSSQL, ssSybase] then
+    // Some DB's do not support datetime values before 1753-01-01
+    for i := 18 to testValuesCount-1 do
+      begin
+      testValues[ftDate,i] := testValues[ftDate,0];
+      testValues[ftDateTime,i] := testValues[ftDateTime,0];
+      end;
+
   // DecimalSeparator must correspond to monetary locale (lc_monetary) set on PostgreSQL server
   // Here we assume, that locale on client side is same as locale on server
   if SQLServerType in [ssPostgreSQL] then
@@ -466,14 +476,14 @@ begin
   // exists. And while this exeption is in a try..except statement, the debugger
   // always shows the exception, which is pretty annoying.
   try
-    if SQLDbType = INTERBASE then
+    if SQLConnType = INTERBASE then
       begin
       // This only works with Firebird 2+
       FConnection.ExecuteDirect('execute block as begin if (exists (select 1 from rdb$relations where rdb$relation_name=''' + ATableName + ''')) '+
         'then execute statement ''drop table ' + ATAbleName + ';'';end');
       FTransaction.CommitRetaining;
       end;
-    if SQLDBType = mssql then
+    if SQLConnType = mssql then
       begin
       // Checking is needed here to avoid getting "auto rollback" of a subsequent CREATE TABLE statement
       // which leads to the rollback not referring to the right transaction=>SQL error
@@ -485,7 +495,7 @@ begin
         'end');
       FTransaction.CommitRetaining;
       end;
-    if SQLDbType = sybase then
+    if SQLConnType = sybase then
       begin
       // Checking is needed here to avoid getting "auto rollback" of a subsequent CREATE TABLE statement
       // which leads to the rollback not referring to the right transaction=>SQL error

+ 60 - 56
packages/fcl-db/tests/testfieldtypes.pas

@@ -218,14 +218,13 @@ begin
       script.append('create table b (id int);');
       ExecuteScript;
       // Firebird/Interbase need a commit after a DDL statement. Not necessary for the other connections
-      if SQLDbType=interbase then TSQLDBConnector(DBConnector).Transaction.CommitRetaining;
-
+      if SQLConnType=interbase then TSQLDBConnector(DBConnector).Transaction.CommitRetaining;
       end;
   finally
     TSQLDBConnector(DBConnector).Connection.ExecuteDirect('drop table a');
     TSQLDBConnector(DBConnector).Connection.ExecuteDirect('drop table b');
     // Firebird/Interbase need a commit after a DDL statement. Not necessary for the other connections
-    if SQLDbType=interbase then TSQLDBConnector(DBConnector).Transaction.CommitRetaining;
+    if SQLConnType=interbase then TSQLDBConnector(DBConnector).Transaction.CommitRetaining;
   end;
 end;
 
@@ -293,7 +292,7 @@ var
 
 begin
   with TSQLDBConnector(DBConnector) do begin
-    if SQLDbType = INTERBASE then
+    if SQLConnType = INTERBASE then
     begin
       //Interbase internal storage of exact numeric data types based on precision:
       // 1-4 (smallint), 5-9 (integer), 10-18 (int64)
@@ -436,7 +435,7 @@ var
   i             : byte;
 
 begin
-  if SQLDbType<>postgresql then Ignore('This test does only apply to Postgres, since others don''t support varchars without length given');
+  if SQLConnType<>postgresql then Ignore('This test does only apply to Postgres, since others don''t support varchars without length given');
 
   CreateTableWithFieldType(ftString,'VARCHAR');
   TestFieldDeclaration(ftString,dsMaxStringSize+1);
@@ -466,7 +465,7 @@ begin
   TestFieldDeclaration(ftDate,8);
 
   for i := 0 to testDateValuesCount-1 do
-    if SQLDbType=oracle then
+    if SQLConnType=oracle then
       TSQLDBConnector(DBConnector).Connection.ExecuteDirect('insert into FPDEV2 (FT) values (to_date (''' + testDateValues[i] + ''',''YYYY-MM-DD''))')
     else
       TSQLDBConnector(DBConnector).Connection.ExecuteDirect('insert into FPDEV2 (FT) values (''' + testDateValues[i] + ''')');
@@ -641,7 +640,7 @@ begin
   TestFieldDeclaration(ftDateTime,8);
 
   for i := 0 to testValuesCount-1 do
-    if SQLDbType=oracle then
+    if SQLConnType=oracle then
       TSQLDBConnector(DBConnector).Connection.ExecuteDirect('insert into FPDEV2 (FT) values (to_date (''' + testValues[i] + ''',''YYYY-MM-DD HH24:MI:SS''))')
     else
       TSQLDBConnector(DBConnector).Connection.ExecuteDirect('insert into FPDEV2 (FT) values (''' + testValues[i] + ''')');
@@ -825,7 +824,7 @@ end;
 
 procedure TTestFieldTypes.TestVarBytesParamQuery;
 begin
-  TestXXParamQuery(ftVarBytes, FieldtypeDefinitions[ftVarBytes], testVarBytesValuesCount, SQLDbType<>mssql);
+  TestXXParamQuery(ftVarBytes, FieldtypeDefinitions[ftVarBytes], testVarBytesValuesCount, not(SQLServerType in [ssMSSQL, ssSybase]));
 end;
 
 procedure TTestFieldTypes.TestBooleanParamQuery;
@@ -856,7 +855,7 @@ begin
   TSQLDBConnector(DBConnector).Connection.ExecuteDirect('create table FPDEV2 (ID INT, FIELD1 '+ASQLTypeDecl+')');
 
 // Firebird/Interbase need a commit after a DDL statement. Not necessary for the other connections
-  if SQLDbType=interbase then TSQLDBConnector(DBConnector).Transaction.CommitRetaining;
+  if SQLConnType=interbase then TSQLDBConnector(DBConnector).Transaction.CommitRetaining;
 
   with TSQLDBConnector(DBConnector).Query do
     begin
@@ -1036,7 +1035,7 @@ end;
 
 procedure TTestFieldTypes.RunTest;
 begin
-//  if (SQLDbType in TSQLDBType) then
+//  if (SQLConnType in TSQLConnType) then
     inherited RunTest;
 end;
 
@@ -1221,7 +1220,7 @@ end;
 
 procedure TTestFieldTypes.TestInsertReturningQuery;
 begin
-  if not(SQLDbType in [postgresql,interbase,oracle]) then Ignore(STestNotApplicable);
+  if not(SQLConnType in [postgresql,interbase,oracle]) then Ignore(STestNotApplicable);
   with TSQLDBConnector(DBConnector) do
     begin
     // This only works with databases that supports 'insert into .. returning'
@@ -1239,25 +1238,27 @@ procedure TTestFieldTypes.TestOpenStoredProc;
 begin
   with TSQLDBConnector(DBConnector) do
   begin
-    if SQLDbType in MySQLdbTypes then
-    begin
-      Connection.ExecuteDirect('create procedure FPDEV_PROC() select 1 union select 2;');
-      Query.SQL.Text:='call FPDEV_PROC';
-    end
-    else if SQLDbType = interbase then
-    begin
-      Connection.ExecuteDirect('create procedure FPDEV_PROC returns (r integer) as begin r=1; end');
-      Query.SQL.Text:='execute procedure FPDEV_PROC';
-    end
-    else if SQLDbType = mssql then
-    begin
-      Connection.ExecuteDirect('create procedure FPDEV_PROC as select 1 union select 2;');
-      Query.SQL.Text:='execute FPDEV_PROC';
-    end
-    else
-    begin
-      Ignore('This test does not apply to this sqldb-connection type, since it does not support selectable stored procedures.');
-      Exit;
+    case SQLServerType of
+      ssMySQL:
+        begin
+        Connection.ExecuteDirect('create procedure FPDEV_PROC() select 1 union select 2;');
+        Query.SQL.Text:='call FPDEV_PROC';
+        end;
+      ssFirebird, ssInterbase:
+        begin
+        Connection.ExecuteDirect('create procedure FPDEV_PROC returns (r integer) as begin r=1; end');
+        Query.SQL.Text:='execute procedure FPDEV_PROC';
+        end;
+      ssMSSQL, ssSybase:
+        begin
+        Connection.ExecuteDirect('create procedure FPDEV_PROC as select 1 union select 2;');
+        Query.SQL.Text:='execute FPDEV_PROC';
+        end;
+      else
+        begin
+        Ignore('This test does not apply to this sqldb-connection type, since it does not support selectable stored procedures.');
+        Exit;
+        end;
     end;
     Transaction.CommitRetaining;
 
@@ -1265,7 +1266,7 @@ begin
       Query.Open;
       AssertEquals(1, Query.Fields[0].AsInteger);
       Query.Next;
-      if not(SQLDbType in [interbase]) then
+      if not(SQLConnType in [interbase]) then
       begin
         AssertFalse('Eof after 1st row', Query.Eof);
         AssertEquals(2, Query.Fields[0].AsInteger);
@@ -1290,7 +1291,7 @@ begin
   // at least one row must be returned
   with TSQLDBConnector(DBConnector) do
   begin
-    case SQLDbType of
+    case SQLConnType of
       sqlite3:
         statements := TTestStatements.Create('pragma table_info(FPDEV)');
       interbase:
@@ -1303,7 +1304,7 @@ begin
       mssql:
         statements := TTestStatements.Create(CTE_SELECT  (*MS SQL 2005*));
       else
-        if SQLdbType in MySQLdbTypes then
+        if SQLConnType in MySQLConnTypes then
           statements := TTestStatements.Create(
             'check table FPDEV',  // bug 14519
             'show tables from '+Connection.DatabaseName  // bug 16842
@@ -1328,7 +1329,7 @@ procedure TTestFieldTypes.TestClearUpdateableStatus;
 // Test if CanModify is correctly disabled in case of a select query without
 // a from-statement.
 begin
-  if not (SQLDbType in MySQLdbTypes) then Ignore('This test does only apply to MySQL because the used SQL-statement is MySQL only.');
+  if not (SQLConnType in MySQLConnTypes) then Ignore('This test does only apply to MySQL because the used SQL-statement is MySQL only.');
   with TSQLDBConnector(DBConnector) do
     begin
     with (GetNDataset(false,5) as TSQLQuery) do
@@ -1621,10 +1622,13 @@ begin
     Close;
 
     // tests parsing of WHERE ... LIMIT
-    case sqlDBtype of
-      interbase : SQL.Text:='select first 1 NAME from FPDEV where NAME=''TestName21''';
-      mssql     : SQL.Text:='select top 1 NAME from FPDEV where NAME=''TestName21''';
-      else        SQL.Text:='select NAME from FPDEV where NAME=''TestName21'' limit 1';
+    case SQLServerType of
+      ssFirebird, ssInterbase:
+        SQL.Text:='select first 1 NAME from FPDEV where NAME=''TestName21''';
+      ssMSSQL, ssSybase:
+        SQL.Text:='select top 1 NAME from FPDEV where NAME=''TestName21''';
+      else
+        SQL.Text:='select NAME from FPDEV where NAME=''TestName21'' limit 1';
     end;
     Open;
     CheckTrue(CanModify, SQL.Text);
@@ -1639,7 +1643,7 @@ begin
 
     // tests parsing SELECT with quoted identifiers (MySQL requires sql-mode=ANSI_QUOTES)
     SQL.Text:='SELECT"ID"FROM"FPDEV"ORDER BY"ID"';
-    if sqlDBtype in [postgresql] then SQL.Text:=lowercase(SQL.Text); // The folding of unquoted names to lower case in PostgreSQL is incompatible with the SQL standard
+    if SQLServerType in [ssPostgreSQL] then SQL.Text:=lowercase(SQL.Text); // The folding of unquoted names to lower case in PostgreSQL is incompatible with the SQL standard
     Open;
     CheckTrue(CanModify, SQL.Text);
     Close;
@@ -1672,7 +1676,7 @@ begin
     AssertTrue(query.RowsAffected<>0); // It should return -1 or the number of selected rows.
     query.Close;
     AssertTrue(query.RowsAffected<>0); // It should return -1 or the same as the last time it was called.
-    if (SQLDbType = sqlite3) then  // sqlite doesn't count the rowsaffected if there is no where-clause
+    if (SQLConnType = sqlite3) then  // sqlite doesn't count the rowsaffected if there is no where-clause
       Query.SQL.Text := 'delete from FPDEV2 where 1'
     else
       Query.SQL.Text := 'delete from FPDEV2';
@@ -1756,7 +1760,7 @@ end;
 procedure TTestFieldTypes.TestBug9744;
 var i : integer;
 begin
-  if SQLDbType in [interbase,postgresql,mssql] then Ignore('This test does not apply to this db-engine, since it has no double field-type');
+  if not(SQLServerType in [ssMySQL, ssSQLite]) then Ignore('This test does not apply to this db-engine, since it has no double field-type');
 
   with TSQLDBConnector(DBConnector) do
     begin
@@ -1802,7 +1806,7 @@ begin
     begin
     FieldNames := TStringList.Create;
     try
-      if SQLDbType in MySQLdbTypes then
+      if SQLConnType in MySQLConnTypes then
         Connection.GetFieldNames('FPDEV',FieldNames)
       else
         Connection.GetFieldNames('fpDEv',FieldNames);
@@ -1871,7 +1875,7 @@ procedure TTestFieldTypes.TestSQLClob;
   end;
 var datatype: string;
 begin
-  if sqlDBType=sqlite3 then
+  if SQLConnType=sqlite3 then
     datatype:='CLOB'
   else
     datatype:=FieldtypeDefinitions[ftMemo];
@@ -1891,7 +1895,7 @@ procedure TTestFieldTypes.TestSQLLargeint;
   end;
 var datatype: string;
 begin
-  if sqlDBType=sqlite3 then
+  if SQLConnType=sqlite3 then
     datatype:='LARGEINT'
   else
     datatype:='BIGINT';
@@ -1918,7 +1922,7 @@ procedure TTestFieldTypes.TestSQLInterval;
   end;
 var datatype: string;
 begin
-  if sqlDBType = postgresql then
+  if SQLConnType = postgresql then
   begin
     datatype:='INTERVAL';
     testIntervalValuesCount := 5;
@@ -1928,9 +1932,9 @@ begin
     datatype:=FieldtypeDefinitions[ftTime];
     if datatype = '' then
       Ignore(STestNotApplicable);
-    if sqlDBType = sqlite3 then
+    if SQLConnType = sqlite3 then
       testIntervalValuesCount := 5
-    else if sqlDBType in MySQLdbTypes then
+    else if SQLConnType in MySQLConnTypes then
       testIntervalValuesCount := 4
     else
       testIntervalValuesCount := 3;
@@ -1944,28 +1948,28 @@ var datatype, values: string;
     i: integer;
     updatable: boolean;
 begin
-  if sqlDBType in MySQLdbTypes then
+  if SQLConnType in MySQLConnTypes then
   begin
     datatype:='INT AUTO_INCREMENT PRIMARY KEY';
     values:='VALUES(DEFAULT)';
     fieldtype:=ftAutoInc;
     updatable:=true;
   end
-  else if sqlDBType = sqlite3 then
+  else if SQLConnType = sqlite3 then
   begin
     datatype:='INTEGER PRIMARY KEY';
     values:='DEFAULT VALUES';
     fieldtype:=ftInteger;
     updatable:=true;
   end
-  else if sqlDBType = postgresql then
+  else if SQLConnType = postgresql then
   begin
     datatype:='SERIAL';
     values:='DEFAULT VALUES';
     fieldtype:=ftInteger;
     updatable:=true;
   end
-  else if sqlDBType = mssql then
+  else if SQLConnType = mssql then
   begin
     datatype:='INTEGER IDENTITY';
     values:='DEFAULT VALUES';
@@ -2041,7 +2045,7 @@ begin
                               ')                            ');
 
   // Firebird/Interbase need a commit after a DDL statement. Not necessary for the other connections
-  if SQLDbType=interbase then TSQLDBConnector(DBConnector).Transaction.CommitRetaining;
+  if SQLConnType=interbase then TSQLDBConnector(DBConnector).Transaction.CommitRetaining;
 
   ds := TSQLDBConnector(DBConnector).Query;
   ds.sql.Text:='select * from FPDEV2';
@@ -2065,12 +2069,12 @@ end;
 
 procedure TTestFieldTypes.TestTemporaryTable;
 begin
-  if SQLDbType in [mssql] then Ignore('This test does not apply to this sqldb-connection type, since it doesn''t support temporary tables');
+  if SQLServerType in [ssMSSQL, ssSybase] then Ignore('This test does not apply to this sqldb-connection type, since it doesn''t support temporary tables');
 
   with TSQLDBConnector(DBConnector).Query do
     begin
     SQL.Clear;
-    if SQLDbType=interbase then
+    if SQLConnType=interbase then
       // Global temporary table: introduced in Firebird 2.1
       // has persistent metadata; data is per transaction (default) or per connection
       SQL.Add('CREATE GLOBAL TEMPORARY TABLE FPDEV_TEMP (id int)')
@@ -2089,7 +2093,7 @@ begin
       Close;
     finally
       // For Firebird/Interbase, we need to explicitly delete the table as well (it's active within the transaction)
-      if SQLDbType=interbase then
+      if SQLConnType=interbase then
         begin
         SQL.Text := 'DROP TABLE FPDEV_TEMP';
         ExecSQL;
@@ -2140,7 +2144,7 @@ procedure TTestFieldTypes.TestParametersAndDates;
 // See bug 7205
 var ADateStr : String;
 begin
-  if not(SQLDbType in [postgresql,odbc,oracle]) then
+  if not(SQLConnType in [postgresql,odbc,oracle]) then
     Ignore('This test does not apply to this sqldb-connection type, since it doesn''t use semicolons for casts');
 
   with TSQLDBConnector(DBConnector).Query do

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

@@ -313,6 +313,8 @@ begin
   testValues[ftDate] := testDateValues;
   testValues[ftBlob] := testStringValues;
   testValues[ftMemo] := testStringValues;
+  testValues[ftWideString] := testStringValues;
+  testValues[ftWideMemo] := testStringValues;
   testValues[ftFMTBcd] := testFmtBCDValues;
   for i := 0 to testValuesCount-1 do
     begin