Thanks for the reply Jim,
I think that it is returning something. I did some more work on this
(see my more recent posts with more code and backtraces 'Query object
seg. faults on destruction'). I distilled the example further to try
to narrow it down.
This line of code outputs the following:
cout << "Result received = " << client_id_result.rows() << endl;
Result received = 1
And this line of code evaluates to true:
client_id_result = client_id_query.store();
if (client_id_result) {} // type Result
So I think there is something in there. I hope this is something that
I am simply missing, and somehow I got lost.
graham
On Nov 26, 2007, at 7:16 AM, Jim Wallace wrote:
> Are you actually getting anything back? I usually check the result
> set
> before accessing it since it will probably crash when trying to access
> client_id_result.at(0) if there is nothing in the vector.
>
>> -----Original Message-----
>> From: Graham Reitz [mailto:grahamreitz@stripped]
>> Sent: Friday, November 23, 2007 6:35 PM
>> To: MySQL++ Mailing List
>> Subject: Application hangs at Result call to at()...
>>
>> I have an application that does the following:
>>
>> unsigned int some_db::client_id_query(std::string &client_username,
>> std::string &client_password,
>> std::string &error_msg) {
>> try
>> {
>> Query client_id_query = m_connection.query();
>> client_id_query << "select client_id from clients
>> where client_user_name ="
>> << quote_only << client_username << " and
>> client_password ="
>> << quote_only << client_password;
>>
>> cout << "Query created\n";
>>
>> Result client_id_result = client_id_query.store();
>>
>> cout << "Result received\n";
>>
>> Row client_id_row;
>> if (client_id_row = client_id_result.at(0)) // It
>> hangs here, and eventually hard crashes.
>> {
>> return client_id_row.at(0);
>> }
>> }
>> catch (exception &e)
>> {
>> error_msg = e.what();
>> }
>> catch (...)
>> {
>> error_msg = "Unknown exception";
>> }
>> return 0;
>> }
>>
>> The output is:
>> Connected to the some database (this is from the main
>> function) Query created Result received (hangs here for about
>> 20-30 seconds and than hard
>> crashes)
>>
>> I can perform a manual query in the database using the mysql
>> client and it returns a result without issue.
>> What would cause it to hang for about 20-30 seconds at the
>> client_id_result.at(0) call?
>> If there is something fundamentally wrong with this code I
>> would be grateful for any advice.
>>
>> Thanks,
>> graham
>>
>>
>
> --
> MySQL++ Mailing List
> For list archives: http://lists.mysql.com/plusplus
> To unsubscribe: http://lists.mysql.com/plusplus?unsub=1
>