Source for file oci.daobuilder.php

Documentation is available at oci.daobuilder.php

  1. <?php
  2. /**
  3. @package    jelix
  4. @subpackage db_driver
  5. @author     Laurent Jouanneau
  6. @contributor Gwendal Jouannic
  7. @copyright  2007 Laurent Jouanneau
  8. @link      http://www.jelix.org
  9. @licence  http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public Licence, see LICENCE file
  10. */
  11.  
  12. /**
  13.  * driver for jDaoCompiler
  14.  * @package    jelix
  15.  * @subpackage db_driver
  16.  */
  17. class ociDaoBuilder extends jDaoGenerator {
  18.  
  19.     protected $aliasWord = ' ';
  20.     protected $propertiesListForInsert = 'PrimaryFieldsExcludeAutoIncrement';
  21.  
  22.     function __construct($factoryClassName$recordClassName$daoDefinition){
  23.         parent::__construct($factoryClassName$recordClassName$daoDefinition);
  24.     }
  25.  
  26.     protected function genOuterJoins(&$tables$primaryTableName){
  27.         $sqlFrom '';
  28.         $sqlWhere ='';
  29.         foreach($this->_dataParser->getOuterJoins(as $tablejoin){
  30.             $table$tables[$tablejoin[0]];
  31.             $tablename $this->_encloseName($table['name']);
  32.  
  33.             if($table['name']!=$table['realname'])
  34.                 $r =$this->_encloseName($table['realname']).' '.$tablename;
  35.             else
  36.                 $r =$this->_encloseName($table['realname']);
  37.             $fieldjoin='';
  38.  
  39.             if($tablejoin[1== 0){
  40.                 $operand='='$opafter='(+)';
  41.             }elseif($tablejoin[1== 1){
  42.                 $operand='(+)='$opafter='';
  43.             }
  44.             foreach($table['fk'as $k => $fk){
  45.                 $fieldjoin.=' AND '.$primaryTableName.'.'.$this->_encloseName($fk).$operand.$tablename.'.'.$this->_encloseName($table['pk'][$k]).$opafter;
  46.             }
  47.             $sqlFrom.=', '.$r;
  48.             $sqlWhere.=$fieldjoin;
  49.         }
  50.         return array($sqlFrom$sqlWhere);
  51.     }
  52.  
  53.     protected function genSelectPattern ($pattern$table$fieldname$propname ){
  54.         if ($pattern =='%s'){
  55.             if ($fieldname != $propname){
  56.                 $field $table.$this->_encloseName($fieldname).' "'.$propname.'"';
  57.             }else{
  58.                 $field $table.$this->_encloseName($fieldname);
  59.             }
  60.         }else{
  61.             $field str_replace(array("'""%s")array("\\'",$table.$this->_encloseName($fieldname)),$pattern).' "'.$propname.'"';
  62.         }
  63.         return $field;
  64.     }
  65.  
  66.     /*
  67.      * Remplace le lastInsertId qui ne marche pas avec oci 
  68.      */
  69.     protected function genUpdateAutoIncrementPK($pkai$pTableRealName{
  70.         return '          $record->'.$pkai->name.'= $this->_conn->query(\'SELECT '.$pkai->sequenceName.'.currval as '.$pkai->name.' from dual\')->fetch()->'.$pkai->name.';';
  71.     }
  72.  
  73. }

Documentation generated on Thu, 22 Mar 2012 22:17:56 +0100 by phpDocumentor 1.4.3