[ Index ]
 

Code source de Symfony 1.0.0

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/lib/vendor/propel-generator/classes/propel/engine/platform/ -> PgsqlPlatform.php (source)

   1  <?php
   2  /*
   3   *  $Id: PgsqlPlatform.php 137 2005-11-17 14:11:19Z fabien $
   4   *
   5   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   6   * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   7   * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
   8   * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
   9   * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  10   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  11   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  12   * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  13   * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  14   * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  15   * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  16   *
  17   * This software consists of voluntary contributions made by many individuals
  18   * and is licensed under the LGPL. For more information please see
  19   * <http://propel.phpdb.org>.
  20   */
  21   
  22  require_once 'propel/engine/platform/DefaultPlatform.php';
  23  
  24  /**
  25   * Postgresql Platform implementation.
  26   *
  27   * @author Hans Lellelid <hans@xmpl.org> (Propel)
  28   * @author Martin Poeschl <mpoeschl@marmot.at> (Torque)
  29   * @version $Revision: 256 $
  30   * @package propel.engine.platform
  31   */
  32  class PgsqlPlatform extends DefaultPlatform {
  33  
  34      /**
  35       * Initializes db specific domain mapping.
  36       */
  37      protected function initialize()
  38      {
  39          parent::initialize();
  40          $this->setSchemaDomainMapping(new Domain(PropelTypes::BOOLEAN, "BOOLEAN"));
  41          $this->setSchemaDomainMapping(new Domain(PropelTypes::TINYINT, "INT2"));
  42          $this->setSchemaDomainMapping(new Domain(PropelTypes::SMALLINT, "INT2"));
  43          $this->setSchemaDomainMapping(new Domain(PropelTypes::BIGINT, "INT8"));
  44          $this->setSchemaDomainMapping(new Domain(PropelTypes::REAL, "FLOAT"));
  45          $this->setSchemaDomainMapping(new Domain(PropelTypes::DOUBLE, "DOUBLE PRECISION"));
  46          $this->setSchemaDomainMapping(new Domain(PropelTypes::LONGVARCHAR, "TEXT"));
  47          $this->setSchemaDomainMapping(new Domain(PropelTypes::BINARY, "BYTEA"));
  48          $this->setSchemaDomainMapping(new Domain(PropelTypes::VARBINARY, "BYTEA"));
  49          $this->setSchemaDomainMapping(new Domain(PropelTypes::LONGVARBINARY, "BYTEA"));
  50          $this->setSchemaDomainMapping(new Domain(PropelTypes::BLOB, "BYTEA"));
  51          $this->setSchemaDomainMapping(new Domain(PropelTypes::CLOB, "TEXT"));
  52      }
  53      
  54      /**
  55       * @see Platform#getNativeIdMethod()
  56       */
  57      public function getNativeIdMethod()
  58      {
  59          return Platform::SEQUENCE;
  60      }
  61  
  62      /**
  63       * @see Platform#getAutoIncrement()
  64       */
  65      public function getAutoIncrement()
  66      {
  67          return "";
  68      }
  69      
  70      /**
  71       * @see Platform#getMaxColumnNameLength()
  72       */
  73      public function getMaxColumnNameLength()
  74      {
  75          return 32;
  76      }
  77      
  78      /**
  79       * Escape the string for RDBMS.
  80       * @param string $text
  81       * @return string
  82       */ 
  83      public function escapeText($text) {
  84          return pg_escape_string($text);
  85      }
  86      
  87      /**
  88       * @see Platform::getBooleanString()
  89       */
  90      public function getBooleanString($b)
  91      {
  92          // parent method does the checking for allowes tring
  93          // representations & returns integer
  94          $b = parent::getBooleanString($b);
  95          return ($b ? "'t'" : "'f'");
  96      }
  97      
  98      /**
  99       * @see Platform::supportsNativeDeleteTrigger()
 100       */
 101      public function supportsNativeDeleteTrigger()
 102      {
 103          return true;
 104      }
 105      
 106      /**
 107       * @see Platform::hasSize(String)
 108       * TODO collect info for all platforms
 109       */
 110      public function hasSize($sqlType)
 111      {
 112          return !("BYTEA" == $sqlType || "TEXT" == $sqlType);
 113      }
 114  }


Généré le : Fri Mar 16 22:42:14 2007 par Balluche grâce à PHPXref 0.7