mysqlmedoo

medoo select term doesn't work correct


I have the debug modus on and get this

mySQL string:

SELECT "dmd_key","id" 
FROM "keys" 
WHERE "dmd_key" = '140ec37b981042c8549b07d6d4589295' 
  AND "website" = 'test.de'

But that string doesn't work for me. I get a database error message. (the standard message..)

If I change my string into this:

SELECT `id`,`dmd_key` 
FROM `keys` 
WHERE `dmd_key` = '140ec37b981042c8549b07d6d4589295' 
  AND `website` = 'test.de'

I get results. I think I have to change something in my settings but I don't know what.

It is my first time with medoo and I think medoo doesn't love me...

Thanks for your help.


Solution

  • This appears to be a problem within Medoo. You're not the only person seeing the issue (1,2). According to this bug report, Medoo creates mySQL code that escapes table names with double quotes, and then changes a mySQL option to cater for it:

    case 'mysql':
        // Make MySQL using standard quoted identifier
        $commands[] = 'SET SQL_MODE=ANSI_QUOTES';
    

    This option seems to be disabled on your web host, rendering Medoo unusable in your environment.

    It's tough to put in words how insane this is. A framework should generate SQL that is compatible with the database it runs on. I would switch to a different framework.