[Dbix-class] Re: [Catalyst] Session::Store::DBIC and session table (postgres)

Fernan Aguero fernan.aguero at gmail.com
Thu Nov 15 13:31:21 GMT 2012


On Wed, Nov 14, 2012 at 5:56 PM, Francisco Obispo <fobispo at isc.org> wrote:

> Use:
>
> $c->model('GUS::WebappSession') as the name.


So, it was a good suggestion after all ... it didn't work at first, and I
think this led me to (maybe) a possible fix

This doesn't work:

sub remove_sessions : Private {
  my ( $self, $c ) =3D @_;
  $c->delete_expired_sessions;
}

And this doesn't either:

sub remove_sessions : Private {
  my ( $self, $c ) =3D @_;
  my $model =3D $c->model('GUS::WebappSession');
  my $rs =3D $model->search(  { expires =3D> { '<' , time() } } )->delete;
}

But this workaround did work:

sub remove_sessions : Private {
  my ( $self, $c ) =3D @_;
  my $model =3D $c->model('GUS::WebappSession');
  my $rs =3D $model->search(  { expires =3D> { '<' , time() } } );
  while (my $session =3D $rs->next() ) {
    $session->delete;
  }
}

So, apparently the problem is calling delete() right on the resultset
object. For some reason that eludes me, DBIC is not fully qualifying the
table in this case.

Whereas when I call delete() on the DBIC::Class::Row? object it works.

Now looking back I guess I should have started all this fuss on the DBIC
mailing list :)

Folks, apologies for the cross-post, but I'm now moving the discussion to
its natural home.

For those interested here's the link to the complete thread:
http://www.mail-archive.com/catalyst@lists.scsys.co.uk/msg13542.html

And here's the link to the RT ticket
https://rt.cpan.org/Ticket/Display.html?id=3D81179



-- =

fernan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20121115/986=
43db2/attachment.htm


More information about the DBIx-Class mailing list