Thanks for your reply Ravi
   let me explain the entire scenario.I have an employee entity .User can
search employees by giving part of name .There are four type of employees .I
have to show number of employees matching user search criteria for every
type of employee under different tabs.Actual results are to be displayed
only if user open that tab.
In SQL term we could write following query

Select count(*) from employee where name like '%<searchname>%' and type ='A'
;

My first problem is that i dint find any equivalent of like operator.Is
there any way to do it?
Secondly we can not keep record count for each search combination.what will
you suggest for this case?
Thanks once again.




On Fri, Jun 11, 2010 at 4:23 PM, Ravi <ping2r...@gmail.com> wrote:

> Google app engine designed to work for any numbers of records with in
> minimum time, so SQL features like counting the records whenever
> needed is not supported.
> So you need to take care of such counter by urself at the time of
> adding or deleting the records in a table/entity.
>
> If you just want total number of records and dont care if counting
> happened in last 24 hours then look into low level api for datastore
> statistics, GAE refreshes total count every 24 hours and you can read
> the total count from there.
>
> And if you want count of records with some where clause, then you need
> to maintain it.
>
> like if u want like this
> select count(0) from tb where tb.propA='someValue'
>
> then you may need to create a new entity say counterForTb, and have
> few fields entityName and count and where clause columns
> and whenevr you add a new record in tb then increase the count of that
> record in counter table and on delete decrease it.
>
>
>
>
> Something for google guys
> Just realized that all columns are indexed unless we specify to not to
> index, and there must be some index meta data/statistics saved
> somewhere in google data stores about index(like total records
> matching to this index). And if that stats can be accessible through
> some APIs then we may be able to get total count just by reading data
> from indexes stats.
> Is this something feasible?
>
>
>
>
>
>
>
>
> On Jun 11, 11:39 am, RAVINDER MAAN <rsmaan...@gmail.com> wrote:
> > How can we get records count for a query in JDO.
> > In sql we have select count(*) from <table_name>
> > i want to get number of records returned by a query. what is the
> > efficient way to do that.One option is to use size() function .I think
> > it is not best way.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine for Java" group.
> To post to this group, send email to
> google-appengine-j...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-appengine-java+unsubscr...@googlegroups.com<google-appengine-java%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-appengine-java?hl=en.
>
>


-- 
Regards,
Ravinder Singh Maan

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to