mysql_fetch_row bad pointer
Posted by: Stephen Holtom
Date: October 19, 2011 02:35AM

I can't seem to get any queries to work, and I'm not getting standard error return values.

Basically, I'm preparing a query with a parameter, like this:

const char * query = "select * from Checkpoint where Id=?";
pStatement = mysql_stmt_init( m_connection );
mysql_stmt_prepare( pStatement, query, (unsigned long)strlen(query) );

<binding overhead omitted...>

mysql_stmt_bind_param( pStatement, binding );


I've checked all the prepare/bind statements for errors, and there aren't any.

Then when I want to use my query I do this:


mysql_stmt_execute( pStatement );
MYSQL_RES result = mysql_store_result( m_connection );
unsigned int numFields = mysql_num_fields(result);
unsigned long numRows = mysql_num_rows(result);
MYSQL_ROW row = mysql_fetch_row(result);

...and here's the weird thing: the first few lines run fine, and numFields == 4, and numRows == 1, exactly what I expect for this query.
But while 'row' is non-null, it's just gibberish. row[0] (and all the other char*s) are bad pointers.

What am I doing wrong? Is this a bug in MySQL?
Any help appreciated.

Options: ReplyQuote


Subject
Views
Written By
Posted
mysql_fetch_row bad pointer
2882
October 19, 2011 02:35AM


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.