Subject Re: [ib-support] ISC Error codes (REPOST)
Author Theo Bebekis
Ryan

I don't have an answer to the question but if you're using
Pascal, here is a method from an earlier version of my
TFBStatus class which analyzes the vector and constructs
a text message

procedure TFBStatus.Analyze(var Vector: TStatusVector; bResetVector: Boolean);
var
pMsg : array[0..ERR_BUF_MAX_LEN - 1] of char;
PStatusVector : PISC_STATUS;
begin
FIBCode := 0;
FSQLCode := 0;
FIBText := '';
FSQLText := '';
FText := '';

{ Quoted from ApiGuide.pdf :
For InterBase errors,
the first element of the status vector is set to 1,
and the second element is set to an InterBase error code.}
FHasErrors := (Vector[0] = 1) and (Vector[1] > 0);

if not FHasErrors then
begin
if bResetVector then
FillChar(Vector, Length(Vector) * SizeOf(ISC_STATUS), 0);
Exit; // ==>
end;

{ SQL error related }
FSQLCode := GDS.isc_sqlcode(@Vector);
FSQLText := 'SQLCODE : ' + IntToStr(FSQLCode);

if (FSQLCode <> -999) then
begin
FillChar(pMsg, SizeOf(pMsg), 0);
GDS.isc_sql_interprete(FSQLCode, pMsg, SizeOf(pMsg));
FSQLText := FSQLText + CRLF + 'SQL Message : ' + CRLF + String(pMsg);
end;

{ Engine error related }
FIBCode := Vector[1];
FIBText := FIBText + CRLF + 'Engine Error Code : ' + IntToStr(FIBCode);
FIBText := FIBText + CRLF + 'Engine Message : ' + CRLF;
FillChar(pMsg, SizeOf(pMsg), 0);
PStatusVector := @Vector;
{ isc_interprete advances the pointer according to docs }
while (GDS.isc_interprete(pMsg, @PStatusVector) > 0) do
begin
if (FIBText <> '') and (FIBText[Length(FIBText)] <> LF) then
FIBText := FIBText + CRLF;
FIBText := FIBText + string(pMsg);
FillChar(pMsg, SizeOf(pMsg), 0);
end;

if (FIBText <> '') and (FIBText[Length(FIBText)] = '.') then
Delete(FIBText, Length(FIBText), 1);

FText := FSQLText + CRLF + '------------------' + FIBText;

if bResetVector then
FillChar(Vector, Length(Vector) * SizeOf(ISC_STATUS), 0);
end;

Regards
Theo

-----------------------------------
Theo Bebekis
Thessaloniki, Greece
bebekis@...
teo@...
-----------------------------------
----- Original Message -----
From: "Ryan Nilsson-Harding" <nilsson@...>
To: <ib-support@yahoogroups.com>
Sent: Tuesday, September 17, 2002 2:22 AM
Subject: [ib-support] ISC Error codes (REPOST)


> Hi there,
> I posted this question about a week ago, with no reply.
> Just trying again incase it was missed.
>
> I would like some clarification on the error codes if possible, as
> the same error code is used to indicate:
> 1- that the file does not exist; and
> 2- that the file DOES exist (when trying to create it again)
> as these are both I/O errors, and the I/O error code is 335544344.
>
> I need to separate these two errors, so I have captured all error
> codes and messages.
> File does not exist err codes:
>
> 335544344
> 2
> 13130828 <--*
> 2
>
> File already exists err codes:
> 335544344
> 2
> 13129584 <--*
>
> I am assuming that the indicated codes (<--*) above are what
> differentiates
> these two errors. Am I correct?
> Can I merely look for the code on the third line of the err. codes
> to determine which kind of I/O error?
> Also, what does the '2' refer to?
> And why is there an additional '2' in the 'not exist' err. codes?
> Where can I find more info on these '3rd line' codes?
>
> I know the error Messages clearly state these diffs, but I think
> it's more efficient if I can determine this info from the codes.
>
> Thanks for any information, and sorry for the many questions.
> Rgds,
> -Ryan
>