Closed (works as designed)
Project:
Drupal core
Version:
7.x-dev
Component:
database system
Priority:
Minor
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
15 Mar 2010 at 18:07 UTC
Updated:
16 Mar 2010 at 19:18 UTC
Using D7, I noticed that I can't use a placeholder for the table name in any db_* functions. I can't seem to find any info why, apologize if it has been discussed.
The only way around it has been to stringify the name. For instance, {".$db_table."}. I realize, with the newer D7 Database API this is not that big a deal; however, when you want to preserve an older query string, this becomes an issue.
Thanks
Comments
Comment #1
Crell commentedThat's because we're not using pseudo-placeholders anymore. We're using DB-native placeholders, which have actual significance in SQL rather than being just a simple str_replace().
If you have a dynamic table name, you can either inject it into the string manually (after sanitizing it yourself!) or use the query builders to create the query, as you pass the table name into the factory function.