I’m not trying to slight your approach in the least – it is indeed more compact and prettier to read.  I guess I’m just an efficiency buff – I’ve never been a fan of wrapping things that are fairly simple to do and that already do what you’re trying to do just for the sake of making it look prettier.  And yes, if CF had these functions natively, I would use them over the current methods for sure J

 

Anyway, if you’re _really_ aiming to make this easier for people, mightn’t this be better suited to a combination of a custom tag _and_ CFC?  The CFC would do exactly what you have planned.  The custom tag would wrap the CFQUERY tag and return an instance of your CFC.  That would make things even easier since there’s no CFC to create from the user’s perspective.  It would provide a full wrapper for cfqueries.

 

<cfquery2 datasource=”mydsn” name=”myquery”>

            SELECT something FROM somewhere

</cfquery2>

 

<cfset lastRecord = myquery.movelast()>

 

Roland

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of John Farrar
Sent: Wednesday, February 23, 2005 5:21 PM
To: [email protected]
Subject: Re: [CFCDev] query object

 

Roland Collins wrote:

I understand what you’re saying, but I still think they can all be done now!  We use this kind of stuff all the time and have never had issues with it.

 

Want the last record?

 

myquery.mycolumnname[myquery.recordcount]

or...
objQuery.moveLast()

 

Want to start half way through the query?

 

for (i = myquery.recordcount / 2; i lte myquery.recordcount; i = i + 1) {

somevalue = myquery.mycolumnname[i];

}

or...
objQuery.movePosition(123)

Thanks.... forgot that method.

 

Want to abort arbitrarily?

for (i = 0; i LTE myquery.recordcount; i = i + 1) {

somevalue = myquery.mycolumnname[i];

 

            if (somevalue is ‘my_matching_value’) break;

}

or...
with the CFC... just don't access it any more.

 

Or even better:

while (myquery.mycolumname[i] is not ‘my_matching_value) {

            doSomething();

            i = i + 1;

}

while(objQuery.myColumnname is not 'my_matching_value') {
       doSomething();
       objQuery.moveNext();
}


 

I guess I understand wanting to have a familiar way of iterating over data when you’re using multiple platforms, but I really don’t know anything that the ADO/.NET model has that the CF model doesn’t either!

 

Roland

The point is this. Yes if you know how you can do all of these functions in CF. Yet in every last case of examples you showed (even thought the last one required a couple of more typing characters... the CFC method is easier to implement, easier to read... and just more pleasant working. Isn't that why we use ColdFusion... because it makes programming more pleasant? This is using the language to take it to the next level.

And now something you will enjoy... it would be more difficult to extend the standard data methods to add features in ASP. ASP.net isn't "so bad"... but it's still easier to do it in CF. We aren't at all saying ASP has any advantages. We are just enhancing the CF to do it the way others like it... and add simplicity even beyond your solutions. Your solutions are good. Yet... for the new programmer it would be much easier to ramp up with the CFC we are creating.

John Farrar

---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] 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/[email protected] ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] 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/[email protected]

Reply via email to