List:General Discussion« Previous MessageNext Message »
From:Jason Hall Date:November 30 2001 11:34pm
Subject:mysql_insert_id and transactions
View as plain text  
allrighty, for you perl/mysql folks here is the trouble I'm having.
I'm tyring to do a transaction in mysql/innodb in perl with the following 
basic flow
eval{
        Insert my first record
        get the insert_id
                (using $sth->{mysql_insert_id})
        now perform other inserts that need that key
        commit;
};
if($@)
{
        rollback;
        and other logic
}

the only problem is the {mysql_insert_id} doesn't give me anything back.  
NADA...
Is this a bug only in transactions or innodb? since I know the function is 
working in autocommit / MyIsam tables.
Do I have to do the select last_insert_id ? Because that IS working (and 
consequently what I am doing now).

using .43 on linux RH7.1  compiled from source
-- 
Jayce^
Thread
mysql_insert_id and transactionsJason Hall1 Dec
Re:mysql_insert_id and transactionsHeikki Tuuri1 Dec
  • Re:mysql_insert_id and transactionsJani Tolonen3 Dec
  • Re:mysql_insert_id and transactionsJani Tolonen3 Dec
Re:mysql_insert_id and transactionsHeikki Tuuri3 Dec