Ai
1 Star 0 Fork 0

天才楠/MySQL

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
main.cpp 774 Bytes
一键复制 编辑 原始数据 按行查看 历史
天才楠 提交于 2024-09-18 12:44 +08:00 . mysql
#include <iostream>
#include "mysql.hpp"
int main() {
MySQL mysql;
mysql.connect("localhost", "test", "123456", "testDB");
mysql.setAutoCommit(false);
if (mysql.getAutoCommit()) {
std::cout << "auto commit ON" << '\n';
} else {
std::cout << "auto commit OFF" << '\n';
}
mysql.setCharacterSet("utf8");
std::cout << "当前字符集:" << mysql.getCharacterSet() << '\n';
std::string sql;
while (true) {
std::cout << "mysql>";
std::getline(std::cin,sql);
std::cout << mysql.query(sql.c_str()) << '\n';
auto result = mysql.getQueryRestult();
for (size_t i = 0; i < size(result); ++i) {
for (size_t j = 0; j < size(result[i]); ++j) {
std::cout << result[i][j] << " \n"[j == size(result[i]) - 1];
}
}
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/tcnpp/MySQL.git
git@gitee.com:tcnpp/MySQL.git
tcnpp
MySQL
MySQL
master

搜索帮助