cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sheraz Sharif <li...@m3b.net>
Subject RE: DatabaseAddAction and unique or primary keys
Date Fri, 07 Feb 2003 12:07:00 GMT
I am using postgresql 7.2..

I am not sure what you mean.  Are you talking about making the database
run a trigger before the insert happens?  If so, I do not think that
will solve my problem.  I want cocoon to realize that there already
exists that specific value in the table, and notify the user to try
again. I think what I am trying to say is this.

1. User sends form to cocoon.
2. Cocoon processes form values.
3. Form values are ok, check the database to make sure primary keys and
unique keys do not already exist
4. on success, insert values into database
5. on failure, return failure

I am thinking that I need make some additions to the DatabaseAddAction
class to make this happen.

Sheraz

On Fri, 2003-02-07 at 05:43, Kazmir, Jaroslav wrote:
> Which type of database you use? Isn't it easily to use before insert
> trigger? 
> 
> JayKay
> 
> -----Original Message-----
> From: Sheraz Sharif [mailto:lists@m3b.net] 
> Sent: Freitag, 07. Februar 2003 12:19
> To: cocoon-users@xml.apache.org
> 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.
> 




---------------------------------------------------------------------
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:     <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail:   <cocoon-users-help@xml.apache.org>


Mime
View raw message