/** * @see DBAdapter::bindValue() * * @param PDOStatement $stmt * @param string $parameter * @param mixed $value * @param ColumnMap $cMap * @param null|integer $position * * @return boolean */ public function bindValue(PDOStatement $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 ($pdoType == PDO::PARAM_BOOL) { $value = (int) $value; $pdoType = PDO::PARAM_INT; return $stmt->bindValue($parameter, $value, $pdoType); } elseif ($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); }
/** * Whether this column contains scalar values (to be used as indices). * * @param \ColumnMap $column * * @return Boolean */ private function isScalar(\ColumnMap $column) { return in_array($column->getPdoType(), array(\PDO::PARAM_BOOL, \PDO::PARAM_INT, \PDO::PARAM_STR)); }
/** * Whether this column in an integer * * @param \ColumnMap $column * * @return Boolean */ private function isInteger(\ColumnMap $column) { return $column->getPdoType() === \PDO::PARAM_INT; }