Esempio n. 1
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);
 }
Esempio n. 2
0
 protected function getDateTimeClass(Column $column)
 {
     if (PropelTypes::isPhpObjectType($column->getPhpType())) {
         return $column->getPhpType();
     }
     $dateTimeClass = $this->getBuildProperty('generator.dateTime.dateTimeClass');
     if (!$dateTimeClass) {
         $dateTimeClass = '\\DateTime';
     }
     return $dateTimeClass;
 }
Esempio n. 3
0
 /**
  * Returns whether or not the column PHP native type is an object.
  *
  * @return boolean
  * @see PropelTypes::isPhpObjectType()
  */
 public function isPhpObjectType()
 {
     return PropelTypes::isPhpObjectType($this->getPhpType());
 }
 /**
  * Get the PHP snippet for binding a value to a column.
  * Warning: duplicates logic from AdapterInterface::bindValue().
  * Any code modification here must be ported there.
  */
 public function getColumnBindingPHP(Column $column, $identifier, $columnValueAccessor, $tab = "            ")
 {
     $script = '';
     if ($column->isTemporalType()) {
         $columnValueAccessor = $columnValueAccessor . " ? " . $columnValueAccessor . "->format(\"" . $this->getTimeStampFormatter() . "\") : null";
     } elseif ($column->isLobType()) {
         // we always need to make sure that the stream is rewound, otherwise nothing will
         // get written to database.
         $script .= "\nif (is_resource({$columnValueAccessor})) {\n    rewind({$columnValueAccessor});\n}";
     }
     $script .= sprintf("\n\$stmt->bindValue(%s, %s, %s);", $identifier, $columnValueAccessor, PropelTypes::getPdoTypeString($column->getType()));
     return preg_replace('/^(.+)/m', $tab . '$1', $script);
 }
Esempio n. 5
0
 /**
  * Get the PDO type of this column.
  *
  * @return int The PDO::PARAM_* value
  */
 public function getPdoType()
 {
     return PropelTypes::getPdoType($this->type);
 }
Esempio n. 6
0
 /**
  * Get the PHP snippet for binding a value to a column.
  * Warning: duplicates logic from DBAdapter::bindValue().
  * Any code modification here must be ported there.
  */
 public function getColumnBindingPHP($column, $identifier, $columnValueAccessor, $tab = "            ")
 {
     $script = '';
     $hasValuePreparation = false;
     if ($column->isTemporalType()) {
         // nothing special, the internal value was already properly formatted by the setter
     } elseif ($column->isLobType()) {
         // we always need to make sure that the stream is rewound, otherwise nothing will
         // get written to database.
         $script .= "\nif (is_resource({$columnValueAccessor})) {\n    rewind({$columnValueAccessor});\n}";
     }
     $script .= sprintf("\n\$stmt->bindValue(%s, %s, %s);", $identifier, $columnValueAccessor, PropelTypes::getPdoTypeString($column->getType()));
     return preg_replace('/^(.+)/m', $tab . '$1', $script);
 }