SELECT COUNT(*) FROM TABLE?

3 views
Skip to first unread message

ccwu

unread,
Oct 27, 2010, 10:18:04 AM10/27/10
to RingoJS
Hi,

Using ringo-sqlstore, how can I get the row count of a table?

Robert Gaggl

unread,
Oct 28, 2010, 7:25:04 AM10/28/10
to RingoJS
hi,

sqlstore's query implementation currently lacks a count() method or a
convenient possibility to directly execute sql statements. if you have
defined an entity (stored in this table) the only way currently is to
use [entity].all().length - which is suboptimal since all() creates an
array containing lazy-loaded entities -, otherwise you could directly
use a database connection.

robert

Hannes Wallnoefer

unread,
Oct 28, 2010, 1:49:30 PM10/28/10
to RingoJS
A function to count entities would be quite handy. What would be a
good name for that? count()? size()?

Hannes

Frederick Polgardy

unread,
Oct 28, 2010, 1:59:33 PM10/28/10
to rin...@googlegroups.com
count.

> --
> You received this message because you are subscribed to the Google Groups "RingoJS" group.
> To post to this group, send email to rin...@googlegroups.com.
> To unsubscribe from this group, send email to ringojs+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/ringojs?hl=en.
>

Robert Thurnher

unread,
Oct 28, 2010, 2:00:01 PM10/28/10
to rin...@googlegroups.com
On 28 October 2010 19:49, Hannes Wallnoefer <han...@gmail.com> wrote:
> A function to count entities would be quite handy. What would be a
> good name for that? count()? size()?

E.g., `[Entity].query().count().select()` sounds good (better than
`size()` in this case), IMHO.

-- Robi


> Hannes
>
> On 28 Okt., 13:25, Robert Gaggl <grobs...@gmail.com> wrote:
>> hi,
>>
>> sqlstore's query implementation currently lacks a count() method or a
>> convenient possibility to directly execute sql statements. if you have
>> defined an entity (stored in this table) the only way currently is to
>> use [entity].all().length - which is suboptimal since all() creates an
>> array containing lazy-loaded entities -, otherwise you could directly
>> use a database connection.
>>
>> robert
>>
>> On Oct 27, 4:18 pm, ccwu <ccwu660...@gmail.com> wrote:
>>
>> > Hi,
>>
>> > Using ringo-sqlstore, how can I get the row count of a table?
>

Reply all
Reply to author
Forward
0 new messages