コード例 #1
0
ファイル: OraclePlatform.php プロジェクト: smoqs/Propel2
 /**
  * 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);
 }
コード例 #2
0
ファイル: ObjectBuilder.php プロジェクト: SwissalpS/Propel2
 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;
 }
コード例 #3
0
ファイル: Column.php プロジェクト: bondarovich/Propel2
 /**
  * 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());
 }
コード例 #4
0
 /**
  * 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);
 }
コード例 #5
0
ファイル: ColumnMap.php プロジェクト: disider/Propel2
 /**
  * Get the PDO type of this column.
  *
  * @return int The PDO::PARAM_* value
  */
 public function getPdoType()
 {
     return PropelTypes::getPdoType($this->type);
 }
コード例 #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);
 }