Changeset d7cb774 in github for program/include/rcube_db.inc


Ignore:
Timestamp:
Oct 25, 2005 11:04:17 AM (8 years ago)
Author:
svncommit <devs@…>
Branches:
master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
Children:
d13c369
Parents:
e0ed972
Message:

more pear/mdb2 integration

File:
1 edited

Legend:

Unmodified
Added
Removed
  • program/include/rcube_db.inc

    r53560c5 rd7cb774  
    102102    } 
    103103 
    104     // Query database (read operations) 
    105      
    106     function query($query, $offset=0, $numrows=0) 
     104    // Query database 
     105     
     106    function query() 
     107    { 
     108                $params = func_get_args(); 
     109                $query = array_shift($params); 
     110                 
     111                return $this->_query($query, 0, 0, $params); 
     112    } 
     113    
     114        function limitquery() 
     115    { 
     116                $params = func_get_args(); 
     117                $query = array_shift($params); 
     118                $offset = array_shift($params); 
     119                $numrows = array_shift($params); 
     120                 
     121                return $this->_query($query, $offset, $numrows, $params); 
     122    } 
     123     
     124    function _query($query, $offset, $numrows, $params) 
    107125    { 
    108126        // Read or write ? 
     
    119137        if ($numrows || $offset) 
    120138                        { 
    121                         $result = $this->db_handle->limitQuery($query,$offset,$numrows); 
     139                        $result = $this->db_handle->limitQuery($query,$offset,$numrows,$params); 
    122140                        } 
    123141        else     
    124                         $result = $this->db_handle->query($query); 
    125          
     142                        $result = $this->db_handle->query($query,$params); 
     143 
    126144        if (DB::isError($result)) 
     145                        { 
    127146            raise_error(array('code' => 500, 
    128147                              'type' => 'db', 
     
    130149                              'file' => __FILE__,  
    131150                              'message' => $result->getMessage()), TRUE, FALSE); 
    132          
     151             return false; 
     152            } 
     153 
    133154        return $this->_add_result($result, $query); 
    134155    } 
     
    197218    } 
    198219 
     220        function quoteIdentifier ( $str ) 
     221        { 
     222                if (!$this->db_handle) 
     223                        $this->db_connect('r'); 
     224                         
     225                return $this->db_handle->quoteIdentifier($str); 
     226        } 
     227         
     228        function unixtimestamp($field) 
     229        { 
     230                switch($this->db_provider) 
     231                        { 
     232                        case 'pgsql': 
     233                                return "EXTRACT (EPOCH FROM $field)"; 
     234                                break; 
     235                        default: 
     236                                return "UNIX_TIMESTAMP($field)"; 
     237                        } 
     238        } 
     239         
    199240    function _add_result($res, $query) 
    200241    { 
Note: See TracChangeset for help on using the changeset viewer.