Author: ahristov
Date: 2007-03-28 21:30:15 +0200 (Wed, 28 Mar 2007)
New Revision: 300
Modified:
trunk/ext/mysqli/mysqlnd/mysqlnd.c
trunk/ext/mysqli/mysqlnd/mysqlnd_wireprotocol.c
trunk/ext/mysqli/mysqlnd/mysqlnd_wireprotocol.h
Log:
Add handling of error in EOF packets.
Modified: trunk/ext/mysqli/mysqlnd/mysqlnd.c
===================================================================
--- trunk/ext/mysqli/mysqlnd/mysqlnd.c 2007-03-28 19:09:40 UTC (rev 299)
+++ trunk/ext/mysqli/mysqlnd/mysqlnd.c 2007-03-28 19:30:15 UTC (rev 300)
@@ -478,6 +478,11 @@
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error while reading %s's EOF packet",
mysqlnd_command_to_text[command]);
}
+ } else if (0xFF == ok_response.field_count) {
+ /* The server signalled error. Set the error */
+ SET_CLIENT_ERROR(conn->error_info, ok_response.error_no,
+ ok_response.sqlstate, ok_response.error);
+ conn->upsert_status.affected_rows = (mynd_ulonglong) ~0;
} else if (0xFE != ok_response.field_count) {
SET_CLIENT_ERROR(conn->error_info, CR_MALFORMED_PACKET, UNKNOWN_SQLSTATE,
"Malformed packet");
Modified: trunk/ext/mysqli/mysqlnd/mysqlnd_wireprotocol.c
===================================================================
--- trunk/ext/mysqli/mysqlnd/mysqlnd_wireprotocol.c 2007-03-28 19:09:40 UTC (rev 299)
+++ trunk/ext/mysqli/mysqlnd/mysqlnd_wireprotocol.c 2007-03-28 19:30:15 UTC (rev 300)
@@ -729,6 +729,13 @@
packet->field_count= uint1korr(p);
p++;
+ if (0xFF == packet->field_count) {
+ php_mysqlnd_read_error_from_line(p, packet->header.size - 1,
+ packet->error, sizeof(packet->error),
+ &packet->error_no, packet->sqlstate);
+ return PASS;
+ }
+
packet->warning_count = uint2korr(p);
p+= 2;
packet->server_status = uint2korr(p);
Modified: trunk/ext/mysqli/mysqlnd/mysqlnd_wireprotocol.h
===================================================================
--- trunk/ext/mysqli/mysqlnd/mysqlnd_wireprotocol.h 2007-03-28 19:09:40 UTC (rev 299)
+++ trunk/ext/mysqli/mysqlnd/mysqlnd_wireprotocol.h 2007-03-28 19:30:15 UTC (rev 300)
@@ -197,6 +197,10 @@
mysqlnd_1b field_count; /* 0xFE */
mysqlnd_2b warning_count;
mysqlnd_2b server_status;
+ /* If error packet, we use these */
+ char error[MYSQLND_ERRMSG_SIZE+1];
+ char sqlstate[MYSQLND_SQLSTATE_LENGTH + 1];
+ unsigned int error_no;
} php_mysql_packet_eof;
/* EOF packet */
| Thread |
|---|
| • PHP mysqlnd svn commit: r300 - trunk/ext/mysqli/mysqlnd | ahristov | 28 Mar |