minor fix in mysqli_prepare: copying stmt errormessag to mysql structure

This commit is contained in:
Georg Richter 2004-08-12 22:14:06 +00:00
parent 6639ab8469
commit 8ff9528138

View File

@ -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;
}