Make WordPress Core


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.1/wp-includes/wp-db.php

    r18350 r18357  
    4040 * It is possible to replace this class with your own
    4141 * by setting the $wpdb global variable in wp-content/db.php
    42  * file to your class. The wpdb class will still be included,
    43  * so you can extend it or simply use your own.
     42 * file with your class. You can name it wpdb also, since
     43 * this file will not be included, if the other file is
     44 * available.
    4445 *
    4546 * @link http://codex.wordpress.org/Function_Reference/wpdb_Class
     
    460461         */
    461462        var $func_call;
     463
     464        /**
     465         * Connects to the database server and selects a database
     466         *
     467         * PHP4 compatibility layer for calling the PHP5 constructor.
     468         *
     469         * @uses wpdb::__construct() Passes parameters and returns result
     470         * @since 0.71
     471         *
     472         * @param string $dbuser MySQL database user
     473         * @param string $dbpassword MySQL database password
     474         * @param string $dbname MySQL database name
     475         * @param string $dbhost MySQL database host
     476         */
     477        function wpdb( $dbuser, $dbpassword, $dbname, $dbhost ) {
     478                return $this->__construct( $dbuser, $dbpassword, $dbname, $dbhost );
     479        }
    462480
    463481        /**
     
    10141032         */
    10151033        function db_connect() {
     1034                global $db_list, $global_db_list;
     1035
    10161036                if ( WP_DEBUG ) {
    10171037                        $this->dbh = mysql_connect( $this->dbhost, $this->dbuser, $this->dbpassword, true );
     
    10841104                }
    10851105
    1086                 if ( preg_match( '/^\s*(create|alter|truncate|drop) /i', $query ) ) {
    1087                         $return_val = $this->result;
    1088                 } elseif ( preg_match( '/^\s*(insert|delete|update|replace) /i', $query ) ) {
     1106                if ( preg_match( "/^\\s*(insert|delete|update|replace|alter) /i", $query ) ) {
    10891107                        $this->rows_affected = mysql_affected_rows( $this->dbh );
    10901108                        // Take note of the insert_id
    1091                         if ( preg_match( '/^\s*(insert|replace) /i', $query ) ) {
     1109                        if ( preg_match( "/^\\s*(insert|replace) /i", $query ) ) {
    10921110                                $this->insert_id = mysql_insert_id($this->dbh);
    10931111                        }
     
    13671385                        // (Duplicates are discarded)
    13681386                        foreach ( $this->last_result as $row ) {
    1369                                 $key = array_shift( get_object_vars( $row ) );
     1387                                $key = array_shift( $var_by_ref = get_object_vars( $row ) );
    13701388                                if ( ! isset( $new_array[ $key ] ) )
    13711389                                        $new_array[ $key ] = $row;
Note: See TracChangeset for help on using the changeset viewer.