* The tests which belongs to r6485

git-svn-id: trunk@6486 -
This commit is contained in:
joost 2007-02-13 23:41:33 +00:00
parent 4c4c69c89a
commit b1653c6fc3

View File

@ -27,11 +27,15 @@ type
procedure RunTest; override;
published
procedure TestUpdateIndexDefs;
procedure TestGetIndexDefs;
procedure TestDoubleQuoteEscapeComments;
procedure TestpfInUpdateFlag; // bug 7565
procedure TestInt;
procedure TestScript;
procedure TestTemporaryTable;
procedure TestParametersAndDates;
procedure TestExceptionOnsecondClose;
@ -61,6 +65,8 @@ implementation
uses sqldbtoolsunit,toolsunit, variants, sqldb, bufdataset;
Type HackedDataset = class(TDataset);
const
testFloatValuesCount = 21;
testFloatValues : Array[0..testFloatValuesCount-1] of double = (-maxSmallint-1,-maxSmallint,-256,-255,-128,-127,-1,0,1,127,128,255,256,maxSmallint,maxSmallint+1,0.123456,-0.123456,4.35,12.434E7,9.876e-5,123.45678);
@ -829,6 +835,63 @@ begin
inherited RunTest;
end;
procedure TTestFieldTypes.TestUpdateIndexDefs;
var ds : TSQLQuery;
begin
ds := DBConnector.GetNDataset(1) as TSQLQuery;
ds.Prepare;
ds.IndexDefs.Update;
AssertEquals(1,ds.IndexDefs.count);
AssertEquals('ID',ds.indexdefs[0].Fields);
Asserttrue(ds.indexdefs[0].Options=[ixPrimary,ixUnique]);
ds.IndexDefs.Update;
AssertEquals(1,ds.IndexDefs.count);
AssertEquals('ID',ds.indexdefs[0].Fields);
Asserttrue(ds.indexdefs[0].Options=[ixPrimary,ixUnique]);
end;
procedure TTestFieldTypes.TestTemporaryTable;
begin
with TSQLDBConnector(DBConnector).Query do
begin
SQL.Clear;
SQL.Add('CREATE TEMPORARY TABLE TEMP1 (id int)');
ExecSQL;
SQL.Text := 'INSERT INTO TEMP1(id) values (5)';
ExecSQL;
SQL.Text := 'SELECT * FROM TEMP1';
Open;
AssertEquals(5,fields[0].AsInteger);
Close;
end;
end;
procedure TTestFieldTypes.TestGetIndexDefs;
var ds : TSQLQuery;
inddefs : TIndexDefs;
begin
ds := DBConnector.GetNDataset(1) as TSQLQuery;
ds.Open;
AssertEquals(1,ds.IndexDefs.count);
inddefs := HackedDataset(ds).GetIndexDefs(ds.IndexDefs,[ixPrimary]);
AssertEquals(1,inddefs.count);
AssertEquals('ID',inddefs[0].Fields);
Asserttrue(inddefs[0].Options=[ixPrimary,ixUnique]);
inddefs.Free;
inddefs := HackedDataset(ds).GetIndexDefs(ds.IndexDefs,[ixPrimary,ixUnique]);
AssertEquals(1,inddefs.count);
AssertEquals('ID',inddefs[0].Fields);
Asserttrue(inddefs[0].Options=[ixPrimary,ixUnique]);
inddefs.Free;
inddefs := HackedDataset(ds).GetIndexDefs(ds.IndexDefs,[ixDescending]);
AssertEquals(0,inddefs.count);
inddefs.Free;
end;
procedure TTestFieldTypes.TestDoubleQuoteEscapeComments;
begin
with TSQLDBConnector(DBConnector).Query do