Re: Data validation at the db level

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 7 Sep 2006, Chris W. Parker wrote:

> Hey everyone,
>
> Is there any work being done in the database world for data validation
> at the db level?
>
> It would be cool to just define a field as being an email address (of
> length nn) instead of saying a TEXT field (of length nn) and validating
> it in the application layer. Same goes for other things as well.
>
> Sure, it's not really possible to account for all different types of
> data, but the basics would be nice. (email, numbers only, letters only,
> alphanumeric only, [a-z0-9#-] only, etc.)
>

That would be what CHECK constraints are for; MySQL doesn't have them yet,
Postgresql does:

http://www.postgresql.org/docs/8.1/interactive/ddl-constraints.html#AEN1954

You could emulate them in MySQL5 using triggers and stored procedures.

If your database allowed user-defined column types, you could maybe define
one as 'email address' with the approriate restrictions.

	steve

 ...........................................................
. Steve Edberg                       sbedberg@xxxxxxxxxxx .
. Computer Consultant     University of California, Davis .
.                                           (530)754-9127 .
...........................................................

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux