Mailing List
Home
Forum Home
MySQL General - General MySQL discussion
MySQL++ - Programming with the C++ API to MySQL
MaxDB - Everything about MaxDB, formerly known as SAP DB
ODBC - ODBC with the MySQL Connector/ODBC driver
MySQL on Win32 - Runing MySQL on Windows 9x/Me/NT/2000/XP
Java Help - Mostly related to the MySQL Connector/J driver
Perl - Perl support for MySQL with DBI and DBD::mysql
GUI - MySQL GUI Tools
Announcement
Subjects
Subject: mysql openssl Question
ERROR 1045: Access denied for user: 'root@localhost ' (Using
password: NO)
Update one field with more fields from another table
Subject: Getting Identity after INSERT
ERROR 2002: Can 't connect to local MySQL server through socket
mysql test 4 1 fails with the gis test
Subject: MySQL Cluster Software
Downgrade Mysql from 4 to 3 23
Mysql 4 0 Oracle Stored Procedure Trigger Conversion
Can 't access mysql after kernel upgrade
Executing MySQL Commands From Within C Program
Comparing and writing out BLOBS
Subject: Re: Preventing Duplicate Entries
FULLTEXT query format question
Strange behavior, Table Level Permission
Does the binary log enabling affect the MySQL performances?
mysql:it 's a db not a dbms how it 's possible?!
mysql have same function mthod as Oracle decode()
 
Application hangs at Result call to at()...

Application hangs at Result call to at()...

2007-11-23       - By Graham Reitz

 Back
Reply:     1     2     3     4     5     6     7  

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