Here's a conceptual question. Lets say you have a query with multiple rows
in it. There is a few calculations that will take place between items in a
row to get some additional values per row (i.e. a discount price, etc.).
One way of doing this is when outputting the query, you send the
Michael,
I don't know if this will play into it at all, but I seem to remember
some people talking about performance hits when you build new queries or
add columns/data to existing queries using the query functions in CF.
The method of using a CFC to format the data and return a new query
object
Straight from a DB or SP. There are calculation items that can't be done in
the query itself which is why that's not an option.
If the query data came straight from a database rather than being a QoQ or
something , then I would prefer to do all the calculations in the original
SELECT
The performance of a CFC that has been set as an object is very good. I'd
have to say extremely good with a 0ms hit on most occasions. As for a
performance hit when building/altering queries, I've never heard of one but
I'll do some tests to be sure. A query 'object' is just like an array
'object'
with a clear-cut solution.
John Burns
Certified Advanced ColdFusion MX Developer
AI-ES Aeronautics, Web Developer
-Original Message-
From: Michael Dinowitz [mailto:[EMAIL PROTECTED]
Sent: Monday, January 17, 2005 12:43 PM
To: CF-Talk
Subject: RE: Extra query info
The performance of a CFC
to create two methods: the public one that takes a
query object could call the private method that does the processing on each
row.
Andy
-Original Message-
From: Michael Dinowitz [mailto:[EMAIL PROTECTED]
Sent: Monday, January 17, 2005 12:43 PM
To: CF-Talk
Subject: RE: Extra query info
Also, have you considered having the database doing the calculations and create
the new fields, then it's already for the ColdFusion once the record set it
returned.
You probably have, but I wanted to throw this out, as it's an under utilized
technique.
--
Ian Skinner
Web
Someone mentioned that already and it's not possible in this instance. On
the other hand, you are correct that it's an under utilized technique. Care
to write up a small paper on it? ;)
Also, have you considered having the database doing the calculations and
create the new fields, then it's
Programmer
BloodSource
www.BloodSource.org
Sacramento, CA
C code. C code run. Run code run. Please!
- Cynthia Dunning
...-Original Message-
...From: Michael Dinowitz [mailto:[EMAIL PROTECTED]
...Sent: Monday, January 17, 2005 12:06 PM
...To: CF-Talk
...Subject: RE: Extra query info
Not complete against the idea of writing a paper, even though that is not
really my thing, IE I have never done it before. It would probable be a
week or three before I had the time, but other then that sure, why not.
I happen to know an excellent editor who will work with you to craft a piece
If you're using CFCs it would make more sense to create a function
that takes a set of data (one row) manipulates it and returns
something else. This way the function can be utilized everywhere
instead of just for a query. If you're feeding the whole data set to a
CFC why not just make an include
Right. That's the first option below. Looks like that's the one to go with.
Problem is, it makes the debug look a mile long. :(
If you're using CFCs it would make more sense to create a function
that takes a set of data (one row) manipulates it and returns
something else. This way the function
On Mon, 17 Jan 2005 15:57:41 -0500, Michael Dinowitz
[EMAIL PROTECTED] wrote:
Right. That's the first option below. Looks like that's the one to go with.
Problem is, it makes the debug look a mile long. :(
Yes but you will be able to sleep better at night knowing you have not
made a complete
I pass queries to CFCs all the time when there's a need. I don't see it as
making a mockery of CFCs.
As for debugging, it's my own state of mind. This site has over 40 includes
per page and that number makes me crazy. I like my code tight and clean and
this site is no where near that. :(
Yes but
When do you passa query to a CFC? I would think you would pass an
object the has a query set in it maybe but a complete Query? I mean I
am sure there are valid reason but none are coming to mind :)
Adam H
On Mon, 17 Jan 2005 16:22:30 -0500, Michael Dinowitz
[EMAIL PROTECTED] wrote:
I pass
When I do a query it's super tight. It only has the important data that I
want to deal with. That being said, when I pass that query it's because I
want to work with all the data. As I make more changes to the HoF site and
optimize it more under Blackstone, I'll probably change how I do things.
into the DB. I'm sure that a CFC depending on environmental data (CGI, Form,
etc.) rather than explicitly passing that data in is a violation of some
rules somewhere.
yeah it is...i think even Forta's intro to CFCs calls this a no no.
But thats more from the standpoint that it hampers
This is where I disagree with the whole OO approach and what people consider
no nos. I know that the form processor CFC always processes a form. I know
that a form will only be posted as a form, never as an URL. I know that the
CFC will only be used in a place where a form will be posted to. Why
Actually, you usually DO pass in server, application, session, and
client variables into a CFC. Part of encapsulation is isolation from
the environment. What if I switch from client to session variables?
Do I really want to have to go change every CFC?
Same with your form CFCs. Chances are
On Mon, 17 Jan 2005 18:07:50 -0500, Michael Dinowitz
[EMAIL PROTECTED] wrote:
This is where I disagree with the whole OO approach and what people consider
no nos. I know that the form processor CFC always processes a form. I know
that a form will only be posted as a form, never as an URL. I
I echo what Barney saidbut i also see a valid point in what
Micheal is saying i thinkif I have a CFC called form_validator.cfc
I should be able to use it on a form...but I think that kinda defeats
some of the concepts that CFC are supposed to be used for...its like
making a CSS class
I think that realistically, there's always a time to break the
rules... even if you follow them to the letter 99% of the time.
Granted, saying I will ALWAYS pass a query into this CFC is just
begging for someone to change the rules. Unless you're writing a query
parser for some specfic purpose. Or
I guess I have to see more CFCs. The ones I've seen 'assume' that server,
application, session, and client exist and do not have to be passed in. I
usually even see request.DSN 'assumed' into the form. In your example (I see
what your saying about the form processing CFC) this would fail as no
On Mon, 17 Jan 2005 14:30:37 -0800, Adam Haskell [EMAIL PROTECTED] wrote:
When do you passa query to a CFC? I would think you would pass an
object the has a query set in it maybe but a complete Query? I mean I
am sure there are valid reason but none are coming to mind :)
Why are you surprised
, January 17, 2005 3:30 PM
...To: CF-Talk
...Subject: RE: Forms to CFCs RE: Extra query info
...
...I guess I have to see more CFCs. The ones I've seen 'assume' that server,
...application, session, and client exist and do not have to be passed in. I
...usually even see request.DSN 'assumed' into the form
I guess when I think about what I would be doing I can only think of
procesing individual rows in the query not doing in processing to the
query itself...I can understand returning a query I use that plenty of
places... But thats kind of what i am getting at, when it comes to
pasing in a query, if
It all boils down to how much you value encapsulation. I think it's
worth it, but that's just me. I hate testing code, so the more
isolated each bit of code is the better. I also work on
constant-development apps, so it's not a build it and let it run
type thing, I'm constantly making changes.
On Mon, 17 Jan 2005 18:30:25 -0500, Michael Dinowitz
[EMAIL PROTECTED] wrote:
I guess I have to see more CFCs. The ones I've seen 'assume' that server,
application, session, and client exist and do not have to be passed in.
I would classify those as not good practice.
I usually even see
How about a method that does send a notification to these users.
You might pass in an array of user objects, but depending on how the
rest of your app is set up, you might well be passing a recordset.
You could write also it so that you'd notify each user individually
(separate method call), and
The more I think about it, the more passing the form scope into the form
processing CFC makes sense, as long as there is no overhead for this operation.
On the other hand, I can't see a reason to pass the CGI scope into a CFC that's
designed to do site logging. It's designed to operate with the
30 matches
Mail list logo