List:MySQL++« Previous MessageNext Message »
From:Warren Young Date:August 18 2008 12:59am
Subject:Re: insert_id always 0 when using stored procedures
View as plain text  
On Aug 15, 2008, at 1:03 PM, Guru Clint wrote:

>             m_uliLastID = sqlQuery.insert_id()

If you look at the MySQL++ code, you'll see that Query::insert_id()  
maps pretty much directly to the C API function mysql_insert_id().   
The documentation for that says:

> mysql_insert_id() returns 0 following a CALL statement for a stored  
> procedure that generates an AUTO_INCREMENT value because in this  
> case mysql_insert_id() applies to CALL and not the statement within  
> the procedure. Within the procedure, you can use LAST_INSERT_ID() at  
> the SQL level to obtain the AUTO_INCREMENT value.
insert_id always 0 when using stored proceduresGuru Clint17 Aug
  • Re: insert_id always 0 when using stored proceduresWarren Young18 Aug