pdo statement->execute expects either the prepared statement with already bound parameters OR an array of the vars to be bound. It can NOT handle them MIXED

This commit is contained in:
Klaus Leithoff 2010-03-04 12:05:42 +00:00
parent 3e33651c5d
commit 7e34a7c999

View File

@ -326,16 +326,24 @@ class sqlfs_stream_wrapper implements iface_stream_wrapper
if ($this->operation == self::STORE2FS) if ($this->operation == self::STORE2FS)
{ {
$stmt = self::$pdo->prepare('UPDATE '.self::TABLE.' SET fs_size=:fs_size,fs_mime=:fs_mime,fs_modifier=:fs_modifier,fs_modified=:fs_modified WHERE fs_id=:fs_id'); $stmt = self::$pdo->prepare('UPDATE '.self::TABLE.' SET fs_size=:fs_size,fs_mime=:fs_mime,fs_modifier=:fs_modifier,fs_modified=:fs_modified WHERE fs_id=:fs_id');
if (!($ret = $stmt->execute($values)))
{
error_log(__METHOD__."() execute() failed! errorInfo()=".array2string(self::$pdo->errorInfo()));
}
} }
else else
{ {
$stmt = self::$pdo->prepare('UPDATE '.self::TABLE.' SET fs_size=:fs_size,fs_mime=:fs_mime,fs_modifier=:fs_modifier,fs_modified=:fs_modified,fs_content=:fs_content WHERE fs_id=:fs_id'); $stmt = self::$pdo->prepare('UPDATE '.self::TABLE.' SET fs_size=:fs_size,fs_mime=:fs_mime,fs_modifier=:fs_modifier,fs_modified=:fs_modified,fs_content=:fs_content WHERE fs_id=:fs_id');
$this->stream_seek(0,SEEK_SET); // rewind to the start $this->stream_seek(0,SEEK_SET); // rewind to the start
foreach($values as $name => &$value)
{
$stmt->bindParam($name,$value);
}
$stmt->bindParam('fs_content', $this->opened_stream, PDO::PARAM_LOB); $stmt->bindParam('fs_content', $this->opened_stream, PDO::PARAM_LOB);
} if (!($ret = $stmt->execute()))
if (!($ret = $stmt->execute($values))) {
{ error_log(__METHOD__."() execute() failed! errorInfo()=".array2string(self::$pdo->errorInfo()));
error_log(__METHOD__."() execute() failed! errorInfo()=".array2string(self::$pdo->errorInfo())); }
} }
} }
$ret = fclose($this->opened_stream) && $ret; $ret = fclose($this->opened_stream) && $ret;