If you are picky about performance, you may want to get rid of the
"isDefined" too...

On Sat, Nov 15, 2008 at 11:27 PM, Barney Boisvert <[EMAIL PROTECTED]>wrote:

>
> if performance is the question, load testing is the answer.  If even
> simple load testing is too much work, then it's fast enough.  :)
>
> cheers,
> barneyb
>
> On 11/15/08, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> >
> > 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>
> >
> >
> > >
> >
>
>
> --
> Barney Boisvert
> [EMAIL PROTECTED]
> http://www.barneyb.com/
>
> >
>


-- 
Oscar Arevalo
http://www.oscararevalo.com

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