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.
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 :-/
W
e generate 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:
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
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
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