Make WordPress Core


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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.