$this->dieUsage( "Invalid continue param. You should pass the " .
"original value returned by the previous query", "_badcontinue" );
}
+ $op = $params['dir'] == 'descending' ? '<' : '>';
$clfrom = intval( $cont[0] );
- $clto = $this->getDB()->strencode( $this->titleToKey( $cont[1] ) );
+ $clto = $this->getDB()->addQuotes( $this->titleToKey( $cont[1] ) );
$this->addWhere(
- "cl_from > $clfrom OR " .
+ "cl_from $op $clfrom OR " .
"(cl_from = $clfrom AND " .
- "cl_to >= '$clto')"
+ "cl_to $op= $clto)"
);
}
$this->dieUsage( 'Invalid continue param. You should pass the ' .
'original value returned by the previous query', '_badcontinue' );
}
- $orig = $this->getDB()->strencode( $this->titleTokey( $cont[0] ) );
- $dup = $this->getDB()->strencode( $this->titleToKey( $cont[1] ) );
+ $op = $params['dir'] == 'descending' ? '<' : '>';
+ $db = $this->getDB();
+ $orig = $db->addQuotes( $this->titleTokey( $cont[0] ) );
+ $dup = $db->addQuotes( $this->titleToKey( $cont[1] ) );
$this->addWhere(
- "i1.img_name > '$orig' OR " .
- "(i1.img_name = '$orig' AND " .
- "i2.img_name >= '$dup')"
+ "i1.img_name $op $orig OR " .
+ "(i1.img_name = $orig AND " .
+ "i2.img_name $op= $dup)"
);
}
$dir = ( $params['dir'] == 'descending' ? ' DESC' : '' );
- $this->addOption( 'ORDER BY', 'i1.img_name' . $dir );
+ // Don't order by i1.img_name if it's constant in the WHERE clause
+ if ( count( $this->getPageSet()->getGoodTitles() ) == 1 ) {
+ $this->addOption( 'ORDER BY', 'i2.img_name' . $dir );
+ } else {
+ $this->addOption( 'ORDER BY', array(
+ 'i1.img_name' . $dir,
+ 'i2.img_name' . $dir
+ ));
+ }
$this->addOption( 'LIMIT', $params['limit'] + 1 );
$res = $this->select( __METHOD__ );
$this->dieUsage( 'Invalid continue param. You should pass the ' .
'original value returned by the previous query', '_badcontinue' );
}
+ $op = $params['dir'] == 'descending' ? '<' : '>';
+ $db = $this->getDB();
$iwlfrom = intval( $cont[0] );
- $iwlprefix = $this->getDB()->strencode( $cont[1] );
- $iwltitle = $this->getDB()->strencode( $this->titleToKey( $cont[2] ) );
+ $iwlprefix = $db->addQuotes( $cont[1] );
+ $iwltitle = $db->addQuotes( $this->titleToKey( $cont[2] ) );
$this->addWhere(
- "iwl_from > $iwlfrom OR " .
+ "iwl_from $op $iwlfrom OR " .
"(iwl_from = $iwlfrom AND " .
- "(iwl_prefix > '$iwlprefix' OR " .
- "(iwl_prefix = '$iwlprefix' AND " .
- "iwl_title >= '$iwltitle')))"
+ "(iwl_prefix $op $iwlprefix OR " .
+ "(iwl_prefix = $iwlprefix AND " .
+ "iwl_title $op= $iwltitle)))"
);
}
$this->dieUsage( 'Invalid continue param. You should pass the ' .
'original value returned by the previous query', '_badcontinue' );
}
+ $op = $params['dir'] == 'descending' ? '<' : '>';
$ilfrom = intval( $cont[0] );
- $ilto = $this->getDB()->strencode( $this->titleToKey( $cont[1] ) );
+ $ilto = $this->getDB()->addQuotes( $this->titleToKey( $cont[1] ) );
$this->addWhere(
- "il_from > $ilfrom OR " .
+ "il_from $op $ilfrom OR " .
"(il_from = $ilfrom AND " .
- "il_to >= '$ilto')"
+ "il_to $op= $ilto)"
);
}
$this->dieUsage( 'Invalid continue param. You should pass the ' .
'original value returned by the previous query', '_badcontinue' );
}
+ $op = $params['dir'] == 'descending' ? '<' : '>';
$llfrom = intval( $cont[0] );
- $lllang = $this->getDB()->strencode( $cont[1] );
+ $lllang = $this->getDB()->addQuotes( $cont[1] );
$this->addWhere(
- "ll_from > $llfrom OR " .
+ "ll_from $op $llfrom OR " .
"(ll_from = $llfrom AND " .
- "ll_lang >= '$lllang')"
+ "ll_lang $op= $lllang)"
);
}
$this->dieUsage( 'Invalid continue param. You should pass the ' .
'original value returned by the previous query', '_badcontinue' );
}
+ $op = $params['dir'] == 'descending' ? '<' : '>';
$plfrom = intval( $cont[0] );
$plns = intval( $cont[1] );
- $pltitle = $this->getDB()->strencode( $this->titleToKey( $cont[2] ) );
+ $pltitle = $this->getDB()->addQuotes( $this->titleToKey( $cont[2] ) );
$this->addWhere(
- "{$this->prefix}_from > $plfrom OR " .
+ "{$this->prefix}_from $op $plfrom OR " .
"({$this->prefix}_from = $plfrom AND " .
- "({$this->prefix}_namespace > $plns OR " .
+ "({$this->prefix}_namespace $op $plns OR " .
"({$this->prefix}_namespace = $plns AND " .
- "{$this->prefix}_title >= '$pltitle')))"
+ "{$this->prefix}_title $op= $pltitle)))"
);
}