[thelist] CF: Clearing a cached query?

Joshua Olson joshua at waetech.com
Tue Oct 15 12:34:01 CDT 2002


----- Original Message -----
From: "Raymond Camden" <jedimaster at macromedia.com>
Sent: Tuesday, October 15, 2002 10:16 AM


> > unless I'm reusing the query (which is another avoidable
> > problem), putting a
> > query in an include seems to add to disorganization, when there are
> > perfectly viable solutions (like the one I presented).
> >
>
> This I strongly disagree with. What happens if you change your table
> structure? Every file that uses the query then has to be updated. By
> abstracting your queries, you make it much easier to update your code.
> How is disorganized to move multiple queries in multiple files to one
> query in one file?

Hear, hear... I agree 100%.  As of late I've started putting my queries into
custom tags and am finding that my resulting code is much more compact,
organized, and easier to maintain.  Moreover, often times I find that one
query becomes 2, 3, or more queries because of "upgrades" the client
requests.  For example, give a content driven site with all content
available to the public.  One day, the client decides that they want to
restrict content to subscribers.  Instead of saying to them, "well, to do
this, I'm going to have to add security whenever the articles are pulled
from the database... that could take hours... and don't you dare change your
mind or I'll have to do this again!!", I can say, "okay, no problem.  After
we decide on the exact nature of the security schema, it'll only take a few
minutes to update the code."

Another example, I use a custom tag to encapsulate the login process.
Suddenly, the client wishes to incorporate the login database (Access 95)
from the company they just merged with--but for some reason they don't want
to spend the money to port the Access database into the SQL Server 2k
database that current drives the site.  Instead of hunting down all the
places where the login queries are performed, simply update the one Custom
Tag.

Even for some one-time use queries, I find that I save myself trouble in the
future if I make a custom tag out of the query.  Oh so often the need for
the same action will arise again, and having the query wrapped into a CT
saves a lot of time.

Just my 4cents.

-joshua




More information about the thelist mailing list