mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Code cleanups during code reviews
Ensure we get error if INSERT IGNORE ... SELECT fails Fixed wrong key_part->key_length usage in index_merge client/mysql.cc: Code cleanups & simply optimizations mysql-test/r/information_schema.result: Safety mysql-test/t/information_schema.test: Safety sql/ha_ndbcluster.cc: Code cleanups sql/item.cc: Code cleanups sql/item_subselect.cc: Code cleanups sql/item_sum.cc: Code cleanups sql/opt_range.cc: Made get_index_only_read_time() static (instad of inline) to increase portability (function was not declared before use) Simple optimization Fixed wrong key_part->key_length usage in index_merge Removed not used variable n_used_covered Indentation fixes & comment cleanups sql/parse_file.cc: Code cleanups sql/sql_base.cc: Code cleanups sql/sql_bitmap.h: Added missing return sql/sql_insert.cc: Ensure we get error if INSERT IGNORE ... SELECT fails sql/sql_select.cc: Code cleanups sql/sql_show.cc: Safety fix if a LOT of errors are ignored sql/sql_update.cc: Code cleanups sql/table.cc: Code cleanups sql/table.h: Code cleanups sql/uniques.cc: Code cleanups strings/decimal.c: Simple optimization Code cleanups
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user