Re: [Dbix-class] FW: DBIx::Class::LookupColumn

2012-10-18 Thread QE :: Felix Ostmann
Looks nice, but can you also support the lookup over a nm-table? So: Users -> Users2Roles -> Roles Users has: user_id Users2Roles has: user_id role_id Roles has: role_id type of course that is not identical to a direct lookup-table, but perhaps the right place/module to add such a feature.

Re: [Dbix-class] order by field?

2012-12-17 Thread QE :: Felix Ostmann
I am doing such a order with the following SQL: ... ORDER BY (department = 'Marketing') DESC, (department = 'Sales') DESC, (department = 'Financial') DESC, (department = 'IT') DESC, (department = 'Operations') DESC, ... But there is no special way to use this with DBIx::Class :-/

Re: [Dbix-class] Returning search results in a specific order

2013-05-02 Thread QE :: Felix Ostmann
W ​e gene​rate a special ORDER BY for such a scenario (that should work for most RDBMs): ORDER BY id = 2 ASC, id = 1 ASC, id = 3 ASC 2013/5/1 Peter Rabbitson > On Tue, Apr 30, 2013 at 08:36:50PM +, Chris Newman wrote: > > > From: Peter Rabbitson [mailto:rabbit+d...@rabbit.us] > > Sent:

Re: [Dbix-class] Fastest method to check for key existence?

2015-02-11 Thread QE :: Felix Ostmann
We are using this function in our ResultSet.pm: sub exists { my ($self, $query) = @_; return $self->search($query, { rows => 1, select => [\1] })->single; } Have a nice day Felix 2015-02-12 1:05 GMT+01:00 Charlie Garrison : > Good morning, > > On 11/2/15 at 10:58 PM +0100, Ekki Plich

Re: [Dbix-class] Fastest method to check for key existence?

2015-02-13 Thread QE :: Felix Ostmann
I often build a map and use this also for an exist()-check (not for bigdata) my %email_for = map { $@_ } $rs ->search( undef, { select => qw[ user_id email ], }, ) ->cursor ->all ; only important is t

Re: [Dbix-class] Joins using sub-selects

2018-10-08 Thread QE :: Felix Ostmann
Hi David, i did not see a problem with you current approach. It is simple you dislike literal sql? You could write the subselect as a dbic statement and call as_query() and use it, see https://metacpan.org/pod/distribution/DBIx-Class/lib/DBIx/Class/Manual/Cookbook.pod#Correlated-subqueries my $i