Hi All,

I am using a "Query Factory" component for all queries for my big
Application. I want to know is it good or bad to use in place of
CFquery as performance wise.

I am using same kind of process for Object Factory. so its good or bad
performance wise?
Pls advice.
Here is the code for QueryFactory
--------------------------------------------------

<!----

<cfcomponent output="false" hint="query factory"
extends="exception.load">

        <cfscript>
                init();
        </cfscript>

        <cffunction name="init" access="public" output="false"
returntype="any" hint="Initialize the query factory object">
                <cfargument name="DSN" required="false" type="any"
default="DSNOfApp" hint="DSN for query" />
                <cfset var dsn = Arguments.DSN>

                <cfscript>
                        if (trim(dsn) eq "")
                        {
                                dsn="defaultdsnforyourapplication";// default 
dsn for ur
application
                        }
                        setDSN(DSN);
                        setQueryString("");
                </cfscript>
        </cffunction>

        <cffunction name="getType" access="public" returntype="any"
output="false" hint="Returns the objects type">
                <cfreturn "utility.queryFactory" />
        </cffunction>

        <cffunction name="setDSN" access="private" output="false"
returntype="void" hint="Sets DSN for query">
                <cfargument name="newDSN" type="string" required="true" />
                <cfSet Variables.DSN = Arguments.newDSN />
        </cffunction>



        <cffunction name="getDSN" access="private" output="false"
returntype="any" hint="Gets DSN for query">
                <cfscript>
                        if (isDefined('Variables.DSN')){
                                return Variables.DSN;
                        }else{
                                return '';
                        }
                </cfscript>
        </cffunction>

        <cffunction name="setQueryString" access="public" output="false"
returntype="void" hint="Sets sql statements for query">
                <cfargument name="newQueryString" type="string" required="true" 
/>
                <cfSet Variables.QueryString = Arguments.newQueryString />
        </cffunction>

        <cffunction name="getQueryString" access="public" output="false"
returntype="any" hint="Gets sql statements for query">
                <cfscript>
                        if (isDefined('Variables.QueryString')){
                                return Variables.QueryString;
                        }else{
                                return '';
                        }
                </cfscript>
        </cffunction>

        <cffunction name="getResultSet" access="public" output="false"
returntype="any" hint="Gets the resultset">
                <cfscript>
                        if (isDefined('variables.resultSet')){
                                return variables.resultSet;
                        }else{
                                return '';
                        }
                </cfscript>
        </cffunction>

        <cffunction name="setResultSet" access="private" output="false"
returntype="any" hint="Sets the resultset">
                <cfargument name="newResultSet" type="any" required="true" />
                <cfset variables.resultSet = Arguments.newResultSet>
        </cffunction>

        <cffunction name="execute" access="public" output="false"
hint="executes the query">
                        <cfset variables.qry="">

                        <cfquery name="qry" datasource="#getDSN()#">
                                #getQueryString()#
                        </cfquery>

                        <cfscript>
                                setResultSet(variables.qry);
                        </cfscript>

        </cffunction>

</cfcomponent>


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CFCDev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cfcdev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to