Source for file sqlite.daobuilder.php

Documentation is available at sqlite.daobuilder.php

  1. <?php
  2. /**
  3. @package    jelix
  4. @subpackage db_driver
  5. @author     Laurent Jouanneau
  6. @contributor Loic Mathaud <loic@mathaud.net>
  7. @contributor Steven Jehannet
  8. @copyright  2007-2009 Laurent Jouanneau, 2008 Loic Mathaud, 2010 Steven Jehannet
  9. @link      http://www.jelix.org
  10. @licence  http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public Licence, see LICENCE file
  11. */
  12.  
  13. /**
  14.  * driver for jDaoCompiler
  15.  * @package    jelix
  16.  * @subpackage db_driver
  17.  */
  18. class sqliteDaoBuilder extends jDaoGenerator {
  19.  
  20.     protected $propertiesListForInsert = 'PrimaryFieldsExcludeAutoIncrement';
  21.  
  22.     protected function buildSelectPattern ($pattern$table$fieldname$propname ){
  23.         if ($pattern =='%s'){
  24.             $field $table.$this->_encloseName($fieldname).' as '.$this->_encloseName($propname);
  25.         }else{
  26.             $field str_replace(array("'""%s")array("\\'",$table.$this->_encloseName($fieldname)),$pattern).' as '.$this->_encloseName($propname);
  27.         }
  28.         return $field;
  29.     }
  30.  
  31.     protected function buildCountUserQuery($method&$src&$allField{
  32.         if ($method->distinct !=''{
  33.             $properties $this->_dataParser->getProperties ();
  34.             $tables $this->_dataParser->getTables();
  35.             $prop $properties[$method->distinct];
  36.             $distinct=' DISTINCT '.$this->_encloseName($tables[$prop->table]['name'].'.'.$this->_encloseName($prop->fieldName);
  37.         }
  38.  
  39.         $src['    $__query = \'SELECT COUNT(*) as c '.($method->distinct !=''?'FROM (SELECT'.$distinct:'').'\'.$this->_fromClause.$this->_whereClause;';
  40.         $glueCondition ($this->sqlWhereClause !='' ' AND ':' WHERE ');
  41.  
  42.         $cond $method->getConditions();
  43.         if($cond !== null{
  44.             $sqlCond $this->buildConditions($cond$allField$method->getParameters()true);
  45.             if(trim($sqlCond!= '')
  46.                 $src['    $__query .=\''.$glueCondition.$sqlCond."';";
  47.         }
  48.         if($method->distinct !=''$src[].= '    $__query .=\')\';';
  49.     }
  50.  
  51. }

Documentation generated on Mon, 19 Sep 2011 14:14:14 +0200 by phpDocumentor 1.4.3