transactd 3.2.1 → 3.3.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 (44) hide show
  1. checksums.yaml +4 -4
  2. data/bin/common/{tdclc_32_3_2.dll → tdclc_32_3_3.dll} +0 -0
  3. data/bin/common/{tdclc_64_3_2.dll → tdclc_64_3_3.dll} +0 -0
  4. data/build/swig/ruby/tdclrb_wrap.cpp +117 -549
  5. data/build/tdclc/tdclc.cbproj +1 -1
  6. data/build/tdclc/tdclc.rc +4 -4
  7. data/build/tdclcpp/tdclcpp.rc +4 -4
  8. data/build/tdclcpp/tdclcpp_bc.cbproj +1 -1
  9. data/build/tdclrb/tdclrb.rc +4 -4
  10. data/source/bzs/db/IBlobBuffer.h +2 -1
  11. data/source/bzs/db/blobBuffer.h +11 -10
  12. data/source/bzs/db/engine/mysql/database.cpp +13 -25
  13. data/source/bzs/db/engine/mysql/database.h +1 -8
  14. data/source/bzs/db/engine/mysql/mysqlProtocol.cpp +85 -68
  15. data/source/bzs/db/protocol/tdap/client/connMgr.cpp +99 -2
  16. data/source/bzs/db/protocol/tdap/client/connMgr.h +28 -2
  17. data/source/bzs/db/protocol/tdap/client/nsTable.cpp +21 -2
  18. data/source/bzs/db/protocol/tdap/client/nsTable.h +2 -1
  19. data/source/bzs/db/protocol/tdap/client/serializer.cpp +2 -2
  20. data/source/bzs/db/protocol/tdap/client/table.cpp +4 -19
  21. data/source/bzs/db/protocol/tdap/client/table.h +1 -2
  22. data/source/bzs/db/protocol/tdap/client/trdboostapiInternal.h +7 -0
  23. data/source/bzs/db/protocol/tdap/myDateTime.cpp +3 -2
  24. data/source/bzs/db/protocol/tdap/mysql/tdapCommandExecuter.cpp +49 -32
  25. data/source/bzs/db/protocol/tdap/mysql/tdapCommandExecuter.h +8 -6
  26. data/source/bzs/db/protocol/tdap/tdapSchema.h +9 -5
  27. data/source/bzs/db/protocol/tdap/tdapcapi.h +15 -5
  28. data/source/bzs/db/transactd/connManager.cpp +32 -8
  29. data/source/bzs/db/transactd/connManager.h +3 -2
  30. data/source/bzs/db/transactd/connectionRecord.h +37 -9
  31. data/source/bzs/db/transactd/transactd.cpp +21 -3
  32. data/source/bzs/test/tdclatl/test_v3.js +14 -3
  33. data/source/bzs/test/tdclphp/transactd_Test.php +3 -1
  34. data/source/bzs/test/tdclphp/transactd_v3_Test.php +11 -2
  35. data/source/bzs/test/tdclrb/transactd_spec.rb +3 -1
  36. data/source/bzs/test/tdclrb/transactd_v3_spec.rb +11 -1
  37. data/source/bzs/test/trdclengn/test_trdclengn.cpp +3 -1
  38. data/source/global/tdclatl/ConnMgr.cpp +20 -0
  39. data/source/global/tdclatl/ConnMgr.h +2 -0
  40. data/source/global/tdclatl/ConnRecord.cpp +13 -5
  41. data/source/global/tdclatl/ConnRecord.h +1 -0
  42. data/source/global/tdclatl/ConnRecords.h +2 -1
  43. data/source/global/tdclatl/tdclatl.idl +7 -0
  44. metadata +4 -4
@@ -54,6 +54,17 @@ static const _TCHAR* SYSVAR_NAME[TD_VAR_SIZE] =
54
54
  _T("timestamp_always)")
55
55
  };
56
56
 
57
+ static const _TCHAR* STATUSVAR_NAME[TD_VAR_SIZE] =
58
+ {
59
+ _T("tcp_connections"),
60
+ _T("tcp_wait_threads"),
61
+ _T("tpool_connections"),
62
+ _T("tpool_threads"),
63
+ _T("pipe_connections"),
64
+ _T("pipe_wait_threads"),
65
+ _T("cur_open_databases"),
66
+ };
67
+
57
68
  static const _TCHAR* SLAVE_STATUS_NAME[SLAVE_STATUS_DEFAULT_SIZE] =
58
69
  {
59
70
  _T("Slave_IO_State"),
@@ -98,6 +109,55 @@ static const _TCHAR* SLAVE_STATUS_NAME[SLAVE_STATUS_DEFAULT_SIZE] =
98
109
  _T("Master_Server_Id" ),
99
110
  };
100
111
 
112
+
113
+ class stringBuffer
114
+ {
115
+ friend class connMgr;
116
+ std::vector<char> m_buf;
117
+ public:
118
+ inline void resize(size_t size) { m_buf.resize(size); }
119
+ inline char* ptr() { return &m_buf[0]; }
120
+ inline size_t size() const { return m_buf.size(); }
121
+ };
122
+
123
+ //-----------------------------------------------------------------------------
124
+ // class connRecords
125
+ //-----------------------------------------------------------------------------
126
+ connRecords::connRecords(){}
127
+
128
+ connRecords::connRecords(const connRecords& r) :
129
+ m_records(r.m_records), m_buf(r.m_buf) {}
130
+
131
+ connRecords& connRecords::operator=(const connRecords& r)
132
+ {
133
+ if (this != &r)
134
+ {
135
+ m_records = r.m_records;
136
+ m_buf = r.m_buf;
137
+ }
138
+ return *this;
139
+ }
140
+
141
+ void connRecords::clear() { m_records.clear(); m_buf.reset(); }
142
+
143
+ const connRecords::record& connRecords::operator[] (int index) const
144
+ {
145
+ return m_records[index];
146
+ }
147
+
148
+ connRecords::record& connRecords::operator[] (int index)
149
+ {
150
+ return m_records[index];
151
+ }
152
+
153
+ size_t connRecords::size() const { return m_records.size(); }
154
+
155
+ connRecords* connRecords::create(){ return new connRecords();}
156
+
157
+ void connRecords::release(){ delete this;}
158
+
159
+ //-----------------------------------------------------------------------------
160
+
101
161
  #pragma pack(push, 1)
102
162
  pragma_pack1
103
163
  struct oldRrecord
@@ -271,6 +331,26 @@ const connMgr::records& connMgr::schemaTables(const _TCHAR* dbname)
271
331
  return doDefinedTables(dbname, TD_STSTCS_SCHEMA_TABLE_LIST);
272
332
  }
273
333
 
334
+ void connMgr::setBlobFieldPointer(const blobHeader* hd)
335
+ {
336
+ if (!hd) return;
337
+ assert(hd->curRow < hd->rows);
338
+ m_records.m_buf.reset(new stringBuffer());
339
+ m_records.m_buf->resize(hd->dataSize + 100);
340
+ const blobField* f = hd->nextField;
341
+
342
+ char* p = m_records.m_buf->ptr();
343
+ for (int i = 0; i < hd->fieldCount; ++i)
344
+ {
345
+ memcpy(p, f->data(), f->size);
346
+ m_records[f->fieldNum].longValue = (__int64)p;
347
+ p += f->size;
348
+ *p = 0x00;
349
+ ++p;
350
+ f = f->next();
351
+ }
352
+ }
353
+
274
354
  const connMgr::records& connMgr::slaveStatus()
275
355
  {
276
356
  if ((m_pluginVer.majorVersion >= 3) && (m_pluginVer.minorVersion >= 2))
@@ -280,8 +360,11 @@ const connMgr::records& connMgr::slaveStatus()
280
360
  getRecords();
281
361
  if (m_records.size() > SLAVE_STATUS_DEFAULT_SIZE)
282
362
  m_records.resize(SLAVE_STATUS_DEFAULT_SIZE);
363
+
364
+ // set blob pointers
365
+ setBlobFieldPointer(getBlobHeader());
283
366
  return m_records;
284
- }
367
+ }
285
368
  m_stat = STATUS_NOSUPPORT_OP;
286
369
  m_records.resize(0);
287
370
  return m_records;
@@ -294,6 +377,13 @@ const connMgr::records& connMgr::sysvars()
294
377
  return getRecords();
295
378
  }
296
379
 
380
+ const connMgr::records& connMgr::statusvars()
381
+ {
382
+ m_keynum = TD_STSTCS_STATUS_VARIABLES;
383
+ allocBuffer();
384
+ return getRecords();
385
+ }
386
+
297
387
  const connMgr::records& connMgr::connections()
298
388
  {
299
389
  m_keynum = TD_STSTCS_READ;
@@ -352,7 +442,7 @@ void connMgr::removeSystemDb(connMgr::records& recs)
352
442
  (strcmp(recs[i].name, "performance_schema")==0) ||
353
443
  (strcmp(recs[i].name, "information_schema")==0) ||
354
444
  (strcmp(recs[i].name, "sys")==0))
355
- recs.erase(recs.begin() + i);
445
+ recs.erase(/*recs.begin() +*/ i);
356
446
  }
357
447
  }
358
448
 
@@ -363,6 +453,13 @@ const _TCHAR* connMgr::sysvarName(uint_td index)
363
453
  return _T("");
364
454
  }
365
455
 
456
+ const _TCHAR* connMgr::statusvarName(uint_td index)
457
+ {
458
+ if (index < TD_SVAR_SIZE)
459
+ return STATUSVAR_NAME[index];
460
+ return _T("");
461
+ }
462
+
366
463
  const _TCHAR* connMgr::slaveStatusName(uint_td index)
367
464
  {
368
465
  if (index < SLAVE_STATUS_DEFAULT_SIZE)
@@ -37,15 +37,38 @@ namespace client
37
37
 
38
38
  class database;
39
39
  class connMgr;
40
+ class stringBuffer;
40
41
  typedef boost::shared_ptr<connMgr> connMgr_ptr;
41
42
 
43
+ class DLLLIB connRecords
44
+ {
45
+ typedef bzs::db::transactd::connection::record record;
46
+ friend class connMgr;
47
+ std::vector<record> m_records;
48
+ boost::shared_ptr<stringBuffer> m_buf;
49
+ inline void resize(size_t size) { m_records.resize(size); }
50
+ inline void erase(size_t index) { m_records.erase(m_records.begin() + index); }
51
+
52
+ public:
53
+ connRecords();
54
+ connRecords(const connRecords& r);
55
+ connRecords& operator=(const connRecords& r);
56
+ const record& operator[] (int index) const;
57
+ record& operator[] (int index);
58
+ size_t size() const;
59
+ void clear();
60
+ void release();
61
+ static connRecords* create();
62
+ };
63
+
42
64
  class DLLLIB connMgr : private nstable // no copyable
43
65
  {
66
+
44
67
  public:
45
68
  typedef bzs::db::transactd::connection::record record;
46
- typedef std::vector<record> records;
69
+ typedef connRecords records;
47
70
  private:
48
- std::vector<record> m_records;
71
+ connMgr::records m_records;
49
72
  __int64 m_params[2];
50
73
  database* m_db;
51
74
  std::_tstring m_uri;
@@ -59,6 +82,7 @@ private:
59
82
  explicit connMgr(const connMgr& r); //no copyable
60
83
  connMgr& operator=(const connMgr& r); //no copyable
61
84
  const connMgr::records& doDefinedTables(const _TCHAR* dbname, int type);
85
+ void setBlobFieldPointer(const bzs::db::blobHeader* bd);
62
86
  explicit connMgr(database* db);
63
87
 
64
88
  public:
@@ -71,6 +95,7 @@ public:
71
95
  const records& schemaTables(const _TCHAR* dbname);
72
96
  const records& slaveStatus();
73
97
  const records& sysvars();
98
+ const records& statusvars();
74
99
  const records& connections();
75
100
  const records& inUseDatabases(__int64 connid);
76
101
  const records& inUseTables(__int64 connid, int dbid);
@@ -82,6 +107,7 @@ public:
82
107
  using nstable::release;
83
108
  static void removeSystemDb(records& recs);
84
109
  static const _TCHAR* sysvarName(uint_td index);
110
+ static const _TCHAR* statusvarName(uint_td index);
85
111
  static const _TCHAR* slaveStatusName(uint_td index);
86
112
  static connMgr* create(database* db);
87
113
  };
@@ -1,5 +1,5 @@
1
1
  /* =================================================================
2
- Copyright (C) 2000-2013 BizStation Corp All rights reserved.
2
+ Copyright (C) 2000-2016 BizStation Corp All rights reserved.
3
3
 
4
4
  This program is free software; you can redistribute it and/or
5
5
  modify it under the terms of the GNU General Public License
@@ -861,6 +861,23 @@ void nstable::dropIndex(bool NoRenumber)
861
861
  m_keynum -= ((uchar_td)0x80);
862
862
  }
863
863
 
864
+ const blobHeader* nstable::getBlobHeader()
865
+ {
866
+ short stat = m_stat;
867
+ const blobHeader* p;
868
+ /*backup current data buffer*/
869
+ const void* tmp = data();
870
+ setData(&p);
871
+ tdap(TD_GET_BLOB_BUF);
872
+ /*restore data buffer*/
873
+ setData((void*)tmp);
874
+ std::swap(stat, m_stat);
875
+
876
+ if (stat)
877
+ return NULL;
878
+ return p;
879
+ }
880
+
864
881
  short_td nstable::doBtrvErr(HWND hWnd, _TCHAR* retbuf)
865
882
  {
866
883
  return tdapErr(hWnd, m_stat, m_impl->uri, retbuf);
@@ -976,6 +993,7 @@ void nstable::throwError(const _TCHAR* caption, nstable* tb)
976
993
  THROW_BZS_ERROR_WITH_CODEMSG(tb->stat(), tmp2);
977
994
  }
978
995
 
996
+ #pragma warn -8060
979
997
  _TCHAR* nstable::getDirURI(const _TCHAR* path, _TCHAR* buf)
980
998
  {
981
999
  bool uri = false;
@@ -990,7 +1008,7 @@ _TCHAR* nstable::getDirURI(const _TCHAR* path, _TCHAR* buf)
990
1008
  _TUCHAR* p = _tcsmrchr((_TUCHAR*)buf, '=');
991
1009
  if (p)
992
1010
  *(p+1) = 0x00;
993
- else if (p = _tcsmrchr((_TUCHAR*)buf, '?'))
1011
+ else if ((p = _tcsmrchr((_TUCHAR*)buf, '?')))
994
1012
  *p = 0x00;
995
1013
  else if ((p = _tcsmrchr((_TUCHAR*)buf, PSEPARATOR_C)) && (uri == false))
996
1014
  *p = 0x00;
@@ -1005,6 +1023,7 @@ _TCHAR* nstable::getDirURI(const _TCHAR* path, _TCHAR* buf)
1005
1023
  }
1006
1024
  return buf;
1007
1025
  }
1026
+ #pragma warn .8060
1008
1027
 
1009
1028
  /* Get file name from full path name.
1010
1029
  *
@@ -1,7 +1,7 @@
1
1
  #ifndef BZS_DB_PROTOCOL_TDAP_CLIENT_NSTABLE_H
2
2
  #define BZS_DB_PROTOCOL_TDAP_CLIENT_NSTABLE_H
3
3
  /* =================================================================
4
- Copyright (C) 2000-2013 BizStation Corp All rights reserved.
4
+ Copyright (C) 2000-2016 BizStation Corp All rights reserved.
5
5
 
6
6
  This program is free software; you can redistribute it and/or
7
7
  modify it under the terms of the GNU General Public License
@@ -144,6 +144,7 @@ protected:
144
144
  void destroy();
145
145
  void setShared();
146
146
  void seekByBookmark(bookmark_td* bm, ushort_td lockBias = LOCK_BIAS_DEFAULT);
147
+ const bzs::db::blobHeader* getBlobHeader();
147
148
  public:
148
149
  explicit nstable(nsdatabase* pbe);
149
150
  void addref(void);
@@ -1,5 +1,5 @@
1
1
  /*=================================================================
2
- Copyright (C) 2014 BizStation Corp All rights reserved.
2
+ Copyright (C) 2014-2016 BizStation Corp All rights reserved.
3
3
 
4
4
  This program is free software; you can redistribute it and/or
5
5
  modify it under the terms of the GNU General Public License
@@ -130,7 +130,7 @@ void serializeExecutable(Archive& ar, executable& exec, const unsigned int versi
130
130
  int v = (int)exec.isEnabled();
131
131
  ar& make_nvp("enabled", v);
132
132
  if (Archive::is_loading::value)
133
- exec.setEnabled(v);
133
+ exec.setEnabled(v != 0);
134
134
  }
135
135
  }
136
136
 
@@ -1,5 +1,5 @@
1
1
  /* =================================================================
2
- Copyright (C) 2000-2013 BizStation Corp All rights reserved.
2
+ Copyright (C) 2000-2016 BizStation Corp All rights reserved.
3
3
 
4
4
  This program is free software; you can redistribute it and/or
5
5
  modify it under the terms of the GNU General Public License
@@ -731,11 +731,11 @@ uint_td table::doRecordCount(bool estimate, bool fromCurrent)
731
731
  seekByBookmark(bm);
732
732
  m_impl->exBookMarking = false;
733
733
  m_stat = tmpStat;
734
- if (m_stat == STATUS_EOF)
735
- m_stat = 0;
736
734
  }
737
735
  else
738
- return nstable::doRecordCount(estimate, fromCurrent);
736
+ result = nstable::doRecordCount(estimate, fromCurrent);
737
+ if (m_stat == STATUS_EOF)
738
+ m_stat = 0;
739
739
 
740
740
  return result;
741
741
  }
@@ -1617,22 +1617,7 @@ void table::addSendBlob(const blob* blob)
1617
1617
  m_stat = stat;
1618
1618
  }
1619
1619
 
1620
- const blobHeader* table::getBlobHeader()
1621
- {
1622
- short stat = m_stat;
1623
- const blobHeader* p;
1624
- /*backup current data buffer*/
1625
- const void* tmp = data();
1626
- setData(&p);
1627
- tdap(TD_GET_BLOB_BUF);
1628
- /*restore data buffer*/
1629
- setData((void*)tmp);
1630
- std::swap(stat, m_stat);
1631
1620
 
1632
- if (stat)
1633
- return NULL;
1634
- return p;
1635
- }
1636
1621
 
1637
1622
  unsigned char* table::setBlobFieldPointer(char* ptr, const blobHeader* hd, unsigned char* to)
1638
1623
  {
@@ -1,7 +1,7 @@
1
1
  #ifndef BZS_DB_PROTOCOL_TDAP_CLIENT_TABLE_H
2
2
  #define BZS_DB_PROTOCOL_TDAP_CLIENT_TABLE_H
3
3
  /* =================================================================
4
- Copyright (C) 2000-2013 BizStation Corp All rights reserved.
4
+ Copyright (C) 2000-2016 BizStation Corp All rights reserved.
5
5
 
6
6
  This program is free software; you can redistribute it and/or
7
7
  modify it under the terms of the GNU General Public License
@@ -106,7 +106,6 @@ class DLLLIB table : public nstable
106
106
  uchar_td charset() const;
107
107
  bool checkIndex(short index) const;
108
108
  void getKeySpec(keySpec* ks, bool SpecifyKeyNum = false);
109
- const bzs::db::blobHeader* getBlobHeader();
110
109
  unsigned char* setBlobFieldPointer(char* ptr, const ::bzs::db::blobHeader* p,
111
110
  unsigned char* to=NULL);
112
111
  void addSendBlob(const bzs::db::blob* blob);
@@ -53,6 +53,13 @@ inline static void readStatusCheck(table& tb, const _TCHAR* name)
53
53
  nstable::throwError(name, tb.stat());
54
54
  }
55
55
 
56
+ template <class T>
57
+ void validateStatus(const T& obj, const _TCHAR* caption)
58
+ {
59
+ if (obj->stat())
60
+ nstable::throwError(caption, obj->stat());
61
+ }
62
+
56
63
  class indexNavi
57
64
  {
58
65
 
@@ -1,5 +1,5 @@
1
1
  /*=================================================================
2
- Copyright (C) 2013 BizStation Corp All rights reserved.
2
+ Copyright (C) 2013-2016 BizStation Corp All rights reserved.
3
3
 
4
4
  This program is free software; you can redistribute it and/or
5
5
  modify it under the terms of the GNU General Public License
@@ -34,6 +34,7 @@ namespace protocol
34
34
  namespace tdap
35
35
  {
36
36
  #pragma warning(disable : 4996)
37
+ #pragma warn -8056
37
38
  #ifdef _WIN32
38
39
  const wchar_t wtime_format_ms[] = L"%02d:%02d:%02d.%0*u";
39
40
  const wchar_t wtime_format[] = L"%02d:%02d:%02d";
@@ -913,7 +914,7 @@ wchar_t* myTimeStamp::timeStr(wchar_t* p, size_t size) const
913
914
 
914
915
 
915
916
  #pragma warning(default : 4996)
916
-
917
+ #pragma warn .8056
917
918
 
918
919
  } // namespace tdap
919
920
  } // namespace protocol
@@ -1,5 +1,5 @@
1
1
  /*=================================================================
2
- Copyright (C) 2012 2013 BizStation Corp All rights reserved.
2
+ Copyright (C) 2012-2016 BizStation Corp All rights reserved.
3
3
 
4
4
  This program is free software; you can redistribute it and/or
5
5
  modify it under the terms of the GNU General Public License
@@ -16,7 +16,6 @@
16
16
  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
17
17
  02111-1307, USA.
18
18
  =================================================================*/
19
-
20
19
  #include "tdapCommandExecuter.h"
21
20
  #include "recordsetReader.h"
22
21
  #include <bzs/db/blobBuffer.h>
@@ -102,10 +101,10 @@ std::string getDatabaseName(const request& req, bool forSql)
102
101
  {
103
102
  std::vector<std::string> ssc;
104
103
  std::vector<std::string> ss;
105
- const char* p = (const char*)req.keybuf;
106
- if (p && p[0])
104
+ const char* p = (const char*)req.keybuf;
105
+ if (p && p[0])
107
106
  {
108
- std::string s(p);
107
+ std::string s(p);
109
108
  split(ssc, s, "\t");
110
109
  if (ssc.size())
111
110
  {
@@ -287,17 +286,17 @@ std::string dbExecuter::makeSQLcreateTable(const request& req)
287
286
  bool isMetaDb(const request& req)
288
287
  {
289
288
  char buf[MAX_PATH];
290
- const char* p = (const char*)req.keybuf;
291
- char_m* st = NULL;
292
- if (p && p[0])
293
- {
294
- strncpy(buf, p, MAX_PATH);
295
- _strlwr(buf);
296
- st = _mbsstr((char_m*)buf, (char_m*)BdfNameTitle);
297
- if (st == NULL)
298
- st = (char_m*)strstr(buf, TRANSACTD_SCHEMANAME);
299
- }
300
- return (st != NULL);
289
+ const char* p = (const char*)req.keybuf;
290
+ char_m* st = NULL;
291
+ if (p && p[0])
292
+ {
293
+ strncpy(buf, p, MAX_PATH);
294
+ _strlwr(buf);
295
+ st = _mbsstr((char_m*)buf, (char_m*)BdfNameTitle);
296
+ if (st == NULL)
297
+ st = (char_m*)strstr(buf, TRANSACTD_SCHEMANAME);
298
+ }
299
+ return (st != NULL);
301
300
  }
302
301
 
303
302
  inline bool getUserPasswd(request& req, char* &user, char* &pwd)
@@ -429,7 +428,7 @@ inline bool dbExecuter::doCreateTable(request& req)
429
428
  {
430
429
  if (req.result == 0)
431
430
  {
432
- std::string dbname = db->name();
431
+ std::string dbname = db->name();
433
432
  dbManager::releaseDatabase(req.cid);
434
433
  req.result = ddl_dropDataBase(dbname, dbSqlname, req.cid);
435
434
  if (ER_DB_DROP_EXISTS+ MYSQL_ERROR_OFFSET == req.result) req.result = 0;
@@ -1087,7 +1086,7 @@ inline void dbExecuter::doInsertBulk(request& req)
1087
1086
  smartBulkInsert sbi(m_tb, *n);
1088
1087
  for (ushort_td i = 0; i < *n; i++)
1089
1088
  {
1090
- ushort_td len = *((ushort_td*)pos);
1089
+ ushort_td len = *((ushort_td*)pos);
1091
1090
  if (pos + len > (const uchar*)req.data + *req.datalen)
1092
1091
  {
1093
1092
  ret = STATUS_BUFFERTOOSMALL;
@@ -1136,7 +1135,7 @@ inline void dbExecuter::doGetSchema(request& req, netsvc::server::netWriter* nw)
1136
1135
  THD* thd = db->thd();
1137
1136
  std::string name = getTableName(req);
1138
1137
  tables.init_one_table(dbname.c_str(), dbname.size(), name.c_str(),
1139
- name.size(), name.c_str(), TL_READ);
1138
+ name.size(), name.c_str(), TL_READ);
1140
1139
  uint key_length= cp_get_table_def_key(thd, &tables, &keyPtr);
1141
1140
  if (!cp_tdc_open_view(thd, &tables, name.c_str(), key, key_length, OPEN_VIEW_NO_PARSE))
1142
1141
  {
@@ -1159,7 +1158,7 @@ inline void dbExecuter::doGetSchema(request& req, netsvc::server::netWriter* nw)
1159
1158
  String s;
1160
1159
  m_tb = getTable(req.pbk->handle);
1161
1160
  m_tb->getCreateSql(&s);
1162
- unsigned int len = (unsigned int)s.length();
1161
+ unsigned int len = (unsigned int)s.length();
1163
1162
  if (len+1 <= *req.datalen)
1164
1163
  {
1165
1164
  char* p = nw->curPtr() - sizeof(unsigned short);// orver write row space
@@ -1768,11 +1767,11 @@ int dbExecuter::commandExec(request& req, netsvc::server::netWriter* nw)
1768
1767
 
1769
1768
  void makeRandomKey(unsigned char *buf, unsigned int size)
1770
1769
  {
1771
- unsigned char *end= buf + size;
1772
- std::random_device rnd;
1773
- for (; buf < end; buf++)
1774
- *buf = (unsigned char)(rnd() * 94 + 33);
1775
- *buf= 0x00;
1770
+ unsigned char *end= buf + size;
1771
+ std::random_device rnd;
1772
+ for (; buf < end; buf++)
1773
+ *buf = (unsigned char)(rnd() * 94 + 33);
1774
+ *buf= 0x00;
1776
1775
  }
1777
1776
 
1778
1777
  size_t dbExecuter::getAcceptMessage(char* message, size_t size)
@@ -1818,15 +1817,19 @@ size_t dbExecuter::getAcceptMessage(char* message, size_t size)
1818
1817
  // ---------------------------------------------------------------------------
1819
1818
  // class connMgrExecuter
1820
1819
  // ---------------------------------------------------------------------------
1821
- connMgrExecuter::connMgrExecuter(request& req, unsigned __int64 parent)
1822
- : m_req(req), m_modHandle(parent)
1820
+ connMgrExecuter::connMgrExecuter(request& req, unsigned __int64 parent, blobBuffer* bb)
1821
+ : m_req(req), m_modHandle(parent), m_blobBuffer(bb)
1823
1822
  {
1823
+ m_blobBuffer->clear();
1824
1824
  }
1825
1825
 
1826
- int serialize(request& req, char* buf, size_t& size, const connection::records& records, short stat)
1826
+ int serialize(request& req, char* buf, size_t& size, const connection::records& records, short stat
1827
+ , blobBuffer* bb = NULL)
1827
1828
  {
1828
1829
  req.reset();
1829
1830
  req.paramMask = P_MASK_DATA | P_MASK_DATALEN | P_MASK_KEYBUF;
1831
+ if (bb && bb->fieldCount())
1832
+ req.paramMask |= P_MASK_BLOBBODY;
1830
1833
  if (records.size())
1831
1834
  req.data = (void*)&records[0];
1832
1835
  else
@@ -1862,6 +1865,13 @@ int connMgrExecuter::systemVariables(char* buf, size_t& size)
1862
1865
  return serialize(m_req, buf, size, records, st.stat());
1863
1866
  }
1864
1867
 
1868
+ int connMgrExecuter::statusVariables(char* buf, size_t& size)
1869
+ {
1870
+ connManager st(m_modHandle);
1871
+ const connection::records& records = st.statusVariables();
1872
+ return serialize(m_req, buf, size, records, st.stat());
1873
+ }
1874
+
1865
1875
  int connMgrExecuter::schemaTables(char* buf, size_t& size)
1866
1876
  {
1867
1877
  connManager st(m_modHandle);
@@ -1883,11 +1893,16 @@ int connMgrExecuter::definedViews(char* buf, size_t& size)
1883
1893
  return serialize(m_req, buf, size, records, st.stat());
1884
1894
  }
1885
1895
 
1886
- int connMgrExecuter::slaveStatus(char* buf, size_t& size)
1896
+ int connMgrExecuter::slaveStatus(netsvc::server::netWriter* nw)
1887
1897
  {
1888
1898
  connManager st(m_modHandle);
1889
- const connection::records& records = st.readSlaveStatus();
1890
- return serialize(m_req, buf, size, records, st.stat());
1899
+ const connection::records& records = st.readSlaveStatus(m_blobBuffer);
1900
+ int v = serialize(m_req, nw->ptr(), nw->datalen, records, st.stat(), m_blobBuffer);
1901
+ short dymmy = 0;
1902
+ if ((m_req.result == 0) && m_blobBuffer->fieldCount())
1903
+ nw->datalen = m_req.serializeBlobBody(m_blobBuffer, nw->ptr(), nw->datalen,
1904
+ FILE_MAP_SIZE, nw->optionalData(), dymmy);
1905
+ return v;
1891
1906
  }
1892
1907
 
1893
1908
  int connMgrExecuter::disconnectOne(char* buf, size_t& size)
@@ -1926,6 +1941,8 @@ int connMgrExecuter::commandExec(netsvc::server::netWriter* nw)
1926
1941
  return definedDatabases(nw->ptr(), nw->datalen);
1927
1942
  case TD_STSTCS_SYSTEM_VARIABLES:
1928
1943
  return systemVariables(nw->ptr(), nw->datalen);
1944
+ case TD_STSTCS_STATUS_VARIABLES:
1945
+ return statusVariables(nw->ptr(), nw->datalen);
1929
1946
  case TD_STSTCS_SCHEMA_TABLE_LIST:
1930
1947
  return schemaTables(nw->ptr(), nw->datalen);
1931
1948
  case TD_STSTCS_TABLE_LIST:
@@ -1933,7 +1950,7 @@ int connMgrExecuter::commandExec(netsvc::server::netWriter* nw)
1933
1950
  case TD_STSTCS_VIEW_LIST:
1934
1951
  return definedViews(nw->ptr(), nw->datalen);
1935
1952
  case TD_STSTCS_SLAVE_STATUS:
1936
- return slaveStatus(nw->ptr(), nw->datalen);
1953
+ return slaveStatus(nw);
1937
1954
  default:
1938
1955
  m_req.reset();
1939
1956
  m_req.result = STATUS_NOSUPPORT_OP;