[Dbix-class] Access a Sequence - Best practice

Brandon Black blblack at gmail.com
Tue May 15 20:10:35 GMT 2007


On 5/15/07, SHAD0WRUNNER at gmx.de <SHAD0WRUNNER at gmx.de> wrote:
> Hello,
>
> I want to update many Rows with the same sequence-number.
> My solution is :
>
> $sql = "SELECT my_seq.nextval FROM DUAL";
> ($id)  = $storage->_dbh->selectrow_array($sql);
>
> $resultset->update({ 'nr' => \'my_seq.currval'});
>
> or
>
> $resultset->update({ 'nr' => $id });
>

Well, off of the main topic, you should really use $storage->dbh
rather than $storage->_dbh, or you're not protected from disconnected
dbh's.

-- Brandon



More information about the Dbix-class mailing list