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

2012-11-15 Thread Fernan Aguero
On Thu, Nov 15, 2012 at 10:38 AM, Peter Rabbitson wrote:

> On Thu, Nov 15, 2012 at 10:31:21AM -0300, Fernan Aguero wrote:
> > 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.
>
> This is a known issue, RT#80015. Should be fixed shortly (hopefully before
> next weekend). In the meantime use $rs->delete_all, which in essence is
> your workaround, just a little more efficient.



Great! Will patch my code (and Session::Store::DBIC) with your
suggestion until then.

Thanks!

-- 
fernan
___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


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

2012-11-15 Thread Fernan Aguero
On Wed, Nov 14, 2012 at 5:56 PM, Francisco Obispo  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 ) = @_;
  $c->delete_expired_sessions;
}

And this doesn't either:

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

But this workaround did work:

sub remove_sessions : Private {
  my ( $self, $c ) = @_;
  my $model = $c->model('GUS::WebappSession');
  my $rs = $model->search(  { expires => { '<' , time() } } );
  while (my $session = $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=81179



-- 
fernan
___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/