Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

RE: unsuccessful queries and lost connection

From: Jim Wallace <jwallace(at)kaneva.com>
Date: Wed Jul 25 2007 - 07:50:25 EDT


You could lose connection for various reason such as how the server is configured, timeouts, etc.

catch is the correct way to deal with it. What you do then is application specific.

Search the mailing list for "connection" or "retry" since there has been quite a few postings on retry methods. I posted my try/catch macros some time back. If you can't find them e-mail me and I'll send you a sample of what I do.

-----Original Message-----
From: Albert Sanchez [mailto:ouferrat@gmail.com] Sent: Wednesday, July 25, 2007 4:16 AM
To: plusplus@lists.mysql.com
Subject: unsuccessful queries and lost connection

Hi all,

I'm programming a piece of software that continuously looks up if it has pending sql queries (UPDATE and INSERT) and executes them. I should also control if I lost the db connection or if a sql query was unsuccessful.

My question is:

in what circumstances could I lose the connection to the db and how would I realize it?

Do you need help?X

I have found in the refman a mysqlpp::BadQuery class.

Just something like this?

try {

    mysqlpp::Query sqlQuery = sqlConn.query();     sqlQuery << q;
} catch(mysqlpp::BadQuery ex) {

}

Is there a better way to deal with errors?

I only want to know if it occurred an error, I am not interested in other stats or results.

Thanks in advance,
Albert

-- 
MySQL++ Mailing List
For list archives: 
http://lists.mysql.com/plusplus
To unsubscribe:    
http://lists.mysql.com/plusplus?unsub=lists@pantek.com
Received on Wed Jul 25 07:50:42 2007
Do you need more help?X

This archive was generated by hypermail 2.1.8 : Thu Aug 09 2007 - 19:28:34 EDT


Contact Us  Legal Notices  Order Services Online 
Pantek Home  Privacy Policy  IT news  Site Map  Pantek Library