List:MySQL++« Previous MessageNext Message »
From:Jim Graf Date:September 26 2008 3:01pm
Subject:Fwd: possible bug
View as plain text  
I replied to the OP forgetting to change the reply to
plusplus@stripped. Anybody aware of how to make gmail filters modify
headers?

---------- Forwarded message ----------
From: Jim Graf <exportfs@stripped>
Date: Fri, Sep 26, 2008 at 7:59 AM
Subject: Re: possible bug
To: Izzy <estreams@stripped>


On Fri, Sep 26, 2008 at 6:20 AM, Izzy <estreams@stripped> wrote:

>
> mysqlpp::Connection *pCon;
>
> and tried
> pCon = new mysqlpp::Connection[ 20 ];
>
> everything linked normally without problems.
> But when I looped and tried to connect every connection, I got bunch
> of catched exceptions, like MySql gonne away, and similar.
>

Very simple testing shows that:

  mysqlpp::Connection *pCon;
  pCon = new mysqlpp::Connection[ 20 ];

runs the default Connection constructor, and I might mention, it is
perfectly valid c++. If there are any issues with creating and maintaining
objects in this manner, I am not aware or have forgotten?

So what does the code look like "when I looped and tried to connect every
connection"?

Did you do something like:

mysqlpp::Connection *pCon;
pCon = new mysqlpp::Connection[9];
for (int i=0; i < 9; i++){
  if (pCon[i].connect(db, server, user, pass)){
    std::cout << "made connection" << std::endl;
    std::string s;
    std::stringstream out;
    out << i;
    s = std::string("MR0")+out.str();
    mysqlpp::Query query = pCon[i].query("select chip from Chip where
chip='"+s+"'");
    mysqlpp::StoreQueryResult res = query.store();
    for (size_t j = 0; j < res.num_rows(); ++j) {
      cout << '\t' << res[j][0] << endl;
    }

  } else {
    std::cout << "a problem making connection" << std::endl;
  }
}
exit(1);

jgraf@gr-icad11 [1081]$ ./simple1 -s gr-icad4:3307 -u reteng -p ....
Connection::Connection(bool te)
Connection::Connection(bool te)
Connection::Connection(bool te)
Connection::Connection(bool te)
Connection::Connection(bool te)
Connection::Connection(bool te)
Connection::Connection(bool te)
Connection::Connection(bool te)
Connection::Connection(bool te)
made connection
made connection
        MR01
made connection
        MR02
made connection
        MR03
made connection
made connection
        MR05
made connection
made connection
made connection
        MR08

which is exactly correct (ie, MR00 does not exist).

I hacked on simple1.cpp and Connection.cpp to get this output.

-jim

Thread
Fwd: possible bugJim Graf26 Sep
  • Re: Fwd: possible bugMickaël Wolff26 Sep
    • Re: Fwd: possible bugIzzy28 Sep
      • Re: Fwd: possible bugMickaël Wolff28 Sep
      • Re: Fwd: possible bugJoel Fielder29 Sep
        • Re: Fwd: possible bugRick Gutleber29 Sep
          • Re: Fwd: possible bugJoseph Artsimovich29 Sep
          • Re: Fwd: possible bugAndrew Sayers29 Sep
          • Re: Fwd: possible bugIzzy29 Sep