problem with ttable component in lazarus

The stable tester's forum for ZeosLib 7.0.x series

Report problems concerning our Delphi 2009+ version and new Zeoslib 7.0 features here.
Post Reply
aducom
Zeos Dev Team
Zeos Dev Team
Posts: 67
Joined: 30.08.2005, 13:21

problem with ttable component in lazarus

Post by aducom »

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.

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
  
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Post by EgonHugeist »

aducom,


i'm glad to see a DevMember back! Each help is welcome.
I forgot to add it, stupid enough. It might be a suggestion to generate a more appropiate errormessage?
Well that looks like a good idea. Would you like to attach a patch? Did you work with our SVN in the past? Or do you wanna waiting for a done job? (;
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
aducom
Zeos Dev Team
Zeos Dev Team
Posts: 67
Joined: 30.08.2005, 13:21

Post by aducom »

I was introduced a long time ago in the days of Zeos 4. I have worked with svn before, but mostly I send my remarks to Mark. But I don't mind making the changes into the branch myself. I don't need to wait for a done job ;-)
I need new credentials though.
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Post by EgonHugeist »

aducom,
I was introduced a long time ago in the days of Zeos 4. I

but mostly I send my remarks to Mark.
Keep going on this way OR give me your SF.Net username to grand you access. But i propose you mail Mark first.
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

Maybe better to just drop the from part from the metadata query when the database name is empty?
Don't know if that is very usefull when no database is 'active' on the connection. But at least, it's not a faulty query.

Mark
Image
Post Reply