• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Query Caching

In Listing 24.9, the code returns a recordset containing the state abbreviation and the state ID from the State table. As you might imagine, this query could be used to populate a form select list. By using the results of our ListStates query to populate a select list, we remove the need to hard code 50 or more OPTION tags. Not only does this save us time, but also it eliminates potential mistakes in our code. Yes, I know that there are only 50 states, but let’s not forget about Washington, D.C., Puerto Rico, and the various territories.

I am sure that you can think of a number of templates that could require the use of this States select list. Let’s assume that we have created a form that new customers use to open new accounts. Each time a customer goes to create a new account, the ListStates query is run, and the result set is the same each time. Although this is a simple query and takes only a few milliseconds to execute, it could be called hundreds of times a day as new accounts are created. Because the ListStates query could be used in a number of CFM templates, we could realistically have a situation in which this query is executing several thousand times a day. Those “few milliseconds” of execution time start adding up, not to mention the resulting network traffic.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint