You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the Problem
Medoo ignores SET SQL_MODE command when used in options during Medoo object creation. It is probably executed but then there is the same command executed again in Medoo code and overwrites whatever user has set.
Result is then that no matter the user sets, SQL_MODE always equals "ANSI_QUOTES".
Detail Code
The detail code you are using causes the problem.
SQL_MODE gets overwritten by this code in Medoo.php:
case 'mysql':
// Make MySQL using standard quoted identifier.$commands[] = 'SET SQL_MODE=ANSI_QUOTES';
break;
Expected output
I would expect Medoo to parse SET SQL_MODE (if entered by the user), check if ANSI_QUOTES is in the modes that user specified, if not then add it to the list, if yes, then just continue and let the command execute.
Instead of adding another SET SQL_MODE command into $commands array that overwrites the user specified SQL modes.
The text was updated successfully, but these errors were encountered:
So after the Medoo line referenced above is executed for the current connection, it would change it to simply be ANSI_QUOTES instead.
A potential alternative approach that would simply add in the ANSI_QUOTES option to the existing list would be maybe something like this:
SET SQL_MODE = IF(FIND_IN_SET('ANSI_QUOTES', @@sql_mode), @@sql_mode, CONCAT(@@sql_mode, ',ANSI_QUOTES'));
Which should leave the SQL_MODE unchanged if ANSI_QUOTES is already in the list, or it will add it to the end if it isn't.
It still doesn't make ANSI_QUOTES work for PlanetScale databases, but this may help allow users to avoid needing to define a custom command in some cases if Medoo is currently overriding their server defaults.
Information
Describe the Problem
Medoo ignores SET SQL_MODE command when used in options during Medoo object creation. It is probably executed but then there is the same command executed again in Medoo code and overwrites whatever user has set.
Result is then that no matter the user sets, SQL_MODE always equals "ANSI_QUOTES".
Detail Code
The detail code you are using causes the problem.
SQL_MODE gets overwritten by this code in Medoo.php:
Expected output
I would expect Medoo to parse SET SQL_MODE (if entered by the user), check if ANSI_QUOTES is in the modes that user specified, if not then add it to the list, if yes, then just continue and let the command execute.
Instead of adding another SET SQL_MODE command into $commands array that overwrites the user specified SQL modes.
The text was updated successfully, but these errors were encountered: