доброе времени суток. ПОдскажите в чем проблема... есть код...
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <string.h>
#include <stdarg.h>
#include <cppconn/driver.h>
#include <cppconn/exception.h>
#include <cppconn/resultset.h>
#include <cppconn/statement.h>
#include <cppconn/prepared_statement.h>
using namespace std;
sql::Driver *driver;
sql::Connection *con;
sql::Statement *stmt;
sql::ResultSet *res;
int main(int argc, char *argv[])
{
string mphone;
try {
driver = get_driver_instance();
con = driver->connect("tcp://127.0.0.1:3306", "xxx", "xxx");
con->setSchema("test2");
/* получаем номер телефона для отправки смс */
stmt = con->createStatement(); //SUBSTRING_INDEX(value, ':', 1) as val
res = stmt->executeQuery("SELECT DRV_MPHONE FROM DRIVER");
while (res->next())
{
mphone = res->getString("DRV_MPHONE");
}
delete res;
delete stmt;
delete con;
} catch (sql::SQLException &e) {
cout << "# ERR: SQLException in " << __FILE__;
cout << "(" << __FUNCTION__ << ") on line " << __LINE__ << endl;
cout << "# ERR: " << e.what();
cout << " (MySQL error code: " << e.getErrorCode();
cout << ", SQLState: " << e.getSQLState() << " )" << endl;
}
return 0;
}