Ignore:
Timestamp:
Mar 31, 2010, 6:32:40 PM (14 years ago)
Author:
george
Message:
  • Upraveno: Aktualizace fóra.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/forum/includes/db/dbal.php

    r400 r702  
    33*
    44* @package dbal
    5 * @version $Id: dbal.php 9178 2008-12-06 11:11:10Z acydburn $
     5* @version $Id$
    66* @copyright (c) 2005 phpBB Group
    77* @license http://opensource.org/licenses/gpl-license.php GNU Public License
     
    236236        function sql_like_expression($expression)
    237237        {
    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);
    240240
    241241                return $this->_sql_like_expression('LIKE \'' . $this->sql_escape($expression) . '\'');
     
    413413
    414414        /**
     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        /**
    415451        * Run more than one insert statement.
    416452        *
     
    436472                                if (!is_array($_sql_ary))
    437473                                {
    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));
    440475                                }
    441476
     
    448483                        }
    449484
    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));
    451486                }
    452487                else
     
    459494                                }
    460495
    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                                }
    462502                        }
    463503                }
Note: See TracChangeset for help on using the changeset viewer.