Created attachment 23365 [details] add DBDInitSQL parameter to mod_dbd Usually, after connection to DB has been established, user has to execute some initialization statement. For example this one: SET NAMES 'utf8'; Attached patch adds configuration parameter DBDInitSQL, which enables user to specify which statement(s) to execute after connection has been established. Same like parameter for prepared statements: DBDInitSQL "SET NAMES 'utf8'" label This patch is part of major change to mod_dbd concerning DBDPool-s. See http://www.mail-archive.com/dev@httpd.apache.org/msg42922.html
Created attachment 23379 [details] add DBDInitSQL parameter to mod_dbd http://www.mail-archive.com/dev@httpd.apache.org/msg43269.html Nick Kew proposed use of hook instead of function call. So I'v implemented that and now i am adding new patch.
Comments from Ronald Park on dev@httpd.apache.org: (http://marc.info/?l=apache-httpd-dev&m=123792143900952&w=2) I think this is an excellent set of patches. I had developed a similar enhancement to allow mod_dbd to connect with multiple databases at my last job but never had a chance to make it available here. Your version is far more clever and configurable. I did have one minor nit to pick with the implementation of the DBDInitSQL command. A user might presume that the order of commands listed in the config file would be preserved when the commands are run. By using a hash table, you'll likely get a random order causing problems. For example, perhaps the user needs to first load one table then choose a subset from that first table to file another; if you run them in the reserve order, the second table will likely be empty. :( If you choose not to change the implementation, then the documentation should make this clear.
Created attachment 23482 [details] main patch This patch adds ability to the mod_dbd Apache module to execute any SQL statements after DB connection have been established. Patch is against httpd trunk. Configuration example: DBDriver mysql DBDParams host=localhost,user=root,reconnect=0 DBDPersist On DBDInitSQL "USE passport" DBDInitSQL "SET NAMES utf8" DBDMin 1 Order of the DBDInitSQL statements is preserved (statements will be executed in same order they were in httpd.conf file). Also this patch introduces optional post_connection hook, which enables any other module to hook after connection were established.
Created attachment 23500 [details] new patch Removed DBD_DECLARE_NONSTD(void) from ap_dbd_sql_init function definition.
My understanding is that this was committed to trunk, can you confirm whether this was resolved? Can you reopen this if not.