[ 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/ -> MysqlPlatform.php (source)

   1  <?php
   2  /*
   3   *  $Id: MysqlPlatform.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   * MySql 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 MysqlPlatform 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::NUMERIC, "DECIMAL"));
  41          $this->setSchemaDomainMapping(new Domain(PropelTypes::LONGVARCHAR, "TEXT"));
  42          $this->setSchemaDomainMapping(new Domain(PropelTypes::TIMESTAMP, "DATETIME"));
  43          $this->setSchemaDomainMapping(new Domain(PropelTypes::BU_TIMESTAMP, "DATETIME"));
  44          $this->setSchemaDomainMapping(new Domain(PropelTypes::BINARY, "BLOB"));
  45          $this->setSchemaDomainMapping(new Domain(PropelTypes::VARBINARY, "MEDIUMBLOB"));
  46          $this->setSchemaDomainMapping(new Domain(PropelTypes::LONGVARBINARY, "LONGBLOB"));
  47          $this->setSchemaDomainMapping(new Domain(PropelTypes::BLOB, "LONGBLOB"));
  48          $this->setSchemaDomainMapping(new Domain(PropelTypes::CLOB, "LONGTEXT"));
  49      }
  50  
  51      /**
  52       * @see Platform#getAutoIncrement()
  53       */
  54      public function getAutoIncrement()
  55      {
  56          return "AUTO_INCREMENT";
  57      }
  58  
  59      /**
  60       * @see Platform#getMaxColumnNameLength()
  61       */
  62      public function getMaxColumnNameLength()
  63      {
  64          return 64;
  65      }
  66      
  67      /**
  68       * @see Platform::supportsNativeDeleteTrigger()
  69       */
  70      public function supportsNativeDeleteTrigger()
  71      {
  72          $usingInnoDB = false;
  73          if(class_exists('DataModelBuilder', false))
  74          {
  75              $usingInnoDB = strtolower(DataModelBuilder::getBuildProperty('mysqlTableType')) == 'innodb';
  76          }
  77          return $usingInnoDB || false;
  78      }
  79      
  80      /**
  81       * @see Platform#hasSize(String)
  82       */
  83      public function hasSize($sqlType) {
  84          return !("MEDIUMTEXT" == $sqlType || "LONGTEXT" == $sqlType
  85                  || "BLOB" == $sqlType || "MEDIUMBLOB" == $sqlType
  86                  || "LONGBLOB" == $sqlType);
  87      }
  88  
  89      /**
  90       * Escape the string for RDBMS.
  91       * @param string $text
  92       * @return string
  93       */
  94      public function escapeText($text) {
  95          return mysql_escape_string($text);
  96      }
  97      
  98      /**
  99       * @see Platform::quoteIdentifier()
 100       */
 101  	public function quoteIdentifier($text)
 102      {
 103          return '`' . $text . '`';
 104      }
 105  }


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