char *db_password;
int db_port; /* port for host name address */
bool connected; /* connection made to db */
+ bool have_insert_id; /* do not have insert id */
bool fields_defined; /* set when fields defined */
char *sqlite_errmsg; /* error message returned by sqlite */
POOLMEM *errmsg; /* nicely edited error message */
char *db_password;
int db_port; /* port for host name address */
bool connected; /* connection made to db */
+ bool have_insert_id; /* do not have insert id */
bool fields_defined; /* set when fields defined */
char *sqlite_errmsg; /* error message returned by sqlite */
POOLMEM *errmsg; /* nicely edited error message */
char *db_address; /* host address */
char *db_socket; /* socket for local access */
int db_port; /* port of host address */
+ int have_insert_id; /* do have insert_id() */
bool connected;
POOLMEM *errmsg; /* nicely edited error message */
POOLMEM *cmd; /* SQL command string */
char *db_address; /* host address */
char *db_socket; /* socket for local access */
int db_port; /* port of host address */
+ int have_insert_id; /* do have insert_id() */
bool connected;
POOLMEM *errmsg; /* nicely edited error message */
POOLMEM *cmd; /* SQL command string */
char *db_socket; /* socket for local access */
int db_port; /* port of host address */
int session_id; /* unique session id */
+ int have_insert_id; /* do have insert_id() */
bool connected;
POOLMEM *errmsg; /* nicely edited error message */
POOLMEM *cmd; /* SQL command string */
char *db_address; /* host address */
char *db_socket; /* socket for local access */
int db_port; /* port of host address */
+ int have_insert_id; /* do have insert_id() */
bool connected;
POOLMEM *errmsg; /* nicely edited error message */
POOLMEM *cmd; /* SQL command string */
}
return 0;
}
- mdb->num_rows = sql_affected_rows(mdb);
+ if (mdb->have_insert_id) {
+ mdb->num_rows = sql_affected_rows(mdb);
+ } else {
+ mdb->num_rows = 1;
+ }
if (mdb->num_rows != 1) {
char ed1[30];
m_msg(file, line, &mdb->errmsg, _("Insertion problem: affected_rows=%s\n"),
mdb = (B_DB *) malloc(sizeof(B_DB));
memset(mdb, 0, sizeof(B_DB));
mdb->db_name = bstrdup(db_name);
+ mdb->have_insert_id = true;
mdb->errmsg = get_pool_memory(PM_EMSG); /* get error message buffer */
*mdb->errmsg = 0;
mdb->cmd = get_pool_memory(PM_EMSG); /* get command buffer */