Drupal 10, the latest version of the open-source digital experience platform with even more features, is here.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 CreditAttribution: 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.