Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By jsloan on
I know that it has been discussed before and I retrieved the scripts from Lars Gregori (but they have not been updated since 2001).
So, is there an interest from the rest of the community in implementing a prefix on the database tables?
Let the discussion begin !
Comments
Gary has been working on this
Gary has been working on database prefix code recently. Check his sandbox in the contributions repository. Feel free to help.
Side effects of function db_prefix_tables()
Hello all,
I hope that this is read by someone, and not dropped because it is on an old thread...
There is a serious problem with the db_prefix_tables implementation. What this function appears to do is remove all occurances of "{" and "}" in an SQL query. It does this based on the convention of specifying prefixable database names like "{user}".
Unfortunately this breaks queries which have serialized data such as arrays. Serialized arrays have the form:
I have just spent several hours trying to track down why the ldap_authentication module wouldn't work right, and it was due to this :)
My fix would be to turn this:
into this:
This should work for most cases because serialized data in an sql query is usually surrounded by single quotes, and not a trailing space. Thoughts?
Regards, Mark.
Addition to the function change
Just discovered we should also check for the "}." case as well. Ie queries which go "SELECT {users}.[fields]..."
Which version
Are you using latest CVS? Dries committed a patch to database API by Gerhard a few days ago which should have fixed this.