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
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
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 =>
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;
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(
&
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.
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
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
_
(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
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.
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
',
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
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
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
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
___
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
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
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
.. 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
_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
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
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
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
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
_
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
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
> 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
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')->
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
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
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
> }
> );
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
#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
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
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
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,
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
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
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
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
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
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
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
::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]
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
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
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
47 matches
Mail list logo