macromedia.coldfusion.advanced_techniques
[Top] [All Lists]

Re: Making a query object with only certain columns?

Subject: Re: Making a query object with only certain columns?
From: Adam Cameron
Date: Fri, 19 Sep 2008 00:11:22 +0100
Newsgroups: macromedia.coldfusion.advanced_techniques

> I could approach it that way, but I have about 7 different columns to pass so 
> I'd have to pass in 8 parameters each time (query name + 7 cols).

Well: two.  The query, and the list of columns.

I'd approach this by just passing in a query, and stipulating in the hint
for the argument that it must have specific columns.  Within the method,
check the correct columns are there, and if not: raise an exception.
Garbage in: garbage out.  I think you are overcomplicating things with what
you're suggesting.

Conversely, you could have two arguments:
- a query (required)
- a list of column mappings (optional)

If there's no mappings, then the correct columns must be in place.  If
there's the mapping list, use those ones instead.  There's - of course -
still no guarantee that the columns in the mapping list will be in the
query, but there's only so much one can do to accommodate the calling code.

-- 
Adam

<Prev in Thread] Current Thread [Next in Thread>