About Unique Constraint

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Sep 2008
Posts: 34
Reputation: srs_grp is an unknown quantity at this point 
Solved Threads: 0
srs_grp srs_grp is offline Offline
Light Poster

About Unique Constraint

 
0
  #1
Feb 9th, 2009
Hello,
I want to check uniqueness of id at the time of entry only.And I want to give message to the user at that time only.How to do this?
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 1,175
Reputation: stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light 
Solved Threads: 125
Featured Poster
stephen84s's Avatar
stephen84s stephen84s is offline Offline
Veteran Poster

Re: About Unique Constraint

 
0
  #2
Feb 9th, 2009
Either you generate the Id and assign it to the user yourself using an autoincrement or a UUID feature, but if you want the user to select his own ID you will have to perform a check in your records (database or files) to check if the ID has already been chosen by someone else.
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand."

"How to ask questions the smart way ?"
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 34
Reputation: srs_grp is an unknown quantity at this point 
Solved Threads: 0
srs_grp srs_grp is offline Offline
Light Poster

Re: About Unique Constraint

 
0
  #3
Feb 9th, 2009
Originally Posted by stephen84s View Post
Either you generate the Id and assign it to the user yourself using an autoincrement or a UUID feature, but if you want the user to select his own ID you will have to perform a check in your records (database or files) to check if the ID has already been chosen by someone else.

yes.. but the problem is where should I perform this check,so that I can immediately inform user abt constraint violation.
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 1,175
Reputation: stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light 
Solved Threads: 125
Featured Poster
stephen84s's Avatar
stephen84s stephen84s is offline Offline
Veteran Poster

Re: About Unique Constraint

 
0
  #4
Feb 9th, 2009
That depends, what are you working on right now, what type of application is it ? A web page, Swing form ? You want specific answers but you haven't yet given details specific to your application.
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand."

"How to ask questions the smart way ?"
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC