sqlite both/assoc/num fix

This commit is contained in:
Garvin Hicking 2011-01-07 10:41:06 +00:00
parent 334e7a9ba6
commit bf39c311a3
2 changed files with 5 additions and 2 deletions

View File

@ -3,6 +3,9 @@
Version 1.6 () 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 * TPL fixes for upcoming Smarty3, thanks to timbalu
* Experimental: Config-Groups for template and plugin options, * Experimental: Config-Groups for template and plugin options,

View File

@ -18,7 +18,7 @@ function serendipity_db_logmsg($msgstr) {
* @param int Bitmask to tell whether to fetch numerical/associative arrays * @param int Bitmask to tell whether to fetch numerical/associative arrays
* @return array Propper array containing the ressource results * @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 $search = array('%00', '%25');
static $replace = array("\x00", '%'); static $replace = array("\x00", '%');
@ -253,7 +253,7 @@ function &serendipity_db_query($sql, $single = false, $result_type = "both", $re
$rows = array(); $rows = array();
foreach($serendipity['dbSth']->fetchAll($result_type) AS $row) { 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)) { if (!empty($assocKey)) {
// You can fetch a key-associated array via the two function parameters assocKey and assocVal // You can fetch a key-associated array via the two function parameters assocKey and assocVal
if (empty($assocVal)) { if (empty($assocVal)) {