sqlconn/src/main.cc

24 lines
830 B
C++
Raw Normal View History

2024-10-14 18:08:50 +08:00
#include "sqlConnection.h"
2024-10-23 18:45:36 +08:00
#include <iostream>
#include <ranges>
namespace ranges = std::ranges;
namespace views = std::ranges::views;
using namespace std;
2024-10-14 18:08:50 +08:00
int main(int argc, char** const argv){
SqlConnection conn{};
2024-10-24 14:14:12 +08:00
auto resp = conn.Connect("192.168.1.17", "3306", "root", "", "mobiletek_mmi");
2024-11-22 17:14:20 +08:00
auto table_result = conn.get_tables();
auto fields = conn.get_fields("r303");
ranges::for_each(fields, [](auto item){cout<<item<<endl;});
2024-10-23 18:45:36 +08:00
// resp.or_else([](auto err_msg){cout<<err_msg<<"\n";});
2024-10-24 14:14:12 +08:00
// auto table_result = conn.GetTables();
2024-11-22 17:14:20 +08:00
// auto result = conn.Query("SELECT IMEI_1 FROM R303 WHERE Powertest=1;");
// ranges::for_each(result.value(), [](auto row){
// ranges::for_each(row, [](auto item){
// cout<<item<<", ";
// });
// cout<<endl;
// });
2024-10-14 18:08:50 +08:00
return 0;
}