1) Does anyone know of a good software package / utility for diagnosing load issues?
2) As requested, the code is below, check it out ---->
Thank you
Okay, so say way run this object called hcp.cfc.
<!--- COLDFUSION COMPONENT: hcp.cfc --->
<cfcomponent displayname="hcp" extends="main" hint="I contain methods that load and access information for the entire hcp.com application.">
<!--- METHOD: initializeObject() --->
<cffunction name="initializeObject" access="public" output="no" hint="I prepare content, routines, and objects for hcp.com">
<!--- Attempt to run the function code --->
<cftry>
<!--- Obtain the top-level market topics from the database --->
<cfinvoke
component="#server.database#"
method="selectTopics"
prefixFilter="m1"
returnvariable="sthcpInfo.aMarkets">
<!--- For each market returned by the database... --->
<cfloop from="1" to="#ArrayLen(sthcpInfo.aMarkets)#" step="1" index="current_market">
<cflock scope="SERVER" type="EXCLUSIVE" timeout="30">
<!--- Create a new topic object for this market in server memory--->
<cfset "server.#sthcpInfo.aMarkets[current_market].topic#" = CreateObject("component", "cf_components.topic")>
<!--- run the initializeObject routine to init this object--->
<cfset Evaluate("server.#sthcpInfo.aMarkets[current_market].topic#.initializeObject(sthcpInfo.aMarkets[current_market].topic)")>
</cflock>
</cfloop>
<!--- If something went wrong with the function code... --->
<cfcatch type="Any">
<!--- Run the error handling routine --->
<cfinclude template="/cf_includes/cfcatch.cfm">
</cfcatch>
</cftry>
</cffunction>
In the above hcp.cfc we have a routine that runs called initializeObject that prepares information to be stored in this object. One piece of info is market information, which we store in an array. hcp.cfc is created like so if the variable server.hcp does not exist (logic is in application.cfm):
<cfset server.hcp = CreateObject("component", "hcp.cfc")>
<cfset server.hcp.initializeObject()>
Inside this initialization routine it accessed server.database (another cfc created identical in design to hcp.cfc). We are accessing a method called selectTopics. SelectTopics looks like th
<cffunction name="selectTopics" access="public" output="no" returntype="any" hint="I get topic information from the topic table and return it as an array">
<!--- Parameters associated with this method (Function-level variables are prefixed with "var_") --->
<cfargument name="prefixFilter" type="string" required="No" default="0">
<cfargument name="columnSorter" type="any" required="No" default="topic">
<cfargument name="sortType" type="any" required="No" default="ASC">
<!--- Attempt to run the function code --->
<cftry>
<cfquery name="qQuery" datasource="#dsn#">
SELECT col1, col2
FROM table 1
LEFT JOIN table2 ON (table1.col1 = table2.col2
<cfif arguments.prefixFilter NEQ "0">
WHERE table1.col1 LIKE '#arguments.prefixFilter#%'
</cfif>
AND Left(table1.col4, 2) <> '99'
ORDER BY table1.#arguments.columnSorter# #arguments.sortType#
</cfquery>
<!--- return the information to the requester as an array of structures--->
<cfreturn qQuery>
<!--- catch any errors that could have happened. --->
<cfcatch type="Any">
<!--- Run the error handling routine --->
<cfinclude template="/cf_includes/cfcatch.cfm">
</cfcatch>
</cftry>
</cffunction>
we access this information using a get routine called getMarkets
<!--- Get the market list from the hcp.object --->
<cfset variables.aMarketList = server.hcp.getMarkets()>
getRoutine looks like this:
<cffunction name="getMarkets" output="no" access="public" returntype="any" hint="I get all market information and return it as an array">
<!--- Attempt to run the function code --->
<cftry>
<!--- return headlines --->
<cfreturn stHCPInfo.aMarkets>
<!--- If something went wrong with the function code... --->
<cfcatch>
<!--- Run the error handling routine --->
<cfinclude template="/cf_includes/cfcatch.cfm">
</cfcatch>
</cftry>
</cffunction>
----- Original Message -----
From: Raymond Camden
To: CF-Talk
Sent: Wednesday, February 25, 2004 9:26 AM
Subject: RE: problems accessing variables with components
Can you share the code then?
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

