1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-09 08:06:59 +02:00

IMAP: Number of rows

This commit is contained in:
Jakub Vrana
2025-03-18 12:52:17 +01:00
parent 693dc5b8a7
commit 57e6c2651c

View File

@@ -39,7 +39,10 @@ if (isset($_GET["imap"])) {
function query($query, $unbuffered = false) { function query($query, $unbuffered = false) {
if (preg_match('~DELETE FROM "(.+?)"~', $query)) { if (preg_match('~DELETE FROM "(.+?)"~', $query)) {
preg_match_all('~"uid" = (\d+)~', $query, $matches); preg_match_all('~"uid" = (\d+)~', $query, $matches);
imap_delete($this->imap, implode(",", $matches[1]), FT_UID); return imap_delete($this->imap, implode(",", $matches[1]), FT_UID);
} elseif (preg_match('~^SELECT COUNT\(\*\)\sFROM "(.+?)"~s', $query, $match)) {
$status = table_status($match[1]);
return new Result(array(array($status["Rows"])));
} elseif (preg_match('~^SELECT (.+)\sFROM "(.+?)"(?:\sWHERE "uid" = (\d+))?.*?(?:\sLIMIT (\d+)(?:\sOFFSET (\d+))?)?~s', $query, $match)) { } elseif (preg_match('~^SELECT (.+)\sFROM "(.+?)"(?:\sWHERE "uid" = (\d+))?.*?(?:\sLIMIT (\d+)(?:\sOFFSET (\d+))?)?~s', $query, $match)) {
list(, $columns, $table, $uid, $limit, $offset) = $match; list(, $columns, $table, $uid, $limit, $offset) = $match;
if ($uid) { if ($uid) {
@@ -109,6 +112,11 @@ if (isset($_GET["imap"])) {
next($this->result); next($this->result);
return $row; return $row;
} }
function fetch_row() {
$row = $this->fetch_assoc();
return ($row ? array_values($row) : false);
}
} }
} }