mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2026-01-06 12:52:34 +01:00
fcl-db: tests: adapt some tests for Interbase XE
(Interbase and Firebird are not the same; f.e. Interbase does not support BIGINT data type, CTEs, Execute block, insert returning etc.) git-svn-id: trunk@23069 -
This commit is contained in:
parent
cf5bd7e5c1
commit
d53b5371bb
@ -33,7 +33,7 @@ const MySQLConnTypes = [mysql40,mysql41,mysql50,mysql51,mysql55];
|
||||
'VARCHAR(10)',
|
||||
'SMALLINT',
|
||||
'INTEGER',
|
||||
'',
|
||||
'', // ftWord
|
||||
'BOOLEAN',
|
||||
'DOUBLE PRECISION', // ftFloat
|
||||
'', // ftCurrency
|
||||
@ -41,8 +41,8 @@ const MySQLConnTypes = [mysql40,mysql41,mysql50,mysql51,mysql55];
|
||||
'DATE',
|
||||
'TIME',
|
||||
'TIMESTAMP', // ftDateTime
|
||||
'',
|
||||
'',
|
||||
'', // ftBytes
|
||||
'', // ftVarBytes
|
||||
'', // ftAutoInc
|
||||
'BLOB', // ftBlob
|
||||
'BLOB', // ftMemo
|
||||
@ -53,7 +53,7 @@ const MySQLConnTypes = [mysql40,mysql41,mysql50,mysql51,mysql55];
|
||||
'',
|
||||
'',
|
||||
'CHAR(10)', // ftFixedChar
|
||||
'',
|
||||
'', // ftWideString
|
||||
'BIGINT', // ftLargeInt
|
||||
'',
|
||||
'',
|
||||
@ -67,8 +67,8 @@ const MySQLConnTypes = [mysql40,mysql41,mysql50,mysql51,mysql55];
|
||||
'', // ftGuid
|
||||
'TIMESTAMP', // ftTimestamp
|
||||
'NUMERIC(18,6)',// ftFmtBCD
|
||||
'',
|
||||
''
|
||||
'', // ftFixedWideChar
|
||||
'' // ftWideMemo
|
||||
);
|
||||
|
||||
|
||||
@ -195,17 +195,22 @@ begin
|
||||
FieldtypeDefinitions := FieldtypeDefinitionsConst;
|
||||
|
||||
case SQLServerType of
|
||||
ssFirebird, ssInterbase:
|
||||
ssFirebird:
|
||||
begin
|
||||
FieldtypeDefinitions[ftBoolean] := '';
|
||||
FieldtypeDefinitions[ftMemo] := 'BLOB SUB_TYPE TEXT';
|
||||
FieldtypeDefinitions[ftMemo] := 'BLOB SUB_TYPE TEXT';
|
||||
end;
|
||||
ssInterbase:
|
||||
begin
|
||||
FieldtypeDefinitions[ftMemo] := 'BLOB SUB_TYPE TEXT';
|
||||
FieldtypeDefinitions[ftLargeInt] := 'NUMERIC(18,0)';
|
||||
end;
|
||||
ssMSSQL, ssSybase:
|
||||
// todo: Sybase: copied over MSSQL; verify correctness
|
||||
begin
|
||||
FieldtypeDefinitions[ftBoolean] := 'BIT';
|
||||
FieldtypeDefinitions[ftCurrency]:= 'MONEY';
|
||||
FieldtypeDefinitions[ftFloat] := 'FLOAT';
|
||||
FieldtypeDefinitions[ftCurrency]:= 'MONEY';
|
||||
FieldtypeDefinitions[ftDate] := 'DATETIME';
|
||||
FieldtypeDefinitions[ftTime] := '';
|
||||
FieldtypeDefinitions[ftDateTime]:= 'DATETIME';
|
||||
@ -218,14 +223,14 @@ begin
|
||||
ssMySQL:
|
||||
begin
|
||||
//MySQL recognizes BOOLEAN, but as synonym for TINYINT, not true sql boolean datatype
|
||||
FieldtypeDefinitions[ftBoolean] := '';
|
||||
FieldtypeDefinitions[ftBoolean] := '';
|
||||
// Use 'DATETIME' for datetime-fields instead of timestamp, because
|
||||
// mysql's timestamps are only valid in the range 1970-2038.
|
||||
// Downside is that fields defined as 'TIMESTAMP' aren't tested
|
||||
FieldtypeDefinitions[ftDateTime] := 'DATETIME';
|
||||
FieldtypeDefinitions[ftBytes] := 'BINARY(5)';
|
||||
FieldtypeDefinitions[ftBytes] := 'BINARY(5)';
|
||||
FieldtypeDefinitions[ftVarBytes] := 'VARBINARY(10)';
|
||||
FieldtypeDefinitions[ftMemo] := 'TEXT';
|
||||
FieldtypeDefinitions[ftMemo] := 'TEXT';
|
||||
end;
|
||||
ssOracle:
|
||||
begin
|
||||
|
||||
@ -1237,7 +1237,7 @@ end;
|
||||
|
||||
procedure TTestFieldTypes.TestInsertReturningQuery;
|
||||
begin
|
||||
if not(SQLConnType in [postgresql,interbase,oracle]) then Ignore(STestNotApplicable);
|
||||
if not(SQLServerType in [ssFirebird, ssOracle, ssPostgreSQL]) then Ignore(STestNotApplicable);
|
||||
with TSQLDBConnector(DBConnector) do
|
||||
begin
|
||||
// This only works with databases that supports 'insert into .. returning'
|
||||
@ -1308,26 +1308,25 @@ begin
|
||||
// at least one row must be returned
|
||||
with TSQLDBConnector(DBConnector) do
|
||||
begin
|
||||
case SQLConnType of
|
||||
sqlite3:
|
||||
case SQLServerType of
|
||||
ssSQLite:
|
||||
statements := TTestStatements.Create('pragma table_info(FPDEV)');
|
||||
interbase:
|
||||
ssFirebird:
|
||||
statements := TTestStatements.Create(
|
||||
CTE_SELECT (*FB 2.1*),
|
||||
'EXECUTE BLOCK RETURNS (U VARCHAR(255)) AS BEGIN SELECT rdb$get_context(''SYSTEM'',''CURRENT_USER'') FROM rdb$database INTO U; SUSPEND; END' (*FB 2.0*)
|
||||
);
|
||||
postgresql:
|
||||
ssPostgreSQL:
|
||||
statements := TTestStatements.Create(CTE_SELECT);
|
||||
mssql:
|
||||
ssMSSQL:
|
||||
statements := TTestStatements.Create(CTE_SELECT (*MS SQL 2005*));
|
||||
ssMySQL:
|
||||
statements := TTestStatements.Create(
|
||||
'check table FPDEV', // bug 14519
|
||||
'show tables from '+Connection.DatabaseName // bug 16842
|
||||
)
|
||||
else
|
||||
if SQLConnType in MySQLConnTypes then
|
||||
statements := TTestStatements.Create(
|
||||
'check table FPDEV', // bug 14519
|
||||
'show tables from '+Connection.DatabaseName // bug 16842
|
||||
)
|
||||
else
|
||||
Ignore(STestNotApplicable);
|
||||
Ignore(STestNotApplicable);
|
||||
end;
|
||||
|
||||
for s in statements do
|
||||
@ -1798,7 +1797,7 @@ begin
|
||||
connection.ExecuteDirect('insert into TTTXY(ID,NP) values ('+inttostr(i)+',1)');
|
||||
connection.ExecuteDirect('insert into TTTXY(ID,NP) values ('+inttostr(i)+',2)');
|
||||
end;
|
||||
Query.SQL.Text := 'select OBJ.ID, OBJ.NAME, count(XY.NP) as NPF from TTTOBJ as OBJ, TTTXY as XY where OBJ.ID=XY.ID group by OBJ.ID, OBJ.NAME';
|
||||
Query.SQL.Text := 'select OBJ.ID, OBJ.NAME, count(XY.NP) as NPF from TTTOBJ OBJ, TTTXY XY where OBJ.ID=XY.ID group by OBJ.ID, OBJ.NAME';
|
||||
query.Prepare;
|
||||
query.open;
|
||||
query.close;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user