From bdd30aba4e73500aeb1c27f4440dde9cf04f776d Mon Sep 17 00:00:00 2001 From: Garvin Hicking Date: Fri, 7 Jan 2011 10:41:06 +0000 Subject: [PATCH] sqlite both/assoc/num fix --- docs/NEWS | 3 +++ include/db/pdo-sqlite.inc.php | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/NEWS b/docs/NEWS index e1d7164f..00216528 100644 --- a/docs/NEWS +++ b/docs/NEWS @@ -3,6 +3,9 @@ Version 1.6 () ------------------------------------------------------------------------ + * Fix PDO::SQLite to properly fetch the requested row type + (assoc/both/num), important for staticpage plugin + * TPL fixes for upcoming Smarty3, thanks to timbalu * Experimental: Config-Groups for template and plugin options, diff --git a/include/db/pdo-sqlite.inc.php b/include/db/pdo-sqlite.inc.php index 8c59c642..df858ea7 100644 --- a/include/db/pdo-sqlite.inc.php +++ b/include/db/pdo-sqlite.inc.php @@ -18,7 +18,7 @@ function serendipity_db_logmsg($msgstr) { * @param int Bitmask to tell whether to fetch numerical/associative arrays * @return array Propper array containing the ressource results */ -function serendipity_db_sqlite_fetch_array($row, $type = PDO::FETCH_BOTH) +function serendipity_db_sqlite_fetch_array($row, $type = PDO::FETCH_ASSOC) { static $search = array('%00', '%25'); static $replace = array("\x00", '%'); @@ -253,7 +253,7 @@ function &serendipity_db_query($sql, $single = false, $result_type = "both", $re $rows = array(); foreach($serendipity['dbSth']->fetchAll($result_type) AS $row) { - $row = serendipity_db_sqlite_fetch_array($row); + $row = serendipity_db_sqlite_fetch_array($row, $result_type); if (!empty($assocKey)) { // You can fetch a key-associated array via the two function parameters assocKey and assocVal if (empty($assocVal)) {