Changeset 17877 for branches/comu-ver2/data/module/DB/mysql.php
- Timestamp:
- 2009/03/06 20:21:51 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/comu-ver2/data/module/DB/mysql.php
r15532 r17877 19 19 * @author Stig Bakken <ssb@php.net> 20 20 * @author Daniel Convissor <danielc@php.net> 21 * @copyright 1997-200 5The PHP Group21 * @copyright 1997-2007 The PHP Group 22 22 * @license http://www.php.net/license/3_0.txt PHP License 3.0 23 23 * @version CVS: $Id$ … … 40 40 * @author Stig Bakken <ssb@php.net> 41 41 * @author Daniel Convissor <danielc@php.net> 42 * @copyright 1997-200 5The PHP Group42 * @copyright 1997-2007 The PHP Group 43 43 * @license http://www.php.net/license/3_0.txt PHP License 3.0 44 * @version Release: @package_version@44 * @version Release: 1.7.14RC1 45 45 * @link http://pear.php.net/package/DB 46 46 */ … … 112 112 1216 => DB_ERROR_CONSTRAINT, 113 113 1217 => DB_ERROR_CONSTRAINT, 114 1356 => DB_ERROR_DIVZERO, 115 1451 => DB_ERROR_CONSTRAINT, 116 1452 => DB_ERROR_CONSTRAINT, 114 117 ); 115 118 … … 237 240 $params); 238 241 } else { 239 ini_set('track_errors', 1);242 @ini_set('track_errors', 1); 240 243 $this->connection = @call_user_func_array($connect_function, 241 244 $params); 242 ini_set('track_errors', $ini);245 @ini_set('track_errors', $ini); 243 246 } 244 247 … … 298 301 function simpleQuery($query) 299 302 { 300 $ismanip = DB::isManip($query);303 $ismanip = $this->_checkManip($query); 301 304 $this->last_query = $query; 302 305 $query = $this->modifyQuery($query); … … 420 423 function freeResult($result) 421 424 { 422 return @mysql_free_result($result);425 return is_resource($result) ? mysql_free_result($result) : false; 423 426 } 424 427 … … 556 559 function affectedRows() 557 560 { 558 if ( DB::isManip($this->last_query)) {561 if ($this->_last_query_manip) { 559 562 return @mysql_affected_rows($this->connection); 560 563 } else { … … 753 756 /** 754 757 * Quotes a string so it can be safely used as a table or column name 755 * 756 * MySQL can't handle the backtick character (<kbd>`</kbd>) in 757 * table or column names. 758 * (WARNING: using names that require this is a REALLY BAD IDEA) 759 * 760 * WARNING: Older versions of MySQL can't handle the backtick 761 * character (<kbd>`</kbd>) in table or column names. 758 762 * 759 763 * @param string $str identifier name to be quoted … … 766 770 function quoteIdentifier($str) 767 771 { 768 return '`' . $str. '`';772 return '`' . str_replace('`', '``', $str) . '`'; 769 773 } 770 774 … … 853 857 function modifyLimitQuery($query, $from, $count, $params = array()) 854 858 { 855 if (DB::isManip($query) ) {859 if (DB::isManip($query) || $this->_next_query_manip) { 856 860 return $query . " LIMIT $count"; 857 861 } else { … … 929 933 { 930 934 if (is_string($result)) { 935 // Fix for bug #11580. 936 if ($this->_db) { 937 if (!@mysql_select_db($this->_db, $this->connection)) { 938 return $this->mysqlRaiseError(DB_ERROR_NODBSELECTED); 939 } 940 } 941 931 942 /* 932 943 * Probably received a table name. 933 944 * Create a result resource identifier. 934 945 */ 935 $id = @mysql_ list_fields($this->dsn['database'],936 $result,$this->connection);946 $id = @mysql_query("SELECT * FROM $result LIMIT 0", 947 $this->connection); 937 948 $got_string = true; 938 949 } elseif (isset($result->result)) {
Note: See TracChangeset
for help on using the changeset viewer.