summaryrefslogtreecommitdiff
path: root/ext/mysqli
diff options
context:
space:
mode:
authorGeorg Richter <georg@php.net>2004-08-12 22:14:06 +0000
committerGeorg Richter <georg@php.net>2004-08-12 22:14:06 +0000
commit8ff952813825be09fad4c55855da39216d532ffc (patch)
tree93b5e947243167ae151645f8b049cf6d191e1dfa /ext/mysqli
parent6639ab84690e238c00b59509bd154d5ef770a81b (diff)
downloadphp-git-8ff952813825be09fad4c55855da39216d532ffc.tar.gz
minor fix in mysqli_prepare: copying stmt errormessag to mysql structure
Diffstat (limited to 'ext/mysqli')
-rw-r--r--ext/mysqli/mysqli_api.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/ext/mysqli/mysqli_api.c b/ext/mysqli/mysqli_api.c
index 5345aa34fe..d6fa8fe6c2 100644
--- a/ext/mysqli/mysqli_api.c
+++ b/ext/mysqli/mysqli_api.c
@@ -1243,6 +1243,12 @@ PHP_FUNCTION(mysqli_prepare)
if ((stmt->stmt = mysql_stmt_init(mysql->mysql))) {
if (mysql_stmt_prepare(stmt->stmt, query, query_len)) {
+ if (stmt->stmt->last_errno) {
+ /* if we close the statement handle, we have to copy the errors to connection handle */
+ mysql->mysql->net.last_errno = stmt->stmt->last_errno;
+ strcpy(mysql->mysql->net.last_error, stmt->stmt->last_error);
+ strcpy(mysql->mysql->net.sqlstate, stmt->stmt->sqlstate);
+ }
mysql_stmt_close(stmt->stmt);
stmt->stmt = NULL;
}