|
@@ -80,11 +80,13 @@ type
|
|
{ ESQLDatabaseError}
|
|
{ ESQLDatabaseError}
|
|
|
|
|
|
ESQLDatabaseError = class(EDatabaseError)
|
|
ESQLDatabaseError = class(EDatabaseError)
|
|
|
|
+ Private
|
|
|
|
+ Function GetNamePrefix (comp : TComponent; Fmt: String) :String;
|
|
public
|
|
public
|
|
- ErrorCode: integer;
|
|
|
|
SQLState : string;
|
|
SQLState : string;
|
|
constructor CreateFmt(const Fmt: string; const Args: array of const;
|
|
constructor CreateFmt(const Fmt: string; const Args: array of const;
|
|
Comp : TComponent; AErrorCode: integer; ASQLState: string); overload;
|
|
Comp : TComponent; AErrorCode: integer; ASQLState: string); overload;
|
|
|
|
+ constructor Create(AMessage: string; Comp : TComponent; AErrorCode: integer; ASQLState: string); overload;
|
|
end;
|
|
end;
|
|
|
|
|
|
{ TSQLDBFieldDef }
|
|
{ TSQLDBFieldDef }
|
|
@@ -741,20 +743,36 @@ end;
|
|
|
|
|
|
{ ESQLDatabaseError }
|
|
{ ESQLDatabaseError }
|
|
|
|
|
|
-constructor ESQLDatabaseError.CreateFmt(const Fmt: string; const Args: array of const;
|
|
|
|
- Comp: TComponent; AErrorCode: integer; ASQLState: string);
|
|
|
|
-const CompNameFmt='%s : %s';
|
|
|
|
-var Msg: string;
|
|
|
|
|
|
+Function ESQLDatabaseError.GetNamePrefix(comp: TComponent; Fmt: String): String;
|
|
|
|
+
|
|
|
|
+const
|
|
|
|
+ CompNameFmt='%s : %s';
|
|
|
|
+
|
|
begin
|
|
begin
|
|
if not assigned(Comp) then
|
|
if not assigned(Comp) then
|
|
- Msg := Fmt
|
|
|
|
|
|
+ Result := Fmt
|
|
else if Comp.Name = '' then
|
|
else if Comp.Name = '' then
|
|
- Msg := Format(CompNameFmt, [Comp.ClassName,Fmt])
|
|
|
|
|
|
+ Result := Format(CompNameFmt, [Comp.ClassName,Fmt])
|
|
else
|
|
else
|
|
- Msg := Format(CompNameFmt, [Comp.Name,Fmt]);
|
|
|
|
|
|
+ Result := Format(CompNameFmt, [Comp.Name,Fmt]);
|
|
|
|
+end;
|
|
|
|
|
|
|
|
+constructor ESQLDatabaseError.CreateFmt(const Fmt: string; const Args: array of const;
|
|
|
|
+ Comp: TComponent; AErrorCode: integer; ASQLState: string);
|
|
|
|
+var Msg: string;
|
|
|
|
+begin
|
|
|
|
+ Msg:=GetNamePrefix(Comp,Fmt);
|
|
inherited CreateFmt(Msg, Args);
|
|
inherited CreateFmt(Msg, Args);
|
|
- ErrorCode := AErrorCode;
|
|
|
|
|
|
+ FErrorCode := AErrorCode;
|
|
|
|
+ SQLState := ASQLState;
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+constructor ESQLDatabaseError.Create(AMessage: string; Comp: TComponent;
|
|
|
|
+ AErrorCode: integer; ASQLState: string);
|
|
|
|
+begin
|
|
|
|
+ AMessage:=GetNamePrefix(Comp,AMessage);
|
|
|
|
+ inherited Create(AMessage);
|
|
|
|
+ FErrorCode := AErrorCode;
|
|
SQLState := ASQLState;
|
|
SQLState := ASQLState;
|
|
end;
|
|
end;
|
|
|
|
|