rdmenezes / remote-testbed

Automatically exported from code.google.com/p/remote-testbed
0 stars 1 forks source link

Incompatible mysql++ library changes since version 2.2.0 #2

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
There are some changes in the interface of MYSQL++ since v. 2.2.0         

which causes a crash in code like the following in the MCI component:

{{{
        mysqlpp::Query moteupdate = sqlConn.query();
        moteupdate << "update mote set site_id = %0:site_id,
curr_session_id=NULL, priv_session_id=NULL where id = %1:mote_id";
        moteupdate.parse();

        moteupdate.def["site_id"] = site_id;
        moteupdate.def["mote_id"] = mote_id;

                            }}}

http://tangentsoft.net/mysql++/doc/html/userman/breakages.html#id2912942
mentions that code will have to change from:
{{{
Query q = con.query();
q << "delete from mytable where myfield=%0:myvalue";
q.parse();
q.def["myvalue"] = some_value;
q.execute();
}}}

...to something more like this:

{{{
Query q = con.query();
q << "delete from mytable where myfield=%0";
q.parse();
q.execute(some_value);
}}}

Original issue reported on code.google.com by jonas.fonseca on 28 Aug 2007 at 2:27

GoogleCodeExporter commented 9 years ago
Rosta has patch to conditionally work around this for newer versions of mysql++.

Original comment by jonas.fonseca on 25 Oct 2007 at 3:39

GoogleCodeExporter commented 9 years ago

Original comment by jonas.fonseca on 2 Nov 2007 at 9:58

GoogleCodeExporter commented 9 years ago
Since the MCS really doesn't have any need for using the template interface 
(with
%0:...) it might be better to just use the simpler "string composing" interface.

The above example would end up being:

  mysqlpp::Query q = con.query();
  q << "delete from mytable where myfield=" << some_value;
  q.execute();

Where quoting can be performed by putting mysqlpp::quote into the stream:

  mysqlpp::Query q = con.query();
  q << "delete from mytable where myfield=" mysqlpp::quote << some_value;
  q.execute();

Original comment by jonas.fonseca on 2 Nov 2007 at 1:18

GoogleCodeExporter commented 9 years ago
Patch that replaces all template queries with normal queries.

Original comment by jonas.fonseca on 5 Nov 2007 at 7:50

Attachments:

GoogleCodeExporter commented 9 years ago
The above patch is buggy since the moteselect query in Host::findOrCreateMote() 
is
reused and only template queries support this. A newer version has been pushed 
to the
next branch of the public remote-mci repository at repo.or.cz. The head commit 
is
attached here, it however depends on two cleanup commits.

Original comment by jonas.fonseca on 6 Nov 2007 at 1:26

Attachments:

GoogleCodeExporter commented 9 years ago
The fix was queued in the "next" branch of the remote-mci repository

Original comment by jonas.fonseca on 7 Nov 2007 at 7:30

GoogleCodeExporter commented 9 years ago

Original comment by jonas.fonseca on 12 Nov 2007 at 9:28

GoogleCodeExporter commented 9 years ago
This has been merged as of commit ed053c00d3a35bde42521c6f7bb9cb9ee2b82b44 ...

Original comment by jonas.fonseca on 14 Nov 2007 at 8:45