From 2459f8f5930e7bf0c6325e7ba6705d7ada8acb5e Mon Sep 17 00:00:00 2001 From: zYne Date: Tue, 14 Nov 2006 21:47:08 +0000 Subject: [PATCH] Informix datadict driver: added some sql clauses for future use --- lib/Doctrine/DataDict/Informix.php | 40 +++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/lib/Doctrine/DataDict/Informix.php b/lib/Doctrine/DataDict/Informix.php index ec90e3caf..584eba668 100644 --- a/lib/Doctrine/DataDict/Informix.php +++ b/lib/Doctrine/DataDict/Informix.php @@ -20,13 +20,35 @@ */ Doctrine::autoload('Doctrine_DataDict'); /** - * @package Doctrine - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @author Konsta Vesterinen + * @package Doctrine + * @license http://www.opensource.org/licenses/lgpl-license.php LGPL + * @author Konsta Vesterinen * @author Lukas Smith (PEAR MDB2 library) - * @version $Revision$ - * @category Object Relational Mapping - * @link www.phpdoctrine.com - * @since 1.0 - */ -class Doctrine_DataDict_Informix extends Doctrine_DataDict { } + * @version $Revision$ + * @category Object Relational Mapping + * @link www.phpdoctrine.com + * @since 1.0 + */ +class Doctrine_DataDict_Informix extends Doctrine_DataDict { + protected static $sql = array( + 'listTables' => "SELECT tabname,tabtype FROM systables WHERE tabtype IN ('T','V') AND owner != 'informix'", + 'listColumns' => "SELECT c.colname, c.coltype, c.collength, d.default, c.colno + FROM syscolumns c, systables t,outer sysdefaults d + WHERE c.tabid = t.tabid AND d.tabid = t.tabid AND d.colno = c.colno + AND tabname='%s' ORDER BY c.colno", + 'listPk' => "SELECT part1, part2, part3, part4, part5, part6, part7, part8 FROM + systables t, sysconstraints s, sysindexes i WHERE t.tabname='%s' + AND s.tabid=t.tabid AND s.constrtype='P' + AND i.idxname=s.idxname", + 'listForeignKeys' => "SELECT tr.tabname,updrule,delrule, + i.part1 o1,i2.part1 d1,i.part2 o2,i2.part2 d2,i.part3 o3,i2.part3 d3,i.part4 o4,i2.part4 d4, + i.part5 o5,i2.part5 d5,i.part6 o6,i2.part6 d6,i.part7 o7,i2.part7 d7,i.part8 o8,i2.part8 d8 + from systables t,sysconstraints s,sysindexes i, + sysreferences r,systables tr,sysconstraints s2,sysindexes i2 + where t.tabname='%s' + and s.tabid=t.tabid and s.constrtype='R' and r.constrid=s.constrid + and i.idxname=s.idxname and tr.tabid=r.ptabid + and s2.constrid=r.primary and i2.idxname=s2.idxname", + ); + +}