[ Index ]

PHP Cross Reference of Akelos Framework

title

Body

[close]

/AkActiveRecord/AkDbAdapters/ -> AkPgsqlDbAdapter.php (source)

   1  <?php
   2  /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
   3  
   4  // +----------------------------------------------------------------------+
   5  // | Akelos Framework - http://www.akelos.org                             |
   6  // +----------------------------------------------------------------------+
   7  // | Copyright (c) 2002-2006, Akelos Media, S.L.  & Bermi Ferrer Martinez |
   8  // | Released under the GNU Lesser General Public License, see LICENSE.txt|
   9  // +----------------------------------------------------------------------+
  10  
  11  /**
  12   * @package ActiveRecord
  13   * @subpackage Base
  14   * @component DbAdapter PostgreSQL
  15   * @author Bermi Ferrer <bermi a.t akelos c.om> 2004 - 2007
  16   * @author Kaste 2007
  17   * @copyright Copyright (c) 2002-2006, Akelos Media, S.L. http://www.akelos.org
  18   * @license GNU Lesser General Public License <http://www.gnu.org/copyleft/lesser.html>
  19   */
  20  
  21  class AkPgsqlDbAdapter extends AkDbAdapter
  22  {
  23      
  24      
  25      function type()
  26      {
  27          return 'postgre';
  28      }
  29      
  30      /* SCHEMA */
  31      
  32      function renameColumn($table_name,$column_name,$new_name)
  33      {
  34          return $this->execute("ALTER TABLE $table_name RENAME COLUMN $column_name TO $new_name");
  35      }
  36      
  37      /* META */
  38      
  39      function availableTables()
  40      {
  41          $schema_path = $this->selectValue('SHOW search_path');
  42          $schemas = "'".join("', '",split(',',$schema_path))."'";
  43          return $this->selectValues("SELECT tablename FROM pg_tables WHERE schemaname IN ($schemas)");
  44      }
  45  
  46      /* QUOTING */ 
  47      
  48      function quote_string($value)
  49      {
  50          if (AK_PHP5) {
  51              return "'".pg_escape_string($this->connection->_connectionID,$value)."'";
  52          } else
  53              return "'".pg_escape_string($value)."'";
  54      }
  55      
  56  }
  57  ?>


Generated: Mon Oct 27 12:43:49 2008 Cross-referenced by PHPXref 0.6