| | |
| | | } |
| | | |
| | | // Query database |
| | | |
| | | function query() |
| | | |
| | | { |
| | | |
| | | $params = func_get_args(); |
| | | |
| | | $query = array_shift($params); |
| | | |
| | | |
| | | |
| | | return $this->_query($query, 0, 0, $params); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | function limitquery() |
| | | |
| | | { |
| | | |
| | | $params = func_get_args(); |
| | | |
| | | $query = array_shift($params); |
| | | |
| | | $offset = array_shift($params); |
| | | |
| | | $numrows = array_shift($params); |
| | | |
| | | |
| | | |
| | | return $this->_query($query, $offset, $numrows, $params); |
| | | |
| | | } |
| | | |
| | | function _query($query, $offset, $numrows, $params) |
| | |
| | | return $this->_add_result($result, $query); |
| | | } |
| | | |
| | | |
| | | function num_rows($res_id=NULL) |
| | | { |
| | | if (!$this->db_handle) |
| | |
| | | return FALSE; |
| | | } |
| | | |
| | | |
| | | function affected_rows($res_id=NULL) |
| | | { |
| | | if (!$this->db_handle) |
| | |
| | | |
| | | return $this->db_handle->affectedRows(); |
| | | } |
| | | |
| | | |
| | | function insert_id($sequence = '') |
| | | { |
| | |
| | | return $result->fetchRow(MDB2_FETCHMODE_ASSOC); |
| | | } |
| | | |
| | | function quoteIdentifier ( $str ) |
| | | |
| | | function quote($input, $type=null) |
| | | { |
| | | |
| | | if (!$this->db_handle) |
| | | |
| | | $this->db_connect('r'); |
| | | |
| | | |
| | | |
| | | return $this->db_handle->quoteIdentifier($str); |
| | | |
| | | return $this->db_handle->quote($input, $type); |
| | | } |
| | | |
| | | |
| | | function quoteIdentifier($str) |
| | | { |
| | | if (!$this->db_handle) |
| | | $this->db_connect('r'); |
| | | |
| | | return $this->db_handle->quoteIdentifier($str); |
| | | } |
| | | |
| | | function quote_identifier($str) |
| | | { |
| | | return $this->quoteIdentifier($str); |
| | | } |
| | | |
| | | |
| | | function unixtimestamp($field) |
| | | |
| | | { |
| | | |
| | | switch($this->db_provider) |
| | | |
| | | { |
| | | |
| | | case 'pgsql': |
| | | |
| | | return "EXTRACT (EPOCH FROM $field)"; |
| | | |
| | | break; |
| | | |
| | | default: |
| | | |
| | | return "UNIX_TIMESTAMP($field)"; |
| | | |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | function _add_result($res, $query) |
| | | { |