r65785 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r65784‎ | r65785 | r65786 >
Date:05:47, 2 May 2010
Author:jeroendedauw
Status:ok
Tags:
Comment:
Removed commented distance query code
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2_Queries.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2_Queries.php
@@ -66,7 +66,7 @@
6767 /** Local collection of error strings, passed on to callers if possible. */
6868 protected $m_errors = array();
6969
70 - public function __construct( &$parentstore, &$dbslave ) {
 70+ public function __construct( &$parentstore, DatabaseBase &$dbslave ) {
7171 $this->m_store = $parentstore;
7272 $this->m_dbs = $dbslave;
7373 }
@@ -593,7 +593,7 @@
594594 * SMWValueDescription objects, create and return a plain WHERE condition
595595 * string for it.
596596 */
597 - protected function compileAttributeWhere( $query, SMWDescription $description, $proptable, $valueindex, $operator = 'AND' ) {
 597+ protected function compileAttributeWhere( $query, SMWDescription $description, SMWSQLStore2Table $proptable, $valueindex, $operator = 'AND' ) {
598598 $where = '';
599599 if ( $description instanceof SMWValueDescription ) {
600600 $dv = $description->getDatavalue();
@@ -610,15 +610,9 @@
611611 case SMW_CMP_LEQ: $comp = '<='; break;
612612 case SMW_CMP_GEQ: $comp = '>='; break;
613613 case SMW_CMP_NEQ: $comp = '!='; break;
614 - case SMW_CMP_LIKE:
615 - // TODO: explicitly excluding _geo here is a temporary workaround. Future versions will use personalised comparators for extensions and not LIKE (requires synchronisation with SemanticMaps to work)
616 - if ( ( $dv->getTypeID() != '_geo' ) && ( ( $fieldtype == 't' ) || ( $fieldtype == 'l' ) ) ) { // string data allows pattern matches
617 - $comp = ' LIKE ';
618 - $value = str_replace( array( '%', '_', '*', '?' ), array( '\%', '\_', '%', '_' ), $value ); // translate pattern
619 - }
620 - break;
621614 }
622 - if ( $comp == '' ) { // allow extensions to define their own query conditions
 615+ if ( $comp == '' ) { // Allow extensions to define their own query conditions.
 616+ // FIXME: only one fieldname is passed, which won't work when multiple fields are needed.
623617 wfRunHooks( 'smwGetSQLConditionForValue', array( &$where, $description, $query->alias, $fieldname, $this->m_dbs ) );
624618 } else {
625619 $where = "{$query->alias}.{$fieldname}{$comp}" . $this->m_dbs->addQuotes( $value );

Status & tagging log