Browse Source

--- Merging r23059 into '.':
U packages/fcl-db/tests/testfieldtypes.pas

# revisions: 22993,22996,22998,23037,23048,23059
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)
r23059 | lacak | 2012-11-26 09:47:29 +0100 (Mon, 26 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@24930 -

marco 12 years ago
parent
commit
2f41c5e218
1 changed files with 42 additions and 38 deletions
  1. 42 38
      packages/fcl-db/tests/testfieldtypes.pas

+ 42 - 38
packages/fcl-db/tests/testfieldtypes.pas

@@ -1266,7 +1266,7 @@ begin
       Query.Open;
       AssertEquals(1, Query.Fields[0].AsInteger);
       Query.Next;
-      if not(SQLConnType in [interbase]) then
+      if not(SQLServerType in [ssFirebird, ssInterbase]) then
       begin
         AssertFalse('Eof after 1st row', Query.Eof);
         AssertEquals(2, Query.Fields[0].AsInteger);
@@ -1329,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 (SQLConnType in MySQLConnTypes) then Ignore('This test does only apply to MySQL because the used SQL-statement is MySQL only.');
+  if not (SQLServerType in [ssMySQL]) 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
@@ -1932,9 +1932,9 @@ begin
     datatype:=FieldtypeDefinitions[ftTime];
     if datatype = '' then
       Ignore(STestNotApplicable);
-    if SQLConnType = sqlite3 then
+    if SQLServerType = ssSQLite then
       testIntervalValuesCount := 5
-    else if SQLConnType in MySQLConnTypes then
+    else if SQLServerType = ssMySQL then
       testIntervalValuesCount := 4
     else
       testIntervalValuesCount := 3;
@@ -1948,37 +1948,41 @@ var datatype, values: string;
     i: integer;
     updatable: boolean;
 begin
-  if SQLConnType in MySQLConnTypes then
-  begin
-    datatype:='INT AUTO_INCREMENT PRIMARY KEY';
-    values:='VALUES(DEFAULT)';
-    fieldtype:=ftAutoInc;
-    updatable:=true;
-  end
-  else if SQLConnType = sqlite3 then
-  begin
-    datatype:='INTEGER PRIMARY KEY';
-    values:='DEFAULT VALUES';
-    fieldtype:=ftInteger;
-    updatable:=true;
-  end
-  else if SQLConnType = postgresql then
-  begin
-    datatype:='SERIAL';
-    values:='DEFAULT VALUES';
-    fieldtype:=ftInteger;
-    updatable:=true;
-  end
-  else if SQLConnType = mssql then
-  begin
-    datatype:='INTEGER IDENTITY';
-    values:='DEFAULT VALUES';
-    fieldtype:=ftAutoInc;
-    updatable:=false;
-  end
-  else
-    Ignore(STestNotApplicable);
-
+  case SQLServerType of
+    ssMySQL:
+      begin
+      datatype:='INT AUTO_INCREMENT PRIMARY KEY';
+      values:='VALUES(DEFAULT)';
+      fieldtype:=ftAutoInc;
+      updatable:=true;
+      end;
+    ssSQLite:
+      begin
+      datatype:='INTEGER PRIMARY KEY';
+      values:='DEFAULT VALUES';
+      fieldtype:=ftInteger;
+      updatable:=true;
+      end;
+    ssPostgreSQL:
+      begin
+      datatype:='SERIAL';
+      values:='DEFAULT VALUES';
+      if SQLConnType = ODBC then
+        fieldtype:=ftAutoInc
+      else
+        fieldtype:=ftInteger;
+      updatable:=true;
+      end;
+    ssMSSQL, ssSybase:
+      begin
+      datatype:='INTEGER IDENTITY';
+      values:='DEFAULT VALUES';
+      fieldtype:=ftAutoInc;
+      updatable:=false;
+      end
+    else
+      Ignore(STestNotApplicable);
+  end;
   CreateTableWithFieldType(fieldtype, datatype);
   TestFieldDeclaration(fieldtype, sizeof(longint));
 
@@ -2074,7 +2078,7 @@ begin
   with TSQLDBConnector(DBConnector).Query do
     begin
     SQL.Clear;
-    if SQLConnType=interbase then
+    if SQLServerType in [ssFirebird, ssInterbase] 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)')
@@ -2093,7 +2097,7 @@ begin
       Close;
     finally
       // For Firebird/Interbase, we need to explicitly delete the table as well (it's active within the transaction)
-      if SQLConnType=interbase then
+      if SQLServerType in [ssFirebird, ssInterbase] then
         begin
         SQL.Text := 'DROP TABLE FPDEV_TEMP';
         ExecSQL;
@@ -2144,7 +2148,7 @@ procedure TTestFieldTypes.TestParametersAndDates;
 // See bug 7205
 var ADateStr : String;
 begin
-  if not(SQLConnType in [postgresql,odbc,oracle]) then
+  if not(SQLServerType in [ssPostgreSQL, ssOracle]) 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