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()
 
Subject: Re: probleme with exeptions

Subject: Re: probleme with exeptions

2007-10-02       - By Hai Nguyen

 Back
It looks like your exception is coming from the underlining c++ string
stuff and not from mysql++.

You can try adding in a catch all for std::exception or just a "...", e.g.

catch ( const std::exception& e)  {
// do something
}
or
catch ( ... )  {
// do something
}

You also might want to do a stack trace to see what's generating that
exception.

I hope that helps in some way...

- Hai

Maarten Schrijvers wrote:
> Herv? accidently sent this to my email...
>
> Hello all,
>
> I using mysql++-2.3.2 on hp-ux
>
> I use a instance of
>     mysqlpp::Connection m_db;
>
> the exception it's normaly at true.
>
> it's a example of use:
> void OnLoadCalendrier()
> {
>
>     database.OpenConnection();
>     string strlog;
>
>     string sql;
>     int nb_result;
>     mysqlpp::Query query = database.m_db.query();
>     mysqlpp::Row row;
>     int nbgrp=0, nbcc=0;
>
>     CCalendrier *cal;
>     IteCal ite;
>    
>     try
>     {
>        
>         sql = SQL_SELECT_CALENDRIER;
>         query << sql;
>         r->LogRoomSend((char*)sql.c_str());
>
>         mysqlpp::Result res = query.store();
>         nb_result = res.size();
>         mysqlpp::Result::iterator i;
>         if(res.num_rows()>=1)
>         {
>             for (i = res.begin(); i != res.end(); i++) {
>                 row = *i;
>                
>                 cal = new CCalendrier();
>                 cal->id = atoi(row["id_calendrier"]);
>    
> cal->decode(TYPE_JSEM,(char*)row["jsem"].c_str());
>                 cal->decode(TYPE_MOIS,
> (char*)row["mois"].c_str());
>                 cal->decode(TYPE_JOUR,
> (char*)row["jour"].c_str());
>                 cal->decode(TYPE_HEURE,
> (char*)row["heure"].c_str());
>                 cal->decode(TYPE_MINUTE,
> (char*)row["minute"].c_str());
>                 cal->decode(TYPE_SECONDE,
> (char*)row["seconde"].c_str());
>                
>                 if(!row["time_deb"].is_null() &&
> !row["time_fin"].is_null() )
>                 {
>    
> cal->add_timeperiode((char*)row["time_deb"].c_str(),(char*)row["time_fin"].c
>
> _str());
>                    
>                 }
>                
>                 ite = ListeCal.searchPos(cal->id);
>    
>                 if(ite == ListeCal.ListeCDC.end())
>                     ListeCal.ListeCDC.push_back(*cal);
>                 else
>                 {
>                     ite = ListeCal.searchPos(cal->id);
>                     ListeCal.ListeCDC.insert(ite,*cal);
>                     ite = ListeCal.searchPos(cal->id);
>                     ListeCal.ListeCDC.erase(ite);
>
>                 }
>                
>             }  
>             query.clear();
>        
>         }
>         //cerr << "nbre Calendrier : "<< nb_result << endl;
>     } catch ( const mysqlpp::BadQuery& er){         cerr << "Error: "
> << er.what() << endl;
>         strlog ="GetTelephone() - Error: ";
>         strlog += er.what() ;
>         r->LogRoomSend((char*) strlog.c_str());
>     } catch (const mysqlpp::BadConversion& er) {
>         cerr << "Error: convertion "<< er.what()<< endl;
>         strlog ="GetTelephone() - Error convertion : ";
>         strlog += er.what() ;
>         r->LogRoomSend((char*) strlog.c_str());
>     }  
>     catch (const mysqlpp::Exception& er) {
>         cerr << "Error: hummmm : \n" << er.what() << endl;
>         strlog ="GetTelephone() - Error hummmm : ";
>         strlog += er.what() ;
>         r->LogRoomSend((char*) strlog.c_str());
>     }  
>
> }
>
> But after all exception the program abort.
>
>
> terminate called after throwing an instance of 'std::out_of_range'
>  what():  basic_string::substr
> IOT Trap
> Abort(coredump)
>
> Please help-me.
>
> Herv?
>
>
>
>


--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe:    http://lists.mysql.com/plusplus?unsub=mysql@(protected)