Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
GLPI
glpi
Commits
6cffc2b7
Commit
6cffc2b7
authored
Apr 22, 2020
by
Adrien Clairembault
Committed by
Johan Cwiklinski
Apr 23, 2020
Browse files
Replace SQL_CALC_FOUNDS_ROWS by count
parent
92540a94
Changes
1
Hide whitespace changes
Inline
Side-by-side
inc/api.class.php
View file @
6cffc2b7
...
...
@@ -1279,7 +1279,7 @@ abstract class API extends CommonGLPI {
$add_keys_names
=
count
(
$params
[
'add_keys_names'
])
>
0
;
// build query
$query
=
"SELECT
SQL_CALC_FOUND_ROWS
DISTINCT "
.
$DB
->
quoteName
(
"
$table
.id"
)
.
", "
.
$DB
->
quoteName
(
"
$table
.*"
)
.
"
$query
=
"SELECT DISTINCT "
.
$DB
->
quoteName
(
"
$table
.id"
)
.
", "
.
$DB
->
quoteName
(
"
$table
.*"
)
.
"
FROM "
.
$DB
->
quoteName
(
$table
)
.
"
$join
WHERE
$where
...
...
@@ -1301,8 +1301,8 @@ abstract class API extends CommonGLPI {
}
// get result full row counts
$
data_numtotalrow
=
$DB
->
request
(
'
SELECT
F
OUN
D_ROWS()'
)
->
next
()
;
$totalcount
=
$
data_numtotalrow
[
'FOUND_ROWS()'
];
$
count_query
=
"
SELECT
C
OUN
T(*) FROM
{
$DB
->
quoteName
(
$table
)
}
$join
WHERE
$where
"
;
$totalcount
=
$
DB
->
query
(
$count_query
)
->
fetch_row
()[
0
];
if
(
$params
[
'range'
][
0
]
>
$totalcount
)
{
$this
->
returnError
(
"Provided range exceed total count of data: "
.
$totalcount
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment