[Dbix-class] Getting a' count' value

Emmanuel Quevillon tuco at pasteur.fr
Thu May 14 12:37:22 GMT 2009


Peter Rabbitson wrote:
> Emmanuel Quevillon wrote:
>> Hi,
>>
>> Sorry if my question looks stupid, but I'd like to retrieve the
>> value of a count returned by an SQL query.
>>
>> I tried different things but it always return 1
>>
>> Here is the way I'd like it to work:
>>
>> ...
>> acc => $g->name(),
>> num => $c->model('Table')->search({'id' => $g->id},<CODE>
>>
>> where I tried to replace <CODE> with :
> 
> Ever tried search()->count ? :)

Hi Peter,

Yep, I forgot to mention it, but I also tried this solution
with the same results -> cnt = 1.
I also tried something else, when I change the column name that
returns a count of 0, I also get a value of 1 as value in my hash
table $hash->{num}
Weird!!

Thanks
-- 
-------------------------
Emmanuel Quevillon
Biological Software and Databases Group
Institut Pasteur
+33 1 44 38 95 98
tuco at_ pasteur dot fr
-------------------------



More information about the DBIx-Class mailing list