|
@@ -28,6 +28,7 @@
|
|
|
#include "mysql_conn.h"
|
|
|
#include "mysql_conn_pool.h"
|
|
|
#include "orm_cache.hpp"
|
|
|
+#include "mysql_connect_mar.h"
|
|
|
/*baseincludefile*/
|
|
|
namespace orm
|
|
|
{
|
|
@@ -168,10 +169,21 @@ namespace orm
|
|
|
{
|
|
|
n = conn->read_loop();
|
|
|
offset = 0;
|
|
|
+ if(n==0)
|
|
|
+ {
|
|
|
+ error_msg = conn->error_msg;
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
for (; offset < n;)
|
|
|
{
|
|
|
conn->read_field_pack(conn->_cache_data, n, offset, temp_pack_data);
|
|
|
- if (temp_pack_data.length == temp_pack_data.current_length)
|
|
|
+ if(temp_pack_data.error > 0)
|
|
|
+ {
|
|
|
+ iserror = true;
|
|
|
+ error_msg =temp_pack_data.data;
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ if (temp_pack_data.length == temp_pack_data.current_length && temp_pack_data.current_length > 0)
|
|
|
{
|
|
|
if (conn->pack_eof_check(temp_pack_data))
|
|
|
{
|
|
@@ -371,10 +383,20 @@ namespace orm
|
|
|
{
|
|
|
n = co_await conn->async_read_loop();
|
|
|
offset = 0;
|
|
|
+ if (n==0)
|
|
|
+ {
|
|
|
+ co_return 0;
|
|
|
+ }
|
|
|
for (; offset < n;)
|
|
|
{
|
|
|
conn->read_field_pack(conn->_cache_data, n, offset, temp_pack_data);
|
|
|
- if (temp_pack_data.length == temp_pack_data.current_length)
|
|
|
+ if(temp_pack_data.error > 0)
|
|
|
+ {
|
|
|
+ iserror = true;
|
|
|
+ error_msg =temp_pack_data.data;
|
|
|
+ co_return 0;
|
|
|
+ }
|
|
|
+ if (temp_pack_data.length == temp_pack_data.current_length && temp_pack_data.current_length > 0)
|
|
|
{
|
|
|
if (conn->pack_eof_check(temp_pack_data))
|
|
|
{
|
|
@@ -601,7 +623,11 @@ namespace orm
|
|
|
|
|
|
unsigned int offset = 0;
|
|
|
n = conn->read_loop();
|
|
|
-
|
|
|
+ if(n==0)
|
|
|
+ {
|
|
|
+ error_msg = conn->error_msg;
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
pack_info_t temp_pack_data;
|
|
|
temp_pack_data.seq_id = 1;
|
|
|
conn->read_field_pack(conn->_cache_data, n, offset, temp_pack_data);
|
|
@@ -730,7 +756,10 @@ namespace orm
|
|
|
|
|
|
unsigned int offset = 0;
|
|
|
n = co_await conn->async_read_loop();
|
|
|
-
|
|
|
+ if (n==0)
|
|
|
+ {
|
|
|
+ co_return 0;
|
|
|
+ }
|
|
|
pack_info_t temp_pack_data;
|
|
|
temp_pack_data.seq_id = 1;
|
|
|
conn->read_field_pack(conn->_cache_data, n, offset, temp_pack_data);
|
|
@@ -848,7 +877,11 @@ namespace orm
|
|
|
|
|
|
unsigned int offset = 0;
|
|
|
n = conn->read_loop();
|
|
|
-
|
|
|
+ if(n==0)
|
|
|
+ {
|
|
|
+ error_msg = conn->error_msg;
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
pack_info_t temp_pack_data;
|
|
|
temp_pack_data.seq_id = 1;
|
|
|
conn->read_field_pack(conn->_cache_data, n, offset, temp_pack_data);
|
|
@@ -4907,10 +4940,21 @@ M_MODEL& or_leRandomnumber(T val)
|
|
|
{
|
|
|
n = conn->read_loop();
|
|
|
offset = 0;
|
|
|
+ if(n==0)
|
|
|
+ {
|
|
|
+ error_msg = conn->error_msg;
|
|
|
+ return temprecord;
|
|
|
+ }
|
|
|
for (; offset < n;)
|
|
|
{
|
|
|
conn->read_field_pack(conn->_cache_data, n, offset, temp_pack_data);
|
|
|
- if (temp_pack_data.length == temp_pack_data.current_length)
|
|
|
+ if(temp_pack_data.error > 0)
|
|
|
+ {
|
|
|
+ iserror = true;
|
|
|
+ error_msg =temp_pack_data.data;
|
|
|
+ return temprecord;
|
|
|
+ }
|
|
|
+ if (temp_pack_data.length == temp_pack_data.current_length && temp_pack_data.current_length > 0)
|
|
|
{
|
|
|
if (conn->pack_eof_check(temp_pack_data))
|
|
|
{
|
|
@@ -5122,10 +5166,21 @@ M_MODEL& or_leRandomnumber(T val)
|
|
|
{
|
|
|
n = conn->read_loop();
|
|
|
offset = 0;
|
|
|
+ if(n==0)
|
|
|
+ {
|
|
|
+ error_msg = conn->error_msg;
|
|
|
+ return std::make_tuple(table_fieldname, table_fieldmap, temprecord);
|
|
|
+ }
|
|
|
for (; offset < n;)
|
|
|
{
|
|
|
conn->read_field_pack(conn->_cache_data, n, offset, temp_pack_data);
|
|
|
- if (temp_pack_data.length == temp_pack_data.current_length)
|
|
|
+ if(temp_pack_data.error > 0)
|
|
|
+ {
|
|
|
+ iserror = true;
|
|
|
+ error_msg =temp_pack_data.data;
|
|
|
+ return std::make_tuple(table_fieldname, table_fieldmap, temprecord);
|
|
|
+ }
|
|
|
+ if (temp_pack_data.length == temp_pack_data.current_length && temp_pack_data.current_length > 0)
|
|
|
{
|
|
|
if (conn->pack_eof_check(temp_pack_data))
|
|
|
{
|
|
@@ -5295,26 +5350,33 @@ M_MODEL& or_leRandomnumber(T val)
|
|
|
return *mod;
|
|
|
}
|
|
|
auto conn = conn_obj->get_select_conn();
|
|
|
+
|
|
|
+ std::size_t n = conn->write_sql(sqlstring);
|
|
|
+ if(n==0)
|
|
|
+ {
|
|
|
+ error_msg = conn->error_msg;
|
|
|
+ return *mod;
|
|
|
+ }
|
|
|
|
|
|
- unsigned int querysql_len = sqlstring.length() + 1;
|
|
|
+ //unsigned int querysql_len = sqlstring.length() + 1;
|
|
|
|
|
|
- conn->send_data.clear();
|
|
|
+ // conn->send_data.clear();
|
|
|
|
|
|
- conn->send_data.push_back((querysql_len & 0xFF));
|
|
|
- conn->send_data.push_back((querysql_len >> 8 & 0xFF));
|
|
|
- conn->send_data.push_back((querysql_len >> 16 & 0xFF));
|
|
|
- conn->send_data.push_back(0x00);
|
|
|
- conn->send_data.push_back(0x03);
|
|
|
- conn->send_data.append(sqlstring);
|
|
|
+ // conn->send_data.push_back((querysql_len & 0xFF));
|
|
|
+ // conn->send_data.push_back((querysql_len >> 8 & 0xFF));
|
|
|
+ // conn->send_data.push_back((querysql_len >> 16 & 0xFF));
|
|
|
+ // conn->send_data.push_back(0x00);
|
|
|
+ // conn->send_data.push_back(0x03);
|
|
|
+ // conn->send_data.append(sqlstring);
|
|
|
|
|
|
- std::size_t n = asio::write(*conn->socket, asio::buffer(conn->send_data), conn->ec);
|
|
|
+ // std::size_t n = asio::write(*conn->socket, asio::buffer(conn->send_data), conn->ec);
|
|
|
|
|
|
- if(conn->ec)
|
|
|
- {
|
|
|
- error_msg = conn->ec.message();
|
|
|
- iserror = true;
|
|
|
- return *mod;
|
|
|
- }
|
|
|
+ // if(conn->ec)
|
|
|
+ // {
|
|
|
+ // error_msg = conn->ec.message();
|
|
|
+ // iserror = true;
|
|
|
+ // return *mod;
|
|
|
+ // }
|
|
|
|
|
|
pack_info_t temp_pack_data;
|
|
|
temp_pack_data.seq_id = 1;
|
|
@@ -5332,10 +5394,22 @@ M_MODEL& or_leRandomnumber(T val)
|
|
|
{
|
|
|
n = conn->read_loop();
|
|
|
offset = 0;
|
|
|
+ if(n==0)
|
|
|
+ {
|
|
|
+ iserror = true;
|
|
|
+ error_msg = conn->error_msg;
|
|
|
+ return *mod;
|
|
|
+ }
|
|
|
for (; offset < n;)
|
|
|
{
|
|
|
conn->read_field_pack(conn->_cache_data, n, offset, temp_pack_data);
|
|
|
- if (temp_pack_data.length == temp_pack_data.current_length)
|
|
|
+ if(temp_pack_data.error > 0)
|
|
|
+ {
|
|
|
+ iserror = true;
|
|
|
+ error_msg =temp_pack_data.data;
|
|
|
+ return *mod;
|
|
|
+ }
|
|
|
+ if (temp_pack_data.length == temp_pack_data.current_length && temp_pack_data.current_length > 0)
|
|
|
{
|
|
|
if (conn->pack_eof_check(temp_pack_data))
|
|
|
{
|
|
@@ -5486,18 +5560,26 @@ M_MODEL& or_leRandomnumber(T val)
|
|
|
}
|
|
|
auto conn = co_await conn_obj->async_get_select_conn();
|
|
|
|
|
|
- unsigned int querysql_len = sqlstring.length() + 1;
|
|
|
+ std::size_t n = co_await conn->async_write_sql(sqlstring);
|
|
|
+
|
|
|
+ if(n==0)
|
|
|
+ {
|
|
|
+ error_msg = conn->error_msg;
|
|
|
+ co_return 0;
|
|
|
+ }
|
|
|
|
|
|
- conn->send_data.clear();
|
|
|
+ // unsigned int querysql_len = sqlstring.length() + 1;
|
|
|
|
|
|
- conn->send_data.push_back((querysql_len & 0xFF));
|
|
|
- conn->send_data.push_back((querysql_len >> 8 & 0xFF));
|
|
|
- conn->send_data.push_back((querysql_len >> 16 & 0xFF));
|
|
|
- conn->send_data.push_back(0x00);
|
|
|
- conn->send_data.push_back(0x03);
|
|
|
- conn->send_data.append(sqlstring);
|
|
|
+ // conn->send_data.clear();
|
|
|
|
|
|
- std::size_t n = co_await asio::async_write(*conn->socket, asio::buffer(conn->send_data), asio::use_awaitable);
|
|
|
+ // conn->send_data.push_back((querysql_len & 0xFF));
|
|
|
+ // conn->send_data.push_back((querysql_len >> 8 & 0xFF));
|
|
|
+ // conn->send_data.push_back((querysql_len >> 16 & 0xFF));
|
|
|
+ // conn->send_data.push_back(0x00);
|
|
|
+ // conn->send_data.push_back(0x03);
|
|
|
+ // conn->send_data.append(sqlstring);
|
|
|
+
|
|
|
+ // std::size_t n = co_await asio::async_write(*conn->socket, asio::buffer(conn->send_data), asio::use_awaitable);
|
|
|
|
|
|
|
|
|
pack_info_t temp_pack_data;
|
|
@@ -5516,10 +5598,20 @@ M_MODEL& or_leRandomnumber(T val)
|
|
|
{
|
|
|
n = co_await conn->async_read_loop();
|
|
|
offset = 0;
|
|
|
+ if (n==0)
|
|
|
+ {
|
|
|
+ co_return 0;
|
|
|
+ }
|
|
|
for (; offset < n;)
|
|
|
{
|
|
|
conn->read_field_pack(conn->_cache_data, n, offset, temp_pack_data);
|
|
|
- if (temp_pack_data.length == temp_pack_data.current_length)
|
|
|
+ if(temp_pack_data.error > 0)
|
|
|
+ {
|
|
|
+ iserror = true;
|
|
|
+ error_msg =temp_pack_data.data;
|
|
|
+ co_return 0;
|
|
|
+ }
|
|
|
+ if (temp_pack_data.length == temp_pack_data.current_length && temp_pack_data.current_length > 0)
|
|
|
{
|
|
|
if (conn->pack_eof_check(temp_pack_data))
|
|
|
{
|
|
@@ -5705,10 +5797,21 @@ M_MODEL& or_leRandomnumber(T val)
|
|
|
{
|
|
|
n = conn->read_loop();
|
|
|
offset = 0;
|
|
|
+ if(n==0)
|
|
|
+ {
|
|
|
+ error_msg = conn->error_msg;
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
for (; offset < n;)
|
|
|
{
|
|
|
conn->read_field_pack(conn->_cache_data, n, offset, temp_pack_data);
|
|
|
- if (temp_pack_data.length == temp_pack_data.current_length)
|
|
|
+ if(temp_pack_data.error > 0)
|
|
|
+ {
|
|
|
+ iserror = true;
|
|
|
+ error_msg =temp_pack_data.data;
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ if (temp_pack_data.length == temp_pack_data.current_length && temp_pack_data.current_length > 0)
|
|
|
{
|
|
|
if (conn->pack_eof_check(temp_pack_data))
|
|
|
{
|
|
@@ -5896,10 +5999,20 @@ M_MODEL& or_leRandomnumber(T val)
|
|
|
// n = co_await conn->socket->async_read_some(asio::buffer(result_data), asio::use_awaitable);
|
|
|
n = co_await conn->async_read_loop();
|
|
|
offset = 0;
|
|
|
+ if (n==0)
|
|
|
+ {
|
|
|
+ co_return 0;
|
|
|
+ }
|
|
|
for (; offset < n;)
|
|
|
{
|
|
|
conn->read_field_pack(conn->_cache_data, n, offset, temp_pack_data);
|
|
|
- if (temp_pack_data.length == temp_pack_data.current_length)
|
|
|
+ if(temp_pack_data.error > 0)
|
|
|
+ {
|
|
|
+ iserror = true;
|
|
|
+ error_msg =temp_pack_data.data;
|
|
|
+ co_return 0;
|
|
|
+ }
|
|
|
+ if (temp_pack_data.length == temp_pack_data.current_length && temp_pack_data.current_length > 0)
|
|
|
{
|
|
|
if (conn->pack_eof_check(temp_pack_data))
|
|
|
{
|
|
@@ -6048,25 +6161,32 @@ M_MODEL& or_leRandomnumber(T val)
|
|
|
}
|
|
|
auto conn = conn_obj->get_select_conn();
|
|
|
|
|
|
- unsigned int querysql_len = sqlstring.length() + 1;
|
|
|
-
|
|
|
- conn->send_data.clear();
|
|
|
- conn->send_data.push_back((querysql_len & 0xFF));
|
|
|
- conn->send_data.push_back((querysql_len >> 8 & 0xFF));
|
|
|
- conn->send_data.push_back((querysql_len >> 16 & 0xFF));
|
|
|
- conn->send_data.push_back(0x00);
|
|
|
- conn->send_data.push_back(0x03);
|
|
|
- conn->send_data.append(sqlstring);
|
|
|
-
|
|
|
- std::size_t n = asio::write(*conn->socket, asio::buffer(conn->send_data), conn->ec);
|
|
|
-
|
|
|
- if(conn->ec)
|
|
|
+ std::size_t n = conn->write_sql(sqlstring);
|
|
|
+ if(n==0)
|
|
|
{
|
|
|
- error_msg = conn->ec.message();
|
|
|
- iserror = true;
|
|
|
+ error_msg = conn->error_msg;
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
+ // unsigned int querysql_len = sqlstring.length() + 1;
|
|
|
+
|
|
|
+ // conn->send_data.clear();
|
|
|
+ // conn->send_data.push_back((querysql_len & 0xFF));
|
|
|
+ // conn->send_data.push_back((querysql_len >> 8 & 0xFF));
|
|
|
+ // conn->send_data.push_back((querysql_len >> 16 & 0xFF));
|
|
|
+ // conn->send_data.push_back(0x00);
|
|
|
+ // conn->send_data.push_back(0x03);
|
|
|
+ // conn->send_data.append(sqlstring);
|
|
|
+
|
|
|
+ // std::size_t n = asio::write(*conn->socket, asio::buffer(conn->send_data), conn->ec);
|
|
|
+
|
|
|
+ // if(conn->ec)
|
|
|
+ // {
|
|
|
+ // error_msg = conn->ec.message();
|
|
|
+ // iserror = true;
|
|
|
+ // return 0;
|
|
|
+ // }
|
|
|
+
|
|
|
|
|
|
pack_info_t temp_pack_data;
|
|
|
temp_pack_data.seq_id = 1;
|
|
@@ -6082,10 +6202,21 @@ M_MODEL& or_leRandomnumber(T val)
|
|
|
{
|
|
|
n = conn->read_loop();
|
|
|
offset = 0;
|
|
|
+ if(n==0)
|
|
|
+ {
|
|
|
+ error_msg = conn->error_msg;
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
for (; offset < n;)
|
|
|
{
|
|
|
conn->read_field_pack(conn->_cache_data, n, offset, temp_pack_data);
|
|
|
- if (temp_pack_data.length == temp_pack_data.current_length)
|
|
|
+ if(temp_pack_data.error > 0)
|
|
|
+ {
|
|
|
+ iserror = true;
|
|
|
+ error_msg =temp_pack_data.data;
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ if (temp_pack_data.length == temp_pack_data.current_length && temp_pack_data.current_length > 0)
|
|
|
{
|
|
|
if (conn->pack_eof_check(temp_pack_data))
|
|
|
{
|
|
@@ -6252,17 +6383,25 @@ M_MODEL& or_leRandomnumber(T val)
|
|
|
}
|
|
|
auto conn = co_await conn_obj->async_get_select_conn();
|
|
|
|
|
|
- unsigned int querysql_len = sqlstring.length() + 1;
|
|
|
+ std::size_t n = co_await conn->async_write_sql(sqlstring);
|
|
|
+
|
|
|
+ if (n==0)
|
|
|
+ {
|
|
|
+ error_msg = conn->error_msg;
|
|
|
+ co_return 0;
|
|
|
+ }
|
|
|
|
|
|
- conn->send_data.clear();
|
|
|
- conn->send_data.push_back((querysql_len & 0xFF));
|
|
|
- conn->send_data.push_back((querysql_len >> 8 & 0xFF));
|
|
|
- conn->send_data.push_back((querysql_len >> 16 & 0xFF));
|
|
|
- conn->send_data.push_back(0x00);
|
|
|
- conn->send_data.push_back(0x03);
|
|
|
- conn->send_data.append(sqlstring);
|
|
|
+ // unsigned int querysql_len = sqlstring.length() + 1;
|
|
|
|
|
|
- std::size_t n = co_await asio::async_write(*conn->socket, asio::buffer(conn->send_data), asio::use_awaitable);
|
|
|
+ // conn->send_data.clear();
|
|
|
+ // conn->send_data.push_back((querysql_len & 0xFF));
|
|
|
+ // conn->send_data.push_back((querysql_len >> 8 & 0xFF));
|
|
|
+ // conn->send_data.push_back((querysql_len >> 16 & 0xFF));
|
|
|
+ // conn->send_data.push_back(0x00);
|
|
|
+ // conn->send_data.push_back(0x03);
|
|
|
+ // conn->send_data.append(sqlstring);
|
|
|
+
|
|
|
+ // std::size_t n = co_await asio::async_write(*conn->socket, asio::buffer(conn->send_data), asio::use_awaitable);
|
|
|
|
|
|
|
|
|
pack_info_t temp_pack_data;
|
|
@@ -6283,10 +6422,20 @@ M_MODEL& or_leRandomnumber(T val)
|
|
|
{
|
|
|
n = co_await conn->async_read_loop();
|
|
|
offset = 0;
|
|
|
+ if (n==0)
|
|
|
+ {
|
|
|
+ co_return 0;
|
|
|
+ }
|
|
|
for (; offset < n;)
|
|
|
{
|
|
|
conn->read_field_pack(conn->_cache_data, n, offset, temp_pack_data);
|
|
|
- if (temp_pack_data.length == temp_pack_data.current_length)
|
|
|
+ if(temp_pack_data.error > 0)
|
|
|
+ {
|
|
|
+ iserror = true;
|
|
|
+ error_msg =temp_pack_data.data;
|
|
|
+ co_return 0;
|
|
|
+ }
|
|
|
+ if (temp_pack_data.length == temp_pack_data.current_length && temp_pack_data.current_length > 0)
|
|
|
{
|
|
|
if (conn->pack_eof_check(temp_pack_data))
|
|
|
{
|
|
@@ -6593,10 +6742,21 @@ M_MODEL& or_leRandomnumber(T val)
|
|
|
{
|
|
|
n = conn->read_loop();
|
|
|
offset = 0;
|
|
|
+ if(n==0)
|
|
|
+ {
|
|
|
+ error_msg = conn->error_msg;
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
for (; offset < n;)
|
|
|
{
|
|
|
conn->read_field_pack(conn->_cache_data, n, offset, temp_pack_data);
|
|
|
- if (temp_pack_data.length == temp_pack_data.current_length)
|
|
|
+ if(temp_pack_data.error > 0)
|
|
|
+ {
|
|
|
+ iserror = true;
|
|
|
+ error_msg =temp_pack_data.data;
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ if (temp_pack_data.length == temp_pack_data.current_length && temp_pack_data.current_length > 0)
|
|
|
{
|
|
|
if (conn->pack_eof_check(temp_pack_data))
|
|
|
{
|
|
@@ -6763,10 +6923,20 @@ M_MODEL& or_leRandomnumber(T val)
|
|
|
{
|
|
|
n = co_await conn->async_read_loop();
|
|
|
offset = 0;
|
|
|
+ if (n==0)
|
|
|
+ {
|
|
|
+ co_return valuetemp;
|
|
|
+ }
|
|
|
for (; offset < n;)
|
|
|
{
|
|
|
conn->read_field_pack(conn->_cache_data, n, offset, temp_pack_data);
|
|
|
- if (temp_pack_data.length == temp_pack_data.current_length)
|
|
|
+ if(temp_pack_data.error > 0)
|
|
|
+ {
|
|
|
+ iserror = true;
|
|
|
+ error_msg =temp_pack_data.data;
|
|
|
+ co_return 0;
|
|
|
+ }
|
|
|
+ if (temp_pack_data.length == temp_pack_data.current_length && temp_pack_data.current_length > 0)
|
|
|
{
|
|
|
if (conn->pack_eof_check(temp_pack_data))
|
|
|
{
|
|
@@ -6933,10 +7103,21 @@ M_MODEL& or_leRandomnumber(T val)
|
|
|
{
|
|
|
n = conn->read_loop();
|
|
|
offset = 0;
|
|
|
+ if(n==0)
|
|
|
+ {
|
|
|
+ error_msg = conn->error_msg;
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
for (; offset < n;)
|
|
|
{
|
|
|
conn->read_field_pack(conn->_cache_data, n, offset, temp_pack_data);
|
|
|
- if (temp_pack_data.length == temp_pack_data.current_length)
|
|
|
+ if(temp_pack_data.error > 0)
|
|
|
+ {
|
|
|
+ iserror = true;
|
|
|
+ error_msg =temp_pack_data.data;
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ if (temp_pack_data.length == temp_pack_data.current_length && temp_pack_data.current_length > 0)
|
|
|
{
|
|
|
if (conn->pack_eof_check(temp_pack_data))
|
|
|
{
|
|
@@ -7100,10 +7281,20 @@ M_MODEL& or_leRandomnumber(T val)
|
|
|
{
|
|
|
n = co_await conn->async_read_loop();
|
|
|
offset = 0;
|
|
|
+ if (n==0)
|
|
|
+ {
|
|
|
+ co_return 0;
|
|
|
+ }
|
|
|
for (; offset < n;)
|
|
|
{
|
|
|
conn->read_field_pack(conn->_cache_data, n, offset, temp_pack_data);
|
|
|
- if (temp_pack_data.length == temp_pack_data.current_length)
|
|
|
+ if(temp_pack_data.error > 0)
|
|
|
+ {
|
|
|
+ iserror = true;
|
|
|
+ error_msg =temp_pack_data.data;
|
|
|
+ co_return 0;
|
|
|
+ }
|
|
|
+ if (temp_pack_data.length == temp_pack_data.current_length && temp_pack_data.current_length > 0)
|
|
|
{
|
|
|
if (conn->pack_eof_check(temp_pack_data))
|
|
|
{
|
|
@@ -7274,7 +7465,11 @@ M_MODEL& or_leRandomnumber(T val)
|
|
|
|
|
|
unsigned int offset = 0;
|
|
|
n = conn->read_loop();
|
|
|
-
|
|
|
+ if(n==0)
|
|
|
+ {
|
|
|
+ error_msg = conn->error_msg;
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
pack_info_t temp_pack_data;
|
|
|
temp_pack_data.seq_id = 1;
|
|
|
conn->read_field_pack(conn->_cache_data, n, offset, temp_pack_data);
|
|
@@ -7373,28 +7568,39 @@ M_MODEL& or_leRandomnumber(T val)
|
|
|
}
|
|
|
auto conn = conn_obj->get_edit_conn();
|
|
|
|
|
|
- unsigned int querysql_len = sqlstring.length() + 1;
|
|
|
-
|
|
|
- conn->send_data.clear();
|
|
|
- conn->send_data.push_back((querysql_len & 0xFF));
|
|
|
- conn->send_data.push_back((querysql_len >> 8 & 0xFF));
|
|
|
- conn->send_data.push_back((querysql_len >> 16 & 0xFF));
|
|
|
- conn->send_data.push_back(0x00);
|
|
|
- conn->send_data.push_back(0x03);
|
|
|
- conn->send_data.append(sqlstring);
|
|
|
-
|
|
|
- std::size_t n = asio::write(*conn->socket, asio::buffer(conn->send_data), conn->ec);
|
|
|
-
|
|
|
- if(conn->ec)
|
|
|
+ std::size_t n = conn->write_sql(sqlstring);
|
|
|
+ if(n==0)
|
|
|
{
|
|
|
- error_msg = conn->ec.message();
|
|
|
- iserror = true;
|
|
|
+ error_msg = conn->error_msg;
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
+ // unsigned int querysql_len = sqlstring.length() + 1;
|
|
|
+
|
|
|
+ // conn->send_data.clear();
|
|
|
+ // conn->send_data.push_back((querysql_len & 0xFF));
|
|
|
+ // conn->send_data.push_back((querysql_len >> 8 & 0xFF));
|
|
|
+ // conn->send_data.push_back((querysql_len >> 16 & 0xFF));
|
|
|
+ // conn->send_data.push_back(0x00);
|
|
|
+ // conn->send_data.push_back(0x03);
|
|
|
+ // conn->send_data.append(sqlstring);
|
|
|
+
|
|
|
+ // std::size_t n = asio::write(*conn->socket, asio::buffer(conn->send_data), conn->ec);
|
|
|
+
|
|
|
+ // if(conn->ec)
|
|
|
+ // {
|
|
|
+ // error_msg = conn->ec.message();
|
|
|
+ // iserror = true;
|
|
|
+ // return 0;
|
|
|
+ // }
|
|
|
+
|
|
|
unsigned int offset = 0;
|
|
|
n = conn->read_loop();
|
|
|
-
|
|
|
+ if(n==0)
|
|
|
+ {
|
|
|
+ error_msg = conn->error_msg;
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
pack_info_t temp_pack_data;
|
|
|
temp_pack_data.seq_id = 1;
|
|
|
conn->read_field_pack(conn->_cache_data, n, offset, temp_pack_data);
|
|
@@ -7508,7 +7714,10 @@ M_MODEL& or_leRandomnumber(T val)
|
|
|
|
|
|
unsigned int offset = 0;
|
|
|
n = co_await conn->async_read_loop();
|
|
|
-
|
|
|
+ if (n==0)
|
|
|
+ {
|
|
|
+ co_return 0;
|
|
|
+ }
|
|
|
pack_info_t temp_pack_data;
|
|
|
temp_pack_data.seq_id = 1;
|
|
|
conn->read_field_pack(conn->_cache_data, n, offset, temp_pack_data);
|
|
@@ -7623,7 +7832,10 @@ M_MODEL& or_leRandomnumber(T val)
|
|
|
|
|
|
unsigned int offset = 0;
|
|
|
n = co_await conn->async_read_loop();
|
|
|
-
|
|
|
+ if (n==0)
|
|
|
+ {
|
|
|
+ co_return 0;
|
|
|
+ }
|
|
|
pack_info_t temp_pack_data;
|
|
|
temp_pack_data.seq_id = 1;
|
|
|
conn->read_field_pack(conn->_cache_data, n, offset, temp_pack_data);
|
|
@@ -7711,7 +7923,11 @@ M_MODEL& or_leRandomnumber(T val)
|
|
|
|
|
|
unsigned int offset = 0;
|
|
|
n = conn->read_loop();
|
|
|
-
|
|
|
+ if(n==0)
|
|
|
+ {
|
|
|
+ error_msg = conn->error_msg;
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
pack_info_t temp_pack_data;
|
|
|
temp_pack_data.seq_id = 1;
|
|
|
conn->read_field_pack(conn->_cache_data, n, offset, temp_pack_data);
|
|
@@ -7832,7 +8048,11 @@ M_MODEL& or_leRandomnumber(T val)
|
|
|
|
|
|
unsigned int offset = 0;
|
|
|
n = conn->read_loop();
|
|
|
-
|
|
|
+ if(n==0)
|
|
|
+ {
|
|
|
+ error_msg = conn->error_msg;
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
pack_info_t temp_pack_data;
|
|
|
temp_pack_data.seq_id = 1;
|
|
|
conn->read_field_pack(conn->_cache_data, n, offset, temp_pack_data);
|
|
@@ -7947,7 +8167,10 @@ M_MODEL& or_leRandomnumber(T val)
|
|
|
|
|
|
unsigned int offset = 0;
|
|
|
n = co_await conn->async_read_loop();
|
|
|
-
|
|
|
+ if (n==0)
|
|
|
+ {
|
|
|
+ co_return 0;
|
|
|
+ }
|
|
|
pack_info_t temp_pack_data;
|
|
|
temp_pack_data.seq_id = 1;
|
|
|
conn->read_field_pack(conn->_cache_data, n, offset, temp_pack_data);
|
|
@@ -8034,7 +8257,11 @@ M_MODEL& or_leRandomnumber(T val)
|
|
|
|
|
|
unsigned int offset = 0;
|
|
|
n = conn->read_loop();
|
|
|
-
|
|
|
+ if(n==0)
|
|
|
+ {
|
|
|
+ error_msg = conn->error_msg;
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
pack_info_t temp_pack_data;
|
|
|
temp_pack_data.seq_id = 1;
|
|
|
conn->read_field_pack(conn->_cache_data, n, offset, temp_pack_data);
|
|
@@ -8114,7 +8341,10 @@ M_MODEL& or_leRandomnumber(T val)
|
|
|
|
|
|
unsigned int offset = 0;
|
|
|
n = co_await conn->async_read_loop();
|
|
|
-
|
|
|
+ if (n==0)
|
|
|
+ {
|
|
|
+ co_return 0;
|
|
|
+ }
|
|
|
pack_info_t temp_pack_data;
|
|
|
temp_pack_data.seq_id = 1;
|
|
|
conn->read_field_pack(conn->_cache_data, n, offset, temp_pack_data);
|
|
@@ -8239,7 +8469,11 @@ M_MODEL& or_leRandomnumber(T val)
|
|
|
|
|
|
unsigned int offset = 0;
|
|
|
n = conn->read_loop();
|
|
|
-
|
|
|
+ if(n==0)
|
|
|
+ {
|
|
|
+ error_msg = conn->error_msg;
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
pack_info_t temp_pack_data;
|
|
|
temp_pack_data.seq_id = 1;
|
|
|
conn->read_field_pack(conn->_cache_data, n, offset, temp_pack_data);
|
|
@@ -8371,7 +8605,11 @@ M_MODEL& or_leRandomnumber(T val)
|
|
|
|
|
|
unsigned int offset = 0;
|
|
|
n = conn->read_loop();
|
|
|
-
|
|
|
+ if(n==0)
|
|
|
+ {
|
|
|
+ error_msg = conn->error_msg;
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
pack_info_t temp_pack_data;
|
|
|
temp_pack_data.seq_id = 1;
|
|
|
conn->read_field_pack(conn->_cache_data, n, offset, temp_pack_data);
|
|
@@ -8450,7 +8688,11 @@ M_MODEL& or_leRandomnumber(T val)
|
|
|
|
|
|
unsigned int offset = 0;
|
|
|
n = conn->read_loop();
|
|
|
-
|
|
|
+ if(n==0)
|
|
|
+ {
|
|
|
+ error_msg = conn->error_msg;
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
pack_info_t temp_pack_data;
|
|
|
temp_pack_data.seq_id = 1;
|
|
|
conn->read_field_pack(conn->_cache_data, n, offset, temp_pack_data);
|
|
@@ -8523,7 +8765,10 @@ M_MODEL& or_leRandomnumber(T val)
|
|
|
|
|
|
unsigned int offset = 0;
|
|
|
n = co_await conn->async_read_loop();
|
|
|
-
|
|
|
+ if (n==0)
|
|
|
+ {
|
|
|
+ co_return 0;
|
|
|
+ }
|
|
|
pack_info_t temp_pack_data;
|
|
|
temp_pack_data.seq_id = 1;
|
|
|
conn->read_field_pack(conn->_cache_data, n, offset, temp_pack_data);
|
|
@@ -8603,7 +8848,11 @@ M_MODEL& or_leRandomnumber(T val)
|
|
|
|
|
|
unsigned int offset = 0;
|
|
|
n = conn->read_loop();
|
|
|
-
|
|
|
+ if(n==0)
|
|
|
+ {
|
|
|
+ error_msg = conn->error_msg;
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
pack_info_t temp_pack_data;
|
|
|
temp_pack_data.seq_id = 1;
|
|
|
conn->read_field_pack(conn->_cache_data, n, offset, temp_pack_data);
|
|
@@ -8676,7 +8925,10 @@ M_MODEL& or_leRandomnumber(T val)
|
|
|
|
|
|
unsigned int offset = 0;
|
|
|
n = co_await conn->async_read_loop();
|
|
|
-
|
|
|
+ if (n==0)
|
|
|
+ {
|
|
|
+ co_return 0;
|
|
|
+ }
|
|
|
pack_info_t temp_pack_data;
|
|
|
temp_pack_data.seq_id = 1;
|
|
|
conn->read_field_pack(conn->_cache_data, n, offset, temp_pack_data);
|
|
@@ -8756,7 +9008,11 @@ M_MODEL& or_leRandomnumber(T val)
|
|
|
|
|
|
unsigned int offset = 0;
|
|
|
n = conn->read_loop();
|
|
|
-
|
|
|
+ if(n==0)
|
|
|
+ {
|
|
|
+ error_msg = conn->error_msg;
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
pack_info_t temp_pack_data;
|
|
|
temp_pack_data.seq_id = 1;
|
|
|
conn->read_field_pack(conn->_cache_data, n, offset, temp_pack_data);
|
|
@@ -8828,7 +9084,10 @@ M_MODEL& or_leRandomnumber(T val)
|
|
|
|
|
|
unsigned int offset = 0;
|
|
|
n = co_await conn->async_read_loop();
|
|
|
-
|
|
|
+ if (n==0)
|
|
|
+ {
|
|
|
+ co_return 0;
|
|
|
+ }
|
|
|
pack_info_t temp_pack_data;
|
|
|
temp_pack_data.seq_id = 1;
|
|
|
conn->read_field_pack(conn->_cache_data, n, offset, temp_pack_data);
|
|
@@ -8939,7 +9198,11 @@ M_MODEL& or_leRandomnumber(T val)
|
|
|
|
|
|
unsigned int offset = 0;
|
|
|
n = conn->read_loop();
|
|
|
-
|
|
|
+ if(n==0)
|
|
|
+ {
|
|
|
+ error_msg = conn->error_msg;
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
pack_info_t temp_pack_data;
|
|
|
temp_pack_data.seq_id = 1;
|
|
|
conn->read_field_pack(conn->_cache_data, n, offset, temp_pack_data);
|
|
@@ -8989,7 +9252,11 @@ M_MODEL& or_leRandomnumber(T val)
|
|
|
|
|
|
unsigned int offset = 0;
|
|
|
n = conn->read_loop();
|
|
|
-
|
|
|
+ if(n==0)
|
|
|
+ {
|
|
|
+ error_msg = conn->error_msg;
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
pack_info_t temp_pack_data;
|
|
|
temp_pack_data.seq_id = 1;
|
|
|
conn->read_field_pack(conn->_cache_data, n, offset, temp_pack_data);
|
|
@@ -9084,7 +9351,10 @@ M_MODEL& or_leRandomnumber(T val)
|
|
|
|
|
|
unsigned int offset = 0;
|
|
|
n = co_await conn->async_read_loop();
|
|
|
-
|
|
|
+ if (n==0)
|
|
|
+ {
|
|
|
+ co_return 0;
|
|
|
+ }
|
|
|
pack_info_t temp_pack_data;
|
|
|
temp_pack_data.seq_id = 1;
|
|
|
conn->read_field_pack(conn->_cache_data, n, offset, temp_pack_data);
|
|
@@ -9146,7 +9416,10 @@ M_MODEL& or_leRandomnumber(T val)
|
|
|
|
|
|
unsigned int offset = 0;
|
|
|
n = co_await conn->async_read_loop();
|
|
|
-
|
|
|
+ if (n==0)
|
|
|
+ {
|
|
|
+ co_return 0;
|
|
|
+ }
|
|
|
pack_info_t temp_pack_data;
|
|
|
temp_pack_data.seq_id = 1;
|
|
|
conn->read_field_pack(conn->_cache_data, n, offset, temp_pack_data);
|
|
@@ -9269,10 +9542,21 @@ M_MODEL& or_leRandomnumber(T val)
|
|
|
{
|
|
|
n = conn->read_loop();
|
|
|
offset = 0;
|
|
|
+ if(n==0)
|
|
|
+ {
|
|
|
+ error_msg = conn->error_msg;
|
|
|
+ return std::make_tuple(table_fieldname, table_fieldmap, temprecord);
|
|
|
+ }
|
|
|
for (; offset < n;)
|
|
|
{
|
|
|
conn->read_field_pack(conn->_cache_data, n, offset, temp_pack_data);
|
|
|
- if (temp_pack_data.length == temp_pack_data.current_length)
|
|
|
+ if(temp_pack_data.error > 0)
|
|
|
+ {
|
|
|
+ iserror = true;
|
|
|
+ error_msg =temp_pack_data.data;
|
|
|
+ return std::make_tuple(table_fieldname, table_fieldmap, temprecord);
|
|
|
+ }
|
|
|
+ if (temp_pack_data.length == temp_pack_data.current_length && temp_pack_data.current_length > 0)
|
|
|
{
|
|
|
if (conn->pack_eof_check(temp_pack_data))
|
|
|
{
|
|
@@ -9434,10 +9718,20 @@ M_MODEL& or_leRandomnumber(T val)
|
|
|
{
|
|
|
n = co_await conn->async_read_loop();
|
|
|
offset = 0;
|
|
|
+ if (n==0)
|
|
|
+ {
|
|
|
+ co_return std::make_tuple(table_fieldname, table_fieldmap, temprecord);
|
|
|
+ }
|
|
|
for (; offset < n;)
|
|
|
{
|
|
|
conn->read_field_pack(conn->_cache_data, n, offset, temp_pack_data);
|
|
|
- if (temp_pack_data.length == temp_pack_data.current_length)
|
|
|
+ if(temp_pack_data.error > 0)
|
|
|
+ {
|
|
|
+ iserror = true;
|
|
|
+ error_msg =temp_pack_data.data;
|
|
|
+ co_return std::make_tuple(table_fieldname, table_fieldmap, temprecord);
|
|
|
+ }
|
|
|
+ if (temp_pack_data.length == temp_pack_data.current_length && temp_pack_data.current_length > 0)
|
|
|
{
|
|
|
if (conn->pack_eof_check(temp_pack_data))
|
|
|
{
|
|
@@ -9621,6 +9915,8 @@ M_MODEL& or_leRandomnumber(T val)
|
|
|
|
|
|
M_MODEL *mod;
|
|
|
|
|
|
+ std::shared_ptr<mysql_conn_base> select_conn;
|
|
|
+ std::shared_ptr<mysql_conn_base> edit_conn;
|
|
|
std::shared_ptr<orm_conn_pool> conn_obj;
|
|
|
};
|
|
|
//} /*tagnamespace_replace*/
|