mirror of
https://gitee.com/fasiondog/hikyuu.git
synced 2024-12-01 03:18:18 +08:00
Merge branch 'master' of https://gitee.com/fasiondog/hikyuu.git
This commit is contained in:
commit
b8a920834c
@ -23,9 +23,10 @@ MySQLStatement::MySQLStatement(const DBConnectPtr& driver, const string& sql_sta
|
|||||||
HKU_ASSERT_M(m_stmt != nullptr, "Failed mysql_stmt_init!");
|
HKU_ASSERT_M(m_stmt != nullptr, "Failed mysql_stmt_init!");
|
||||||
int ret = mysql_stmt_prepare(m_stmt, sql_statement.c_str(), sql_statement.size());
|
int ret = mysql_stmt_prepare(m_stmt, sql_statement.c_str(), sql_statement.size());
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
|
std::string stmt_errorstr = mysql_stmt_error(m_stmt);
|
||||||
mysql_stmt_close(m_stmt);
|
mysql_stmt_close(m_stmt);
|
||||||
m_stmt = nullptr;
|
m_stmt = nullptr;
|
||||||
HKU_THROW("Failed prepare statement! error: {} SQL: {}", mysql_stmt_error(m_stmt),
|
HKU_THROW("Failed prepare statement! error: {} SQL: {}", stmt_errorstr.c_str(),
|
||||||
sql_statement);
|
sql_statement);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -35,7 +36,7 @@ MySQLStatement::MySQLStatement(const DBConnectPtr& driver, const string& sql_sta
|
|||||||
memset(m_param_bind.data(), 0, param_count * sizeof(MYSQL_BIND));
|
memset(m_param_bind.data(), 0, param_count * sizeof(MYSQL_BIND));
|
||||||
}
|
}
|
||||||
|
|
||||||
MYSQL_RES* m_meta_result = mysql_stmt_result_metadata(m_stmt);
|
m_meta_result = mysql_stmt_result_metadata(m_stmt);
|
||||||
if (m_meta_result) {
|
if (m_meta_result) {
|
||||||
int column_count = mysql_num_fields(m_meta_result);
|
int column_count = mysql_num_fields(m_meta_result);
|
||||||
m_result_bind.resize(column_count);
|
m_result_bind.resize(column_count);
|
||||||
@ -284,4 +285,4 @@ void MySQLStatement::sub_getColumnAsBlob(int idx, string& item) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace hku
|
} // namespace hku
|
||||||
|
Loading…
Reference in New Issue
Block a user