List:MySQL++« Previous MessageNext Message »
From:Chris Frey Date:October 21 2005 2:12pm
Subject:Re: Nested queries
View as plain text  
On Fri, Oct 21, 2005 at 12:34:36PM +0200, Mattias Fliesberg wrote:
> while (Row row = res.fetch_row()) {
> 	string stuff;
> 	string id = (row.at(0)).c_str();
> 	string value = (row.at(1)).c_str();
> 	Query query_0 = con.query();
> 	ResUse res_0 = query_0.use("SELECT value2 FROM table2 WHERE id=" + id);
> 	Row row_0 = res_0.fetch_row();
> 	string value2 = (row_0.at(0)).c_str();
> 	if (value2.length() > 0)
> 		stuff = value2;
> 	else
> 		stuff = value;
> 	/* ... */
> }
> 
> It dies at "query_0.use(..." with this output from gdb:
> 
> #0  0x401e7467 in std::basic_string<char, std::char_traits<char>,
> std::allocator<char> >::~basic_string ()
>    from /usr/lib/libstdc++.so.5
> #1  0x08052bd3 in ~basic_stringbuf (this=0xbffff5d0) at query.h:195
> #2  0x08058aeb in ~Query (this=0xbffff580) at main.cpp:45
> #3  0x0805837d in main (argc=1, argv=0xbffffd54) at main.cpp:76

Is there an exception being thrown?  I'm not sure how it can get into the
destructors at the query_0.use() point.

- Chris

Thread
Nested queriesMattias Fliesberg21 Oct
  • Re: Nested queriesChris Frey21 Oct
    • MySQL DevelopmentFabricio Mota22 Oct
  • Re: Nested queriesWarren Young23 Oct
    • Re: Nested queriesMattias Fliesberg24 Oct
      • Re: Nested queriesChris Frey24 Oct
Re: Nested queriesJonatan Taminau21 Oct