diff options
author | Remi Collet <fedora@famillecollet.com> | 2010-11-01 08:46:05 +0100 |
---|---|---|
committer | Remi Collet <fedora@famillecollet.com> | 2010-11-01 08:46:05 +0100 |
commit | c28b13eaeca04574994d5a7c2320bbce4c63450f (patch) | |
tree | babb19b528e46b85bbbdc59a78313d422f5bcd5a /class | |
parent | 1421a2207c0130030233e901d6f5055f54417e68 (diff) |
add new TableRpmRepo->getMaxStamp() method and use it
Diffstat (limited to 'class')
-rw-r--r-- | class/CommonTable.php | 4 | ||||
-rw-r--r-- | class/TableRpmRepo.php | 12 |
2 files changed, 16 insertions, 0 deletions
diff --git a/class/CommonTable.php b/class/CommonTable.php index ba3f7ad..0aeeb29 100644 --- a/class/CommonTable.php +++ b/class/CommonTable.php @@ -262,6 +262,10 @@ abstract class CommonTable **/ public function request ($crit='') { + if (is_string($crit) && strpos($crit,' ')) { + // $crit is a full SQL command + return new TableIterator ($this->db, $crit); + } return new TableIterator ($this->db, $this->table, $crit); } diff --git a/class/TableRpmRepo.php b/class/TableRpmRepo.php index a8ae44f..3144abe 100644 --- a/class/TableRpmRepo.php +++ b/class/TableRpmRepo.php @@ -108,6 +108,18 @@ class TableRpmRepo extends CommonTable } return $res; } + + /** + * Retrieve the greater update date + */ + function getMaxStamp() { + + $sql='SELECT MAX(stamp) AS stamp FROM '.$this->table; + foreach ($this->request($sql) as $res) { + return $res['stamp']; + } + return 0; + } } ?>
\ No newline at end of file |