
strange downcasing error in raw query
Reported by cies | January 10th, 2009 @ 09:07 AM
hi!
im writing some raw sql query because i dont get this thing to work using the DM api. (if you know how to do this using the DM api, pleasssse let me know)
doing so i found the following error:
r = repository.adapter.query('SELECT member_id, COUNT(member_id) FROM uploads GROUP BY member_id;') ~ SELECT member_id, COUNT(member_id) FROM uploads GROUP BY member_id; => [# member_id="HAHAHA", :"coun_t(member_id)"=1>, # member_id="xx3322ssdd33", :"coun_t(member_id)"=4>]
see COUNT got to be coun_t...
i have no idea what cauzed this problem (dm, do, extlib, no clue). so i just post here hoping that someone knows.
i solves my problm pretty easy:
r = repository.adapter.query('SELECT member_id, count(member_id) FROM uploads GROUP BY member_id;') ~ SELECT member_id, count(member_id) FROM uploads GROUP BY member_id; => [# member_id="HAHAHA", :"count(member_id)"=1>, # member_id="xx3322ssdd33", :"count(member_id)"=4>]
thanks!
Comments and changes to this ticket
-
Dan Kubb (dkubb) January 10th, 2009 @ 12:13 PM
- State changed from unconfirmed to not-applicable
Try using "COUNT(member_id) AS member_count" in your query.
-
cies January 11th, 2009 @ 11:22 PM
i ended up doing this.. yet i still think COUNT shouldn't become coun_t. i worked around it, others will, yet that doesn't mean this behavior is a feature and not a bug.
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »