Re: Checking for username...



Ivan Omelchenko 608308824 wrote:

> Kenneth Downs ?????:
>> Domestos wrote:
>>
>>
>>>Hi all,
>>>
>>>How do I check in a mySQL table called 'Users' on column user_name when
>>>registering a new user_name to make sure the new 'user_name' does not
>>>already exist in that column?
>>>
>>>TIA
>>
>>
>> The database can do this by implementing a unique constraint on the
>> column
>> user_name. After issuing the INSERT, (or any SQL command), check for an
>> error, and report it. This then solves your general problem of enforcing
>> data integrity and reporting errors.
> checking for the SQL error is not a good idea, actually.
> Well known programing prupose to use select before insert.

Well known on what planet?

The Server maintains integrity, that's why they were invented. This
protects the database against a buggy or intentionally misbehaving
application. Not surprisingly, it is also much faster.

--
Kenneth Downs
Secure Data Software, Inc.
(Ken)nneth@(Sec)ure(Dat)a(.com)
.



Relevant Pages

  • Re: Modeling Address using Relational Theory
    ... Kenneth Downs wrote: ... >> that are not city, state/province, country, or postcode. ... > processing software, they are going to parse it for you anyway, so you can ... > Secure Data Software, Inc. ...
    (comp.databases.theory)
  • Re: Constraint on an aggregate?
    ... but figure this is just 'data integrity'. ... Not like we're rewriting the ... security, calculations, and constraints. ... Kenneth Downs ...
    (comp.databases)
  • Re: easy way of concatenating 2 strings
    ... Kelvin Chu wrote: ... > is there an equivalent of .= in PHP? ... Kenneth Downs ... Secure Data Software, Inc. ...
    (comp.lang.php)