If I create a new table in my Firebird database, and then I call:
TIBDatabase.GetTableNames, the newly created table doesn’t get enunmerated: I have first to issue:
IBDatabase1.Connected := False;
IBDatabase1.Connected := True;
and then I can call TIBDatabase.GetTableNames and have the newly created table enumerated.
The following function uses TIBDatabase.GetTableNames to determine the existence of a given table name passed as parameter
function TableExists(const aTableName: String): Boolean;
var
ListOfExistingTables: TStringList;
begin
Result:= False;
ListOfExistingTables:= TStringList.Create;
try
IBDatabase1.GetTableNames(ListOfExistingTables);
Result:= (ListOfExistingTables.IndexOf(aTableName) > - 1);
finally
ListOfExistingTables.Free;
end;
end;
In Firebird even Metadata-changes are isolated in transactions. So you have to commit the transaction, which you have used to create the table. Maybe you have to commit the transaction which is uses by IBX to read the table-names, too.