Page 1 of 1
Support for Delphi XE2 metadata
Posted: Tue 20 Mar 2012 15:13
by nandod
Hello,
I am trying to get new-style metadata but I only get a bunch of "not supported" exceptions.
I am using 4.75.27. Is the feature supported in a later version? If not, will it and when?
Thanks
--
Nando
Posted: Wed 21 Mar 2012 12:10
by AndreyZ
For the time being our dbExpress drivers don't support obtaining all metadata kinds that RAD Studio XE2 defines. We will investigate this question. Please specify the exact metadata kinds you want to obtain using dbExpress driver for SQL Server that are not supported now.
Posted: Wed 21 Mar 2012 12:48
by nandod
I dug a bit more and it seems it doesn't respect DBX's structure for the following command:
Code: Select all
TDBXMetaDataCommands.GetTables + ' % ' + TDBXMetaDataTableTypes.Table
It should return a 4-column cursor as defined in DBXMetadataNames:
Code: Select all
TDBXTablesColumns = class
public
/// Used to access the CatalogName column in the Tables metadata collection.
/// The data in this column specifies the catalog name.
///
const CatalogName = 'CatalogName';
/// Used to access the SchemaName column in the Tables metadata collection.
/// The data in this column specifies the schema name.
///
const SchemaName = 'SchemaName';
/// Used to access the TableName column in the Tables metadata collection.
/// The data in this column specifies the table name.
///
const TableName = 'TableName';
/// Used to access the TableType column in the Tables metadata collection.
/// The data in this column specifies the table type: TABLE, VIEW,
/// SYNONYM, SYSTEM_TABLE.
///
const TableType = 'TableType';
end;
TDBXTablesIndex = class
public
/// Used to access the CatalogName column by ordinal in the Tables metadata collection.
/// The data in this column specifies the catalog name.
///
const CatalogName = 0;
/// Used to access the SchemaName column by ordinal in the Tables metadata collection.
/// The data in this column specifies the schema name.
///
const SchemaName = 1;
/// Used to access the TableName column by ordinal in the Tables metadata collection.
/// The data in this column specifies the table name.
///
const TableName = 2;
/// Used to access the TableType column by ordinal in the Tables metadata collection.
/// The data in this column specifies the table type: TABLE, VIEW,
/// SYNONYM, SYSTEM_TABLE.
///
const TableType = 3;
const Last = 3;
end;
but it returns a 5-column cursor instead with an extra column at the beginning which puts off any access by index through TDBXTablesIndex.
Also, the names are wrong, which prevents access through TDBXTablesColumns as well. In short, it is using the old (pre-D2007 I think) metadata format, as you can see by inspecting the column names:
RECNO
CATALOG_NAME
SCHEMA_NAME
TABLE_NAME
TABLE_TYPE
Plus, shouldn't the TableType column contain the values above (TABLE, VIEW, SYNONYM, SYSTEM_TABLE)?
Thanks
--
Nando
Posted: Wed 21 Mar 2012 13:03
by nandod
BTW I also need to read table columns, primary and foreign keys.
Posted: Thu 22 Mar 2012 12:21
by AndreyZ
We will take into account all your suggestions. We will improve metadata support in one of the next builds of dbExpress driver for SQL Server.
dbExpress driver for SQL Server already supports getting metadata of table columns (GetColumns).