Re: [Dbix-class] Prefetch Problem: Related data can't be fetched

2008-02-26 Thread Matt Lawrence
Jess Robinson wrote: On Tue, 26 Feb 2008, Matt Lawrence wrote: Jess Robinson wrote: On Tue, 26 Feb 2008, Matt Lawrence wrote: Rubbish, whatever gave you that idea? Docs say: |prefetch| can be used with the following relationship types: |belongs_to|, |has_one| (or if you're using |add_re

Re: [Dbix-class] Prefetch Problem: Related data can't be fetched

2008-02-26 Thread Jess Robinson
On Tue, 26 Feb 2008, Matt Lawrence wrote: Jess Robinson wrote: On Tue, 26 Feb 2008, Matt Lawrence wrote: Rubbish, whatever gave you that idea? Docs say: |prefetch| can be used with the following relationship types: |belongs_to|, |has_one| (or if you're using |add_relationship|, any relat

Re: [Dbix-class] Prefetch Problem: Related data can't be fetched

2008-02-26 Thread Nigel Metheringham
On 26 Feb 2008, at 14:03, Matt Lawrence wrote: Jess Robinson wrote: You can indeed prefetch a has_many rel. Excellent. How does that work? Do you get one instance of each object with a prepopulated resultset? Single object which returns an array from the has_many accessor. Nigel

Re: [Dbix-class] Prefetch Problem: Related data can't be fetched

2008-02-26 Thread Matt Lawrence
Jess Robinson wrote: On Tue, 26 Feb 2008, Matt Lawrence wrote: [EMAIL PROTECTED] wrote: Hi, I am having a problem, in which I couldn't get the relationship column data by using prefetch. My relationship is declared like this, suppose we have two tables: railway and railway_station, which rel

Re: [Dbix-class] Prefetch Problem: Related data can't be fetched

2008-02-26 Thread Jess Robinson
On Tue, 26 Feb 2008, Matt Lawrence wrote: [EMAIL PROTECTED] wrote: Hi, I am having a problem, in which I couldn't get the relationship column data by using prefetch. My relationship is declared like this, suppose we have two tables: railway and railway_station, which relationship is 1 to many

Re: [Dbix-class] Prefetch Problem: Related data can't be fetched

2008-02-26 Thread Jess Robinson
On Tue, 26 Feb 2008, [EMAIL PROTECTED] wrote: Hi, I am having a problem, in which I couldn't get the relationship column data by using prefetch. My relationship is declared like this, suppose we have two tables: railway and railway_station, which relationship is 1 to many. #in railway schem

[Dbix-class] Adding columns 'on the fly'

2008-02-26 Thread Dan Richman
Is it possible to select columns without actually adding those columns to the schema modules? In other words: while (my $obj = $rs->next) { my $data = $obj->Foo->my_column; } Is there a way to grab "my_column" without actually adding it to the schema? I ask because in this case, "Foo"

Re: [Dbix-class] count behaviour

2008-02-26 Thread Alex Povolotsky
Ash Berlin wrote: As for where its documened... somewhere in the Template Toolkit manual. the _rs methods are mentioned in Relationship docs of DBIC. Tho it could be more obvious, since currently there is just this snippet (and ones like it) Thanks a lot Might be nice if you prepare a doc

Re: [Dbix-class] Prefetch Problem: Related data can't be fetched

2008-02-26 Thread Matt Lawrence
[EMAIL PROTECTED] wrote: > Hi, > > I am having a problem, in which I couldn't get the relationship column > data by using prefetch. > My relationship is declared like this, suppose we have two tables: > railway and railway_station, which relationship is 1 to many. > > #in railway schema > __PACKAGE

Re: [Dbix-class] Get generated SQL

2008-02-26 Thread Matt Lawrence
Emmanuel Quevillon wrote: Hi, Is there a simple way to get the automatic generated SQL from a ResultSet? As for example $query = $rs->sql()? Thanks I wrote a patch to achieve this a little while ago, but I didn't get around to writing good enough tests. Since someone else seems to want the

[Dbix-class] Retrieveing substring?

2008-02-26 Thread Alex Povolotsky
Hello! I have a very simple record create table location ( lid serial primary key, name varchar(128) not null, descr text); I'd like to retrevie for list select lid, name, substr(descr,100) as descrbegin from location; How should I do it with DBIx::Class? I do not want to fetch (potentially)

[Dbix-class] ON DELETE statement in Pg not avaiable in schema::loader?

2008-02-26 Thread Moritz Onken
Hi, I use the ON DELETE statements in my Pg database to set the foreign key to null if a column is deleted. But this information doesn't make it's way to the schema if I use Schema::Loader. And therefore the files created by create_ddl_dir are useless because they don't contain this infor

Re: [Dbix-class] count behaviour

2008-02-26 Thread Ash Berlin
On 26 Feb 2008, at 11:34, Alex Povolotsky wrote: Ash Berlin wrote: On 26 Feb 2008, at 11:23, Alex Povolotsky wrote: Hello! I'm using (with Catalyst and TT) some simple code to count related data [% FOREACH loc IN llist -%] [% loc.name %] : ($loc.lid") %]>Edit) [% loc.contacts.count+0 %

Re: [Dbix-class] count behaviour

2008-02-26 Thread Alex Povolotsky
Ash Berlin wrote: On 26 Feb 2008, at 11:23, Alex Povolotsky wrote: Hello! I'm using (with Catalyst and TT) some simple code to count related data [% FOREACH loc IN llist -%] [% loc.name %] : (%]>Edit) [% loc.contacts.count+0 %] contacts (more): [% loc.servers.count+0 %] servers (more): her

Re: [Dbix-class] count behaviour

2008-02-26 Thread Ash Berlin
On 26 Feb 2008, at 11:23, Alex Povolotsky wrote: Hello! I'm using (with Catalyst and TT) some simple code to count related data [% FOREACH loc IN llist -%] [% loc.name %] : (%]>Edit) [% loc.contacts.count+0 %] contacts (more): [% loc.servers.count+0 %] servers (more): here will be traff

[Dbix-class] count behaviour

2008-02-26 Thread Alex Povolotsky
Hello! I'm using (with Catalyst and TT) some simple code to count related data [% FOREACH loc IN llist -%] [% loc.name %] : (%]>Edit) [% loc.contacts.count+0 %] contacts (more): [% loc.servers.count+0 %] servers (more): here will be traffic [% END -%] Debugging SQL requests, I've found that b

Re: [Dbix-class] Proposal for hook into deploy()

2008-02-26 Thread Pedro Melo
Hi, On Feb 23, 2008, at 10:58 PM, Jon Schutz wrote: On Sat, 2008-02-23 at 11:47 +, Ash Berlin wrote: Any comments or suggestions of a better way? Yes, how about this: http://search.cpan.org/~jrobinson/DBIx-Class-0.08009/lib/DBIx/ Class/Schema.pm#sqlt_deploy_hook($sqlt_schema) Than

Re: [Dbix-class] Bug with find_or_new and insert_or_update with postgresql: any success?

2008-02-26 Thread Alex Povolotsky
Zbigniew Lukasiak wrote: On Mon, Feb 25, 2008 at 9:53 PM, Alex Povolotsky <[EMAIL PROTECTED]> wrote: Hello! I've found in archives nearly my case, that passing NULL to Pg is not 'not passing column at all', so adding a new row with a simple code like this my $loc = $c->model($self->mod

[Dbix-class] Get generated SQL

2008-02-26 Thread Emmanuel Quevillon
Hi, Is there a simple way to get the automatic generated SQL from a ResultSet? As for example $query = $rs->sql()? Thanks -- - Emmanuel Quevillon Biological Software and Databases Group Institut Pasteur +33 1 44 38 95 98 tuco at_ pasteur dot fr -