List:MySQL++« Previous MessageNext Message »
From:Rieu Nicolas Date:June 16 2006 8:24am
Subject:Destruction of the Connection fails
View as plain text  
Hello,
I've got the same problem than mazah_82

At the end of the block, the program doesn't terminate correctly:
The program displays (cout)
1
2
But it stops before displaying 3

Here is my code:
--------------------------------
  Connection & conn = BdParam::getConnexion(); // see later: I explain how
								// to
connect

  // Creation de la requete à partir de la connexion
  Query query = conn.query();
  query << "select BAL_LAT "
        << "from BALISE "
        << "where BAL_PK_NOM_BALISE = '" << arNomBase << "'";
   
  // execution de la requete
  Result res = query.store();

cout<<"1"<<endl;

  if (res.size() > 0) {

  	Row row = res.at(0);

      double l = row.at(0);

cout<<"2"<<endl;
  }
cout<<"3"<<endl;

....
-----------------------------------
How do I create the connection to the database ? :

I've got a static class "BdParam", which defines a static Connection (con)

-----------------------------------
// declaration of the connection
Connection BdParam::con=Connection(use_exceptions);

// method implementing the connection
Connection & BdParam::getConnexion() {

 
  BdParam::con.connect("database",
                       "host",
                       "user",
                       "password");
  return BdParam::con;
  }

Is anyone able to notice I made a mistake or not?
Thanks a lot for replying, please.

Nicolas


This message contains information that may be privileged or confidential and is the
property of the Capgemini Group. It is intended only for the person to whom it is
addressed. If you are not the intended recipient,  you are not authorized to read, print,
retain, copy, disseminate,  distribute, or use this message or any part thereof. If you
receive this  message in error, please notify the sender immediately and delete all 
copies of this message.

Thread
Destruction of the Connection failsRieu Nicolas16 Jun
  • Re: Destruction of the Connection failsWarren Young17 Jun