|
21 | 21 | 'port'=>"",#optional
|
22 | 22 | 'chset'=>"utf8",#optional, default charset
|
23 | 23 | );
|
| 24 | + $IS_COUNT=false; #set to true if you want to see Total records when pagination occurs (SLOWS down all select queries!) |
24 | 25 | file_exists($f=dirname(__FILE__) . '/phpminiconfig.php')&&require($f); // Read from config (easier to update)
|
25 | 26 | if (function_exists('date_default_timezone_set')) date_default_timezone_set('UTC');#required by PHP 5.1+
|
26 | 27 |
|
27 | 28 | //constants
|
28 | | - $VERSION='1.9.160630'; |
| 29 | + $VERSION='1.9.160705'; |
29 | 30 | $MAX_ROWS_PER_PAGE=50; #max number of rows in select per one page
|
30 | 31 | $D="\r\n"; #default delimiter for export
|
31 | 32 | $BOM=chr(239).chr(187).chr(191);
|
@@ -1106,17 +1107,18 @@ function get_close_char($str, $pos, $ochar){
|
1106 | 1107 | }
|
1107 | 1108 |
|
1108 | 1109 | function do_one_sql($sql){
|
1109 | | - global $last_sth,$last_sql,$MAX_ROWS_PER_PAGE,$page,$is_limited_sql,$last_count; |
| 1110 | + global $last_sth,$last_sql,$MAX_ROWS_PER_PAGE,$page,$is_limited_sql,$last_count,$IS_COUNT; |
1110 | 1111 | $sql=trim($sql);
|
1111 | 1112 | $sql=preg_replace("/;$/","",$sql);
|
1112 | 1113 | if ($sql){
|
1113 | 1114 | $last_sql=$sql;$is_limited_sql=0;
|
1114 | 1115 | $last_count=NULL;
|
1115 | 1116 | if (preg_match("/^select/i",$sql) && !preg_match("/limit +\d+/i", $sql)){
|
1116 | | - #get total count |
1117 | | - $sql1='select count(*) from ('.$sql.') ___count_table'; |
1118 | | - $last_count=db_value($sql1,NULL,'noerr'); |
1119 | | - |
| 1117 | + if ($IS_COUNT){ |
| 1118 | + #get total count |
| 1119 | + $sql1='select count(*) from ('.$sql.') ___count_table'; |
| 1120 | + $last_count=db_value($sql1,NULL,'noerr'); |
| 1121 | + } |
1120 | 1122 | $offset=$page*$MAX_ROWS_PER_PAGE;
|
1121 | 1123 | $sql.=" LIMIT $offset,$MAX_ROWS_PER_PAGE";
|
1122 | 1124 | $is_limited_sql=1;
|
|
0 commit comments