mirror of
https://github.com/postfixadmin/postfixadmin.git
synced 2024-09-19 19:22:14 +02:00
functions.inc.php:
- create_page_browser(): added queries for PgSQL (untested!) git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1033 a1433add-5e2c-0410-b055-b7f2511e0802
This commit is contained in:
parent
cf1fde5194
commit
799cd9c2f3
@ -600,6 +600,9 @@ function create_page_browser($idxfield, $querypart) {
|
|||||||
|
|
||||||
# init row counter
|
# init row counter
|
||||||
$initcount = "SET @row=-1";
|
$initcount = "SET @row=-1";
|
||||||
|
if ('pgsql'==$CONF['database_type']) {
|
||||||
|
$initcount = "CREATE TEMPORARY SEQUENCE rowcount MINVALUE 0";
|
||||||
|
}
|
||||||
$result = db_query($initcount);
|
$result = db_query($initcount);
|
||||||
|
|
||||||
# get labels for relevant rows (first and last of each page)
|
# get labels for relevant rows (first and last of each page)
|
||||||
@ -609,6 +612,13 @@ function create_page_browser($idxfield, $querypart) {
|
|||||||
SELECT $idxfield AS label, @row := @row + 1 AS row $querypart
|
SELECT $idxfield AS label, @row := @row + 1 AS row $querypart
|
||||||
) idx WHERE MOD(idx.row, $page_size) IN (0,$page_size_zerobase) OR idx.row = $count_results
|
) idx WHERE MOD(idx.row, $page_size) IN (0,$page_size_zerobase) OR idx.row = $count_results
|
||||||
";
|
";
|
||||||
|
if ('pgsql'==$CONF['database_type']) {
|
||||||
|
$query = "
|
||||||
|
SELECT * FROM (
|
||||||
|
SELECT $idxfield AS label, nextval('rowcount') AS row $querypart
|
||||||
|
) idx WHERE MOD(idx.row, $page_size) IN (0,$page_size_zerobase) OR idx.row = $count_results
|
||||||
|
";
|
||||||
|
}
|
||||||
# echo "<p>$query";
|
# echo "<p>$query";
|
||||||
|
|
||||||
# TODO: $query is MySQL-specific
|
# TODO: $query is MySQL-specific
|
||||||
@ -633,6 +643,10 @@ function create_page_browser($idxfield, $querypart) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ('pgsql'==$CONF['database_type']) {
|
||||||
|
db_query ("DROP SEQUENCE rowcount");
|
||||||
|
}
|
||||||
|
|
||||||
return $pagebrowser;
|
return $pagebrowser;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user