Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2_Queries.php |
— | — | @@ -622,7 +622,7 @@ |
623 | 623 | $keys = $dv->getDBkeys(); |
624 | 624 | |
625 | 625 | // Try comparison based on value field and comparator. |
626 | | - if ( ( $valueIndexes[0] >= 0 ) && ( $description->getComparator() != SMW_CMP_EQ ) ) { // TODO //.// |
| 626 | + if ( ( $valueIndexes[0] >= 0 ) ) { // TODO //.// |
627 | 627 | // Find field name for comparison. |
628 | 628 | $smwidjoinfield = false; |
629 | 629 | $fieldNames = $this->getDBFieldsForDVIndexes( $proptable->objectfields, $valueIndexes, $smwidjoinfield ); |
— | — | @@ -634,13 +634,14 @@ |
635 | 635 | // TODO: refactor this hook away by using a method in the description classes |
636 | 636 | |
637 | 637 | switch ( $description->getComparator() ) { |
| 638 | + case SMW_CMP_EQ: $comp = '='; break; |
638 | 639 | case SMW_CMP_LEQ: $comp = '<='; break; |
639 | 640 | case SMW_CMP_GEQ: $comp = '>='; break; |
640 | 641 | case SMW_CMP_NEQ: $comp = '!='; break; |
641 | 642 | } |
642 | 643 | |
643 | 644 | wfRunHooks( 'smwGetSQLConditionForValue', array( &$where, $description, $query->alias, $fieldNames, $this->m_dbs ) ); |
644 | | - |
| 645 | + |
645 | 646 | if ( $where == '' ) { |
646 | 647 | $value = $keys[$valueIndexes[0]]; // TODO //.// |
647 | 648 | $where = "{$query->alias}.{$fieldNames[0]}{$comp}" . $this->m_dbs->addQuotes( $value ); |
— | — | @@ -662,11 +663,12 @@ |
663 | 664 | $i++; |
664 | 665 | } |
665 | 666 | } |
| 667 | + |
666 | 668 | } elseif ( ( $description instanceof SMWConjunction ) || ( $description instanceof SMWDisjunction ) ) { |
667 | 669 | $op = ( $description instanceof SMWConjunction ) ? 'AND' : 'OR'; |
668 | 670 | foreach ( $description->getDescriptions() as $subdesc ) { |
669 | 671 | // $where .= ($where!=''?$op:'') . |
670 | | - $this->compileAttributeWhere( $query, $subdesc, $proptable, $valueindex, $op ); |
| 672 | + $this->compileAttributeWhere( $query, $subdesc, $proptable, $valueIndexes, $op ); |
671 | 673 | } |
672 | 674 | } |
673 | 675 | if ( $where != '' ) $query->where .= ( $query->where ? " $operator ":'' ) . "($where)"; |