cvs: pear /DB_Table package.xml /DB_Table/DB Table.php /DB_Table/DB/Table Manager.php QuickForm.php Valid.php

From: Date: Thu, 18 Aug 2005 08:09:46 +0000
Subject: cvs: pear /DB_Table package.xml /DB_Table/DB Table.php /DB_Table/DB/Table Manager.php QuickForm.php Valid.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-34088@lists.php.net to get a copy of this message
wiesemann Thu Aug 18 04:09:46 2005 EDT Modified files: /pear/DB_Table package.xml /pear/DB_Table/DB Table.php /pear/DB_Table/DB/Table Manager.php QuickForm.php Valid.php Log: Optimized some pieces of code and applied Coding Standards http://cvs.php.net/diff.php/pear/DB_Table/package.xml?r1=1.33&r2=1.34&ty=u Index: pear/DB_Table/package.xml diff -u pear/DB_Table/package.xml:1.33 pear/DB_Table/package.xml:1.34 --- pear/DB_Table/package.xml:1.33 Wed Aug 17 11:24:32 2005 +++ pear/DB_Table/package.xml Thu Aug 18 04:09:28 2005 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="ISO-8859-1" ?> <!DOCTYPE package SYSTEM "http://pear.php.net/dtd/package-1.0"> -<!-- $Id: package.xml,v 1.33 2005/08/17 15:24:32 wiesemann Exp $ --> +<!-- $Id: package.xml,v 1.34 2005/08/18 08:09:28 wiesemann Exp $ --> <package version="1.0"> <name>DB_Table</name> <summary>Builds on PEAR DB to abstract datatypes and automate table creation, data validation, insert, update, delete, and select; combines these with PEAR HTML_QuickForm to automatically generate input forms that match the table column definitions.</summary> @@ -45,6 +45,8 @@ new $formFilters parameter in getForm() one can apply filters to all form elements (thanks to ieure at php dot net) + + * Optimized some pieces of code and applied Coding Standards </notes> <filelist> http://cvs.php.net/diff.php/pear/DB_Table/DB/Table.php?r1=1.34&r2=1.35&ty=u Index: pear/DB_Table/DB/Table.php diff -u pear/DB_Table/DB/Table.php:1.34 pear/DB_Table/DB/Table.php:1.35 --- pear/DB_Table/DB/Table.php:1.34 Wed Aug 17 11:35:41 2005 +++ pear/DB_Table/DB/Table.php Thu Aug 18 04:09:41 2005 @@ -19,7 +19,7 @@ * * @license http://www.gnu.org/copyleft/lesser.html LGPL * -* @version $Id: Table.php,v 1.34 2005/08/17 15:35:41 wiesemann Exp $ +* @version $Id: Table.php,v 1.35 2005/08/18 08:09:41 wiesemann Exp $ * */ @@ -803,16 +803,20 @@ } // get the result - switch($method) { - case 'getCol': - $result = $this->db->$method($sql, 0, $params); - break; - case 'getAssoc': - $result = $this->db->$method($sql, false, $params); - break; - default: - $result = $this->db->$method($sql, $params); - break; + switch ($method) { + + case 'getCol': + $result = $this->db->$method($sql, 0, $params); + break; + + case 'getAssoc': + $result = $this->db->$method($sql, false, $params); + break; + + default: + $result = $this->db->$method($sql, $params); + break; + } // swap modes back @@ -1686,6 +1690,7 @@ case 'double': settype($val, 'float'); break; + } } } @@ -1737,6 +1742,7 @@ DB_TABLE_ERR_CREATE_FLAG, "('$flag')" ); + } // are we going to create the table? @@ -1829,6 +1835,7 @@ $val ); break; + } // have we passed the check so far, and should we http://cvs.php.net/diff.php/pear/DB_Table/DB/Table/Manager.php?r1=1.8&r2=1.9&ty=u Index: pear/DB_Table/DB/Table/Manager.php diff -u pear/DB_Table/DB/Table/Manager.php:1.8 pear/DB_Table/DB/Table/Manager.php:1.9 --- pear/DB_Table/DB/Table/Manager.php:1.8 Mon Mar 7 18:20:10 2005 +++ pear/DB_Table/DB/Table/Manager.php Thu Aug 18 04:09:42 2005 @@ -12,10 +12,11 @@ * @package DB_Table * * @author Paul M. Jones <pmjones@php.net> +* @author Mark Wiesemann <wiesemann@php.net> * * @license http://www.gnu.org/copyleft/lesser.html LGPL * -* @version $Id: Manager.php,v 1.8 2005/03/07 23:20:10 pmjones Exp $ +* @version $Id: Manager.php,v 1.9 2005/08/18 08:09:42 wiesemann Exp $ * */ @@ -34,6 +35,7 @@ * @package DB_Table * * @author Paul M. Jones <pmjones@php.net> +* @author Mark Wiesemann <wiesemann@php.net> * */ http://cvs.php.net/diff.php/pear/DB_Table/DB/Table/QuickForm.php?r1=1.26&r2=1.27&ty=u Index: pear/DB_Table/DB/Table/QuickForm.php diff -u pear/DB_Table/DB/Table/QuickForm.php:1.26 pear/DB_Table/DB/Table/QuickForm.php:1.27 --- pear/DB_Table/DB/Table/QuickForm.php:1.26 Wed Aug 17 11:35:41 2005 +++ pear/DB_Table/DB/Table/QuickForm.php Thu Aug 18 04:09:43 2005 @@ -12,7 +12,7 @@ * * @license http://www.gnu.org/copyleft/lesser.html LGPL * -* @version $Id: QuickForm.php,v 1.26 2005/08/17 15:35:41 wiesemann Exp $ +* @version $Id: QuickForm.php,v 1.27 2005/08/18 08:09:43 wiesemann Exp $ * */ @@ -529,6 +529,7 @@ } break; + } // done @@ -729,24 +730,25 @@ default: // by Alex Hoebart: this should allow any registered rule. - if (in_array($type,$form->getRegisteredRules())) { - if (is_array($opts)) { - // $opts[0] is the message - // $opts[1] is the size or regex - $message = $opts[0]; - $format = $opts[1]; - } else { - // $opts is the error message - $message = $opts; - $format = null; - } - } else { // rule is not registered ==> do not add a rule + if (!in_array($type, $form->getRegisteredRules())) { + // rule is not registered ==> do not add a rule continue; } + if (is_array($opts)) { + // $opts[0] is the message + // $opts[1] is the size or regex + $message = $opts[0]; + $format = $opts[1]; + } else { + // $opts is the error message + $message = $opts; + $format = null; + } break; } switch ($col['qf_type']) { + case 'date': case 'time': case 'timestamp': @@ -754,10 +756,12 @@ $form->addGroupRule($elemname, $message, $type, $format, null, $validate); break; + default: // use addRule() for all other elements $form->addRule($elemname, $message, $type, $format, $validate); break; + } } @@ -844,6 +848,7 @@ $col['qf_type'] = 'text'; } break; + } } http://cvs.php.net/diff.php/pear/DB_Table/DB/Table/Valid.php?r1=1.6&r2=1.7&ty=u Index: pear/DB_Table/DB/Table/Valid.php diff -u pear/DB_Table/DB/Table/Valid.php:1.6 pear/DB_Table/DB/Table/Valid.php:1.7 --- pear/DB_Table/DB/Table/Valid.php:1.6 Mon Mar 7 18:20:10 2005 +++ pear/DB_Table/DB/Table/Valid.php Thu Aug 18 04:09:43 2005 @@ -9,10 +9,11 @@ * @package DB_Table * * @author Paul M. Jones <pmjones@php.net> +* @author Mark Wiesemann <wiesemann@php.net> * * @license http://www.gnu.org/copyleft/lesser.html LGPL * -* @version $Id: Valid.php,v 1.6 2005/03/07 23:20:10 pmjones Exp $ +* @version $Id: Valid.php,v 1.7 2005/08/18 08:09:43 wiesemann Exp $ * */ @@ -43,6 +44,7 @@ * @package DB_Table * * @author Paul M. Jones <pmjones@php.net> +* @author Mark Wiesemann <wiesemann@php.net> * */

« previous php.pear.cvs (#34088) next »