Sorry, I was doing 3 things at once.

Revised code sample:
<cfset querier = createObject( "QueryFactory" ) />
<cfset querier.setDSN( "BSParty" ) />
<cfset querier.setQueryString( "select * from table" ) />
<cfset results = querier.execute() />


On Sat, Nov 15, 2008 at 11:11 PM, David McGuigan <[EMAIL PROTECTED]>wrote:

> What are you actually trying to accomplish here?
>
> Just glancing at your CFC, it seems like a simple query to the database
>
> <cfquery name="getBS" datasource="BSParty" >
>       select * from table
> </cfquery>
>
> Has now become:
> <cfset querier = createObject( "QueryFactory" ) />
> <cfset querier.setDSN = "BSParty" />
> <cfset querier.setQueryString = "select * from table" />
> <cfset results = querier.execute() />
>
> I'm wondering what the point is? If it's to eliminate the need to specify a
> datasource in every query, you're doing just as much work here with these
> fruitless methods. One of the strengths of the cfquery tag is that it wraps
> around content for clear, readable formatting of SQL. With your CFC the only
> way to preserve that would be cfsavecontent, which will now add even more
> code to your plate for querying the database.
>
> I'm really curious. What are the benefits/goals of the approach?
>
>
>
>
>
> On Sat, Nov 15, 2008 at 10:40 PM, prashant roy <[EMAIL PROTECTED]>wrote:
>
>> right. i am just worrying.
>> if my one component will serving all my queries then how much it affects
>> the performance of website. load testing is good thing to go ahead
>>
>> On Sat, Nov 15, 2008 at 9:28 PM, Oscar Arevalo <[EMAIL PROTECTED]>wrote:
>>
>>> 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