-
Notifications
You must be signed in to change notification settings - Fork 268
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
Active_Record Is Changing Case of Table Names #792
Comments
What is the value of |
The value of $ADODB_QUOTE_FIELDNAMES in my executing code is NULL. In the documentation, I see where there are five allowed values for $ADODB_QUOTE_FIELDNAMES – true, false, UPPER, LOWER and, NATIVE. As an aside and, possible other issue, I see that line 708 of adodb-lib.inc.php conditionally assigns an undocumented sixth value, BRACKETS. I do see that setting it to NATIVE or LOWER causes ADODB to revert to the expected behavior. So, that is a usable workaround. Here is minimal code to repro:
ADOdb_Active_Record munges the case of the query to uppercase table and field names regardless of the setting of ADODB_ASSOC_CASE and, throws errors:
Uncommenting the $ADODB_QUOTE_FIELDNAMES = 'NATIVE' line causes it to revert to the expected behavior. Also of note here is that setting $ADODB_QUOTE_FIELDNAMES to true does not work. |
This quoting / case converting of fields is a bit of a mess at the moment, due to the fact that a $ADODB_QUOTE_FIELDNAMES (badly) attempts to control both. Fixing that is tracked in #745. |
After analysis, I believe that for the time being this is actually the only available workaround (until #745 is done), as I don't want to mess with changing default behavior at the risk of introducing other regressions. |
The casing of table, column and index names are incorrectly linked to the casing of returned associative array keys and the field quoting performed, see #792. This change separates the feature into distinct methods solely for the feature, and deprecates previous methodologies
Upgrading from Adodb 5.20.16 to 5.21.3, I have run into an issue where ADODB_Active_Record is changing the case of the table name and field names to all-caps from provided lowercase in update and insert queries (select seems to be fine). In my case, this has caused previously-working code to start throwing errors about tables not existing (e.g., it is saying CLIENTS doesn’t exist when asked to update data in clients).
While I understand that there are server settings for making MySQL case-insensitive, ADODB should not be changing the case of provided table names or fields.
From the setup:
From the traceback:
INSERT INTO CLIENTS (…) VALUES (…) ) ) … Table ‘redacted_db_name.CLIENTS' doesn't exist
The text was updated successfully, but these errors were encountered: