Changeset 8740
- Timestamp:
- 08/26/2008 11:57:48 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/schema.php
r8653 r8740 7 7 global $wpdb, $wp_queries; 8 8 9 if ( $wpdb-> supports_collation() ) {9 if ( $wpdb->has_cap( 'collation' ) ) { 10 10 if ( ! empty($wpdb->charset) ) 11 11 $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset"; -
trunk/wp-includes/query.php
r8738 r8740 1047 1047 1048 1048 if ( !empty($q['category__not_in']) ) { 1049 if ( $wpdb-> supports_subqueries() ) {1049 if ( $wpdb->has_cap( 'subqueries' ) ) { 1050 1050 $cat_string = "'" . implode("', '", $q['category__not_in']) . "'"; 1051 1051 $whichcat .= " AND $wpdb->posts.ID NOT IN (SELECT $wpdb->term_relationships.object_id FROM $wpdb->term_relationships WHERE $wpdb->term_relationships.term_taxonomy_id IN ($cat_string) )"; -
trunk/wp-includes/wp-db.php
r8739 r8740 333 333 $this->ready = true; 334 334 335 if ( $this-> supports_collation() ) {335 if ( $this->has_cap( 'collation' ) ) { 336 336 $collation_query = ''; 337 337 if ( !empty($this->charset) ) { … … 920 920 function supports_collation() 921 921 { 922 return ( version_compare($this->db_version(), '4.1.0', '>=') ); 923 } 924 925 /** 926 * Whether of not the database version supports sub-queries. 927 * 928 * @since 2.7 929 * 930 * @return bool True if sub-queries are supported, false if version does not 931 */ 932 function supports_subqueries() { 933 return ( version_compare(mysql_get_server_info($this->dbh), '4.1.0', '>=') ); 922 return $this->has_cap( 'collation' ); 923 } 924 925 /** 926 * Generic function to determine if a database supports a particular feature 927 * @param string $db_cap the feature 928 * @param false|string|resource $dbh_or_table the databaese (the current database, the database housing the specified table, or the database of the mysql resource) 929 * @return bool 930 */ 931 function has_cap( $db_cap ) { 932 $version = $this->db_version(); 933 934 switch ( strtolower( $db_cap ) ) : 935 case 'collation' : // @since 2.5.0 936 case 'group_concat' : // @since 2.7 937 case 'subqueries' : // @since 2.7 938 return version_compare($version, '4.1', '>='); 939 break; 940 endswitch; 941 942 return false; 934 943 } 935 944
Note: See TracChangeset
for help on using the changeset viewer.