Title: RE: [CFCDev] query object CFC Beta

>I address the "This scope" as attributes. If someone creates a datafield that matches a function name they are both existing with simular "name" but they are independent

Well… unless something has changed in CFMX7 that I missed hearing about, they're *not* independent.  If you have a method movePrevious(), and for some reason the query you're iterating has a column "movePrevious" (maybe it's a chess-game database?), then when your setAttributes() method gets to here:

<cfset this[local.columnName] = variables.query[local.columnName][variables.currentRow]>

On the 'movePrevious' column, you're doing this:

<cfset this["movePrevious"] = variables.query["movePrevious"][variables.currentRow]>


And you'll overwrite the movePrevious() method with the value of variables.query["movePrevious"][variables.currentRow].

A method is just a variable.  And the movePrevious() method is just this.movePrevious.  So as with any other similar situation, if you set this.movePrevious to be anything else, the original value (in this case your method) is lost.

Try it.

Use this code to generate your query, and then iterate over it:
<cfscript>
        q = queryNew("init,getColumnList,getCurrentRow,getRecordCount,getRecordSet,hasNext,hasPrevious,isFirst,isLast,moveFirst,moveLast,moveNext,movePosition,movePrevious,setAttributes");

        for (i=1; i le 10; i=i+1){
                queryAddRow(q);
                querySetCell(q, "init", createUUID());
                querySetCell(q, "getColumnList", createUUID());
                querySetCell(q, "getCurrentRow", createUUID());
                querySetCell(q, "getRecordCount", createUUID());
                querySetCell(q, "getRecordSet", createUUID());
                querySetCell(q, "hasNext", createUUID());
                querySetCell(q, "hasPrevious", createUUID());
                querySetCell(q, "isFirst", createUUID());
                querySetCell(q, "isLast", createUUID());
                querySetCell(q, "moveFirst", createUUID());
                querySetCell(q, "moveLast", createUUID());
                querySetCell(q, "moveNext", createUUID());
                querySetCell(q, "movePosition", createUUID());
                querySetCell(q, "movePrevious", createUUID());
                querySetCell(q, "setAttributes", createUUID());
        }
</cfscript>

Best put your code in a try/catch block, and do a dump of your object in the catch...
--
Adam

This email contains confidential information. If you are not the intended recipient of this email, please notify Straker Interactive and delete the email. You are not entitled to use it in any way.

---------------------------------------------------------- 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