Changeset 702 for trunk/forum/includes/db/dbal.php
- Timestamp:
- Mar 31, 2010, 6:32:40 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/forum/includes/db/dbal.php
r400 r702 3 3 * 4 4 * @package dbal 5 * @version $Id : dbal.php 9178 2008-12-06 11:11:10Z acydburn$5 * @version $Id$ 6 6 * @copyright (c) 2005 phpBB Group 7 7 * @license http://opensource.org/licenses/gpl-license.php GNU Public License … … 236 236 function sql_like_expression($expression) 237 237 { 238 $expression = str_replace(array('_', '%'), array("\_", "\%"), $expression);239 $expression = str_replace(array(chr(0) . "\_", chr(0) . "\%"), array('_', '%'), $expression);238 $expression = utf8_str_replace(array('_', '%'), array("\_", "\%"), $expression); 239 $expression = utf8_str_replace(array(chr(0) . "\_", chr(0) . "\%"), array('_', '%'), $expression); 240 240 241 241 return $this->_sql_like_expression('LIKE \'' . $this->sql_escape($expression) . '\''); … … 413 413 414 414 /** 415 * Run binary AND operator on DB column. 416 * Results in sql statement: "{$column_name} & (1 << {$bit}) {$compare}" 417 * 418 * @param string $column_name The column name to use 419 * @param int $bit The value to use for the AND operator, will be converted to (1 << $bit). Is used by options, using the number schema... 0, 1, 2...29 420 * @param string $compare Any custom SQL code after the check (for example "= 0") 421 */ 422 function sql_bit_and($column_name, $bit, $compare = '') 423 { 424 if (method_exists($this, '_sql_bit_and')) 425 { 426 return $this->_sql_bit_and($column_name, $bit, $compare); 427 } 428 429 return $column_name . ' & ' . (1 << $bit) . (($compare) ? ' ' . $compare : ''); 430 } 431 432 /** 433 * Run binary OR operator on DB column. 434 * Results in sql statement: "{$column_name} | (1 << {$bit}) {$compare}" 435 * 436 * @param string $column_name The column name to use 437 * @param int $bit The value to use for the OR operator, will be converted to (1 << $bit). Is used by options, using the number schema... 0, 1, 2...29 438 * @param string $compare Any custom SQL code after the check (for example "= 0") 439 */ 440 function sql_bit_or($column_name, $bit, $compare = '') 441 { 442 if (method_exists($this, '_sql_bit_or')) 443 { 444 return $this->_sql_bit_or($column_name, $bit, $compare); 445 } 446 447 return $column_name . ' | ' . (1 << $bit) . (($compare) ? ' ' . $compare : ''); 448 } 449 450 /** 415 451 * Run more than one insert statement. 416 452 * … … 436 472 if (!is_array($_sql_ary)) 437 473 { 438 $this->sql_query('INSERT INTO ' . $table . ' ' . $this->sql_build_array('INSERT', $sql_ary)); 439 return true; 474 return $this->sql_query('INSERT INTO ' . $table . ' ' . $this->sql_build_array('INSERT', $sql_ary)); 440 475 } 441 476 … … 448 483 } 449 484 450 $this->sql_query('INSERT INTO ' . $table . ' ' . ' (' . implode(', ', array_keys($sql_ary[0])) . ') VALUES ' . implode(', ', $ary));485 return $this->sql_query('INSERT INTO ' . $table . ' ' . ' (' . implode(', ', array_keys($sql_ary[0])) . ') VALUES ' . implode(', ', $ary)); 451 486 } 452 487 else … … 459 494 } 460 495 461 $this->sql_query('INSERT INTO ' . $table . ' ' . $this->sql_build_array('INSERT', $ary)); 496 $result = $this->sql_query('INSERT INTO ' . $table . ' ' . $this->sql_build_array('INSERT', $ary)); 497 498 if (!$result) 499 { 500 return false; 501 } 462 502 } 463 503 }
Note:
See TracChangeset
for help on using the changeset viewer.