Dayum, dude...

And I thought *I* was long-winded... cooooooool!

Someone who goes thru keyboards faster than I do! hehe

I just happened to be skimming the code example and saw the isDefined
thing. I saw it, and questioned it. Glad you weren't put out.

I'm all for annoying people, except people you respect.

You definitely make some good points. Especially since I also find
structKeyExists() painful and/or difficult to type. And I ALWAYS spell
it strucktKeyExists the first time around, and it gives me many
errors, and the errors say unto me "variable undefined" and yea do I
say then, "farging iceholes, I done did it agin'..."

I use full syntax in on-list examples because I fear that those who
read it may inherit (or discover) bad habits in my code, and they may
later accuse me of being silly, lazy, or, worse, utterly lacking in
proper geek comportment.

As far as the DB example, that's a return from a SQL Server built-in
stored procedure, and it will ALWAYS return a minimum of 2 query
objects... since my data access layer is wrapped in a CFC and it's a
one-off call to a simple DAO to execute the sproc it seemed much more
sensible to code one function-local struct and return the data to the
caller than to write a complicated system (it's a base DAO and 3
extension classes as it is) wherein I have getters and setters for
anywhere between 1 and 8 resultsets, possibly more than one sproc call
(depending on which extension class I'm calling), and all the data
(or, at least very most of the data) is always going to be needed.
Since they're not long resultsets anyway, I elected to sacrifice a
little bit of overhead on behalf of a simpler design.

Incidentally, since I was returning the data in a struct, I discovered
that I had a situation wherein my tableDAO may return either 7 OR 8
resultsets, depending on the structure of the table. The issue that
ensued is very difficult to explain understandably.... so bear with
me. In a full response from the sproc, I'd have an 8-element struct,
with a query in each. If the sproc only returned 7 results, it always
dropped what I had defined as resultset 6. When that happened, CF
dropped the 8th name from the struct, but left out resultset 6, which
means that resultset 7 ended up in a struct element with the key name
that should have been reserved for resultset 6, and resultset 8 ended
up in the struct under a key name that should have been set aside for
result set 7.

What I ended up doing was adding a private method that reconstructs
the return value on the fly, looping over the struct generated by the
sproc call and keying off unique column names in the datasets to
reorder the struct. As I write this, I begin to think it's probably
not the best way, but... it worked. And it proved to me that there is
definite value in API-based coding.

I hope that made sense.

Anywho, thanks for responding.

Laterz,
J


On Fri, 4 Mar 2005 20:01:10 -0500, S. Isaac Dealey <[EMAIL PROTECTED]> wrote:
> In my own code I use structKeyExists() _nearly_ exclusively. Which is
> not to say that there aren't exceptions. The exception in general is
> when either a) I don't actually know what the name of the variable
> will be and as a result would have no data to pass to the
> structkeyexists() function -- this is an unfortunate circumstance
> which arrises occasionally when I want to conditionally check for the
> existence of a variable within a function given the name of the
> variable -- some variable names are fine in an isdefined() call, other
> quite common and perfectly valid variable syntaxes produce an
> exception (I think isdefined("myarray[1]") is all it takes)... I would
> _MUCH_ rather cf simply return false in _any_ case that the value is a
> string which can't be evaluated (rather than a complex object) in much
> the same way that isNumeric() will not error when given a complex
> object for examination. That not being the case, I end up being forced
> to resort to try-catch -- which is an awful way to manage that because
> the exception is a waste of resources - but I digress - or b) when I
> know that the syntax for the variable will be valid in an isdefined()
> call, but I'm not certain all the structures will exist:
> <snippages>


-- 
Continuum Media Group LLC
Burnsville, MN 55337
http://www.web-relevant.com
http://cfobjective.neo.servequake.com

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:197569
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to