📄 mysqli.cpp
字号:
#include "MySQLi.h"MySQLi::MySQLi(std::string hostname, std::string username, std::string password, std::string dbname, unsigned int port=3306){ this->m_hostname = hostname; this->m_username = username; this->m_password = password; this->m_dbname = dbname ; this->m_port = port ; //this->m_unix_socket = unix_socket; //this->m_client_flag = client_flag; this->mysql_conn = mysql_init(NULL); mysql_real_connect( this->mysql_conn, (this->m_hostname).c_str(), (this->m_username).c_str(), (this->m_password).c_str(), (this->m_dbname).c_str(), this->m_port, (this->m_unix_socket).c_str(), this->m_client_flag ); }MySQLi::~MySQLi(){ if (this->mysql_conn) mysql_close(this->mysql_conn);}void MySQLi::close(){ mysql_close(this->mysql_conn);}int MySQLi::select_db(std::string dbname){ this->m_dbname = dbname; return mysql_select_db(this->mysql_conn, (this->m_dbname).c_str()); }MySQLi_Result* MySQLi::query(std::string query){ mysql_query(this->mysql_conn, query.c_str()); return new MySQLi_Result(mysql_use_result(this->mysql_conn)); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -