Changeset 17877 for branches/comu-ver2/data/module/DB/fbsql.php
- Timestamp:
- 2009/03/06 20:21:51 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/comu-ver2/data/module/DB/fbsql.php
r15532 r17877 19 19 * @author Frank M. Kromann <frank@frontbase.com> 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 Frank M. Kromann <frank@frontbase.com> 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 * @since Class functional since Release 1.7.0 … … 172 172 $params); 173 173 } else { 174 ini_set('track_errors', 1);174 @ini_set('track_errors', 1); 175 175 $this->connection = @call_user_func_array($connect_function, 176 176 $params); 177 ini_set('track_errors', $ini);177 @ini_set('track_errors', $ini); 178 178 } 179 179 … … 230 230 // Determine which queries that should return data, and which 231 231 // should return an error code only. 232 if ( DB::isManip($query)) {232 if ($this->_checkManip($query)) { 233 233 return DB_OK; 234 234 } … … 321 321 function freeResult($result) 322 322 { 323 return @fbsql_free_result($result);323 return is_resource($result) ? fbsql_free_result($result) : false; 324 324 } 325 325 … … 354 354 function commit() 355 355 { 356 @fbsql_commit( );356 @fbsql_commit($this->connection); 357 357 } 358 358 … … 367 367 function rollback() 368 368 { 369 @fbsql_rollback( );369 @fbsql_rollback($this->connection); 370 370 } 371 371 … … 432 432 function affectedRows() 433 433 { 434 if ( DB::isManip($this->last_query)) {434 if ($this->_last_query_manip) { 435 435 $result = @fbsql_affected_rows($this->connection); 436 436 } else { … … 544 544 function modifyLimitQuery($query, $from, $count, $params = array()) 545 545 { 546 if (DB::isManip($query) ) {546 if (DB::isManip($query) || $this->_next_query_manip) { 547 547 return preg_replace('/^([\s(])*SELECT/i', 548 548 "\\1SELECT TOP($count)", $query); … … 554 554 555 555 // }}} 556 // {{{ quoteSmart() 557 558 /** 559 * Formats input so it can be safely used in a query 560 * 561 * @param mixed $in the data to be formatted 562 * 563 * @return mixed the formatted data. The format depends on the input's 564 * PHP type: 565 * + null = the string <samp>NULL</samp> 566 * + boolean = string <samp>TRUE</samp> or <samp>FALSE</samp> 567 * + integer or double = the unquoted number 568 * + other (including strings and numeric strings) = 569 * the data escaped according to FrontBase's settings 570 * then encapsulated between single quotes 571 * 556 // {{{ quoteBoolean() 557 558 /** 559 * Formats a boolean value for use within a query in a locale-independent 560 * manner. 561 * 562 * @param boolean the boolean value to be quoted. 563 * @return string the quoted string. 572 564 * @see DB_common::quoteSmart() 573 * @since Method available since Release 1.6.0 574 */ 575 function quoteSmart($in) 576 { 577 if (is_int($in) || is_double($in)) { 578 return $in; 579 } elseif (is_bool($in)) { 580 return $in ? 'TRUE' : 'FALSE'; 581 } elseif (is_null($in)) { 582 return 'NULL'; 583 } else { 584 return "'" . $this->escapeSimple($in) . "'"; 585 } 586 } 587 565 * @since Method available since release 1.7.8. 566 */ 567 function quoteBoolean($boolean) { 568 return $boolean ? 'TRUE' : 'FALSE'; 569 } 570 571 // }}} 572 // {{{ quoteFloat() 573 574 /** 575 * Formats a float value for use within a query in a locale-independent 576 * manner. 577 * 578 * @param float the float value to be quoted. 579 * @return string the quoted string. 580 * @see DB_common::quoteSmart() 581 * @since Method available since release 1.7.8. 582 */ 583 function quoteFloat($float) { 584 return $this->escapeSimple(str_replace(',', '.', strval(floatval($float)))); 585 } 586 588 587 // }}} 589 588 // {{{ fbsqlRaiseError()
Note: See TracChangeset
for help on using the changeset viewer.