I'm having a few issues executing sql statements in c++ using the connector.
Any hints or ideas are welcome.
NB: Mysql Connector c++ 1.05
I have these defined in the class header:
sql::Driver *driver;
sql::Connection *con;
sql::Statement *stmt;
sql::ResultSet *res;
sql::PreparedStatement *prep_stmt;
And the functional code in the .cpp file:
driver = get_driver_instance();
con = driver -> connect(url, user, pass);
//con -> setAutoCommit(0);
cout << "\nConnection OK!";
cout << "\nDatabase connection\'s autocommit mode = " << con -> getAutoCommit() << endl;
con 开发者_运维百科-> setSchema(database);
prep_stmt = con->prepareStatement("SELECT * FROM tbl_stats;");
res = prep_stmt->executeQuery(); //BREAKS HERE
The last line breaks with a buffer overrun.
If i step into the line during debug, it occasionally reports that there is no source file, however when it does, it allows you to single step a section of ASM.
this code bellow causes a similar error:
stmt = con->createStatement();
stmt->execute("SELECT * FROM tbl_stats;"); //BREAK HERE
Is there any way to debug this kind of error? Has anyone seen this before?
is there any better/simpler ways of c++ mysql interaction
Thanks,
Luke
精彩评论