diff options
-rw-r--r-- | mysql-test/r/connect.result | 2 | ||||
-rw-r--r-- | sql-common/client.c | 18 |
2 files changed, 18 insertions, 2 deletions
diff --git a/mysql-test/r/connect.result b/mysql-test/r/connect.result index c323bdf5998..f2bacf92cc8 100644 --- a/mysql-test/r/connect.result +++ b/mysql-test/r/connect.result @@ -150,7 +150,7 @@ ERROR 08004: Too many connections # -- Connecting super (1)... # -- Connecting super (2)... -ERROR 00000: Too many connections +ERROR HY000: Too many connections SELECT user FROM information_schema.processlist ORDER BY id; user diff --git a/sql-common/client.c b/sql-common/client.c index b1728f0f74f..e7cf30c1a35 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -684,6 +684,16 @@ cli_safe_read(MYSQL *mysql) strmake(net->sqlstate, pos+1, SQLSTATE_LENGTH); pos+= SQLSTATE_LENGTH+1; } + else + { + /* + The SQL state hasn't been received -- it should be reset to HY000 + (unknown error sql state). + */ + + strmov(net->sqlstate, unknown_sqlstate); + } + (void) strmake(net->last_error,(char*) pos, min((uint) len,(uint) sizeof(net->last_error)-1)); } @@ -1897,7 +1907,13 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, (int) have_tcpip)); if (mysql->options.protocol == MYSQL_PROTOCOL_MEMORY) goto error; - /* Try also with PIPE or TCP/IP */ + + /* + Try also with PIPE or TCP/IP. Clear the error from + create_shared_memory(). + */ + + net_clear_error(net); } else { |