Re: [Catalyst] Query not working

2012-05-10 Thread Greg Matheson
On Thu, 10 May 2012, Kenneth S Mclane wrote:

> That has not been my experience. I have asked several questions there with 
> little to responses.

In that case, try the #dbix-class channel on irc.perl.org. They 
are responsive, in my experience.

> Yes DBIx::Class, but I am trying to use the result files and models 
> generated by the helper script.



> From:
> Tomas Doran 
> To:
> The elegant MVC web framework 
> Date:
> 05/10/2012 09:29 AM
> Subject:
> Re: [Catalyst] Query not working




> On 10 May 2012, at 15:17, Kenneth S Mclane wrote:

> > I am trying to port this query to Catalyst: 

> You mean DBIx::Class - Catalyst is totally database agnositc (no database 
> is even required)

> Whilst a lot of people here also use DBIC (and DBIC questions often get 
> asked/answered here), you're generally more likely to get useful advice on 
> the DBIC mailing list.

> Cheers
> t0m


> ___
> 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/




> ___
> 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/


___
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] Query not working

2012-05-10 Thread Kenneth S Mclane
That has not been my experience. I have asked several questions there with 
little to responses.

Yes DBIx::Class, but I am trying to use the result files and models 
generated by the helper script.



From:
Tomas Doran 
To:
The elegant MVC web framework 
Date:
05/10/2012 09:29 AM
Subject:
Re: [Catalyst] Query not working




On 10 May 2012, at 15:17, Kenneth S Mclane wrote:

> I am trying to port this query to Catalyst: 

You mean DBIx::Class - Catalyst is totally database agnositc (no database 
is even required)

Whilst a lot of people here also use DBIC (and DBIC questions often get 
asked/answered here), you're generally more likely to get useful advice on 
the DBIC mailing list.

Cheers
t0m


___
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/



___
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] Query not working

2012-05-10 Thread Tomas Doran

On 10 May 2012, at 15:17, Kenneth S Mclane wrote:

> I am trying to port this query to Catalyst: 

You mean DBIx::Class - Catalyst is totally database agnositc (no database is 
even required)

Whilst a lot of people here also use DBIC (and DBIC questions often get 
asked/answered here), you're generally more likely to get useful advice on the 
DBIC mailing list.

Cheers
t0m


___
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/


[Catalyst] Query not working

2012-05-10 Thread Kenneth S Mclane
I am trying to port this query to Catalyst:

SELECT
 s.server_id, 
 a.account_code,
 s.server_name,
 s.server_type,
 s.os_name,
 (select count(*) from server ss, subsystem sb 
where ss.server_id = sb.server_id 
and ss.server_id = s.server_id) as num_subsystems   
FROM 
 account a,
 server s
WHERE a.account_id = s.account_id
order by a.account_code, s.server_name

This is what I have so far:

sub list :Local {
my ($self, $c, $page) = @_;
$page = $c->req->param('page') || 1;
my $rs = $c->model('ORANGES::Server')->search_rs(undef, { 
prefetch => ['account','subs'],
rows => 15,
page => $page,
'+select' => [{count => 'subs.subsystem.id'}],
'+as' => [qw/num_subs/], 
order_by => ['account.account_code', 'server_name'],
 });
$c->stash(rows => $rs);
$c->stash(pager => $rs->pager());
$c->stash->{'template'}=>'server/list';
}

I haven't figured out the count statement as yet. I am currently getting 
my "as" added to the sql twice, i.e. "AS num_subs AS num_subs".

I can only find examples counting one field, let alone 2 tables and since 
I can't get it to return any results I can't even tell if it is counting 
correctly.

___
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] Authentication in a Many Database Scenario

2012-05-10 Thread Aaron Trevena
On 9 May 2012 21:51, Steve  wrote:
> I have such an application, albeit a small one with multiple databases - one
> per customer.  I store all the users in a single, separate database, and for
> each user, store a reference to their particular database.  Once
> authenticated, I use InstancePerContext to build the appropriate database
> model.  It works fine.

Something I've frequently seen is putting memcached in front of the
user/session database, this allows you to abstract away (and
denormalize if necessary) that database nicely and only worry about
your application/site database in most of the application itself -
especially for mass hosting sites, or dealing with large clusters of
split databases (by region, country, white-label, etc)

Cheers,

A

-- 
Aaron J Trevena, BSc Hons
http://www.aarontrevena.co.uk
LAMP System Integration, Development and Consulting

___
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] Authentication in a Many Database Scenario

2012-05-10 Thread Aaron Trevena
On 9 May 2012 22:10,   wrote:
> Thanks for that, it looks like what I need, just need to puzzle out how it
> works.

The ConfigPerSite catalyst component trait uses InstancePerContext,
and configures each context based on combination of host/path to get
the configuration, the aim of the module is to host multiple sites or
sub-sites in a single catalyst app with their own, or shared database,
template paths, etc.

A.

-- 
Aaron J Trevena, BSc Hons
http://www.aarontrevena.co.uk
LAMP System Integration, Development and Consulting

___
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/