diff options
author | Andrey Hristov <andrey@php.net> | 2015-11-02 16:35:59 +0100 |
---|---|---|
committer | Andrey Hristov <andrey@php.net> | 2015-11-12 16:19:16 +0100 |
commit | e30e884e53c2cfed646a218122daeaa9a81f2d45 (patch) | |
tree | c36ca8625cb47c8658e3ffcc88d91440bb3224b6 /ext/mysqlnd/mysqlnd_wireprotocol.c | |
parent | fefc3045a38fa58302ba38fc5986a56fec7613c1 (diff) | |
download | php-git-e30e884e53c2cfed646a218122daeaa9a81f2d45.tar.gz |
MNDR:
- move COM_INIT_DE result handling to the command
Diffstat (limited to 'ext/mysqlnd/mysqlnd_wireprotocol.c')
-rw-r--r-- | ext/mysqlnd/mysqlnd_wireprotocol.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/ext/mysqlnd/mysqlnd_wireprotocol.c b/ext/mysqlnd/mysqlnd_wireprotocol.c index 975239011f..8cfbec3c14 100644 --- a/ext/mysqlnd/mysqlnd_wireprotocol.c +++ b/ext/mysqlnd/mysqlnd_wireprotocol.c @@ -3020,6 +3020,7 @@ mysqlnd_com_init_db_run(void *cmd) struct st_mysqlnd_protocol_com_init_db_command * command = (struct st_mysqlnd_protocol_com_init_db_command *) cmd; enum_func_status ret = FAIL; MYSQLND_CONN_DATA * conn = command->context.conn; + const MYSQLND_CSTRING db = command->context.db; DBG_ENTER("mysqlnd_com_init_db_run"); @@ -3036,6 +3037,24 @@ mysqlnd_com_init_db_run(void *cmd) conn->error_info, conn->upsert_status, conn->payload_decoder_factory, &conn->last_message, conn->persistent); } + /* + The server sends 0 but libmysql doesn't read it and has established + a protocol of giving back -1. Thus we have to follow it :( + */ + UPSERT_STATUS_SET_AFFECTED_ROWS_TO_ERROR(conn->upsert_status); + if (ret == PASS) { + if (conn->connect_or_select_db.s) { + mnd_pefree(conn->connect_or_select_db.s, conn->persistent); + } + conn->connect_or_select_db.s = mnd_pestrndup(db.s, db.l, conn->persistent); + conn->connect_or_select_db.l = db.l; + if (!conn->connect_or_select_db.s) { + /* OOM */ + SET_OOM_ERROR(conn->error_info); + ret = FAIL; + } + } + DBG_RETURN(ret); } /* }}} */ |