/** * @see AdapterInterface::bindValue() * * @param StatementInterface $stmt * @param string $parameter * @param mixed $value * @param ColumnMap $cMap * @param null|integer $position * * @return boolean */ public function bindValue(StatementInterface $stmt, $parameter, $value, ColumnMap $cMap, $position = null) { $pdoType = $cMap->getPdoType(); // 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 (\PDO::PARAM_BOOL === $pdoType) { $value = (int) $value; $pdoType = \PDO::PARAM_INT; return $stmt->bindValue($parameter, $value, $pdoType); } if ($cMap->isTemporal()) { $value = $this->formatTemporalValue($value, $cMap); } elseif (is_resource($value) && $cMap->isLob()) { // we always need to make sure that the stream is rewound, otherwise nothing will // get written to database. rewind($value); } return $stmt->bindValue($parameter, $value, $pdoType); }
/** * @see AdapterInterface::bindValue() * * @param StatementInterface $stmt * @param string $parameter * @param mixed $value * @param ColumnMap $cMap * @param null|integer $position * * @return boolean */ public function bindValue(StatementInterface $stmt, $parameter, $value, ColumnMap $cMap, $position = null) { if (PropelTypes::CLOB_EMU === $cMap->getType()) { return $stmt->bindParam(':p' . $position, $value, $cMap->getPdoType(), strlen($value)); } if ($cMap->isTemporal()) { $value = $this->formatTemporalValue($value, $cMap); } elseif (is_resource($value) && $cMap->isLob()) { // we always need to make sure that the stream is rewound, otherwise nothing will // get written to database. rewind($value); } return $stmt->bindValue($parameter, $value, $cMap->getPdoType()); }
/** * Whether this column contains scalar values (to be used as indices). * * @param ColumnMap $column * * @return bool */ private function isScalar(ColumnMap $column) { return in_array($column->getPdoType(), array(\PDO::PARAM_BOOL, \PDO::PARAM_INT, \PDO::PARAM_STR)); }