-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for modifying the identifier delimiter #1061
base: master
Are you sure you want to change the base?
Conversation
Added a small correction in Didn't realize it until I was eating lunch a few moments ago that the logic was wrong for the potential SQL Server scenario:
|
This works great! @catfan can this be put into a release? |
@orware Thanks for this PR. However, it's no need to use a method to set the quotation identifier, because it will only call once in most cases. It can be better to set it from the connection option. I will design a better way to achieve this, and test more other databases for this feature. Of course, @chriscct7 can use this PR just now for your migration work. |
@catfan is there a chance we can get this or something compatible with this like the approach you mentioned merged? |
@chriscct7 You can switch to @orware branch https://github.com/orware/Medoo.git and use it directly. |
Hi there, |
Hi, I'm using PHP 8.2 on Ubuntu with MariaDB 10.6.18 I'm using the orware Medoo.PHP file from https://github.com/orware/Medoo.git and just getting 400 errors from my JS call to PHP driven Medoo DB to insert as the inserts are failing due to badly delimited table/column names. Does this Medoo branch support MariaDB (Mysql derivative)??? Thanks IvanThe JSON xHDR data looks like
My Medoo PHP includes mysql as the server type The PHP code doing the insert contains |
You can test the changes made in this PR directly, but the actual test suite may be expecting the SQL-92 specific syntax so it may not be able to directly run the tests when the identifier delimiter has been changed since the generated queries likely won't match anymore.
But by default, the changes proposed here should allow the existing test suite to continue to pass without any changes, since it should still be using the double quote identifier delimiter.
Taking input from Medoo#1044, this adds support for users to modify the quote identifier used for their quotes with databases that might not support the assumed SQL-92 standard double quote delimiter for identifiers.
While I think switching databases into the SQL-92 mode is a good approach generally for making maintenance on the Medoo side simpler, so that the code can be generalized more easily, it's not a workable approach in all situations as described in the issue above by the two PlanetScale users that have run into difficulties.
Similarly though, I could see a Microsoft SQL Server user possibly not wanting to do the same and it causing an issue somehow, although this particular situation does appear to be a bit more PlanetScale specific since the ability for the
ANSI_QUOTES
option is not supported at this time, nor does it seem to be something that will readily become available in the near future. We've documented this limitation on our MySQL Compatibility page.Many libraries do allow for the customization of this identifier for their database-specific drivers, but I do understand the Medoo project's desire to keep things as simple and self-contained as possible and I hope the code suggested in this Pull Request is simple enough that it may be considered for users.