This is probably your best solution. I would _still_ put the constraint on
the table because imho it's better to have a user see an error than to have
no indication when something is wrong. This way, in the event that the
stored procedure isn't working properly -- for any reason -- you'll know
right away and you can fix it right away and you won't have to spend a lot
of time cleaning up a horrible mess caused by some innocuous bug in your
app. I'm not sure what kind of increased load the constraint creates, but I
don't think it's significant in most situations.


Isaac
Certified Advanced ColdFusion 5 Developer

www.turnkey.to
954-776-0046

> I have recently just done a similar thing for a games
> site... The email
> address and the display name of the user was to be
> unique... The way I
> did it was via a stored procedure... So on registration I
> call a stored
> procedure and pass all the details through, then the proc
> works out if
> it can be added... If so then it inserts the record, if
> not then it does
> not... But in both cases it returns a row which contains
> whether the
> insert was successful or not so I could return an error to
> the flash
> file to tell the user to pick another name...

> HTH



> -----Original Message-----
> From: Kola Oyedeji [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, September 29, 2002 19:29
> To: CF-Talk
> Subject: OT: When to use database constraints


> Hi

> I would like to know if constraints other than keys are
> usually used? I
> have a database where the email address must be unique and
> was wondering
> if a constraint should be used. I could check for the
> existence of an
> email address prior to inserting a new record but this
> involves another
> query. Alternatively i could attempt to insert a duplicate
> email address
> and catch any database error generated as a result. I'm
> just wondering
> which method is best. Also the database will only be used
> with this CF
> application.

> thanks

> Kola



> __________________________________________________________
> ____________
> This list and all House of Fusion resources hosted by
> CFHosting.com. The place for dependable ColdFusion
> Hosting.
> FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
> Archives:
> http://www.mail-archive.com/cf-talk@houseoffusion.com/
> Unsubscribe:
> http://www.houseoffusion.com/index.cfm?sidebar=lists


______________________________________________________________________
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to