If i run multiple query one after the other inside a transaction it seems i can't insert data in a table create within the same transaction
this is an extremely simplified code to show what i'm talking about, i'm testing this on a firebird 2.5 database:
Code: Select all
procedure databaseUpdate;
var
DB: TUniConnection;
Q: TUniQuery;
begin
DB := TUniConnection.Create(nil);
Q := TUniQuery.Create(nil);
Q.Connection := DB;
try
// some code here to initialize database connection parameters: provider, host, database, user, password
DB.Open;
DB.StartTransaction;
Q.SQL.Clear;
Q.SQL.Add('CREATE TABLE TEST_TABLE (ID INTEGER, FIELD_01 INTEGER)');
Q.Execute;
Q.SQL.Clear;
Q.SQL.Add('INSERT INTO TEST_TABLE (ID, FIELD_01) VALUES (1, 117)');
Q.Execute; // <== here comes the error
Q.Commit;
finally
Q.Close;
Q.Free;
DB.Close;
DB.Free;
end;
end;
Code: Select all
Dynamic SQL Error
SQL error code = -204
Table unknown
TEST_TABLE
At line 1, column 14
i think it has something to do with transaction management, does anyone has a clue about this?