[thelist] ASP: More Selective Select

rudy r937 at interlog.com
Thu Jul 3 20:02:25 CDT 2003


> If you had your queries stored in your database, or, some kind of separate
> layer (or even just separate files) for your data manipulation, then it
> probably would have been easier...

i put every CFQUERY into a CFINCLUDE whether it needs it or not

that way, i can reuse a query easily

it makes the surrounding code easier to read, too

plus, of course, there is query caching, and i will modify the queries to
make this easier to achieve

for example, if two separate pages need similar data, i will "supersize" the
queries so that both pages can share the same query

i.e. if page 1 wants SELECT A,B,C  and page 2 wants SELECT B,C,D then i will
write the query as SELECT A,B,C,D and let both pages CFINCLUDE it

and in a case where all pages need the same query, like the query that
fetches the nav bar, it is obvious that CFINCLUDEing the identical query on
every page makes query caching simple (since even a slight difference in the
sql makes it a different query)

yes, i've done global search and replace myself too, but hardly ever on sql


rudy




More information about the thelist mailing list