Hi Jan,
Nice hint! It is working.
The interesting part is that I've used TZSQLMetaData with Firebird and the (MetadaType = mdColumns) option list all tables and their columns, so you do not neet do set (TableName = "YourTableName"). I think this way is better, since I'm using TZSQLMetaData to construct a TreeView of tables and its fields.
Here is the basic code, which uses just one TZSQLMetaData object and just one loop:
Code: Select all
int
TDModTest::FillStructTreeView(TTreeView* ATView) const
{
int Count = 0;
// Prepare SQL MetaData.
ZMetaData->Close();
ZMetaData->MetadataType = mdColumns;
ZMetaData->Open();
// Auxiliary.
AnsiString STableName, SColumnName, SOld;
SOld = "";
TTreeNode* NodeTable;
TTreeNode* NodeColumn;
// Add nodes to ATView.
while ( !ZMetaData->Eof )
{ // Table name.
STableName = ZMetaData->FieldByName("TABLE_NAME")->AsString;
// Do not add system's tables.
bool NameOK = ( !STableName.Pos("RDB$") &&
!STableName.Pos("MON$") );
// Add node for TableName (if OK and different).
if ( NameOK && (STableName != SOld) )
{
NodeTable = ATView->Items->Add(ATView->Selected, STableName);
SOld = STableName;
}
// Column name.
SColumnName = ZMetaData->FieldByName("COLUMN_NAME")->AsString;
// Add child node for ColumnName
if ( NameOK && (SColumnName != "") )
NodeColumn = ATView->Items->AddChild(NodeTable, SColumnName);
// Next item.
ZMetaData->Next();
Count++;
}
return (Count);
}
Do you think this is a difference in ZeosLib's drivers behavior that deserves to be reported?
Thanks anyway.
Marcelo.