Home > Archive > PERL POE > June 2005 > nobody knows how to do that?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
nobody knows how to do that?
|
|
|
| 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
| |
| David Davis 2005-06-09, 4:00 am |
| 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 =3D> {
sql =3D> "insert into tbl values(nextval('tbl_id'),=
?)",
placeholders =3D> [ 'some_value' ],
event =3D> sub {
croak $_[0]->{error} if ($_[0]->{error});
print "insert id: ".$_[0]->{insert_id}."\n";
},
last_insert_id =3D> 'SELECT LAST_INSERT_ID()',
}
);
event can be a postback, coderef, or event name.
Easy enough?
David
On 5/18/05, Laura <laura@zmail.ru> wrote:
> I just need to insert the data and get back it`s id
> immediately...
>=20
> $sql=3D"insert into tbl
> values(nextval('tbl_id'),'some_value')";
> $k->post("ladbi" =3D> "do",
> SuccessEvent =3D> "insert",
> FailureEvent =3D> "failed",
> HandleId =3D> $dbh_id,
> Args =3D> [ $sql],
> );
>=20
> please help, thank you
> ---
> Professional hosting for everyone - http://www.host.ru
>
| |
| Rocco Caputo 2005-06-09, 4:00 am |
| On Thu, May 19, 2005 at 10:20:36AM +0400, Laura 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],
> );
It looks like the author of LaDBI doesn't read the list. Maybe you
can contact him directly? His e-mail address is in the documentation.
--
Rocco Caputo - http://poe.perl.org/
|
|
|
|
|