projects
/
Pman.Base
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
7d72aa1
)
fix #7328 add _no_count support
author
Alan
<alan@roojs.com>
Fri, 5 Aug 2022 03:33:25 +0000
(11:33 +0800)
committer
Alan
<alan@roojs.com>
Fri, 5 Aug 2022 03:33:25 +0000
(11:33 +0800)
Pman/Roo.php
patch
|
blob
|
history
diff --git
a/Pman/Roo.php
b/Pman/Roo.php
index
7335b3d
..
a9871a0
100644
(file)
--- a/
Pman/Roo.php
+++ b/
Pman/Roo.php
@@
-85,6
+85,9
@@
class Pman_Roo extends Pman
* lookup[key]=value single fetch based on a single key value lookup.
* multiple key/value can be used. eg. ontable+onid..
* _columns what to return.
* lookup[key]=value single fetch based on a single key value lookup.
* multiple key/value can be used. eg. ontable+onid..
* _columns what to return.
+ *
+ * _no_count skip the default count query.
+ * use the number of records in the query result as the total
*
*
* JOINS:
*
*
* JOINS:
@@
-266,16
+269,18
@@
class Pman_Roo extends Pman
$xx=clone($x);
}
$xx=clone($x);
}
-
- $total = $xx->count($this->countWhat);
+ $total = false;
+ if (!isset($_REQUEST['_no_count'])) {
+ $total = $xx->count($this->countWhat);
+ }
// sorting..
//
// sorting..
//
- //var_dump($total);exit;
+ //
var_dump($total);exit;
$this->applySort($x);
$fake_limit = false;
$this->applySort($x);
$fake_limit = false;
- if (!empty($_REQUEST['_distinct']) && $total < 400) {
+ if (!empty($_REQUEST['_distinct']) && $total
!== false && $total
< 400) {
$fake_limit = true;
}
$fake_limit = true;
}
@@
-307,7
+312,7
@@
class Pman_Roo extends Pman
if (!empty($_REQUEST['query']['add_blank'])) {
$ret[] = array( 'id' => 0, 'name' => '----');
if (!empty($_REQUEST['query']['add_blank'])) {
$ret[] = array( 'id' => 0, 'name' => '----');
- $total
+=
1;
+ $total
=== false ? false : $total+
1;
}
$rooar = method_exists($x, 'toRooArray');
}
$rooar = method_exists($x, 'toRooArray');
@@
-364,7
+369,7
@@
class Pman_Roo extends Pman
// this make take some time...
$this->sessionState(0);
// echo "<PRE>"; print_r($ret);
// this make take some time...
$this->sessionState(0);
// echo "<PRE>"; print_r($ret);
- $this->jdata($ret, max(count($ret), $total), $extra );
+ $this->jdata($ret, max(count($ret), $total
=== false ? 0 : $total
), $extra );
}
}