IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
712 | 712 | $where = array(); |
713 | 713 | |
714 | 714 | $key_only_queries = array(); |
| 715 | $joined_keys = array(); |
715 | 716 | $queries = array(); |
716 | 717 | |
717 | 718 | // Split out the meta_key only queries (we can only do this for OR) |
… |
… |
|
762 | 763 | $i = count( $join ); |
763 | 764 | $alias = $i ? 'mt' . $i : $meta_table; |
764 | 765 | |
| 766 | if ( isset( $joined_keys[ $meta_key ] ) ) |
| 767 | $alias = $joined_keys[ $meta_key ]; |
| 768 | |
765 | 769 | if ( 'NOT EXISTS' == $meta_compare ) { |
766 | | $join[$i] = "LEFT JOIN $meta_table"; |
767 | | $join[$i] .= $i ? " AS $alias" : ''; |
768 | | $join[$i] .= " ON ($primary_table.$primary_id_column = $alias.$meta_id_column AND $alias.meta_key = '$meta_key')"; |
| 770 | if ( !isset( $joined_keys[ $meta_key ] ) ) { |
| 771 | $joined_keys[ $meta_key ] = $alias; |
| 772 | |
| 773 | $join[$i] = "LEFT JOIN $meta_table"; |
| 774 | $join[$i] .= $i ? " AS $alias" : ''; |
| 775 | $join[$i] .= " ON ($primary_table.$primary_id_column = $alias.$meta_id_column AND $alias.meta_key = '$meta_key')"; |
| 776 | } |
769 | 777 | |
770 | 778 | $where[$k] = ' ' . $alias . '.' . $meta_id_column . ' IS NULL'; |
771 | 779 | |
772 | 780 | continue; |
773 | 781 | } |
774 | 782 | |
775 | | $join[$i] = "INNER JOIN $meta_table"; |
776 | | $join[$i] .= $i ? " AS $alias" : ''; |
777 | | $join[$i] .= " ON ($primary_table.$primary_id_column = $alias.$meta_id_column)"; |
| 783 | $joined_keys[ $meta_key ] = $meta_id_column; |
| 784 | |
| 785 | if ( !isset( $joined_keys[ $meta_key ] ) ) { |
| 786 | $joined_keys[ $meta_key ] = $alias; |
| 787 | |
| 788 | $join[$i] = "INNER JOIN $meta_table"; |
| 789 | $join[$i] .= $i ? " AS $alias" : ''; |
| 790 | $join[$i] .= " ON ($primary_table.$primary_id_column = $alias.$meta_id_column)"; |
| 791 | } |
778 | 792 | |
779 | 793 | $where[$k] = ''; |
780 | 794 | if ( !empty( $meta_key ) ) |