transactd 3.5.0 → 3.6.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.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/bin/common/{tdclc_32_3_5.dll → tdclc_32_3_6.dll} +0 -0
  3. data/bin/common/tdclc_64_3_6.dll +0 -0
  4. data/build/swig/ruby/tdclrb_wrap.cpp +12524 -24430
  5. data/build/swig/tdcl.i +5 -0
  6. data/build/tdclc/tdclc.cbproj +1 -1
  7. data/build/tdclc/tdclc.rc +4 -4
  8. data/build/tdclcpp/tdclcpp.rc +4 -4
  9. data/build/tdclcpp/tdclcpp_bc.cbproj +1 -1
  10. data/build/tdclrb/tdclrb.rc +4 -4
  11. data/source/bzs/db/engine/mysql/database.cpp +210 -184
  12. data/source/bzs/db/engine/mysql/database.h +276 -105
  13. data/source/bzs/db/engine/mysql/mysqlInternal.h +37 -0
  14. data/source/bzs/db/engine/mysql/mysqlProtocol.cpp +1 -0
  15. data/source/bzs/db/protocol/hs/hsCommandExecuter.cpp +4 -4
  16. data/source/bzs/db/protocol/tdap/client/activeTable.h +1 -1
  17. data/source/bzs/db/protocol/tdap/client/activeTableImple.h +1 -0
  18. data/source/bzs/db/protocol/tdap/client/connMgr.cpp +1 -1
  19. data/source/bzs/db/protocol/tdap/client/database.cpp +7 -4
  20. data/source/bzs/db/protocol/tdap/client/database.h +6 -1
  21. data/source/bzs/db/protocol/tdap/client/databaseManager.h +2 -2
  22. data/source/bzs/db/protocol/tdap/client/dbDef.cpp +21 -9
  23. data/source/bzs/db/protocol/tdap/client/dbDef.h +1 -1
  24. data/source/bzs/db/protocol/tdap/client/dllmain.cpp +10 -2
  25. data/source/bzs/db/protocol/tdap/client/field.cpp +29 -5
  26. data/source/bzs/db/protocol/tdap/client/field.h +3 -1
  27. data/source/bzs/db/protocol/tdap/client/fieldNameAlias.cpp +5 -0
  28. data/source/bzs/db/protocol/tdap/client/fieldNameAlias.h +1 -0
  29. data/source/bzs/db/protocol/tdap/client/fields.h +9 -2
  30. data/source/bzs/db/protocol/tdap/client/groupQuery.cpp +8 -4
  31. data/source/bzs/db/protocol/tdap/client/memRecord.cpp +18 -5
  32. data/source/bzs/db/protocol/tdap/client/memRecord.h +2 -2
  33. data/source/bzs/db/protocol/tdap/client/nsTable.cpp +46 -13
  34. data/source/bzs/db/protocol/tdap/client/nsTable.h +5 -0
  35. data/source/bzs/db/protocol/tdap/client/recordset.cpp +5 -0
  36. data/source/bzs/db/protocol/tdap/client/recordset.h +1 -0
  37. data/source/bzs/db/protocol/tdap/client/recordsetImple.h +6 -2
  38. data/source/bzs/db/protocol/tdap/client/request.h +46 -38
  39. data/source/bzs/db/protocol/tdap/client/sqlBuilder.cpp +2 -3
  40. data/source/bzs/db/protocol/tdap/client/stringConverter.h +29 -13
  41. data/source/bzs/db/protocol/tdap/client/table.cpp +60 -10
  42. data/source/bzs/db/protocol/tdap/client/table.h +4 -1
  43. data/source/bzs/db/protocol/tdap/client/trdboostapi.h +18 -1
  44. data/source/bzs/db/protocol/tdap/client/trdormapi.h +10 -4
  45. data/source/bzs/db/protocol/tdap/fieldComp.h +1 -1
  46. data/source/bzs/db/protocol/tdap/mysql/characterset.h +1 -0
  47. data/source/bzs/db/protocol/tdap/mysql/databaseSchema.cpp +11 -4
  48. data/source/bzs/db/protocol/tdap/mysql/databaseSchema.h +2 -1
  49. data/source/bzs/db/protocol/tdap/mysql/recordsetReader.h +52 -94
  50. data/source/bzs/db/protocol/tdap/mysql/request.h +20 -13
  51. data/source/bzs/db/protocol/tdap/mysql/tdapCommandExecuter.cpp +92 -60
  52. data/source/bzs/db/protocol/tdap/mysql/tdapCommandExecuter.h +4 -4
  53. data/source/bzs/db/protocol/tdap/tdapRequest.h +11 -0
  54. data/source/bzs/db/protocol/tdap/tdapSchema.cpp +83 -34
  55. data/source/bzs/db/protocol/tdap/tdapSchema.h +5 -1
  56. data/source/bzs/db/protocol/tdap/tdapcapi.h +7 -3
  57. data/source/bzs/example/ormap_c.cpp +2 -2
  58. data/source/bzs/netsvc/server/serverPipe.cpp +35 -1
  59. data/source/bzs/test/tdclatl/test_v3.js +48 -1
  60. data/source/bzs/test/tdclphp/bench.php +89 -76
  61. data/source/bzs/test/tdclphp/transactd_Test.php +691 -687
  62. data/source/bzs/test/tdclphp/transactd_blob_Test.php +46 -43
  63. data/source/bzs/test/tdclphp/transactd_datetime_Test.php +46 -43
  64. data/source/bzs/test/tdclphp/transactd_kanjischema_Test.php +33 -33
  65. data/source/bzs/test/tdclphp/transactd_pool_Test.php +29 -25
  66. data/source/bzs/test/tdclphp/transactd_v3_Test.php +653 -183
  67. data/source/bzs/test/tdclrb/transactd_datetime_spec.rb +40 -4
  68. data/source/bzs/test/tdclrb/transactd_fetch_spec.rb +785 -0
  69. data/source/bzs/test/tdclrb/transactd_pool_spec.rb +21 -1
  70. data/source/bzs/test/tdclrb/transactd_setget_spec.rb +450 -0
  71. data/source/bzs/test/tdclrb/transactd_spec.rb +14 -2
  72. data/source/bzs/test/tdclrb/transactd_v3_spec.rb +1192 -11
  73. data/source/bzs/test/trdclengn/testField.h +522 -1
  74. data/source/bzs/test/trdclengn/test_tdclcpp_v3.cpp +37 -1
  75. data/source/bzs/test/trdclengn/test_trdclengn.cpp +62 -4
  76. data/source/global/tdclatl/RecordsetQuery.cpp +2 -1
  77. data/source/global/tdclatl/RecordsetQuery.h +1 -1
  78. data/source/global/tdclatl/Table.cpp +17 -0
  79. data/source/global/tdclatl/Table.h +3 -1
  80. data/source/global/tdclatl/tdclatl.idl +7 -2
  81. data/transactd.gemspec +1 -1
  82. metadata +7 -5
  83. data/bin/common/tdclc_64_3_5.dll +0 -0
@@ -28,6 +28,8 @@
28
28
  #include <bzs/env/crosscompile.h>
29
29
  #include "fieldAccess.h"
30
30
  #include <bzs/db/IBlobBuffer.h>
31
+ #include <bitset>
32
+ #include <bzs/db/protocol/tdap/tdapRequest.h>
31
33
 
32
34
  class THD;
33
35
  struct TABLE;
@@ -270,17 +272,247 @@ public:
270
272
  return m_convNum = num; // If not found, a value as it is returned.
271
273
  }
272
274
 
273
- char clientKeynum(char num)
275
+ };
276
+
277
+ class prepareHandler
278
+ {
279
+ TABLE* m_table;
280
+ std::bitset<256> m_bts;
281
+ std::bitset<256> m_btsOld;
282
+ char m_keyNum;
283
+ bool m_keyRead;
284
+ bool m_changed;
285
+ bool m_wholeRow;
286
+ bool m_innodb;
287
+ bool m_lock;
288
+
289
+ void setInnodbFetchExtraCols(unsigned long v);
290
+
291
+ inline void setWholeRow(bool v)
292
+ {
293
+ if (m_wholeRow != v)
294
+ {
295
+ m_wholeRow = v;
296
+ m_changed = true;
297
+ }
298
+ }
299
+
300
+ inline void setKeyRead(bool v)
301
+ {
302
+ if (v != m_keyRead)
303
+ {
304
+ m_keyRead = v;
305
+ m_changed = true;
306
+ }
307
+ }
308
+
309
+ #define MAX_KEY_SEGMENT 8
310
+ void makeKeyFieldBitmap(std::bitset<256>& bts, char keynum)
311
+ {
312
+ if (keynum >= 0)
313
+ {
314
+ const KEY* key = &m_table->key_info[(int)keynum];
315
+ if (key)
316
+ {
317
+ int sgi = 0;
318
+ int segments = std::min<uint>(MAX_KEY_SEGMENT,
319
+ key->user_defined_key_parts);
320
+ while (sgi < segments)
321
+ {
322
+ bts.set(key->key_part[sgi].field->field_index);
323
+ ++sgi;
324
+ }
325
+ }
326
+ }
327
+ }
328
+
329
+ void makeKeyFieldBitmap(int keynum)
330
+ {
331
+ if (keynum >= 0)
332
+ {
333
+ const KEY* key = &m_table->key_info[(int)keynum];
334
+ if (key)
335
+ {
336
+ int sgi = 0;
337
+ int segments = std::min<uint>(MAX_KEY_SEGMENT, key->user_defined_key_parts);
338
+ while (sgi < segments)
339
+ {
340
+ setReadBitmap(key->key_part[sgi].field->field_index);
341
+ ++sgi;
342
+ }
343
+ }
344
+ }
345
+ }
346
+
347
+ bool isKeyFieldOnly()
348
+ {
349
+ std::bitset<256> bts;
350
+ makeKeyFieldBitmap(bts, m_keyNum);
351
+ makeKeyFieldBitmap(bts, m_table->s->primary_key);
352
+ //Compare bitmap
353
+ uint n = (uint)m_bts.count();
354
+ uint i = 0;
355
+ while (n)
356
+ {
357
+ if (m_bts[i] && !bts[i])
358
+ return false;
359
+ if (m_bts[i++]) --n;
360
+ }
361
+ return true;
362
+ }
363
+
364
+ /* @return keyonly */
365
+ bool setBits()
274
366
  {
275
- if (num < m_keyCount)
367
+ bool keyOnly = false;
368
+ if (!m_wholeRow)
276
369
  {
277
- if (strstr(m_key[(int)num].name, "key"))
278
- return m_key[(int)num].name[3] - '0';
370
+ if (m_btsOld != m_bts)
371
+ {
372
+ keyOnly = isKeyFieldOnly();
373
+ bitmap_clear_all(&m_table->tmp_set);
374
+ uint n = (uint)m_bts.count();
375
+ for (uint i = 0; i < n; ++i)
376
+ {
377
+ if (m_bts[i])
378
+ bitmap_set_bit(&m_table->tmp_set, i);
379
+ }
380
+ m_changed = true;
381
+ }else
382
+ keyOnly = m_keyRead;
383
+
384
+ m_btsOld = m_bts;
279
385
  }
280
- return -1;
386
+ else if (!m_btsOld.all())
387
+ m_btsOld.set(); // set all bits true
388
+
389
+ return keyOnly;
390
+ }
391
+
392
+ void doChange()
393
+ {
394
+ int ret = m_table->file->ha_index_or_rnd_end();
395
+ assert(ret == 0);
396
+ m_table->file->extra(m_keyRead ? HA_EXTRA_KEYREAD : HA_EXTRA_NO_KEYREAD);
397
+ unsigned long fetch_col = m_wholeRow ? ROW_RETRIEVE_ALL_COLS : ROW_RETRIEVE_DEFAULT;
398
+ /* if key_read and ROW_RETRIEVE_ALL_COLS, fetch all key fields */
399
+ //if (m_keyRead) fetch_col = ROW_RETRIEVE_ALL_COLS;
400
+ setInnodbFetchExtraCols(fetch_col);
401
+ if (m_wholeRow)
402
+ {
403
+ m_table->read_set = &m_table->s->all_set;
404
+ //m_table->write_set = &m_table->s->all_set;
405
+ }
406
+ else
407
+ {
408
+ m_table->read_set = &m_table->tmp_set;
409
+ //m_table->write_set = &m_table->tmp_set;
410
+ }
411
+ if (m_keyNum >= 0)
412
+ ret = m_table->file->ha_index_init(m_keyNum, true);
413
+ else
414
+ ret = m_table->file->ha_rnd_init(true);
415
+ assert(ret == 0);
416
+ m_changed = false;
417
+ }
418
+
419
+ bool isChengeLock()
420
+ {
421
+ if (m_lock != (m_table->reginfo.lock_type >= TL_WRITE))
422
+ {
423
+ m_lock = (m_table->reginfo.lock_type >= TL_WRITE);
424
+ if (m_lock)
425
+ {
426
+ m_wholeRow = true;
427
+ m_keyRead = false;
428
+ }
429
+ return true;
430
+ }
431
+ return false;
432
+ }
433
+ public:
434
+ inline prepareHandler(TABLE* table) : m_table(table), m_keyNum(-1), m_keyRead(false), m_changed(true),
435
+ m_wholeRow(true), m_innodb(false), m_lock(false)
436
+ {
437
+ assert(table);
438
+ m_innodb = (strcmp(m_table->file->table_type(), "InnoDB") == 0);
439
+ }
440
+
441
+ void init(TABLE* table)
442
+ {
443
+ m_table = table;
444
+ assert(table);
445
+ m_keyNum = -1;
446
+ m_keyRead = false;
447
+ m_changed = true;
448
+ m_wholeRow = true;
449
+ m_innodb = (strcmp(m_table->file->table_type(), "InnoDB") == 0);
450
+ m_lock = false;
451
+ }
452
+
453
+ void setKeyNum(char v)
454
+ {
455
+ if (v != m_keyNum)
456
+ {
457
+ m_changed = true;
458
+ m_keyNum = v;
459
+ }
460
+ }
461
+
462
+ char keyNum() const { return m_keyNum; };
463
+
464
+ void makeCurrentKeyFieldBitmap()
465
+ {
466
+ if (m_keyNum >= 0)
467
+ makeKeyFieldBitmap(m_keyNum);
468
+ }
469
+
470
+ void makePrimaryKeyFieldBitmap()
471
+ {
472
+ makeKeyFieldBitmap(m_table->s->primary_key);
473
+ }
474
+
475
+ inline void clearReadBitmap()
476
+ {
477
+ m_bts.reset();
478
+ }
479
+
480
+ inline void setReadBitmap(uint bit)
481
+ {
482
+ m_bts.set(bit);
483
+ }
484
+
485
+ inline void setReadBitmap(const std::bitset<256>& bits)
486
+ {
487
+ m_bts = bits;
488
+ }
489
+
490
+ inline const std::bitset<256>& getReadBitmap()
491
+ {
492
+ return m_bts;
493
+ }
494
+
495
+ inline bool isKeyRead() const { return m_keyRead; }
496
+
497
+ inline bool isWholeRow() const { return m_wholeRow; }
498
+
499
+ void ready(bool wholeRow = true, bool keyRead = false)
500
+ {
501
+ if (isChengeLock()) m_changed = true;
502
+ setWholeRow(wholeRow);
503
+ if (setBits())
504
+ setKeyRead(true); // force keyRead, Ignore function param
505
+ else
506
+ setKeyRead(keyRead);
507
+ if (m_changed) doChange();
281
508
  }
282
509
  };
283
510
 
511
+ static const bool lock_mode = true;
512
+ static const bool key_read = true;
513
+ static const bool field_select = false;
514
+ static const bool whole_row = false;
515
+
284
516
  class table : private boost::noncopyable
285
517
  {
286
518
  friend class database;
@@ -308,12 +540,13 @@ class table : private boost::noncopyable
308
540
  IblobBuffer* m_blobBuffer;
309
541
  std::vector<Field*> m_noNullModeNullFieldList;
310
542
  std::vector<Field*> m_timeStampFields;
543
+ Field* m_updateAtField;
311
544
  unsigned int m_readCount;
312
545
  unsigned int m_updCount;
313
546
  unsigned int m_delCount;
314
547
  unsigned int m_insCount;
315
548
  ulong m_privilege;
316
- char m_keyNum;
549
+ //char m_keyNum;
317
550
  unsigned char m_nullBytesCl;
318
551
  struct
319
552
  {
@@ -332,6 +565,7 @@ class table : private boost::noncopyable
332
565
  bool m_mysqlNull : 1;
333
566
  bool m_timestampAlways : 1;
334
567
  };
568
+ prepareHandler m_prepare;
335
569
 
336
570
  table(TABLE* table, database& db, const std::string& name, short mode,
337
571
  int id, bool mysqlnull);
@@ -355,7 +589,7 @@ class table : private boost::noncopyable
355
589
 
356
590
  inline uint keylen() const
357
591
  {
358
- return m_table->key_info[(int)m_keyNum].key_length;
592
+ return m_table->key_info[(int)m_prepare.keyNum()].key_length;
359
593
  }
360
594
  void setKeyValues(const uchar* ptr, int size);
361
595
  void setBlobFieldPointer(const bzs::db::blobHeader* hd);
@@ -380,6 +614,8 @@ class table : private boost::noncopyable
380
614
  inline void unlockRow(bool noConsistent);
381
615
  inline void tryConsistentRead(bool noConsistent);
382
616
 
617
+
618
+
383
619
  #ifdef USE_HANDLERSOCKET
384
620
  std::vector<int> m_useFields;
385
621
  void checkFiledIndex(int index);
@@ -398,6 +634,9 @@ public:
398
634
 
399
635
  ~table();
400
636
 
637
+ inline prepareHandler* getPrepareHandler() { return &m_prepare; }
638
+
639
+
401
640
  inline void checkACL(enum_sql_command cmd);
402
641
 
403
642
  inline ulong* privilegePtr() {return &m_privilege;}
@@ -484,11 +723,11 @@ public:
484
723
  m_db.closeTable(this);
485
724
  }
486
725
 
487
- inline char keyNum() const { return m_keyNum; }
726
+ inline char keyNum() const { return m_prepare.keyNum(); }
488
727
 
489
728
  inline bool isUniqueKey()
490
729
  {
491
- return (m_table->key_info[(int)m_keyNum].flags & HA_NOSAME);
730
+ return (m_table->key_info[keyNum()].flags & HA_NOSAME);
492
731
  }
493
732
 
494
733
  /*
@@ -507,19 +746,24 @@ public:
507
746
  return ((num >= 0) && (num < (short)m_table->s->keys));
508
747
  }
509
748
 
510
- bool setKeyNum(char num, bool sorted = true);
749
+ bool setKeyNum(char num, bool wholeRow = true, bool keyRead = false);
750
+
751
+ bool setKeyNumForMultiRead(char num);
511
752
 
512
- inline void setKeyNum(const char* name, bool sorted = true)
753
+ inline void setKeyNum(const char* name, bool wholeRow = true, bool keyRead = false)
513
754
  {
514
- setKeyNum(keynumByName(name), sorted);
755
+ setKeyNum(keynumByName(name), wholeRow, keyRead);
515
756
  }
757
+
758
+ bool setNonKey(bool wholeRow = true, bool keyRead = false);
759
+
516
760
  bool isNisKey(char num) const;
517
761
 
518
762
  inline key_part_map keymap()
519
763
  {
520
- return (1U << m_table->key_info[(int)m_keyNum].user_defined_key_parts) - 1;
764
+ assert(keynumCheck(keyNum()));
765
+ return (1U << m_table->key_info[(int)keyNum()].user_defined_key_parts) - 1;
521
766
  }
522
- bool setNonKey(bool scan = false);
523
767
  unsigned long long tableFlags() const { return m_table->file->ha_table_flags();}
524
768
  void seekKey(enum ha_rkey_function find_flag, key_part_map keyMap);
525
769
  void getNextSame(key_part_map keyMap);
@@ -553,16 +797,12 @@ public:
553
797
  inline void stepNextExt(IReadRecordsHandler* handler, bool includeCurrent,
554
798
  bool noBookmark)
555
799
  {
556
- if (m_table->file->inited != handler::RND)
557
- setNonKey(true);
558
800
  readRecords(handler, includeCurrent, READ_RECORD_STEPNEXT, noBookmark);
559
801
  }
560
802
 
561
803
  inline void stepPrevExt(IReadRecordsHandler* handler, bool includeCurrent,
562
804
  bool noBookmark)
563
805
  {
564
- if (m_table->file->inited != handler::RND)
565
- setNonKey(true);
566
806
  readRecords(handler, includeCurrent, READ_RECORD_STEPPREV, noBookmark);
567
807
  }
568
808
 
@@ -571,25 +811,24 @@ public:
571
811
  inline void clearKeybuf() { memset(&m_keybuf[0], 0x00, MAX_KEYLEN); }
572
812
 
573
813
  __int64 insert(bool ncc);
574
- void update(bool ncc);
575
- void updateDirectkey();
576
- void beginUpdate(char keyNum);
577
- void del();
578
- void beginDel();
579
-
814
+ double beginDel(int confrictCheck);
815
+ double beginUpdate(char keyNum, int confrictCheck);//return value of update_at
816
+ void update(bool ncc, double updateAtBefore);
817
+ void del(double updateAtBefore);
818
+ void setUpdateTimeValue(void* data);
580
819
  int keynumByName(const char* name) const;
581
820
 
582
821
  inline int stat() { return m_stat; }
822
+
583
823
  short setKeyValuesPacked(const uchar* ptr, int size);
584
824
  void* record() const;
585
-
586
825
  uint keyPackCopy(uchar* ptr);
587
-
588
- void setRecord(void* ptr, unsigned short size, int offset = 0);
826
+ void setRecord(void* ptr, unsigned short size, int offset = 0,
827
+ bzs::db::protocol::tdap::autoIncPackInfo* ai = NULL);
589
828
  void setRecordFromPacked(const uchar* packedPtr, uint size,
590
- const bzs::db::blobHeader* hd);
829
+ const bzs::db::blobHeader* hd,
830
+ bzs::db::protocol::tdap::autoIncPackInfo* ai);
591
831
  uint recordPackCopy(char* buf, uint maxsize = 0);
592
-
593
832
  ushort fieldPackCopy(unsigned char* nullPtr, int& nullbit, unsigned char* dest, short fieldNum);
594
833
 
595
834
  inline uint fieldSizeByte(int fieldNum)
@@ -695,16 +934,16 @@ public:
695
934
  return m_blobBuffer->fieldCount();
696
935
  }
697
936
 
698
- inline void indexInit()
937
+ /*inline void rebuiltInnodbPrebuilt()
699
938
  {
700
939
  int ret = m_table->file->ha_index_or_rnd_end();
701
940
  assert(ret == 0);
702
- if (m_keyNum >= 0)
703
- ret = m_table->file->ha_index_init(m_keyNum, true);
941
+ if (keyNum() >= 0)
942
+ ret = m_table->file->ha_index_init(keyNum(), true);
704
943
  else
705
944
  ret = m_table->file->ha_rnd_init(true);
706
945
  assert(ret == 0);
707
- }
946
+ }*/
708
947
 
709
948
  inline void setRowLock(rowLockMode* lck)
710
949
  {
@@ -754,12 +993,13 @@ public:
754
993
  m_validCursor = false;
755
994
  }
756
995
  }
996
+
757
997
  void setKeyValues(const std::vector<std::string>& values, int keypart,
758
998
  const std::string* inValue = NULL);
759
999
 
760
1000
  unsigned int writeDefaultImage(unsigned char* p, size_t size);
761
1001
 
762
- unsigned int writeSchemaImage(unsigned char* p, size_t size);
1002
+ unsigned int writeSchemaImage(unsigned char* p, size_t size, bool bin_str);
763
1003
 
764
1004
 
765
1005
  void restoreRecord() { restore_record(m_table, s->default_values);}
@@ -777,80 +1017,11 @@ public:
777
1017
  void getCreateSql(String* s);
778
1018
 
779
1019
  void setValue(int index, const std::string& v, int type);
780
- };
781
-
782
- class fieldBitmap
783
- {
784
- TABLE* m_table;
785
- bool m_keyRead;
786
-
787
- public:
788
- inline fieldBitmap(TABLE* table) : m_table(table), m_keyRead(false)
789
- {
790
- m_table->read_set = &m_table->tmp_set;
791
- m_table->write_set = &m_table->tmp_set;
792
- bitmap_clear_all(m_table->read_set);
793
- }
794
-
795
- inline fieldBitmap() : m_table(NULL), m_keyRead(false) {}
796
1020
 
797
- inline void setTable(table* tb)
798
- {
799
- if (tb)
800
- {
801
- m_table = tb->internalTable();
802
- m_table->read_set = &m_table->tmp_set;
803
- m_table->write_set = &m_table->tmp_set;
804
- bitmap_clear_all(m_table->read_set);
805
- }
806
- else if (m_table)
807
- {
808
- if (m_keyRead)
809
- m_table->file->extra(HA_EXTRA_NO_KEYREAD);
810
- m_table->read_set = &m_table->s->all_set;
811
- m_table->write_set = &m_table->s->all_set;
812
- m_table = NULL;
813
- }
814
- }
815
-
816
- inline ~fieldBitmap()
817
- {
818
- if (m_table)
819
- {
820
- if (m_keyRead)
821
- m_table->file->extra(HA_EXTRA_NO_KEYREAD);
822
- m_table->read_set = &m_table->s->all_set;
823
- m_table->write_set = &m_table->s->all_set;
824
- }
825
- }
826
-
827
- inline void setKeyRead(bool v)
828
- {
829
- assert(m_table);
830
- if (v)
831
- m_table->file->extra(HA_EXTRA_KEYREAD);
832
- else if (m_keyRead)
833
- m_table->file->extra(HA_EXTRA_NO_KEYREAD);
834
- m_keyRead = v;
835
- }
836
-
837
- inline void setReadBitmap(uint bit)
838
- {
839
- assert(m_table);
840
- bitmap_set_bit(m_table->read_set, bit);
841
- }
842
-
843
-
844
- inline MY_BITMAP* getReadBitmap()
845
- {
846
- if (m_table)
847
- return m_table->read_set;
848
- return NULL;
849
- }
1021
+ //void setInnodbFetchExtraCols(unsigned long v);
1022
+ };
850
1023
 
851
- inline bool isUsing() const { return (m_table != NULL); }
852
1024
 
853
- };
854
1025
 
855
1026
  // smart wrapper for exception
856
1027
  class smartBulkInsert
@@ -494,6 +494,8 @@ inline int cp_store_create_info(THD *thd, TABLE_LIST *table_list, String *packet
494
494
  extern MYSQL_PLUGIN_IMPORT my_bool opt_show_slave_auth_info;
495
495
 
496
496
  #define STATUS_VAR_SCOPE ,SHOW_SCOPE_GLOBAL
497
+ #define DSMRR_SIZE sizeof(DsMrr_impl)
498
+
497
499
  #else //Not MySQL 5.7
498
500
 
499
501
  #define OPEN_TABLE_FLAG_TYPE MYSQL_OPEN_GET_NEW_TABLE
@@ -636,6 +638,7 @@ inline int cp_store_create_info(THD *thd, TABLE_LIST *table_list, String *packet
636
638
  #endif // Not MARIADB_10_1 || MARIADB_10_0
637
639
 
638
640
  #define STATUS_VAR_SCOPE
641
+ #define DSMRR_SIZE 0
639
642
  #endif // Not MySQL 5.7
640
643
 
641
644
 
@@ -738,4 +741,38 @@ public:
738
741
  }
739
742
  };
740
743
 
744
+
745
+ struct innodb_prebuit
746
+ {
747
+ ulong magic_n;
748
+ void* table;
749
+ void* index;
750
+ void* trx;
751
+ //unsigned int dummy; // Bit flags
752
+
753
+ unsigned sql_stat_start:1;
754
+ #ifndef MYSQL_5_7
755
+ unsigned mysql_has_locked:1;
756
+ #endif
757
+ unsigned clust_index_was_generated:1;
758
+ unsigned index_usable:1;
759
+ unsigned read_just_key:1;
760
+ unsigned used_in_HANDLER:1;
761
+ unsigned template_type:2;
762
+
763
+ void* dummy2; //mysql_row_templ_t* mysql_template
764
+ void* dummy3; //mem_heap_t* heap;
765
+ void* dummy4; //ins_node_t* ins_node;
766
+ void* dummy5; //byte* ins_upd_rec_buff
767
+ void* dummy6; //const byte* default_rec;
768
+ unsigned long hint_need_to_fetch_extra_cols;
769
+ };
770
+
771
+ /* Values for hint_need_to_fetch_extra_cols */
772
+ #define ROW_RETRIEVE_DEFAULT 0
773
+ #define ROW_RETRIEVE_PRIMARY_KEY 1
774
+ #define ROW_RETRIEVE_ALL_COLS 2
775
+
776
+ #define ROW_PREBUILT_ALLOCATED 78540783
777
+
741
778
  #endif // BZS_DB_ENGINE_MYSQL_MYSQLINTERNAL_H
@@ -609,6 +609,7 @@ inline void appenDbList(connection::records& recs, LEX_STRING* db_name)
609
609
  connection::record& rec = recs[recs.size() - 1];
610
610
  strncpy(rec.name, db_name->str, 64);
611
611
  rec.name[64] = 0x00;
612
+ rec.type = 1;
612
613
  }
613
614
 
614
615
  void readDbList(THD* thd, connection::records& recs)
@@ -140,16 +140,16 @@ void writeStatus(int stat, resultBuffer& buf, int option)
140
140
 
141
141
  int update(request& req, engine::mysql::table* tb, int type)
142
142
  {
143
- tb->beginUpdate(tb->keyNum());
143
+ tb->beginUpdate(tb->keyNum(), false);
144
144
  tb->setUseValues(req.table.values, type);
145
- tb->update(true);
145
+ tb->update(true, 0);
146
146
  return tb->stat();
147
147
  }
148
148
 
149
149
  int del(request& req, engine::mysql::table* tb, int type)
150
150
  {
151
- tb->beginDel();
152
- tb->del();
151
+ tb->beginDel(false);
152
+ tb->del(0);
153
153
  return tb->stat();
154
154
  }
155
155
 
@@ -105,7 +105,7 @@ public:
105
105
 
106
106
  ~activeTable();
107
107
 
108
- activeTable& alias(const _TCHAR* src, const _TCHAR* dst);
108
+ activeTable& alias(const _TCHAR* orign, const _TCHAR* alias);
109
109
 
110
110
  activeTable& resetAlias();
111
111
 
@@ -242,6 +242,7 @@ class activeTableImple : public activeObject<map_orm>
242
242
  {
243
243
  // if target field type is different then we need convrt type
244
244
  const fielddef& f = td->fieldDefs[kd->segments[i].fieldNum];
245
+ memset(buf_ptr, 0, MAX_KEYLEN);
245
246
  field fd(buf_ptr - f.pos, f, fds);
246
247
  len[i] = f.isStringType() ? 0xff : f.len;
247
248
  if (mdl[fieldIndexes[i]].isNull())
@@ -52,7 +52,7 @@ static const _TCHAR* SYSVAR_NAME[TD_VAR_SIZE] =
52
52
  _T("hs_port"),
53
53
  _T("use_handlersocket"),
54
54
  _T("timestamp_always"),
55
- _T("startup_ha")
55
+ _T("startup_ha"),
56
56
  };
57
57
 
58
58
  static const _TCHAR* STATUSVAR_NAME[TD_SVAR_SIZE] =
@@ -224,7 +224,7 @@ void database::create(const _TCHAR* uri, short type)
224
224
  short stat;
225
225
  if (!m_impl->dbDef)
226
226
  {
227
- m_impl->dbDef = new dbdef(this, type); // Create TabelDef here.
227
+ m_impl->dbDef = new dbdef(this, type, 0); // Create TabelDef here.
228
228
  dbdefCreated = true;
229
229
  }
230
230
  bool isTransactd = isTransactdUri(uri);
@@ -321,7 +321,8 @@ void database::drop(const _TCHAR* uri)
321
321
 
322
322
  fileNames[count++] = s;
323
323
  BTRCALLID_PTR ptr = m_btrcallid;
324
- m_btrcallid = NULL;
324
+ if (isUseTransactd())
325
+ m_btrcallid = NULL;
325
326
  close();
326
327
  m_btrcallid = ptr;
327
328
  for (int i = 0; i < count; i++)
@@ -399,7 +400,7 @@ database& database::operator=(const database& rt)
399
400
  database* database::clone()
400
401
  {
401
402
  if (!m_impl->dbDef)
402
- m_impl->dbDef = new dbdef(this, TYPE_SCHEMA_BDF);
403
+ m_impl->dbDef = new dbdef(this, TYPE_SCHEMA_BDF, 0);
403
404
  database* p = new database();
404
405
  *p = *this;
405
406
  return p;
@@ -492,7 +493,7 @@ bool database::open(const _TCHAR* _uri, short type, short mode,
492
493
  }
493
494
  }
494
495
  if (!m_impl->dbDef)
495
- m_impl->dbDef = new dbdef(this, type);
496
+ m_impl->dbDef = new dbdef(this, type, mode);
496
497
 
497
498
  if (m_impl->noPreloadSchema)
498
499
  {
@@ -775,6 +776,8 @@ struct openTablePrams
775
776
  mode += TD_OPEN_MASK_GETSHCHEMA;
776
777
  getSchema = true;
777
778
  autoCreate = false;
779
+ if (database::compatibleMode() & database::CMP_MODE_BINFD_DEFAULT_STR)
780
+ mode += TD_OPEN_MASK_BIN_STR;
778
781
  }
779
782
  }
780
783
  if (readOnly && !IS_MODE_READONLY(mode))
@@ -145,10 +145,15 @@ public:
145
145
  static void destroy(database* db);
146
146
  static void setCompatibleMode(int mode);
147
147
  static int compatibleMode();
148
- static const int CMP_MODE_MYSQL_NULL = 1; //default
149
148
  static const int CMP_MODE_OLD_NULL = 0;
149
+ static const int CMP_MODE_MYSQL_NULL = 1; //default
150
+ static const int CMP_MODE_BINFD_DEFAULT_STR = 2;
151
+ static const int CMP_MODE_OLD_ALL = 2;
152
+ static const int CMP_MODE_OLD_BIN = 3;
150
153
  };
151
154
 
155
+
156
+
152
157
  class overrideCompatibleMode
153
158
  {
154
159
  int mode;