Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread TEDBQuery error trapping
Sat, Mar 12 2016 9:17 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

I've decided to move as much into sql as possible for one of the subsystems of an application and I want to trap INSERT and UPDATE queries for inappropriate data (eg strings to long) and locking problems.

I started by trying to stuff 80 bytes into a VARCHAR(5) field using INSERT. An error message is generated but TEDBQuery's events (well the three I tried anyway) aren't triggered.

I'm hoping there's a way to trap problems when using a query and I'm just to thick to see it. Help anyone?

Roy Lambert
Mon, Mar 14 2016 8:16 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Roy,

<< I've decided to move as much into sql as possible for one of the subsystems of an application and I want to trap INSERT and UPDATE queries for inappropriate data (eg strings to long) and locking problems.

I started by trying to stuff 80 bytes into a VARCHAR(5) field using INSERT. An error message is generated but TEDBQuery's events (well the three I tried anyway) aren't triggered.

I'm hoping there's a way to trap problems when using a query and I'm just to thick to see it. Help anyone? >>

SQL execution errors are simply raised as exceptions, so you would just use normal exception handling techniques to deal with them.  Either that, or use a database procedure and trap/handle the exception there.

Tim Young
Elevate Software
www.elevatesoft.com
Mon, Mar 14 2016 10:01 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Tim


>SQL execution errors are simply raised as exceptions, so you would just use normal exception handling techniques to deal with them. Either that, or use a database procedure and trap/handle the exception there.

I was hoping to avoid another layer of try..except. I think I'll override ExecSQL in my subclassed query and add it in there.

Roy
Image