Пример #1
0
 /**
  * Initializes db specific domain mapping.
  */
 protected function initialize()
 {
     parent::initialize();
     $this->setSchemaDomainMapping(new Domain(PropelTypes::NUMERIC, 'DECIMAL'));
     $this->setSchemaDomainMapping(new Domain(PropelTypes::LONGVARCHAR, 'MEDIUMTEXT'));
     $this->setSchemaDomainMapping(new Domain(PropelTypes::DATE, 'DATETIME'));
     $this->setSchemaDomainMapping(new Domain(PropelTypes::BINARY, 'BLOB'));
     $this->setSchemaDomainMapping(new Domain(PropelTypes::VARBINARY, 'MEDIUMBLOB'));
     $this->setSchemaDomainMapping(new Domain(PropelTypes::LONGVARBINARY, 'LONGBLOB'));
     $this->setSchemaDomainMapping(new Domain(PropelTypes::BLOB, 'LONGBLOB'));
     $this->setSchemaDomainMapping(new Domain(PropelTypes::CLOB, 'LONGTEXT'));
     $this->setSchemaDomainMapping(new Domain(PropelTypes::OBJECT, 'MEDIUMTEXT'));
     $this->setSchemaDomainMapping(new Domain(PropelTypes::PHP_ARRAY, 'MEDIUMTEXT'));
     $this->setSchemaDomainMapping(new Domain(PropelTypes::ENUM, 'TINYINT'));
 }
 /**
  * Initializes db specific domain mapping.
  */
 protected function initialize()
 {
     parent::initialize();
     $this->setSchemaDomainMapping(new Domain(PropelTypes::INTEGER, "INT"));
     $this->setSchemaDomainMapping(new Domain(PropelTypes::BOOLEAN, "INT"));
     $this->setSchemaDomainMapping(new Domain(PropelTypes::DOUBLE, "FLOAT"));
     $this->setSchemaDomainMapping(new Domain(PropelTypes::LONGVARCHAR, "VARCHAR(MAX)"));
     $this->setSchemaDomainMapping(new Domain(PropelTypes::CLOB, "VARCHAR(MAX)"));
     $this->setSchemaDomainMapping(new Domain(PropelTypes::DATE, "DATETIME"));
     $this->setSchemaDomainMapping(new Domain(PropelTypes::BU_DATE, "DATETIME"));
     $this->setSchemaDomainMapping(new Domain(PropelTypes::TIME, "DATETIME"));
     $this->setSchemaDomainMapping(new Domain(PropelTypes::TIMESTAMP, "DATETIME"));
     $this->setSchemaDomainMapping(new Domain(PropelTypes::BU_TIMESTAMP, "DATETIME"));
     $this->setSchemaDomainMapping(new Domain(PropelTypes::BINARY, "BINARY(7132)"));
     $this->setSchemaDomainMapping(new Domain(PropelTypes::VARBINARY, "VARBINARY(MAX)"));
     $this->setSchemaDomainMapping(new Domain(PropelTypes::LONGVARBINARY, "VARBINARY(MAX)"));
     $this->setSchemaDomainMapping(new Domain(PropelTypes::BLOB, "VARBINARY(MAX)"));
     $this->setSchemaDomainMapping(new Domain(PropelTypes::OBJECT, "VARBINARY(MAX)"));
     $this->setSchemaDomainMapping(new Domain(PropelTypes::PHP_ARRAY, "VARCHAR(MAX)"));
     $this->setSchemaDomainMapping(new Domain(PropelTypes::ENUM, "TINYINT"));
 }
 public function getColumnBindingPHP($column, $identifier, $columnValueAccessor, $tab = "            ")
 {
     // FIXME - This is a temporary hack to get around apparent bugs w/ PDO+MYSQL
     // See http://pecl.php.net/bugs/bug.php?id=9919
     if ($column->getPDOType() === \PDO::PARAM_BOOL) {
         return sprintf("\n%s\$stmt->bindValue(%s, (int) %s, PDO::PARAM_INT);", $tab, $identifier, $columnValueAccessor);
     }
     return parent::getColumnBindingPHP($column, $identifier, $columnValueAccessor, $tab);
 }
Пример #4
0
 /**
  * Get the PHP snippet for binding a value to a column.
  * Warning: duplicates logic from OracleAdapter::bindValue().
  * Any code modification here must be ported there.
  */
 public function getColumnBindingPHP(Column $column, $identifier, $columnValueAccessor, $tab = "            ")
 {
     if ($column->getPDOType() == PropelTypes::CLOB_EMU) {
         return sprintf("%s\$stmt->bindParam(%s, %s, %s, strlen(%s));\n", $tab, $identifier, $columnValueAccessor, PropelTypes::getPdoTypeString($column->getType()), $columnValueAccessor);
     }
     return parent::getColumnBindingPHP($column, $identifier, $columnValueAccessor, $tab);
 }
 public function getColumnDDL(Column $col)
 {
     if ($col->isAutoIncrement()) {
         $col->setType('INTEGER');
         $col->setDomainForType('INTEGER');
     }
     if ($col->getDefaultValue() && $col->getDefaultValue()->isExpression() && 'CURRENT_TIMESTAMP' === $col->getDefaultValue()->getValue()) {
         //sqlite use CURRENT_TIMESTAMP different than mysql/pgsql etc
         //we set it to the more common behavior
         $col->setDefaultValue(new ColumnDefaultValue("(datetime(CURRENT_TIMESTAMP, 'localtime'))", ColumnDefaultValue::TYPE_EXPR));
     }
     return parent::getColumnDDL($col);
 }
Пример #6
0
 /**
  * Overrides the implementation from DefaultPlatform
  *
  * @author     Niklas Närhinen <*****@*****.**>
  * @return     string
  * @see        DefaultPlatform::getDropIndexDDL
  */
 public function getDropIndexDDL(Index $index)
 {
     if ($index instanceof Unique) {
         $pattern = "\n    ALTER TABLE %s DROP CONSTRAINT %s;\n    ";
         return sprintf($pattern, $this->quoteIdentifier($index->getTable()->getName()), $this->quoteIdentifier($index->getName()));
     } else {
         return parent::getDropIndexDDL($index);
     }
 }
Пример #7
0
 /**
  * Escape the string for RDBMS.
  * @param      string $text
  * @return     string
  */
 public function disconnectedEscapeText($text)
 {
     if (function_exists('sqlite_escape_string')) {
         return sqlite_escape_string($text);
     } else {
         return parent::disconnectedEscapeText($text);
     }
 }