OK... got the naming conflict issue. Thanks for sticking with me.
Now addressing the object is like this...
objectName.column.columnName
so an object named objProduct and a column named image would be addressed like this.
<cfoutput> #objProduct.column.image# </cfoutput>
Attached is the upgraded code samle of the oquery.cfc
Thanks for clearing that up.
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]
<cfcomponent displayname="QueryIterator" output="false">
<!--- This CFC is the property of SOSensible. You may use it free of
charge under standard
GNU Open Source Lisc. practices. You may use it for personal or
commercial and modify it
to your needs at no charge. The only exceptions are that you may not
remove this notice and
you must not hold our company or employees liable in any way for it's
performance. If you enhance
this component we request that you send a copy of your enhancements to
us at [EMAIL PROTECTED]
for our review so that the spirit of this open source object will
continue to grow for the
community at large.
www.sosensible.com --->
<cfset variables.query = queryNew("empty","VarChar")>
<cfset variables.currentRow = 0>
<cfset variables.recordCount = 0>
<cfset variables.columnList = "">
<cfset variables.keyField = "">
<cfset variables.keyNumeric = TRUE>
<cfset this.column = structNew()>
<cffunction name="init" access="public" returntype="oquery"
output="false">
<cfargument name="query" type="query" required="yes">
<cfargument name="keyField" type="string" required="no"
default="">
<cfargument name="keyNumeric" type="boolean" required="no"
default="TRUE">
<cfset var local = structNew()>
<cfscript>
variables.query = duplicate(arguments.query);
variables.columnList = arguments.query.columnList;
variables.currentRow = 1;
variables.keyField = arguments.keyField;
variables.keyNumeric = arguments.keyNumeric;
variables.recordCount = arguments.query.recordCount;
setAttributes();
</cfscript>
<cfreturn this>
</cffunction>
<cffunction name="getColumnList" access="public" returntype="numeric"
output="false">
<cfreturn variables.columnList>
</cffunction>
<cffunction name="getCurrentRow" access="public" returntype="numeric"
output="false">
<cfreturn variables.currentRow>
</cffunction>
<cffunction name="getRecordCount" access="public" returntype="numeric"
output="false">
<cfreturn variables.recordCount>
</cffunction>
<cffunction name="getRecord" access="public" returntype="query"
output="false">
<cfargument name="key" type="string" required="No" default="">
<cfset local = structNew()>
<cfif arguments.key EQ "">
<cfset local.myKey =
variables.query[variables.keyField][variables.currentRow]>
<cfelse>
<cfset local.myKey = 0>
<cfloop index="local.row" from="1"
to="#variables.recordCount#">
<cfset local.value =
evaluate("variables.query.#variables.keyField#[local.row]")>
<cfif local.value EQ arguments.key>
<cfset local.myKey = local.value>
<cfset local.row =
variables.recordCount>
</cfif>
</cfloop>
</cfif>
<cfquery name="local.myReturn" dbtype="query">
SELECT *
FROM variables.query
WHERE #variables.keyField# = <cfif
variables.keyNumeric>#local.myKey#<cfelse>'#local.myKey#'</cfif>
</cfquery>
<cfreturn local.myReturn>
</cffunction>
<cffunction name="getRecordSet" access="public" returntype="query"
output="false">
<cfreturn variables.query>
</cffunction>
<cffunction name="hasNext" access="public" returntype="boolean"
output="false">
<cfreturn (variables.currentRow lt variables.query.recordCount)>
</cffunction>
<cffunction name="hasPrevious" access="public" returntype="boolean"
output="false">
<cfreturn (variables.currentRow gt 1)>
</cffunction>
<cffunction name="isFirst" access="public" returntype="boolean"
output="false">
<cfreturn (variables.currentRow EQ 1)>
</cffunction>
<cffunction name="isLast" access="public" returntype="boolean"
output="false">
<cfreturn (variables.currentRow EQ variables.query.recordCount)>
</cffunction>
<cffunction name="moveFirst" access="public" returntype="boolean"
output="false">
<cfset var local = structNew()>
<cfif variables.recordCount GTE 1>
<cfset variables.currentRow = 1>
<cfset local.myReturn = TRUE>
<cfset setAttributes()>
<cfelse>
<cfset local.myReturn = FALSE>
</cfif>
<cfreturn local.myReturn>
</cffunction>
<cffunction name="moveLast" access="public" returntype="boolean"
output="false">
<cfset var local = structNew()>
<cfif variables.recordCount GTE 1>
<cfset variables.currentRow = variables.recordCount>
<cfset local.myReturn = TRUE>
<cfset setAttributes()>
<cfelse>
<cfset local.myReturn = FALSE>
</cfif>
<cfreturn local.myReturn>
</cffunction>
<cffunction name="moveNext" access="public" returntype="boolean"
output="false">
<cfset var local = structNew()>
<cfif hasNext()>
<cfset variables.currentRow = variables.currentRow + 1>
<cfset local.myReturn = TRUE>
<cfset setAttributes()>
<cfelse>
<cfset local.myReturn = FALSE>
</cfif>
<cfreturn local.myReturn>
</cffunction>
<cffunction name="movePosition" access="public" returntype="boolean"
output="false">
<cfargument name="position" type="numeric" required="Yes">
<cfset var local = structNew()>
<cfif arguments.position LTE getRecordCount()>
<cfset variables.currentRow = arguments.position>
<cfset local.myReturn = TRUE>
<cfset setAttributes()>
<cfelse>
<cfset local.myReturn = FALSE>
</cfif>
<cfreturn local.myReturn>
</cffunction>
<cffunction name="movePrevious" access="public" returntype="boolean"
output="false">
<cfset var local = structNew()>
<cfif hasPrevious()>
<cfset variables.currentRow = variables.currentRow - 1>
<cfset local.myReturn = TRUE>
<cfset setAttributes()>
<cfelse>
<cfset local.myReturn = FALSE>
</cfif>
<cfreturn local.myReturn>
</cffunction>
<cffunction name="setAttributes" access="private" returntype="boolean"
output="No">
<cfset var local = structNew()>
<cfset local.myReturn = TRUE>
<cfloop index="local.columnName" list="#variables.columnList#">
<cfset this.column[local.columnName] =
variables.query[local.columnName][variables.currentRow]>
</cfloop>
<cfreturn local.myReturn>
</cffunction>
<!--- To add functions...
addRecord()
deleteRecord()
updateRecord()
filter()
isFiltered()
clearFilter()
columnType()
columnQuoted() ...this would be used to know if query interaction for this
type of column requires quotes or not, could help automate dynamic queries
sort() ...note-not sure if QofQ can do a multicolumn sort
addDynmicColumn() ...i.e. "dynamically calculated columns" that return as
standard data columns. (and in CFMX7 you can have data types for these)
getRecordRange(start,end)
--->
</cfcomponent>---------------------------------------------------------- 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]
