Support for Delphi XE2 metadata

Discussion of open issues, suggestions and bugs regarding usage of dbExpress drivers for SQL Server in Delphi and C++Builder
Post Reply
nandod
Posts: 15
Joined: Mon 29 May 2006 09:03

Support for Delphi XE2 metadata

Post by nandod » Tue 20 Mar 2012 15:13

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

AndreyZ

Post by AndreyZ » Wed 21 Mar 2012 12:10

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.

nandod
Posts: 15
Joined: Mon 29 May 2006 09:03

Post by nandod » Wed 21 Mar 2012 12:48

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

nandod
Posts: 15
Joined: Mon 29 May 2006 09:03

Post by nandod » Wed 21 Mar 2012 13:03

BTW I also need to read table columns, primary and foreign keys.

AndreyZ

Post by AndreyZ » Thu 22 Mar 2012 12:21

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).

Post Reply