Make WordPress Core

Changeset 21471


Ignore:
Timestamp:
08/08/2012 06:13:48 AM (13 years ago)
Author:
nacin
Message:

Introduce wpdb::get_charset_collate() to return the DEFAULT CHARACTER SET and COLLATE for use in table schemas.

props simonwheatley, pento. fixes #18451.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/schema.php

    r20363 r21471  
    1818 * @name $charset_collate
    1919 */
    20 $charset_collate = '';
    21 
    22 if ( ! empty( $wpdb->charset ) )
    23     $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
    24 if ( ! empty( $wpdb->collate ) )
    25     $charset_collate .= " COLLATE $wpdb->collate";
     20$charset_collate = $wpdb->get_charset_collate();
    2621
    2722/**
  • trunk/wp-includes/wp-db.php

    r21470 r21471  
    15611561
    15621562    /**
     1563     * The database character collate.
     1564     *
     1565     * @since 3.5.0
     1566     *
     1567     * @return string The database character collate.
     1568     */
     1569    public function get_charset_collate() {
     1570        $charset_collate = '';
     1571
     1572        if ( ! empty( $this->charset ) )
     1573            $charset_collate = "DEFAULT CHARACTER SET $this->charset";
     1574        if ( ! empty( $this->collate ) )
     1575            $charset_collate .= " COLLATE $this->collate";
     1576
     1577        return $charset_collate;
     1578    }
     1579
     1580    /**
    15631581     * Determine if a database supports a particular feature
    15641582     *
Note: See TracChangeset for help on using the changeset viewer.