You could cache the query then use query of query to extract the appropriate
line from the previous query. However caching in an admin context is
probably a bad idea. You could pass all the form field data through to the
form when you click the edit link, but that would slow down the page, be a
pain to maintain, pose security problems, and just be plain weird.

Best thing to do, I think, is exactly what you're doing. To me, writing
maintainable code comes first. Performance comes second. Maintainable means
writing things the simplest, most intuitive, most boring way possible. Of
course sometimes "simplest" means writing a clever and complicated custom
tag / cfc and treating that as a black box.

  _____  

From: Mark Henderson [mailto:[EMAIL PROTECTED]
Sent: Tuesday, 17 August 2004 2:57 p.m.
To: CF-Talk
Subject: reducing number of queries

I'm using fuseQ for most of this project and I only have one question that
will (hopefully) cut down on the use extranneous switches (which I'm sure
have and I don't need).

So heres the relevant part of my switch..

    <cfcase value="selectClient">
        <cfset XFA.updateClient = "admin.updateClient">
        <cfset temp=AddToQ("adminQueries.clientSelect")>
        <cfset temp=AddToQ("admin.displayClient")>
    </cfcase>

    <cfcase value="displayClient">
        <cfset XFA.updateClient = "admin.clientInfo">
        <cfset AddToQ("home.defaultLayout AS LAYOUT")>
        <cfinclude template="dsp_clientSelect.cfm">
    </cfcase>

    <cfcase value="clientInfo">
        <cfset temp=AddToQ("adminQueries.clientInfo")>
        <cfset temp=AddToQ("admin.updateClient")>
    </cfcase>
  
    <cfcase value="updateClient">
        <cfset XFA.updateClientSuccess = "admin.updateClientRecord">
        <cfset AddToQ("home.defaultLayout AS LAYOUT")>
        <cfinclude template="dsp_updateClient.cfm">
    </cfcase>

    <cfcase value="updateClientRecord">
        <cfset temp=AddToQ("adminQueries.updateClient")>
        <cfset temp=AddToQ("admin.updateClientSuccess")>
    </cfcase>

    <cfcase value="updateClientSuccess">
        <cfset XFA.adminSelection = "admin.adminSelection">
        <cfset AddToQ("home.defaultLayout AS LAYOUT")>
        <cfinclude template="dsp_updateClientSuccess.cfm">
    </cfcase>

Select client calls a query

<cfquery name="selectClient" datasource="#request.dsn#">
  SELECT  *
  FROM  client
  WHERE  company_name IS NOT NULL
  ORDER BY  company_name ASC
</cfquery>

which I output to the dsp_selectClient.cfm file, only displaying the list of
clients for the administrator to choose one for editing/updating. From here
I use the selected form entry to re-query the same database for JUST this
user so as  to output their details (as in the clientInfo and updateClient
switches). What I am wondering is if there is a way to grab and only output
the selected client from the previous query, instead of having to query
again (which seems inefficient).

Any ideas? The problem I usually have when trying this is a resulting error
telling me I have attempted to call from a query that's no longer available.
On that note, I wonder what's the easiest way to save a reasonably large
query like this. Is it possible to use a Structure and output a particular
client from this perhaps?

TIA

Regards
Mark Henderson
Web Designer
<mailto:[EMAIL PROTECTED]> mailto:[EMAIL PROTECTED]

205 Main Street
PO Box 143, Gore
Southland 9700
Phone: (03) 203 9999
Fax: (03) 203 9900

Notice of Confidential Information: The information contained in this
electronic mail is CONFIDENTIAL INFORMATION and may be LEGALLY PRIVILEGED,
intended only for the individual or entity named above. If you are not the
intended recipient, you are hereby notified that the use, dissemination,
distribution, or copying of this document is strictly prohibited. If you
have received this electronic message in error, please immediately notify us
by return or telephone (0064 3 203 9999) and destroy the original message.
Thank you.

  _____
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to