diff options
author | monty@mysql.com <> | 2005-06-01 16:35:09 +0300 |
---|---|---|
committer | monty@mysql.com <> | 2005-06-01 16:35:09 +0300 |
commit | a69f4321155fced6ef3a771e68b7dab1d2f119cc (patch) | |
tree | ad666c13b9844b04a96005aa6c422f8542efce7c /client/mysql.cc | |
parent | e253b7815a2f27461d47a6097aa5b6cc6458de1a (diff) | |
download | mariadb-git-a69f4321155fced6ef3a771e68b7dab1d2f119cc.tar.gz |
Code cleanups during code reviews
Ensure we get error if INSERT IGNORE ... SELECT fails
Fixed wrong key_part->key_length usage in index_merge
Diffstat (limited to 'client/mysql.cc')
-rw-r--r-- | client/mysql.cc | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/client/mysql.cc b/client/mysql.cc index 9cdc270e8ed..9733089c324 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -1657,11 +1657,12 @@ int mysql_real_query_for_lazy(const char *buf, int length) { for (uint retry=0;; retry++) { + int error; if (!mysql_real_query(&mysql,buf,length)) return 0; - int error= put_error(&mysql); + error= put_error(&mysql); if (mysql_errno(&mysql) != CR_SERVER_GONE_ERROR || retry > 1 || - !opt_reconnect) + !opt_reconnect) return error; if (reconnect()) return error; @@ -2237,22 +2238,23 @@ print_table_data_vertically(MYSQL_RES *result) } } + /* print_warnings should be called right after executing a statement */ -static void -print_warnings() + +static void print_warnings() { - char query[30]; + const char *query; MYSQL_RES *result; MYSQL_ROW cur; + my_ulonglong num_rows; /* Get the warnings */ - strmov(query,"show warnings"); - mysql_real_query_for_lazy(query,strlen(query)); + query= "show warnings"; + mysql_real_query_for_lazy(query, strlen(query)); mysql_store_result_for_lazy(&result); /* Bail out when no warnings */ - my_ulonglong num_rows = mysql_num_rows(result); - if (num_rows == 0) + if (!(num_rows= mysql_num_rows(result))) { mysql_free_result(result); return; @@ -2266,13 +2268,12 @@ print_warnings() mysql_free_result(result); } -static const char -*array_value(const char **array, char key) + +static const char *array_value(const char **array, char key) { - int x; - for (x= 0; array[x]; x+= 2) - if (*array[x] == key) - return array[x + 1]; + for (; *array; array+= 2) + if (**array == key) + return array[1]; return 0; } |