summaryrefslogtreecommitdiff
path: root/program/include/rcube_mdb2.inc
diff options
context:
space:
mode:
Diffstat (limited to 'program/include/rcube_mdb2.inc')
-rwxr-xr-xprogram/include/rcube_mdb2.inc52
1 files changed, 21 insertions, 31 deletions
diff --git a/program/include/rcube_mdb2.inc b/program/include/rcube_mdb2.inc
index f6fde8dd5..35973ad5d 100755
--- a/program/include/rcube_mdb2.inc
+++ b/program/include/rcube_mdb2.inc
@@ -102,39 +102,24 @@ class rcube_db
}
// 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)
@@ -168,6 +153,7 @@ class rcube_db
return $this->_add_result($result, $query);
}
+
function num_rows($res_id=NULL)
{
if (!$this->db_handle)
@@ -181,6 +167,7 @@ class rcube_db
return FALSE;
}
+
function affected_rows($res_id=NULL)
{
if (!$this->db_handle)
@@ -189,6 +176,7 @@ class rcube_db
return $this->db_handle->affectedRows();
}
+
function insert_id($sequence = '')
{
if (!$this->db_handle || $this->db_mode=='r')
@@ -212,42 +200,44 @@ class rcube_db
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->quote($input, $type);
+ }
+
- return $this->db_handle->quoteIdentifier($str);
+ function quoteIdentifier($str)
+ {
+ if (!$this->db_handle)
+ $this->db_connect('r');
+ return $this->db_handle->quoteIdentifier($str);
}
-
- function unixtimestamp($field)
+ function quote_identifier($str)
{
+ return $this->quoteIdentifier($str);
+ }
- switch($this->db_provider)
+ 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)
{
// sql error occured