Re: MDB getTextDeclaration

From: Date: Fri, 28 May 2004 11:10:00 +0000
Subject: Re: MDB getTextDeclaration
References: 1 2  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-29769@lists.php.net to get a copy of this message
"Lukas Smith" <smith@backendmedia.com> wrote in message news:40B6E560.5040808@backendmedia.com... > > Not likely to happen in MDB unless I can make sure I dont break BC (are > you essentially asking that MySQL uses Text for text fields with more > than 256 chars?). Yes, it already uses Text when the Length is not set. This is how my overloaded getTextDeclaration() method for MySql looks like: function getTextDeclaration($name, $field) { $qry = $name; if ($field['length']>0 && $field['length']<64) //length<64 -> CHAR $qry .= " VARCHAR ({$field['length']})"; else if ($field['length']>64 && $field['length']<256) //64<Length<256 -> VARCHAR $qry .= " CHAR ({$field['length']})"; else //perhaps perform a check if length>64Kb then use a BLOB type $qry .= " TEXT"; $qry .= (isset($field['default']) ? ' DEFAULT ' . $this->getTextValue($field['default']) : '') . (isset($field['notnull']) ? ' NOT NULL' : ''); return $qry; } > I may explore this for MDB2. MDB2 makes modifications to the datatype > conversion easier since it splits the code out into a separate class. > > Essentially with MDB you should be using a max length of 256. Anything > above that needs to be a clob. This is a bit clumsy as the LOB API is a > bit verbose in MDB. Its much simpler in MDB2. > Well it looks like you are focused in MDB2 :) So is MDB2 useable yet? The project I'm doing is for a website with 50K unique hits a day so I need to make sure performance is not too bad and the API is not gonna suffer continuous changes. Thanks, ivan

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