Hi, I am trying to use prepared INSERT statements for mod_dbd with the mysql driver, but somehow always a 0 is written to the database instead of a string. This is what I do:
// In configuration directives stage ap_dbd_prepare(s, "INSERT INTO request_type (name) VALUES (%s) " "ON DUPLICATE KEY UPDATE frequency = frequency + 1", "insert_request_type"); // In hook post_read_request apr_dbd_prepared_t *prep_stmt; if (NULL == (prep_stmt = apr_hash_get(req_cfg->dbd->prepared, "insert_request_type", APR_HASH_KEY_STRING))) { ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, "DBD Log: Could not get prepared statement with label: insert_request_type"); return DECLINED; } int nrows, rv; if (rv = apr_dbd_pvquery(req_cfg->dbd->driver, r->pool, req_cfg->dbd->handle, &nrows, prep_stmt, req_cfg->request_type, NULL)) { ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, "DBD Log: Failed to execute prepared statement with label: insert_request_type"); return DECLINED; } Then this is what ends up in my MySQL log: Prepare INSERT INTO request_type (name) VALUES (?) ON DUPLICATE KEY UPDATE frequency = frequency + 1 Execute INSERT INTO request_type (name) VALUES (0) ON DUPLICATE KEY UPDATE frequency = frequency + 1 So it seems that the statement is prepared correctly, but somehow the string I want to write is replaced by a 0. Am I doing something terribly wrong here? I don't get it. Cheers, Andrej