List:MySQL++« Previous MessageNext Message »
From:Jim Wallace Date:November 26 2007 1:16pm
Subject:RE: Application hangs at Result call to at()...
View as plain text  
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
> 
> 
Thread
Application hangs at Result call to at()...Graham Reitz24 Nov
  • Re: Application hangs at Result call to at()...Graham Reitz24 Nov
    • Re: Application hangs at Result call to at()...Graham Reitz24 Nov
      • Re: Application hangs at Result call to at()...Graham Reitz24 Nov
      • Re: Application hangs at Result call to at()...Warren Young26 Nov
  • RE: Application hangs at Result call to at()...Jim Wallace26 Nov
    • Re: Application hangs at Result call to at()...Graham Reitz26 Nov