全て クラス 名前空間 関数 変数 型定義 列挙型 列挙値 ページ
tdapcapi.h
1 #ifndef BZS_DB_PROTOCOL_TDAP_TDAPCAPI_H
2 #define BZS_DB_PROTOCOL_TDAP_TDAPCAPI_H
3 /* =================================================================
4  Copyright (C) 2012 2013-2016 BizStation Corp All rights reserved.
5 
6  This program is free software; you can redistribute it and/or
7  modify it under the terms of the GNU General Public License
8  as published by the Free Software Foundation; either version 2
9  of the License, or (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program; if not, write to the Free Software
18  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19  02111-1307, USA.
20  ================================================================= */
21 #include <bzs/env/compiler.h>
22 #include <tchar.h>
23 
24 /** data types
25  */
26 typedef unsigned int uint_td;
27 typedef unsigned short ushort_td;
28 typedef void void_td;
29 typedef short short_td;
30 typedef unsigned char uchar_td;
31 typedef char char_td;
32 typedef int percentage_td;
33 typedef ushort_td keylen_td;
34 
35 /* Wnen change MAX_BOOKMARK_SIZE, database.h REF_SIZE_MAX too */
36 #define MAX_BOOKMARK_SIZE 112 // innodb unique key max 767 byte
37 struct BOOKMARK
38 {
39  uchar_td val[MAX_BOOKMARK_SIZE];
40  bool empty;
41  BOOKMARK():empty(true){}
42  bool isEmpty() const
43  {
44  return empty;
45  }
46 };
47 typedef BOOKMARK bookmark_td;
48 
49 /* tdap c interface */
50 #ifdef LIB_TDCLCPP
51 extern __declspec(dllimport) short_td
52  __stdcall BTRCALLID(ushort_td op, void* posb, void* data, uint_td* datalen,
53  void* keybuf, keylen_td keylen, char_td keyNum,
54  uchar_td* clientID);
55 #endif
56 
57 typedef short_td(__STDCALL* BTRCALLID_PTR)(ushort_td, void*, void*, uint_td*,
58  void*, keylen_td, char_td,
59  uchar_td*);
60 
61 typedef void(__STDCALL* WIN_TPOOL_SHUTDOWN_PTR)();
62 
63 /* HA hostname resolver */
64 #if (defined(__BORLANDC__) && !defined(__clang__))
65 typedef const char* __STDCALL (*HANAME_RESOLVER_PTR)(const char* vhost, const char* port, char* retBuf, unsigned int& opt);
66 typedef void __STDCALL (*REGISTER_RESOLVER_PTR)(HANAME_RESOLVER_PTR func);
67 
68 #else
69 /* @cond INTERNAL */
70 typedef const char* (__STDCALL* HANAME_RESOLVER_PTR)(const char* vhost, const char* port, char* retBuf, unsigned int& opt);
71 typedef void (__STDCALL* REGISTER_RESOLVER_PTR)(HANAME_RESOLVER_PTR func);
72 
73 /* @endcond */
74 #endif
75 
76 /** buffer size
77  */
78 #define POS_BLOCK_SIZE 128
79 #define BTRV_BOOKMARK_SIZE 4
80 #ifndef MAX_KEYLEN
81 #define MAX_KEYLEN 0X3FF // 1023
82 #endif
83 #define BTRV_MAX_DATA_SIZE 57000
84 #define TDAP_MAX_DATA_SIZE 6291456 // 6Mbyte
85 #define BOOKMARK_ALLOC_SIZE 40960
86 
87 /** operation type
88  *
89  */
90 #define TD_OPENTABLE 0
91 #define TD_CLOSETABLE 1
92 #define TD_REC_INSERT 2
93 #define TD_REC_UPDATE 3
94 #define TD_REC_DELETE 4
95 #define TD_KEY_SEEK 5
96 #define TD_KEY_NEXT 6
97 #define TD_KEY_PREV 7
98 #define TD_KEY_AFTER 8
99 #define TD_KEY_OR_AFTER 9
100 #define TD_KEY_BEFORE 10
101 #define TD_KEY_OR_BEFORE 11
102 #define TD_KEY_FIRST 12
103 #define TD_KEY_LAST 13
104 #define TD_CREATETABLE 14
105 #define TD_TABLE_INFO 15
106 #define TD_SETDIRECTORY 17
107 #define TD_GETDIRECTORY 18
108 #define TD_BEGIN_TRANSACTION 19
109 #define TD_END_TRANSACTION 20
110 #define TD_ABORT_TRANSACTION 21
111 #define TD_BOOKMARK 22
112 #define TD_MOVE_BOOKMARK 23
113 #define TD_POS_NEXT 24
114 #define TD_STOP_ENGINE 25
115 #define TD_VERSION 26
116 #define TD_UNLOCK 27
117 #define TD_RESET_CLIENT 28
118 #define TD_SET_OWNERNAME 29
119 #define TD_CLEAR_OWNERNAME 30
120 #define TD_BUILD_INDEX 31
121 #define TD_DROP_INDEX 32
122 #define TD_POS_FIRST 33
123 #define TD_POS_LAST 34
124 #define TD_POS_PREV 35
125 #define TD_KEY_NEXT_MULTI 36
126 #define TD_KEY_PREV_MULTI 37
127 #define TD_POS_NEXT_MULTI 38
128 #define TD_POS_PREV_MULTI 39
129 #define TD_INSERT_BULK 40
130 #define TD_BACKUPMODE 42
131 #define TD_MOVE_PER 44
132 #define TD_GET_PER 45
133 #define TD_UPDATE_PART 53
134 #define TD_KEY_EQUAL_KO 55
135 #define TD_KEY_NEXT_KO 56
136 #define TD_KEY_PREV_KO 57
137 #define TD_KEY_GT_KO 58
138 #define TD_KEY_GE_KO 59
139 #define TD_KEY_LT_KO 60
140 #define TD_KEY_LE_KO 61
141 #define TD_KEY_FIRST_KO 62
142 #define TD_KEY_LAST_KO 63
143 #define TD_CREATE_TEMP 64
144 #define TD_TABLE_INFO_EX 65
145 #define TD_REC_UPDATEATKEY 70
146 #define TD_REC_DELLETEATKEY 71
147 #define TD_KEY_GE_NEXT_MULTI 72
148 #define TD_KEY_LE_PREV_MULTI 73
149 #define TD_FILTER_PREPARE 74
150 #define TD_CONNECT 78
151 #define TD_STORE_TEST 79 // For test only
152 #define TD_SET_TIMESTAMP_MODE 80
153 #define TD_BEGIN_SHAPSHOT 88
154 #define TD_END_SNAPSHOT 89
155 #define TD_AUTOMEKE_SCHEMA 90
156 #define TD_GETSERVER_CHARSET 91
157 #define TD_ADD_SENDBLOB 92
158 #define TD_GET_BLOB_BUF 93
159 #define TD_STASTISTICS 94
160 #define TD_KEY_SEEK_MULTI 95
161 #define TD_ACL_RELOAD 96
162 #define TD_RECONNECT 97
163 #define TD_GET_SCHEMA 98
164 
165 /** create sub operations
166  */
167 #define CR_SUBOP_DROP -128
168 #define CR_SUBOP_RENAME -127
169 #define CR_SUBOP_SWAPNAME -126
170 #define CR_SUBOP_CREATE_DBONLY -125
171 #define CR_SUBOP_BY_FILESPEC -1
172 #define CR_SUBOP_BY_FILESPEC_NOCKECK 0
173 #define CR_SUBOP_BY_TABLEDEF 1
174 #define CR_SUBOP_BY_TABLEDEF_NOCKECK 2
175 #define CR_SUBOP_BY_SQL 3
176 #define CR_SUBOP_BY_SQL_NOCKECK 4
177 
178 #define CR_SUB_FLAG_EXISTCHECK -1
179 
180 /** TD_TABLE_INFO sub operations
181  */
182 #define ST_SUB_GETSQL_BY_TABLEDEF -1
183 
184 /** TD_ADD_SENDBLOB sub operations
185  */
186 #define TD_ASBLOB_ENDROW -125
187 
188 /** TD_GET_SCHEMA sub operations
189  */
190 #define SC_SUBOP_TABLEDEF 0
191 #define SC_SUBOP_BY_SQL -1
192 #define SC_SUBOP_VIEW_BY_SQL -2
193 #define SC_SUBOP_TABLEDEF_BIN_STR -3
194 
195 /** TD_GET_STASTISTICS sub operations
196  */
197 #define TD_STSTCS_READ 0
198 #define TD_STSTCS_DISCONNECT_ONE 1
199 #define TD_STSTCS_DISCONNECT_ALL 2
200 #define TD_STSTCS_DATABASE_LIST 3
201 #define TD_STSTCS_SYSTEM_VARIABLES 4
202 #define TD_STSTCS_SCHEMA_TABLE_LIST 5
203 #define TD_STSTCS_TABLE_LIST 6
204 #define TD_STSTCS_VIEW_LIST 7
205 #define TD_STSTCS_SLAVE_STATUS 8
206 #define TD_STSTCS_STATUS_VARIABLES 9
207 #define TD_STSTCS_SLAVE_HOSTS 10
208 #define TD_STSTCS_EXTENDED_VARIABLES 11
209 #define TD_STSTCS_SLAVE_CHANNELS 12
210 #define TD_STSTCS_SLAVE_CHANNELS_LOCK 13
211 #define TD_STSTCS_HA_LOCK 14
212 #define TD_STSTCS_HA_UNLOCK 15
213 #define TD_STSTCS_HA_SET_ROLEMASTER 16
214 #define TD_STSTCS_HA_SET_ROLESLAVE 17
215 #define TD_STSTCS_HA_SET_ROLENONE 18
216 #define TD_STSTCS_HA_SET_TRXBLOCK 19
217 #define TD_STSTCS_HA_SET_TRXNOBLOCK 20
218 #define TD_STSTCS_HA_ENABLE_FO 21
219 #define TD_STSTCS_HA_DISBLE_FO 22
220 
221 
222 /** connect sub operation
223  */
224 
225 #define LG_SUBOP_CONNECT 0
226 #define LG_SUBOP_DISCONNECT 1
227 #define LG_SUBOP_NEWCONNECT 3
228 #define LG_SUBOP_RECONNECT 4
229 #define LG_SUBOP_DISCONNECT_EX 5 //for reconnect test
230 #define LG_SUBOP_ASSOCIATE 6
231 
232 /** TD_STSTCS_TABLE_LIST type list
233 */
234 #define TABLE_TYPE_NORMAL_TABLE 1
235 #define TABLE_TYPE_VIEW 2
236 #define TABLE_TYPE_TD_SCHEMA 4
237 
238 
239 /** TIMESTAMP_MODE
240 */
241 #define TIMESTAMP_VALUE_CONTROL 0
242 #define TIMESTAMP_ALWAYS 1
243 
244 
245 /** field types
246  */
247 #define ft_string 0
248 #define ft_integer 1
249 #define ft_float 2
250 #define ft_date 3
251 #define ft_time 4
252 #define ft_decimal 5
253 #define ft_money 6
254 #define ft_logical 7
255 #define ft_numeric 8
256 #define ft_bfloat 9
257 #define ft_lstring 10
258 #define ft_zstring 11
259 #define ft_note 12
260 #define ft_lvar 13
261 #define ft_uinteger 14
262 #define ft_autoinc 15
263 #define ft_bit 16
264 #define ft_numericsts 17
265 #define ft_numericsa 18
266 #define ft_currency 19
267 #define ft_timestamp 20
268 #define ft_blob 21
269 #define ft_reserve22 22
270 #define ft_reserve23 23
271 #define ft_reserve24 24
272 #define ft_wstring 25
273 #define ft_wzstring 26
274 #define ft_guid 27
275 #define ft_datetime 30
276 #define ft_myvarchar 40
277 #define ft_myvarbinary 41
278 #define ft_mywvarchar 42
279 #define ft_mywvarbinary 43
280 #define ft_mychar 44
281 #define ft_mywchar 45
282 #define ft_mydate 46
283 #define ft_mytime 47
284 #define ft_mydatetime 48
285 #define ft_mytimestamp 49
286 #define ft_mytext 50
287 #define ft_myblob 51
288 #define ft_autoIncUnsigned 52
289 #define ft_myfixedbinary 53
290 #define ft_enum 54
291 #define ft_set 55
292 #define ft_mytime_num_cmp 56 //for comare use only
293 #define ft_mydatetime_num_cmp 57 //for comare use only
294 #define ft_mytimestamp_num_cmp 58 //for comare use only
295 #define ft_myyear 59
296 #define ft_mygeometry 60
297 #define ft_myjson 61
298 #define ft_mydecimal 62
299 #define ft_nullindicator 255
300 
301 /* compair types */
302 enum eCompType
303 {
304  eEqual = 1,
305  eGreater = 2,
306  eLess = 3,
307  eNotEq = 4,
308  eGreaterEq = 5,
309  eLessEq = 6,
310  eBitAnd = 8,
311  eNotBitAnd = 9,
312  eIsNull = 10,
313  eIsNotNull = 11
314 };
315 
316 /* filter cobine type */
317 enum combineType
318 {
319  eCend,
320  eCand,
321  eCor
322 };
323 
324 /** extruct row comp bias
325  */
326 // In the case of a var type, it is copare as whole length.
327 #define CMPLOGICAL_VAR_COMP_ALL 16
328 #define CMPLOGICAL_CMPACS 32 // no support
329 // The field for comparison shows not a value but a field number.
330 #define CMPLOGICAL_FIELD 64
331 #define CMPLOGICAL_CASEINSENSITIVE 128 // not case-sensitive
332 
333 
334 /** btrv transaction lock options
335  */
336 #define LOCK_BIAS_DEFAULT 0
337 #define LOCK_SINGLE_WAIT 100
338 #define LOCK_SINGLE_NOWAIT 200
339 #define LOCK_MULTI_WAIT 300
340 #define LOCK_MULTI_NOWAIT 400
341 
342 #define NOWAIT_WRITE 500
343 #define PARALLEL_TRN 1000
344 #define TRN_ISO_READ_COMMITED 0
345 #define TRN_ISO_REPEATABLE_READ 2000
346 #define TRN_ISO_SERIALIZABLE 3000
347 
348 #define SINGLELOCK_READ_COMMITED LOCK_SINGLE_NOWAIT + PARALLEL_TRN
349 #define MULTILOCK_READ_COMMITED LOCK_MULTI_NOWAIT + PARALLEL_TRN
350 #define MULTILOCK_REPEATABLE_READ TRN_ISO_REPEATABLE_READ + LOCK_MULTI_NOWAIT
351 #define MULTILOCK_ISO_SERIALIZABLE TRN_ISO_SERIALIZABLE + LOCK_MULTI_NOWAIT
352 
353 /** InnoDB or transactional engin lock options
354 */
355 // Transaction
356 #define SINGLELOCK_NOGAP SINGLELOCK_READ_COMMITED
357 #define MULTILOCK_NOGAP MULTILOCK_READ_COMMITED
358 #define MULTILOCK_GAP MULTILOCK_REPEATABLE_READ + LOCK_MULTI_NOWAIT
359 // Snapshot
360 #define CONSISTENT_READ 4000
361 #define CONSISTENT_READ_WITH_BINLOG_POS 4200
362 #define MULTILOCK_GAP_SHARE TRN_ISO_REPEATABLE_READ
363 #define MULTILOCK_NOGAP_SHARE 0
364 #define REPL_POSTYPE_NONE 0
365 #define REPL_POSTYPE_MARIA_GTID 1 // like 0-1-50
366 #define REPL_POSTYPE_POS 2 // 12345
367 #define REPL_POSTYPE_GTID 3
368 
369 
370 // Read row lock
371 #define ROW_LOCK_X LOCK_SINGLE_NOWAIT
372 #define ROW_LOCK_S 5000 + LOCK_SINGLE_NOWAIT
373 
374 //Server isoration
375 #define SRV_ISO_READ_UNCOMMITED 0
376 #define SRV_ISO_READ_COMMITED 1
377 #define SRV_ISO_REPEATABLE_READ 2
378 #define SRV_ISO_SERIALIZABLE 3
379 
380 /** open mode
381  */
382 #define TD_OPEN_NORMAL 0
383 #define TD_OPEN_READONLY -2
384 #define TD_OPEN_EXCLUSIVE -4
385 #define TD_OPEN_READONLY_EXCLUSIVE (TD_OPEN_READONLY + TD_OPEN_EXCLUSIVE)
386 
387 /** @cond INTERNAL */
388 #define TD_OPEN_MASK_SIMPLE_NULL 0
389 #define TD_OPEN_MASK_MYSQL_NULL -16
390 #define TD_OPEN_MASK_GETSHCHEMA -32
391 #define TD_OPEN_MASK_GETDEFAULTIMAGE -64
392 #define TD_OPEN_MASK_BIN_STR -128
393 
394 #define IS_MODE_READONLY(mode) (((0 - mode) & 2) != 0)
395 #define IS_MODE_EXCLUSIVE(mode) (((0 - mode) & 4) != 0)
396 #define IS_MODE_MYSQL_NULL(mode) (((0 - mode) & 16) != 0)
397 #define IS_MODE_GETSCHEMA(mode) (((0 - mode) & 32) != 0)
398 #define IS_MODE_GETDEFAULTIMAGE(mode) (((0 - mode) & 64) != 0)
399 #define IS_MODE_BIN_STR(mode) (((0 - mode) & 128) != 0)
400 /** @endcond */
401 
402 /** field algin
403  */
404 #define BT_AL_LEFT 0
405 #define BT_AL_CENTER 2
406 #define BT_AL_RIGHT 1
407 
408 
409 /** error code
410  */
411 #define STATUS_TABLE_YET_OPEN -3
412 #define STATUS_DURING_TRANSACTION -4
413 #define STATUS_NO_ACR_UPDATE_DELETE -5
414 #define STATUS_NO_ACR_INSERT -6
415 #define STATUS_NO_ACR_READ -7
416 #define STATUS_CANT_ALLOC_MEMORY -8
417 #define STATUS_USE_KEYFIELD -9
418 #define STATUS_TOO_MANY_TABLES -10
419 #define STATUS_INVARID_PRM_KEY_NUM -11
420 #define STATUS_INVARID_PNT_KEY_NUM -12
421 #define STATUS_INVARID_REP_KEY_NUM -13
422 #define STATUS_INVARID_FIELD_IDX -14
423 #define STATUS_ALREADY_DELETED -15
424 #define STATUS_LMITS_MAX_TABLES -16
425 #define STATUS_DB_YET_OPEN -17
426 #define STATUS_TABLENAME_NOTFOUND -18
427 #define STATUS_DIFFERENT_DBVERSION -19
428 #define STATUS_DUPLICATE_FIELDNAME -20
429 #define STATUS_INVALID_TABLE_IDX -21
430 #define STATUS_AUTH_DENIED -22
431 #define STATUS_TOO_MANY_FIELDS -23
432 #define STATUS_FILTERSTRING_ERROR -24
433 #define STATUS_INVALID_FIELDLENGTH -25
434 #define STATUS_INVALID_KEYTYPE -26
435 #define STATUS_LVAR_NOTE_NOT_LAST -27
436 #define STATUS_NODEF_FOR_CONVERT -28
437 #define STATUS_TRD_NEED_VARLENGTH -29
438 #define STATUS_INVALID_VARIABLETABLE -30
439 #define STATUS_AUTOINC_SPACE_ERROR -31
440 #define STATUS_TOO_LONG_OWNERNAME -32
441 #define STATUS_CANT_DEL_FOR_REL -33
442 #define STATUS_NO_AUTOINC_SPACE -34
443 #define STATUS_INVALID_RECLEN -35
444 #define STATUS_INVALID_FIELDVALUE -36
445 #define STATUS_INVALID_VALLEN -37
446 #define STATUS_FIELDTYPE_NOTSUPPORT -42
447 #define STATUS_INVALID_NULLMODE -43
448 #define STATUS_TOO_LARGE_VALUE -44
449 #define STATUS_SQL_PARSE_ERROR -45
450 
451 #define STATUS_SUCCESS 0
452 #define STATUS_PROGRAM_ERROR 1
453 #define STATUS_IO_ERROR 2
454 #define STATUS_FILE_NOT_OPENED 3
455 #define STATUS_NOT_FOUND_TI 4
456 #define STATUS_DUPPLICATE_KEYVALUE 5
457 #define STATUS_INVALID_KEYNUM 6
458 #define STATUS_NO_CURRENT 8
459 #define STATUS_EOF 9
460 #define STATUS_TABLE_NOTOPEN 12
461 #define STATUS_REQUESTER_DEACTIVE 20
462 #define STATUS_KEYBUFFERTOOSMALL 21
463 #define STATUS_BUFFERTOOSMALL 22
464 #define STATUS_CANT_CREATE 25
465 #define STATUS_NOSUPPORT_OP 41
466 #define STATUS_INVALID_BOOKMARK 43
467 #define STATUS_ACCESS_DENIED 46
468 #define STATUS_INVALID_OWNERNAME 51
469 #define STATUS_TABLE_EXISTS_ERROR 59
470 #define STATUS_LIMMIT_OF_REJECT 60
471 #define STATUS_WARKSPACE_TOO_SMALL 61
472 #define STATUS_INVALID_EX_DESC 62
473 #define STATUS_INVALID_EX_INS 63
474 #define STATUS_REACHED_FILTER_COND 64
475 #define STATUS_INVALID_FIELD_OFFSET 65
476 #define STATUS_CHANGE_CONFLICT 80
477 #define STATUS_INVALID_LOCKTYPE 83
478 #define STATUS_LOCK_ERROR 84
479 #define STATUS_FILE_LOCKED 85
480 #define STATUS_INVALID_SUPPLYVALUES 86
481 #define STATUS_CANNOT_LOCK_TABLE 88
482 #define STATUS_INVALID_KEYNAME STATUS_INVALID_KEYNUM
483 #define STATUS_INVALID_DATASIZE STATUS_BUFFERTOOSMALL
484 #define STATUS_INVALID_FIELDNAME STATUS_INVALID_FIELD_OFFSET
485 #define ERROR_TD_INVALID_CLINETHOST 171
486 #define ERROR_NO_DATABASE 172
487 #define ERROR_NOSPECIFY_TABLE 176
488 #define ERROR_LOAD_CLIBRARY 200
489 #define ERROR_INDEX_RND_INIT 201
490 #define STATUS_INVALID_PREPAREID 202
491 #define STATUS_LMIT_OF_PREPAREED 203
492 #define STATUS_ALREADY_INSNAPSHOT 204
493 #define STATUS_ALREADY_INTRANSACTION 205
494 #define STATUS_ALREADY_INEXCLUSIVE 206
495 #define SERVER_CLIENT_NOT_COMPATIBLE 3003
496 #define NET_BAD_SRB_FORMAT 3021
497 #define ERROR_TD_HOSTNAME_NOT_FOUND 3103
498 #define ERROR_TD_CONNECTION_FAILURE 3106
499 #define ERROR_TD_NOT_CONNECTED 3110
500 #define ERROR_TD_NET_TIMEOUT 3800
501 #define ERROR_TD_NET_REMOTE_DISCONNECT 3801
502 #define ERROR_TD_NET_TOO_BIGDATA 3802
503 #define ERROR_TD_NET_OTHER 3810
504 #define ERROR_TD_C_CLIENT_UNKNOWN 3811
505 #define ERROR_TD_INVALID_SERVER_ROLE 3812
506 #define ERROR_TD_RECONNECTED 3900
507 
508 #define ERROR_TD_RECONNECTED_OFFSET 1000
509 #define MYSQL_ERROR_OFFSET 25000
510 
511 inline bool canRecoverNetError(short code)
512 {
513  return (code >= ERROR_TD_HOSTNAME_NOT_FOUND) &&
514  (code < ERROR_TD_RECONNECTED) &&
515  (code != ERROR_TD_NET_TOO_BIGDATA);
516 }
517 
518 
519 #define TRANSACTD_SCHEMANAME _T("transactd_schema")
520 #define TYPE_SCHEMA_BDF 0
521 #define TYPE_SCHEMA_DDF 1
522 #define TYPE_SCHEMA_BDF_NOPRELOAD 2
523 
524 
525 #define FILTER_CURRENT_TYPE_NOTINC 0
526 #define FILTER_CURRENT_TYPE_INC 1
527 #define FILTER_TYPE_SEEKS_BOOKMARKS 1 //with FILTER_TYPE_SEEKS only
528 #define FILTER_CURRENT_TYPE_NOBOOKMARK 2
529 #define FILTER_TYPE_SUPPLYVALUE 4
530 #define FILTER_TYPE_FORWORD 4 //at preparing only
531 #define FILTER_TYPE_SEEKS 8
532 
533 
534 /* No need export for client */
535 #define FILTER_COMBINE_NOPREPARE 0
536 #define FILTER_COMBINE_PREPARE 32
537 
538 
539 #define NIS_FILED_NAME "$nf"
540 
541 /** max ownwr name size + 1 */
542 #define OWNERNAME_SIZE 12
543 
544 #define TD_BACKUP_START 0
545 #define TD_BACKUP_END 2
546 #define TD_BACKUP_MODE_OK STATUS_SUCCESS
547 #define TD_BACKUP_MODE_NOT_SUPPORT STATUS_PROGRAM_ERROR
548 #define TD_BACKUP_MODE_BUSY STATUS_CANNOT_LOCK_TABLE
549 #define TD_BACKUP_MODE_NOT_PERMIT 41
550 #define TD_BACKUP_MODE_SERVER_ERROR 91
551 
552 #define DFV_TIMESTAMP_DEFAULT 1.0f
553 #define DFV_TIMESTAMP_DEFAULT_ASTR "1"
554 #define DFV_TIMESTAMP_DEFAULT_WSTR L"1"
555 
556 /** @cond INTERNAL */
557 struct clsrv_ver
558 {
559  union
560  {
561  ushort_td clMajor;
562  ushort_td srvMysqlMajor;
563  };
564  union
565  {
566  ushort_td clMinor;
567  ushort_td srvMysqlMinor;
568  };
569  union
570  {
571  ushort_td clRelease;
572  ushort_td srvMysqlRelease;
573  };
574  uchar_td srvMajor;
575  uchar_td srvMysqlType;
576  ushort_td srvMinor;
577  ushort_td srvRelease;
578  inline bool isSupportDateTimeTimeStamp() const
579  {
580  if (srvMysqlMajor >= 10) return true;
581  if ((srvMysqlMajor == 5) && (srvMysqlMinor > 5)) return true;
582  return false;
583  }
584 };
585 #define VER_ST_SIZE 12
586 
587 #define MYSQL_TYPE_MYSQL 'M'
588 #define MYSQL_TYPE_MARIA 'A'
589 
590 
591 struct trdVersiton
592 {
593  char cherserServer[128];
594  clsrv_ver desc;
595 };
596 
597 #define MYSQL_SCRAMBLE_LENGTH 20
598 #define MYSQL_USERNAME_MAX 16
599 
600 struct handshale_t
601 {
602  unsigned int size; // size of this
603  unsigned int options;
604  trdVersiton ver;
605  unsigned short transaction_isolation;
606  unsigned short lock_wait_timeout;
607  unsigned char scramble[MYSQL_SCRAMBLE_LENGTH+1]; //user auth scramble
608 };
609 
610 #define HST_OPTION_NO_SCRAMBLE 1
611 #define HST_OPTION_ROLE_MASTER 2
612 #define HST_OPTION_ROLE_SLAVE 4
613 #define HST_OPTION_CLEAR_CACHE 8
614 
615 
616 #define CL_OPTION_CHECK_ROLE 1
617 
618 /* server system variables index */
619 #define TD_VER_DB 0
620 #define TD_VER_SERVER 1
621 #define TD_VAR_LISTENADDRESS 2
622 #define TD_VAR_LISTENPORT 3
623 #define TD_VAR_HOSTCHECKNAME 4
624 #define TD_VAR_MAXTCPCONNECTIONS 5
625 #define TD_VAR_TABLENAMELOWER 6
626 #define TD_VAR_POOLTHREADS 7
627 #define TD_VAR_TCPSERVERTYPE 8
628 #define TD_VAR_LOCKWAITTIMEOUT 9
629 #define TD_VAR_ISOLATION 10
630 #define TD_VAR_AUTHTYPE 11
631 #define TD_VAR_PIPESHAREMEMSIZE 12
632 #define TD_VAR_MAXPIPECONNECTIONS 13
633 #define TD_VAR_USEPIPE 14
634 #define TD_VAR_HSLISTENPORT 15
635 #define TD_VAR_USEHS 16
636 #define TD_VAR_TIMESTAMPMODE 17
637 #define TD_VAR_STARTUP_HA 18
638 #define TD_VAR_SIZE 19
639 
640 /* server status variables index */
641 #define TD_SVAR_TCP_CONNECTIONS 0
642 #define TD_SVAR_TCP_WAIT_THREADS 1
643 #define TD_SVAR_TPOOL_CONNECTIONS 2
644 #define TD_SVAR_TPOOL_WAIT_THREADS 3
645 #define TD_SVAR_PIPE_CONNECTIONS 4
646 #define TD_SVAR_PIPE_WAIT_THREADS 5
647 #define TD_SVAR_OPEN_DBS 6
648 #define TD_SVAR_HA 7
649 #define TD_SVAR_SIZE 8
650 
651 #define HA_ROLE_SLAVE 0
652 #define HA_ROLE_MASTER 1
653 #define HA_ROLE_NONE 2
654 #define HA_RESTORE_ROLE 4
655 #define HA_ENABLE_FAILOVER 8
656 
657 /* server sql variables index */
658 #define TD_EXTENDED_VAR_MYSQL_GTID_MODE 0
659 #define TD_EXTENDED_VAR_BINLOG_FILE 1
660 #define TD_EXTENDED_VAR_BINLOG_POS 2
661 #define TD_EXTENDED_VAR_BINLOG_GTID 3
662 #define TD_EXTENDED_VAR_SIZE 4
663 
664 
665 #define TD_CLINET_LOGNAME "transactd_clinet_err.log"
666 
667 /** @endcond */
668 /* In the case of "tdclcppxxx" library of msvc, The ($TargetName) is not changed automatically.
669  If you change this version then you need change The ($TargetName) project options too.
670  */
671 #define C_INTERFACE_VER_MAJOR "3"//##1 Build marker! Don't remove
672 #define C_INTERFACE_VER_MINOR "8"//##2 Build marker! Don't remove
673 #define C_INTERFACE_VER_RELEASE "4"//##3 Build marker! Don't remove
674 
675 /* dnamic load library name.
676  The default extention of Mac is ".boudle", Therefore ".so" is popular. */
677 #ifdef LINUX
678 #ifdef __APPLE__
679 #define C_INTERFACE_VERSTR \
680  "." C_INTERFACE_VER_MAJOR "." C_INTERFACE_VER_MINOR ".so" // use loadlibrary
681 #else // NOT __APPLE__
682 #define C_INTERFACE_VERSTR \
683  ".so." C_INTERFACE_VER_MAJOR "." C_INTERFACE_VER_MINOR // use loadlibrary
684 #endif // NOT __APPLE__
685 #else // NOT LINUX
686 #define C_INTERFACE_VERSTR \
687  "_" C_INTERFACE_VER_MAJOR "_" C_INTERFACE_VER_MINOR ".dll" // use
688 // loadlibrary
689 #endif // NOT LINUX
690 
691 #if (defined(__x86_64__) || (defined(LINUX) && !defined(__BORLANDC__)))
692 #define TDCLC_LIBNAME "tdclc_64" C_INTERFACE_VERSTR // use loadlibrary
693 #else //__x86_32__
694 #define TDCLC_LIBNAME "tdclc_32" C_INTERFACE_VERSTR // use loadlibrary
695 #endif //__x86_32__
696 
697 /* Cpp library name prefix */
698 #define TD_CPP_LIB_PRE "tdclcpp"
699 
700 #if ((defined(_MSC_VER) && defined(_DLL)) || \
701  (defined(__BORLANDC__) && defined(_RTLDLL)))
702 #define RTL_PART "r"
703 #else
704 #define RTL_PART
705 #endif
706 
707 /* Cpp library name middle part */
708 #if (defined(__x86_64__) || (defined(LINUX) && !defined(__BORLANDC__)))
709 #ifdef _UNICODE
710 #define TD_LIB_PART "64u" RTL_PART
711 #else // NOT _UNICODE
712 #define TD_LIB_PART "64m" RTL_PART
713 #endif // NOT _UNICODE
714 #else //__x86_32__
715 #ifdef _UNICODE
716 #define TD_LIB_PART "32u" RTL_PART
717 #else // NOT _UNICODE
718 #define TD_LIB_PART "32m" RTL_PART
719 #endif // NOT _UNICODE
720 #endif //__x86_32__
721 
722 /* Cpp library name version part
723  In the case of "tdclcppxxx" library of msvc , The ($TargetName) is not changed
724  automatically.
725  If you change this version then you need change The ($TargetName) project
726  options too.
727 
728  In the case of "tdclcppxxx" library of gcc , The -soname option is not changed
729  automatically.
730  If you change this version then you need change The -soname option project
731  options too.
732 
733  */
734 
735 #define CPP_INTERFACE_VER_MAJOR "3"//##4 Build marker! Don't remove
736 #define CPP_INTERFACE_VER_MINOR "8"//##5 Build marker! Don't remove
737 #define CPP_INTERFACE_VER_RELEASE "4"//##6 Build marker! Don't remove
738 
739 /* use autolink tdclcpp */
740 #if (__BCPLUSPLUS__ || _MSC_VER)
741 #ifdef __APPLE__
742 #define CPP_INTERFACE_VERSTR \
743  "_" COMPILER_VERSTR "_" TD_LIB_PART "." CPP_INTERFACE_VER_MAJOR \
744  "." CPP_INTERFACE_VER_MINOR
745 #else
746 #define CPP_INTERFACE_VERSTR \
747  "_" COMPILER_VERSTR "_" TD_LIB_PART "_" CPP_INTERFACE_VER_MAJOR \
748  "_" CPP_INTERFACE_VER_MINOR
749 #endif
750 #endif
751 
752 
753 
754 #define TD_CPP_LIB_NAME \
755  LIB_PREFIX TD_CPP_LIB_PRE CPP_INTERFACE_VERSTR SHARED_LIB_EXTENTION
756 
757 #ifdef LINUX
758 #ifdef __APPLE__
759 #define TD_CPP_SO_NAME \
760  LIB_PREFIX TD_CPP_LIB_PRE CPP_INTERFACE_VERSTR ".dylib"
761 #else // NOT __APPLE__
762 #define TD_CPP_SO_NAME \
763  LIB_PREFIX TD_CPP_LIB_PRE ".so." CPP_INTERFACE_VER_MAJOR "." CPP_INTERFACE_VER_MINOR
764 #endif // NOT __APPLE__
765 #else // NOT LINUX
766 #define TD_CPP_SO_NAME \
767  LIB_PREFIX TD_CPP_LIB_PRE CPP_INTERFACE_VERSTR ".dll"
768 #endif // NOT LINUX
769 
770 
771 
772 #define TRANSACTD_VER_MAJOR 3//##7 Build marker! Don't remove
773 #define TRANSACTD_VER_MINOR 8//##8 Build marker! Don't remove
774 #define TRANSACTD_VER_RELEASE 4//##9 Build marker! Don't remove
775 
776 #endif // BZS_DB_PROTOCOL_TDAP_TDAPCAPI_H
BOOKMARK()
Definition: tdapcapi.h:41
bool isEmpty() const
Definition: tdapcapi.h:42
BOOKMARK構造体
Definition: tdapcapi.h:37
bool empty
Definition: tdapcapi.h:40
uchar_td val[MAX_BOOKMARK_SIZE]
Definition: tdapcapi.h:39

Transactd SDK 2018年07月31日(火) 19時40分23秒 doxygen