From sandhyar@amiindia.co.in Wed Aug 17 11:07:42 2005 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D813252848 for ; Wed, 17 Aug 2005 08:07:42 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 48465-05 for ; Wed, 17 Aug 2005 11:07:39 +0000 (GMT) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by svr1.postgresql.org (Postfix) with ESMTP id C1D5C52ABA for ; Wed, 17 Aug 2005 08:07:34 -0300 (ADT) Received: from amiindia.co.in (unknown [203.199.198.234]) by svr4.postgresql.org (Postfix) with ESMTP id 802A65AFD16 for ; Wed, 17 Aug 2005 10:16:19 +0000 (GMT) Received: from venus.amiindia.co.in (localhost.localdomain [127.0.0.1]) by amiindia.co.in (8.12.10/8.12.11) with ESMTP id j7H9n6rh023865; Wed, 17 Aug 2005 15:19:29 +0530 Received: from amiindiahjwbgh (unknown [10.0.0.205])by venus.amiindia.co.in (Postfix) with ESMTPid 34AD34FC067; Wed, 17 Aug 2005 15:18:31 +0530 (IST) Message-ID: <007301c5a315$1cf97b80$cd00000a@amiindiahjwbgh> From: "sandhya" To: "Tom Lane" Cc: "Shashi Gireddy" , "postgre" Subject: error codes in postgresql Date: Wed, 17 Aug 2005 15:49:02 +0530 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0070_01C5A343.30A456E0" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 X-imss-version: 2.5 X-imss-result: Passed X-imss-scores: Clean:85.94160 C:21 M:1 S:5 R:5 X-imss-settings: Baseline:1 C:1 M:1 S:1 R:1 (0.0000 0.0000) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.064 required=5 tests=[AWL=-0.014, FORGED_RCVD_HELO=0.05, HTML_60_70=0.027, HTML_MESSAGE=0.001] X-Spam-Level: X-Archive-Number: 200508/210 X-Sequence-Number: 18529 This is a multi-part message in MIME format. ------=_NextPart_000_0070_01C5A343.30A456E0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi, =20 I want to know ,if there is any way to return error codes/numbers as = a return value from the postgresql functions. For ex: If i am using my connection function say, DbConnect(dname,uname,.........) { //here i use postgres connection function pg_conn *conn; conninfo=3D"dbname=3Dexample(dname) user=3Dpostgres(uname)"; conn=3DPQConnectdb(conninfo) //After connecting i need to create a table..and if the table exists=20 PQerrormessage(conn) will return error message... But what i need is .. Is there any other way of returning error number to my main program. Can you please tell me how to handle these errors in my application. I referred posgresql site..I didn't get any clear idea of it. Any help please...... Thank you... Regards, Sandhya R ------=_NextPart_000_0070_01C5A343.30A456E0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
 
 
Hi,
  
   I want to know ,if there = is any way to=20 return  error codes/numbers as  a return value from the = postgresql=20 functions.
For ex:
 
If i am using my connection function=20 say,
DbConnect(dname,uname,.........)
{
//here i use postgres connection=20 function
pg_conn *conn;
conninfo=3D"dbname=3Dexample(dname)=20 user=3Dpostgres(uname)";
conn=3DPQConnectdb(conninfo)
//After connecting i need to create a = table..and if=20 the table exists
PQerrormessage(conn) will return error=20 message...
But what i need is ..
Is there any other way of returning = error number to=20 my main program.
Can you please tell me how to handle = these errors=20 in my application.
I referred posgresql site..I didn't get = any clear=20 idea of it.
Any help please......
 
Thank you...
Regards,
Sandhya R
 
 
------=_NextPart_000_0070_01C5A343.30A456E0-- From sivakumark@aztec.soft.net Wed Aug 17 12:16:04 2005 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 800A852A8A for ; Wed, 17 Aug 2005 09:16:04 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 71737-02 for ; Wed, 17 Aug 2005 12:16:01 +0000 (GMT) Received: from param.aztec.soft.net (param.aztec.soft.net [164.164.151.8]) by svr1.postgresql.org (Postfix) with ESMTP id 15ADF52AC3 for ; Wed, 17 Aug 2005 09:15:56 -0300 (ADT) Received: from param.aztec.soft.net (localhost.localdomain [127.0.0.1]) by param.aztec.soft.net (8.12.8/8.11.2) with ESMTP id j7HCFK6t032104 for ; Wed, 17 Aug 2005 17:45:21 +0530 Received: from maya.aztec.soft.net (maya.aztec.soft.net [164.164.151.5])by param.aztec.soft.net (8.12.8/) with ESMTP id j7HCFGJM032053; Wed, 17 Aug 2005 17:45:16 +0530 Received: by maya.aztec.soft.net with Internet Mail Service (5.5.2657.72)id ; Wed, 17 Aug 2005 17:49:30 +0530 Message-ID: <584DE893B0E08F4B9748E295029F1E9702C1114A@maya.aztec.soft.net> From: Sivakumar K To: sandhya Cc: Shashi Gireddy , postgre Subject: Re: error codes in postgresql Date: Wed, 17 Aug 2005 17:49:30 +0530 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2657.72) Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C5A325.EB0795EC" X-imss-version: 2.030 X-imss-result: Passed X-imss-scores: Clean:99.90000 C:2 M:3 S:5 R:5 X-imss-settings: Baseline:1 C:1 M:1 S:1 R:1 (0.0000 0.0000) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.375 required=5 tests=[AWL=0.000, DNS_FROM_RFC_ABUSE=0.374, HTML_MESSAGE=0.001] X-Spam-Level: X-Archive-Number: 200508/212 X-Sequence-Number: 18531 This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01C5A325.EB0795EC Content-Type: text/plain Hi sandhya, You can use PQresultStatus API to get the result status of the command execution And PQresStatus to convert the enumerated type returned by PQresultStatus to a string constant. For more information you can check the libpq API documentation http://www.postgresql.org/docs/8.0/static/libpq-exec.html Is this what you want? Regards, Siva Kumar.K -----Original Message----- From: pgsql-admin-owner@postgresql.org [mailto:pgsql-admin-owner@postgresql.org] On Behalf Of sandhya Sent: Wednesday, August 17, 2005 3:49 PM To: Tom Lane Cc: Shashi Gireddy; postgre Subject: [ADMIN] error codes in postgresql Hi, I want to know ,if there is any way to return error codes/numbers as a return value from the postgresql functions. For ex: If i am using my connection function say, DbConnect(dname,uname,.........) { //here i use postgres connection function pg_conn *conn; conninfo="dbname=example(dname) user=postgres(uname)"; conn=PQConnectdb(conninfo) //After connecting i need to create a table..and if the table exists PQerrormessage(conn) will return error message... But what i need is .. Is there any other way of returning error number to my main program. Can you please tell me how to handle these errors in my application. I referred posgresql site..I didn't get any clear idea of it. Any help please...... Thank you... Regards, Sandhya R ------_=_NextPart_001_01C5A325.EB0795EC Content-Type: text/html Content-Transfer-Encoding: quoted-printable

Hi sandhya,

      You can use = PQresultStatus API to get the result status of the command = execution

      And = PQresStatus to convert the enumerated type returned by PQresultStatus to a string = constant.

      For more = information you can check the libpq API documentation

      http:= //www.postgresql.org/docs/8.0/static/libpq-exec.html

 

      Is this what = you want?

 

 

Regards,

Siva = Kumar.K

-----Original = Message-----
From: pgsql-admin-owner@postgresql.org = [mailto:pgsql-admin-owner@postgresql.org] On Behalf Of sandhya
Sent: =
Wednesday, August 17, 2005 3:49 = PM
To:
Tom = Lane
Cc: Shashi Gireddy; = postgre
Subject: [ADMIN] error = codes in postgresql

 

 

 

Hi,

   =

   I want to = know ,if there is any way to return  error codes/numbers as  a return = value from the postgresql functions.

For ex:

 

If i am using my = connection function say,

DbConnect(dname,uname,.....= ....)

{

//here i use postgres = connection function

pg_conn = *conn;

conninfo=3D"dbname=3De= xample(dname) user=3Dpostgres(uname)";

conn=3DPQConnectdb(conninfo= )

//After connecting i need = to create a table..and if the table exists

PQerrormessage(conn) will = return error message...

But what i need is = ..

Is there any other way of = returning error number to my main program.

Can you please tell me how = to handle these errors in my application.

I referred posgresql = site..I didn't get any clear idea of it.

Any help = please......

 

Thank = you...

Regards,

Sandhya = R

 

 

------_=_NextPart_001_01C5A325.EB0795EC-- From sandhyar@amiindia.co.in Wed Aug 17 12:39:52 2005 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id AE3C652938 for ; Wed, 17 Aug 2005 09:39:52 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 75593-04 for ; Wed, 17 Aug 2005 12:39:49 +0000 (GMT) Received: from amiindia.co.in (unknown [203.199.198.234]) by svr1.postgresql.org (Postfix) with ESMTP id DC7D9528DB for ; Wed, 17 Aug 2005 09:39:32 -0300 (ADT) Received: from venus.amiindia.co.in (localhost.localdomain [127.0.0.1]) by amiindia.co.in (8.12.10/8.12.11) with ESMTP id j7HCFirh017556; Wed, 17 Aug 2005 17:45:49 +0530 Received: from amiindiahjwbgh (unknown [10.0.0.205])by venus.amiindia.co.in (Postfix) with ESMTPid AA6D04FC060; Wed, 17 Aug 2005 17:45:33 +0530 (IST) Message-ID: <010701c5a329$a89e7230$cd00000a@amiindiahjwbgh> From: "sandhya" To: "Sivakumar K" Cc: "postgre" References: <584DE893B0E08F4B9748E295029F1E9702C1114A@maya.aztec.soft.net> Subject: Re: error codes in postgresql Date: Wed, 17 Aug 2005 18:16:01 +0530 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_00FB_01C5A357.B9226B10" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 X-imss-version: 2.5 X-imss-result: Passed X-imss-scores: Clean:99.90000 C:21 M:3 S:5 R:5 X-imss-settings: Baseline:1 C:1 M:1 S:1 R:1 (0.0000 0.0000) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.051 required=5 tests=[AWL=-0.000, FORGED_RCVD_HELO=0.05, HTML_MESSAGE=0.001] X-Spam-Level: X-Archive-Number: 200508/213 X-Sequence-Number: 18532 This is a multi-part message in MIME format. ------=_NextPart_000_00FB_01C5A357.B9226B10 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Thank you Sivakumar. ExecStatusType PQresultStatus(const PGresult *res); Will it return code or message.If i want to use this what should be the = return value of my function? Onemore doubt.. char *PQresultErrorField(const PGresult *res, int fieldcode); What is the use of this?What is the difference between the previous one = and this? PG_DIAG_SQLSTATE--If i use this as my fieldcode will it take care of all = my error values. Sorry for my basic questions.As i am very new to this i don't know how = to handle errors in=20 this. Normally we will be defining some errormessages according to the error = codes return by the PQErrorMessage function. When i am using this even i declare my function as void..it is returning = the errormessage. So..what iam planning is if i have some error codes returning from any = of my postgresql function i can define myown message for that and i can = send it as a return value to the main right! Please tell me how can i handle this? Thanks&Regards, Sandhya ----- Original Message -----=20 From: Sivakumar K=20 To: sandhya=20 Cc: Shashi Gireddy ; postgre=20 Sent: Wednesday, August 17, 2005 5:49 PM Subject: RE: [ADMIN] error codes in postgresql Hi sandhya, You can use PQresultStatus API to get the result status of the = command execution And PQresStatus to convert the enumerated type returned by = PQresultStatus to a string constant. For more information you can check the libpq API documentation http://www.postgresql.org/docs/8.0/static/libpq-exec.html Is this what you want? Regards, Siva Kumar.K -----Original Message----- From: pgsql-admin-owner@postgresql.org = [mailto:pgsql-admin-owner@postgresql.org] On Behalf Of sandhya Sent: Wednesday, August 17, 2005 3:49 PM To: Tom Lane Cc: Shashi Gireddy; postgre Subject: [ADMIN] error codes in postgresql Hi, =20 I want to know ,if there is any way to return error codes/numbers = as a return value from the postgresql functions. For ex: If i am using my connection function say, DbConnect(dname,uname,.........) { //here i use postgres connection function pg_conn *conn; conninfo=3D"dbname=3Dexample(dname) user=3Dpostgres(uname)"; conn=3DPQConnectdb(conninfo) //After connecting i need to create a table..and if the table exists=20 PQerrormessage(conn) will return error message... But what i need is .. Is there any other way of returning error number to my main program. Can you please tell me how to handle these errors in my application. I referred posgresql site..I didn't get any clear idea of it. Any help please...... Thank you... Regards, Sandhya R ------=_NextPart_000_00FB_01C5A357.B9226B10 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Thank you Sivakumar.
ExecStatusType PQresultStatus(const PGresult *res);
Will it return code or message.If i want to use this what should be = the=20 return value of my function?
 
Onemore doubt..
char *PQresultErrorField(const PGresult *res, int fieldcode);
What is the use of this?What is the difference between the previous = one and=20 this?
PG_DIAG_SQLSTATE--If i use this as my fieldcode = will it=20 take care of all my error values.
Sorry for my basic questions.As i am very new to = this i=20 don't know how to handle errors in
this.
Normally we will be defining some errormessages = according=20 to the error codes return by the PQErrorMessage function.
When i am using this even i declare my function = as=20 void..it is returning the errormessage.
So..what iam planning is if i have some error = codes=20 returning from any of my postgresql function i can define myown message = for that=20 and i can send it as a return value to the main right!
Please tell me how can i handle this?
 
Thanks&Regards,
Sandhya
 
 
 
 
 
----- Original Message -----
To: sandhya
Cc: Shashi Gireddy ; postgre
Sent: Wednesday, August 17, = 2005 5:49=20 PM
Subject: RE: [ADMIN] error = codes in=20 postgresql

Hi sandhya,

      You can use=20 PQresultStatus API to get the result status of the command=20 execution

      And = PQresStatus to=20 convert the enumerated type returned by PQresultStatus to a string=20 constant.

      For more = information=20 you can check the libpq API documentation

      http:/= /www.postgresql.org/docs/8.0/static/libpq-exec.html

 

      Is this what = you=20 want?

 

 

Regards,

Siva=20 Kumar.K

-----Original=20 Message-----
From: = pgsql-admin-owner@postgr= esql.org=20 [mailto:pgsql-admin-owner@postgresql.org] On Behalf Of = sandhya
Sent:
Wednesday, August=20 17, 2005 3:49=20 PM
To:
Tom=20 Lane
Cc: Shashi Gireddy; = postgre
Subject: [ADMIN] error codes in = postgresql

 

 

 

Hi,

  =20

   I want to = know ,if=20 there is any way to return  error codes/numbers as  a return = value=20 from the postgresql functions.

For = ex:

 

If i am using my = connection=20 function say,

DbConnect(dname,uname,.........)

{

//here i use postgres = connection=20 function

pg_conn=20 *conn;

conninfo=3D"dbname=3Dexample(dname)=20 user=3Dpostgres(uname)";

conn=3DPQConnectdb(conninfo)

//After connecting i = need to=20 create a table..and if the table exists

PQerrormessage(conn) = will return=20 error message...

But what i need is=20 ..

Is there any other way = of=20 returning error number to my main program.

Can you please tell me = how to=20 handle these errors in my application.

I referred posgresql = site..I=20 didn't get any clear idea of it.

Any help=20 please......

 

Thank=20 you...

Regards,

Sandhya = R

 

 

------=_NextPart_000_00FB_01C5A357.B9226B10-- From sivakumark@aztec.soft.net Wed Aug 17 13:59:49 2005 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9121152917 for ; Wed, 17 Aug 2005 10:59:49 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 97698-06 for ; Wed, 17 Aug 2005 13:59:46 +0000 (GMT) Received: from param.aztec.soft.net (param.aztec.soft.net [164.164.151.8]) by svr1.postgresql.org (Postfix) with ESMTP id 771FF52940 for ; Wed, 17 Aug 2005 10:59:43 -0300 (ADT) Received: from param.aztec.soft.net (localhost.localdomain [127.0.0.1]) by param.aztec.soft.net (8.12.8/8.11.2) with ESMTP id j7HDx86r026372 for ; Wed, 17 Aug 2005 19:29:09 +0530 Received: from maya.aztec.soft.net (maya.aztec.soft.net [164.164.151.5])by param.aztec.soft.net (8.12.8/) with ESMTP id j7HDx7JM026331; Wed, 17 Aug 2005 19:29:08 +0530 Received: by maya.aztec.soft.net with Internet Mail Service (5.5.2657.72)id ; Wed, 17 Aug 2005 19:33:22 +0530 Message-ID: <584DE893B0E08F4B9748E295029F1E9702C11415@maya.aztec.soft.net> From: Sivakumar K To: sandhya Cc: postgre Subject: Re: error codes in postgresql Date: Wed, 17 Aug 2005 19:33:21 +0530 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2657.72) Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C5A334.6D1DB9FE" X-imss-version: 2.030 X-imss-result: Passed X-imss-scores: Clean:99.90000 C:2 M:3 S:5 R:5 X-imss-settings: Baseline:1 C:1 M:1 S:1 R:1 (0.0000 0.0000) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.344 required=5 tests=[AWL=-0.031, DNS_FROM_RFC_ABUSE=0.374, HTML_MESSAGE=0.001] X-Spam-Level: X-Archive-Number: 200508/216 X-Sequence-Number: 18535 This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01C5A334.6D1DB9FE Content-Type: text/plain -----Original Message----- From: sandhya [mailto:sandhyar@amiindia.co.in] Sent: Wednesday, August 17, 2005 6:16 PM To: Sivakumar K Cc: postgre; sandhya Subject: Re: [ADMIN] error codes in postgresql Thank you Sivakumar. ExecStatusType PQresultStatus(const PGresult *res); Will it return code or message.If i want to use this what should be the return value of my function? This will return whether your query was executed successfully or not. Onemore doubt.. char *PQresultErrorField(const PGresult *res, int fieldcode); What is the use of this?What is the difference between the previous one and this? PG_DIAG_SQLSTATE--If i use this as my fieldcode will it take care of all my error values. Sorry for my basic questions.As i am very new to this i don't know how to handle errors in this. This will return more detailed info regarding why the query execution was not successful based on the fieldcode. For example If I execute select * from pg_databasesas (table does not exist) PQresStatus (PQresultStatus (res)) will return PGRES_FATAL_ERROR Whereas PQresultErrorField (res, PG_DIAG_SQLSTATE) will return 42P01 which corresponds to "undefined table". PQresultErrorField (res, PG_ DIAG_MESSAGE_PRIMARY) will return relation "pg_databasesa" does not exist. Note that the above API's will return information regarding result set object only. Normally we will be defining some errormessages according to the error codes return by the PQErrorMessage function. I really wonder if PQErrorMessage returns error codes. AFAIK it returns error messages. When i am using this even i declare my function as void..it is returning the errormessage. So..what iam planning is if i have some error codes returning from any of my postgresql function i can define myown message for that and i can send it as a return value to the main right! Please tell me how can i handle this? Why do you want to define your own error messages when the appropriate error message is returned from PostgreSQL Server? Please feel free to correct me Thanks&Regards, Sandhya ----- Original Message ----- From: Sivakumar K To: sandhya Cc: Shashi Gireddy ; postgre Sent: Wednesday, August 17, 2005 5:49 PM Subject: RE: [ADMIN] error codes in postgresql Hi sandhya, You can use PQresultStatus API to get the result status of the command execution And PQresStatus to convert the enumerated type returned by PQresultStatus to a string constant. For more information you can check the libpq API documentation http://www.postgresql.org/docs/8.0/static/libpq-exec.html Is this what you want? Regards, Siva Kumar.K -----Original Message----- From: pgsql-admin-owner@postgresql.org [mailto:pgsql-admin-owner@postgresql.org] On Behalf Of sandhya Sent: Wednesday, August 17, 2005 3:49 PM To: Tom Lane Cc: Shashi Gireddy; postgre Subject: [ADMIN] error codes in postgresql Hi, I want to know ,if there is any way to return error codes/numbers as a return value from the postgresql functions. For ex: If i am using my connection function say, DbConnect(dname,uname,.........) { //here i use postgres connection function pg_conn *conn; conninfo="dbname=example(dname) user=postgres(uname)"; conn=PQConnectdb(conninfo) //After connecting i need to create a table..and if the table exists PQerrormessage(conn) will return error message... But what i need is .. Is there any other way of returning error number to my main program. Can you please tell me how to handle these errors in my application. I referred posgresql site..I didn't get any clear idea of it. Any help please...... Thank you... Regards, Sandhya R ------_=_NextPart_001_01C5A334.6D1DB9FE Content-Type: text/html Content-Transfer-Encoding: quoted-printable

-----Original = Message-----
From: sandhya [mailto:sandhyar@amiindia.co.in]
Sent: =
Wednesday, August 17, 2005 6:16 = PM
To:
Sivakumar = K
Cc: postgre; sandhya
Subject: Re: [ADMIN] = error codes in postgresql

 

Thank you = Sivakumar.

ExecStatusType PQresultStatus(const PGresult = *res);

Will it return code or message.If i want to = use this what should be the return value of my function?

 

      = ;      This will return whether your query was executed successfully or = not.

 

Onemore doubt..

char *PQresultErrorField(const PGresult = *res, int fieldcode);

What is the use of this?What is the = difference between the previous one and this?

PG_DIAG_SQLSTATE--If i use this as my = fieldcode will it take care of all my error values.

Sorry for my basic questions.As i am very = new to this i don't know how to handle errors in

this.

This will = return more detailed info regarding why the query execution was not successful = based on the fieldcode.

 

      = ;      For example

      = ;      If I execute select * from pg_databasesas (table does not = exist)

 

      = ;      PQresStatus (PQresultStatus (res)) will return = PGRES_FATAL_ERROR

 

      = ;      Whereas

      = ;     

      = ;      PQresultErrorField (res, PG_DIAG_SQLSTATE) will return 42P01 which corresponds to = "undefined table".

      = ;      PQresultErrorField (res, PG_ DIAG_MESSAGE_PRI= MARY) will return       relation "pg_databasesa" does not exist.

 

      = ;      Note that the above API's will return information regarding result set = object only.

 

Normally we will be defining some = errormessages according to the error codes return by the PQErrorMessage = function.

      = ;     

      = ;      I really wonder if PQErrorMessage returns error codes. AFAIK it returns = error messages.

 

When i am using this even i declare my = function as void..it is returning the errormessage.

So..what iam planning is if i have some = error codes returning from any of my postgresql function i can define myown message = for that and i can send it as a return value to the main = right!

Please tell me how can i handle = this?

 

      = ;      Why do you want to define your own error messages when the appropriate = error message is returned from PostgreSQL Server?

 

      = ;      Please feel free to correct me

 

Thanks&Regards,

Sandhya

 

 

 

 

 

----- Original Message = -----

From: Sivakumar K

To:= sandhya

Sent: Wednesday, August 17, 2005 5:49 PM

Subject: RE: [ADMIN] error codes in postgresql

 

Hi = sandhya,

      You can use PQresultStatus API to get the result status of the command execution

      And PQresStatus to convert the enumerated type returned by = PQresultStatus to a string constant.

      For more information you can check the libpq API = documentation

      http:= //www.postgresql.org/docs/8.0/static/libpq-exec.html

 

      Is this what you want?

 

 

Regards,

Siva Kumar.K

-----Original = Message-----
From: pgsql-admin-owner@postg= resql.org [mailto:pgsql-admin-owner@postgresql.org] On Behalf Of sandhya
Sent: =
Wednesday, August 17, 2005 3:49 = PM
To:
Tom = Lane
Cc: Shashi Gireddy; = postgre
Subject: [ADMIN] error = codes in postgresql

 

 

 

Hi,

   =

   I want to = know ,if there is any way to return  error codes/numbers as  a return = value from the postgresql functions.

For ex:

 

If i am using my = connection function say,

DbConnect(dname,uname,.....= ....)

{

//here i use postgres = connection function

pg_conn = *conn;

conninfo=3D"dbname=3De= xample(dname) user=3Dpostgres(uname)";

conn=3DPQConnectdb(conninfo= )

//After connecting i need = to create a table..and if the table exists

PQerrormessage(conn) will = return error message...

But what i need is = ..

Is there any other way of = returning error number to my main program.

Can you please tell me how = to handle these errors in my application.

I referred posgresql = site..I didn't get any clear idea of it.

Any help = please......

 

Thank = you...

Regards,

Sandhya = R

 

 

------_=_NextPart_001_01C5A334.6D1DB9FE-- From sivakumark@pervasive-postgres.com Tue Aug 23 04:25:18 2005 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id BE6C5D77EF for ; Tue, 23 Aug 2005 01:25:18 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 08874-08 for ; Tue, 23 Aug 2005 04:25:12 +0000 (GMT) Received: from ausimss.pervasive.com (ausimss.pervasive.com [66.45.103.246]) by svr1.postgresql.org (Postfix) with ESMTP id 27E01D734E for ; Tue, 23 Aug 2005 01:25:09 -0300 (ADT) Received: from ausbayes2.aus.pervasive.com ([172.16.8.8]) by ausimss.pervasive.com with InterScan Messaging Security Suite; Mon, 22 Aug 2005 23:25:06 -0500 Received: from ausbayes1.aus.pervasive.com ([172.16.8.6]) by ausbayes2.aus.pervasive.com with Microsoft SMTPSVC(5.0.2195.6713); Mon, 22 Aug 2005 23:25:06 -0500 Received: from blrmail2.aus.pervasive.com ([10.3.16.65]) by ausbayes1.aus.pervasive.com with Microsoft SMTPSVC(5.0.2195.6713); Mon, 22 Aug 2005 23:25:05 -0500 Content-class: urn:content-classes:message Subject: Re: error codes in postgresql Date: Tue, 23 Aug 2005 09:54:38 +0530 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C5A79A.A216A9EB" Message-ID: X-MS-Has-Attach: X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 X-MS-TNEF-Correlator: Thread-Topic: [ADMIN] error codes in postgresql Thread-Index: AcWnK17nsOhgP9qWQUq1VYIiTL3nSAAABPxwABvBSzA= From: "Sivakumar K" To: Cc: X-OriginalArrivalTime: 23 Aug 2005 04:25:05.0982 (UTC) FILETIME=[A3803DE0:01C5A79A] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.001 required=5 tests=[AWL=-0.000, HTML_MESSAGE=0.001] X-Spam-Level: X-Archive-Number: 200508/277 X-Sequence-Number: 18596 This is a multi-part message in MIME format. ------_=_NextPart_001_01C5A79A.A216A9EB Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable =20 Hi sandhya, I really wonder if the function name is pg_field_type (res, col_no).=20 The function name which returns the field type of a particular column is PQftype (res, col_no). This returns the field type as oid.The oid of the built-in data types can be found in src/include/catalog/pg_type.h =20 When using libpq API's you need to include only "libpq-fe.h". =20 =20 Is pg_field_type (res, col_no) an abstraction over PQftype (res, col_no) in your case? =20 Regards, Siva Kumar.K =20 =20 =20 -----Original Message----- From: sandhya [mailto:sandhyar@amiindia.co.in]=20 Sent: Monday, August 22, 2005 7:12 PM To: Sivakumar K Cc: postgre; sandhya Subject: Re: [ADMIN] error codes in postgresql =20 Hi, I have one doubt, =20 Inorder to get the field type in a table i am using pg_field_type(res,col_no) =20 Col_no : Is the field no. for which i have to know the field type. =20 When i am using the above declaration, i am getting the error as, pg_field_type undeclared(First use this function) =20 What i have to include? I am unable to get.Pls Help me. I have included 'libpq-fe.h".Otherthan this what i should include. Pls help me in this regard, =20 Thanks&Regards, Sandhya R =20 =20 ------_=_NextPart_001_01C5A79A.A216A9EB Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

 

Hi = sandhya,=

  &nb= sp;         I really wonder if the function name is pg_field_type (res, col_no). =

The function name which returns the field type of a particular column is = PQftype (res, col_no).

This returns the field type as oid.The oid of the built-in data types can be = found in src/include/catalog/pg_type.h

 

When using libpq API’s you need to include only = “libpq-fe.h”.

 

 

Is pg_field_type (res, col_no) an abstraction over PQftype (res, col_no) in = your case?

 

Regards,=

Siva Kumar.K

 

 

 

-----Original = Message-----
From: sandhya [mailto:sandhyar@amiindia.co.in]
Sent:
Monday, August 22, 2005 7:12 = PM
To: Sivakumar K
Cc: postgre; sandhya
Subject: Re: [ADMIN] = error codes in postgresql

 

Hi,

I have one = doubt,

 

Inorder to get the field type in a table i = am using pg_field_type(res,col_no)

 

Col_no : Is the field no. for which i have to know the field = type.

 

When i am using the above declaration, i am getting the error as,

pg_field_type undeclared(First use this function)

 

What i have to = include?

I am unable to get.Pls Help = me.

I have = included 'libpq-fe.h".Otherthan this what i = should include.

Pls help me in this = regard,

 

Thanks&Regards,

Sandhya R

 

 

------_=_NextPart_001_01C5A79A.A216A9EB--