Re: [Dbix-class] Extended JOIN syntax

2012-01-29 Thread Bernhard Graf
Correction: $artist_rs->result_class->era_begin(1979); $artist_rs->result_class->era_end(1990); $artist_rs->search_related('cds_era')->next; Bernhard ___ List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class IRC: irc.perl.org#dbix-class

Re: [Dbix-class] Extended JOIN syntax

2012-01-29 Thread Bernhard Graf
Am 29.01.2012 21:52, schrieb Peter Rabbitson: It is possible, but is not yet particularly pretty. The trick is that the coderef in question is called every time the relationship needs to be resolved. By referencing some external package-global you can control what the coderef will return. like

Re: [Dbix-class] Extended JOIN syntax

2012-01-29 Thread Bernhard Graf
Am 29.01.2012 20:42, schrieb Bernhard Graf: The example above still requires the bind values to be defined statically in the schema. I couldn't find any examples, about how to specify bind values at execution time - e.g. likes this: My::Schema::Artist->has_many( cds_era => 

[Dbix-class] Extended JOIN syntax

2012-01-29 Thread Bernhard Graf
I have just learned, that the JOIN syntax was improved recently, so it is possible to specify more than just the equality of column values, as shown in the example from DBIx::Class::Relationship::Base: My::Schema::Artist->has_many( cds_80s => 'My::Schema::CD', sub { my $args = shift;

Re: [Dbix-class] Q: prefetch has_many relation

2010-04-09 Thread Bernhard Graf
Am 09.04.2010 17:10, schrieb Bernhard Graf: > Meanwhile I found out, that the resultset attribute "rows" is > "responsible" for switching to the big SQL code: Thinking again I realized that this makes pretty much sence. > my $new_rs = $artist_rs->search( &

Re: [Dbix-class] Q: prefetch has_many relation

2010-04-09 Thread Bernhard Graf
artist_id I could send you the complete archive (which is similar to manual page DBIx::Class::Manual::Example) with the test db and scripts if it helps. Bernhard Graf ___ List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class IRC: irc.

Re: [Dbix-class] Q: prefetch has_many relation

2010-04-08 Thread Bernhard Graf
Am 08.04.2010 20:55, schrieb Bernhard Graf: > > for my $row ($rs->all) { > say join(', ', $row->cds->get_column('title')->all); > } > > it still fetched each of the CDs again one by one. > > Changing this to > > for m

Re: [Dbix-class] Q: prefetch has_many relation

2010-04-08 Thread Bernhard Graf
say join(',', map {$_->role_id} $row->user2roles->all); } fixed it indeed: no more additional queries. :) So actually it works - but I have no idea, why the SQL query has to be so sophisticated... don't sub-queries usually slow down significantly? Bernhard Graf _

[Dbix-class] Q: prefetch has_many relation

2010-04-08 Thread Bernhard Graf
(says the manual). How do I select all CDs of the artists of $artist_rs with one query? Bernhard Graf ___ List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class IRC: irc.perl.org#dbix-class SVN: http://dev.catalyst.perl.org/repos/bast/DBIx

[Dbix-class] Q: txn_do() w/ or w/o closure

2010-04-08 Thread Bernhard Graf
Does it make any difference? Is there a recommended way of doing it (better use or avoid closure)? Bernhard Graf ___ List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class IRC: irc.perl.org#dbix-class SVN: http://dev.catalyst.perl.

Re: [Dbix-class] memory usage to load schema

2010-02-03 Thread Bernhard Graf
M usage. If this is a problem, then you're using the wrong tool. Yawn. I don't think we have a controversy concerning Perl. Bernhard Graf ___ List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class IRC: irc.perl.org#dbix-class

Re: [Dbix-class] memory usage to load schema

2010-02-03 Thread Bernhard Graf
', is_nullable => 1, size => '255', }, ... more common column definitions here ... }; package MyApp::Schema::Result::SomeTable; use DBIC::Type; ... __PACKAGE__->add_columns( ... firstname => DBIC::Type::varchar_255, lastnam

[Dbix-class] Q: Foreign keys

2010-01-31 Thread Bernhard Graf
e triggers" ... can I enable this feature exlusively for the SQLite storage engine? Bernhard Graf ___ List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class IRC: irc.perl.org#dbix-class SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Cl

Re: [Dbix-class] Removing rows older than a given number of minutes ...

2010-01-26 Thread Bernhard Graf
ed); > $user->delete if ($duration->seconds > $limit); > } > > Probably more generic rather than hard-coding SQL stuff. Try this on a dataset with a million rows, please. L8er ;*) Bernhard Graf ___ List: http://lists.scsys.co

Re: [Dbix-class] Prefetch question

2009-12-17 Thread Bernhard Graf
Charlie Garrison schrieb: > Note, Bill said Class::DBI, not DBIx::Class. They are completely different > packages. Ew - you are right! Thanks. Does that mean DBIx::Class doesn't have something similar? Bernhard Graf ___

Re: [Dbix-class] Prefetch question

2009-12-16 Thread Bernhard Graf
prove, when fetching country data only once per country id - in my case it is nearly always 'DE' and sometimes 'AT' or 'CH'. Bernhard Graf ___ List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class IRC

[Dbix-class] Prefetch question

2009-12-16 Thread Bernhard Graf
Is it possible not to prefetch country, but tell DBIC to cache delayed fetches of related data, so that each related country row is really only fetched once for this user resultset? Or can I read the whole country table first and then somehow assign those rows to the appropriate $user

Re: [Dbix-class] Re: Custom SQL

2009-12-14 Thread Bernhard Graf
Gordon and Kevin, thanks for your help. It works now. I also found another way described in http://www.shadowcat.co.uk/catalyst/-talks/yapc-na-2008/dbix-masterclass.xul p. 59ff, which does virtually the same. Bernhard Graf ___ List: http

Re: [Dbix-class] Custom SQL

2009-12-14 Thread Bernhard Graf
.. to what? When I set a table, the error message becomes: Can't locate object method "is_virtual" via package "DBIx::Class::ResultSource::Table" at My/Schema/Result/MyRequest.pm line 12. It really frustrates me, when simple things become that difficult. Bernha

[Dbix-class] Custom SQL

2009-12-14 Thread Bernhard Graf
_source_instance" via package "My::Schema::Result::MyRequest" at My/Schema/Result/MyRequest.pm line 7. Ideas? Bernhard Graf ___ List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class IRC: irc.perl.org#dbix-class SVN: http://dev.c

Re: [Dbix-class] InflateColumn::Markup::Unified inflates columns that use a markup language

2009-09-30 Thread Bernhard Graf
Jose Luis Martinez schrieb: > 2- I see that the Markup::Unified module requires, uses, and makes an > instance of the three markup modules that are supported. IMHO, I don't > think this is a good long-term strategy if you are willing to support > more modules because: > - If you only want to use

Re: [Dbix-class] InflateColumn::Markup::Unified inflates columns that use a markup language

2009-09-30 Thread Bernhard Graf
Ido Perelmutter schrieb: > Two modules I've created: Markup::Unified and > DBIx::Class::InflateColumn::Markup::Unified are now on CPAN. The first > one was written just to facilitate the second one. What I wanted here > was a way to automatically process text columns that use one of the > three po

Re: [Dbix-class] Table attributes for deploy()

2009-08-03 Thread Bernhard Graf
Just found the answer: http://lumberjaph.net/blog/index.php/2009/04/27/a-simple-feed-aggregator-with-modern-perl-part-1/ ___ List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class IRC: irc.perl.org#dbix-class SVN: http://dev.catalyst.perl.or

[Dbix-class] Table attributes for deploy()

2009-08-03 Thread Bernhard Graf
27;, Nice. I'm unable to find out, how to set attributes for a table, e.g. CREATE TABLE `url` ( ... ) ENGINE=InnoDB DEFAULT CHARSET=utf8; ("ENGINE=InnoDB" is a default - I want "CHARSET=utf8") Is that possible in DBIC? -- Bernhard Graf _

Re: [Dbix-class] ResultSet columns attribute broken?

2009-04-29 Thread Bernhard Graf
I did install and - YES - it works fine! Thanks for your patience. ;-) -- Bernhard Graf ___ List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class IRC: irc.perl.org#dbix-class SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/ Searcha

Re: [Dbix-class] ResultSet columns attribute broken?

2009-04-29 Thread Bernhard Graf
proper sql ok 21 - columns 1st rscolumn present ok 22 - columns 2nd rscolumn present not ok 23 - columns 3rd rscolumn present # TODO Need to remove '.' from accessors # Failed (TODO) test 'columns 3rd rscolumn present' # at t/76select.t line 145. # died: DBIx::Cla

Re: [Dbix-class] ResultSet columns attribute broken?

2009-04-28 Thread Bernhard Graf
> can you try svn trunk? > (http://dev.catalyst.perl.org/repos/bast/DBIx-Class/0.08/trunk/) same thing. -- Bernhard Graf ___ List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class IRC: irc.perl.org#dbix-class SVN

[Dbix-class] ResultSet columns attribute broken?

2009-04-28 Thread Bernhard Graf
ist not loaded or not passed to new() prior to insert() on DBICTest::CD=HASH(0x199d820) trying to resolve relationship (maybe you forgot to call ->reload_from_storage to get defaults from the db) at t/76select.t line 13 whereas this works: my @cds = $schema->resultset('CD')->

Re: [Dbix-class] ANN - DBD::SQLite version 1.24_01 - amalgamation

2009-04-22 Thread Bernhard Graf
make me killfile you at the list server. Well if this is not rude... Such announcement don't even bother me close to the Outlook-style HTML- posts, that quote a whole thread just to say "Thanks" or "Agreed". So IMHO there is no need for such a hard reaction. -- Bernhard

Re: [Dbix-class] specify join type

2009-02-19 Thread Bernhard Graf
scade_* attrs on both sides, or is it enough having it in has_many only? -- Bernhard Graf ___ List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class IRC: irc.perl.org#dbix-class SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/ Searchable A

Re: [Dbix-class] specify join type

2009-02-19 Thread Bernhard Graf
u can always have 2 identical, other than the join_type attribute, > relationships defined under different names, to allow both forms of > joins to be performed as required... Good idea! -- Bernhard Graf ___ List: http://lists.scsys.co.uk/cgi-bin/mai

Re: [Dbix-class] specify join type

2009-02-19 Thread Bernhard Graf
> } > ); I think that would work, although using the "right" join type seems more natural and might be even more efficient. -- Bernhard Graf ___ List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class IRC: irc.perl.org#dbix-class

[Dbix-class] specify join type

2009-02-19 Thread Bernhard Graf
#x27; group_by => 'me.id', } ); I've found http://search.cpan.org/dist/DBIx-Class/lib/DBIx/Class/ResultSet.pm#from but it seems cumbersome and comes with a big warning. Bernhard Graf ___ List: http://lists.scsys.co.uk/cgi-bin/mai

[Dbix-class] DateTime personalization

2008-10-31 Thread Bernhard Graf
classes is loading component DateTimeMethods before InflateColumn::DateTime or TimeStamp: _PACKAGE__->load_components(qw/DateTimeMethods TimeStamp Core/); Now all datetime objects stringify automagically according to the authenticated user's settings. My only concern is: Would this be

Re: [Dbix-class] Q: Differing column names in DBIC and SQL

2008-10-21 Thread Bernhard Graf
ique_constraint(), but $rs->create({name => ...}) et.al still fail this case. I think I give up. -- Bernhard Graf ___ List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class IRC: irc.perl.org#dbix-class SVN: http://dev.catalyst.per

Re: [Dbix-class] Q: Differing column names in DBIC and SQL

2008-10-21 Thread Bernhard Graf
Jess Robinson wrote: > On Tue, 21 Oct 2008, Bernhard Graf wrote: > > Peter Rabbitson wrote: > >>> - AFAIR their usage slows down db access once more. > >> > >> Please bring some evidence for your last claim. If this turns out > >> to be true,

Re: [Dbix-class] Q: Differing column names in DBIC and SQL

2008-10-21 Thread Bernhard Graf
ore on deployment means faster queries than applying quote_char-s and name_sep-s in each query. -- Bernhard Graf ___ List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class IRC: irc.perl.org#dbix-class SVN: http://dev.catalyst.perl.org/re

Re: [Dbix-class] Q: Differing column names in DBIC and SQL

2008-10-21 Thread Bernhard Graf
AFAIR their usage slows down db access once more. > As a side note - it is wise to avoid naming columns identical to perl > conventional method names (i.e. having a column 'new' will have some > strange side effects) Thanks for the tip. Still I hope to get an answer to my act

[Dbix-class] Q: Differing column names in DBIC and SQL

2008-10-21 Thread Bernhard Graf
name => '_user', }, ); and deploy() actually generated an SQL column "_user", but then failed at the first __PACKAGE__->add_unique_constraint(['user']); -- Bernhard Graf ___ List: http://lists.scsys.co.uk/cgi

[Dbix-class] Idea for DBIx::Class::DynamicDefault

2008-10-20 Thread Bernhard Graf
eth($column_name); Now the called method could obtain the column's meta data by calling $self->column_info($column_name) . -- Bernhard Graf ___ List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class IRC: irc.perl.org#dbix-class

Re: [Dbix-class] Issue with DBIx::Class::TimeStamp

2008-09-11 Thread Bernhard Graf
d_columns() was new in DBIx::Class 0.08009, so either this requirement should be made for installation or else there should be a compability shim. -- Bernhard Graf ___ List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class IRC: irc.perl.org

Re: [Dbix-class] Issue with DBIx::Class::TimeStamp

2008-09-10 Thread Bernhard Graf
Matt S Trout wrote: > On Sat, Sep 06, 2008 at 08:30:49PM +0200, Bernhard Graf wrote: > > /me wrote: > > > Wouldn't it be better if $self->is_changed is consulted first in > > > DBIx::Class::TimeStamp? > > > > I took DBIx::Class::TimeStamp version 0.0

Re: [Dbix-class] Issue with DBIx::Class::TimeStamp

2008-09-06 Thread Bernhard Graf
opies some innards of DBIx::Class::Row::update(), so I'm not sure if it really behaves right in every case and in future versions of DBIC. -- Bernhard Graf ___ List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class IRC: irc.perl.org#dbix

[Dbix-class] Issue with DBIx::Class::TimeStamp

2008-09-06 Thread Bernhard Graf
::TimeStamp? -- Bernhard Graf ___ List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class IRC: irc.perl.org#dbix-class SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/ Searchable Archive: http://www.grokbase.com/group/[EMAIL PROTECTED]

[Dbix-class] Automatically counting rows of another table - and how to disable temporarily

2007-10-28 Thread Bernhard Graf
t = $schema->resultset('My::Schema::Artist')->find($artistid); $rs = $schema->resultset('My::Schema::Album'); $rs->disable_count(1); for ($i = 0; $name = get_albumname(); ++$i) { $rs->create({artist => $artist, name => $name}); } $a

Re: [Dbix-class] serializing DBIx::Class::ResultSourceHandle

2007-09-20 Thread Bernhard Graf
Not pretty, but this works at least. Thank you very much. -- Bernhard Graf ___ List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class IRC: irc.perl.org#dbix-class SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/ Searchable Archiv

[Dbix-class] serializing DBIx::Class::ResultSourceHandle

2007-09-19 Thread Bernhard Graf
seems I have to restore the schema manually into the object before I ->insert(). Is that correct? If yes - how to? -- Bernhard Graf ___ List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class IRC: irc.perl.org#dbix-class SVN: http://dev.c