#include #include #include "mysql_connection.h" #include #include #include #include #include #include #include #include using namespace std; vector v; // вказівки SQL, зчитані з файлу int main(void) { try { sql::Driver *driver; sql::Connection *con; sql::ResultSet *res; sql::Statement *stmt; sql::PreparedStatement *pstmt; string s; driver = get_driver_instance(); con = driver->connect("tcp://127.0.0.1:3306", // 127.0.0.1 - адреса сервера // 3306 — номер порту; "root", // обліковий запис користувача "!@#123Qwe" // пароль ); stmt = con->createStatement(); stmt->execute("USE school;"); delete stmt; ifstream fi; fi.open("02.txt"); while (!fi.eof()) { getline(fi,s); if (s!="") { cout << endl << s << endl; pstmt = con->prepareStatement(s); res = pstmt->executeQuery(); while (res->next()) { bool yes = true; for (int k=1; yes; k++) try { s=res->getString(k); if (s=="") s="null"; cout << s+" "; } catch (sql::SQLException &e) {yes = false;} cout <