From d2b9463ad7c505f2b8454063ed0ec22666fe1d76 Mon Sep 17 00:00:00 2001 From: xx Date: Fri, 21 Jun 2024 00:45:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dmysql=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E5=90=8E=E5=AF=BC=E8=87=B4=E7=9A=84=E9=87=8D=E8=BF=9E=E6=8A=9B?= =?UTF-8?q?=E5=87=BA=E7=A9=BA=E5=BC=82=E5=B8=B8=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/db/mysql.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/db/mysql.cpp b/src/db/mysql.cpp index c93b6df..2051485 100644 --- a/src/db/mysql.cpp +++ b/src/db/mysql.cpp @@ -39,8 +39,14 @@ If you have any questions, please contact us: 1585346868@qq.com Or visit our web -#define DEBUG_LOG_PPST_SET 0 + +#ifdef _DEBUG +#define DEBUG_LOG_SETSQL 1 +#define DEBUG_LOG_PPST_SET 1 +#else #define DEBUG_LOG_SETSQL 0 +#define DEBUG_LOG_PPST_SET 0 +#endif ylib::mysql::conn::conn() { m_handle = nullptr; @@ -139,7 +145,7 @@ void ylib::mysql::conn::task_out() { if(m_sw != 0 || CONNECTION->isValid() == false) { close(); - if (start(m_info) == false) + if (start(m_info) != SR_SUCCESS) { throw ylib::exception(this->last_error()); } @@ -386,7 +392,7 @@ void ylib::mysql::prepare_statement::set_string(uint32 index, const char* data, PRINT_DEBUG_SET_NSTRING; PREPARE_STATEMENT->setString(index,sql::SQLString(data,size)); #if DEBUG_LOG_PPST_SET == 1 - std::cout << "set " << index << " = " << value << std::endl; + std::cout << "set " << index << " = " << std::string_view(data,size) << std::endl; #endif } void ylib::mysql::prepare_statement::set_blob(uint32 index, const char* data, int size) @@ -397,7 +403,7 @@ void ylib::mysql::prepare_statement::set_blob(uint32 index, const char* data, in m_blobs.push(data_ptr); PREPARE_STATEMENT->setBlob(index, data_ptr.get()); #if DEBUG_LOG_PPST_SET == 1 - std::cout << "set " << index << " = " << value.length()<<"(BLOB)" << std::endl; + std::cout << "set " << index << " = " << size<<"(BLOB)" << std::endl; #endif }