Welcome! Log In Create A New Profile

Advanced

HFSQL /CS Exception/Tansaction/Referential integrity

Posted by BLS 
Howdy folks,

As said in the topic my questions is about Exceptions, Tansactions, and Referential integrity
I am using HFSQL C/S (nothing else)

For instance :

HTransactionStart()
WHEN EXCEPTION IN
    HAdd(Orders) // add the order
    HTransactionEnd() // validate the addition
DO
    HTransactionCancel() // delete the order lines
END


Do you think this makes sense ? In other words isn't a HAdd() guaranteed to work under whatever circumstances ?
What if I create a ref. integrity error by HAdd(), does it raise an exception ?

I have to create a rock solid WD14 RAD pattern, So IMO a Transaction Frame is the only way to go.. including deleting/modifying.


bjoern

Fabrice Harari
Re: HFSQL /CS Exception/Tansaction/Referential integrity
April 29, 2009 03:33PM
Hi Bjoërn...

a hadd can of course fail. You can have duplicate errors, integrity error, file access error, index error, and so on...

And for most of those, you do NOT need to use an exception to track it (result false, herror, herrorinfo, etc)

Of course, you also have to consider what type of automatic error processing you are setting up in your project (hOnError)...

Finally a transaction system is generally used only when you are saving multiple records related one to the others (invoice header + Lines) and you want to be sure that all of them are ok on disk at the same time..

So I would do the following:

- For any 'direct' error management, testing the result of each hFunction is enough
- for complex (multiple linked record) writing, use transactions
- For unexpected problems (hard disk failure, network problem, etc), use Exceptions

Of course, the funny part is testing (unplug the cable during a loop, 100 times, just to be sure :-) )

Best regards

Quote
Fabrice Harari
Hi Bjoërn...

a hadd can of course fail. You can have duplicate errors, integrity error, file access error, index error, and so on...

And for most of those, you do NOT need to use an exception to track it (result false, herror, herrorinfo, etc)

Best regards

Fabrice Harari
WinDev, WebDev, WinDev Mobile Consulting & Video Courses

Thanks Fabrice,
I know that : The questions is : Does a HAdd() integrity error raises an exception ? (which would be nice, beside) OR NOT?

>>> > My mistake , my request was quite fuzzy.

And sure , a multi-table update should live ONLY within a TTF.

The quint-essence of my question however remains the same :

Does this makes sense :
HTransactionStart()
WHEN EXCEPTION IN
    HAdd(Orders) // add the order
    HTransactionEnd() // validate the addition
DO
    HTransactionCancel() // delete the order lines
END

Let me ask in another way : If you have to create a RAD pattern, would you use this code snippet ?
Björn
PS: Sorry for missing the appointment....(Oversplept) ( keep you informed)
I#'l reply later atm the forum is not useable : Bjoern
Jimbo
Re: HFSQL /CS Exception/Tansaction/Referential integrity
April 29, 2009 07:59PM
Hi Bjoern, I'm sorry, the spam filter has caught your message. Imho it has been Fabrice's web signation. Just delete that next time. Sorry, but I cannot do anything about it. Every day at least a dozen spam postings hit the forum, some of them poisoned with web addresses that inject backdoor trojans. So, I cannot remove the filter, it's too dangerous. Kind regards, Guenter
no, ( not erm grm.... ) problem.

Björn smiling smiley no retingsinkaly smiling smiley.
Konnichiwa Jimbo san
// who cares ...
would be nice to talk about the brand new 14 RAD thingy.

Seriously : Any chance to create a bullet proof RAD pattern ( community based) ?

Björn
Hi Björn,

I would like to see a RAD pattern community based project. I previously requested that PCSoft provide the source for their Simple RAD as a starting point but they said not at this time. It was taken as a suggestion.

I suggest you start a new topic.

Jeff
HI Jeff,
hm, what I could do atm is to offer and share a work in progress WX14 RAD framework which is avail. via remote SCM.
What do you think ?
For me this collaboration would be (almost) a win-win thingy, ( guess for all of us) but I do not want to make a Poll or such....

Björn
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: