Which type of database you use? Isn't it easily to use before insert
trigger? 

JayKay

-----Original Message-----
From: Sheraz Sharif [mailto:[EMAIL PROTECTED]] 
Sent: Freitag, 07. Februar 2003 12:19
To: [EMAIL PROTECTED]
Subject: DatabaseAddAction and unique or primary keys

Hello all,

Sorry if this gets double-posted...

I have been working on a website for a while.  Here is my problem - I
can easily verify user input through forms and return any error messages
through the xsp-formval tags.  After validation, the input is passed to
the database.  However, I get an SQL exception :

ProcessingException: Could not add record: java.sql.SQLException: ERROR:
Cannot insert a duplicate key into unique index category_name_key

This is happening because I am attempting to insert a value into a key
column where that value already exists.  I am looking for a solution
where cocoon will connect to the database and attempt to retreive the
key value before the insert.  If it does not exist, it will insert it,
otherwise it will fail and I can notify the user of the error.  Have I
been verbose enough?  If no solution exists, I am thinking I can either
extend or rewrite the DatabaseAddAction class to do this.  Or should I
abandon logicsheets all together and move to xforms?  Thanks.

Sheraz
-- 
[EMAIL PROTECTED]
m3b Consulting
www.m3b.net
832.573.0937




---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <[EMAIL PROTECTED]>
For additional commands, e-mail:   <[EMAIL PROTECTED]>

---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <[EMAIL PROTECTED]>
For additional commands, e-mail:   <[EMAIL PROTECTED]>

Reply via email to