Subject | Re: [IBO] TIB_ Connection - OnError Event - Validation Error |
---|---|
Author | Helen Borrie |
Post date | 2004-10-19T12:28:41Z |
At 12:42 PM 19/10/2004 +0100, you wrote:
Sender: TObject;
const ERRCODE: longint;
ErrorMessage,
ErrorCodes: TStringList;
const SQLCODE: longint;
SQLMessage,
SQL: TStringList;
var RaiseException: boolean
The stringlist ErrorMessage contains each error message string that
corresponds to the (isc/gds) errorcode in the ErrorCodes list. The last
error (the one passed in ERRCODE) is the first one in the stringlist.
For ErrorCode[0] '335544347' you get the ErrorMessage[0] 'Validation error
for column %s, value "%s".
For example, using the DSQL tab in IB_SQL:
create domain char3 as
char(3) check (value=upper(value));
commit; (hit the Commit button)
<next>
create table blah(
id integer,
data char3);
commit;
<next>
insert into blah
values(99, 'abc');
ISC ERROR CODE:335544347 (This is ERRCODE)
ISC ERROR MESSAGE:
validation error for column DATA1, value "abc"
(This is ErrorMessages[0])
Although it's not great programming practice for an error handler to parse
error strings in order to decide what to do, it's probably justified
here. Walk the string to find the first whole word after "column ", if you
really must know the column name.
Helen
>Hi,The OnError event provides these arguments:
>
>I am using OnError Event of TIB_Connection to capture and translate any
>error messages and I need known the name of Column on Validation Error
>'335544347 isc_not_valid'.
Sender: TObject;
const ERRCODE: longint;
ErrorMessage,
ErrorCodes: TStringList;
const SQLCODE: longint;
SQLMessage,
SQL: TStringList;
var RaiseException: boolean
The stringlist ErrorMessage contains each error message string that
corresponds to the (isc/gds) errorcode in the ErrorCodes list. The last
error (the one passed in ERRCODE) is the first one in the stringlist.
For ErrorCode[0] '335544347' you get the ErrorMessage[0] 'Validation error
for column %s, value "%s".
For example, using the DSQL tab in IB_SQL:
create domain char3 as
char(3) check (value=upper(value));
commit; (hit the Commit button)
<next>
create table blah(
id integer,
data char3);
commit;
<next>
insert into blah
values(99, 'abc');
ISC ERROR CODE:335544347 (This is ERRCODE)
ISC ERROR MESSAGE:
validation error for column DATA1, value "abc"
(This is ErrorMessages[0])
Although it's not great programming practice for an error handler to parse
error strings in order to decide what to do, it's probably justified
here. Walk the string to find the first whole word after "column ", if you
really must know the column name.
Helen