Some are out of the scope of iteration job. But if you want you can add some functions to iterate over columns and to support paging, sorting and even QoQ by adding a select(condition) method.
 
In this case the methods can be:
 
init(query, [page size])
getCurrentRow()
getRecordCount()
getColumnList()
isFirstRow()
isLastRow()
firstRow()
lastRow()
nextRow()
previousRow()
hasNextRow() (you can omit these has.. functions because we have isFirstRow and isLastRow, but not sure)
hasPreviousRow()
isFirstPage
isLastPage
nextPage etc.
select ("description like '%a%'")
 
there can be many...
 
Murat.


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of John Farrar
Sent: Thursday, February 24, 2005 12:00 AM
To: CFCDev@cfczone.org
Subject: Re: [CFCDev] query object

John Farrar Wrote:

Here is my current list of functions... (we will see what final name the component has when I complete it... since it's not paid for work... will finish it later)

init()
getCurrentRow()
getRecordCount()
getColumnList()
isFirst()
isLast()
moveFirst()
moveLast()
moveNext()
movePrevious()
hasNext()
hasPrevious()

Plus you would have an attribute for every "field". These will be read only attributes. (The way CFC's work someone can manipulate the attribute currently, but the actual values are not exposed so they are not changing the internal recordset if they try by editing the object attributes.) The attributes will be the same names as the fieldnames.

Note... I was also thinking future oriented... we could add other functions. (sorting, addRecord, deleteRecord, sort, filter, columnType... and any others we dream up) The list above is good for a version 1.0 component though... you think?

Murat Demirci wrote:
add four new functions:
 
- boolean isFirst()
- boolean isLast()
- void first()
- void last()
 
I'll stop commenting.
 
Regards,
Murat.

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Murat Demirci
Sent: Wednesday, February 23, 2005 10:06 PM
To: CFCDev@cfczone.org
Subject: RE: [CFCDev] query object

> but note you say you don't expect the same functionality... then you say "It doesn't work as expected". The expectation is to run like ASP, that is where it came from. (Or VBScript)
 
You're right at the end they are similar.
 
> If I get a window and someone else doesn't do it first...
 
That's not my principle John since there are lots of works to do, I have to sort them.
 
> Write up all the specs for me... and I will put one together. The advantage to doing it in a CFC is you can pass the recordset in... CF can dynamically move to any record, forward, back... etc. A custom tag would not do this for you... tags can't be instantiated and lack persistance. UDF's also lack persistance. Therefore a CFC seems the way to go... unless someone has a reason to use another tool. (And please don't say CF5!)
 
I don't believe a CFC can solve the issues, but I'm sending the ready-to-use QueryIterator CFC here. The usage of this CFC is, you can enhance it:
 
<cfquery name="myQuery" datasource="myDsn">
select description from aTable
</cfquery>
<cfset qi = createObject("component", "QueryIterator").init(myQuery) />
<cfset i = 0 />
<cfloop condition="qi.hasNext()">
 <cfset qi.next() />
 <cfset i = i + 1 />
 <cfoutput>#i#. #qi.current("description")#<br /></cfoutput>
</cfloop>
 
Murat.
---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to cfcdev@cfczone.org with the words 'unsubscribe cfcdev' as the subject of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com). An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org

---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to cfcdev@cfczone.org with the words 'unsubscribe cfcdev' as the subject of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com). An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to cfcdev@cfczone.org with the words 'unsubscribe cfcdev' as the subject of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com). An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org

Reply via email to