transactd 2.4.0 → 2.4.2

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 (61) hide show
  1. checksums.yaml +4 -4
  2. data/BUILD_UNIX-JA.md +37 -29
  3. data/BUILD_WIN-JA.md +96 -69
  4. data/CMakeLists.txt +7 -17
  5. data/README-JA.md +22 -17
  6. data/README.md +23 -16
  7. data/{RELEASE_NOTE-JA → RELEASE_NOTE-JA.md} +163 -98
  8. data/{RELEASE_NOTE → RELEASE_NOTE.md} +165 -99
  9. data/bin/common/tdclc_32_2_4.dll +0 -0
  10. data/bin/common/tdclc_64_2_4.dll +0 -0
  11. data/build/common/get_boost_libs.cmake +2 -0
  12. data/build/common/system.cmake +6 -4
  13. data/build/common/transactd_cl_output.cmake +14 -2
  14. data/build/common/transactd_common.cmake +34 -12
  15. data/build/tdclc/CMakeLists.txt +10 -2
  16. data/build/tdclc/tdclc.rc +4 -4
  17. data/build/tdclcpp/CMakeLists.txt +34 -9
  18. data/build/tdclcpp/tdclcpp.rc +4 -4
  19. data/build/tdclrb/CMakeLists.txt +24 -15
  20. data/build/tdclrb/gem/Makefile.win32-VS +2 -2
  21. data/build/tdclrb/gem_output.cmake +27 -10
  22. data/build/tdclrb/tdclrb.rc +4 -4
  23. data/source/bzs/db/engine/mysql/database.cpp +18 -18
  24. data/source/bzs/db/engine/mysql/database.h +4 -4
  25. data/source/bzs/db/engine/mysql/dbManager.cpp +1 -2
  26. data/source/bzs/db/engine/mysql/mysqlInternal.h +23 -2
  27. data/source/bzs/db/engine/mysql/mysqlThd.cpp +3 -2
  28. data/source/bzs/db/protocol/tdap/client/activeTableImple.h +26 -12
  29. data/source/bzs/db/protocol/tdap/client/dbDef.cpp +3 -3
  30. data/source/bzs/db/protocol/tdap/client/field.cpp +74 -23
  31. data/source/bzs/db/protocol/tdap/client/field.h +3 -1
  32. data/source/bzs/db/protocol/tdap/client/filter.h +4 -4
  33. data/source/bzs/db/protocol/tdap/client/groupQuery.cpp +3 -1
  34. data/source/bzs/db/protocol/tdap/client/memRecord.cpp +16 -9
  35. data/source/bzs/db/protocol/tdap/client/memRecord.h +2 -2
  36. data/source/bzs/db/protocol/tdap/client/nsDatabase.cpp +1 -1
  37. data/source/bzs/db/protocol/tdap/client/recordsetImple.h +3 -2
  38. data/source/bzs/db/protocol/tdap/client/serializer.cpp +12 -0
  39. data/source/bzs/db/protocol/tdap/client/serializer.h +1 -0
  40. data/source/bzs/db/protocol/tdap/client/table.cpp +60 -109
  41. data/source/bzs/db/protocol/tdap/client/table.h +2 -1
  42. data/source/bzs/db/protocol/tdap/client/trdboostapi.h +13 -0
  43. data/source/bzs/db/protocol/tdap/client/trdboostapiInternal.h +1 -1
  44. data/source/bzs/db/protocol/tdap/client/trdormapi.h +8 -8
  45. data/source/bzs/db/protocol/tdap/fieldComp.h +6 -0
  46. data/source/bzs/db/protocol/tdap/mysql/recordsetReader.h +147 -46
  47. data/source/bzs/db/protocol/tdap/tdapSchema.cpp +78 -0
  48. data/source/bzs/db/protocol/tdap/tdapSchema.h +6 -1
  49. data/source/bzs/db/protocol/tdap/tdapcapi.h +3 -3
  50. data/source/bzs/db/transactd/transactd.cpp +1 -1
  51. data/source/bzs/env/compiler.h +12 -0
  52. data/source/bzs/env/tcharMinGW.h +1 -0
  53. data/source/bzs/netsvc/client/tcpClient.h +4 -2
  54. data/source/bzs/netsvc/server/serverCpt.cpp +1 -0
  55. data/source/bzs/netsvc/server/serverTpool.cpp +3 -0
  56. data/source/bzs/test/tdclphp/transactd_Test.php +2 -2
  57. data/source/bzs/test/tdclphp/transactd_pool_Test.php +6 -0
  58. data/source/bzs/test/trdclengn/test_trdclengn.cpp +2 -2
  59. data/source/global/ormsrcgen/srcgen.cpp +1 -2
  60. data/source/linux/tchar.h +1 -0
  61. metadata +4 -4
@@ -29,8 +29,8 @@
29
29
  //
30
30
 
31
31
  VS_VERSION_INFO VERSIONINFO
32
- FILEVERSION 2,4,0,66
33
- PRODUCTVERSION 2,4,0,66
32
+ FILEVERSION 2,4,2,91
33
+ PRODUCTVERSION 2,4,2,91
34
34
  FILEFLAGSMASK 0x3fL
35
35
  #ifdef _DEBUG
36
36
  FILEFLAGS 0x1L
@@ -47,9 +47,9 @@ BEGIN
47
47
  BEGIN
48
48
  VALUE "CompanyName", "BizStation Corp."
49
49
  VALUE "FileDescription", "Transactd C++ client"
50
- VALUE "FileVersion", "2.4.0.66"
50
+ VALUE "FileVersion", "2.4.2.91"
51
51
  VALUE "LegalCopyright", "Copyright(C) 2014 BizStation Corp"
52
- VALUE "ProductVersion", "2.4.0.66"
52
+ VALUE "ProductVersion", "2.4.2.91"
53
53
  VALUE "ProductName", "Transactd Client (GPL V2)"
54
54
  END
55
55
  END
@@ -66,6 +66,15 @@ if("${TRANSACTD_RUBY_GEM_ROOT_PATH}" STREQUAL "")
66
66
  set(TRANSACTD_RUBY_GEM_ROOT_PATH "${TRANSACTD_BINARY_ROOT}")
67
67
  endif()
68
68
 
69
+ # ==========================================================
70
+ # add library path
71
+ # ==========================================================
72
+ if(WIN32)
73
+ link_directories("${TRANSACTD_RUBY_GEM_ROOT_PATH}/bin/common")
74
+ else()
75
+ link_directories("../tdclcpp")
76
+ endif()
77
+
69
78
 
70
79
  # ==========================================================
71
80
  # add swig wrapper source file
@@ -104,6 +113,16 @@ endif()
104
113
  # ==========================================================
105
114
  add_library(${this_target} SHARED ${${this_target}_SOURCE_FILES})
106
115
 
116
+ # ==========================================================
117
+ # add dependencie projects
118
+ # ==========================================================
119
+ if(WIN32)
120
+ if(MSVC)
121
+ add_dependencies(${this_target} tdclcpp)
122
+ endif()
123
+ else()
124
+ add_dependencies(${this_target} tdclc tdclcpp)
125
+ endif()
107
126
 
108
127
  # ==========================================================
109
128
  # Add compile options
@@ -127,7 +146,7 @@ endif()
127
146
  if(MSVC)
128
147
  set_property(TARGET ${this_target} APPEND PROPERTY COMPILE_DEFINITIONS
129
148
  WIN32 _WIN32 _WINDOWS _USRDLL BOOST_ALL_NO_LIB
130
- LIB_TDCLCPP TRDCL_AUTOLINK_OFF TRDCLENGN_EXPORTS _CRT_SECURE_NO_WARNINGS)
149
+ LIB_TDCLCPP TRDCL_AUTOLINK TRDCLENGN_EXPORTS _CRT_SECURE_NO_WARNINGS)
131
150
  else()
132
151
  set_property(TARGET ${this_target} APPEND PROPERTY COMPILE_DEFINITIONS
133
152
  PIC _REENTRANT BOOST_ALL_NO_LIB)
@@ -145,20 +164,10 @@ endif()
145
164
  # add link / include
146
165
  # ==========================================================
147
166
  target_link_libraries(${this_target} "${TRANSACTD_RUBY_LIBRARY_PATH}")
148
- if(WIN32 AND (NOT MSVC))
149
- transactd_link_boost_libraries("timer;filesystem;thread;chrono;system")
150
- else()
151
- transactd_link_boost_libraries("timer")
152
- if(MSVC)
153
- target_link_libraries(${this_target} "tdclcppmr")
154
- else()
155
- if(NOT TRANSACTD_WITHOUT_C_CPP_CLIENTS)
156
- target_link_libraries(${this_target} "tdclcppm")
157
- else()
158
- transactd_link_boost_libraries("timer;filesystem;thread;chrono;system")
159
- target_link_libraries(${this_target} "tdclcpp_64m")
160
- endif()
161
- endif()
167
+ transactd_link_boost_libraries("timer;filesystem;thread;chrono;system")
168
+ #tdclcpp_x on windows is auto link
169
+ if(NOT WIN32)
170
+ target_link_libraries(${this_target} "tdclcpp_64m")
162
171
  endif()
163
172
 
164
173
 
@@ -26,8 +26,8 @@ set INSMSG=..\..\..\install.log
26
26
  set ERRMSG=errormsg.log
27
27
 
28
28
  @REM BUILD
29
- echo BUILD tdcl.sln %date% %time% >> "%BLDMSG%"
30
- msbuild tdcl.sln /p:Configuration=Release /m:2 >> "%BLDMSG%" 2>&1
29
+ echo BUILD TransactdRubyClient.sln %date% %time% >> "%BLDMSG%"
30
+ msbuild TransactdRubyClient.sln /p:Configuration=Release /m:2 >> "%BLDMSG%" 2>&1
31
31
  if ERRORLEVEL 1 (
32
32
  echo ************************************************************** 1>&2
33
33
  echo EROOR MESSAGE 1>&2
@@ -23,24 +23,41 @@ include(../common/smart_install.cmake)
23
23
  # ==========================================================
24
24
  if(NOT COMMAND tdcl_set_output)
25
25
  macro(tdcl_set_output TRANSACTD_BINARY_ROOT prefix)
26
- ## install tdclcppmr
26
+ if("${TRANSACTD_RUBY_GEM_ROOT_PATH}" STREQUAL "")
27
+ set(TRANSACTD_RUBY_GEM_ROOT_PATH "${TRANSACTD_BINARY_ROOT}")
28
+ endif()
29
+ ## install tdclcpp
27
30
  if((NOT WIN32) OR MSVC)
28
- install(TARGETS tdclcppmr
29
- LIBRARY DESTINATION "${TRANSACTD_RUBY_GEM_ROOT_PATH}/bin/common"
30
- RUNTIME DESTINATION "${TRANSACTD_RUBY_GEM_ROOT_PATH}/bin/common"
31
- ARCHIVE DESTINATION "${TRANSACTD_RUBY_GEM_ROOT_PATH}/bin/common"
32
- )
31
+ foreach(tmp_build_type "_RELEASE" "_DEBUG" "_RELWITHDEBINFO" "_MINSIZEREL")
32
+ set_target_properties(tdclcpp PROPERTIES
33
+ RUNTIME_OUTPUT_DIRECTORY${tmp_build_type} "${TRANSACTD_RUBY_GEM_ROOT_PATH}/bin/common"
34
+ LIBRARY_OUTPUT_DIRECTORY${tmp_build_type} "${TRANSACTD_RUBY_GEM_ROOT_PATH}/bin/common"
35
+ ARCHIVE_OUTPUT_DIRECTORY${tmp_build_type} "${TRANSACTD_RUBY_GEM_ROOT_PATH}/bin/common")
36
+ endforeach()
33
37
  ## install to system dir (copy file if greater)
34
38
  if(WIN32)
35
- get_target_property(tmp_var "tdclcppmr" LOCATION)
36
- get_filename_component(tmp_var "${tmp_var}" NAME)
39
+ set(tmp_target_name "")
40
+ if(TARGET "tdclcpp")
41
+ set(tmp_target_name "tdclcpp")
42
+ elseif(TARGET "tdclcppmr")
43
+ set(tmp_target_name "tdclcppmr")
44
+ elseif(TARGET "tdclcppm")
45
+ set(tmp_target_name "tdclcppm")
46
+ endif()
47
+ if (NOT "${tmp_target_name}" STREQUAL "")
48
+ string(TOUPPER "OUTPUT_NAME_${CMAKE_BUILD_TYPE}" tmp_var)
49
+ get_target_property(tmp_var "${tmp_target_name}" "${tmp_var}")
50
+ set(tmp_var "${tmp_var}.dll")
51
+ else()
52
+ set(tmp_var "tdclcpp_vc100_*.dll")
53
+ endif()
37
54
  file(TO_CMAKE_PATH "${TRANSACTD_RUBY_GEM_ROOT_PATH}/bin/common/${tmp_var}" tmp_var)
38
55
  bz_smart_install(SOURCES "${tmp_var}" TO_WIN_SYSTEMDIR)
39
56
  else()
40
57
  if("${prefix}" STREQUAL "")
41
- install(TARGETS tdclcppmr LIBRARY DESTINATION /usr/lib)
58
+ install(TARGETS tdclcpp LIBRARY DESTINATION /usr/lib)
42
59
  else()
43
- install(TARGETS tdclcppmr LIBRARY DESTINATION "${prefix}")
60
+ install(TARGETS tdclcpp LIBRARY DESTINATION "${prefix}")
44
61
  endif()
45
62
  endif()
46
63
  endif()
@@ -29,8 +29,8 @@
29
29
  //
30
30
 
31
31
  VS_VERSION_INFO VERSIONINFO
32
- FILEVERSION 2,4,0,66
33
- PRODUCTVERSION 2,4,0,66
32
+ FILEVERSION 2,4,2,91
33
+ PRODUCTVERSION 2,4,2,91
34
34
  FILEFLAGSMASK 0x3fL
35
35
  #ifdef _DEBUG
36
36
  FILEFLAGS 0x1L
@@ -47,9 +47,9 @@ BEGIN
47
47
  BEGIN
48
48
  VALUE "CompanyName", "BizStation Corp."
49
49
  VALUE "FileDescription", "Transactd Ruby client"
50
- VALUE "FileVersion", "2.4.0.66"
50
+ VALUE "FileVersion", "2.4.2.91"
51
51
  VALUE "LegalCopyright", "Copyright(C) 2014 BizStation Corp"
52
- VALUE "ProductVersion", "2.4.0.66"
52
+ VALUE "ProductVersion", "2.4.2.91"
53
53
  VALUE "ProductName", "Transactd Client (GPL V2)"
54
54
  END
55
55
  END
@@ -1077,7 +1077,7 @@ void table::fillNull(uchar* ptr, int size)
1077
1077
 
1078
1078
  void table::setKeyValues(const uchar* ptr, int size)
1079
1079
  {
1080
- KEY& key = m_table->key_info[m_keyNum];
1080
+ KEY& key = m_table->key_info[(int)m_keyNum];
1081
1081
  memcpy(&m_keybuf[0], ptr, std::min(MAX_KEYLEN, size));
1082
1082
  int pos = 0;
1083
1083
  for (int j = 0; j < (int)key.user_defined_key_parts; j++)
@@ -1107,7 +1107,7 @@ void table::setKeyValues(const uchar* ptr, int size)
1107
1107
  */
1108
1108
  short table::setKeyValuesPacked(const uchar* ptr, int size)
1109
1109
  {
1110
- KEY& key = m_table->key_info[m_keyNum];
1110
+ KEY& key = m_table->key_info[(int)m_keyNum];
1111
1111
  int to = 0;
1112
1112
  const uchar* from = ptr;
1113
1113
  int ret = -1;
@@ -1166,7 +1166,7 @@ uint table::keyPackCopy(uchar* ptr)
1166
1166
  if (m_keyNum < 0)
1167
1167
  return 0;
1168
1168
 
1169
- KEY& key = m_table->key_info[m_keyNum];
1169
+ KEY& key = m_table->key_info[(int)m_keyNum];
1170
1170
  if ((key.flags & HA_NULL_PART_KEY) || (key.flags & HA_VAR_LENGTH_KEY))
1171
1171
  {
1172
1172
  int from = 0;
@@ -1488,7 +1488,7 @@ void table::seekKey(enum ha_rkey_function find_flag, key_part_map keyMap)
1488
1488
  {
1489
1489
  if (find_flag != HA_READ_KEY_EXACT)
1490
1490
  key_copy(&m_keybuf[0], m_table->record[0],
1491
- &m_table->key_info[m_keyNum], KEYLEN_ALLCOPY);
1491
+ &m_table->key_info[(int)m_keyNum], KEYLEN_ALLCOPY);
1492
1492
  }
1493
1493
  }
1494
1494
  else
@@ -1508,7 +1508,7 @@ void table::moveKey(boost::function<int()> func)
1508
1508
  setCursorStaus();
1509
1509
  if (m_stat == 0)
1510
1510
  key_copy(&m_keybuf[0], m_table->record[0],
1511
- &m_table->key_info[m_keyNum], KEYLEN_ALLCOPY);
1511
+ &m_table->key_info[(int)m_keyNum], KEYLEN_ALLCOPY);
1512
1512
  }
1513
1513
  else
1514
1514
  m_stat = STATUS_INVALID_KEYNUM;
@@ -1528,7 +1528,7 @@ void table::getNextSame(key_part_map keyMap)
1528
1528
  if (m_stat == 0)
1529
1529
  {
1530
1530
  key_copy(&m_keybuf[0], m_table->record[0],
1531
- &m_table->key_info[m_keyNum], KEYLEN_ALLCOPY);
1531
+ &m_table->key_info[(int)m_keyNum], KEYLEN_ALLCOPY);
1532
1532
  }
1533
1533
  }
1534
1534
  else
@@ -1603,7 +1603,7 @@ bool table::keyCheckForPercent()
1603
1603
  if (m_keyNum == -1)
1604
1604
  m_keyNum = m_table->s->primary_key;
1605
1605
  // The value of the beginning of a key
1606
- KEY& key = m_table->key_info[m_keyNum];
1606
+ KEY& key = m_table->key_info[(int)m_keyNum];
1607
1607
  if (key.key_length > 128)
1608
1608
  return false;
1609
1609
  return true;
@@ -1611,7 +1611,7 @@ bool table::keyCheckForPercent()
1611
1611
 
1612
1612
  void table::preBuildPercent(uchar* first, uchar* last)
1613
1613
  {
1614
- KEY& key = m_table->key_info[m_keyNum];
1614
+ KEY& key = m_table->key_info[(int)m_keyNum];
1615
1615
  getFirst();
1616
1616
  if (m_stat == 0)
1617
1617
  {
@@ -1661,7 +1661,7 @@ void table::getByPercentage(unsigned short per)
1661
1661
  uchar* st = keybufFirst;
1662
1662
  uchar* en = keybufLast;
1663
1663
  uchar* cu = (uchar*)keybuf();
1664
- KEY& key = m_table->key_info[m_keyNum];
1664
+ KEY& key = m_table->key_info[(int)m_keyNum];
1665
1665
  uint keylen = key.key_length + 10;
1666
1666
  boost::shared_array<uchar> stbuf(new uchar[keylen]);
1667
1667
  boost::shared_array<uchar> lsbuf(new uchar[keylen]);
@@ -1749,7 +1749,7 @@ void table::getByPercentage(unsigned short per)
1749
1749
 
1750
1750
  int table::percentage(uchar* first, uchar* last, uchar* cur)
1751
1751
  {
1752
- KEY& key = m_table->key_info[m_keyNum];
1752
+ KEY& key = m_table->key_info[(int)m_keyNum];
1753
1753
  // 1 cur to last
1754
1754
  key_range minkey;
1755
1755
  minkey.key = cur;
@@ -1786,7 +1786,7 @@ void table::calcPercentage()
1786
1786
  m_percentResult = 0;
1787
1787
  // The present key value is copied.
1788
1788
  uchar keybufCur[MAX_KEYLEN] = { 0x00 };
1789
- key_copy(keybufCur, m_table->record[0], &m_table->key_info[m_keyNum],
1789
+ key_copy(keybufCur, m_table->record[0], &m_table->key_info[(int)m_keyNum],
1790
1790
  KEYLEN_ALLCOPY);
1791
1791
 
1792
1792
  uchar keybufFirst[MAX_KEYLEN] = { 0x00 };
@@ -1982,7 +1982,7 @@ void table::movePos(const uchar* pos, char keyNum, bool sureRawValue)
1982
1982
  if (m_keyNum != keyNum)
1983
1983
  { // need key change
1984
1984
  key_copy(&m_keybuf[0], m_table->record[0],
1985
- &m_table->key_info[keyNum], KEYLEN_ALLCOPY);
1985
+ &m_table->key_info[(int)keyNum], KEYLEN_ALLCOPY);
1986
1986
  // It seek(s) until ref becomes the same, since it is a duplication
1987
1987
  // key.
1988
1988
  setKeyNum(keyNum);
@@ -2086,7 +2086,7 @@ bool table::isNisKey(char num) const
2086
2086
  {
2087
2087
  if ((num >= 0) && (num < (short)m_table->s->keys))
2088
2088
  {
2089
- Field* fd = m_table->key_info[num].key_part[0].field;
2089
+ Field* fd = m_table->key_info[(int)num].key_part[0].field;
2090
2090
  if (fd->null_bit)
2091
2091
  return true;
2092
2092
  }
@@ -2195,7 +2195,7 @@ __int64 table::insert(bool ncc)
2195
2195
  m_nonNcc = !ncc;
2196
2196
  if (!ncc && !m_bulkInserting)
2197
2197
  key_copy(&m_keybuf[0], m_table->record[0],
2198
- &m_table->key_info[m_keyNum], KEYLEN_ALLCOPY);
2198
+ &m_table->key_info[(int)m_keyNum], KEYLEN_ALLCOPY);
2199
2199
 
2200
2200
  /* Do not change to m_changed = false */
2201
2201
  m_changed = true;
@@ -2282,7 +2282,7 @@ void table::update(bool ncc)
2282
2282
  // Only when the present key value is changed
2283
2283
  if (m_keyNum >= 0)
2284
2284
  {
2285
- const KEY& key = m_table->key_info[m_keyNum];
2285
+ const KEY& key = m_table->key_info[(int)m_keyNum];
2286
2286
  key_copy(&m_keybuf[0], m_table->record[0], (KEY*)&key,
2287
2287
  KEYLEN_ALLCOPY);
2288
2288
 
@@ -2354,7 +2354,7 @@ const char* table::keyName(char keyNum)
2354
2354
  {
2355
2355
  if ((keyNum >= 0) && (keyNum < (short)m_table->s->keys))
2356
2356
  {
2357
- KEY& key = m_table->key_info[keyNum];
2357
+ KEY& key = m_table->key_info[(int)keyNum];
2358
2358
  return key.name;
2359
2359
  }
2360
2360
  return "";
@@ -2387,7 +2387,7 @@ void table::endBulkInsert()
2387
2387
  {
2388
2388
  if (m_bulkInserting)
2389
2389
  {
2390
- key_copy(&m_keybuf[0], m_table->record[0], &m_table->key_info[m_keyNum],
2390
+ key_copy(&m_keybuf[0], m_table->record[0], &m_table->key_info[(int)m_keyNum],
2391
2391
  KEYLEN_ALLCOPY);
2392
2392
  m_bulkInserting = false;
2393
2393
  m_table->file->ha_release_auto_increment();
@@ -2441,7 +2441,7 @@ inline void setSegmentValue(const KEY_PART_INFO& segment, const std::string& v)
2441
2441
  void table::setKeyValues(const std::vector<std::string>& values, int keypart,
2442
2442
  const std::string* inValue)
2443
2443
  {
2444
- KEY& key = m_table->key_info[m_keyNum];
2444
+ KEY& key = m_table->key_info[(int)m_keyNum];
2445
2445
  for (int i = 0; i < (int)key.user_defined_key_parts; i++)
2446
2446
  if (i < (int)values.size())
2447
2447
  setSegmentValue(key.key_part[i], values[i]);
@@ -311,7 +311,7 @@ class table : private boost::noncopyable
311
311
 
312
312
  inline uint keylen() const
313
313
  {
314
- return m_table->key_info[m_keyNum].key_length;
314
+ return m_table->key_info[(int)m_keyNum].key_length;
315
315
  }
316
316
  void setKeyValues(const uchar* ptr, int size);
317
317
  void setBlobFieldPointer(const bzs::db::blobHeader* hd);
@@ -446,7 +446,7 @@ public:
446
446
 
447
447
  inline bool isUniqueKey()
448
448
  {
449
- return (m_table->key_info[m_keyNum].flags & HA_NOSAME);
449
+ return (m_table->key_info[(int)m_keyNum].flags & HA_NOSAME);
450
450
  }
451
451
 
452
452
  /*
@@ -475,7 +475,7 @@ public:
475
475
 
476
476
  inline key_part_map keymap()
477
477
  {
478
- return (1U << m_table->key_info[m_keyNum].user_defined_key_parts) - 1;
478
+ return (1U << m_table->key_info[(int)m_keyNum].user_defined_key_parts) - 1;
479
479
  }
480
480
  unsigned long long tableFlags() const { return m_table->file->ha_table_flags();}
481
481
  void seekKey(enum ha_rkey_function find_flag, key_part_map keyMap);
@@ -604,7 +604,7 @@ public:
604
604
 
605
605
  inline const KEY& keyDef(char keyNum) const
606
606
  {
607
- return m_table->key_info[keyNum];
607
+ return m_table->key_info[(int)keyNum];
608
608
  }
609
609
 
610
610
  inline const KEY* primaryKey() const
@@ -224,8 +224,7 @@ int dbManager::ddl_execSql(THD* thd, const std::string& sql_stmt)
224
224
  smartDbsReopen reopen(thd, m_dbs);
225
225
 
226
226
  thd->clear_error();
227
- int result = dispatch_command(COM_QUERY, thd, (char*)sql_stmt.c_str(),
228
- (uint)sql_stmt.size());
227
+ int result = cp_query_command(thd, (char*)sql_stmt.c_str());
229
228
  //if (!thd->cp_isOk())
230
229
  // result = 1;
231
230
  if (thd->is_error())
@@ -65,6 +65,7 @@ extern "C" {
65
65
  extern void * my_malloc(PSI_memory_key key, size_t size, myf_t flags);
66
66
  extern void * my_realloc(PSI_memory_key key, void *ptr, size_t size, myf_t flags);
67
67
  extern void my_free(void *ptr);
68
+ extern void my_claim(void *ptr);
68
69
  extern void * my_memdup(PSI_memory_key key, const void *from, size_t length, myf_t flags);
69
70
  extern char * my_strdup(PSI_memory_key key, const char *from, myf_t flags);
70
71
  extern char * my_strndup(PSI_memory_key key, const char *from, size_t length, myf_t flags);
@@ -170,9 +171,12 @@ extern "C" {
170
171
  # endif
171
172
  #endif // MySQL 5.5 Only
172
173
 
173
- #if ((MYSQL_VERSION_NUM > 50600) && (MYSQL_VERSION_NUM < 50700)) // MySQL 5.6 Only
174
+ #if ((MYSQL_VERSION_NUM > 50600) && (MYSQL_VERSION_NUM < 1000000)) // MySQL 5.6.25 or later
174
175
  # if (MYSQL_VERSION_NUM >= 50625)
175
176
  # define FINDFILE_6PRAMS
177
+ # if (MYSQL_VERSION_NUM >= 50708)
178
+ # define MYSQL_578_LATER
179
+ # endif
176
180
  # endif
177
181
  #endif
178
182
 
@@ -363,6 +367,15 @@ inline void cp_open_error_release(THD* /*thd*/, TABLE_LIST& /*tables*/)
363
367
  ;
364
368
  }
365
369
 
370
+ inline bool cp_query_command(THD* thd, char* str)
371
+ {
372
+ COM_DATA com_data;
373
+ com_data.com_query.query = (char*)str;
374
+ com_data.com_query.length = (uint)strlen(str);
375
+ return dispatch_command(thd, &com_data, COM_QUERY);
376
+ }
377
+
378
+
366
379
  #else //Not MySQL 5.7
367
380
  #define OPEN_TABLE_FLAG_TYPE MYSQL_OPEN_GET_NEW_TABLE
368
381
 
@@ -461,6 +474,10 @@ inline void cp_open_error_release(THD* thd, TABLE_LIST& tables)
461
474
 
462
475
  }
463
476
 
477
+ inline bool cp_query_command(THD* thd, char* str)
478
+ {
479
+ return dispatch_command(COM_QUERY, thd, str, (uint)strlen(str));
480
+ }
464
481
 
465
482
  #endif
466
483
 
@@ -490,7 +507,11 @@ inline void cp_open_error_release(THD* thd, TABLE_LIST& tables)
490
507
  {
491
508
  #ifdef FINDFILE_6PRAMS
492
509
  MEM_ROOT tmp_mem_root;
493
- init_sql_alloc(&tmp_mem_root, TABLE_ALLOC_BLOCK_SIZE, 0);
510
+ # ifdef MYSQL_578_LATER
511
+ init_sql_alloc(key_memory_get_all_tables, &tmp_mem_root, TABLE_ALLOC_BLOCK_SIZE, 0);
512
+ # else
513
+ init_sql_alloc(&tmp_mem_root, TABLE_ALLOC_BLOCK_SIZE, 0);
514
+ # endif
494
515
  return find_files(thd, files, NullS, mysql_data_home, "", true, &tmp_mem_root);
495
516
  #else
496
517
  return find_files(thd, files, NullS, mysql_data_home, "", true);
@@ -139,9 +139,10 @@ THD* buildTHD()
139
139
  assert(thd->mysys_var);
140
140
  cp_set_mysys_var(thd->mysys_var);
141
141
  thd->system_thread = NON_SYSTEM_THREAD;
142
+ #ifndef MYSQL_578_LATER
142
143
  const NET v = { 0 };
143
144
  thd->net = v;
144
-
145
+ #endif
145
146
  thd->variables.option_bits |= OPTION_BIN_LOG;
146
147
  thd->variables.tx_isolation = (ulong)getTransactdIsolation();
147
148
 
@@ -149,7 +150,7 @@ THD* buildTHD()
149
150
  char tmp[256];
150
151
  sprintf_s(tmp, 256, "set innodb_lock_wait_timeout=%d;",
151
152
  g_lock_wait_timeout);
152
- dispatch_command(COM_QUERY, thd, tmp, (uint)strlen(tmp));
153
+ cp_query_command(thd, tmp);
153
154
 
154
155
 
155
156
  cp_set_db(thd, td_strdup("bizstation", MYF(0)));
@@ -140,7 +140,7 @@ class activeTableImple : public activeObject<map_orm>
140
140
  joinFields.resize(fnsCount);
141
141
  fieldIndexes.resize(fnsCount);
142
142
  const tabledef* td = table()->tableDef();
143
- const keydef* kd = &td->keyDefs[table()->keyNum()];
143
+ const keydef* kd = &td->keyDefs[(int)table()->keyNum()];
144
144
  if (kd->segmentCount < fnsCount)
145
145
  THROW_BZS_ERROR_WITH_MSG(_T("Join key fields are too many.\n ")
146
146
  _T("Check index number and field count."));
@@ -157,9 +157,13 @@ class activeTableImple : public activeObject<map_orm>
157
157
  if (f.len > FIXED_VALUE_BUF_SIZE)
158
158
  THROW_BZS_ERROR_WITH_MSG(_T("Join fixed key field is too long")
159
159
  _T(" field.\n This field can not use join."));
160
- field fd(joinFields[i].fixedValue, f, fds);
161
- fd = s.c_str() +1;
162
- joinFields[i].len = f.len;
160
+ field fd(joinFields[i].fixedValue - f.pos, f, fds);
161
+ size_t pos = s.find(_T(']'), 1);
162
+ if (pos == std::_tstring::npos)
163
+ THROW_BZS_ERROR_WITH_MSG(_T("Join fixed key field is invalid format")
164
+ _T(".\n This field can not use join."));
165
+ fd = s.substr(1, pos - 1).c_str();
166
+ joinFields[i].len = f.isStringType() ? 0xff : f.len;
163
167
  joinFields[i].type = JOIN_KEYVALUE_TYPE_PTR;
164
168
 
165
169
  }
@@ -173,7 +177,7 @@ class activeTableImple : public activeObject<map_orm>
173
177
  convertFieldType(
174
178
  td->fieldDefs[kd->segments[i].fieldNum].type))
175
179
  {
176
- joinFields[i].len = fd.len;
180
+ joinFields[i].len = fd.isStringType() ? 0xff : fd.len;
177
181
  joinFields[i].type = JOIN_KEYVALUE_TYPE_PTR;
178
182
  }
179
183
  else
@@ -211,10 +215,16 @@ class activeTableImple : public activeObject<map_orm>
211
215
  template <class Container>
212
216
  inline void addSeekValues(row& mdl, pq_handle& q,
213
217
  std::vector<typename Container::key_type>& fieldIndexes,
214
- std::vector<joinInfo>& joinFields)
218
+ std::vector<joinInfo>& joinFields,
219
+ const fielddefs* fds)
215
220
  {
216
221
  const uchar_td* ptr[8];
217
222
  int len[8];
223
+ uchar_td buf[MAX_KEYLEN];
224
+ uchar_td* buf_ptr = buf;
225
+ const tabledef* td = table()->tableDef();
226
+ const keydef* kd = &td->keyDefs[(int)table()->keyNum()];
227
+
218
228
  for (int i = 0; i < (int)fieldIndexes.size(); ++i)
219
229
  {
220
230
  if (fieldIndexes[i] == -1)
@@ -223,15 +233,19 @@ class activeTableImple : public activeObject<map_orm>
223
233
  len[i] = joinFields[i].len;
224
234
  }
225
235
  else if (joinFields[i].type == JOIN_KEYVALUE_TYPE_PTR)
226
- {
236
+ {
227
237
  ptr[i] = (const uchar_td*)mdl[fieldIndexes[i]].ptr();
228
238
  len[i] = joinFields[i].len;
229
239
  }
230
240
  else
231
241
  {
232
- const _TCHAR* p = mdl[fieldIndexes[i]].c_str();
233
- ptr[i] = (const uchar_td*)p;
234
- len[i] = (int)_tcslen(p);
242
+ // if target field type is different then we need convrt type
243
+ const fielddef& f = td->fieldDefs[kd->segments[i].fieldNum];
244
+ field fd(buf_ptr - f.pos, f, fds);
245
+ fd = mdl[fieldIndexes[i]].c_str();
246
+ ptr[i] = buf_ptr;
247
+ len[i] = f.isStringType() ? 0xff : f.len;
248
+ buf_ptr += f.len;
235
249
  }
236
250
  }
237
251
 
@@ -293,7 +307,7 @@ class activeTableImple : public activeObject<map_orm>
293
307
  while (it1 != ite1)
294
308
  {
295
309
  row& mdl = *(mdls.getRow((*it1)[0]));
296
- addSeekValues<Container>(mdl, stmt, fieldIndexes, joinFields);
310
+ addSeekValues<Container>(mdl, stmt, fieldIndexes, joinFields, fds);
297
311
  ++it1;
298
312
  }
299
313
  }
@@ -303,7 +317,7 @@ class activeTableImple : public activeObject<map_orm>
303
317
  while (it != ite)
304
318
  {
305
319
  row& mdl = *(*it);
306
- addSeekValues<Container>(mdl, stmt, fieldIndexes, joinFields);
320
+ addSeekValues<Container>(mdl, stmt, fieldIndexes, joinFields, fds);
307
321
  ++it;
308
322
  }
309
323
  }
@@ -1018,9 +1018,9 @@ short dbdef::fieldNumByName(short TableIndex, const _TCHAR* name)
1018
1018
  uint_td dbdef::fieldValidLength(eFieldQuery query, uchar_td FieldType)
1019
1019
  { // return MaxLen or MinLen or DefaultLen or Dec of field type
1020
1020
 
1021
- uint_td maxlen;
1022
- uint_td minlen;
1023
- uint_td defaultlen;
1021
+ uint_td maxlen = 0;
1022
+ uint_td minlen = 0;
1023
+ uint_td defaultlen = 0;
1024
1024
  int dec = -1;
1025
1025
  switch (FieldType)
1026
1026
  {