Page 1 of 1

EPgError

Posted: Mon 09 Aug 2010 14:33
by p.boutin
Hi there,

I would like to catch EPgError but I can't find which unit I have to add into the uses.

I bought a licence wilthout the source code. Is this possible ?
Otherwise how can I treat the EPgError ?

Thank by advance, Paul

ps: I'm programing with delphi 6

Posted: Tue 10 Aug 2010 12:17
by AlexP
Hello.

To use EPgError Exception it's necessary to add the PgError unit to uses section.

Posted: Tue 10 Aug 2010 15:37
by p.boutin
Thank you alex

but unfortunatly I do not have the pgError.pas or pgError.dcu file.
Where is this located ?

Posted: Wed 11 Aug 2010 08:35
by AlexP
Hello.

The default path to PgError.dcu is (your system drive):\Program Files\Devart\PgDac for Delphi 6\Lib, if you install PgDac in another dir, search PgError.dcu in (your instal pgDac directory)/lib

Please check if path to the PgDAC library is available in
delphi->tools->Environment Options->Library->Library Path
....;:\Program Files\Devart\PgDac for Delphi 6\Lib;:\Program Files\Devart\PgDac for Delphi 6\Bin

if this path doesn't exist it is necessary to reinstall PgDAC or add this path manually

Posted: Wed 11 Aug 2010 09:29
by p.boutin
Thank again alex for your prompt reply

We bougth "dbExpress Driver for PostgreSQL" not the "Delphi data access components".

In delphi->tools->Environment Options->Library->Library Path,
I added "C:\Program Files\DBxPgSQL\Source"

It contains

CRDbxDesign.pas
CRSQLConnection.pas
DBXDevartPostgreSQL.pas
DriverOptions.pas

but I can't find the PgError.dcu file into my Devart\DbxPgSQL directory.

So I installed the pgDAC trial version just to be able to put pgError in my uses. This worked.

Code: Select all

  
try
   SQLConnectionWithWrongSettings.connected := True
except
    on E: EPgError do
       ShowMessage('It is EPgError: ' + E.ErrorCode + ' - ' + E.Message);
    on E: EDAError do
       ShowMessage('It is EDAError: ' + IntToStr(E.ErrorCode) + ' - ' + E.Message);
    on E: EDatabaseError do
       ShowMessage('It is EDatabaseError: ' + E.Message);
    on E: Exception do
       ShowMessage(E.Message);
end;
With this code when I run the program through Delphi, the IDE raises 3 exceptions
1- EpgError : Database does not exists
2- EpgError : Database does not exists
3- EDatabaseError : Database does not exists

then the debugger go into the except section and show the message

Code: Select all

'It is EDatabaseError: ' + E.Message'
How can I catch the EPgError in order tobe able to retrieve the ErrorCode ?

Posted: Wed 11 Aug 2010 14:40
by AlexP
Hello,

We have performed a detailed investigation of the problem. To catch the dbExpress exception you can use
the TDBXError class (it is necessary to add the DBXCommon unit in uses), because in dbExpreess EPgError is replaced by TDBXError

Posted: Thu 12 Aug 2010 07:46
by p.boutin
Hi Alex,

Which release of Delphi were you using while investigating the problem ?

I use delphi 6 which include an old release of DBXpress.
I do not have the DBXcommon the only units I have are

DBXpress,
DBXpressWeb

Update the DBXpress components does not seems a safe way for us. (I'm not even sure that this is possible, these components are installed with delphi..)

What do you suggest ?

Posted: Thu 12 Aug 2010 09:34
by AlexP
Hello,

You are right, the DBXCommon unit is available starting from Delphi 2007.
In earlier Delphi versions you can use EDatabaseError.

Posted: Thu 12 Aug 2010 12:25
by p.boutin
OK... That's what I'm currently doing but there is no error code in this type of exception so I'm not able to manage errors properly because I can't identify errors with a single message Exception property..

Posted: Fri 13 Aug 2010 08:26
by AlexP
Hello,

You can't get ErrorCode, because dbExpress work through standard Delphi database classes that don't support the ErrorCode property.

Posted: Mon 16 Aug 2010 12:13
by p.boutin
At list I know that I can't retreive it.

Thank you for your help Alex