![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
|
Query query = con.query(); ResUse res = query.use("SELECT id,value FROM table"); while |
#2
| |||
| |||
|
|
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 |
#3
| |||
| |||
|
|
I'm trying to execute a query, within another queries loop. |
#4
| |||
| |||
|
#5
| |||
| |||
|
|
Oh, of course it does. But how is it solved in PHP? I know you can do it there... I've tried the seperate connection solution but it didn't work, guess I'll try it again. //Mattias On 10/23/05, Warren Young <mysqlpp (AT) etr-usa (DOT) com> wrote: Mattias Fliesberg wrote: I'm trying to execute a query, within another queries loop. The MySQL C API that underlies MySQL++ imposes restrictions on that. RTFM. You must consume all rows from a SELECT before you can issue another query on the same connection. To get around this, you can use separate Connection objects, and get a Query object from each one. -- MySQL++ Mailing List For list archives: http://lists.mysql.com/plusplus To unsubscribe: http://lists.mysql.com/plusplus?unsu...mail (DOT) com |
![]() |
| Thread Tools | |
| Display Modes | |
| |