What I have is a table structure that looks like this:
| contact_id | start_time_1 | end_time_1 | start_time_2 | end_time_2 |
start_date | end_date |
start_time_1, start_time_2, end_time_1, and end_time_2 contain the primary
key of this table:
| days_times_id | days | times |
The trick is to get the primary keys from the one table and then look up the
values from the other. Unfortunately, I don't think I am doing this very
efficiently.
I have this bit of code:
<cfloop query="qryGetDaysFromTeacherSchedule">
<!--- Set some temp variables = to previous query results)
<cfscript>
Request.TempTime1 = start_time_1;
Request.TempTime2 = end_time_1;
Request.TempTime3 = start_time_2;
Request.TempTime4 = end_time_2;
</cfscript>
<!--- Loop four times, to account for 2 different start times and end
times --->
<cfloop from="1" to="4" index="i">
<!--- Get the values associated with the primary keys assigned to
the previous temp variables --->
<cfquery name="qryGetTimes" datasource="#Request.main_dsn#">
SELECT times FROM days_times WHERE days_times_id =
#Evaluate('Request.TempTime#i#')#
</cfquery>
<!--- Set the query results = to some more temp Variables --->
<cfset "Request.TempTime2#i#" = qryGetTimes.times>
</cfloop>
<cfif DayOfWeekAsString(DayOfWeek(week_day)) eq days and
(Variables.TempTime21 neq Variables.TempTime22)>
<!--- "DO STUFF" --->
</cfif>
</cfloop>
That one little bit of code is responsible for 9 ms of page processing time.
What in the world can I do to reduce this as much as possible? I know a
stored procedure would take a bit off that, but I don't know if it will be
enough and just want to explore all possibilities.
Thanks!
Todd Ashworth
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists