diff options
author | Alexey Kopytov <Alexey.Kopytov@Sun.com> | 2010-05-11 12:27:53 +0400 |
---|---|---|
committer | Alexey Kopytov <Alexey.Kopytov@Sun.com> | 2010-05-11 12:27:53 +0400 |
commit | d9a5541a34f273c390f088504dc41daf6cdfaa0a (patch) | |
tree | a082c9a70425283b10f95421a2d3c2f680aa939c /sql-common | |
parent | cb421d43cdc0eaa5f342ac3c75c1a4c4a4156f6c (diff) | |
parent | 6d0425b18df7468036a1bbf6d781d624a28e2fb3 (diff) | |
download | mariadb-git-d9a5541a34f273c390f088504dc41daf6cdfaa0a.tar.gz |
Manual merge from mysql-5.1-bugteam to mysql-trunk-merge.
Conflicts:
Text conflict in tests/mysql_client_test.c
Diffstat (limited to 'sql-common')
-rw-r--r-- | sql-common/client.c | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/sql-common/client.c b/sql-common/client.c index 173d8397bd9..bb7bd4d2633 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -2884,6 +2884,11 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, goto error; } + /* + Using init_commands is not supported when connecting from within the + server. + */ +#ifndef MYSQL_SERVER if (mysql->options.init_commands) { DYNAMIC_ARRAY *init_commands= mysql->options.init_commands; @@ -2895,18 +2900,26 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, for (; ptr < end_command; ptr++) { - MYSQL_RES *res; + int status; + if (mysql_real_query(mysql,*ptr, (ulong) strlen(*ptr))) goto error; - if (mysql->fields) - { - if (!(res= cli_use_result(mysql))) - goto error; - mysql_free_result(res); - } + + do { + if (mysql->fields) + { + MYSQL_RES *res; + if (!(res= cli_use_result(mysql))) + goto error; + mysql_free_result(res); + } + if ((status= mysql_next_result(mysql)) > 0) + goto error; + } while (status == 0); } mysql->reconnect=reconnect; } +#endif DBUG_PRINT("exit", ("Mysql handler: 0x%lx", (long) mysql)); reset_sigpipe(mysql); |