MySQL Metadata for keys

The offical for ZeosLib 7.3 Report problems, ask for help, post proposals for the new version of Zeoslib 7.3/v8
Quick Info:
-We made two new drivers: odbc(raw and unicode version) and oledb
-GUID domain/field-defined support for FB
-extended error infos of Firebird
-performance ups are still in queue
In future some more feature will arrive, so stay tuned and don't hassitate to help
Post Reply
MJFShark
Expert Boarder
Expert Boarder
Posts: 211
Joined: 04.06.2020, 13:59

MySQL Metadata for keys

Post by MJFShark »

It looks like the MySQL metadata calls:
UncachedGetImportedKeys
UncachedGetExportedKeys
UncachedGetCrossReference

All currently don't work on MySQL 5.7 and MySQL 8.0 (those are the only two versions I have access to.)
They all seem to rely on the command:
SHOW TABLE STATUS FROM %s LIKE ''%s''
which as far as I can tell does not show any real key information. I've gone back through the file history to see if something changed at some point, but didn't find anything.

The easiest solution I can see would be to use the information_schema to get the information. The MySQL metadata stuff is currently a mix of using the informaton_schema and the "show" commands and I know there's been some concern about using the information_schema, but in this case since I don't think the current functions work at all it doesn't seem like using the informaton_schema would be an issue.

I'm happy to do a pr with updated functions but wanted to check if others think it's the way to go, of if perhaps someone knows how to use the show command to get the key information those calls need.

-Mark
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1918
Joined: 17.01.2011, 14:17

Re: MySQL Metadata for keys

Post by marsupilami »

Hello Mark,

generally speaking there is no problem in using the information_schema. I suggest to check the server version so we don't get an exception on older servers. Something like:

Code: Select all

  if MySQLServerVersion >=WorkingVersion then begin
    // get information fom information schema here
  end else begin
    // do nothing here and return an empty result set.
  end;
As far as I know the information schema was buggy at times and doesn't exist on old servers.
Post Reply