transactd 3.1.0 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
|
@@ -117,7 +117,7 @@ uchar_td convFieldType(enum enum_field_types type, uint flags, bool binary,
|
|
|
117
117
|
case MYSQL_TYPE_BLOB:
|
|
118
118
|
case MYSQL_TYPE_LONG_BLOB:
|
|
119
119
|
case MYSQL_TYPE_MEDIUM_BLOB:
|
|
120
|
-
if (
|
|
120
|
+
if (binary)
|
|
121
121
|
return ft_myblob;
|
|
122
122
|
return ft_mytext;
|
|
123
123
|
case MYSQL_TYPE_GEOMETRY:
|
|
@@ -200,19 +200,19 @@ tabledef* schemaBuilder::getTabledef(engine::mysql::table* src, int id,
|
|
|
200
200
|
String str;
|
|
201
201
|
for (int i = 0; i < src->fields(); ++i)
|
|
202
202
|
{
|
|
203
|
-
|
|
203
|
+
Field* f = src->field(i);
|
|
204
|
+
if (isNisField(f->field_name))
|
|
204
205
|
--td.fieldCount;
|
|
205
206
|
else
|
|
206
207
|
{
|
|
207
208
|
fielddef fd;
|
|
208
|
-
Field* f = src->field(i);
|
|
209
209
|
memset(&fd, 0, sizeof(fd));
|
|
210
|
-
fd.setName(
|
|
211
|
-
fd.len =
|
|
210
|
+
fd.setName(f->field_name);
|
|
211
|
+
fd.len = f->pack_length();
|
|
212
212
|
fd.pos = pos;
|
|
213
|
-
fd.type = convFieldType(
|
|
214
|
-
isBinary(
|
|
215
|
-
isUnicode(
|
|
213
|
+
fd.type = convFieldType(f->real_type(), f->flags,
|
|
214
|
+
isBinary(*(f->charset())),
|
|
215
|
+
isUnicode(*(f->charset())));
|
|
216
216
|
if ((fd.type == ft_mytime) || (fd.type == ft_mydatetime) || (fd.type == ft_mytimestamp))
|
|
217
217
|
{
|
|
218
218
|
if (src->isLegacyTimeFormat(i))
|
|
@@ -226,14 +226,12 @@ tabledef* schemaBuilder::getTabledef(engine::mysql::table* src, int id,
|
|
|
226
226
|
}
|
|
227
227
|
|
|
228
228
|
if (fd.type == ft_mydecimal)
|
|
229
|
-
{
|
|
230
229
|
fd.digits = my_decimal_length_to_precision(f->field_length, f->decimals(),
|
|
231
230
|
(f->flags & UNSIGNED_FLAG) != 0);
|
|
232
|
-
}
|
|
233
231
|
|
|
234
232
|
fd.setPadCharSettings(false, true);
|
|
235
|
-
if (
|
|
236
|
-
fd.setCharsetIndex(charsetIndex(
|
|
233
|
+
if (f->has_charset())
|
|
234
|
+
fd.setCharsetIndex(charsetIndex(f->charset()->csname));
|
|
237
235
|
|
|
238
236
|
if ((fd.type == ft_mydatetime || fd.type == ft_mytimestamp) && (f->val_real() == 0))
|
|
239
237
|
{// No constant value
|
|
@@ -297,15 +295,11 @@ tabledef* schemaBuilder::getTabledef(engine::mysql::table* src, int id,
|
|
|
297
295
|
if (nouseNullkey == false)
|
|
298
296
|
sg.flags.bit9 = ks.null_bit ? 1 : 0; // null key
|
|
299
297
|
allNullkey = allNullkey & sg.flags.bit9;
|
|
300
|
-
if (isStringTypeForIndex(convFieldType(
|
|
301
|
-
src->fieldType(sg.fieldNum),
|
|
302
|
-
src->fieldFlags(sg.fieldNum),
|
|
303
|
-
isBinary(src->fieldCharset(i)),
|
|
304
|
-
isUnicode(src->fieldCharset(sg.fieldNum)))))
|
|
305
|
-
sg.flags.bitA =
|
|
306
|
-
!(src->fieldFlags(sg.fieldNum) & BINARY_FLAG);// case in-sencitive
|
|
307
|
-
|
|
308
298
|
Field* f = src->field(sg.fieldNum);
|
|
299
|
+
if (isStringTypeForIndex(convFieldType(f->type(), f->flags, isBinary(*(f->charset())),
|
|
300
|
+
isUnicode(*(f->charset())))))
|
|
301
|
+
sg.flags.bitA = !(f->flags & BINARY_FLAG);// case in-sencitive
|
|
302
|
+
|
|
309
303
|
if (f->pack_length() != ks.length + var_bytes_if(f))
|
|
310
304
|
td.fieldDefs[sg.fieldNum].keylen = ks.length ; // suppot prefix key
|
|
311
305
|
++segNum;
|
|
@@ -331,7 +325,7 @@ tabledef* schemaBuilder::getTabledef(engine::mysql::table* src, int id,
|
|
|
331
325
|
|
|
332
326
|
tabledef* schemaBuilder::getTabledef(database* db, const char* tablename, uchar* rec, size_t size)
|
|
333
327
|
{
|
|
334
|
-
table* tb = db->openTable(tablename, TD_OPEN_READONLY, NULL);
|
|
328
|
+
table* tb = db->openTable(tablename, TD_OPEN_READONLY, NULL, "");
|
|
335
329
|
if (db->stat())
|
|
336
330
|
{
|
|
337
331
|
m_stat = db->stat();
|
|
@@ -367,7 +361,36 @@ bool isFrmFile(const std::string& name, bool notschema=true)
|
|
|
367
361
|
return false;
|
|
368
362
|
}
|
|
369
363
|
|
|
370
|
-
|
|
364
|
+
|
|
365
|
+
int isView(database* db, const char *name)
|
|
366
|
+
{
|
|
367
|
+
int ret = -1;
|
|
368
|
+
#ifndef NO_LOCK_OPEN
|
|
369
|
+
safe_mysql_mutex_lock lck(&LOCK_open);
|
|
370
|
+
#endif
|
|
371
|
+
TABLE_SHARE* s = cp_get_cached_table_share(db->thd(), db->name().c_str(), name);
|
|
372
|
+
if (s)
|
|
373
|
+
{
|
|
374
|
+
ret = (int)s->is_view;
|
|
375
|
+
#ifdef NO_LOCK_OPEN
|
|
376
|
+
cp_tdc_release_share(s);
|
|
377
|
+
#endif
|
|
378
|
+
}
|
|
379
|
+
return ret;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
table* getTable(database* db, const char *name)
|
|
383
|
+
{
|
|
384
|
+
table* tb = NULL;
|
|
385
|
+
try
|
|
386
|
+
{
|
|
387
|
+
tb = db->openTable(name, TD_OPEN_READONLY, NULL, "");
|
|
388
|
+
}
|
|
389
|
+
catch(...){}
|
|
390
|
+
return tb;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
void schemaBuilder::listTable(database* db, std::vector<std::string>& tables, int type)
|
|
371
394
|
{
|
|
372
395
|
char path[FN_REFLEN + 1];
|
|
373
396
|
build_table_filename(path, sizeof(path) - 1, db->name().c_str(), "", "", 0);
|
|
@@ -375,35 +398,52 @@ void schemaBuilder::listSchemaTable(database* db, std::vector<std::string>& shce
|
|
|
375
398
|
fs::path p = s;
|
|
376
399
|
fs::directory_iterator it(p);
|
|
377
400
|
fs::directory_iterator end;
|
|
378
|
-
|
|
379
|
-
|
|
401
|
+
tables.clear();
|
|
402
|
+
|
|
380
403
|
for (fs::directory_iterator it(p); it != end; ++it)
|
|
381
404
|
{
|
|
382
405
|
if (!is_directory(*it))
|
|
383
406
|
{
|
|
384
|
-
std::string s = it->path().
|
|
385
|
-
if (isFrmFile(
|
|
407
|
+
std::string s = it->path().string(); // fullpath
|
|
408
|
+
if (isFrmFile(it->path().filename().string(), false)) // filename
|
|
386
409
|
{
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
410
|
+
enum legacy_db_type not_used;
|
|
411
|
+
|
|
412
|
+
frm_type_enum ftype = dd_frm_type(db->thd(), (char*)s.c_str(), ¬_used);
|
|
413
|
+
filename_to_tablename(it->path().stem().string().c_str(), path, FN_REFLEN);
|
|
414
|
+
std::string tablename = path;
|
|
415
|
+
|
|
416
|
+
if (((type & TABLE_TYPE_VIEW) && (ftype == FRMTYPE_VIEW)) ||
|
|
417
|
+
((type & TABLE_TYPE_NORMAL_TABLE) && (ftype == FRMTYPE_TABLE)))
|
|
418
|
+
tables.push_back(tablename);
|
|
419
|
+
else if ((ftype == FRMTYPE_TABLE) && type == TABLE_TYPE_TD_SCHEMA)
|
|
391
420
|
{
|
|
392
|
-
tb = db->openTable(path, TD_OPEN_READONLY, NULL);
|
|
393
|
-
}
|
|
394
|
-
catch(...){}
|
|
395
|
-
if (!tb) break;
|
|
396
|
-
if (!tb->isView())
|
|
397
|
-
{
|
|
398
|
-
LEX_STRING& comment = tb->internalTable()->s->comment;
|
|
399
|
-
const char* p = comment.str;
|
|
400
|
-
if ((comment.length > 8) && strstr(p,"%@%02.000") &&
|
|
401
|
-
(tb->fields() == 2) && (tb->keys() == 1))
|
|
402
421
|
{
|
|
403
|
-
|
|
422
|
+
#ifndef NO_LOCK_OPEN
|
|
423
|
+
safe_mysql_mutex_lock lck(&LOCK_open);
|
|
424
|
+
#endif
|
|
425
|
+
TABLE_SHARE* s = cp_get_cached_table_share(db->thd(), db->name().c_str(), tablename.c_str());
|
|
426
|
+
if (s)
|
|
427
|
+
{
|
|
428
|
+
LEX_STRING* comment = &s->comment;
|
|
429
|
+
if (comment && (comment->length > 8) && strstr(comment->str,"%@%02.000"))
|
|
430
|
+
tables.push_back(tablename);
|
|
431
|
+
#ifdef NO_LOCK_OPEN
|
|
432
|
+
cp_tdc_release_share(s);
|
|
433
|
+
#endif
|
|
434
|
+
continue;
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
{
|
|
439
|
+
table* tb = getTable(db, tablename.c_str());
|
|
440
|
+
if (!tb) break;
|
|
441
|
+
LEX_STRING* comment = &tb->internalTable()->s->comment;
|
|
442
|
+
if (comment && (comment->length > 8) && strstr(comment->str,"%@%02.000"))
|
|
443
|
+
tables.push_back(tablename);
|
|
444
|
+
if (tb) tb->close();
|
|
404
445
|
}
|
|
405
446
|
}
|
|
406
|
-
db->closeTable(tb);
|
|
407
447
|
}
|
|
408
448
|
}
|
|
409
449
|
}
|
|
@@ -431,7 +471,7 @@ short schemaBuilder::execute(database* db, table* mtb, bool nouseNullkey)
|
|
|
431
471
|
{
|
|
432
472
|
filename_to_tablename(it->path().stem().string().c_str(), path,
|
|
433
473
|
FN_REFLEN);
|
|
434
|
-
table* tb = db->openTable(path, TD_OPEN_READONLY, NULL);
|
|
474
|
+
table* tb = db->openTable(path, TD_OPEN_READONLY, NULL, "");
|
|
435
475
|
if (!tb) break;
|
|
436
476
|
if (!tb->isView())
|
|
437
477
|
tables.push_back(tb);
|
|
@@ -56,9 +56,11 @@ public:
|
|
|
56
56
|
tabledef* getTabledef(engine::mysql::table* src, int id, bool nouseNullkey, uchar* rec, size_t size);
|
|
57
57
|
tabledef* getTabledef(engine::mysql::database* db, const char* tablename, uchar* rec, size_t size);
|
|
58
58
|
short execute(engine::mysql::database* db, engine::mysql::table* mtb, bool nouseNullkey);
|
|
59
|
-
static void
|
|
59
|
+
static void listTable(engine::mysql::database* db, std::vector<std::string>& tables, int type);
|
|
60
60
|
};
|
|
61
61
|
|
|
62
|
+
|
|
63
|
+
|
|
62
64
|
} // namespace mysql
|
|
63
65
|
} // namespace protocol
|
|
64
66
|
} // namespace db
|
|
@@ -70,10 +70,10 @@ public:
|
|
|
70
70
|
}
|
|
71
71
|
int getFieldNumByPos(unsigned short pos) const
|
|
72
72
|
{
|
|
73
|
+
char* start = (char*)m_tb->field(0)->ptr;
|
|
73
74
|
for (int i = 0; i < m_tb->fields(); i++)
|
|
74
75
|
{
|
|
75
|
-
char* start
|
|
76
|
-
if (m_tb->fieldPos(i) - start == pos)
|
|
76
|
+
if ((char*)m_tb->field(i)->ptr - start == pos)
|
|
77
77
|
return i;
|
|
78
78
|
}
|
|
79
79
|
return -1;
|
|
@@ -93,7 +93,7 @@ public:
|
|
|
93
93
|
{
|
|
94
94
|
Field* fd = m_tb->field(index);
|
|
95
95
|
unsigned char* null_ptr = (unsigned char*)cp_null_ptr(fd, (unsigned char*)m_tb->internalTable()->record[0]);
|
|
96
|
-
return (unsigned char)((unsigned char*)m_tb->
|
|
96
|
+
return (unsigned char)((unsigned char*)m_tb->field(0)->ptr - null_ptr);
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
bool isLegacyTimeFormat(int fieldNum) const
|
|
@@ -136,12 +136,12 @@ inline void position::setTable(engine::mysql::table* tb)
|
|
|
136
136
|
|
|
137
137
|
inline char* position::fieldPtr(const resultField* rf) const
|
|
138
138
|
{
|
|
139
|
-
return m_tb->
|
|
139
|
+
return (char*)m_tb->field(rf->fieldNum)->ptr;
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
inline bool position::isBlobField(const resultField* rf) const
|
|
143
143
|
{
|
|
144
|
-
return db::engine::mysql::isBlobType(m_tb->
|
|
144
|
+
return db::engine::mysql::isBlobType(m_tb->field(rf->fieldNum)->type());
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
/** return data length as real rength.
|
|
@@ -486,10 +486,10 @@ public:
|
|
|
486
486
|
}
|
|
487
487
|
if (key)
|
|
488
488
|
{
|
|
489
|
+
// Sort between first to before first "or";
|
|
489
490
|
std::vector<fieldAdapter>::iterator begin = m_fields.begin();
|
|
490
491
|
std::vector<fieldAdapter>::iterator cur = m_fields.begin();
|
|
491
492
|
std::vector<fieldAdapter>::iterator end = begin + lastIndex;
|
|
492
|
-
|
|
493
493
|
char tmpOpr = (lastIndex != req.logicalCount) ? end->m_fd->opr : 0;
|
|
494
494
|
std::sort(begin, end);
|
|
495
495
|
bool flag = true;
|
|
@@ -855,7 +855,7 @@ public:
|
|
|
855
855
|
bm.setReadBitmap(num);
|
|
856
856
|
if (m_position.isBlobField(&fd))
|
|
857
857
|
++blobs;
|
|
858
|
-
if (m_position.isNullable(num))
|
|
858
|
+
if (m_position.isNullable(num) && m_position.isMysqlNull())
|
|
859
859
|
++nullfields;
|
|
860
860
|
|
|
861
861
|
}
|