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

git-svn-id: trunk@20546 -
This commit is contained in:
marco 2012-03-20 21:14:36 +00:00
parent ecb34fb8da
commit 040e67772a
2 changed files with 10 additions and 15 deletions

View File

@ -7,13 +7,13 @@ interface
uses uses
Classes, SysUtils, toolsunit, Classes, SysUtils, toolsunit,
db, 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] = 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] = FieldtypeDefinitionsConst : Array [TFieldType] of String[20] =
( (
@ -111,6 +111,7 @@ begin
if SQLDbType = MYSQL41 then Fconnection := tMySQL41Connection.Create(nil); if SQLDbType = MYSQL41 then Fconnection := tMySQL41Connection.Create(nil);
if SQLDbType = MYSQL50 then Fconnection := tMySQL50Connection.Create(nil); if SQLDbType = MYSQL50 then Fconnection := tMySQL50Connection.Create(nil);
if SQLDbType = MYSQL51 then Fconnection := tMySQL51Connection.Create(nil); if SQLDbType = MYSQL51 then Fconnection := tMySQL51Connection.Create(nil);
if SQLDbType = MYSQL55 then Fconnection := tMySQL55Connection.Create(nil);
if SQLDbType in [mysql40,mysql41] then if SQLDbType in [mysql40,mysql41] then
begin begin
// Mysql versions prior to 5.0.3 removes the trailing spaces on varchar // 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 = ODBC then Fconnection := tODBCConnection.Create(nil);
if SQLDbType = ORACLE then Fconnection := TOracleConnection.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 begin
// Some DB's do not support milliseconds in datetime and time fields. // 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) // Firebird support miliseconds, see BUG 17199 (when resolved, then interbase can be excluded)

View File

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