Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Wednesday, October 14, 2026

Diff for Metafox/lib/DB/mysql.php between version 1.2 and 1.3

version 1.2, 2005/11/07 20:37:25 version 1.3, 2011/06/17 13:56:39
Line 18 
Line 18 
  * @package    DB   * @package    DB
  * @author     Stig Bakken <ssb@php.net>   * @author     Stig Bakken <ssb@php.net>
  * @author     Daniel Convissor <danielc@php.net>   * @author     Daniel Convissor <danielc@php.net>
  * @copyright  1997-2005 The PHP Group   * @copyright  1997-2007 The PHP Group
  * @license    http://www.php.net/license/3_0.txt  PHP License 3.0   * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
  * @version    CVS: $Id$   * @version    CVS: $Id$
  * @link       http://pear.php.net/package/DB   * @link       http://pear.php.net/package/DB
Line 39  require_once 'DB/common.php';
Line 39  require_once 'DB/common.php';
  * @package    DB   * @package    DB
  * @author     Stig Bakken <ssb@php.net>   * @author     Stig Bakken <ssb@php.net>
  * @author     Daniel Convissor <danielc@php.net>   * @author     Daniel Convissor <danielc@php.net>
  * @copyright  1997-2005 The PHP Group   * @copyright  1997-2007 The PHP Group
  * @license    http://www.php.net/license/3_0.txt  PHP License 3.0   * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
  * @version    Release: 1.7.6   * @version    Release: 1.7.14RC2
  * @link       http://pear.php.net/package/DB   * @link       http://pear.php.net/package/DB
  */   */
 class DB_mysql extends DB_common  class DB_mysql extends DB_common
Line 111  class DB_mysql extends DB_common
Line 111  class DB_mysql extends DB_common
         1146 => DB_ERROR_NOSUCHTABLE,          1146 => DB_ERROR_NOSUCHTABLE,
         1216 => DB_ERROR_CONSTRAINT,          1216 => DB_ERROR_CONSTRAINT,
         1217 => DB_ERROR_CONSTRAINT,          1217 => DB_ERROR_CONSTRAINT,
           1356 => DB_ERROR_DIVZERO,
           1451 => DB_ERROR_CONSTRAINT,
           1452 => DB_ERROR_CONSTRAINT,
     );      );
   
     /**      /**
Line 236  class DB_mysql extends DB_common
Line 239  class DB_mysql extends DB_common
             $this->connection = @call_user_func_array($connect_function,              $this->connection = @call_user_func_array($connect_function,
                                                       $params);                                                        $params);
         } else {          } else {
             ini_set('track_errors', 1);              @ini_set('track_errors', 1);
             $this->connection = @call_user_func_array($connect_function,              $this->connection = @call_user_func_array($connect_function,
                                                       $params);                                                        $params);
             ini_set('track_errors', $ini);              @ini_set('track_errors', $ini);
         }          }
   
         if (!$this->connection) {          if (!$this->connection) {
Line 297  class DB_mysql extends DB_common
Line 300  class DB_mysql extends DB_common
      */       */
     function simpleQuery($query)      function simpleQuery($query)
     {      {
         $ismanip = DB::isManip($query);          $ismanip = $this->_checkManip($query);
         $this->last_query = $query;          $this->last_query = $query;
         $query = $this->modifyQuery($query);          $query = $this->modifyQuery($query);
         if ($this->_db) {          if ($this->_db) {
Line 419  class DB_mysql extends DB_common
Line 422  class DB_mysql extends DB_common
      */       */
     function freeResult($result)      function freeResult($result)
     {      {
         return @mysql_free_result($result);          return is_resource($result) ? mysql_free_result($result) : false;
     }      }
   
     // }}}      // }}}
Line 555  class DB_mysql extends DB_common
Line 558  class DB_mysql extends DB_common
      */       */
     function affectedRows()      function affectedRows()
     {      {
         if (DB::isManip($this->last_query)) {          if ($this->_last_query_manip) {
             return @mysql_affected_rows($this->connection);              return @mysql_affected_rows($this->connection);
         } else {          } else {
             return 0;              return 0;
Line 752  class DB_mysql extends DB_common
Line 755  class DB_mysql extends DB_common
   
     /**      /**
      * Quotes a string so it can be safely used as a table or column name       * Quotes a string so it can be safely used as a table or column name
        * (WARNING: using names that require this is a REALLY BAD IDEA)
      *       *
      * MySQL can't handle the backtick character (<kbd>`</kbd>) in       * WARNING:  Older versions of MySQL can't handle the backtick
      * table or column names.       * character (<kbd>`</kbd>) in table or column names.
      *       *
      * @param string $str  identifier name to be quoted       * @param string $str  identifier name to be quoted
      *       *
Line 765  class DB_mysql extends DB_common
Line 769  class DB_mysql extends DB_common
      */       */
     function quoteIdentifier($str)      function quoteIdentifier($str)
     {      {
         return '`' . $str . '`';          return '`' . str_replace('`', '``', $str) . '`';
     }      }
   
     // }}}      // }}}
Line 852  class DB_mysql extends DB_common
Line 856  class DB_mysql extends DB_common
      */       */
     function modifyLimitQuery($query, $from, $count, $params = array())      function modifyLimitQuery($query, $from, $count, $params = array())
     {      {
         if (DB::isManip($query)) {          if (DB::isManip($query) || $this->_next_query_manip) {
             return $query . " LIMIT $count";              return $query . " LIMIT $count";
         } else {          } else {
             return $query . " LIMIT $from, $count";              return $query . " LIMIT $from, $count";
Line 928  class DB_mysql extends DB_common
Line 932  class DB_mysql extends DB_common
     function tableInfo($result, $mode = null)      function tableInfo($result, $mode = null)
     {      {
         if (is_string($result)) {          if (is_string($result)) {
               // Fix for bug #11580.
               if ($this->_db) {
                   if (!@mysql_select_db($this->_db, $this->connection)) {
                       return $this->mysqlRaiseError(DB_ERROR_NODBSELECTED);
                   }
               }
   
             /*              /*
              * Probably received a table name.               * Probably received a table name.
              * Create a result resource identifier.               * Create a result resource identifier.
              */               */
             $id = @mysql_list_fields($this->dsn['database'],              $id = @mysql_query("SELECT * FROM $result LIMIT 0",
                                      $result, $this->connection);                                 $this->connection);
             $got_string = true;              $got_string = true;
         } elseif (isset($result->result)) {          } elseif (isset($result->result)) {
             /*              /*

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

Platon Group <platon@platon.org> http://platon.org/
Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top