8 More Discussions You Might Find Interesting
1. Programming
Simple question , what good book is next step in learning C.
I finished with K&R and I want to go to the next step , so if someone has a good book please share title :D
I looked for Advanced C programming by example but it is too expansive 400$ on Amazon :(
So please tell me (7 Replies)
Discussion started by: solaris_user
7 Replies
2. Fedora
Not totally new to Linux. Have done distro installs before. At this point, I'm looking for a way out of the MS lock down I've been in. Looking for a good beginner/intermediate book. One that will cover things such as server installs as well as things like X-Windows/SAMBA installs from CLI. What I... (2 Replies)
Discussion started by: jcayo11
2 Replies
3. Solaris
I am a beginner about of solaris.
I want to study it,but i don't how to study it.where shoud i go.
So anybody can instruct me,and give me some books or link.
Thanks. (2 Replies)
Discussion started by: bukky
2 Replies
4. AIX
hi,
I am satheesh Kumar. I am going to take IBM:AIX Basic Operations V5;Test 190 certification. I couldnt find good study material for that.
So, Can any one suggest me some good books or e-study material for that. (1 Reply)
Discussion started by: satheesh83
1 Replies
5. UNIX for Dummies Questions & Answers
Hi guyes and girls.
I am totaly new to this, so i need some advice on books and such.
What book should i read if im going to get good in Unix?
And if im going to read that book, what OS do i need for my first experience? And where do i get it?
Some other things you folks can post is... (4 Replies)
Discussion started by: Seyedx
4 Replies
6. News, Links, Events and Announcements
Any good books out there that you could recommend to a noob? (2 Replies)
Discussion started by: ignacio
2 Replies
7. Shell Programming and Scripting
Hai All
Iam looking for books in unix on shell scripting which has more stuff on how to run Oracle procedures or functions and the best methods to follow passing unix variables as parameters to Oracle.
Thanks in advance
Krishna (2 Replies)
Discussion started by: krishnasai
2 Replies
8. UNIX for Dummies Questions & Answers
i.e configuration of C compiler :confused: (4 Replies)
Discussion started by: atiato
4 Replies
DBIx::Class::Helper::ResultSet::CorrelateRelationship(3pUser Contributed Perl DocumentatDBIx::Class::Helper::ResultSet::CorrelateRelationship(3pm)
NAME
DBIx::Class::Helper::ResultSet::CorrelateRelationship - Easily correlate your ResultSets
VERSION
version 2.013002
SYNOPSIS
package MyApp::Schema::ResultSet::Author;
use base 'DBIx::Class::ResultSet';
__PACKAGE__->load_components(qw(Helper::ResultSet::CorrelateRelationship));
sub with_book_count {
my $self = shift;
$self->search(undef, {
'+columns' => {
book_count => $self->correlate('book')->count_rs->as_query
}
});
}
1;
And then elsewhere, like in a controller:
my $rows = $schema->resultset('Author')->with_book_count->all;
DESCRIPTION
Correlated queries are one of the coolest things I've learned about for SQL since my initial learning of SQL. Unfortunately they are
somewhat confusing. DBIx::Class has supported doing them for a long time, but generally people don't think of them because they are so
rare. I won't go through all the details of how they work and cool things you can do with them, but here are a couple high level things
you can use them for to save you time or effort.
If you want to select a list of authors and counts of books for each author, you could use "group_by" and something like "COUNT(book.id)",
but then you'd need to make your select list match your "group_by" and it would just be a hassle forever after that. The "SYNOPSIS" is a
perfect example of how to implement this.
If you want to select a list of authors and two separate kinds of counts of books for each author, as far as I know, you must use a
correlated subquery in DBIx::Class. Here is an example of how you might do that:
package MyApp::Schema::ResultSet::Author;
use base 'DBIx::Class::ResultSet';
__PACKAGE__->load_components(qw(Helper::ResultSet::CorrelateRelationship));
sub with_good_book_count {
my $self = shift;
$self->search(undef, {
'+columns' => {
good_book_count => $self->correlate('books')->good->count_rs->as_query
}
});
}
sub with_bad_book_count {
my $self = shift;
$self->search(undef, {
'+columns' => {
bad_book_count => $self->correlate('books')->bad->count_rs->as_query
}
});
}
1;
And then elsewhere, like in a controller:
my $rows = $schema->resultset('Author')
->with_bad_book_count
->with_good_book_count
->all;
This assumes that the Book resultset has "good" and "bad" methods.
See "NOTE" in DBIx::Class::Helper::ResultSet for a nice way to apply it to your entire schema.
METHODS
correlate
$rs->correlate($relationship_name)
Correlate takes a single argument, a relationship for the invocant, and returns a resultset that can be used in the selector list.
AUTHOR
Arthur Axel "fREW" Schmidt <frioux+cpan@gmail.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2012 by Arthur Axel "fREW" Schmidt.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
perl v5.14.2 2012-06-18 DBIx::Class::Helper::ResultSet::CorrelateRelationship(3pm)