Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

Re: catch SQLException, error code for Foeign key violation,


  • From: "surabhi.ahuja" <surabhi(dot)ahuja(at)iiitb(dot)ac(dot)in>
  • To: "Kris Jurka" <books(at)ejurka(dot)com>
  • Cc: <pgsql-general(at)postgresql(dot)org>
  • Subject: Re: catch SQLException, error code for Foeign key violation,
  • Date: Wed, 19 Apr 2006 12:02:54 +0530
  • Message-id: <8626C1B7EB748940BCDD7596134632BE398677(at)jal(dot)iiitb(dot)ac(dot)in>

Title: Re: [GENERAL] catch SQLException, error code for Foeign key violation,
Thanks .
in java i can catch SQL Exception,
 
 what is the way to capture such exception in Cpp,
are there any examples available for this?
 
right now in cpp, i do this
 
rStatus = PQresultStatus(result);
 
but what is the specific error code, how to get that,
 
thanks,
regards
Surabhi

From: Kris Jurka [mailto:books(at)ejurka(dot)com]
Sent: Tue 4/18/2006 4:43 AM
To: surabhi.ahuja
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: [GENERAL] catch SQLException, error code for Foeign key violation,

***********************
Your mail has been scanned by InterScan VirusWall.
***********-***********




On Mon, 17 Apr 2006, surabhi.ahuja wrote:

> The question is that is from this SQLException can i detect if it is a
> foreign key violation,
>

You should check the value of SQLException.getSQLState() against this
table:
http://www.postgresql.org/docs/8.1/static/errcodes-appendix.html

Kris Jurka



Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group