全て クラス 名前空間 関数 変数 型定義 列挙型 列挙値 ページ
connectionRecord.h
1 #ifndef BZS_DB_TRANSACTD_CONNECTIONRECORD_H
2 #define BZS_DB_TRANSACTD_CONNECTIONRECORD_H
3 /*=================================================================
4  Copyright (C) 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 <bzs/env/crosscompile.h>
23 #include <vector>
24 
25 #pragma pack(push, 1)
27 
28 namespace bzs
29 {
30 namespace db
31 {
32 namespace transactd
33 {
34 namespace connection
35 {
36 
37 /* Slave status row(field) index
38 record::type data type
39  0 longlong to longValue
40  1 string to value
41 */
42 #define SLAVE_STATUS_IO_STATE 0
43 #define SLAVE_STATUS_MASTER_HOST 1
44 #define SLAVE_STATUS_MASTER_USER 2
45 #define SLAVE_STATUS_MASTER_PORT 3
46 #define SLAVE_STATUS_CONNECT_RETRY 4
47 #define SLAVE_STATUS_MASTER_LOG_FILE 5
48 #define SLAVE_STATUS_READ_MASTER_LOG_POS 6
49 #define SLAVE_STATUS_RELAY_LOG_FILE 7
50 #define SLAVE_STATUS_RELAY_LOG_POS 8
51 #define SLAVE_STATUS_RELAY_MASTER_LOG_FILE 9
52 #define SLAVE_STATUS_SLAVE_IO_RUNNING 10
53 #define SLAVE_STATUS_SLAVE_SQL_RUNNING 11
54 #define SLAVE_STATUS_REPLICATE_DO_DB 12
55 #define SLAVE_STATUS_REPLICATE_IGNORE_DB 13
56 #define SLAVE_STATUS_REPLICATE_DO_TABLE 14
57 #define SLAVE_STATUS_REPLICATE_IGNORE_TABLE 15
58 #define SLAVE_STATUS_REPLICATE_WILD_DO_TABLE 16
59 #define SLAVE_STATUS_REPLICATE_WILD_IGNORE_TABLE 17
60 #define SLAVE_STATUS_LAST_ERRNO 18
61 #define SLAVE_STATUS_LAST_ERROR 19
62 #define SLAVE_STATUS_SKIP_COUNER 20
63 #define SLAVE_STATUS_EXEC_MASTER_LOG_POS 21
64 #define SLAVE_STATUS_RELAY_LOG_SPACE 22
65 #define SLAVE_STATUS_UNTIL_CONDITION 23
66 #define SLAVE_STATUS_UNTIL_LOG_FILE 24
67 #define SLAVE_STATUS_UNTIL_LOG_POS 25
68 #define SLAVE_STATUS_MASTER_SSL_ALLOWED 26
69 #define SLAVE_STATUS_MASTER_SSL_CA_FILE 27
70 #define SLAVE_STATUS_MASTER_SSL_CA_PATH 28
71 #define SLAVE_STATUS_MASTER_SSL_CERT 29
72 #define SLAVE_STATUS_MASTER_SSL_CIPHER 30
73 #define SLAVE_STATUS_MASTER_SSL_KEY 31
74 #define SLAVE_STATUS_SECONDS_BEHIND_MASTER 32
75 #define SLAVE_STATUS_MASTER_SSL_VERIFY_SERVER_CERT 33
76 #define SLAVE_STATUS_LAST_IO_ERRNO 34
77 #define SLAVE_STATUS_LAST_IO_ERROR 35
78 #define SLAVE_STATUS_LAST_SQL_ERRNO 36
79 #define SLAVE_STATUS_LAST_SQL_ERROR 37
80 #define SLAVE_STATUS_REPLICATE_IGNORE_SERVER_IDS 38
81 #define SLAVE_STATUS_MASTER_SERVER_ID 39
82 #define SLAVE_STATUS_DEFAULT_SIZE 40
83 
84 //#ifdef MARIADB_BASE_VERSION
85 # define SLAVE_STATUS_MA_MASTER_SSL_CRL 40
86 # define SLAVE_STATUS_MA_MASTER_SSL_CRLPATH 41
87 # define SLAVE_STATUS_MA_USING_GTID 42
88 # define SLAVE_STATUS_MA_GTID_IO_POS 43
89 # define SLAVE_STATUS_MA_REPLICATE_DO_DOMAIN_IDS 44
90 # define SLAVE_STATUS_MA_REPLICATE_IGNORE_DOMAIN_IDS 45
91 # define SLAVE_STATUS_MA_PARALLEL_MODE 46
92 # define SLAVE_STATUS_MA_RETRIED_TRANSACTIONS 47
93 # define SLAVE_STATUS_MA_MAX_RELAY_LOG_SIZE 48
94 # define SLAVE_STATUS_MA_EXECUTED_LOG_ENTRIES 49
95 # define SLAVE_STATUS_MA_SLAVE_RECV_HEARTBEATS 50
96 # define SLAVE_STATUS_MA_SLAVE_HEARTBEATS_PERIOD 51
97 # define SLAVE_STATUS_MA_GTID_SLAVE_POS 52
98 # define SLAVE_STATUS_MA_SIZE 53
99 //#else
100 # define SLAVE_STATUS_MASTER_UUID 40
101 # define SLAVE_STATUS_MASTER_INFO_FILE 41
102 # define SLAVE_STATUS_SQL_DELAY 42
103 # define SLAVE_STATUS_SQL_REMAINING_DELAY 43
104 # define SLAVE_STATUS_SQL_RUNNING_STATE 44
105 # define SLAVE_STATUS_MASTER_RETRY_COUNT 45
106 # define SLAVE_STATUS_MASTER_BIND 46
107 # define SLAVE_STATUS_LAST_IO_ERROR_TIMESTAMP 47
108 # define SLAVE_STATUS_LAST_SQL_ERROR_TIMESTAMP 48
109 # define SLAVE_STATUS_MASTER_SSL_CRL 49
110 # define SLAVE_STATUS_MASTER_SSL_CRLPATH 50
111 # define SLAVE_STATUS_RETRIEVED_GTID_SET 51
112 # define SLAVE_STATUS_EXECUTED_GTID_SET 52
113 # define SLAVE_STATUS_AUTO_POSITION 53
114 # define SLAVE_STATUS_REPLICATE_REWRITE_DB 54
115 # define SLAVE_STATUS_CHANNEL_NAME 55
116 # define SLAVE_STATUS_SIZE 56
117 //#endif
118 #define SLAVE_STATUS_EX_MA_SIZE SLAVE_STATUS_MA_SIZE - SLAVE_STATUS_DEFAULT_SIZE
119 #define SLAVE_STATUS_EX_SIZE SLAVE_STATUS_SIZE - SLAVE_STATUS_DEFAULT_SIZE
120 
121 
122 
123 
124 #define CON_REC_VALUE_SIZE 67
125 
126 struct record
127 {
128  record() : conId(0), id(0), db(0), updCount(0), status(0)
129  {
130  name[0] = 0x00;
131  }
132  void reset()
133  {
134  name[0] = 0x00;
135  conId = 0;
136  id = 0;
137  db = 0;
138  updCount = 0;
139  status = 0;
140  }
141  union
142  {
143  __int64 conId; // 8 byte
144  __int64 longValue;
145  struct
146  {
147  unsigned int delCount;
148  unsigned int insCount;
149  };
150  };
151  unsigned int id; // 4 byte
152  union
153  {
154  unsigned int db;
155  unsigned int readCount;
156  unsigned int port; // 4 byte
157  };
158  union
159  {
160  unsigned int updCount; // 4 byte
161  unsigned int type;
162  };
163 
164  char name[CON_REC_VALUE_SIZE]; // 67 byte
165  union
166  {
167  char status; // 1 byte
168  struct
169  {
170  char inTransaction : 1;
171  char inSnapshot : 1;
172  char openNormal : 1;
173  char openReadOnly : 1;
174  char openEx : 1;
175  char openReadOnlyEx : 1;
176  char dummy : 2;
177  };
178  };
179 
180 
181  #ifdef _UNICODE
182  inline const wchar_t* t_name(wchar_t* buf, int size) const
183  {
184  MultiByteToWideChar(CP_UTF8, 0, name, -1, buf, size);
185  return buf;
186  }
187  const wchar_t* value(wchar_t* buf, int size) const
188  {
189  if (type == 0)
190  {
191  _i64tow_s(longValue, buf, size, 10);
192  return buf;
193  }else if (type == 1)
194  {
195  MultiByteToWideChar(CP_UTF8, 0, name, -1, buf, size);
196  return buf;
197  }
198  MultiByteToWideChar(CP_UTF8, 0, (char*)longValue, -1, buf, size);
199  return buf;
200  }
201  #endif
202  /*inline const char* t_name(char* buf, int size) const
203  {
204  return name;
205  }*/
206  const char* value(char* buf, int size) const
207  {
208  if (type == 0)
209  {
210  _i64toa_s(longValue, buf, size, 10);
211 
212  }else if (type == 1)
213  strcpy_s(buf, size, name);
214  else
215  strcpy_s(buf, size, (char*)longValue);
216  return buf;
217  }
218  const char* value_ptr() const
219  {
220  if (type == 0)
221  return (const char*)&longValue;
222  else if(type == 1)
223  return name;
224  return (const char*)longValue;
225  }
226 
227 }; // 20 + 68 = 88
228 
229 #ifdef MYSQL_DYNAMIC_PLUGIN
230 typedef std::vector<record> records;
231 #endif
232 
233 } // connection
234 } // transactd
235 } // db
236 } // bzs
237 
238 #pragma pack(pop)
240 
241 #endif // BZS_DB_TRANSACTD_CONNECTIONRECORD_H
unsigned int readCount
Definition: connectionRecord.h:155
pragma_pop
Definition: btrDate.h:107
char inTransaction
Definition: connectionRecord.h:170
unsigned int db
Definition: connectionRecord.h:154
char openEx
Definition: connectionRecord.h:174
__int64 longValue
Definition: connectionRecord.h:144
unsigned int insCount
Definition: connectionRecord.h:148
unsigned int id
Definition: connectionRecord.h:151
char status
Definition: connectionRecord.h:167
char dummy
Definition: connectionRecord.h:176
const char * value(char *buf, int size) const
Definition: connectionRecord.h:206
char openNormal
Definition: connectionRecord.h:172
unsigned int delCount
Definition: connectionRecord.h:147
char openReadOnlyEx
Definition: connectionRecord.h:175
record()
Definition: connectionRecord.h:128
char inSnapshot
Definition: connectionRecord.h:171
char openReadOnly
Definition: connectionRecord.h:173
const char * value_ptr() const
Definition: connectionRecord.h:218
void reset()
Definition: connectionRecord.h:132
pragma_pack1
Definition: btrDate.h:36
unsigned int type
Definition: connectionRecord.h:161
unsigned int updCount
Definition: connectionRecord.h:160
char name[CON_REC_VALUE_SIZE]
Definition: connectionRecord.h:164
接続管理マネージャ結果レコード
Definition: connectionRecord.h:126
__int64 conId
Definition: connectionRecord.h:143
unsigned int port
Definition: connectionRecord.h:156

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