Re: [DB] Suggestion for field types

From: Date: Sat, 10 Jan 2004 09:25:36 +0000
Subject: Re: [DB] Suggestion for field types
References: 1 2 3  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-24953@lists.php.net to get a copy of this message
I do wonder if extending the functionality of tableInfo, is a better short term approach in moving towards DB_Schema (eg. tableInfo being a basic data Provider...) Currently supplied information: table => table name name => field name type => field type len => field length flags => field flags // from DataObjects & other info perspective.. requiresQuotes => value should be quoted.. (true|false) hasNativeSequence => autoincrement or similar (true|false) nullValid => allows NULL. (true|false) default => default value? string|int ... unique => unique flag (true|false) index => indexed??? (true|type?) genericType => boolean| int|float|numeric| date|time|datetime| char|varchar| blob Given this information - writing a DB_Validate class should be pretty simple: $errorCode | true =
     DB_Validate::check($db,'tablename','columnname','data');
$errorsArray | true =
     DB_Validate::check($db,'tablename',$array);
Feel free to comment on what additional information is needed.. - or more generic types. - the ones above are based off of MDB. Regards Alan Peter wrote:
So how about adding two new elements to the array returned by tableInfo(): 'generictype' (or 'peartype'?) which will contain one of a basic set of types 'nativetype' which will contain the type name as used in the create table command by the specific backend and pear-haps also 'sqltype', for the closest SQL-99 column type. This will not break code that looks for 'type', and will allow the various implementations of tableInfo() to start standardising. Kind regards, Peter
-- Can you help out? Need Consulting Services or Know of a Job? http://www.akbkhome.com

« previous php.pear.dev (#24953) next »