transactd 3.1.0 → 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/common/tdclc_32_3_2.dll +0 -0
- data/bin/common/{tdclc_64_3_1.dll → tdclc_64_3_2.dll} +0 -0
- data/build/swig/ruby/ruby.swg +3 -0
- data/build/swig/ruby/tdclrb_wrap.cpp +2413 -126
- data/build/swig/tdcl.i +120 -9
- data/build/tdclc/tdclc.cbproj +4 -1
- data/build/tdclc/tdclc.rc +4 -4
- data/build/tdclcpp/tdclcpp.rc +4 -4
- data/build/tdclcpp/tdclcpp_bc.cbproj +8 -1
- data/build/tdclrb/tdclrb.rc +4 -4
- data/source/bzs/db/engine/mysql/database.cpp +138 -130
- data/source/bzs/db/engine/mysql/database.h +43 -48
- data/source/bzs/db/engine/mysql/dbManager.cpp +81 -96
- data/source/bzs/db/engine/mysql/dbManager.h +13 -22
- data/source/bzs/db/engine/mysql/mysqlInternal.h +157 -291
- data/source/bzs/db/engine/mysql/mysqlProtocol.cpp +425 -0
- data/source/bzs/db/engine/mysql/mysqlProtocol.h +72 -0
- data/source/bzs/db/engine/mysql/mysqlThd.cpp +8 -6
- data/source/bzs/db/protocol/hs/hsCommandExecuter.cpp +7 -3
- data/source/bzs/db/protocol/hs/hsCommandExecuter.h +1 -0
- data/source/bzs/db/protocol/tdap/client/client.h +22 -8
- data/source/bzs/db/protocol/tdap/client/connMgr.cpp +225 -21
- data/source/bzs/db/protocol/tdap/client/connMgr.h +42 -16
- data/source/bzs/db/protocol/tdap/client/database.cpp +58 -15
- data/source/bzs/db/protocol/tdap/client/database.h +3 -3
- data/source/bzs/db/protocol/tdap/client/dbDef.cpp +93 -85
- data/source/bzs/db/protocol/tdap/client/dbDef.h +1 -2
- data/source/bzs/db/protocol/tdap/client/dllmain.cpp +9 -5
- data/source/bzs/db/protocol/tdap/client/filter.h +2 -2
- data/source/bzs/db/protocol/tdap/client/groupComp.h +2 -2
- data/source/bzs/db/protocol/tdap/client/memRecord.cpp +1 -1
- data/source/bzs/db/protocol/tdap/client/nsDatabase.cpp +71 -12
- data/source/bzs/db/protocol/tdap/client/nsDatabase.h +7 -1
- data/source/bzs/db/protocol/tdap/client/nsTable.cpp +35 -2
- data/source/bzs/db/protocol/tdap/client/nsTable.h +1 -0
- data/source/bzs/db/protocol/tdap/client/recordset.cpp +5 -1
- data/source/bzs/db/protocol/tdap/client/recordset.h +15 -0
- data/source/bzs/db/protocol/tdap/client/recordsetImple.h +21 -16
- data/source/bzs/db/protocol/tdap/client/serializer.cpp +32 -11
- data/source/bzs/db/protocol/tdap/client/serializer.h +4 -1
- data/source/bzs/db/protocol/tdap/client/sqlBuilder.cpp +3 -2
- data/source/bzs/db/protocol/tdap/client/sqlBuilder.h +3 -0
- data/source/bzs/db/protocol/tdap/client/table.cpp +18 -14
- data/source/bzs/db/protocol/tdap/client/trdboostapi.h +8 -3
- data/source/bzs/db/protocol/tdap/mysql/characterset.cpp +1 -0
- data/source/bzs/db/protocol/tdap/mysql/databaseSchema.cpp +83 -43
- data/source/bzs/db/protocol/tdap/mysql/databaseSchema.h +3 -1
- data/source/bzs/db/protocol/tdap/mysql/recordsetReader.h +7 -7
- data/source/bzs/db/protocol/tdap/mysql/tdapCommandExecuter.cpp +247 -137
- data/source/bzs/db/protocol/tdap/mysql/tdapCommandExecuter.h +9 -9
- data/source/bzs/db/protocol/tdap/tdapSchema.cpp +1 -4
- data/source/bzs/db/protocol/tdap/tdapSchema.h +3 -7
- data/source/bzs/db/protocol/tdap/tdapcapi.h +23 -3
- data/source/bzs/db/protocol/tdap/uri.h +40 -0
- data/source/bzs/db/transactd/appModule.cpp +14 -5
- data/source/bzs/db/transactd/appModule.h +10 -1
- data/source/bzs/db/transactd/connManager.cpp +93 -48
- data/source/bzs/db/transactd/connManager.h +10 -7
- data/source/bzs/db/transactd/connectionRecord.h +114 -19
- data/source/bzs/env/tstring.h +2 -0
- data/source/bzs/example/changeSchema.cpp +1 -1
- data/source/bzs/example/changeSchema_c.cpp +1 -1
- data/source/bzs/example/insertRecords.cpp +2 -1
- data/source/bzs/example/insertRecords_c.cpp +2 -1
- data/source/bzs/example/queryData.cpp +5 -2
- data/source/bzs/netsvc/server/IAppModule.h +6 -0
- data/source/bzs/test/tdclatl/test_v3.js +75 -0
- data/source/bzs/test/tdclphp/transactd_v3_Test.php +104 -7
- data/source/bzs/test/tdclrb/transactd_v3_spec.rb +84 -0
- data/source/bzs/test/trdclengn/testField.h +66 -6
- data/source/bzs/test/trdclengn/test_tdclcpp_v3.cpp +10 -1
- data/source/bzs/test/trdclengn/test_trdclengn.cpp +85 -0
- data/source/bzs/test/trdclengn/testbase.h +1 -1
- data/source/global/tdclatl/BinlogPos.cpp +64 -0
- data/source/global/tdclatl/BinlogPos.h +84 -0
- data/source/global/tdclatl/ConnMgr.cpp +285 -0
- data/source/global/tdclatl/ConnMgr.h +83 -0
- data/source/global/tdclatl/ConnRecord.cpp +123 -0
- data/source/global/tdclatl/ConnRecord.h +69 -0
- data/source/global/tdclatl/ConnRecords.cpp +57 -0
- data/source/global/tdclatl/ConnRecords.h +55 -0
- data/source/global/tdclatl/Database.cpp +36 -0
- data/source/global/tdclatl/Database.h +4 -0
- data/source/global/tdclatl/Table.cpp +14 -1
- data/source/global/tdclatl/Table.h +1 -0
- data/source/global/tdclatl/resource.h +0 -0
- data/source/global/tdclatl/tdclatl.idl +148 -4
- metadata +14 -4
- data/bin/common/tdclc_32_3_1.dll +0 -0
@@ -18,7 +18,9 @@
|
|
18
18
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
19
19
|
02111-1307, USA.
|
20
20
|
================================================================= */
|
21
|
-
|
21
|
+
#ifdef __GNUC__
|
22
|
+
#pragma interface // implementation mysqlProtocol.cpp
|
23
|
+
#endif
|
22
24
|
#undef _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES
|
23
25
|
#define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES 1
|
24
26
|
|
@@ -51,19 +53,28 @@
|
|
51
53
|
#include <my_config.h>
|
52
54
|
#include <mysql_version.h>
|
53
55
|
|
54
|
-
#if defined(MARIADB_BASE_VERSION)
|
55
|
-
#
|
56
|
-
#
|
57
|
-
#
|
58
|
-
#
|
59
|
-
#
|
56
|
+
#if defined(MARIADB_BASE_VERSION)
|
57
|
+
# if (MYSQL_VERSION_ID > 100107)
|
58
|
+
# define MARIADB_10_1 MYSQL_VERSION_ID
|
59
|
+
# elif (MYSQL_VERSION_ID > 100000)
|
60
|
+
# define MARIADB_10_0 MYSQL_VERSION_ID
|
61
|
+
# else
|
62
|
+
# define MARIADB_5_5 MYSQL_VERSION_ID
|
63
|
+
# endif
|
64
|
+
#else
|
65
|
+
# if (MYSQL_VERSION_ID > 50700)
|
66
|
+
# define MYSQL_5_7 MYSQL_VERSION_ID
|
67
|
+
# elif (MYSQL_VERSION_ID > 50600)
|
68
|
+
# define MYSQL_5_6 MYSQL_VERSION_ID
|
69
|
+
# else
|
70
|
+
# define MYSQL_5_5 MYSQL_VERSION_ID
|
71
|
+
# endif
|
60
72
|
#endif
|
61
73
|
|
62
|
-
|
63
74
|
#include <sql/sql_const.h>
|
64
75
|
#include "my_global.h"
|
65
76
|
#include <math.h>
|
66
|
-
#if
|
77
|
+
#if defined(MYSQL_5_7)
|
67
78
|
// Not use malloc service
|
68
79
|
#define MYSQL_SERVICE_MYSQL_ALLOC_INCLUDED
|
69
80
|
typedef unsigned int PSI_memory_key;
|
@@ -78,15 +89,15 @@ extern "C" {
|
|
78
89
|
extern char * my_strndup(PSI_memory_key key, const char *from, size_t length, myf_t flags);
|
79
90
|
}
|
80
91
|
#include "sql/log.h"
|
81
|
-
#endif //
|
92
|
+
#endif //MYSQL_5_7
|
82
93
|
|
83
94
|
#include "sql/sql_class.h"
|
84
95
|
#include <mysql/plugin.h>
|
85
96
|
#include "sql/mysqld.h"
|
86
97
|
|
87
|
-
#if
|
98
|
+
#if defined(MYSQL_5_6)
|
88
99
|
#include "sql/global_threads.h"
|
89
|
-
#endif
|
100
|
+
#endif //MYSQL_5_6
|
90
101
|
|
91
102
|
#include "sql/sql_plugin.h"
|
92
103
|
#include "sql/sql_cache.h"
|
@@ -101,6 +112,7 @@ extern "C" {
|
|
101
112
|
#include "sql/sql_base.h"
|
102
113
|
#include "sql/sql_parse.h"
|
103
114
|
#include "sql/sql_table.h"
|
115
|
+
#include "sql/handler.h"
|
104
116
|
#include "sql/sql_db.h"
|
105
117
|
#include "sql_acl.h"
|
106
118
|
#include "sql/sql_show.h"
|
@@ -109,7 +121,7 @@ extern "C" {
|
|
109
121
|
|
110
122
|
/* mysql.user password field index */
|
111
123
|
#ifndef MYSQL_USER_FIELD_PASSWORD
|
112
|
-
# if
|
124
|
+
# if defined(MYSQL_5_7)
|
113
125
|
# define MYSQL_USER_FIELD_PASSWORD 40
|
114
126
|
# else
|
115
127
|
# define MYSQL_USER_FIELD_PASSWORD 2
|
@@ -162,7 +174,7 @@ extern "C" {
|
|
162
174
|
#define cp_master_accsess() master_access
|
163
175
|
#define cp_priv_host() priv_host
|
164
176
|
#define cp_priv_user() priv_user
|
165
|
-
#elif(
|
177
|
+
#elif (defined(MYSQL_5_7))
|
166
178
|
#define cp_get_sql_error() get_stmt_da()->mysql_errno()
|
167
179
|
#define query_cache_invalidate3(A, B, C) query_cache.invalidate(A, B, C)
|
168
180
|
#define cp_isOk() get_stmt_da()->is_ok()
|
@@ -171,7 +183,7 @@ extern "C" {
|
|
171
183
|
#define cp_master_accsess() master_access()
|
172
184
|
#define cp_priv_host() host().str
|
173
185
|
#define cp_priv_user() user().str
|
174
|
-
#else
|
186
|
+
#else // MySQL 5.6 Mariadb 10.0 10.1
|
175
187
|
#define cp_get_sql_error() get_stmt_da()->sql_errno()
|
176
188
|
#define cp_isOk() get_stmt_da()->is_ok()
|
177
189
|
#define cp_set_overwrite_status(A) get_stmt_da()->set_overwrite_status(A)
|
@@ -182,7 +194,7 @@ extern "C" {
|
|
182
194
|
|
183
195
|
#endif
|
184
196
|
|
185
|
-
#if (
|
197
|
+
#if defined(MYSQL_5_5)
|
186
198
|
#define ha_index_next index_next
|
187
199
|
#define ha_index_prev index_prev
|
188
200
|
#define ha_index_first index_first
|
@@ -204,22 +216,13 @@ extern "C" {
|
|
204
216
|
# endif
|
205
217
|
#endif
|
206
218
|
|
207
|
-
#if ((MYSQL_VERSION_NUM < 50600) || defined(MARIADB_BASE_VERSION))
|
219
|
+
#if ((MYSQL_VERSION_NUM < 50600) || defined(MARIADB_BASE_VERSION)) //MySQL 5.5 Mariadb 5.5 10.0 10.1
|
208
220
|
|
209
|
-
inline void add_global_thread(THD* thd)
|
210
|
-
{
|
211
|
-
;
|
212
|
-
}
|
221
|
+
inline void add_global_thread(THD* thd) {}
|
213
222
|
|
214
|
-
inline void remove_global_thread(THD* thd)
|
215
|
-
{
|
216
|
-
;
|
217
|
-
}
|
223
|
+
inline void remove_global_thread(THD* thd) {}
|
218
224
|
|
219
|
-
inline void cp_thd_release_resources(THD* thd)
|
220
|
-
{
|
221
|
-
;
|
222
|
-
}
|
225
|
+
inline void cp_thd_release_resources(THD* thd) {}
|
223
226
|
|
224
227
|
inline void cp_restore_globals(THD* thd)
|
225
228
|
{
|
@@ -227,20 +230,14 @@ inline void cp_restore_globals(THD* thd)
|
|
227
230
|
my_pthread_setspecific_ptr(THR_MALLOC, 0);
|
228
231
|
}
|
229
232
|
|
230
|
-
inline void cp_thd_set_read_only(THD* thd, bool v)
|
231
|
-
{
|
232
|
-
;
|
233
|
-
}
|
233
|
+
inline void cp_thd_set_read_only(THD* thd, bool v) {}
|
234
234
|
|
235
|
-
inline bool cp_thd_get_global_read_only(THD* thd)
|
236
|
-
{
|
237
|
-
return false;
|
238
|
-
}
|
235
|
+
inline bool cp_thd_get_global_read_only(THD* thd) { return false; }
|
239
236
|
|
240
237
|
inline bool cp_open_table(THD* thd, TABLE_LIST* tables,
|
241
238
|
Open_table_context* ot_act)
|
242
239
|
{
|
243
|
-
#if defined(
|
240
|
+
#if defined(MARIADB_10_1)
|
244
241
|
return open_table(thd, tables, ot_act);
|
245
242
|
#else
|
246
243
|
return open_table(thd, tables, thd->mem_root, ot_act);
|
@@ -248,7 +245,6 @@ inline bool cp_open_table(THD* thd, TABLE_LIST* tables,
|
|
248
245
|
}
|
249
246
|
#define set_mysys_var(A)
|
250
247
|
|
251
|
-
|
252
248
|
inline bool cp_has_insert_default_function(Field* fd)
|
253
249
|
{
|
254
250
|
return fd->unireg_check == Field::TIMESTAMP_DN_FIELD ||
|
@@ -288,7 +284,7 @@ inline unsigned char* cp_null_ptr(Field* fd, unsigned char* /*record*/)
|
|
288
284
|
return (unsigned char*)fd->null_ptr;
|
289
285
|
}
|
290
286
|
|
291
|
-
#else
|
287
|
+
#else // MySQL 5.6. 5.7
|
292
288
|
|
293
289
|
inline void cp_thd_release_resources(THD* thd)
|
294
290
|
{
|
@@ -349,17 +345,17 @@ inline unsigned char* cp_null_ptr(Field* fd, unsigned char* record)
|
|
349
345
|
return fd->null_offset() + record;
|
350
346
|
}
|
351
347
|
|
352
|
-
#endif
|
348
|
+
#endif // MySQL 5.6. 5.7
|
353
349
|
|
354
350
|
#if (MYSQL_VERSION_NUM < 50611)
|
355
351
|
#define ha_index_read_map index_read_map
|
356
352
|
#endif
|
357
353
|
|
358
|
-
|
359
354
|
extern unsigned int g_openDatabases;
|
360
|
-
#if((MYSQL_VERSION_NUM > 50700) && !defined(MARIADB_BASE_VERSION))
|
361
|
-
#define OPEN_TABLE_FLAG_TYPE 0
|
362
355
|
|
356
|
+
#if (defined(MYSQL_5_7))
|
357
|
+
|
358
|
+
#define OPEN_TABLE_FLAG_TYPE 0
|
363
359
|
#define td_malloc(A, B) my_malloc(PSI_NOT_INSTRUMENTED, A, B)
|
364
360
|
#define td_realloc(A, B, C) my_realloc(PSI_NOT_INSTRUMENTED, A, B, C)
|
365
361
|
#define td_strdup(A, B) my_strdup(PSI_NOT_INSTRUMENTED, A, B)
|
@@ -378,10 +374,8 @@ inline void releaseTHD(THD* thd)
|
|
378
374
|
}
|
379
375
|
#else
|
380
376
|
|
381
|
-
inline void releaseTHD(THD* thd)
|
382
|
-
|
383
|
-
delete thd;
|
384
|
-
}
|
377
|
+
inline void releaseTHD(THD* thd) { delete thd; }
|
378
|
+
|
385
379
|
#endif
|
386
380
|
|
387
381
|
#include <boost/thread/mutex.hpp>
|
@@ -411,6 +405,11 @@ inline Security_context* cp_security_ctx(THD* thd)
|
|
411
405
|
return thd->security_context();
|
412
406
|
}
|
413
407
|
|
408
|
+
inline ulong cp_masterAccess(THD* thd)
|
409
|
+
{
|
410
|
+
return thd->security_context()->master_access();
|
411
|
+
}
|
412
|
+
|
414
413
|
inline int cp_record_count(handler* file, ha_rows* rows)
|
415
414
|
{
|
416
415
|
return file->ha_records(rows);
|
@@ -418,7 +417,7 @@ inline int cp_record_count(handler* file, ha_rows* rows)
|
|
418
417
|
|
419
418
|
#define cp_strdup(A, B) my_strdup(PSI_INSTRUMENT_ME, (A), (B))
|
420
419
|
#define cp_set_mysys_var(A) set_mysys_thread_var(A)
|
421
|
-
inline void cp_set_db(THD* thd, char* p)
|
420
|
+
inline void cp_set_db(THD* thd, const char* p)
|
422
421
|
{
|
423
422
|
thd->set_db(to_lex_cstring(p));
|
424
423
|
}
|
@@ -435,10 +434,7 @@ inline int cp_thread_set_THR_THD(THD* thd)
|
|
435
434
|
return 0;
|
436
435
|
}
|
437
436
|
|
438
|
-
inline void cp_set_transaction_duration_for_all_locks(THD* /*thd*/)
|
439
|
-
{
|
440
|
-
;
|
441
|
-
}
|
437
|
+
inline void cp_set_transaction_duration_for_all_locks(THD* /*thd*/) {}
|
442
438
|
|
443
439
|
inline void cp_set_mdl_request_types(TABLE_LIST& tables, short mode)
|
444
440
|
{
|
@@ -454,10 +450,7 @@ inline void cp_set_mdl_request_types(TABLE_LIST& tables, short mode)
|
|
454
450
|
tables.mdl_request.duration = MDL_TRANSACTION;
|
455
451
|
}
|
456
452
|
|
457
|
-
inline void cp_open_error_release(THD* /*thd*/, TABLE_LIST& /*tables*/)
|
458
|
-
{
|
459
|
-
;
|
460
|
-
}
|
453
|
+
inline void cp_open_error_release(THD* /*thd*/, TABLE_LIST& /*tables*/){}
|
461
454
|
|
462
455
|
inline bool cp_query_command(THD* thd, char* str)
|
463
456
|
{
|
@@ -472,19 +465,28 @@ inline void cp_lex_clear(THD* thd)
|
|
472
465
|
thd->lex->reset();
|
473
466
|
}
|
474
467
|
|
468
|
+
inline TABLE_SHARE* cp_get_cached_table_share(THD* thd, const char *db, const char *name)
|
469
|
+
{
|
470
|
+
return get_cached_table_share(thd, db, name);
|
471
|
+
}
|
472
|
+
|
473
|
+
inline int cp_store_create_info(THD *thd, TABLE_LIST *table_list, String *packet,
|
474
|
+
HA_CREATE_INFO *create_info_arg, int with_db_name)
|
475
|
+
{
|
476
|
+
return store_create_info(thd, table_list, packet, create_info_arg, with_db_name!=0);
|
477
|
+
}
|
478
|
+
|
475
479
|
|
476
480
|
#else //Not MySQL 5.7
|
477
|
-
#define OPEN_TABLE_FLAG_TYPE MYSQL_OPEN_GET_NEW_TABLE
|
478
481
|
|
482
|
+
#define OPEN_TABLE_FLAG_TYPE MYSQL_OPEN_GET_NEW_TABLE
|
479
483
|
#define td_malloc(A, B) my_malloc(A, B)
|
480
484
|
#define td_realloc(A, B, C) my_realloc(A, B, C)
|
481
485
|
#define td_strdup(A, B) my_strdup(A, B)
|
482
486
|
#define td_free(A) my_free(A)
|
483
487
|
|
484
|
-
inline void releaseTHD(THD* thd)
|
485
|
-
|
486
|
-
delete thd;
|
487
|
-
}
|
488
|
+
inline void releaseTHD(THD* thd) { delete thd; }
|
489
|
+
|
488
490
|
inline void cp_set_new_thread_id(THD* thd)
|
489
491
|
{
|
490
492
|
mysql_mutex_lock(&LOCK_thread_count);
|
@@ -494,6 +496,7 @@ inline void cp_set_new_thread_id(THD* thd)
|
|
494
496
|
mysql_mutex_unlock(&LOCK_thread_count);
|
495
497
|
thd->thread_id = thd->variables.pseudo_thread_id;
|
496
498
|
}
|
499
|
+
|
497
500
|
inline void cp_dec_dbcount(THD* thd)
|
498
501
|
{
|
499
502
|
mysql_mutex_lock(&LOCK_thread_count);
|
@@ -501,23 +504,29 @@ inline void cp_dec_dbcount(THD* thd)
|
|
501
504
|
mysql_mutex_unlock(&LOCK_thread_count);
|
502
505
|
remove_global_thread(thd);
|
503
506
|
}
|
507
|
+
|
504
508
|
inline Security_context* cp_security_ctx(THD* thd)
|
505
509
|
{
|
506
510
|
return thd->security_ctx;
|
507
511
|
}
|
508
512
|
|
513
|
+
inline ulong cp_masterAccess(THD* thd)
|
514
|
+
{
|
515
|
+
return thd->security_ctx->master_access;
|
516
|
+
}
|
517
|
+
|
509
518
|
inline int cp_record_count(handler* file, ha_rows* rows)
|
510
519
|
{
|
511
520
|
*rows = file->records();
|
512
521
|
return 0;
|
513
522
|
}
|
523
|
+
|
514
524
|
#define cp_strdup(A, B) my_strdup((A), (B))
|
515
525
|
#define cp_set_mysys_var(A) set_mysys_var(A)
|
516
526
|
|
517
|
-
inline void cp_set_db(THD* thd, char* p)
|
527
|
+
inline void cp_set_db(THD* thd, const char* p)
|
518
528
|
{
|
519
|
-
|
520
|
-
thd->db = p;
|
529
|
+
thd->set_db(p, strlen(p));
|
521
530
|
}
|
522
531
|
|
523
532
|
inline THD* cp_thread_get_THR_THD()
|
@@ -531,9 +540,7 @@ inline int cp_thread_set_THR_THD(THD* thd)
|
|
531
540
|
return 0;
|
532
541
|
}
|
533
542
|
|
534
|
-
inline void cp_set_transaction_duration_for_all_locks(THD* thd)
|
535
|
-
{
|
536
|
-
}
|
543
|
+
inline void cp_set_transaction_duration_for_all_locks(THD* thd) {}
|
537
544
|
|
538
545
|
inline void cp_set_mdl_request_types(TABLE_LIST& tables, short mode)
|
539
546
|
{
|
@@ -549,10 +556,7 @@ inline void cp_set_mdl_request_types(TABLE_LIST& tables, short mode)
|
|
549
556
|
tables.mdl_request.duration = MDL_TRANSACTION;
|
550
557
|
}
|
551
558
|
|
552
|
-
inline void cp_open_error_release(THD* thd, TABLE_LIST& tables)
|
553
|
-
{
|
554
|
-
|
555
|
-
}
|
559
|
+
inline void cp_open_error_release(THD* thd, TABLE_LIST& tables) {}
|
556
560
|
|
557
561
|
inline bool cp_query_command(THD* thd, char* str)
|
558
562
|
{
|
@@ -564,15 +568,93 @@ inline void cp_lex_clear(THD* thd)
|
|
564
568
|
thd->lex->many_values.empty();
|
565
569
|
}
|
566
570
|
|
571
|
+
#if defined(MARIADB_10_1) || defined(MARIADB_10_0)
|
572
|
+
#define NO_LOCK_OPEN
|
573
|
+
inline TABLE_SHARE* cp_get_cached_table_share(THD* thd, const char *db, const char *name)
|
574
|
+
{
|
575
|
+
return tdc_acquire_share(thd, db, name, GTS_VIEW |GTS_TABLE );
|
576
|
+
}
|
577
|
+
inline void cp_tdc_release_share(TABLE_SHARE* s)
|
578
|
+
{
|
579
|
+
tdc_release_share(s);
|
580
|
+
}
|
581
|
+
|
582
|
+
#if defined(MARIADB_10_1)
|
583
|
+
inline int cp_store_create_info(THD *thd, TABLE_LIST *table_list, String *packet,
|
584
|
+
void *create_info_arg, int with_db_name)
|
585
|
+
{
|
586
|
+
return show_create_table(thd, table_list, packet,
|
587
|
+
(Table_specification_st*)create_info_arg, (enum_with_db_name) with_db_name);
|
588
|
+
}
|
589
|
+
#elif (MARIADB_10_0 >= 100013)
|
590
|
+
inline int cp_store_create_info(THD *thd, TABLE_LIST *table_list, String *packet,
|
591
|
+
void *create_info_arg, int with_db_name)
|
592
|
+
{
|
593
|
+
return show_create_table(thd, table_list, packet,
|
594
|
+
(HA_CREATE_INFO*)create_info_arg, (enum_with_db_name) with_db_name);
|
595
|
+
}
|
596
|
+
#else //Mariadb 10.0.9 - .12
|
597
|
+
inline int cp_store_create_info(THD *thd, TABLE_LIST *table_list, String *packet,
|
598
|
+
HA_CREATE_INFO* create_info_arg, int with_db_name)
|
599
|
+
{
|
600
|
+
return store_create_info(thd, table_list, packet, create_info_arg, with_db_name!=0, FALSE);
|
601
|
+
}
|
602
|
+
|
603
|
+
#endif
|
604
|
+
#else // Not MARIADB_10_1 || MARIADB_10_0
|
605
|
+
|
606
|
+
|
607
|
+
inline TABLE_SHARE* cp_get_cached_table_share(THD* /*thd*/, const char *db, const char *name)
|
608
|
+
{
|
609
|
+
return get_cached_table_share(db, name);
|
610
|
+
}
|
611
|
+
inline int cp_store_create_info(THD *thd, TABLE_LIST *table_list, String *packet,
|
612
|
+
HA_CREATE_INFO *create_info_arg, int with_db_name)
|
613
|
+
{
|
614
|
+
return store_create_info(thd, table_list, packet, create_info_arg, with_db_name!=0);
|
615
|
+
}
|
616
|
+
|
617
|
+
#endif // Not MARIADB_10_1 || MARIADB_10_0
|
618
|
+
|
619
|
+
#endif // Not MySQL 5.7
|
620
|
+
|
621
|
+
|
622
|
+
#if (MYSQL_VERSION_ID < 50600) || defined(MARIADB_10_0)
|
623
|
+
#if defined(MARIADB_10_0)
|
624
|
+
inline bool cp_tdc_open_view(THD *thd, TABLE_LIST *table_list, const char *alias,
|
625
|
+
const char *cache_key, uint cache_key_length, uint flags)
|
626
|
+
{
|
627
|
+
return tdc_open_view(thd, table_list, alias, cache_key , cache_key_length, thd->mem_root, flags);
|
628
|
+
}
|
629
|
+
#else
|
630
|
+
inline bool cp_tdc_open_view(THD *thd, TABLE_LIST *table_list, const char *alias,
|
631
|
+
const char *cache_key, uint cache_key_length, uint flags)
|
632
|
+
{
|
633
|
+
return tdc_open_view(thd, table_list, alias, (char *)cache_key , cache_key_length, thd->mem_root, flags);
|
634
|
+
}
|
635
|
+
#endif
|
636
|
+
#else
|
637
|
+
#define cp_tdc_open_view tdc_open_view
|
567
638
|
#endif
|
568
639
|
|
640
|
+
#if (MYSQL_VERSION_ID < 50600)
|
641
|
+
inline uint cp_get_table_def_key(THD *thd, TABLE_LIST* tables, const char** key)
|
642
|
+
{
|
643
|
+
return create_table_def_key(thd, (char *)*key, tables, 0);
|
644
|
+
}
|
645
|
+
#else
|
646
|
+
inline uint cp_get_table_def_key(THD *thd, TABLE_LIST* tables, const char** key)
|
647
|
+
{
|
648
|
+
return (uint)get_table_def_key(tables, key);
|
649
|
+
}
|
650
|
+
#endif
|
569
651
|
/* find_files is static function in maridb.
|
570
652
|
make_db_list function is not static, but it is not list in sql_show.h.
|
571
653
|
*/
|
572
654
|
|
573
|
-
#if (defined(
|
655
|
+
#if (defined(MARIADB_10_0) || defined(MARIADB_10_1))
|
574
656
|
typedef Dynamic_array<LEX_STRING*> SQL_Strings;
|
575
|
-
#if (!defined(
|
657
|
+
#if (!defined(MARIADB_10_1))
|
576
658
|
typedef struct st_lookup_field_values
|
577
659
|
{
|
578
660
|
LEX_STRING db_value, table_value;
|
@@ -607,7 +689,7 @@ inline void cp_lex_clear(THD* thd)
|
|
607
689
|
#endif
|
608
690
|
|
609
691
|
|
610
|
-
#if (defined(
|
692
|
+
#if (defined(MARIADB_10_1) && MARIADB_10_1 > 100108)
|
611
693
|
inline void cp_setup_rpl_bitmap(TABLE* table)
|
612
694
|
{
|
613
695
|
bitmap_set_all(table->write_set);
|
@@ -636,220 +718,4 @@ public:
|
|
636
718
|
}
|
637
719
|
};
|
638
720
|
|
639
|
-
|
640
|
-
// REPL_POS_TYPE
|
641
|
-
#include <bzs/env/compiler.h>
|
642
|
-
pragma_pack1;
|
643
|
-
#define BINLOGNAME_SIZE 119
|
644
|
-
#define GTID_SIZE 64
|
645
|
-
|
646
|
-
struct binlogPos
|
647
|
-
{
|
648
|
-
my_off_t pos;
|
649
|
-
char type;
|
650
|
-
char filename[BINLOGNAME_SIZE];
|
651
|
-
char gtid[GTID_SIZE];
|
652
|
-
};
|
653
|
-
pragma_pop;
|
654
|
-
#define REPL_POSTYPE_MARIA_GTID 1 // see tdapapi.h
|
655
|
-
#define REPL_POSTYPE_POS 2 // see tdapapi.h
|
656
|
-
|
657
|
-
|
658
|
-
#if (MYSQL_VERSION_ID > 100000)
|
659
|
-
# define USE_BINLOG_GTID 1 // like 0-1-50
|
660
|
-
#elif (!defined(_WIN32) || MYSQL_VERSION_ID > 50700 || MYSQL_VERSION_ID < 50600) // Linux or MySQL 5.5 5.7
|
661
|
-
# define USE_BINLOG_VAR 1
|
662
|
-
# if (!defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID > 50600)
|
663
|
-
# include "sql/binlog.h"
|
664
|
-
# endif
|
665
|
-
|
666
|
-
#else // MySQL 5.6 on windows
|
667
|
-
// On windows MySQL 5.6 can not access mysql_bin_log variable
|
668
|
-
# define NOTUSE_BINLOG_VAR 1
|
669
|
-
|
670
|
-
#if (MYSQL_VERSION_ID > 50700)
|
671
|
-
# define Protocol_mysql Protocol
|
672
|
-
# include "sql/rpl_master.h"
|
673
|
-
# define CP_PROTOCOL PROTOCOL_PLUGIN
|
674
|
-
#else
|
675
|
-
# define Protocol_mysql Protocol
|
676
|
-
# define CP_PROTOCOL PROTOCOL_BINARY
|
677
|
-
#endif //(MYSQL_VERSION_ID > 50700)
|
678
|
-
|
679
|
-
class dummyProtocol : public Protocol_mysql
|
680
|
-
{
|
681
|
-
THD* m_thd;
|
682
|
-
public:
|
683
|
-
#if (MYSQL_VERSION_ID > 50700)
|
684
|
-
inline dummyProtocol(THD *thd_arg) : Protocol_mysql()
|
685
|
-
{
|
686
|
-
m_thd = thd_arg;
|
687
|
-
thd_arg->set_protocol(this);
|
688
|
-
}
|
689
|
-
inline virtual ~dummyProtocol(){}
|
690
|
-
#else
|
691
|
-
inline dummyProtocol(THD *thd_arg) : Protocol_mysql(thd_arg)
|
692
|
-
{
|
693
|
-
thd_arg->protocol = this;
|
694
|
-
}
|
695
|
-
inline virtual ~dummyProtocol(){}
|
696
|
-
#endif
|
697
|
-
bool send_result_set_metadata(List<Item> *list, uint flags){return false;}
|
698
|
-
virtual bool write(){return false;};
|
699
|
-
virtual void prepare_for_resend(){}
|
700
|
-
virtual bool store_null(){return false;}
|
701
|
-
virtual bool store_tiny(longlong from){return false;}
|
702
|
-
virtual bool store_short(longlong from){return false;}
|
703
|
-
virtual bool store_long(longlong from){return false;}
|
704
|
-
virtual bool store_longlong(longlong from, bool unsigned_flag){return false;}
|
705
|
-
virtual bool store_decimal(const my_decimal *){return false;}
|
706
|
-
virtual bool store(const char *from, size_t length,
|
707
|
-
const CHARSET_INFO *fromcs,
|
708
|
-
const CHARSET_INFO *tocs){return false;}
|
709
|
-
virtual bool store(float from, uint32 decimals, String *buffer){return false;}
|
710
|
-
virtual bool store(double from, uint32 decimals, String *buffer){return false;}
|
711
|
-
virtual bool store(MYSQL_TIME *time, uint precision){return false;}
|
712
|
-
virtual bool store_date(MYSQL_TIME *time){return false;}
|
713
|
-
virtual bool store_time(MYSQL_TIME *time, uint precision){return false;}
|
714
|
-
virtual bool store(Field *field){return false;}
|
715
|
-
virtual bool send_out_parameters(List<Item_param> *sp_params){return false;}
|
716
|
-
virtual Protocol::enum_protocol_type type(void){ return CP_PROTOCOL; };
|
717
|
-
#ifdef MARIADB_BASE_VERSION //Mariadb 5.5
|
718
|
-
virtual bool store(MYSQL_TIME *time, int decimals){return false;}
|
719
|
-
virtual bool store_time(MYSQL_TIME *time, int decimals){ return false;}
|
720
|
-
#elif (MYSQL_VERSION_ID < 50600) // MySQL 5.5
|
721
|
-
virtual bool store_time(MYSQL_TIME *time){return true;};
|
722
|
-
virtual bool store(MYSQL_TIME *time){return true;}
|
723
|
-
virtual bool store(const char *from, size_t length,
|
724
|
-
CHARSET_INFO *fromcs, CHARSET_INFO *tocs){return false;}
|
725
|
-
#elif (MYSQL_VERSION_ID > 50700) // MySQL 5.7
|
726
|
-
bool store_decimal(const my_decimal *, uint, uint){ return true; }
|
727
|
-
bool store(Proto_field *){ return true; }
|
728
|
-
void start_row(){}
|
729
|
-
int read_packet(void){ return 0; }
|
730
|
-
int get_command(COM_DATA *, enum_server_command *){ return m_thd->lex->sql_command; }
|
731
|
-
enum_vio_type connection_type(void){ return VIO_TYPE_PLUGIN; }
|
732
|
-
ulong get_client_capabilities(void){ return 0; }
|
733
|
-
bool has_client_capability(unsigned long){ return false; }
|
734
|
-
bool connection_alive(void){ return false; }
|
735
|
-
bool end_row(void){ return false; }
|
736
|
-
void abort_row(void){}
|
737
|
-
void end_partial_result_set(void){}
|
738
|
-
int shutdown(bool){ return 0; }
|
739
|
-
SSL_handle get_ssl(void){ return NULL; }
|
740
|
-
uint get_rw_status(void){ return 0; }
|
741
|
-
bool get_compression(void){ return false; }
|
742
|
-
bool start_result_metadata(uint, uint, const CHARSET_INFO *){ return false; }
|
743
|
-
bool send_field_metadata(Send_field *, const CHARSET_INFO *){ return false; }
|
744
|
-
bool end_result_metadata(void){ return false; }
|
745
|
-
bool send_ok(uint, uint, ulonglong, ulonglong, const char *){ return false; }
|
746
|
-
bool send_eof(uint, uint){ return false; }
|
747
|
-
bool send_error(uint, const char *, const char *){ return false; }
|
748
|
-
#endif
|
749
|
-
};
|
750
|
-
|
751
|
-
class masterStatus : public dummyProtocol
|
752
|
-
{
|
753
|
-
binlogPos* m_bpos;
|
754
|
-
bool m_writed;
|
755
|
-
public:
|
756
|
-
inline masterStatus(THD *thd_arg, binlogPos* bpos) :
|
757
|
-
dummyProtocol(thd_arg), m_bpos(bpos), m_writed(false) {}
|
758
|
-
bool store_longlong(longlong from, bool unsigned_flag)
|
759
|
-
{
|
760
|
-
m_bpos->pos = (ulonglong)from;
|
761
|
-
m_bpos->type = REPL_POSTYPE_POS;
|
762
|
-
return false;
|
763
|
-
}
|
764
|
-
|
765
|
-
#if (MYSQL_VERSION_ID < 50600 || defined(MARIADB_BASE_VERSION)) // MySQL 5.5
|
766
|
-
bool store(const char *from, size_t length, CHARSET_INFO *cs)
|
767
|
-
{
|
768
|
-
if (!m_writed)
|
769
|
-
{
|
770
|
-
strncpy(m_bpos->filename, from, BINLOGNAME_SIZE);
|
771
|
-
m_writed = true;
|
772
|
-
}
|
773
|
-
return false;
|
774
|
-
}
|
775
|
-
#else
|
776
|
-
bool store(const char *from, size_t length,
|
777
|
-
const CHARSET_INFO *cs)
|
778
|
-
{
|
779
|
-
if (!m_writed)
|
780
|
-
{
|
781
|
-
strncpy(m_bpos->filename, from, BINLOGNAME_SIZE);
|
782
|
-
m_writed = true;
|
783
|
-
}
|
784
|
-
return false;
|
785
|
-
}
|
786
|
-
#endif
|
787
|
-
};
|
788
|
-
|
789
|
-
#endif // NOTUSE_BINLOG_VAR
|
790
|
-
|
791
|
-
class safe_commit_lock
|
792
|
-
{
|
793
|
-
THD* m_thd;
|
794
|
-
MDL_ticket* m_commits_lock;
|
795
|
-
public:
|
796
|
-
safe_commit_lock(THD* thd): m_thd(thd), m_commits_lock(NULL){}
|
797
|
-
bool lock()
|
798
|
-
{
|
799
|
-
if (m_thd)
|
800
|
-
{
|
801
|
-
MDL_request mdl_request;
|
802
|
-
#if ((MYSQL_VERSION_NUM > 50700) && !defined(MARIADB_BASE_VERSION))
|
803
|
-
mdl_request.init_with_source(MDL_key::COMMIT, "", "", MDL_SHARED, MDL_EXPLICIT, __FILE__, __LINE__);
|
804
|
-
#else
|
805
|
-
mdl_request.init(MDL_key::COMMIT, "", "", MDL_SHARED, MDL_EXPLICIT);
|
806
|
-
#endif
|
807
|
-
if (m_thd->mdl_context.acquire_lock(&mdl_request,
|
808
|
-
m_thd->variables.lock_wait_timeout))
|
809
|
-
return false;
|
810
|
-
m_commits_lock = mdl_request.ticket;
|
811
|
-
}
|
812
|
-
return true;
|
813
|
-
}
|
814
|
-
~safe_commit_lock()
|
815
|
-
{
|
816
|
-
if (m_commits_lock)
|
817
|
-
{
|
818
|
-
m_thd->mdl_context.release_lock(m_commits_lock);
|
819
|
-
m_commits_lock= NULL;
|
820
|
-
}
|
821
|
-
}
|
822
|
-
};
|
823
|
-
|
824
|
-
/*
|
825
|
-
class safe_global_read_lock
|
826
|
-
{
|
827
|
-
THD* m_thd;
|
828
|
-
public:
|
829
|
-
safe_global_read_lock(THD* thd): m_thd(thd){}
|
830
|
-
bool lock()
|
831
|
-
{
|
832
|
-
if (m_thd->global_read_lock.lock_global_read_lock(m_thd))
|
833
|
-
{
|
834
|
-
m_thd = NULL;
|
835
|
-
return false;
|
836
|
-
}
|
837
|
-
#ifdef NOTUSE_BINLOG_VAR
|
838
|
-
close_cached_tables(NULL, NULL, FALSE , 50000000L);
|
839
|
-
if (m_thd->global_read_lock.make_global_read_lock_block_commit(m_thd))
|
840
|
-
{
|
841
|
-
m_thd->global_read_lock.unlock_global_read_lock(m_thd);
|
842
|
-
m_thd = NULL;
|
843
|
-
return false;
|
844
|
-
}
|
845
|
-
#endif
|
846
|
-
return true;
|
847
|
-
}
|
848
|
-
~safe_global_read_lock()
|
849
|
-
{
|
850
|
-
if (m_thd)
|
851
|
-
m_thd->global_read_lock.unlock_global_read_lock(m_thd);
|
852
|
-
}
|
853
|
-
};*/
|
854
|
-
|
855
721
|
#endif // BZS_DB_ENGINE_MYSQL_MYSQLINTERNAL_H
|