TSQLConnector.GetTableNames fails on MySQL
Original Reporter info from Mantis: rvk
-
Reporter name: Rik van Kekem
Original Reporter info from Mantis: rvk
- Reporter name: Rik van Kekem
Description:
TSQLConnector has an internal FProxy which gets the correct TXXXConnection for the specified database. It's used for the connection.
However calling TSQLConnector.GetTableNames doesn't call the GetTableNames of that underlying object. Instead it call the inherited TSQLConnection.GetTableNames which only works for SQLite but not for other databases.
SQLConnector1.GetTableNames(Sl, false); // user tables
gives this as error on a MySQL database
: Field not found : "table_name".
SQLConnector1.GetTableNames(Sl, true); // system tables
gives this as error on a MySQL database
The metadata is not available for this type of database.
This could be fixed by creating an override as TSQLConnector.GetTableNames which calls FProxy.GetTableNames() (if FPoxy is assigned) just like the other procedures in TSQLConnector do.
Additional information:
Solution could be something like this:
--------------
type
TSQLConnector = class(TSQLConnection)
public
procedure GetTableNames(List: TStrings; SystemTables: boolean = False); override;
end;
procedure TSQLConnector.GetTableNames(List: TStrings; SystemTables: boolean);
begin
if Assigned(FProxy) then
FProxy.GetTableNames(List, SystemTables)
else
inherited;
end;
Mantis conversion info:
- Mantis ID: 29819
- Fixed in version: 3.1.1
- Fixed in revision: 33254 (#c21ab782)