Source for file pgsql.daobuilder.php

Documentation is available at pgsql.daobuilder.php

  1. <?php
  2. /**
  3. @package    jelix
  4. @subpackage db_driver
  5. @author     Laurent Jouanneau
  6. @contributor
  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 pgsqlDaoBuilder extends jDaoGenerator {
  18.  
  19.     protected $propertiesListForInsert = 'PrimaryFieldsExcludeAutoIncrement';
  20.     
  21.     protected $trueValue = 'TRUE';
  22.     
  23.     protected $falseValue = 'FALSE';
  24.     
  25.     function __construct($factoryClassName$recordClassName$daoDefinition){
  26.         parent::__construct($factoryClassName$recordClassName$daoDefinition);
  27.  
  28.     }
  29.  
  30.     protected function genUpdateAutoIncrementPK($pkai$pTableRealName{
  31.         return '          $record->'.$pkai->name.'= $this->_conn->lastInsertId(\''.$pkai->sequenceName.'\');';
  32.     }
  33.  
  34.     protected function _encloseName($name){
  35.         return '"'.$name.'"';
  36.     }
  37.  
  38.     protected function _getAutoIncrementPKField ($using null){
  39.         if ($using === null){
  40.             $using $this->_datasParser->getProperties ();
  41.         }
  42.  
  43.         $tb $this->_datasParser->getTables();
  44.         $tb $tb[$this->_datasParser->getPrimaryTable()]['realname'];
  45.  
  46.         foreach ($using as $id=>$field{
  47.             if(!$field->isPK)
  48.                 continue;
  49.             if ($field->datatype == 'autoincrement' || $field->datatype == 'bigautoincrement'{
  50.                if(!strlen($field->sequenceName)){
  51.                   $field->sequenceName $tb.'_'.$field->name.'_seq';
  52.                }
  53.                return $field;
  54.             }
  55.         }
  56.         return null;
  57.     }
  58.  
  59. }
  60. ?>

Documentation generated on Wed, 07 Sep 2011 13:48:25 +0200 by phpDocumentor 1.4.3