>>>>> "Edward" == Edward Rudd <[EMAIL PROTECTED]> writes:
Edward> The ideal solution for this is to move the SQL query into the Edward> backend, by adding a new function to backend driver. I don't beleive that is an option in this case, since, AIUI, mysql only added stored procedures in the latest version, yes? The original, mysql-specific query he used is: ,---- | insert ignore into %s (domain,vhost,month,year,count_impressions) | values ('%s','%s','%s','%s','0') `---- I discovered that this works on postgres, w/o having to change any of the rest of his patch: ,---- | begin;insert into %s (domain,vhost,month,year,count_impressions) | values ('%s','%s',%s,%s,0);commit `---- Ie, s/insert ignore/insert/ and wrap in a transaction. I discovered this issue using mod_log_sql as packaged in debian with the dbi backend and the libdbd-pgsql driver for libdbi. Debian also packages a libdbd-sqlite driver, so the final solution needs to work on at least mysql, pgsql and sqlite. Looking at mod_log_sql.c, it uses this to set the driver: ,----< from mod_log_sql.c set_dbparam() > | apr_table_set(global_config.db.parms,key,val); `---- where key is set to "driver" and val is going to be one of "mysql", "pgsql", "sqlite". So I presume apr_table_get(global_config.db.parms, "driver") ought to do it. I see that there is also globaal_config.driver which is a pointer to a struct logsql_dbdriver. That has member const char *providername. So I'd say that global_config.driver->providername should be the key to use to choose the insert syntax. If that is "dbi" then you may have to call dbi_driver_get_name() (from libdbi) to get the final driver. Or, it may be the case that this is the right way to do it: ,---- | char *drvr; | if (global_config.driver && global_config.driver->providername) { | drvr = global_config.driver->providername; | if (!strncmp(drvr, (const char *)"dbi", strlen(drvr))) | drvr = apr_table_get(global_config.db.parms, (const char *)"driver") | } `---- Also, you may want to use global_config.driver->insert() instead of using safe_sql_insert() to execute the insert. I've not investigated the differences, so I cannot be sure, though. -JimC -- James Cloos <[EMAIL PROTECTED]> OpenPGP: 1024D/ED7DAEA6 -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]