Changeset 18609 for tmp/version-2_5-test/data/module/DB/sybase.php
- Timestamp:
- 2010/03/11 10:35:11 (16 years ago)
- File:
-
- 1 edited
-
tmp/version-2_5-test/data/module/DB/sybase.php (modified) (15 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tmp/version-2_5-test/data/module/DB/sybase.php
r15532 r18609 18 18 * @package DB 19 19 * @author Sterling Hughes <[email protected]> 20 * @author Ant ?io Carlos Ven?cio J?ior <[email protected]>20 * @author Antônio Carlos Venâncio Júnior <[email protected]> 21 21 * @author Daniel Convissor <[email protected]> 22 * @copyright 1997-200 5The PHP Group22 * @copyright 1997-2007 The PHP Group 23 23 * @license http://www.php.net/license/3_0.txt PHP License 3.0 24 24 * @version CVS: $Id$ … … 43 43 * @package DB 44 44 * @author Sterling Hughes <[email protected]> 45 * @author Ant ?io Carlos Ven?cio J?ior <[email protected]>45 * @author Antônio Carlos Venâncio Júnior <[email protected]> 46 46 * @author Daniel Convissor <[email protected]> 47 * @copyright 1997-200 5The PHP Group47 * @copyright 1997-2007 The PHP Group 48 48 * @license http://www.php.net/license/3_0.txt PHP License 3.0 49 * @version Release: @package_version@49 * @version Release: 1.7.14RC1 50 50 * @link http://pear.php.net/package/DB 51 51 */ … … 249 249 function simpleQuery($query) 250 250 { 251 $ismanip = DB::isManip($query);251 $ismanip = $this->_checkManip($query); 252 252 $this->last_query = $query; 253 if ( !@sybase_select_db($this->_db, $this->connection)) {253 if ($this->_db && !@sybase_select_db($this->_db, $this->connection)) { 254 254 return $this->sybaseRaiseError(DB_ERROR_NODBSELECTED); 255 255 } … … 371 371 function freeResult($result) 372 372 { 373 return @sybase_free_result($result);373 return is_resource($result) ? sybase_free_result($result) : false; 374 374 } 375 375 … … 436 436 function affectedRows() 437 437 { 438 if ( DB::isManip($this->last_query)) {438 if ($this->_last_query_manip) { 439 439 $result = @sybase_affected_rows($this->connection); 440 440 } else { … … 463 463 { 464 464 $seqname = $this->getSequenceName($seq_name); 465 if ( !@sybase_select_db($this->_db, $this->connection)) {465 if ($this->_db && !@sybase_select_db($this->_db, $this->connection)) { 466 466 return $this->sybaseRaiseError(DB_ERROR_NODBSELECTED); 467 467 } … … 480 480 } 481 481 } elseif (!DB::isError($result)) { 482 $result = &$this->query("SELECT @@IDENTITY FROM $seqname");482 $result = $this->query("SELECT @@IDENTITY FROM $seqname"); 483 483 $repeat = 0; 484 484 } else { … … 530 530 531 531 // }}} 532 // {{{ quoteFloat() 533 534 /** 535 * Formats a float value for use within a query in a locale-independent 536 * manner. 537 * 538 * @param float the float value to be quoted. 539 * @return string the quoted string. 540 * @see DB_common::quoteSmart() 541 * @since Method available since release 1.7.8. 542 */ 543 function quoteFloat($float) { 544 return $this->escapeSimple(str_replace(',', '.', strval(floatval($float)))); 545 } 546 547 // }}} 532 548 // {{{ autoCommit() 533 549 … … 559 575 { 560 576 if ($this->transaction_opcount > 0) { 561 if ( !@sybase_select_db($this->_db, $this->connection)) {577 if ($this->_db && !@sybase_select_db($this->_db, $this->connection)) { 562 578 return $this->sybaseRaiseError(DB_ERROR_NODBSELECTED); 563 579 } … … 582 598 { 583 599 if ($this->transaction_opcount > 0) { 584 if ( !@sybase_select_db($this->_db, $this->connection)) {600 if ($this->_db && !@sybase_select_db($this->_db, $this->connection)) { 585 601 return $this->sybaseRaiseError(DB_ERROR_NODBSELECTED); 586 602 } … … 643 659 { 644 660 static $error_regexps; 661 662 // PHP 5.2+ prepends the function name to $php_errormsg, so we need 663 // this hack to work around it, per bug #9599. 664 $errormsg = preg_replace('/^sybase[a-z_]+\(\): /', '', $errormsg); 665 645 666 if (!isset($error_regexps)) { 646 667 $error_regexps = array( … … 675 696 '/^There are fewer columns in the INSERT statement than values specified/i' 676 697 => DB_ERROR_VALUE_COUNT_ON_ROW, 698 '/Divide by zero/i' 699 => DB_ERROR_DIVZERO, 677 700 ); 678 701 } … … 715 738 * Create a result resource identifier. 716 739 */ 717 if ( !@sybase_select_db($this->_db, $this->connection)) {740 if ($this->_db && !@sybase_select_db($this->_db, $this->connection)) { 718 741 return $this->sybaseRaiseError(DB_ERROR_NODBSELECTED); 719 742 } … … 812 835 $tableName = $table; 813 836 814 // get unique/primary keys 815 $res = $this->getAll("sp_helpindex $table", DB_FETCHMODE_ASSOC); 816 817 if (!isset($res[0]['index_description'])) { 837 /* We're running sp_helpindex directly because it doesn't exist in 838 * older versions of ASE -- unfortunately, we can't just use 839 * DB::isError() because the user may be using callback error 840 * handling. */ 841 $res = @sybase_query("sp_helpindex $table", $this->connection); 842 843 if ($res === false || $res === true) { 844 // Fake a valid response for BC reasons. 818 845 return ''; 819 846 } 820 847 821 foreach ($res as $val) { 848 while (($val = sybase_fetch_assoc($res)) !== false) { 849 if (!isset($val['index_keys'])) { 850 /* No useful information returned. Break and be done with 851 * it, which preserves the pre-1.7.9 behaviour. */ 852 break; 853 } 854 822 855 $keys = explode(', ', trim($val['index_keys'])); 823 856 … … 834 867 } 835 868 } 869 870 sybase_free_result($res); 836 871 837 872 }
Note: See TracChangeset
for help on using the changeset viewer.
