Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
99b870af
Commit
99b870af
authored
Feb 11, 2011
by
Max Kanat-Alexander
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 535571: Allow Search.pm to accept "limit" and "offset" as parameters.
r=mkanat, a=mkanat (module owner)
parent
ede6518f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
13 deletions
+35
-13
Search.pm
Bugzilla/Search.pm
+31
-1
buglist.cgi
buglist.cgi
+4
-12
No files found.
Bugzilla/Search.pm
View file @
99b870af
...
...
@@ -56,6 +56,7 @@ use Data::Dumper;
use
Date::
Format
;
use
Date::
Parse
;
use
List::
MoreUtils
qw(all part uniq)
;
use
POSIX
qw(INT_MAX)
;
use
Storable
qw(dclone)
;
# Description Of Boolean Charts
...
...
@@ -718,12 +719,14 @@ sub sql {
?
"\nHAVING "
.
join
(
' AND '
,
@$having_terms
)
:
''
;
my
$order_by
=
$self
->
_sql_order_by
?
"\nORDER BY "
.
join
(
', '
,
$self
->
_sql_order_by
)
:
''
;
my
$limit
=
$self
->
_sql_limit
;
$limit
=
"\n$limit"
if
$limit
;
my
$query
=
<<END;
SELECT $select
FROM $from
WHERE $where
$group_by$having$order_by
$group_by$having$order_by
$limit
END
$self
->
{
sql
}
=
$query
;
return
$self
->
{
sql
};
...
...
@@ -918,6 +921,33 @@ sub _translate_order_by_column {
return
@items
;
}
#############################
# Internal Accessors: LIMIT #
#############################
sub
_sql_limit
{
my
(
$self
)
=
@_
;
my
$limit
=
$self
->
_params
->
{
limit
};
my
$offset
=
$self
->
_params
->
{
offset
};
if
(
defined
$offset
and
not
defined
$limit
)
{
$limit
=
INT_MAX
;
}
if
(
defined
$limit
)
{
detaint_natural
(
$limit
)
||
ThrowCodeError
(
'param_must_be_numeric'
,
{
function
=>
'Bugzilla::Search::new'
,
param
=>
'limit'
});
if
(
defined
$offset
)
{
detaint_natural
(
$offset
)
||
ThrowCodeError
(
'param_must_be_numeric'
,
{
function
=>
'Bugzilla::Search::new'
,
param
=>
'offset'
});
}
return
Bugzilla
->
dbh
->
sql_limit
(
$limit
,
$offset
);
}
return
''
;
}
############################
# Internal Accessors: FROM #
############################
...
...
buglist.cgi
View file @
99b870af
...
...
@@ -772,6 +772,10 @@ if (!$order) {
my
@orderstrings
=
split
(
/,\s*/
,
$order
);
if
(
$fulltext
and
grep
{
/^relevance/
}
@orderstrings
)
{
$vars
->
{
'message'
}
=
'buglist_sorted_by_relevance'
}
# Generate the basic SQL query that will be used to generate the bug list.
my
$search
=
new
Bugzilla::
Search
(
'fields'
=>
\
@selectcolumns
,
'params'
=>
scalar
$params
->
Vars
,
...
...
@@ -779,18 +783,6 @@ my $search = new Bugzilla::Search('fields' => \@selectcolumns,
my
$query
=
$search
->
sql
;
$vars
->
{
'search_description'
}
=
$search
->
search_description
;
if
(
defined
$cgi
->
param
(
'limit'
))
{
my
$limit
=
$cgi
->
param
(
'limit'
);
if
(
detaint_natural
(
$limit
))
{
$query
.=
" "
.
$dbh
->
sql_limit
(
$limit
);
}
}
elsif
(
$fulltext
)
{
if
(
$cgi
->
param
(
'order'
)
&&
$cgi
->
param
(
'order'
)
=~
/^relevance/
)
{
$vars
->
{
'message'
}
=
'buglist_sorted_by_relevance'
;
}
}
################################################################################
# Query Execution
...
...
Write
Preview
Markdown
is supported
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