PEAR: Database Abstraction Layer porting to PostgreSQL 7.3

From: Date: Tue, 11 Mar 2003 10:10:20 +0000
Subject: PEAR: Database Abstraction Layer porting to PostgreSQL 7.3
Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-14192@lists.php.net to get a copy of this message
Dear Developers, there have appeared some problems with PEAR::DB once PostGreSQL has been upgraded to version 7.3. The new version of PostgreSQL does not allow weak types and this is not a configurable option. For example, inserting empty strings OR joining tables based on empty strings OR projecting tables using empty strings does not work anymore in case the column worked with is of a type other than varchar or text. I have noticed that quite a bit of code based around PostGreSQL earlier than 7.3 made use of this paradigm, and the very same code refuses to work on the new engine. This problem can easily be solved by patching PEAR::DB::common forcing it to replace empty strings '' with NULL. Here is the neccessary code fragment: <code> function &query($query, $params = array()) { $query = str_replace("''","NULL",$query); ... </code> this es easily made into a configurable option upon initialization of DB and will definately be of some help to many projects based on older codebases. best regards, A. Kulikov -- .::....::.:...::...:..:.:::..:..:..::.:..:..:::..:::...::..:.. :: PUBLIC VOICE Lab :: Alexey Kulikov :: :: The International Media Coop :: alex@pvl.at :: :: www.pvl.at :: phone: +43 699 1 9228792 ::

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