}
$this->addOption( 'LIMIT', $params['limit'] + 1 );
- $this->addOption( 'ORDER BY', 'cat_title' . ( $params['dir'] == 'descending' ? ' DESC' : '' ) );
+ $sort = ( $params['dir'] == 'descending' ? ' DESC' : '' );
+ $this->addOption( 'ORDER BY', 'cat_title' . $sort );
$prop = array_flip( $params['prop'] );
$this->addFieldsIf( array( 'cat_pages', 'cat_subcats', 'cat_files' ), isset( $prop['size'] ) );
$limit = $params['limit'];
$this->addOption( 'LIMIT', $limit + 1 );
- $this->addOption( 'ORDER BY', 'img_name' .
- ( $params['dir'] == 'descending' ? ' DESC' : '' ) );
+ $sort = ( $params['dir'] == 'descending' ? ' DESC' : '' );
+ $this->addOption( 'ORDER BY', 'img_name' . $sort );
$res = $this->select( __METHOD__ );
$this->addOption( 'LIMIT', $limit + 1 );
if ( !$params['unique'] ) {
- $this->addOption( 'ORDER BY', 'pl_title, pl_from' );
+ $this->addOption( 'ORDER BY', array(
+ 'pl_title',
+ 'pl_from'
+ ));
}
$res = $this->select( __METHOD__ );
$this->addOption( 'STRAIGHT_JOIN' );
// We have to GROUP BY all selected fields to stop
// PostgreSQL from whining
- $this->addOption( 'GROUP BY', implode( ', ', $selectFields ) );
+ $this->addOption( 'GROUP BY', $selectFields );
$forceNameTitleIndex = false;
}
$this->addOption( 'USE INDEX', array( 'categorylinks' => 'cl_from' ) );
- $dir = ( $params['dir'] == 'descending' ? ' DESC' : '' );
+ $sort = ( $params['dir'] == 'descending' ? ' DESC' : '' );
// Don't order by cl_from if it's constant in the WHERE clause
if ( count( $this->getPageSet()->getGoodTitles() ) == 1 ) {
- $this->addOption( 'ORDER BY', 'cl_to' . $dir );
+ $this->addOption( 'ORDER BY', 'cl_to' . $sort );
} else {
$this->addOption( 'ORDER BY', array(
- 'cl_from' . $dir,
- 'cl_to' . $dir
+ 'cl_from' . $sort,
+ 'cl_to' . $sort
));
}
if ( $params['unique'] ) {
$this->addOption( 'GROUP BY', 'ar_title' );
} else {
- $this->addOption( 'ORDER BY', 'ar_title, ar_timestamp' );
+ $this->addOption( 'ORDER BY', array(
+ 'ar_title',
+ 'ar_timestamp'
+ ));
}
} else {
if ( $mode == 'revs' ) {
);
}
- $dir = ( $params['dir'] == 'descending' ? ' DESC' : '' );
+ $sort = ( $params['dir'] == 'descending' ? ' DESC' : '' );
// 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 );
+ $this->addOption( 'ORDER BY', 'i2.img_name' . $sort );
} else {
$this->addOption( 'ORDER BY', array(
- 'i1.img_name' . $dir,
- 'i2.img_name' . $dir
+ 'i1.img_name' . $sort,
+ 'i2.img_name' . $sort
));
}
$this->addOption( 'LIMIT', $params['limit'] + 1 );
$limit = $params['limit'];
$this->addOption( 'LIMIT', $limit + 1 );
- $this->addOption( 'ORDER BY', 'fa_name' .
- ( $params['dir'] == 'descending' ? ' DESC' : '' ) );
+ $sort = ( $params['dir'] == 'descending' ? ' DESC' : '' );
+ $this->addOption( 'ORDER BY', 'fa_name' . $sort );
$res = $this->select( __METHOD__ );
$this->addWhereFld( 'iwl_title', $params['title'] );
$this->addOption( 'ORDER BY', 'iwl_from' );
} else {
- $this->addOption( 'ORDER BY', 'iwl_title, iwl_from' );
+ $this->addOption( 'ORDER BY', array(
+ 'iwl_title',
+ 'iwl_from'
+ ));
}
} else {
- $this->addOption( 'ORDER BY', 'iwl_prefix, iwl_title, iwl_from' );
+ $this->addOption( 'ORDER BY', array(
+ 'iwl_prefix',
+ 'iwl_title',
+ 'iwl_from'
+ ));
}
$this->addOption( 'LIMIT', $params['limit'] + 1 );
);
}
- $dir = ( $params['dir'] == 'descending' ? ' DESC' : '' );
+ $sort = ( $params['dir'] == 'descending' ? ' DESC' : '' );
if ( isset( $params['prefix'] ) ) {
$this->addWhereFld( 'iwl_prefix', $params['prefix'] );
if ( isset( $params['title'] ) ) {
$this->addWhereFld( 'iwl_title', $params['title'] );
- $this->addOption( 'ORDER BY', 'iwl_from' . $dir );
+ $this->addOption( 'ORDER BY', 'iwl_from' . $sort );
} else {
$this->addOption( 'ORDER BY', array(
- 'iwl_title' . $dir,
- 'iwl_from' . $dir
+ 'iwl_title' . $sort,
+ 'iwl_from' . $sort
));
}
} else {
// Don't order by iwl_from if it's constant in the WHERE clause
if ( count( $this->getPageSet()->getGoodTitles() ) == 1 ) {
- $this->addOption( 'ORDER BY', 'iwl_prefix' . $dir );
+ $this->addOption( 'ORDER BY', 'iwl_prefix' . $sort );
} else {
$this->addOption( 'ORDER BY', array (
- 'iwl_from' . $dir,
- 'iwl_prefix' . $dir
+ 'iwl_from' . $sort,
+ 'iwl_prefix' . $sort
));
}
}
);
}
- $dir = ( $params['dir'] == 'descending' ? ' DESC' : '' );
+ $sort = ( $params['dir'] == 'descending' ? ' DESC' : '' );
// Don't order by il_from if it's constant in the WHERE clause
if ( count( $this->getPageSet()->getGoodTitles() ) == 1 ) {
- $this->addOption( 'ORDER BY', 'il_to' . $dir );
+ $this->addOption( 'ORDER BY', 'il_to' . $sort );
} else {
$this->addOption( 'ORDER BY', array(
- 'il_from' . $dir,
- 'il_to' . $dir
+ 'il_from' . $sort,
+ 'il_to' . $sort
));
}
$this->addOption( 'LIMIT', $params['limit'] + 1 );
$this->addWhereFld( 'll_title', $params['title'] );
$this->addOption( 'ORDER BY', 'll_from' );
} else {
- $this->addOption( 'ORDER BY', 'll_title, ll_from' );
+ $this->addOption( 'ORDER BY', array(
+ 'll_title',
+ 'll_from'
+ ));
}
} else {
- $this->addOption( 'ORDER BY', 'll_lang, ll_title, ll_from' );
+ $this->addOption( 'ORDER BY', array(
+ 'll_lang',
+ 'll_title',
+ 'll_from'
+ ));
}
$this->addOption( 'LIMIT', $params['limit'] + 1 );
);
}
- $dir = ( $params['dir'] == 'descending' ? ' DESC' : '' );
+ $sort = ( $params['dir'] == 'descending' ? ' DESC' : '' );
if ( isset( $params['lang'] ) ) {
$this->addWhereFld( 'll_lang', $params['lang'] );
if ( isset( $params['title'] ) ) {
$this->addWhereFld( 'll_title', $params['title'] );
- $this->addOption( 'ORDER BY', 'll_from' . $dir );
+ $this->addOption( 'ORDER BY', 'll_from' . $sort );
} else {
$this->addOption( 'ORDER BY', array(
- 'll_title' . $dir,
- 'll_from' . $dir
+ 'll_title' . $sort,
+ 'll_from' . $sort
));
}
} else {
// Don't order by ll_from if it's constant in the WHERE clause
if ( count( $this->getPageSet()->getGoodTitles() ) == 1 ) {
- $this->addOption( 'ORDER BY', 'll_lang' . $dir );
+ $this->addOption( 'ORDER BY', 'll_lang' . $sort );
} else {
$this->addOption( 'ORDER BY', array(
- 'll_from' . $dir,
- 'll_lang' . $dir
+ 'll_from' . $sort,
+ 'll_lang' . $sort
));
}
}
);
}
- $dir = ( $params['dir'] == 'descending' ? ' DESC' : '' );
+ $sort = ( $params['dir'] == 'descending' ? ' DESC' : '' );
// Here's some MySQL craziness going on: if you use WHERE foo='bar'
// and later ORDER BY foo MySQL doesn't notice the ORDER BY is pointless
// but instead goes and filesorts, because the index for foo was used
// clause from the ORDER BY clause
$order = array();
if ( count( $this->getPageSet()->getGoodTitles() ) != 1 ) {
- $order[] = $this->prefix . '_from' . $dir;
+ $order[] = $this->prefix . '_from' . $sort;
}
if ( count( $params['namespace'] ) != 1 ) {
- $order[] = $this->prefix . '_namespace' . $dir;
+ $order[] = $this->prefix . '_namespace' . $sort;
}
- $order[] = $this->prefix . "_title" . $dir;
+ $order[] = $this->prefix . '_title' . $sort;
$this->addOption( 'ORDER BY', $order );
$this->addOption( 'USE INDEX', $this->prefix . '_from' );
$this->addOption( 'LIMIT', $params['limit'] + 1 );
"rev_id >= '$revid')"
);
}
- $this->addOption( 'ORDER BY', 'rev_page, rev_id' );
+ $this->addOption( 'ORDER BY', array(
+ 'rev_page',
+ 'rev_id'
+ ));
// assumption testing -- we should never get more then $pageCount rows.
$limit = $pageCount;
if ( count( $params['namespace'] ) == 1 ) {
$this->addOption( 'ORDER BY', 'wl_title' . $sort );
} else {
- $this->addOption( 'ORDER BY', 'wl_namespace' . $sort . ', wl_title' . $sort );
+ $this->addOption( 'ORDER BY', array(
+ 'wl_namespace' . $sort,
+ 'wl_title' . $sort
+ ));
}
$this->addOption( 'LIMIT', $params['limit'] + 1 );
$res = $this->select( __METHOD__ );