MySQL Forums
Forum List  »  Connector/C++

prepared statement woes in v1.1.0
Posted by: Dominic Froud
Date: October 21, 2009 04:52PM

I'm trying to use v1.1.0 downloaded via launchpad with prepared statements.
I've chosen v1.1.0 as it includes the memory corruption fix for bug 45048.

Code that was previously working now fails with errors like:

SQL: SELECT distinct Users.* FROM Users WHERE Users.username = ?
terminate called after throwing an instance of 'sql::SQLException'
what(): Value not set for all parameters

or more commonly:

SQL: SELECT distinct Users.* FROM Users
terminate called after throwing an instance of 'sql::InvalidArgumentException'
what(): MySQL_Prepared_ResultSet::getDouble: can't fetch because not on result set

I should point out that the getDouble error is actually thrown by a call to getUInt64!

I've narrowed the first error down to a subclassed object method call that does a pstmt->setString() call. My method call is between pstmt = con->prepareStatement(sql) and res = pstmt->executeQuery()

If I do the pstmt->setString() without a method call then it works fine so I'm wondering if something is going wrong between pstmt->setString() call and returning back to the stack frame with the pstmt->executeQuery().

For the second error, the code calls res->next() which returns true but then res->getUInt(1) dies.

Is anyone else having prepared statement issues?

This all worked fine in v1.0.5 (bug 45048 notwithstanding)

Regards,

Dominic

Options: ReplyQuote


Subject
Views
Written By
Posted
prepared statement woes in v1.1.0
6577
October 21, 2009 04:52PM
2654
October 22, 2009 06:02AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.