At 4:36 PM -0700 11/30/01, Jason Hall wrote:
>allrighty, 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.
It's mysql_insertid, not mysql_insert_id. Also, if you inserted the
record using $dbh->do() rather than $sth = $dbh->prepare() + $sth->execute(),
you should use $dbh->{mysql_insertid} rather than $sth->{mysql_insertid}.
>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 ?
>
>using .43 on linux RH7.1 compiled from source
>--
>Jayce^