SetSchemaInfo doesn't return expected results when fieldname is provided

Discussion of open issues, suggestions and bugs regarding usage of dbExpress drivers for SQL Server in Delphi and C++Builder
Post Reply
chrispaskins
Posts: 11
Joined: Tue 11 Oct 2005 10:32
Location: Windsor, UK

SetSchemaInfo doesn't return expected results when fieldname is provided

Post by chrispaskins » Mon 16 Jul 2007 14:20

Using Delphi 2007 for win32, MS SQL 2000, dbExpress driver for SQL Server version 4.00

When using
TSQLDataSet.SetSchemaInfo(stColumns, tablename, fieldname)
where tablename and fieldname are string values of the table and column I'm interested in:

I get a result set of Schema Info for every column in my MS SQL table. It really should be returning the Schema Info for the one column I'm interested in.

I now need to locate the column after opening the dataset:
eg:

Code: Select all

dbt := TSQLDataSet.create(nil);
try
  dbt.SQLConnection := FSqlConnection;
  dbt.GetMetadata := True;
  dbt.SetSchemaInfo(stColumns, tableName, fieldName);
  dbt.Open;
  if not dbt.Eof then
  begin
    if dbt.fieldByName('COLUMN_NAME').asStringfieldname then
    begin
      if not dbt.locate('COLUMN_NAME', fieldname, []) then
        exit;
    end;
    //do stuff with Schema Info result here
  end;
finally
  dbt.Free;
end;
It works but isn't it doing too much work?

Note, this is hapening with dbExpress driver for Oracle version 4.00 as well. With Interbase driver which comes with Delphi 2007 things work as expected ie one row returned.

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Wed 18 Jul 2007 06:41

Thank you for information. We have reproduced this problem and fixed it. This fix will be included in the next build of DbxSda and DbxOda.

Post Reply