增加close
This commit is contained in:
@@ -719,6 +719,7 @@ module::mysql_conn::~mysql_conn()
|
||||
|
||||
int module::mysql_conn::connect(const std::string& ipaddress, const std::string& username, const std::string& password, const std::string& database, const std::string& charset, ushort port)
|
||||
{
|
||||
if (m_conn == nullptr) {throw std::string("Connection is nullptr");}
|
||||
ylib::mysql::mysql_conn_info info;
|
||||
info.ipaddress = ipaddress;
|
||||
info.username = username;
|
||||
@@ -731,60 +732,72 @@ int module::mysql_conn::connect(const std::string& ipaddress, const std::string&
|
||||
|
||||
void module::mysql_conn::clear()
|
||||
{
|
||||
if (m_conn == nullptr) { throw std::string("Connection is nullptr"); }
|
||||
m_conn->clear();
|
||||
}
|
||||
|
||||
std::shared_ptr<module::mysql_prepare_statement> module::mysql_conn::setsql(const std::string& sql)
|
||||
{
|
||||
if (m_conn == nullptr) { throw std::string("Connection is nullptr"); }
|
||||
return std::make_shared<module::mysql_prepare_statement>(m_conn->setsql(sql));
|
||||
}
|
||||
|
||||
uint64 module::mysql_conn::insert_id()
|
||||
{
|
||||
if (m_conn == nullptr) { throw std::string("Connection is nullptr"); }
|
||||
return m_conn->insert_id();
|
||||
}
|
||||
|
||||
void module::mysql_conn::begin(bool autocommit)
|
||||
{
|
||||
if (m_conn == nullptr) { throw std::string("Connection is nullptr"); }
|
||||
m_conn->begin(autocommit);
|
||||
}
|
||||
|
||||
void module::mysql_conn::commit()
|
||||
{
|
||||
if (m_conn == nullptr) { throw std::string("Connection is nullptr"); }
|
||||
m_conn->commit();
|
||||
}
|
||||
|
||||
void module::mysql_conn::rollback()
|
||||
{
|
||||
if (m_conn == nullptr) { throw std::string("Connection is nullptr"); }
|
||||
m_conn->rollback();
|
||||
}
|
||||
|
||||
void module::mysql_conn::setDatabase(const std::string& name)
|
||||
{
|
||||
if (m_conn == nullptr) { throw std::string("Connection is nullptr"); }
|
||||
m_conn->setDatabase(name);
|
||||
}
|
||||
|
||||
std::string module::mysql_conn::last_error()
|
||||
{
|
||||
if (m_conn == nullptr) { throw std::string("Connection is nullptr"); }
|
||||
return m_conn->last_error();
|
||||
}
|
||||
std::shared_ptr<module::select> module::mysql_conn::select()
|
||||
{
|
||||
if (m_conn == nullptr) { throw std::string("Connection is nullptr"); }
|
||||
return std::make_shared<module::select>(m_conn, false);
|
||||
}
|
||||
|
||||
std::shared_ptr<module::insert> module::mysql_conn::insert()
|
||||
{
|
||||
if (m_conn == nullptr) { throw std::string("Connection is nullptr"); }
|
||||
return std::make_shared<module::insert>(m_conn, false);
|
||||
}
|
||||
|
||||
std::shared_ptr<module::update> module::mysql_conn::update()
|
||||
{
|
||||
if (m_conn == nullptr) { throw std::string("Connection is nullptr"); }
|
||||
return std::make_shared<module::update>(m_conn, false);
|
||||
}
|
||||
|
||||
std::shared_ptr<module::delete_> module::mysql_conn::delete_()
|
||||
{
|
||||
if (m_conn == nullptr) { throw std::string("Connection is nullptr"); }
|
||||
return std::make_shared<module::delete_>(m_conn, false);
|
||||
}
|
||||
|
||||
@@ -817,7 +830,8 @@ void module::mysql_conn::regist(sol::state* lua)
|
||||
"select", &module::mysql_conn::select,
|
||||
"update", &module::mysql_conn::update,
|
||||
"insert", &module::mysql_conn::insert,
|
||||
"delete", &module::mysql_conn::delete_
|
||||
"delete", &module::mysql_conn::delete_,
|
||||
"close", &module::mysql_conn::free,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user