Changeset 454 for trunk/plugins

Show
Ignore:
Timestamp:
04/22/07 14:13:48 (19 months ago)
Author:
michiel
Message:

switch from PEAR::DB to PEAR::MDB2
This is the first round of work. Everything is working now.
We need to replace several calls of $db->query with ->execute
and also lots of code to sanitize data should be replaced
with the MDB2 methods for this.

Make sure you have the PEAR::MDB2 package and the
correct MDB2_Driver_* for your database backend.

for mysql users:
pear install MDB2 MDB2_Driver_mysql

for pgsql users:
pear install MDB2 MDB2_Driver_pgsql

Re #119

Location:
trunk/plugins
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/plugins/acronyms.php

    r312 r454  
    2525                        die($res->getMessage()); 
    2626                } 
    27                 while ($res->fetchInto($row, DB_FETCHMODE_ASSOC)) { 
     27                while ($row = $res->fetchRow(MDB2_FETCHMODE_ASSOC)) { 
    2828                        $this->_acronyms[$row["id"]] = array($row["acronym"], $row["description"]); 
    2929                } 
     
    128128                                $sql = sprintf("SELECT id FROM acronyms WHERE acronym='%s' AND description='%s'", $acro["acronym"], $acro["description"]); 
    129129                                $res = $this->_mvblog->db->query($sql); 
    130                                 $res->fetchInto($row); 
     130                                $row = $res->fetchRow(); 
    131131                                $this->_acronyms[$row[0]] = array($acro["acronym"], $acronym["description"]); 
    132132                        } 
  • trunk/plugins/altarchive.php

    r404 r454  
    3232                $sql = "SELECT date FROM articles WHERE active=1 AND public=1 ORDER BY date DESC"; 
    3333                $res = $this->_mvblog->db->query($sql); 
    34                 while ($res->fetchInto($row)) { 
     34                while ($row = $res->fetchRow()) { 
    3535                        $month = date("m", $row[0]); 
    3636                        $year  = date("Y", $row[0]); 
     
    4545                $sql = "SELECT * FROM settings WHERE settingname LIKE 'altarchive_%'"; 
    4646                $res = $this->_mvblog->db->query($sql); 
    47                 while ($res->fetchInto($row, DB_FETCHMODE_ASSOC)) { 
     47                while ($row = $res->fetchRow(MDB2_FETCHMODE_ASSOC)) { 
    4848                        $this->_settings[$row["settingname"]] = $row["settingvalue"]; 
    4949                } 
     
    148148                $sql = "SELECT COUNT(*) FROM settings WHERE settingname = 'altarchive_showdefaultcss'"; 
    149149                $res = $this->_mvblog->db->query($sql); 
    150                 $res->fetchInto($row); 
     150                $row = $res->fetchRow(); 
    151151                if ($row[0]) { 
    152152                        /* yes, so update */