transactd 2.4.5 → 3.0.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 (145) hide show
  1. checksums.yaml +4 -4
  2. data/CMakeLists.txt +1 -1
  3. data/README-JA.md +52 -529
  4. data/README.md +52 -523
  5. data/bin/common/tdclc_32_3_0.dll +0 -0
  6. data/bin/common/tdclc_64_3_0.dll +0 -0
  7. data/build/common/system.cmake +2 -1
  8. data/build/common/transactd_cl_common.cmake +3 -6
  9. data/build/swig/ruby/ruby.swg +85 -28
  10. data/build/swig/ruby/tdclrb_wrap.cpp +3195 -1578
  11. data/build/swig/tdcl.i +161 -5
  12. data/build/tdclc/CMakeLists.txt +1 -0
  13. data/build/tdclc/tdclc.cbproj +7 -1
  14. data/build/tdclc/tdclc.rc +4 -4
  15. data/build/tdclcpp/tdclcpp.rc +4 -4
  16. data/build/tdclcpp/tdclcpp_bc.cbproj +2 -5
  17. data/build/tdclrb/tdclrb.rc +4 -4
  18. data/source/bzs/db/blobStructs.h +1 -1
  19. data/source/bzs/db/engine/mysql/database.cpp +199 -74
  20. data/source/bzs/db/engine/mysql/database.h +47 -18
  21. data/source/bzs/db/engine/mysql/dbManager.cpp +1 -0
  22. data/source/bzs/db/engine/mysql/mysqlInternal.h +32 -8
  23. data/source/bzs/db/protocol/tdap/btrDate.cpp +110 -75
  24. data/source/bzs/db/protocol/tdap/btrDate.h +46 -21
  25. data/source/bzs/db/protocol/tdap/client/activeTable.cpp +18 -18
  26. data/source/bzs/db/protocol/tdap/client/activeTable.h +25 -25
  27. data/source/bzs/db/protocol/tdap/client/activeTableImple.h +10 -4
  28. data/source/bzs/db/protocol/tdap/client/client.cpp +6 -5
  29. data/source/bzs/db/protocol/tdap/client/client.h +82 -15
  30. data/source/bzs/db/protocol/tdap/client/database.cpp +531 -142
  31. data/source/bzs/db/protocol/tdap/client/database.h +19 -6
  32. data/source/bzs/db/protocol/tdap/client/dbDef.cpp +461 -408
  33. data/source/bzs/db/protocol/tdap/client/dbDef.h +11 -17
  34. data/source/bzs/db/protocol/tdap/client/dllmain.cpp +61 -13
  35. data/source/bzs/db/protocol/tdap/client/field.cpp +1592 -1398
  36. data/source/bzs/db/protocol/tdap/client/field.h +110 -121
  37. data/source/bzs/db/protocol/tdap/client/fields.h +40 -10
  38. data/source/bzs/db/protocol/tdap/client/filter.h +69 -55
  39. data/source/bzs/db/protocol/tdap/client/groupQuery.cpp +296 -164
  40. data/source/bzs/db/protocol/tdap/client/groupQuery.h +77 -25
  41. data/source/bzs/db/protocol/tdap/client/memRecord.cpp +31 -13
  42. data/source/bzs/db/protocol/tdap/client/memRecord.h +31 -21
  43. data/source/bzs/db/protocol/tdap/client/nsDatabase.cpp +1 -1
  44. data/source/bzs/db/protocol/tdap/client/nsDatabase.h +4 -1
  45. data/source/bzs/db/protocol/tdap/client/nsTable.cpp +69 -24
  46. data/source/bzs/db/protocol/tdap/client/nsTable.h +3 -1
  47. data/source/bzs/db/protocol/tdap/client/recordset.cpp +1 -0
  48. data/source/bzs/db/protocol/tdap/client/recordsetImple.h +46 -27
  49. data/source/bzs/db/protocol/tdap/client/request.h +2 -1
  50. data/source/bzs/db/protocol/tdap/client/serializer.cpp +44 -9
  51. data/source/bzs/db/protocol/tdap/client/serializer.h +1 -1
  52. data/source/bzs/db/protocol/tdap/client/sqlBuilder.cpp +182 -76
  53. data/source/bzs/db/protocol/tdap/client/sqlBuilder.h +23 -12
  54. data/source/bzs/db/protocol/tdap/client/stringConverter.h +8 -10
  55. data/source/bzs/db/protocol/tdap/client/table.cpp +172 -93
  56. data/source/bzs/db/protocol/tdap/client/table.h +112 -37
  57. data/source/bzs/db/protocol/tdap/client/trdboostapi.h +17 -0
  58. data/source/bzs/db/protocol/tdap/client/trdboostapiInternal.h +0 -1
  59. data/source/bzs/db/protocol/tdap/client/trdclcppautolink.h +0 -2
  60. data/source/bzs/db/protocol/tdap/client/trdormapi.h +1 -1
  61. data/source/bzs/db/protocol/tdap/fieldComp.h +698 -14
  62. data/source/bzs/db/protocol/tdap/myDateTime.cpp +723 -307
  63. data/source/bzs/db/protocol/tdap/myDateTime.h +294 -0
  64. data/source/bzs/db/protocol/tdap/mysql/databaseSchema.cpp +164 -54
  65. data/source/bzs/db/protocol/tdap/mysql/databaseSchema.h +6 -3
  66. data/source/bzs/db/protocol/tdap/mysql/recordsetReader.h +133 -550
  67. data/source/bzs/db/protocol/tdap/mysql/request.h +6 -5
  68. data/source/bzs/db/protocol/tdap/mysql/tdapCommandExecuter.cpp +217 -82
  69. data/source/bzs/db/protocol/tdap/mysql/tdapCommandExecuter.h +1 -1
  70. data/source/bzs/db/protocol/tdap/tdapRequest.h +4 -9
  71. data/source/bzs/db/protocol/tdap/tdapSchema.cpp +808 -17
  72. data/source/bzs/db/protocol/tdap/tdapSchema.h +656 -164
  73. data/source/bzs/db/protocol/tdap/tdapcapi.h +130 -28
  74. data/source/bzs/db/protocol/tdap/uri.h +40 -32
  75. data/source/bzs/db/transactd/connManager.cpp +1 -1
  76. data/source/bzs/db/transactd/transactd.cpp +7 -0
  77. data/source/bzs/env/compiler.h +107 -94
  78. data/source/bzs/env/crosscompile.cpp +24 -12
  79. data/source/bzs/env/crosscompile.h +75 -6
  80. data/source/bzs/env/mbcswchrLinux.cpp +2 -2
  81. data/source/bzs/env/tcharMinGW.h +4 -0
  82. data/source/bzs/example/changeSchema.cpp +22 -17
  83. data/source/bzs/example/queryData.cpp +4 -0
  84. data/source/bzs/netsvc/client/iconnection.h +3 -1
  85. data/source/bzs/netsvc/client/tcpClient.h +10 -3
  86. data/source/bzs/rtl/stringBuffers.cpp +7 -0
  87. data/source/bzs/test/tdclatl/bench_query_atl.js +6 -0
  88. data/source/bzs/test/tdclatl/bench_tdclatl.js +8 -1
  89. data/source/bzs/test/tdclatl/test_query_atl.js +22 -2
  90. data/source/bzs/test/tdclatl/test_v3.js +1017 -0
  91. data/source/bzs/test/tdclphp/transactd_Test.php +55 -21
  92. data/source/bzs/test/tdclphp/transactd_datetime_Test.php +0 -5
  93. data/source/bzs/test/tdclphp/transactd_pool_Test.php +2 -0
  94. data/source/bzs/test/tdclphp/transactd_v3_Test.php +743 -0
  95. data/source/bzs/test/tdclrb/transactd_datetime_spec.rb +0 -5
  96. data/source/bzs/test/tdclrb/transactd_pool_spec.rb +2 -0
  97. data/source/bzs/test/tdclrb/transactd_spec.rb +39 -16
  98. data/source/bzs/test/tdclrb/transactd_v3_spec.rb +748 -0
  99. data/source/bzs/test/transactdBench/transactdBench.cpp +55 -58
  100. data/source/bzs/test/transactdBench/transactdBench2.cpp +1 -3
  101. data/source/bzs/test/trdclengn/testField.h +3305 -0
  102. data/source/bzs/test/trdclengn/test_tdclcpp_v3.cpp +1050 -0
  103. data/source/bzs/test/trdclengn/test_trdclengn.cpp +112 -190
  104. data/source/bzs/test/trdclengn/testbase.h +137 -0
  105. data/source/global/ormsrcgen/srcgen.cpp +23 -12
  106. data/source/global/ormsrcgen/template/ormDataClass_template.h +2 -0
  107. data/source/global/querystmts/querystmts.cpp +2 -3
  108. data/source/global/tdclatl/Bitset.cpp +38 -0
  109. data/source/global/tdclatl/Bitset.h +63 -0
  110. data/source/global/tdclatl/Database.cpp +59 -18
  111. data/source/global/tdclatl/Database.h +7 -4
  112. data/source/global/tdclatl/DbDef.cpp +6 -6
  113. data/source/global/tdclatl/DbDef.h +2 -1
  114. data/source/global/tdclatl/Field.cpp +112 -0
  115. data/source/global/tdclatl/Field.h +19 -5
  116. data/source/global/tdclatl/FieldDef.cpp +137 -16
  117. data/source/global/tdclatl/FieldDef.h +18 -2
  118. data/source/global/tdclatl/FieldDefs.cpp +54 -1
  119. data/source/global/tdclatl/FieldDefs.h +3 -0
  120. data/source/global/tdclatl/GroupQuery.cpp +8 -8
  121. data/source/global/tdclatl/QueryBase.cpp +65 -0
  122. data/source/global/tdclatl/QueryBase.h +10 -0
  123. data/source/global/tdclatl/Record.cpp +33 -2
  124. data/source/global/tdclatl/Record.h +3 -1
  125. data/source/global/tdclatl/RecordsetQuery.cpp +42 -0
  126. data/source/global/tdclatl/RecordsetQuery.h +8 -0
  127. data/source/global/tdclatl/Table.cpp +127 -3
  128. data/source/global/tdclatl/Table.h +10 -1
  129. data/source/global/tdclatl/TableDef.cpp +41 -8
  130. data/source/global/tdclatl/TableDef.h +7 -2
  131. data/source/global/tdclatl/activeTable.cpp +40 -71
  132. data/source/global/tdclatl/resource.h +0 -0
  133. data/source/global/tdclatl/tdclatl.idl +222 -28
  134. data/source/linux/tchar.h +100 -96
  135. data/transactd.gemspec +2 -2
  136. metadata +13 -11
  137. data/BUILD_UNIX-JA.md +0 -161
  138. data/BUILD_WIN-JA.md +0 -326
  139. data/README_ORMSRCGEN-JA.md +0 -115
  140. data/README_ORMSRCGEN.md +0 -118
  141. data/RELEASE_NOTE-JA.md +0 -356
  142. data/RELEASE_NOTE.md +0 -360
  143. data/bin/common/tdclc_32_2_4.dll +0 -0
  144. data/bin/common/tdclc_64_2_4.dll +0 -0
  145. data/source/bzs/test/trdclengn/test_blob.cpp +0 -375
@@ -20,201 +20,214 @@
20
20
  =================================================================*/
21
21
  // function type
22
22
  #if (__BCPLUSPLUS__)
23
- #if (defined(__APPLE__) || defined(__clang__))
24
- #define __THREAD __declspec(thread)
25
- #define __STDCALL
26
- #else
27
- #define __THREAD __thread
28
- #define __STDCALL __stdcall
29
- #endif
30
- #else
31
- #define __THREAD __declspec(thread)
32
- #if (_MSC_VER || __MINGW32__)
33
- #define __STDCALL __stdcall
34
- #else
35
- #define __STDCALL
36
- #endif
23
+ # if (defined(__APPLE__) || defined(__clang__))
24
+ # define __THREAD __declspec(thread)
25
+ # define __STDCALL
26
+ # else
27
+ # define __THREAD __thread
28
+ # define __STDCALL __stdcall
29
+ # endif
30
+ #else
31
+ # define __THREAD __declspec(thread)
32
+ # if (_MSC_VER || __MINGW32__)
33
+ # define __STDCALL __stdcall
34
+ # else
35
+ # define __STDCALL
36
+ # endif
37
37
  #endif
38
38
 
39
39
  // operating system
40
40
  #ifdef _WIN32
41
- #ifdef _WIN64
42
- #ifndef __x86_64__
43
- #define __x86_64__
44
- #endif
45
- #else
46
- #define __x86_32__
47
- #endif
41
+ # ifdef _WIN64
42
+ # ifndef __x86_64__
43
+ # define __x86_64__
44
+ # endif
45
+ # else
46
+ # define __x86_32__
47
+ # endif
48
48
  #else
49
- #ifndef LINUX
50
- #define LINUX 1 // Support 64bit only
51
- #endif
49
+ # ifndef LINUX
50
+ # define LINUX 1 // Support 64bit only
51
+ # endif
52
52
  #endif
53
+
53
54
  #if (__BCPLUSPLUS__ && defined(__APPLE__))
54
- #define __APPLE_32__ 1
55
+ # define __APPLE_32__ 1
55
56
  #endif
57
+
56
58
  // thread strage
57
59
  #ifndef __THREAD_BCB
58
- #undef __THREAD
59
- #if (__BCPLUSPLUS__ && !defined(__clang__))
60
- #define __THREAD_BCB __thread
61
- #define __THREAD
62
- #else
63
- #define __THREAD_BCB
64
- #if (_MSC_VER || (__BORLANDC__ && __clang__))
65
- #define __THREAD __declspec(thread)
66
- #else
67
- #define __THREAD __thread
68
- #endif
69
- #endif
60
+ # undef __THREAD
61
+ # if (__BCPLUSPLUS__ && !defined(__clang__))
62
+ # define __THREAD_BCB __thread
63
+ # define __THREAD
64
+ # else
65
+ # define __THREAD_BCB
66
+ # if (_MSC_VER || (__BORLANDC__ && __clang__))
67
+ # define __THREAD __declspec(thread)
68
+ # else
69
+ # define __THREAD __thread
70
+ # endif
71
+ # endif
70
72
  #endif //__THREAD_BCB
71
73
 
72
74
  // BCB_64
73
75
  #if (__BCPLUSPLUS__ && defined(__clang__))
74
- #define BCB_64
76
+ # define BCB_64
75
77
  #endif
76
78
 
77
79
  // BCB32
78
80
  #if (__BCPLUSPLUS__ && defined(__x86_32__))
79
- #define BCB_32
81
+ # define BCB_32
80
82
  #endif
81
83
 
82
84
  // export
83
85
  #undef PACKAGE
84
86
  #ifdef __BCPLUSPLUS__
85
- #ifndef PACKAGE
86
- #ifdef __x86_64__
87
- #define PACKAGE __declspec(dllexport)
87
+ # ifndef PACKAGE
88
+ # ifdef __x86_64__
89
+ # define PACKAGE __declspec(dllexport)
90
+ # else
91
+ # define PACKAGE __declspec(package)
92
+ # endif
93
+ # endif
88
94
  #else
89
- #define PACKAGE __declspec(package)
90
- #endif
91
- #endif
92
- #else
93
- #if (_WIN32 && !defined(__MINGW32__))
94
- #define PACKAGE __declspec(dllexport)
95
- #else
96
- #define PACKAGE
97
- #endif
95
+ # if (_WIN32 && !defined(__MINGW32__))
96
+ # define PACKAGE __declspec(dllexport)
97
+ # else
98
+ # define PACKAGE
99
+ # endif
98
100
  #endif
99
101
 
100
102
  #ifdef PACKAGE_NO_EXPORT
101
- #undef PACKAGE
102
- #define PACKAGE
103
+ # undef PACKAGE
104
+ # define PACKAGE
103
105
  #endif
104
106
 
105
107
  #define AGRPACK PACKAGE
106
108
 
107
109
  // bcb_osx
108
110
  #if (__BCPLUSPLUS__ && defined(__APPLE__) && !defined(__clang__))
109
- #define PACKAGE_OSX PACKAGE
111
+ # define PACKAGE_OSX PACKAGE
110
112
  #else
111
- #define PACKAGE_OSX
113
+ # define PACKAGE_OSX
112
114
  #endif
113
115
 
114
116
  // import
115
117
  #if (defined(LINUX) || __MINGW32__)
116
- #define PACKAGE_IMPORT
118
+ # define PACKAGE_IMPORT
117
119
  #else
118
- #define PACKAGE_IMPORT __declspec(dllimport)
120
+ # define PACKAGE_IMPORT __declspec(dllimport)
121
+ #endif
122
+
123
+
124
+ //__int64 basic type
125
+ #if (defined(LINUX))
126
+ # ifndef __int64
127
+ # define __int64 long long int
128
+ # endif
129
+ # ifndef NULL
130
+ # define NULL 0
131
+ # endif
119
132
  #endif
120
133
 
121
134
  // data alignment
122
135
  #if (_MSC_VER || (__BORLANDC__ && __clang__))
123
- #define pragma_pack1 __pragma(pack(push, 1))
124
- #define pragma_pop __pragma(pack(pop))
125
- #else
126
- #ifdef __BCPLUSPLUS__
127
- #define pragma_pack1
128
- #define pragma_pop
136
+ # define pragma_pack1 __pragma(pack(push, 1))
137
+ # define pragma_pop __pragma(pack(pop))
129
138
  #else
130
- #define pragma_pack1 _Pragma("pack(1)")
131
- #define pragma_pop _Pragma("pack()")
132
- #endif
139
+ # ifdef __BCPLUSPLUS__
140
+ # define pragma_pack1
141
+ # define pragma_pop
142
+ # else
143
+ # define pragma_pack1 _Pragma("pack(1)")
144
+ # define pragma_pop _Pragma("pack()")
145
+ # endif
133
146
  #endif
134
147
 
135
148
  //memory leak detector
136
149
  #ifdef _MSC_VER
137
- #ifdef _DEBUG
138
- #define _CRTDBG_MAP_ALLOC
139
- #include <stdlib.h>
140
- #include <crtdbg.h>
141
- #endif // _DEBUG
150
+ # ifdef _DEBUG
151
+ # define _CRTDBG_MAP_ALLOC
152
+ # include <stdlib.h>
153
+ # include <crtdbg.h>
154
+ # endif // _DEBUG
142
155
  #endif // _MSC_VER
143
156
 
144
157
 
145
158
  // compiler name
146
159
  #if (_MSC_VER == 1400)
147
- #define COMPILER_VERSTR "vc80"
160
+ # define COMPILER_VERSTR "vc80"
148
161
  #endif
149
162
 
150
163
  #if (_MSC_VER == 1500)
151
- #define COMPILER_VERSTR "vc90"
164
+ # define COMPILER_VERSTR "vc90"
152
165
  #endif
153
166
 
154
167
  #if (_MSC_VER == 1600)
155
- #define COMPILER_VERSTR "vc100"
168
+ # define COMPILER_VERSTR "vc100"
156
169
  #endif
157
170
 
158
171
  #if (_MSC_VER == 1700)
159
- #define COMPILER_VERSTR "vc110"
172
+ # define COMPILER_VERSTR "vc110"
160
173
  #endif
161
174
 
162
175
  #if (_MSC_VER == 1800)
163
- #define COMPILER_VERSTR "vc120"
176
+ # define COMPILER_VERSTR "vc120"
164
177
  #endif
165
178
 
166
179
  #if (_MSC_VER == 1900)
167
- #define COMPILER_VERSTR "vc140"
180
+ # define COMPILER_VERSTR "vc140"
168
181
  #endif
169
182
 
170
183
  #if (__BCPLUSPLUS__ >= 0x630 && (__BCPLUSPLUS__ < 0x640))
171
- #define COMPILER_VERSTR "bc150"
184
+ # define COMPILER_VERSTR "bc150"
172
185
  #endif
173
186
 
174
187
  #if (__BCPLUSPLUS__ >= 0x640 && (__BCPLUSPLUS__ < 0x650))
175
- #define COMPILER_VERSTR "bc160"
188
+ # define COMPILER_VERSTR "bc160"
176
189
  #endif
177
190
 
178
191
  #if (__BCPLUSPLUS__ >= 0x650 && (__BCPLUSPLUS__ < 0x660))
179
- #define COMPILER_VERSTR "bc170"
192
+ # define COMPILER_VERSTR "bc170"
180
193
  #endif
181
194
 
182
195
  #if (__BCPLUSPLUS__ >= 0x660 && (__BCPLUSPLUS__ < 0x670))
183
- #define COMPILER_VERSTR "bc180"
196
+ # define COMPILER_VERSTR "bc180"
184
197
  #endif
185
198
 
186
199
  #if (__BCPLUSPLUS__ >= 0x670 && (__BCPLUSPLUS__ < 0x680))
187
- #define COMPILER_VERSTR "bc190"
200
+ # define COMPILER_VERSTR "bc190"
188
201
  #endif
189
202
 
190
203
  #if (__BCPLUSPLUS__ >= 0x680 && (__BCPLUSPLUS__ < 0x690))
191
- #define COMPILER_VERSTR "bc200"
204
+ # define COMPILER_VERSTR "bc200"
192
205
  #endif
193
206
 
194
207
  #if (__BCPLUSPLUS__ >= 0x690 && (__BCPLUSPLUS__ < 0x700))
195
- #define COMPILER_VERSTR "bc210"
208
+ # define COMPILER_VERSTR "bc210"
196
209
  #endif
197
210
 
198
211
  #if (__APPLE__)
199
- #define SHARED_LIB_EXTENTION ".dylib"
212
+ # define SHARED_LIB_EXTENTION ".dylib"
200
213
  #else
201
- #if (defined(LINUX) || (__BORLANDC__ && __clang__))
202
- #define SHARED_LIB_EXTENTION ".a"
203
- #else
204
- #define SHARED_LIB_EXTENTION ".lib"
205
- #endif
214
+ # if (defined(LINUX) || (__BORLANDC__ && __clang__))
215
+ # define SHARED_LIB_EXTENTION ".a"
216
+ # else
217
+ # define SHARED_LIB_EXTENTION ".lib"
218
+ # endif
206
219
  #endif
207
220
 
208
221
  #if (defined(LINUX) || (__BORLANDC__ && __clang__))
209
- #define LIB_EXTENTION ".a"
222
+ # define LIB_EXTENTION ".a"
210
223
  #else
211
- #define LIB_EXTENTION ".lib"
224
+ # define LIB_EXTENTION ".lib"
212
225
  #endif
213
226
 
214
227
  #ifdef LINUX
215
- #define LIB_PREFIX "lib"
228
+ # define LIB_PREFIX "lib"
216
229
  #else
217
- #define LIB_PREFIX
230
+ # define LIB_PREFIX
218
231
  #endif
219
232
 
220
233
  #endif // BZS_ENV_COMPILER_H
@@ -23,6 +23,7 @@
23
23
  #include <wctype.h>
24
24
  #include <wchar.h>
25
25
 
26
+
26
27
  char16_t* _strupr16(char16_t* s)
27
28
  {
28
29
  char16_t* p = s;
@@ -67,18 +68,6 @@ char* _strlwr(char* s)
67
68
  return p;
68
69
  }
69
70
 
70
- char* _i64toa_s(__int64 v, char* tmp, unsigned long size, int radix)
71
- {
72
- snprintf(tmp, size, "%lld", v);
73
- return tmp;
74
- }
75
-
76
- char* _ltoa_s(int v, char* tmp, unsigned long size, int radix)
77
- {
78
- snprintf(tmp, size, "%d", v);
79
- return tmp;
80
- }
81
-
82
71
  int wcsnicmp16(const char16_t* sl, const char16_t* sr, size_t n)
83
72
  {
84
73
  if (n == 0)
@@ -145,3 +134,26 @@ char16_t* wmemcpy(char16_t* dest, const char16_t* src, size_t count)
145
134
  }
146
135
 
147
136
  #endif // LINUX
137
+
138
+ #if (defined(_WIN32) && !defined(__MINGW32__))
139
+ #include <windows.h>
140
+ #include "crosscompile.h"
141
+
142
+ static const __int64 EPOCH = ((__int64) 116444736000000000ULL);
143
+ int gettimeofday(struct timeval * tp, struct timezone * tzp)
144
+ {
145
+
146
+ SYSTEMTIME system_time;
147
+ FILETIME file_time;
148
+ __int64 time;
149
+
150
+ GetSystemTime( &system_time );
151
+ SystemTimeToFileTime( &system_time, &file_time );
152
+ time = ((__int64)file_time.dwLowDateTime ) ;
153
+ time += ((__int64)file_time.dwHighDateTime) << 32;
154
+
155
+ tp->tv_sec = (long) ((time - EPOCH) / 10000000L);
156
+ tp->tv_usec = (long) (system_time.wMilliseconds * 1000);
157
+ return 0;
158
+ }
159
+ #endif //(defined(_WIN32) && !defined(__MINGW32__))
@@ -47,14 +47,20 @@ int gettimeofday(struct timeval*, struct timezone*);
47
47
  #include <ctype.h>
48
48
  #include <stddef.h>
49
49
  #include <linuxTypes.h>
50
+ #include <inttypes.h>
51
+ #include <stdio.h>
52
+ #include <string.h>
53
+ #include <wctype.h>
54
+ #include <wchar.h>
50
55
  /* c c++ runtime library */
51
- #define _strnicmp strncasecmp
56
+ #ifndef __int64
52
57
  #define __int64 long long int
58
+ #endif
59
+
60
+ #define _strnicmp strncasecmp
53
61
  #define _atoi64 atoll
54
- #define _wtoi(W) wcstol(W, NULL, 10)
55
62
  #define _access access
56
63
  #define sprintf_s snprintf
57
- #define swprintf_s swprintf
58
64
  #define localtime_s localtime_r
59
65
  #define strncpy_s(A, B, C, D) strncpy(A, C, D)
60
66
  #define strcpy_s(A, B, C) strcpy(A, C)
@@ -71,8 +77,58 @@ int gettimeofday(struct timeval*, struct timezone*);
71
77
 
72
78
  char* _strupr(char* s);
73
79
  char* _strlwr(char* s);
74
- char* _ltoa_s(int v, char* tmp, unsigned long size, int radix);
75
- char* _i64toa_s(__int64 v, char* tmp, unsigned long size, int radix);
80
+
81
+
82
+ inline char* _i64toa_s(__int64 v, char* tmp, unsigned long size, int radix)
83
+ {
84
+ snprintf(tmp, size, "%lld", v);
85
+ return tmp;
86
+ }
87
+
88
+ inline char* _ui64toa_s(unsigned __int64 v, char* tmp, unsigned long size, int radix)
89
+ {
90
+ snprintf(tmp, size, "%llu", v);
91
+ return tmp;
92
+ }
93
+
94
+ inline char* _ltoa_s(int v, char* tmp, unsigned long size, int radix)
95
+ {
96
+ snprintf(tmp, size, "%d", v);
97
+ return tmp;
98
+ }
99
+
100
+ inline char* _ultoa_s(int v, char* tmp, unsigned long size, int radix)
101
+ {
102
+ snprintf(tmp, size, "%u", v);
103
+ return tmp;
104
+ }
105
+
106
+ inline char* _ltoa(int v, char* tmp, int radix)
107
+ {
108
+ sprintf(tmp, "%d", v);
109
+ return tmp;
110
+ }
111
+
112
+ inline char* _ultoa(int v, char* tmp, int radix)
113
+ {
114
+ sprintf(tmp, "%u", v);
115
+ return tmp;
116
+ }
117
+
118
+ #if !defined(__BORLANDC__)
119
+ inline char* _i64toa(__int64 v, char* tmp, int radix)
120
+ {
121
+ sprintf(tmp, "%lld", v);
122
+ return tmp;
123
+ }
124
+
125
+ inline char* _ui64toa(unsigned __int64 v, char* tmp, int radix)
126
+ {
127
+ sprintf(tmp, "%llu", v);
128
+ return tmp;
129
+ }
130
+ #endif
131
+
76
132
  char16_t* _strupr16(char16_t* s);
77
133
  char16_t* _strlwr16(char16_t* s);
78
134
  size_t strlen16(const char16_t* src);
@@ -127,14 +183,21 @@ typedef unsigned __int32 char32_t; // 32bit
127
183
  /* c c++ runtime library */
128
184
  #include <tchar.h>
129
185
  #if defined(__BORLANDC__) || defined(__MINGW32__)
186
+
130
187
  #define _ltow_s(A, B, C, D) _ltow(A, B, D)
131
188
  #define _ltoa_s(A, B, C, D) _ltoa(A, B, D)
132
189
  #define _ltot_s(A, B, C, D) _ltot(A, B, D)
133
190
  #define _ultot_s(A, B, C, D) _ultot(A, B, D)
134
191
  #define _i64tot_s(A, B, C, D) _i64tot(A, B, D)
135
- #define _i64tow_s(A, B, C, D) _i64tow(A, B, D)
136
192
  #define _i64toa_s(A, B, C, D) _i64toa(A, B, D)
193
+ #define _i64tow_s(A, B, C, D) _i64tow(A, B, D)
194
+ #define _ui64tot_s(A, B, C, D) _ui64tot(A, B, D)
195
+ #define _ui64toa_s(A, B, C, D) _ui64toa(A, B, D)
196
+ #define _ui64tow_s(A, B, C, D) _ui64tow(A, B, D)
137
197
  #define _strlwr_s(A, B) strlwr(A)
198
+ #ifndef _tcslwr_s
199
+ #define _tcslwr_s(A, B) _tcslwr(A)
200
+ #endif
138
201
  #endif
139
202
 
140
203
  #if defined(__BORLANDC__)
@@ -157,6 +220,7 @@ typedef unsigned __int32 char32_t; // 32bit
157
220
  /* muliti byete char */
158
221
  typedef unsigned char mbchar;
159
222
  typedef unsigned char char_m;
223
+ int gettimeofday(struct timeval * tp, struct timezone * tzp);
160
224
 
161
225
  #endif // defined(LINUX)
162
226
 
@@ -176,4 +240,9 @@ typedef unsigned char char_m;
176
240
  #define tls_setspecific(A, B) pthread_setspecific(A, B)
177
241
  #endif
178
242
 
243
+ #if (defined(_MSC_VER) && (_MSC_VER < 1800))
244
+ #define strtoull _strtoui64
245
+ #define wcstoull _wcstoui64
246
+ #endif
247
+
179
248
  #endif // BZS_ENV_CROSSCOMPILE_H
@@ -40,8 +40,8 @@ void cleanupTls(void* p)
40
40
 
41
41
  void initCvtProcess()
42
42
  {
43
- int ret = pthread_key_create(&g_tls1, cleanupTls);
44
- assert(ret == 0);
43
+ pthread_key_create(&g_tls1, cleanupTls);
44
+ //assert(ret == 0);
45
45
  pthread_setspecific(g_tls1, NULL);
46
46
  }
47
47
 
@@ -23,10 +23,12 @@
23
23
  #ifdef _UNICODE
24
24
 
25
25
  #define _tcsncpy_s wcsncpy_s
26
+ #define _tcslwr _wcslwr
26
27
 
27
28
  #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ <= 5) // 4.5 and lesser
28
29
  #define _tcscpy_s wcscpy_s
29
30
  #define _tcscat_s wcscat_s
31
+ #define _tcserror _wcserror
30
32
  typedef wchar_t _TUCHAR;
31
33
  #elseif __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 5) // 4.6 and grater
32
34
  #define _tcsstr wcsstr
@@ -41,10 +43,12 @@ typedef wchar_t _TUCHAR;
41
43
 
42
44
  #define _tcsncpy_s strncpy_s
43
45
  #define _tcsupr_s(a, b) (_strupr(a))
46
+ #define _tcslwr _strlwr
44
47
 
45
48
  #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ <= 5) // 4.5 and lesser
46
49
  #define _tcscpy_s strcpy_s
47
50
  #define _tcscat_s strcat_s
51
+ #define _tcserror strerror
48
52
  typedef char _TUCHAR;
49
53
  #elif __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 5) // 4.6 and grater
50
54
  #define _tcsstr strstr
@@ -87,28 +87,33 @@ int _tmain(int argc, _TCHAR* argv[])
87
87
  {
88
88
  // backup current user table schema
89
89
  db->dbDef()->pushBackup(tablenum_user);
90
-
91
- if (changeUserTable(db->dbDef()))
90
+ if (db->dbDef()->stat() == 0)
92
91
  {
93
- // convert table if table exist;
94
- if (db->existsTableFile(tablenum_user, NULL))
92
+ if (changeUserTable(db->dbDef()))
95
93
  {
96
- db->setOnCopyData(onCopyData);
94
+ // convert table if table exist;
95
+ if (db->existsTableFile(TABLE_NUM_TMP, NULL))
96
+ {
97
+ db->setOnCopyData(onCopyData);
98
+
99
+ db->convertTable(tablenum_user, false, NULL);
100
+ if (db->stat())
101
+ showError(_T("convert table"), NULL, db->stat());
102
+ }
103
+ }
97
104
 
98
- db->convertTable(tablenum_user, false, NULL);
99
- if (db->stat())
100
- showError(_T("convert table"), NULL, db->stat());
105
+ if (db->stat())
106
+ {
107
+ result = db->stat();
108
+ // restore user table schema
109
+ db->dbDef()->popBackup(tablenum_user);
101
110
  }
102
- }
111
+ else
112
+ _tprintf(_T("\nchange schema success. \n"));
113
+
114
+ }else
115
+ showError(_T("backup table def"), NULL, db->dbDef()->stat());
103
116
 
104
- if (db->stat())
105
- {
106
- result = db->stat();
107
- // restore user table schema
108
- db->dbDef()->popBackup(tablenum_user);
109
- }
110
- else
111
- _tprintf(_T("\nchange schema success. \n"));
112
117
  db->close();
113
118
  }
114
119
  database::destroy(db);
@@ -449,6 +449,7 @@ bool checkVersion(database_ptr db)
449
449
  return (tb->recordCount(false) == 20000);
450
450
  }
451
451
  }
452
+ td = def->tableDefs(1);
452
453
  }
453
454
  return false;
454
455
  }
@@ -464,6 +465,9 @@ int prebuiltData(database_ptr db, const connectParams& param, bool foceCreate,
464
465
  dropDatabase(db);
465
466
  else
466
467
  return 0;
468
+ }else if (db->stat() == STATUS_INVALID_DATASIZE)
469
+ {
470
+ dropDatabase(db);
467
471
  }
468
472
  std::tcout << _T("\nInserting query test data. Please wait... ")
469
473
  << std::flush;
@@ -21,10 +21,11 @@
21
21
  #ifdef __BCPLUSPLUS__
22
22
  #pragma warn -8012
23
23
  #endif
24
-
25
24
  #include <boost/version.hpp>
26
25
  #if (BOOST_VERSION > 104900)
26
+
27
27
  #include <boost/asio.hpp>
28
+
28
29
  #else
29
30
  #include <boost/asio/ip/tcp.hpp>
30
31
  #include <boost/asio/buffer.hpp>
@@ -107,6 +108,7 @@ public:
107
108
  virtual char* read() = 0;
108
109
  virtual bool isHandShakable() const = 0;
109
110
  virtual const boost::system::error_code& error() const = 0;
111
+ virtual void* versions() = 0;
110
112
  };
111
113
 
112
114
  #define CONNECTION_FUNCTION_DIRECT_READ 1
@@ -19,10 +19,12 @@
19
19
  02111-1307, USA.
20
20
  ================================================================= */
21
21
 
22
+ #pragma warning(disable : 4005) //BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT redefine bug
22
23
  #include <bzs/netsvc/client/iconnection.h>
23
-
24
24
  #include <boost/asio/write.hpp>
25
25
  #include <boost/asio/read.hpp>
26
+ #pragma warning(default : 4005)
27
+
26
28
  #include <boost/bind.hpp>
27
29
  #include <boost/thread/mutex.hpp>
28
30
  #if (BOOST_VERSION > 104900)
@@ -148,6 +150,7 @@ public:
148
150
 
149
151
  /** Implementation of Part of the connection interface
150
152
  */
153
+ #define VER_ST_SIZE 12
151
154
  class connectionBase : public connection
152
155
  {
153
156
  protected:
@@ -159,6 +162,7 @@ protected:
159
162
  size_t m_readLen;
160
163
  int m_refCount;
161
164
  int m_charsetServer;
165
+ char m_vers[VER_ST_SIZE];
162
166
  bool m_connected;
163
167
  bool m_isHandShakable;
164
168
  boost::system::error_code m_e;
@@ -183,6 +187,7 @@ public:
183
187
  m_ep(ep), m_reader(NULL), m_refCount(0),
184
188
  m_charsetServer(-1), m_connected(false), m_isHandShakable(true)
185
189
  {
190
+ memset(m_vers, 0, VER_ST_SIZE);
186
191
  }
187
192
  virtual ~connectionBase()
188
193
  {
@@ -196,6 +201,8 @@ public:
196
201
  void setDirectReadHandler(idirectReadHandler* p){ m_reader = p; }
197
202
  bool isHandShakable() const {return m_isHandShakable;};
198
203
  const boost::system::error_code& error() const { return m_e; };
204
+
205
+ void* versions() {return (void*)m_vers;};
199
206
  };
200
207
 
201
208
 
@@ -672,8 +679,8 @@ class pipeConnection : public connectionImple<platform_stream>
672
679
  {
673
680
  char* p = buf;
674
681
  DWORD processId = GetCurrentProcessId();
675
- __int64 clientid = (__int64) this;
676
- sprintf_s(p, 120, "%s_%u_%Lu", name, processId, clientid);
682
+ unsigned __int64 clientid = (unsigned __int64) this;
683
+ sprintf_s(p, 120, "%s_%u_%llu", name, processId, clientid);
677
684
  return p;
678
685
  }
679
686
 
@@ -30,6 +30,7 @@ namespace rtl
30
30
  {
31
31
 
32
32
  static const int MEMORY_UNIT = 8192;
33
+ static const size_t MAX_STRING_BUFFER = 196608; // MAX_USHORT * 3
33
34
 
34
35
  stringBuffer::stringBuffer(size_t size) : m_ptr(NULL), m_len(0), m_pos(0)
35
36
  {
@@ -59,6 +60,12 @@ size_t stringBuffer::alloc(size_t size)
59
60
 
60
61
  size_t stringBuffer::re_alloc(size_t size)
61
62
  {
63
+ if ((size - m_pos) < MAX_STRING_BUFFER && m_len > MAX_STRING_BUFFER)
64
+ {
65
+ m_pos = 0;
66
+ return m_len;
67
+ }
68
+
62
69
  size =
63
70
  ((size / MEMORY_UNIT) + ((size % MEMORY_UNIT) ? 1 : 0)) * MEMORY_UNIT;
64
71
  m_ptr = (char*)::realloc(m_ptr, size);