Subject | Re: [IBO] Handling database errors/exceptions |
---|---|
Author | guido.klapperich@t-online.de |
Post date | 2001-11-09T12:16:54Z |
Ich Dir keine Mail schicken, Andreas, Es kommt immer:
apohl@...
unrouteable mail domain "ibp-consult.com"
Guido
Andreas Pohl wrote:
apohl@...
unrouteable mail domain "ibp-consult.com"
Guido
Andreas Pohl wrote:
> Mirco,
>
> I handle all database error in TIB_connection.OnError. There I translate messages to be "user readable". I display my own MsgBox, call raiseexception:=False; and Abort;
>
> procedure TShared_DM.IB_Connection1Error(Sender: TObject;
> const ERRCODE: Integer; ErrorMessage, ErrorCodes: TStringList;
> const SQLCODE: Integer; SQLMessage, SQL: TStringList;
> var RaiseException: Boolean);
> var t,tt:string;
> begin
> t:='';
> case Errcode of
> 335544741:t:='Verbindung zur Datenbank verloren!'+#10#10+'Die Anwendung wird beendet.';
> 335544755:t:='Wechsel des Passwortes misslungen!';
> 335544352:t:='Keine Zugriffsberechtigung eingerichtet.'+#10#10+'Die Anwendung wird beendet.';
> 335544336:begin
> t:='Datensatz ist in Bearbeitung!'+#10#10+sqlmessage.text+#10#10+sql.text;
> end;
> 335544472:begin IB_Connection1.LoginPrompt:=True;abort;end;
> 335544347:begin
> tt:=uppercase(ExtractDelimited(2, errormessage[3], ['"']));
> t:=uppercase(ExtractDelimited(5, errormessage[3], [' ',',']));
> t:=Format('Ungültiger Wert (%s) für das Feld ***%s*** !',[tt,t]);
> end;
>
> ........
>
> 335544466:begin
> t:=uppercase(ExtractDelimited(2, errormessage[3], ['"']));
> if t='FK_KUNDE1' then t:='Ungültiger Schlüssel für Vertreter 1!'
> else if t='FK_KUNDE2' then t:='Ungültiger Schlüssel für Vertreter 2!'
> else if t='FK_KUNDE3' then t:='Ungültiger Schlüssel für Versandart!'
> else if t='FK_SONDERPREISE1' then t:='Ungültige Kundennummer!'
> else if t='FK_SONDERPREISE2' then t:='Ungültige Artikelnummer!'
> else if t='FK_REZEPTE1' then t:='Ungültige Artikelnummer!'
> else t:='Verletzung der referentiellen Integrität ('+t+')!';
> end;
> end;
> if (t>'') then begin MessageDLG(t,mtError,[mbOk],0);
> RaiseException:=False;
> if errcode<>335544336 then Abort;
> end;
>
> Mit freundlichem Gruss & Best Regards
>
> Andreas Pohl
> apohl@...
> www.ibp-consult.com
> ----- Original Message -----
> From: <mirco@...>
> To: <IBObjects@yahoogroups.com>
> Sent: Friday, November 09, 2001 10:09 AM
> Subject: [IBO] Handling database errors/exceptions
>
> > What I would like to do is to have a standard database error handler
> > that catches all the things that can go wrong during inserts,
> > updates, deletes, etc and displays a custom error message.
> >
> > Note, that I cannot use try&catch to catch the exception, as I don't
> > do the insert or update in code myself... IB does it, e.g. when I
> > edit a grid.
> >
> > I would appreciate any help on this.
> >
> >
>
>
> ___________________________________________________________________________
> IB Objects - direct, complete, custom connectivity to Firebird or InterBase
> without the need for BDE, ODBC or any other layer.
> ___________________________________________________________________________
> http://www.ibobjects.com - your IBO community resource for Tech Info papers,
> keyword-searchable FAQ, community code contributions and more !
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/