Hi Brad,

Looked to me like he just wanted to get a recordcount from the db - not to
actually return a query and then count the records on the web server which
would cause a bunch of data to be transferred from the db to web server for
a large recordset.

Best Wishes,
Peter


On 9/15/06 6:57 PM, "Brad Haas" <[EMAIL PROTECTED]> wrote:

> Kevin,
> 
> I haven't followed this thread, so forgive me if I'm misunderstanding
> the situation.  If you're wanting a record count, why not do this:
> 
> Page_Gateway = Reactor.createGateway("MyTable")
> 
> pages = Page_Gateway.getAll()
> 
> qRecordCount = pages.RecordCount
> 
> Is this what you want or where you looking to not convert the gateway
> to an actually query?
> 
> --Brad
> 
> 
> 
> On Sep 15, 2006, at 6:25 PM, Kevin Roche wrote:
> 
>> Well I did not get any positive answers from anyone on the list
>> about doing
>> a COUNT(*) so I thought you my like to know what to do should you
>> need to do
>> this.
>> 
>> // First we must set up the Reactor Factory.
>> Reactor = CreateObject("Component",
>> "reactor.reactorFactory").init(expandPath("reactor.xml"));
>> 
>> // Then we create the gateway object.
>> Page_Gateway = Reactor.createGateway("MyTable");
>> 
>> // Then we create the Query object.
>> Query = MyTable_Gateway.createQuery();
>> 
>> // Create a field to use using an exsiting column
>> Query.returnObjectFields("MyTable","SomeColumn");
>> 
>> // Set up the Count
>> Query.setFieldExpression("MyTable","SomeColumn","COUNT
>> (*)","CF_SQL_INTEGER")
>> ;
>> 
>> qRecordCount = MyTable_Gateway.getByQuery(Query);
>> 
>> Unfortunately I can yet see how to set up a GROUP BY clause so
>> watch this
>> space ......
>> 
>> Kevin Roche
>> 
>> -----Original Message-----
>> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
>> Behalf Of Kevin Roche
>> Sent: 14 September 2006 23:25
>> To: [email protected]
>> Subject: [Reactor for CF] Aggregate Functions in Gateways
>> 
>> 
>> Anybody out there know how to do an Aggregate function in a Reactor
>> Gateway?
>> For example I want to do somthing like...
>> 
>> SELECT COUNT(*) FROM myTable
>> 
>> It seems to me that setFieldExpression should do it but I have
>> tried a few
>> things and they don't work.
>> 
>> For example:
>> 
>> Query.setFieldExpression("myTable","RC","COUNT(*)","CF_SQL_INTEGER");
>> 
>> doesn't produce anything in the resuling SQL. What am I doing wrong?
>> 
>> 
>> Kevin Roche
>> 
>> 
>> 
>> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
>> -- -- -- -
>> - --
>> Reactor for ColdFusion Mailing List
>> [email protected]
>> Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
>> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
>> -- -- -- -
>> - --
>> 
>> 
>> 
>> 
>> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
>> -- -- -- -- --
>> Reactor for ColdFusion Mailing List
>> [email protected]
>> Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
>> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
>> -- -- -- -- --
>> 
> 
> 
> 
> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> --
> Reactor for ColdFusion Mailing List
> [email protected]
> Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> --
> 





-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Reactor for ColdFusion Mailing List
[email protected]
Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

Reply via email to