From 6b557983c48369a6828647ca06cd86ae32aee127 Mon Sep 17 00:00:00 2001 From: Shish Date: Fri, 31 Dec 2010 20:25:03 +0000 Subject: [PATCH] more PDO compat --- core/config.class.php | 2 +- core/database.class.php | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/core/config.class.php b/core/config.class.php index 1295da6a..f45c0628 100644 --- a/core/config.class.php +++ b/core/config.class.php @@ -175,7 +175,7 @@ class DatabaseConfig extends BaseConfig { $this->values = $cached; } else { - $this->values = $this->database->db->GetAssoc("SELECT name, value FROM config"); + $this->values = $this->database->db->query("SELECT name, value FROM config")->fetchAll(); $this->database->cache->set("config", $this->values); } } diff --git a/core/database.class.php b/core/database.class.php index 8fccb158..373e74a6 100644 --- a/core/database.class.php +++ b/core/database.class.php @@ -274,6 +274,7 @@ class Database { global $database_dsn, $cache_dsn; # FIXME: translate database URI into something PDO compatible + include "config.php"; #$db_proto = $database_dsn; #$db_host = $database_dsn; #$db_name = $database_dsn; @@ -320,7 +321,7 @@ class Database { * Execute an SQL query and return a 2D array */ public function get_all($query, $args=array()) { - $result = $this->db->fetchAll($query, $args); + $result = $this->db->query($query, $args)->fetchAll(); return $result; } @@ -328,12 +329,12 @@ class Database { * Execute an SQL query and return a single row */ public function get_row($query, $args=array()) { - $result = $this->db->fetch($query, $args); + $result = $this->db->query($query, $args)->fetchAll(); if(count($result) == 0) { return null; } else { - return $result; + return $result[0]; } }