problem with ttable component in lazarus
Posted: 20.01.2013, 11:08
It's been a while I used Zeos. Nice to be back here. I looked at the latest version in Lazarus 1.0.4. Install went well. But if I want to select a table then using the pulldown of tablenames generates an error. GetTableNames also generates an error. Now it's obvious to think that it's because of MySQL, but I'm running mySQL 5.1 and using 'show tables like '%' simply works in my MySQL maintenance tool. With lazarus I get
SQL Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near LIKE '%' at line 1.
Now diving into the code it appears that there's no database name. I forgot to add it, stupid enough. It might be a suggestion to generate a more appropiate errormessage? After all you can connect to the database without having selecting a database name.
SQL Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near LIKE '%' at line 1.
Now diving into the code it appears that there's no database name. I forgot to add it, stupid enough. It might be a suggestion to generate a more appropiate errormessage? After all you can connect to the database without having selecting a database name.
Code: Select all
function TZMySQLDatabaseMetadata.UncachedGetTables(const Catalog: string;
const SchemaPattern: string; const TableNamePattern: string;
const Types: TStringDynArray): IZResultSet;
var
LCatalog, LTableNamePattern: string;
begin
Result := inherited UncachedGetTables(Catalog, SchemaPattern, TableNamePattern, Types);
GetCatalogAndNamePattern(Catalog, SchemaPattern, TableNamePattern,
LCatalog, LTableNamePattern);
if LCatalog='' then
raise Exception.Create('Error: missing catalog name');
with GetConnection.CreateStatement.ExecuteQuery(
Format('SHOW TABLES FROM %s LIKE ''%s''',
[GetIdentifierConvertor.Quote(LCatalog), LTableNamePattern])) do
begin