115 |
|
|
116 |
|
{ TFBStatus } |
117 |
|
|
118 |
< |
TFBStatus = class(TFBInterfacedObject) |
118 |
> |
TFBStatus = class(TFBInterfacedObject, IStatus) |
119 |
|
private |
120 |
|
FIBDataBaseErrorMessages: TIBDataBaseErrorMessages; |
121 |
|
FPrefix: AnsiString; |
122 |
+ |
function SQLCodeSupported: boolean; |
123 |
|
protected |
124 |
|
FOwner: TFBClientAPI; |
125 |
|
function GetIBMessage: Ansistring; virtual; abstract; |
127 |
|
public |
128 |
|
constructor Create(aOwner: TFBClientAPI; prefix: AnsiString=''); |
129 |
|
function StatusVector: PStatusVector; virtual; abstract; |
130 |
+ |
procedure Assign(src: TFBStatus); virtual; |
131 |
+ |
function Clone: IStatus; virtual; abstract; |
132 |
|
|
133 |
|
{IStatus} |
134 |
|
function GetIBErrorCode: TStatusCode; |
615 |
|
|
616 |
|
{ TFBStatus } |
617 |
|
|
618 |
+ |
function TFBStatus.SQLCodeSupported: boolean; |
619 |
+ |
begin |
620 |
+ |
Result:= (FOwner <> nil) and assigned(FOwner.isc_sqlcode) and assigned(FOwner.isc_sql_interprete); |
621 |
+ |
end; |
622 |
+ |
|
623 |
|
function TFBStatus.GetSQLMessage: Ansistring; |
624 |
|
var local_buffer: array[0..IBHugeLocalBufferLength - 1] of AnsiChar; |
625 |
|
begin |
636 |
|
inherited Create; |
637 |
|
FOwner := aOwner; |
638 |
|
FPrefix := prefix; |
639 |
< |
FIBDataBaseErrorMessages := [ShowSQLCode, ShowSQLMessage, ShowIBMessage]; |
639 |
> |
FIBDataBaseErrorMessages := [ShowIBMessage]; |
640 |
> |
end; |
641 |
> |
|
642 |
> |
procedure TFBStatus.Assign(src: TFBStatus); |
643 |
> |
begin |
644 |
> |
FOwner := src.FOwner; |
645 |
> |
FPrefix := src.FPrefix; |
646 |
> |
SetIBDataBaseErrorMessages(src.GetIBDataBaseErrorMessages); |
647 |
|
end; |
648 |
|
|
649 |
|
function TFBStatus.GetIBErrorCode: TStatusCode; |
664 |
|
begin |
665 |
|
Result := FPrefix; |
666 |
|
IBDataBaseErrorMessages := FIBDataBaseErrorMessages; |
667 |
< |
if (ShowSQLCode in IBDataBaseErrorMessages) then |
653 |
< |
Result := Result + 'SQLCODE: ' + IntToStr(Getsqlcode); {do not localize} |
654 |
< |
|
655 |
< |
if [ShowSQLMessage, ShowIBMessage]*IBDataBaseErrorMessages <> [] then |
667 |
> |
if SQLCodeSupported then |
668 |
|
begin |
669 |
< |
if (ShowSQLCode in FIBDataBaseErrorMessages) then |
670 |
< |
Result := Result + LineEnding; |
659 |
< |
Result := Result + 'Engine Code: ' + IntToStr(GetIBErrorCode) + ' '; |
660 |
< |
end; |
669 |
> |
if (ShowSQLCode in IBDataBaseErrorMessages) then |
670 |
> |
Result := Result + 'SQLCODE: ' + IntToStr(Getsqlcode); {do not localize} |
671 |
|
|
672 |
< |
if (ShowSQLMessage in IBDataBaseErrorMessages) then |
673 |
< |
Result := Result + GetSQLMessage; |
672 |
> |
if (ShowSQLMessage in IBDataBaseErrorMessages) then |
673 |
> |
begin |
674 |
> |
if ShowSQLCode in IBDataBaseErrorMessages then |
675 |
> |
Result := Result + LineEnding; |
676 |
> |
Result := Result + GetSQLMessage; |
677 |
> |
end; |
678 |
> |
end; |
679 |
|
|
680 |
|
if (ShowIBMessage in IBDataBaseErrorMessages) then |
681 |
|
begin |
682 |
< |
if ShowSQLMessage in IBDataBaseErrorMessages then |
682 |
> |
if Result <> FPrefix then |
683 |
|
Result := Result + LineEnding; |
684 |
< |
Result := Result + GetIBMessage; |
684 |
> |
Result := Result + 'Engine Code: ' + IntToStr(GetIBErrorCode) + LineEnding + GetIBMessage; |
685 |
|
end; |
686 |
|
if (Result <> '') and (Result[Length(Result)] = '.') then |
687 |
|
Delete(Result, Length(Result), 1); |