db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Josh Holtzman <j...@joshholtzman.com>
Subject Re: Select count(*)
Date Wed, 12 Nov 2003 14:37:08 GMT
One way is to select the objects you want using Criteria and 
CustomerPeer.doSelect, which returns a list of Customers matching your 
criteria (customerId=1).  Once you have the list, list.size() returns 
the number of Customers returned, which is what you want.  But if you 
didn't want the list of Customer objects at all, than instantiating all 
of these objects is a waste of server resources.

Also -- is your message a reply to the message regarding the \*comment 
query (bottom of this message)?  I don't see the connection.

Josh

Felipe Ramos wrote:

> Hi all,
>      How can I make a "Select count(*) from Customer where 
> customerId='1' "  query using Torque 3.1 ?
>
>    ( I know that one possibility is use the Criteria.CUSTOM but..... )
>
> Toru Suzuki wrote:
>
>> Hi all,
>>
>> I used Torque3.0 and oracle
>>
>> I'm trying to do
>>
>> String note = "\*comment";
>> Criteria cri = new Criteria();
>> cri.add(PERSON.NOTE, (Object)(note + "%"), Criteria.LIKE);
>>
>> SQL log is
>> SELECT PERSON.NAME, PERSON.NOTE FROM PERSON
>> WHERE PERSON.NOTE LIKE '\comment%'
>>
>> I expected WHERE PERSON.NOTE LIKE '*comment%'
>>
>> SqlExpression.buildLike(String columnName,String criteria,SqlEnum 
>> comparison,boolean ignoreCase,DB db,StringBuffer whereClause)
>> javadoc wrote
>> criteria = "50\%" -> columnName = '50%'
>>
>> Why???
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
>> For additional commands, e-mail: torque-user-help@db.apache.org
>>
>>
>>  
>>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message