I'm trying to write a module to bridge several kinds of game servers to Drupal through the database. I've got quite a bit done, but I'd like to add some validation. I want to ensure that a database column a user inputs to a textfield exists in a database. The catch is, the table it's querying may or may not have the same prefix as Drupal, and I'd rather not require that they have the same prefix.
I could easily construct a custom query to do the trick, but I'd rather use Drupal's database abstraction layer (since I've no idea who may be using this module in odd ways in the future). Is it possible to query a table with a different prefix using db_whatever without manually adding that prefix to settings.php?
Comments
How to connect to multiple
How to connect to multiple databases within Drupal talks about connecting to different database but the D6 notes do not mention using different prefixes. One of the comments for D7 does show a solution for D7. In D6 the prefix is a global $db_prefix not associated with a particular database.
I wonder if I can steal some
I wonder if I can steal some of D7's code to put into my module...
I'm using D6 so that I can use some modules that are no longer maintained, but I might just end up replacing them and upgrading if I can't copy D7 code.
Thanks for the link!
Actually, I misunderstood
Actually, I misunderstood your post. Found the comment you were referring to, looks like a nice hack to use. Thanks again. :)