mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
Introduce wpdb::get_charset_collate() to return the DEFAULT CHARACTER SET and COLLATE for use in table schemas.
props simonwheatley, pento. fixes #18451. git-svn-id: http://core.svn.wordpress.org/trunk@21471 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
73c74cf8f7
commit
4e5fd4de46
@ -17,12 +17,7 @@ global $wpdb, $wp_queries, $charset_collate;
|
|||||||
* @global string
|
* @global string
|
||||||
* @name $charset_collate
|
* @name $charset_collate
|
||||||
*/
|
*/
|
||||||
$charset_collate = '';
|
$charset_collate = $wpdb->get_charset_collate();
|
||||||
|
|
||||||
if ( ! empty( $wpdb->charset ) )
|
|
||||||
$charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
|
|
||||||
if ( ! empty( $wpdb->collate ) )
|
|
||||||
$charset_collate .= " COLLATE $wpdb->collate";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve the SQL for creating database tables.
|
* Retrieve the SQL for creating database tables.
|
||||||
|
@ -1559,6 +1559,24 @@ class wpdb {
|
|||||||
return $this->has_cap( 'collation' );
|
return $this->has_cap( 'collation' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The database character collate.
|
||||||
|
*
|
||||||
|
* @since 3.5.0
|
||||||
|
*
|
||||||
|
* @return string The database character collate.
|
||||||
|
*/
|
||||||
|
public function get_charset_collate() {
|
||||||
|
$charset_collate = '';
|
||||||
|
|
||||||
|
if ( ! empty( $this->charset ) )
|
||||||
|
$charset_collate = "DEFAULT CHARACTER SET $this->charset";
|
||||||
|
if ( ! empty( $this->collate ) )
|
||||||
|
$charset_collate .= " COLLATE $this->collate";
|
||||||
|
|
||||||
|
return $charset_collate;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if a database supports a particular feature
|
* Determine if a database supports a particular feature
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user