I'm unaware of a way to do that with LaDBI

Use EasyDBI instead. :P

I'm assuming you are using mysql here:

 $_[KERNEL]->post( 'EasyDBI',
                insert => {
                        sql => "insert into tbl values(nextval('tbl_id'),?)",
                        placeholders => [ 'some_value' ],
                        event => sub {
                              croak $_[0]->{error} if ($_[0]->{error});
                              print "insert id: ".$_[0]->{insert_id}."\n";
                         },
                         last_insert_id => 'SELECT LAST_INSERT_ID()',
                }
);

event can be a postback, coderef, or event name.
Easy enough?

David

On 5/18/05, Laura <[EMAIL PROTECTED]> wrote:
> I just need to insert the data and get back it`s id
> immediately...
> 
> $sql="insert into tbl
> values(nextval('tbl_id'),'some_value')";
>    $k->post("ladbi" => "do",
>             SuccessEvent => "insert",
>             FailureEvent => "failed",
>             HandleId => $dbh_id,
>             Args => [ $sql],
>             );
> 
> please help, thank you
> ---
> Professional hosting for everyone - http://www.host.ru
>

Reply via email to