summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2005-12-21 16:23:32 +0000
committerIlia Alshanetsky <iliaa@php.net>2005-12-21 16:23:32 +0000
commit41ef7fb555eda571347cf922832921935969d53b (patch)
treefdaf6febd6dfe2fd9289bab8b4d317b650338b58
parent88a1a3cecc073c9a020c2693665be49b822a7f2a (diff)
downloadphp-git-41ef7fb555eda571347cf922832921935969d53b.tar.gz
MFB51: Don't lose track of exec() errors in pdo_sqlite2
-rw-r--r--ext/sqlite/pdo_sqlite2.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/ext/sqlite/pdo_sqlite2.c b/ext/sqlite/pdo_sqlite2.c
index 8723ae6441..648e10789b 100644
--- a/ext/sqlite/pdo_sqlite2.c
+++ b/ext/sqlite/pdo_sqlite2.c
@@ -326,6 +326,10 @@ static int sqlite2_handle_closer(pdo_dbh_t *dbh TSRMLS_DC) /* {{{ */
sqlite_close(H->db);
H->db = NULL;
}
+ if (H->einfo.errmsg) {
+ pefree(H->einfo.errmsg, dbh->is_persistent);
+ H->einfo.errmsg = NULL;
+ }
pefree(H, dbh->is_persistent);
dbh->driver_data = NULL;
}
@@ -357,7 +361,7 @@ static long sqlite2_handle_doer(pdo_dbh_t *dbh, const char *sql, long sql_len TS
pdo_sqlite2_db_handle *H = (pdo_sqlite2_db_handle *)dbh->driver_data;
char *errmsg = NULL;
- if (sqlite_exec(H->db, sql, NULL, NULL, &errmsg) != SQLITE_OK) {
+ if ((H->einfo.errcode = sqlite_exec(H->db, sql, NULL, NULL, &errmsg)) != SQLITE_OK) {
pdo_sqlite2_error(errmsg, dbh);
return -1;
} else {