further meta query optimization. props aaroncampbell. fixes #9124

git-svn-id: https://develop.svn.wordpress.org/trunk@15730 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
scribu 2010-10-05 23:06:20 +00:00
parent 39d1200d5c
commit 5a14ba3fa3
1 changed files with 8 additions and 10 deletions

View File

@ -557,7 +557,7 @@ class WP_Object_Query {
}
$meta_query = array();
foreach ( array( 'key', 'value', 'compare' ) as $key ) {
foreach ( array( 'key', 'value', 'compare', 'type' ) as $key ) {
if ( ! empty( $qv[ "meta_$key" ] ) )
$meta_query[ $key ] = $qv[ "meta_$key" ];
}
@ -596,9 +596,7 @@ class WP_Object_Query {
if ( ! in_array( $meta_compare, array( '=', '!=', '>', '>=', '<', '<=', 'LIKE', 'IN', 'BETWEEN' ) ) )
$meta_compare = '=';
if ( 'STRING' == $meta_type )
$meta_type = 'CHAR';
elseif ( 'NUMERIC' == $meta_type )
if ( 'NUMERIC' == $meta_type )
$meta_type = 'SIGNED';
elseif ( ! in_array( $meta_type, array( 'BINARY', 'CHAR', 'DATE', 'DATETIME', 'DECIMAL', 'SIGNED', 'TIME', 'UNSIGNED' ) ) )
$meta_type = 'CHAR';