diff options
author | monty@mashka.mysql.fi <> | 2002-10-02 13:33:08 +0300 |
---|---|---|
committer | monty@mashka.mysql.fi <> | 2002-10-02 13:33:08 +0300 |
commit | d69250a969449da43891ef5b2859df77917183a8 (patch) | |
tree | 5a27bda6d3f628af7dcb922ad022e84cf8cb351c /client/mysql.cc | |
parent | 7134ffec210edde21860a2b2c2654be481de49b4 (diff) | |
download | mariadb-git-d69250a969449da43891ef5b2859df77917183a8.tar.gz |
Fixes and code cleanups after merge with 4.0.3
Warning handling and initial prepared statement handling (last not complete yet)
Changed a lot of functions that returned 0/1 to my_bool type.
GRANT handling now uses read/write locks instead of mutex
Change basic net functions to use THD instead of NET
(needed for 4.1 protocol)
Use my_sprintf instead of sprintf() + strlen()
Added alloc_query() to be able to chare query initialization code with
prepared statements.
Cleanup handling of SHOW COUNT(*) WARNINGS and SELECT LAST_INSERT_ID()
Note that the following test fails (will be fixed ASAP):
sub_select, union, rpl_rotate_logs and rpl_mystery22
Diffstat (limited to 'client/mysql.cc')
-rw-r--r-- | client/mysql.cc | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/client/mysql.cc b/client/mysql.cc index 7fd221f479c..223d4b794d2 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -40,7 +40,7 @@ #include <signal.h> #include <violite.h> -const char *VER= "12.12"; +const char *VER= "12.13"; /* Don't try to make a nice table if the data is too big */ #define MAX_COLUMN_LENGTH 1024 @@ -1362,9 +1362,9 @@ com_clear(String *buffer,char *line __attribute__((unused))) static int com_go(String *buffer,char *line __attribute__((unused))) { - char buff[160],time_buff[32]; + char buff[200], time_buff[32], *pos; MYSQL_RES *result; - ulong timer; + ulong timer, warnings; uint error=0; if (!status.batch) @@ -1447,7 +1447,7 @@ com_go(String *buffer,char *line __attribute__((unused))) { if (!mysql_num_rows(result) && ! quick) { - sprintf(buff,"Empty set%s",time_buff); + strmov(buff, "Empty set"); } else { @@ -1462,20 +1462,30 @@ com_go(String *buffer,char *line __attribute__((unused))) print_tab_data(result); else print_table_data(result); - sprintf(buff,"%ld %s in set%s", + sprintf(buff,"%ld %s in set", (long) mysql_num_rows(result), - (long) mysql_num_rows(result) == 1 ? "row" : "rows", - time_buff); + (long) mysql_num_rows(result) == 1 ? "row" : "rows"); end_pager(); } } else if (mysql_affected_rows(&mysql) == ~(ulonglong) 0) - sprintf(buff,"Query OK%s",time_buff); + strmov(buff,"Query OK"); else - sprintf(buff,"Query OK, %ld %s affected%s", + sprintf(buff,"Query OK, %ld %s affected", (long) mysql_affected_rows(&mysql), - (long) mysql_affected_rows(&mysql) == 1 ? "row" : "rows", - time_buff); + (long) mysql_affected_rows(&mysql) == 1 ? "row" : "rows"); + + pos=strend(buff); + if ((warnings= mysql_warning_count(&mysql))) + { + *pos++= ','; + *pos++= ' '; + pos=int2str(warnings, pos, 10); + pos=strmov(pos, " warning"); + if (warnings != 1) + *pos++= 's'; + } + strmov(pos, time_buff); put_info(buff,INFO_RESULT); if (mysql_info(&mysql)) put_info(mysql_info(&mysql),INFO_RESULT); |