Page 1 of 1

[bug_fixed] GetFieldNames on ZConnection

Posted: 07.03.2007, 22:51
by simpsomboy
Your ZeosLib DBO Version: 6.6.1
The IDE you are using: Delphi
Version (and maybe patchlevel) of the IDE: 7
The database you are using: Firebird
Version of the database: 1.5
Used protocol: firebird-1.5
[hr]Error description and post

I sugest you to put a function to get the fieldnames directly from connection
like gettablenames

somethin like this


TZConnection....

interface

Code: Select all

  public
    procedure GetFieldNames(const TablePattern: string; List: TStrings);
implementation

Code: Select all

procedure TZConnection.GetFieldNames(const TablePattern: string; List: TStrings);
var
  Metadata: IZDatabaseMetadata;
  ResultSet: IZResultSet;
begin
  CheckConnected;
  List.Clear;
  Metadata := DbcConnection.GetMetadata;
  ResultSet := Metadata.GetColumns('', '', TablePattern, '');
  while ResultSet.Next do
    List.Add(ResultSet.GetStringByName('COLUMN_NAME'));
end;


Posted: 30.04.2007, 14:24
by mdaems
Hi,

I added this feature with some small modification : I included the column name pattern as a parameter. Renamed to GetColumnNames.
SVN Testing branch revision 241.

Mark

Thank you

Posted: 30.05.2007, 22:31
by simpsomboy
Hi,

thank you for adding this code

it's very useful, and people doesn't need to patch their code anymore

Alexandre

Posted: 25.10.2007, 18:29
by edrobinson
Hi,

I tried to use this method today after getting SVN 241.

The call: dbMySQL.GetColumnNames(TableName,'',qFields);
raises an exception "Column with name "Field" was not found."

Any thoughts?

Posted: 25.10.2007, 19:13
by mdaems
Which Mysql version?

Mark

Posted: 25.10.2007, 19:23
by edrobinson
That was the problem. I was using an old MySQL dll. changed to 4.x and all is well.

Thanks for the quicl reply.

Posted: 25.10.2007, 19:30
by mdaems
Weird... I was talking about the server version... Apparently the dll also does something with the 'show columns' queries.

Anyway, now we know how to solve this.

Mark