Skip to content

Commit 5f5a0c4

Browse files
cproensadregad
authored andcommitted
Refactor filter query, export csv, excel
1 parent e4addd7 commit 5f5a0c4

File tree

2 files changed

+10
-14
lines changed

2 files changed

+10
-14
lines changed

csv_export.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,10 @@
5555
# Get current filter
5656
$t_filter = filter_get_bug_rows_filter();
5757

58-
# Get the query clauses
59-
$t_query_clauses = filter_get_bug_rows_query_clauses( $t_filter );
58+
$t_filter_query = new BugFilterQuery( $t_filter );
59+
$t_filter_query->set_limit( EXPORT_BLOCK_SIZE );
6060

61-
# Get the total number of bugs that meet the criteria.
62-
$p_bug_count = filter_get_bug_count( $t_query_clauses, /* pop_params */ false );
63-
64-
if( 0 == $p_bug_count ) {
61+
if( 0 == $t_filter_query->get_bug_count() ) {
6562
print_header_redirect( 'view_all_set.php?type=0' );
6663
}
6764

@@ -106,7 +103,8 @@
106103
bug_clear_cache_all();
107104

108105
# select a new block
109-
$t_result = filter_get_bug_rows_result( $t_query_clauses, EXPORT_BLOCK_SIZE, $t_offset, /* pop params */ false );
106+
$t_filter_query->set_offset( $t_offset );
107+
$t_result = $t_filter_query->execute();
110108
$t_offset += EXPORT_BLOCK_SIZE;
111109

112110
# Keep reading until reaching max block size or end of result set

excel_xml_export.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,10 @@
7777
# Get current filter
7878
$t_filter = filter_get_bug_rows_filter();
7979

80-
# Get the query clauses
81-
$t_query_clauses = filter_get_bug_rows_query_clauses( $t_filter );
80+
$t_filter_query = new BugFilterQuery( $t_filter );
81+
$t_filter_query->set_limit( EXPORT_BLOCK_SIZE );
8282

83-
# Get the total number of bugs that meet the criteria.
84-
$p_bug_count = filter_get_bug_count( $t_query_clauses, /* pop_params */ false );
85-
86-
if( 0 == $p_bug_count ) {
83+
if( 0 == $t_filter_query->get_bug_count() ) {
8784
print_header_redirect( 'view_all_set.php?type=0&print=1' );
8885
}
8986

@@ -94,7 +91,8 @@
9491
bug_clear_cache_all();
9592

9693
# select a new block
97-
$t_result = filter_get_bug_rows_result( $t_query_clauses, EXPORT_BLOCK_SIZE, $t_offset, /* pop params */ false );
94+
$t_filter_query->set_offset( $t_offset );
95+
$t_result = $t_filter_query->execute();
9896
$t_offset += EXPORT_BLOCK_SIZE;
9997

10098
# Keep reading until reaching max block size or end of result set

0 commit comments

Comments
 (0)