New MDB2_Schema Parser

From: Date: Wed, 07 Feb 2007 19:36:09 +0000
Subject: New MDB2_Schema Parser
Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-45619@lists.php.net to get a copy of this message
Hi all, I have uploaded to CVS the first approach for the new MDB2_Schema parser. The old parser is unable to handle recursive tags, so the new parser extends XML_Serializer, allowing much greater flexibility in XML schema files. To start making use of it you need to download the latest CVS version and set MDB2_Schema option 'parser' to 'MDB2_Schema_Parser2' on Schema.php line 88 or on your own script. It is still only a draft so it needs lots of code optimization and etc. Note the following "code": foreach ($this->database_definition['tables'][$table]['declaration']['field'] as $k => $v) { $nKey = $this->database_definition['tables'][$table]['declaration']['field'][$k]['name']; unset($this->database_definition['tables'][$table]['declaration']['field'][$k]['name']); $this->renameKey($this->database_definition['tables'][$table]['declaration']['field'], $k, $nKey); } $this->renameKey($this->database_definition['tables'][$table]['declaration'], 'field', 'fields'); Known issues: <insert/> <update/> <insert/> is parsed to: [insert] => array with 2 element [update] => array with 1 element (we lose the original order) this is much critical in this situation: <function> <name>myfunc</name> <column>A</column> <value>foo</value> <column>B</column> </function> which is parsed to: Array ( [name] => myfunc [column] => Array
       (
           [0] => A
           [1] => B
       )
[value] => foo ) also the last case currently doesn't works at all. when generating the SQL it would bind to: myfunc(Array, 'foo') Any comments or suggestions would be appreciated. regards, iGor.

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