public function getSql()
{
- if (!is_null($this->count)) {
+ if (!is_null($this->count) && $this->count != 0) {
if (!is_null($this->from) && $this->from != 0) {
return XDB::format('LIMIT {?}, {?}', (int)$this->from, (int)$this->count);
} else {
public function __construct($mode, $table, $condition)
{
if ($mode != self::MODE_LEFT && $mode != self::MODE_RIGHT && $mode != self::MODE_INNER) {
- Platal::page()->kill("Join mode error : unknown mode $mode");
+ Platal::page()->kill("Join mode error: unknown mode $mode");
return;
}
$this->mode = $mode;
{
$str = '';
foreach ($joins as $key => $join) {
- if (! ($join instanceof PlSqlJoin)) {
+ if (!($join instanceof PlSqlJoin)) {
Platal::page()->kill("Error: not a join: $join");
}
$mode = $join->mode();
return $sel;
}
-// abstract protected function getSortTokens(&$pf);
+ abstract protected function getSortTokens(&$pf);
}
// {{{ interface PlFilterCondition
*/
abstract class PlSet
{
+ const DEFAULT_MAX_RES = 20;
+
private $conds = null;
private $orders = null;
private $limit = null;
}
if ($orders instanceof PlFilterOrder) {
- $this->orders = array($order);
+ $this->orders[] = $order;
} else {
foreach ($orders as $order) {
$this->orders[] = $order;
$pf = $this->buildFilter($this->conds, $this->orders);
if (is_null($limit)) {
- $limit = new PlLimit(20, 0);
+ $limit = new PlLimit(self::DEFAULT_MAX_RES, 0);
}
$it = $pf->get($limit);
$this->count = $pf->getTotalCount();
*/
public function __construct($name, PlFilterOrder &$pfo, $displaytext = null)
{
- $this->name = $name;
+ $this->name = $name;
if (is_null($displaytext)) {
$this->displaytext = ucfirst($name);
} else {
- $this->displaytext = $displaytext;
+ $this->displaytext = $displaytext;
}
- $this->pfo = $pfo;
+ $this->pfo = $pfo;
}
}