Quantcast
Channel: MySQL Forums - Connector/C++
Viewing all articles
Browse latest Browse all 527

SQLString anomaly (no replies)

$
0
0
I've been having [many] issues configuring the C++ connector including an application crash from ResultSet::getString(""), app crash while getting a driver instance, countless link errors with no helpful information on how to resolve, etc...and have gotten a lot closer to getting the connector ironed out. I've looked at the source for sqlstring.h, and I'm not sure why the member realString is not being initialized in the SQLString constructor. Here's a simple example showing what I'm experiencing.

#include "boost/asio.hpp" // <-- Included to fix a preprocessor issue between boost and the mysql libs
#include "mysql_driver.h"
#include "mysql_connection.h"
#include "cppconn/statement.h"
#include "cppconn/sqlstring.h"
int main()
{
    sql::SQLString query("UNIX_TIMESTAMP()"); // <-- query.realString = null here.
	sql::mysql::MySQL_Driver* driver = sql::mysql::get_driver_instance();
    sql::Connection* connection = driver->connect("localhost", "root", "");
    connection->setSchema("generic");
	sql::Statement* statement = connection->createStatement();
	statement->executeUpdate(query); // <-- Crashes with a bad pointer (query.realString) here.
	return 0;
}

Can anyone shed some light on this?

Thanks.

* I was able to fix it by editing the source of the distributed sqlstring.h file.

Viewing all articles
Browse latest Browse all 527

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>