Re: Error Handling Coming Out of a Trigger
- From: "Del Murray" <Del.Murray@xxxxxxxxxxxxxx>
- Date: Fri, 22 Jun 2007 11:54:29 -0500
Brain,
I like to keep the logic in the Dephi app when it is complicated. I have
seen SQL Servers brought to their knees or cluged up unnecessarily spreading
DB's across multiple servers because the logic in SP and Triggers was overly
complex.
This is particularly tragic when a new DB admin or programmer gets ahold of
the app and wants to try one of everthing that he learned in school simply
because he can and it's cool. Sometimes you want to take a stick to them ..
a large stick, with a nail in the end. :-)
Database managers are for manageing data and Programs are for manageing
business logic, I dont care what the school boys say. (let the flaming
begin).
Icharus' wings "looked" like a good idea, but .......
The example you have right now with your "service lines" is a good one.
There are multiple ways to handle it probably and changing approaches in
stored procedures is usually more difficult than changing program code. ...
IMHO.
Can you give me a little more detail about service lines and discounts on
transactions?
.. A transaction could be an invoice or a line item on an invoice. In
general, if you have a control table where the definition of how "service
lines" are to be discounted then you could 'join' to the definition table
and then for each row (line item or invoice) you would have all of the
discount info available and you would just have to sweep the dataset from
front to back applying the discounts. The nice thing here (if it applies),
is that if say.. line item 4 gets an additional discount based on anything
that came before or after it (say .. if surgical tools (line 2) are
discounted 4% then bandages (line 4) have to also be discounted 4% (even
though the rule says 15%), and if the surgical tools, line 2 was discounted
4% because line 1 exceeded 5000) then you can sweep back and forth (next,
previous) in the dataset recalculating the amounts. This may exceed the
level of complexity for your app, although I am working on one right now for
cell tower billing that is worse. BUT .. if they ever do make it complex,
you have the 'engine' already in place in that it is a block of code. Make
the code so it is modular and then you can use it from anywhere in the
program.
I onced saved 3 guys a couple weeks of programming by showing them they
could read a Clipper database file backwards ... amazing ... we used to read
tapes backward in the old days because it saved hours of rewind time at the
end of the day.
THis really isnt rocket science you know ... :-)
HTH,
Del
.
- Follow-Ups:
- Re: Error Handling Coming Out of a Trigger
- From: Brian Hollister
- Re: Error Handling Coming Out of a Trigger
- References:
- Error Handling Coming Out of a Trigger
- From: Brian Hollister
- Re: Error Handling Coming Out of a Trigger
- From: Brian Bushay TeamB
- Re: Error Handling Coming Out of a Trigger
- From: Brian Hollister
- Re: Error Handling Coming Out of a Trigger
- From: Del Murray
- Re: Error Handling Coming Out of a Trigger
- From: Brian Hollister
- Error Handling Coming Out of a Trigger
- Prev by Date: Catch the print in aTADOCOMMAND
- Next by Date: Re: Error Handling Coming Out of a Trigger
- Previous by thread: Re: Error Handling Coming Out of a Trigger
- Next by thread: Re: Error Handling Coming Out of a Trigger
- Index(es):