Database Management
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesDatabase Management

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 19th, 2003, 08:48 AM
neobuddah's Avatar
neobuddah neobuddah is offline
cosmos curator
Dev Shed Novice (500 - 999 posts)
 
Join Date: Mar 2002
Location: Leeds, UK
Posts: 678 neobuddah User rank is Corporal (100 - 500 Reputation Level)neobuddah User rank is Corporal (100 - 500 Reputation Level)neobuddah User rank is Corporal (100 - 500 Reputation Level)neobuddah User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Day 14 h 17 m 49 sec
Reputation Power: 8
Question Exceptions on unique columns.

Hi

Just wondering...

I'm building an app in PHP/MySQL which may potentially be ported to Oracle/Sybase/PostgreSQL/SQLite.

In my app, I need to ensure that all usernames are unique.

Would it be better to tag the column as unique, try an insert and act upon errors, or query the DB first to see if the username already exists?

I'm not sure how the other DBs handle duplicated on unique columns.

Thanks.
__________________
R.T.F.M - Its the only way to fly...

"No matter what you do, or how good it is, someone will always ask for more features. Or to change the colour of something, then change their minds."

Personal:
experience// 8 Years Web Development
technologies// Standards-compliant, valid, & accessible (x)HTML/CSS, XML/XSL/XPath/XQuery/XUpdate, (OOP) PHP/(My)SQL, eXist/Xindice/XMLDBs
packages// Photoshop, Illustrator, Flash/Fireworks/Director
environment// FC2, MySQL, Lighttpd, PHP5, Mojavi/Agavi
site// //refactored.net/ (Coming soon...)
quote// Programming is the eternal competition between programmers who try to make apps more and more idiot proof and the universe that makes dumber idiots. So far, the universe is winning...

Reply With Quote
  #2  
Old December 19th, 2003, 10:13 AM
r937's Avatar
r937 r937 is online now
SQL Consultant
Click here for more information.
 
Join Date: Feb 2003
Location: Toronto Canada
Posts: 17,912 r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level) 
Time spent in forums: 1 Month 4 Weeks 12 h 17 m 55 sec
Reputation Power: 1018
see my argument in this thread --
http://forums.devshed.com/showthrea...15&pagenumber=1

if 95 out of 100 are successful, would you like to make 100 calls to the database, or 195?

rudy

Reply With Quote
  #3  
Old December 22nd, 2003, 01:59 AM
neobuddah's Avatar
neobuddah neobuddah is offline
cosmos curator
Dev Shed Novice (500 - 999 posts)
 
Join Date: Mar 2002
Location: Leeds, UK
Posts: 678 neobuddah User rank is Corporal (100 - 500 Reputation Level)neobuddah User rank is Corporal (100 - 500 Reputation Level)neobuddah User rank is Corporal (100 - 500 Reputation Level)neobuddah User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Day 14 h 17 m 49 sec
Reputation Power: 8
Yea, thats what I was thinking.

Thanks!

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesDatabase Management > Exceptions on unique columns.


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway