EPgError

EPgError

Postby p.boutin » Mon 09 Aug 2010 14:33

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
p.boutin
 
Posts: 6
Joined: Mon 09 Aug 2010 14:29

Postby AlexP » Tue 10 Aug 2010 12:17

Hello.

To use EPgError Exception it's necessary to add the PgError unit to uses section.
AlexP
Devart Team
 
Posts: 5528
Joined: Tue 10 Aug 2010 11:35

Postby p.boutin » Tue 10 Aug 2010 15:37

Thank you alex

but unfortunatly I do not have the pgError.pas or pgError.dcu file.
Where is this located ?
p.boutin
 
Posts: 6
Joined: Mon 09 Aug 2010 14:29

Postby AlexP » Wed 11 Aug 2010 08:35

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
AlexP
Devart Team
 
Posts: 5528
Joined: Tue 10 Aug 2010 11:35

Postby p.boutin » Wed 11 Aug 2010 09:29

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 ?
p.boutin
 
Posts: 6
Joined: Mon 09 Aug 2010 14:29

Postby AlexP » Wed 11 Aug 2010 14:40

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
AlexP
Devart Team
 
Posts: 5528
Joined: Tue 10 Aug 2010 11:35

Postby p.boutin » Thu 12 Aug 2010 07:46

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 ?
p.boutin
 
Posts: 6
Joined: Mon 09 Aug 2010 14:29

Postby AlexP » Thu 12 Aug 2010 09:34

Hello,

You are right, the DBXCommon unit is available starting from Delphi 2007.
In earlier Delphi versions you can use EDatabaseError.
AlexP
Devart Team
 
Posts: 5528
Joined: Tue 10 Aug 2010 11:35

Postby p.boutin » Thu 12 Aug 2010 12:25

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..
p.boutin
 
Posts: 6
Joined: Mon 09 Aug 2010 14:29

Postby AlexP » Fri 13 Aug 2010 08:26

Hello,

You can't get ErrorCode, because dbExpress work through standard Delphi database classes that don't support the ErrorCode property.
AlexP
Devart Team
 
Posts: 5528
Joined: Tue 10 Aug 2010 11:35

Postby p.boutin » Mon 16 Aug 2010 12:13

At list I know that I can't retreive it.

Thank you for your help Alex
p.boutin
 
Posts: 6
Joined: Mon 09 Aug 2010 14:29


Return to dbExpress driver for PostgreSQL