Title: RE: [CFCDev] query object CFC Beta

Adam,

No, QueryIterator is not a UDF library it's just an *Iterator* object so it is simple; this simplicity doesn't mean it's not an object. However it may implement a more general interface. For example:

- any init(query)
- boolean isLast()
- boolean isFirst()
- void moveFirst()
- void moveLast()
- boolean moveNext()
- boolean movePrevious()
- any getItem(columnName)
- numeric getIndex()
- void setIndex(newIndex)
- numeric getCount() (this method and the below one are exceptions I think. I added them since they might be necessary for granular processing so iteration)
- query getCollection()

I'm sending QueryIterator version 0.5 (John, please send your ideas); it's stable now. This iterator component works with only query objects however it is generalized. So you can more easily change this component to use an Iterator interface or to iterate over Arrays, Structures and Lists. You can also prefer to use Ben Rogers's components; they and this component actually share the same idea of "do iteration only". Also they and this component are a good example of different implementations of iteration.

Adam, you prefer to develop/use a general Collection component(s) that provides iteration, item manipulation, collection creation and metadata access. It may be attractive however I don't think it is necessary since I cannot found a strong real-world reason to use them. Maybe you can develop a collection component to simulate arrays that works with reference? CF's arrays are not passed via reference so it may be problematic when passing an ordered object array between application layers. Your collection component can solve this.

Murat.

Attachment: QueryIterator.cfc
Description: Binary data

Reply via email to