Aleksander Machniak
2012-07-08 3d231c88fa299787fe52e00773d03a4efa51590d
CS fixes
6 files modified
78 ■■■■■ changed files
program/include/rcube_db.php 68 ●●●●● patch | view | raw | blame | history
program/include/rcube_db_mssql.php 2 ●●● patch | view | raw | blame | history
program/include/rcube_db_mysql.php 2 ●●● patch | view | raw | blame | history
program/include/rcube_db_pgsql.php patch | view | raw | blame | history
program/include/rcube_db_sqlite.php 4 ●●●● patch | view | raw | blame | history
program/include/rcube_db_sqlsrv.php 2 ●●● patch | view | raw | blame | history
program/include/rcube_db.php
@@ -1,6 +1,6 @@
<?php
/*
/**
 +-----------------------------------------------------------------------+
 | program/include/rcube_db.php                                          |
 |                                                                       |
@@ -41,9 +41,9 @@
    protected $conn_failure = false;
    protected $a_query_results = array('dummy');
    protected $last_res_id = 0;
    protected $db_index        = 0;
    protected $tables;
    protected $variables;
    protected $db_index = 0;
    protected $options = array(
        // column/table quotes
@@ -254,7 +254,7 @@
    /**
     * Getter for error state
     *
     * @param  boolean  True on error
     * @return boolean True on error
     */
    public function is_error()
    {
@@ -264,7 +264,7 @@
    /**
     * Connection state checker
     *
     * @param  boolean  True if in connected state
     * @return boolean True if in connected state
     */
    public function is_connected()
    {
@@ -273,7 +273,8 @@
    /**
     * Is database replication configured?
     * This returns true if dsnw != dsnr
     *
     * @return bool Returns true if dsnw != dsnr
     */
    public function is_replicated()
    {
@@ -319,11 +320,11 @@
     * Execute a SQL query with limits
     *
     * @param  string  SQL query to execute
     * @param  number  Offset for LIMIT statement
     * @param  number  Number of rows for LIMIT statement
     * @param int    Offset for LIMIT statement
     * @param int    Number of rows for LIMIT statement
     * @param  mixed   Values to be inserted in query
     *
     * @return number  Query handle identifier
     * @return int Query handle identifier
     */
    public function limitquery()
    {
@@ -339,10 +340,11 @@
     * Execute a SQL query with limits
     *
     * @param  string $query   SQL query to execute
     * @param  number $offset  Offset for LIMIT statement
     * @param  number $numrows Number of rows for LIMIT statement
     * @param int    $offset  Offset for LIMIT statement
     * @param int    $numrows Number of rows for LIMIT statement
     * @param  array  $params  Values to be inserted in query
     * @return number  Query handle identifier
     *
     * @return int Query handle identifier
     */
    protected function _query($query, $offset, $numrows, $params)
    {
@@ -400,7 +402,8 @@
     * Get number of affected rows for the last query
     *
     * @param  number $res_id Optional query handle identifier
     * @return mixed   Number of rows or false on failure
     *
     * @return int Number of rows or false on failure
     */
    public function affected_rows($res_id = null)
    {
@@ -439,7 +442,7 @@
     * Get an associative array for one row
     * If no query handle is specified, the last query will be taken as reference
     *
     * @param  number $res_id Optional query handle identifier
     * @param int $res_id Optional query handle identifier
     *
     * @return mixed   Array with col values or false on failure
     */
@@ -453,7 +456,7 @@
     * Get an index array for one row
     * If no query handle is specified, the last query will be taken as reference
     *
     * @param  number $res_id  Optional query handle identifier
     * @param int $res_id Optional query handle identifier
     *
     * @return mixed   Array with col values or false on failure
     */
@@ -467,7 +470,7 @@
     * Get col values for a result row
     *
     * @param  PDOStatement $result Result handle
     * @param  number       $mode   Fetch mode identifier
     * @param int          $mode   Fetch mode identifier
     *
     * @return mixed  Array with col values or false on failure
     */
@@ -527,7 +530,7 @@
    /**
     * Returns list of columns in database table
     *
     * @param string Table name
     * @param string $table Table name
     *
     * @return array List of table cols
     */
@@ -660,9 +663,9 @@
    /**
     * Return SQL statement to convert from a unix timestamp
     *
     * @param  string $timestamp Field name
     * @param int $timestamp Unix timestamp
     *
     * @return string  SQL statement to use in query
     * @return string Date string in db-specific format
     */
    public function fromunixtime($timestamp)
    {
@@ -752,22 +755,21 @@
     *
     * @param  object $res Query handle
     *
     * @return mixed   Handle ID
     * @return int Handle ID
     */
    protected function _add_result($res)
    {
        $res_id = sizeof($this->a_query_results);
        $this->last_res_id = $res_id;
        $this->a_query_results[$res_id] = $res;
        $this->last_res_id = sizeof($this->a_query_results);
        $this->a_query_results[$this->last_res_id] = $res;
        return $res_id;
        return $this->last_res_id;
    }
    /**
     * Resolves a given handle ID and returns the according query handle
     * If no ID is specified, the last resource handle will be returned
     *
     * @param  number $res_id Handle ID
     * @param int $res_id Handle ID
     *
     * @return mixed   Resource handle or false on failure
     */
@@ -844,7 +846,8 @@
        if (($pos = strpos($dsn, '://')) !== false) {
            $str = substr($dsn, 0, $pos);
            $dsn = substr($dsn, $pos + 3);
        } else {
        }
        else {
            $str = $dsn;
            $dsn = null;
        }
@@ -854,7 +857,8 @@
        if (preg_match('|^(.+?)\((.*?)\)$|', $str, $arr)) {
            $parsed['phptype']  = $arr[1];
            $parsed['dbsyntax'] = !$arr[2] ? $arr[1] : $arr[2];
        } else {
        }
        else {
            $parsed['phptype']  = $str;
            $parsed['dbsyntax'] = $str;
        }
@@ -871,7 +875,8 @@
            if (($pos = strpos($str, ':')) !== false) {
                $parsed['username'] = rawurldecode(substr($str, 0, $pos));
                $parsed['password'] = rawurldecode(substr($str, $pos + 1));
            } else {
            }
            else {
                $parsed['username'] = rawurldecode($str);
            }
        }
@@ -900,9 +905,11 @@
                $pos = strrpos($proto_opts, '/');
                $dsn = substr($proto_opts, $pos + 1);
                $proto_opts = substr($proto_opts, 0, $pos);
            } elseif (strpos($dsn, '/') !== false) {
            }
            else if (strpos($dsn, '/') !== false) {
                list($proto_opts, $dsn) = explode('/', $dsn, 2);
            } else {
            }
            else {
                $proto_opts = $dsn;
                $dsn = null;
            }
@@ -934,7 +941,8 @@
                $dsn = substr($dsn, $pos + 1);
                if (strpos($dsn, '&') !== false) {
                    $opts = explode('&', $dsn);
                } else { // database?param1=value1
                }
                else { // database?param1=value1
                    $opts = array($dsn);
                }
                foreach ($opts as $opt) {
program/include/rcube_db_mssql.php
@@ -1,6 +1,6 @@
<?php
/*
/**
 +-----------------------------------------------------------------------+
 | program/include/rcube_db_mssql.php                                    |
 |                                                                       |
program/include/rcube_db_mysql.php
@@ -1,6 +1,6 @@
<?php
/*
/**
 +-----------------------------------------------------------------------+
 | program/include/rcube_db_mysql.php                                    |
 |                                                                       |
program/include/rcube_db_pgsql.php
program/include/rcube_db_sqlite.php
@@ -1,6 +1,6 @@
<?php
/*
/**
 +-----------------------------------------------------------------------+
 | program/include/rcube_db_sqlite.php                                   |
 |                                                                       |
@@ -134,7 +134,7 @@
    /**
     * Returns list of columns in database table
     *
     * @param string Table name
     * @param string $table Table name
     *
     * @return array List of table cols
     */
program/include/rcube_db_sqlsrv.php
@@ -1,6 +1,6 @@
<?php
/*
/**
 +-----------------------------------------------------------------------+
 | program/include/rcube_db_sqlsrv.php                                   |
 |                                                                       |