Skip to content

Commit 393b82d

Browse files
committed
changes for mysql 5.6
1 parent bbd00c9 commit 393b82d

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

handlersocket/database.cpp

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,8 +309,12 @@ dbcontext::init_thread(const void *stack_bottom, volatile int& shutdown_flag)
309309
{
310310
pthread_mutex_lock(&LOCK_thread_count);
311311
thd->thread_id = thread_id++;
312+
#if MYSQL_VERSION_ID >= 50600
313+
add_global_thread(thd);
314+
#else
312315
threads.append(thd);
313316
++thread_count;
317+
#endif
314318
pthread_mutex_unlock(&LOCK_thread_count);
315319
}
316320

@@ -346,9 +350,13 @@ dbcontext::term_thread()
346350
my_pthread_setspecific_ptr(THR_THD, 0);
347351
{
348352
pthread_mutex_lock(&LOCK_thread_count);
353+
#if MYSQL_VERSION_ID >= 50600
354+
remove_global_thread(thd);
355+
#else
356+
--thread_count;
357+
#endif
349358
delete thd;
350359
thd = 0;
351-
--thread_count;
352360
pthread_mutex_unlock(&LOCK_thread_count);
353361
my_thread_end();
354362
}
@@ -763,7 +771,11 @@ dbcontext::cmd_find_internal(dbcallback_i& cb, const prep_stmt& pst,
763771
return cb.dbcb_resp_short(2, "idxnum");
764772
}
765773
KEY& kinfo = table->key_info[pst.get_idxnum()];
774+
#if MYSQL_VERSION_ID >= 50600
775+
if (args.kvalslen > kinfo.actual_key_parts) {
776+
#else
766777
if (args.kvalslen > kinfo.key_parts) {
778+
#endif
767779
return cb.dbcb_resp_short(2, "kpnum");
768780
}
769781
uchar *const key_buf = DENA_ALLOCA_ALLOCATE(uchar, kinfo.key_length);
@@ -812,11 +824,19 @@ dbcontext::cmd_find_internal(dbcallback_i& cb, const prep_stmt& pst,
812824
switch (find_flag) {
813825
case HA_READ_BEFORE_KEY:
814826
case HA_READ_KEY_OR_PREV:
827+
#if MYSQL_VERSION_ID >= 50600
828+
r = hnd->ha_index_prev(table->record[0]);
829+
#else
815830
r = hnd->index_prev(table->record[0]);
831+
#endif
816832
break;
817833
case HA_READ_AFTER_KEY:
818834
case HA_READ_KEY_OR_NEXT:
835+
#if MYSQL_VERSION_ID >= 50600
836+
r = hnd->ha_index_next(table->record[0]);
837+
#else
819838
r = hnd->index_next(table->record[0]);
839+
#endif
820840
break;
821841
case HA_READ_KEY_EXACT:
822842
r = hnd->index_next_same(table->record[0], key_buf, kplen_sum);
@@ -1015,7 +1035,11 @@ dbcontext::cmd_open(dbcallback_i& cb, const cmd_open_args& arg)
10151035
tables.mdl_request.init(MDL_key::TABLE, arg.dbn, arg.tbl,
10161036
for_write_flag ? MDL_SHARED_WRITE : MDL_SHARED_READ, MDL_TRANSACTION);
10171037
Open_table_context ot_act(thd, 0);
1038+
#if MYSQL_VERSION_ID >= 50600
1039+
if (!open_table(thd, &tables, &ot_act)) {
1040+
#else
10181041
if (!open_table(thd, &tables, thd->mem_root, &ot_act)) {
1042+
#endif
10191043
table = tables.table;
10201044
}
10211045
#else

handlersocket/mysql_incl.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@
4343
#include "mysql_priv.h"
4444
#endif
4545

46+
#if MYSQL_VERSION_ID >= 50600
47+
#include <global_threads.h>
48+
#endif
49+
4650
#undef min
4751
#undef max
4852

0 commit comments

Comments
 (0)