From 51ffc2fc97975f2271732cb1111cbf213be0d3e5 Mon Sep 17 00:00:00 2001 From: Klaus Leithoff Date: Thu, 4 Mar 2010 12:04:01 +0000 Subject: [PATCH] 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 --- phpgwapi/inc/class.sqlfs_stream_wrapper.inc.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/phpgwapi/inc/class.sqlfs_stream_wrapper.inc.php b/phpgwapi/inc/class.sqlfs_stream_wrapper.inc.php index 19a88087f9..8200b399c6 100644 --- a/phpgwapi/inc/class.sqlfs_stream_wrapper.inc.php +++ b/phpgwapi/inc/class.sqlfs_stream_wrapper.inc.php @@ -326,16 +326,24 @@ class sqlfs_stream_wrapper implements iface_stream_wrapper 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'); + if (!($ret = $stmt->execute($values))) + { + error_log(__METHOD__."() execute() failed! errorInfo()=".array2string(self::$pdo->errorInfo())); + } } 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'); $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); - } - if (!($ret = $stmt->execute($values))) - { - error_log(__METHOD__."() execute() failed! errorInfo()=".array2string(self::$pdo->errorInfo())); + if (!($ret = $stmt->execute())) + { + error_log(__METHOD__."() execute() failed! errorInfo()=".array2string(self::$pdo->errorInfo())); + } } } $ret = fclose($this->opened_stream) && $ret;