Hello,
I am working on writing a module for a client who has a large amount of data split across several tables that have essentially the same structure, but different names, and because of this I often find myself having to generate dynamic table names to access these tables. Currently I have to validate the user-supplied part of the table name, then run the table name through db_escape_table() to ensure that it contains no bad characters.
It would be handy (and not too difficult to implement, I imagine) to add another %-modifier to db_query(), %t, which would simply run the supplied string through db_escape_table(). Is there a reason this hasn't been done in the past (trying to discourage the use of dynamic table names, perhaps)?
Thanks,
Ben