sql::Driver *driver;
sql::Connection *dbConn;
sql::Statement *stmt;
try{
driver = get_driver_instance();
dbConn = driver->connect("tcp://172.0.0.1:3306", "user", "password");
stmt = dbConn->createStatement();
dbConn->setSchema("zabbix");
res = stmt->executeQuery("INSERT INTO table(name,surname) VALUES ('123','33333333')");
}catch (sql::SQLException e) {
cout << "SQL error. Error message: " << e.what() << endl;
}
Hello guys, I have the following problem: in this code I am trying to insert data to my table, but when the code arrives to row execute query it's going to catch part (error code: 0) and data has been inserted, and when I am trying to execute code without the try/catch, the program is being blocked.
Error point:
[First <kbd>F5</kbd>] `Unhandled exception at 0x00007FFF7B254008 in ConsoleApplication3.exe: Microsoft C++ exception: sql::SQLException at memory location 0x00000014AFDDF5F0.`
[Second <kbd>F5</kbd>]: `Unhandled exception at 0x00007FFF7BCEA508 (ucrtbase.dll) in ConsoleApplication3.exe: An invalid parameter was passed to a function that considers invalid parameters fatal.`
which is the cause of this problem? how to use correctly insert to table?