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
@@ -248,26 +248,27 @@ inline bool cp_has_update_default_function(Field* fd)
248
248
  inline void cp_evaluate_insert_default_function(Field* fd)
249
249
  {
250
250
  #if (MYSQL_VERSION_ID > 50600)
251
- Field* ft = fd;
251
+ Field* ft = fd;
252
252
  #else
253
- Field_timestamp* ft = (Field_timestamp*)(fd);
253
+ Field_timestamp* ft = (Field_timestamp*)(fd);
254
254
  #endif
255
- if (ft)
256
- ft->set_time();
255
+ if (ft)
256
+ ft->set_time();
257
257
  }
258
258
 
259
259
  inline void cp_evaluate_update_default_function(Field* fd)
260
260
  {
261
261
 
262
262
  #if (MYSQL_VERSION_ID > 50600)
263
- Field* ft = fd;
263
+ Field* ft = fd;
264
264
  #else
265
- Field_timestamp* ft = (Field_timestamp*)(fd);
265
+ Field_timestamp* ft = (Field_timestamp*)(fd);
266
266
  #endif
267
- if (ft)
268
- ft->set_time();
267
+ if (ft)
268
+ ft->set_time();
269
269
  }
270
270
 
271
+
271
272
  inline unsigned char* cp_null_ptr(Field* fd, unsigned char* /*record*/)
272
273
  {
273
274
  return (unsigned char*)fd->null_ptr;
@@ -455,6 +456,11 @@ inline bool cp_query_command(THD* thd, char* str)
455
456
  return dispatch_command(thd, &com_data, COM_QUERY);
456
457
  }
457
458
 
459
+ inline void cp_lex_clear(THD* thd)
460
+ {
461
+ thd->lex->reset();
462
+ }
463
+
458
464
 
459
465
  #else //Not MySQL 5.7
460
466
  #define OPEN_TABLE_FLAG_TYPE MYSQL_OPEN_GET_NEW_TABLE
@@ -559,6 +565,11 @@ inline bool cp_query_command(THD* thd, char* str)
559
565
  return dispatch_command(COM_QUERY, thd, str, (uint)strlen(str));
560
566
  }
561
567
 
568
+ inline void cp_lex_clear(THD* thd)
569
+ {
570
+ thd->lex->many_values.empty();
571
+ }
572
+
562
573
  #endif
563
574
 
564
575
  /* find_files is static function in maridb.
@@ -601,4 +612,17 @@ inline bool cp_query_command(THD* thd, char* str)
601
612
  }
602
613
  #endif
603
614
 
615
+
616
+ #if (defined(MARIADDB_10_1) && MARIADDB_10_1 > 100108)
617
+ inline void cp_setup_rpl_bitmap(TABLE* table)
618
+ {
619
+ bitmap_set_all(table->write_set);
620
+ table->rpl_write_set = table->write_set;
621
+ }
622
+ #else
623
+
624
+ inline void cp_setup_rpl_bitmap(TABLE* table){};
625
+
626
+ #endif
627
+
604
628
  #endif // BZS_DB_ENGINE_MYSQL_MYSQLINTERNAL_H
@@ -16,13 +16,12 @@
16
16
  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
17
17
  02111-1307, USA.
18
18
  =================================================================*/
19
- #include <bzs/env/compiler.h>
20
- #include <bzs/env/tstring.h>
21
19
  #include "btrDate.h"
22
20
  #include <bzs/rtl/datetime.h>
23
21
  #include <stdio.h>
24
22
  #include <stdlib.h>
25
23
  #include <time.h>
24
+ #include <bzs/env/crosscompile.h>
26
25
 
27
26
  #ifdef LINUX
28
27
  #include <bzs/env/mbcswchrLinux.h>
@@ -209,99 +208,107 @@ const char* dateFormatString(const char*)
209
208
  {
210
209
  return "%04d/%02d/%02d";
211
210
  }
212
- const wchar_t* dateFormatString(const wchar_t*)
213
- {
214
- return L"%04d/%02d/%02d";
215
- }
216
211
 
217
212
  const char* dateFormatString_h(const char*)
218
213
  {
219
214
  return "%04d-%02d-%02d";
220
215
  }
221
- const wchar_t* dateFormatString_h(const wchar_t*)
222
- {
223
- return L"%04d-%02d-%02d";
224
- }
225
216
 
226
217
  const char* timeFormatString(const char*)
227
218
  {
228
219
  return "%02d:%02d:%02d";
229
220
  }
230
- const wchar_t* timeFormatString(const wchar_t*)
231
- {
232
- return L"%02d:%02d:%02d";
233
- }
234
221
 
235
- const char* timeFormatString_h(const char*)
222
+ /*const char* timeFormatString_h(const char*)
236
223
  {
237
224
  return "%02d-%02d-%02d";
238
- }
239
- const wchar_t* timeFormatString_h(const wchar_t*)
240
- {
241
- return L"%02d-%02d-%02d";
242
- }
225
+ }*/
243
226
 
244
227
  template <class T> size_t _tcslen_(const T* p);
245
228
 
229
+ template <class T> int _ttoi_(const T* p);
230
+
246
231
  template <> size_t _tcslen_(const char* p)
247
232
  {
248
233
  return strlen(p);
249
234
  }
250
- template <> size_t _tcslen_(const wchar_t* p)
251
- {
252
- return wcslen(p);
253
- }
254
-
255
- template <class T> int _ttoi_(const T* p);
256
235
 
257
236
  template <> int _ttoi_(const char* p)
258
237
  {
259
238
  return atoi(p);
260
239
  }
261
- template <> int _ttoi_(const wchar_t* p)
262
- {
263
- return _wtoi(p);
264
- }
265
240
 
266
- template <class T> T* formatDate(T* p, const btrDate& d, bool type_vb);
241
+ template <class T> T* formatDate(T* p, const btrDate& d, bool w3_format);
267
242
 
268
- template <> char* formatDate(char* p, const btrDate& d, bool type_vb)
243
+ template <> char* formatDate(char* p, const btrDate& d, bool w3_format)
269
244
  {
270
- if (type_vb)
245
+ if (w3_format)
271
246
  sprintf_s(p, 20, dateFormatString_h(p), d.yy, d.mm, d.dd);
272
247
  else
273
248
  sprintf_s(p, 20, dateFormatString(p), d.yy, d.mm, d.dd);
274
249
  return p;
275
250
  }
276
251
 
277
- template <> wchar_t* formatDate(wchar_t* p, const btrDate& d, bool type_vb)
252
+ template <class T> T* formatTime(T* p, const btrTime& t/*, bool w3_format*/);
253
+
254
+ template <> char* formatTime(char* p, const btrTime& t/*, bool w3_format*/)
278
255
  {
279
- if (type_vb)
280
- swprintf_s(p, 20, dateFormatString_h(p), d.yy, d.mm, d.dd);
281
- else
282
- swprintf_s(p, 20, dateFormatString(p), d.yy, d.mm, d.dd);
256
+ /*if (w3_format)
257
+ sprintf_s(p, 20, timeFormatString_h(p), t.hh, t.nn, t.ss);
258
+ else*/
259
+ sprintf_s(p, 20, timeFormatString(p), t.hh, t.nn, t.ss);
283
260
  return p;
284
261
  }
285
262
 
286
- template <class T> T* formatTime(T* p, const btrTime& d, bool type_vb);
263
+ #ifdef _WIN32
264
+ const wchar_t* dateFormatString(const wchar_t*)
265
+ {
266
+ return L"%04d/%02d/%02d";
267
+ }
287
268
 
288
- template <> char* formatTime(char* p, const btrTime& t, bool type_vb)
269
+ const wchar_t* dateFormatString_h(const wchar_t*)
289
270
  {
290
- if (type_vb)
291
- sprintf_s(p, 20, timeFormatString_h(p), t.hh, t.nn, t.ss);
271
+ return L"%04d-%02d-%02d";
272
+ }
273
+
274
+ const wchar_t* timeFormatString(const wchar_t*)
275
+ {
276
+ return L"%02d:%02d:%02d";
277
+ }
278
+
279
+ /*const wchar_t* timeFormatString_h(const wchar_t*)
280
+ {
281
+ return L"%02d-%02d-%02d";
282
+ }*/
283
+
284
+ template <> size_t _tcslen_(const wchar_t* p)
285
+ {
286
+ return wcslen(p);
287
+ }
288
+
289
+ template <> int _ttoi_(const wchar_t* p)
290
+ {
291
+ return _wtoi(p);
292
+ }
293
+
294
+ template <> wchar_t* formatDate(wchar_t* p, const btrDate& d, bool w3_format)
295
+ {
296
+ if (w3_format)
297
+ swprintf_s(p, 20, dateFormatString_h(p), d.yy, d.mm, d.dd);
292
298
  else
293
- sprintf_s(p, 20, timeFormatString(p), t.hh, t.nn, t.ss);
299
+ swprintf_s(p, 20, dateFormatString(p), d.yy, d.mm, d.dd);
294
300
  return p;
295
301
  }
296
302
 
297
- template <> wchar_t* formatTime(wchar_t* p, const btrTime& t, bool type_vb)
303
+ template <> wchar_t* formatTime(wchar_t* p, const btrTime& t/*, bool w3_format*/)
298
304
  {
299
- if (type_vb)
305
+ /*if (w3_format)
300
306
  swprintf_s(p, 20, timeFormatString_h(p), t.hh, t.nn, t.ss);
301
- else
307
+ else*/
302
308
  swprintf_s(p, 20, timeFormatString(p), t.hh, t.nn, t.ss);
303
309
  return p;
304
310
  }
311
+ #endif
305
312
 
306
313
  template <class T> btrDate atobtrd(const T* date)
307
314
  {
@@ -318,20 +325,20 @@ template <class T> btrDate atobtrd(const T* date)
318
325
  return bt;
319
326
  }
320
327
 
321
- template <class T> const T* btrdtoa(const btrDate& d, T* retbuf, bool type_vb)
328
+ template <class T> const T* btrdtoa(const btrDate& d, T* retbuf, bool w3_format)
322
329
  {
323
330
  T* p = retbuf;
324
331
  if (p == NULL)
325
332
  p = (T*)databuf();
326
- return formatDate(p, d, type_vb);
333
+ return formatDate(p, d, w3_format);
327
334
  }
328
335
 
329
- template <class T> const T* btrttoa(const btrTime& t, T* retbuf, bool type_vb)
336
+ template <class T> const T* btrttoa(const btrTime& t, T* retbuf/*, bool w3_format*/)
330
337
  {
331
338
  T* p = retbuf;
332
339
  if (p == NULL)
333
340
  p = (T*)databuf();
334
- return formatTime(p, t, type_vb);
341
+ return formatTime(p, t/*, w3_format*/);
335
342
  }
336
343
 
337
344
  template <class T> btrTime atobtrt(const T* p)
@@ -354,14 +361,29 @@ btrDate atobtrd(const char* p)
354
361
  return atobtrd<char>(p);
355
362
  }
356
363
 
357
- const char* btrdtoa(const btrDate& d, char* retbuf, bool type_vb)
364
+ const char* btrdtoa(const btrDate& d, char* retbuf, bool w3_format)
365
+ {
366
+ return btrdtoa<char>(d, retbuf, w3_format);
367
+ }
368
+
369
+ const char* btrttoa(const btrTime& t, char* retbuf/*, bool w3_format*/)
358
370
  {
359
- return btrdtoa<char>(d, retbuf, type_vb);
371
+ return btrttoa<char>(t, retbuf/*, w3_format*/);
360
372
  }
361
373
 
362
- const char* btrttoa(const btrTime& t, char* retbuf, bool type_vb)
374
+ const char* btrstoa(const btrDateTime& s, char* retbuf, bool w3_format)
363
375
  {
364
- return btrttoa<char>(t, retbuf, type_vb);
376
+ char* p = retbuf;
377
+ const btrDate& d = s.date;
378
+ const btrTime& t = s.time;
379
+ if (p == NULL) p = (char*)databuf();
380
+ if (w3_format)
381
+ sprintf_s(p, 21, ("%04d-%02d-%02dT%02d:%02d:%02d"), d.yy, d.mm,
382
+ d.dd, t.hh, t.nn, t.ss);
383
+ else
384
+ sprintf_s(p, 21, ("%04d/%02d/%02d %02d:%02d:%02d"), d.yy, d.mm,
385
+ d.dd, t.hh, t.nn, t.ss);
386
+ return p;
365
387
  }
366
388
 
367
389
  btrTime atobtrt(const char* p)
@@ -370,14 +392,29 @@ btrTime atobtrt(const char* p)
370
392
  }
371
393
 
372
394
  #ifdef _WIN32
373
- const wchar_t* btrdtoa(const btrDate& d, wchar_t* retbuf, bool type_vb)
395
+ const wchar_t* btrdtoa(const btrDate& d, wchar_t* retbuf, bool w3_format)
374
396
  {
375
- return btrdtoa<wchar_t>(d, retbuf, type_vb);
397
+ return btrdtoa<wchar_t>(d, retbuf, w3_format);
376
398
  }
377
399
 
378
- const wchar_t* btrttoa(const btrTime& t, wchar_t* retbuf, bool type_vb)
400
+ const wchar_t* btrttoa(const btrTime& t, wchar_t* retbuf/*, bool w3_format*/)
379
401
  {
380
- return btrttoa<wchar_t>(t, retbuf, type_vb);
402
+ return btrttoa<wchar_t>(t, retbuf/*, w3_format*/);
403
+ }
404
+
405
+ const wchar_t* btrstoa(const btrDateTime& s, wchar_t* retbuf, bool w3_format)
406
+ {
407
+ wchar_t* p = retbuf;
408
+ const btrDate& d = s.date;
409
+ const btrTime& t = s.time;
410
+ if (p == NULL) p = (wchar_t*)databuf();
411
+ if (w3_format)
412
+ swprintf_s(p, 21, L"%04d-%02d-%02dT%02d:%02d:%02d", d.yy, d.mm,
413
+ d.dd, t.hh, t.nn, t.ss);
414
+ else
415
+ swprintf_s(p, 21, L"%04d/%02d/%02d %02d:%02d:%02d", d.yy, d.mm,
416
+ d.dd, t.hh, t.nn, t.ss);
417
+ return p;
381
418
  }
382
419
 
383
420
  btrDate atobtrd(const wchar_t* p)
@@ -392,35 +429,33 @@ btrTime atobtrt(const wchar_t* p)
392
429
 
393
430
  #endif
394
431
 
395
- const _TCHAR* btrstoa(const btrDateTime& s, _TCHAR* retbuf, bool type_vb)
432
+ btrDateTime atobtrs(const char* p)
396
433
  {
397
- _TCHAR* p = retbuf;
398
- const btrDate& d = s.date;
399
- const btrTime& t = s.time;
400
- if (p == NULL)
401
- p = databuf();
402
- ;
403
- if (type_vb)
404
- _stprintf_s(p, 21, _T("%04d-%02d-%02dT%02d:%02d:%02d"), d.yy, d.mm,
405
- d.dd, t.hh, t.nn, t.ss);
406
- else
407
- _stprintf_s(p, 21, _T("%04d/%02d/%02d %02d:%02d:%02d"), d.yy, d.mm,
408
- d.dd, t.hh, t.nn, t.ss);
409
- return p;
434
+ btrDateTime s;
435
+ s.i64 = 0;
436
+ s.date = atobtrd(p);
437
+ const char* tmp = strstr(p, "T");
438
+ if (tmp)
439
+ s.time = atobtrt(tmp + 1);
440
+ else if ((tmp = strstr(p, " ")) != NULL)
441
+ s.time = atobtrt(tmp + 1);
442
+ return s;
410
443
  }
411
444
 
412
- btrDateTime atobtrs(const _TCHAR* p)
445
+ #ifdef _WIN32
446
+ btrDateTime atobtrs(const wchar_t* p)
413
447
  {
414
448
  btrDateTime s;
415
449
  s.i64 = 0;
416
450
  s.date = atobtrd(p);
417
- const _TCHAR* tmp = _tcsstr(p, _T("T"));
451
+ const wchar_t* tmp = wcsstr(p, L"T");
418
452
  if (tmp)
419
453
  s.time = atobtrt(tmp + 1);
420
- else if ((tmp = _tcsstr(p, _T(" "))) != NULL)
454
+ else if ((tmp = wcsstr(p, L" ")) != NULL)
421
455
  s.time = atobtrt(tmp + 1);
422
456
  return s;
423
457
  }
458
+ #endif
424
459
 
425
460
  int getNowDate()
426
461
  {
@@ -18,9 +18,10 @@
18
18
  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19
19
  02111-1307, USA.
20
20
  ================================================================= */
21
-
21
+ #include <tchar.h>
22
+ #include <cstddef>
22
23
  #include <bzs/env/compiler.h>
23
- #include <bzs/env/crosscompile.h>
24
+
24
25
 
25
26
  namespace bzs
26
27
  {
@@ -151,58 +152,82 @@ public:
151
152
  PACKAGE btrDate atobtrd(const char* date);
152
153
 
153
154
  PACKAGE const char* btrdtoa(const btrDate& d, char* retbuf,
154
- bool type_vb = false);
155
+ bool w3_format = false);
155
156
 
156
- PACKAGE const char* btrttoa(const btrTime& t, char* retbuf,
157
- bool type_vb = false);
157
+ PACKAGE const char* btrttoa(const btrTime& t, char* retbuf/*,
158
+ bool w3_format = false*/);
158
159
 
159
160
  PACKAGE btrTime atobtrt(const char* p);
160
161
 
161
- inline const char* btrdtoa(int date, char* retbuf, bool type_vb = false)
162
+ PACKAGE btrDateTime atobtrs(const char* p);
163
+
164
+ PACKAGE const char* btrstoa(const btrDateTime& d, char* retbuf,
165
+ bool w3_format = false);
166
+
167
+ inline const char* btrdtoa(int date, char* retbuf, bool w3_format = false)
162
168
  {
163
169
  btrDate d;
164
170
  d.i = date;
165
- return btrdtoa(d, retbuf, type_vb);
171
+ return btrdtoa(d, retbuf, w3_format);
166
172
  }
167
173
 
168
- inline const char* btrttoa(int time, char* retbuf, bool type_vb = false)
174
+ inline const char* btrttoa(int time, char* retbuf/*, bool w3_format = false*/)
169
175
  {
170
176
  btrTime t;
171
177
  t.i = time;
172
- return btrttoa(t, retbuf, type_vb);
178
+ return btrttoa(t, retbuf/*, w3_format*/);
179
+ }
180
+
181
+ inline const char* btrstoa(__int64 datetime, char* retbuf, bool w3_format = false)
182
+ {
183
+ btrDateTime t;
184
+ t.i64 = datetime;
185
+ return btrstoa(t, retbuf, w3_format);
173
186
  }
174
187
 
188
+ #ifndef SWIG
175
189
  #ifdef _WIN32
176
190
  PACKAGE btrDate atobtrd(const wchar_t* date);
177
191
 
178
192
  PACKAGE const wchar_t* btrdtoa(const btrDate& d, wchar_t* retbuf,
179
- bool type_vb = false);
193
+ bool w3_format = false);
180
194
 
181
- PACKAGE const wchar_t* btrttoa(const btrTime& t, wchar_t* retbuf,
182
- bool type_vb = false);
195
+ PACKAGE const wchar_t* btrttoa(const btrTime& t, wchar_t* retbuf/*,
196
+ bool w3_format = false*/);
183
197
 
184
198
  PACKAGE btrTime atobtrt(const wchar_t* p);
185
199
 
186
- inline const wchar_t* btrdtoa(int date, wchar_t* retbuf, bool type_vb = false)
200
+ PACKAGE btrDateTime atobtrs(const wchar_t* p);
201
+
202
+ PACKAGE const wchar_t* btrstoa(const btrDateTime& d, wchar_t* retbuf,
203
+ bool w3_format = false);
204
+
205
+ inline const wchar_t* btrdtoa(int date, wchar_t* retbuf, bool w3_format = false)
187
206
  {
188
207
  btrDate d;
189
208
  d.i = date;
190
- return btrdtoa(d, retbuf, type_vb);
209
+ return btrdtoa(d, retbuf, w3_format);
191
210
  }
192
211
 
193
- inline const wchar_t* btrttoa(int time, wchar_t* retbuf, bool type_vb = false)
212
+ inline const wchar_t* btrttoa(int time, wchar_t* retbuf/*, bool w3_format = false*/)
194
213
  {
195
214
  btrTime t;
196
215
  t.i = time;
197
- return btrttoa(t, retbuf, type_vb);
216
+ return btrttoa(t, retbuf/*, w3_format*/);
198
217
  }
199
218
 
219
+ inline const wchar_t* btrstoa(__int64 datetime, wchar_t* retbuf, bool w3_format = false)
220
+ {
221
+ btrDateTime t;
222
+ t.i64 = datetime;
223
+ return btrstoa(t, retbuf, w3_format);
224
+ }
225
+
226
+ #endif
200
227
  #endif
201
228
 
202
- PACKAGE const _TCHAR* btrstoa(const btrDateTime& d, _TCHAR* retbuf = NULL,
203
- bool type_vb = false);
204
229
 
205
- PACKAGE btrDateTime atobtrs(const _TCHAR* p);
230
+
206
231
 
207
232
  inline const _TCHAR* c_str(const btrDate& d)
208
233
  {
@@ -214,9 +239,9 @@ inline const _TCHAR* c_str(const btrTime& d)
214
239
  return btrttoa(d, (_TCHAR*)NULL);
215
240
  }
216
241
 
217
- inline const _TCHAR* c_str(const btrDateTime& d, bool type_vb = false)
242
+ inline const _TCHAR* c_str(const btrDateTime& d, bool w3_format = false)
218
243
  {
219
- return btrstoa(d, (_TCHAR*)NULL, type_vb);
244
+ return btrstoa(d, (_TCHAR*)NULL, w3_format);
220
245
  }
221
246
 
222
247
  PACKAGE int getNowDate();
@@ -100,7 +100,7 @@ writableRecord& activeTable::getWritableRecord()
100
100
  return m_imple->getWritableRecord();
101
101
  }
102
102
 
103
- activeTable& activeTable::join(recordset& rs, queryBase& q, const _TCHAR* name1,
103
+ recordset& activeTable::join(recordset& rs, queryBase& q, const _TCHAR* name1,
104
104
  const _TCHAR* name2, const _TCHAR* name3,
105
105
  const _TCHAR* name4, const _TCHAR* name5,
106
106
  const _TCHAR* name6, const _TCHAR* name7,
@@ -108,10 +108,10 @@ activeTable& activeTable::join(recordset& rs, queryBase& q, const _TCHAR* name1,
108
108
  {
109
109
  m_imple->join(*rs.m_imple, q, name1, name2, name3, name4, name5, name6,
110
110
  name7, name8);
111
- return *this;
111
+ return rs;
112
112
  }
113
113
 
114
- activeTable& activeTable::outerJoin(recordset& rs, queryBase& q,
114
+ recordset& activeTable::outerJoin(recordset& rs, queryBase& q,
115
115
  const _TCHAR* name1, const _TCHAR* name2,
116
116
  const _TCHAR* name3, const _TCHAR* name4,
117
117
  const _TCHAR* name5, const _TCHAR* name6,
@@ -119,10 +119,10 @@ activeTable& activeTable::outerJoin(recordset& rs, queryBase& q,
119
119
  {
120
120
  m_imple->outerJoin(*rs.m_imple, q, name1, name2, name3, name4, name5, name6,
121
121
  name7, name8);
122
- return *this;
122
+ return rs;
123
123
  }
124
124
 
125
- activeTable& activeTable::join(recordset& rs, pq_handle& q, const _TCHAR* name1,
125
+ recordset& activeTable::join(recordset& rs, pq_handle& q, const _TCHAR* name1,
126
126
  const _TCHAR* name2, const _TCHAR* name3,
127
127
  const _TCHAR* name4, const _TCHAR* name5,
128
128
  const _TCHAR* name6, const _TCHAR* name7,
@@ -130,10 +130,10 @@ activeTable& activeTable::join(recordset& rs, pq_handle& q, const _TCHAR* name1,
130
130
  {
131
131
  m_imple->join(*rs.m_imple, q, name1, name2, name3, name4, name5, name6,
132
132
  name7, name8);
133
- return *this;
133
+ return rs;
134
134
  }
135
135
 
136
- activeTable& activeTable::outerJoin(recordset& rs, pq_handle& q,
136
+ recordset& activeTable::outerJoin(recordset& rs, pq_handle& q,
137
137
  const _TCHAR* name1, const _TCHAR* name2,
138
138
  const _TCHAR* name3, const _TCHAR* name4,
139
139
  const _TCHAR* name5, const _TCHAR* name6,
@@ -141,7 +141,7 @@ activeTable& activeTable::outerJoin(recordset& rs, pq_handle& q,
141
141
  {
142
142
  m_imple->outerJoin(*rs.m_imple, q, name1, name2, name3, name4, name5, name6,
143
143
  name7, name8);
144
- return *this;
144
+ return rs;
145
145
  }
146
146
 
147
147
  activeTable& activeTable::index(int v)
@@ -161,39 +161,39 @@ pq_handle activeTable::prepare(queryBase& q, bool serverPrepare)
161
161
  return m_imple->prepare(q, serverPrepare);
162
162
  }
163
163
 
164
- activeTable& activeTable::readMore(recordset& rs)
164
+ recordset& activeTable::readMore(recordset& rs)
165
165
  {
166
166
  rs.clear();
167
167
  m_imple->readMore(*rs.m_imple);
168
- return *this;
168
+ return rs;
169
169
  }
170
170
 
171
- activeTable& activeTable::read(recordset& rs, queryBase& q)
171
+ recordset& activeTable::read(recordset& rs, queryBase& q)
172
172
  {
173
173
  rs.clear();
174
174
  m_imple->read(*rs.m_imple, q);
175
- return *this;
175
+ return rs;
176
176
  }
177
177
 
178
- activeTable& activeTable::read(recordset& rs, queryBase& q, validationFunc func)
178
+ recordset& activeTable::read(recordset& rs, queryBase& q, validationFunc func)
179
179
  {
180
180
  rs.clear();
181
181
  m_imple->read(*rs.m_imple, q, func);
182
- return *this;
182
+ return rs;
183
183
  }
184
184
 
185
- activeTable& activeTable::read(recordset& rs, pq_handle& q)
185
+ recordset& activeTable::read(recordset& rs, pq_handle& q)
186
186
  {
187
187
  rs.clear();
188
188
  m_imple->read(*rs.m_imple, q);
189
- return *this;
189
+ return rs;
190
190
  }
191
191
 
192
- activeTable& activeTable::read(recordset& rs, pq_handle& q, validationFunc func)
192
+ recordset& activeTable::read(recordset& rs, pq_handle& q, validationFunc func)
193
193
  {
194
194
  rs.clear();
195
195
  m_imple->read(*rs.m_imple, q, func);
196
- return *this;
196
+ return rs;
197
197
  }
198
198
 
199
199
  activeTable* activeTable::create(idatabaseManager* mgr, const _TCHAR* tableName)