Browse Source

* Tests for Mysql 5.5, from Lacak2. Mantis #21511

git-svn-id: trunk@20546 -
marco 13 years ago
parent
commit
040e67772a
2 changed files with 10 additions and 15 deletions
  1. 6 5
      packages/fcl-db/tests/sqldbtoolsunit.pas
  2. 4 10
      packages/fcl-db/tests/testfieldtypes.pas

+ 6 - 5
packages/fcl-db/tests/sqldbtoolsunit.pas

@@ -7,13 +7,13 @@ interface
 uses
   Classes, SysUtils, toolsunit,
   db,
-  sqldb, ibconnection, mysql40conn, mysql41conn, mysql50conn, mysql51conn, pqconnection,odbcconn,oracleconnection,sqlite3conn;
+  sqldb, ibconnection, mysql40conn, mysql41conn, mysql50conn, mysql51conn, mysql55conn, pqconnection,odbcconn,oracleconnection,sqlite3conn;
 
-type TSQLDBTypes = (mysql40,mysql41,mysql50,mysql51,postgresql,interbase,odbc,oracle,sqlite3);
+type TSQLDBTypes = (mysql40,mysql41,mysql50,mysql51,mysql55,postgresql,interbase,odbc,oracle,sqlite3);
 
-const MySQLdbTypes = [mysql40,mysql41,mysql50,mysql51];
+const MySQLdbTypes = [mysql40,mysql41,mysql50,mysql51,mysql55];
       DBTypesNames : Array [TSQLDBTypes] of String[19] =
-             ('MYSQL40','MYSQL41','MYSQL50','MYSQL51','POSTGRESQL','INTERBASE','ODBC','ORACLE','SQLITE3');
+             ('MYSQL40','MYSQL41','MYSQL50','MYSQL51','MYSQL55','POSTGRESQL','INTERBASE','ODBC','ORACLE','SQLITE3');
              
       FieldtypeDefinitionsConst : Array [TFieldType] of String[20] =
         (
@@ -111,6 +111,7 @@ begin
   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 in [mysql40,mysql41] then
     begin
     // Mysql versions prior to 5.0.3 removes the trailing spaces on varchar
@@ -156,7 +157,7 @@ begin
   if SQLDbType = ODBC then Fconnection := tODBCConnection.Create(nil);
   if SQLDbType = ORACLE then Fconnection := TOracleConnection.Create(nil);
 
-  if SQLDbType in [mysql40,mysql41,mysql50,mysql51,odbc,interbase] then
+  if SQLDbType in [mysql40,mysql41,mysql50,mysql51,mysql55,odbc,interbase] then
     begin
     // Some DB's do not support milliseconds in datetime and time fields.
     // Firebird support miliseconds, see BUG 17199 (when resolved, then interbase can be excluded)

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

@@ -394,10 +394,7 @@ begin
     Open;
     for i := 0 to testValuesCount-1 do
       begin
-      if (SQLDbType in [mysql40,mysql41]) then
-        AssertEquals(TrimRight(testValues[i]),fields[0].AsString) // MySQL < 5.0.3 automatically trims strings
-      else
-        AssertEquals(testValues[i],fields[0].AsString);
+      AssertEquals(testValues[i], Fields[0].AsString);
       Next;
       end;
     close;
@@ -635,16 +632,13 @@ const
   );
 
 var
-  i, corrTestValueCount : byte;
+  i : byte;
 
 begin
   CreateTableWithFieldType(ftDateTime,FieldtypeDefinitions[ftDateTime]);
   TestFieldDeclaration(ftDateTime,8);
 
-  if SQLDbType=mysql40 then corrTestValueCount := testValuesCount-21
-    else corrTestValueCount := testValuesCount;
-
-  for i := 0 to corrTestValueCount-1 do
+  for i := 0 to testValuesCount-1 do
     if SQLDbType=oracle then
       TSQLDBConnector(DBConnector).Connection.ExecuteDirect('insert into FPDEV2 (FT) values (to_date (''' + testValues[i] + ''',''YYYY-MM-DD HH24:MI:SS''))')
     else
@@ -653,7 +647,7 @@ begin
   with TSQLDBConnector(DBConnector).Query do
     begin
     Open;
-    for i := 0 to corrTestValueCount-1 do
+    for i := 0 to testValuesCount-1 do
       begin
       if length(testValues[i]) < 12 then
         AssertEquals(testValues[i],FormatDateTime('yyyy/mm/dd', fields[0].AsDateTime, DBConnector.FormatSettings))