insert_id() returns 0 -
10-14-2005
, 11:05 AM
Hopefully I'm making a silly mistake, but I am having problems with
insert_id().
Code:
Query query = con.query();
ostringstream strbuf;
strbuf.precision(12);
strbuf << "INSERT INTO ...."
query.exec(strbuf.str());
id = con.insert_id();
The query executes fine, but id is 0 at this point.
------------------------------
I am able to get insert_id() to work in dozens of other places in my
application where I do not need precision using the following code:
Query query = con.query();
query << "INSERT INTO ...";
query.execute();
id = con.insert_id();
So, What is the difference between the query.execute and
query.exec(str)? |