diff --git a/mysys/thr_alarm.c b/mysys/thr_alarm.c index 19611a6027a..abb112b83a7 100644 --- a/mysys/thr_alarm.c +++ b/mysys/thr_alarm.c @@ -85,7 +85,7 @@ void init_thr_alarm(uint max_alarms) #else { struct sigaction sact; - sact.sa_flags = 0; + bzero((char*) &sact, sizeof(sact)); sact.sa_handler = thread_alarm; sigaction(THR_CLIENT_ALARM, &sact, (struct sigaction*) 0); } diff --git a/sql/handler.cc b/sql/handler.cc index d641628ac86..b2ab2003165 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -1376,7 +1376,19 @@ next_insert_id(ulonglong nr,struct system_variables *variables) /* - Updates columns with type NEXT_NUMBER if: + Update the auto_increment field if necessary + + SYNOPSIS + update_auto_increment() + + RETURN + 0 ok + 1 get_auto_increment() was called and returned ~(ulonglong) 0 + + + IMPLEMENTATION + + Updates columns with type NEXT_NUMBER if: - If column value is set to NULL (in which case auto_increment_field_not_null is 0) @@ -1415,12 +1427,13 @@ next_insert_id(ulonglong nr,struct system_variables *variables) thd->next_insert_id is cleared after it's been used for a statement. */ -void handler::update_auto_increment() +bool handler::update_auto_increment() { ulonglong nr; THD *thd= table->in_use; struct system_variables *variables= &thd->variables; bool auto_increment_field_not_null; + bool result= 0; DBUG_ENTER("handler::update_auto_increment"); /* @@ -1449,11 +1462,13 @@ void handler::update_auto_increment() thd->next_insert_id= nr; DBUG_PRINT("info",("next_insert_id: %lu", (ulong) nr)); } - DBUG_VOID_RETURN; + DBUG_RETURN(0); } if (!(nr= thd->next_insert_id)) { - nr= get_auto_increment(); + if ((nr= get_auto_increment()) == ~(ulonglong) 0) + result= 1; // Mark failure + if (variables->auto_increment_increment != 1) nr= next_insert_id(nr-1, variables); /* @@ -1493,7 +1508,7 @@ void handler::update_auto_increment() /* Mark that we generated a new value */ auto_increment_column_changed=1; - DBUG_VOID_RETURN; + DBUG_RETURN(result); } /* diff --git a/sql/handler.h b/sql/handler.h index 6a259da0d43..a530406356e 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -497,7 +497,7 @@ public: {} virtual ~handler(void) { /* TODO: DBUG_ASSERT(inited == NONE); */ } int ha_open(const char *name, int mode, int test_if_locked); - void update_auto_increment(); + bool update_auto_increment(); virtual void print_error(int error, myf errflag); virtual bool get_error_message(int error, String *buf); uint get_dup_key(int error); diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index fb7827ef932..52449f6d91c 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -2906,9 +2906,9 @@ String *Item_func_uuid::val_str(String *str) ulonglong tv=my_getsystime() + UUID_TIME_OFFSET + nanoseq; if (unlikely(tv < uuid_time)) set_clock_seq_str(); - else - if (unlikely(tv == uuid_time)) - { /* special protection from low-res system clocks */ + else if (unlikely(tv == uuid_time)) + { + /* special protection from low-res system clocks */ nanoseq++; tv++; } diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index 08ea5f1c1c9..95db383bbb6 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -787,6 +787,7 @@ static void verify_field_count(MYSQL_RES *result, uint exp_count) /* Utility function to execute a query using prepare-execute */ +#ifndef EMBEDDED_LIBRARY static void execute_prepare_query(const char *query, ulonglong exp_count) { MYSQL_STMT *stmt; @@ -807,7 +808,7 @@ static void execute_prepare_query(const char *query, ulonglong exp_count) DIE_UNLESS(affected_rows == exp_count); mysql_stmt_close(stmt); } - +#endif /* Store result processing */