Summary | History: Add getLatestEntry($guid) |
Queue | Horde Framework Packages |
Queue Version | Git master |
Type | Enhancement |
State | Resolved |
Priority | 1. Low |
Owners | mrubinsk (at) horde (dot) org |
Requester | thomas.jarosch (at) intra2net (dot) com |
Created | 08/10/2013 (4336 days ago) |
Due | |
Updated | 08/22/2013 (4324 days ago) |
Assigned | 08/21/2013 (4325 days ago) |
Resolved | 08/22/2013 (4324 days ago) |
Milestone | |
Patch | Yes |
State ⇒ Resolved
commit e5df3a27d590dfe98ec936cfc6706784593c5399
Author: Thomas Jarosch <thomas.jarosch@intra2net.com>
Date: Wed Aug 21 10:57:19 2013 +0200
Add getLatestEntry($guid) to get the latest history entry for a
given $guid
The SQL version is very efficient since it does not need
to loop through all history entries for the object
to determine the latest entry.
Request 12558Signed-off-by: Michael J Rubinsky <mrubinsk@horde.org>
framework/History/lib/Horde/History.php | 36
+++++++++++++++++++++++++++
framework/History/lib/Horde/History/Sql.php | 32 ++++++++++++++++++++++++
2 files changed, 68 insertions(+), 0 deletions(-)
http://git.horde.org/horde-git/-/commit/e5df3a27d590dfe98ec936cfc6706784593c5399
New Attachment: v2-0001-Add-getLatestEntry-guid-to-get-the-latest-history-en.patch
State ⇒ Assigned
Also I've fixed a bug that only occurred during productive testing:
If db->selectOne() didn't find a row, it returned an array with
all the requested keys set and empty values. Could be related to the
MAX() statement
and/or the explicit specification of the field names in the previous
SQL statement.
Therefore I've adapted the code to check if $row['history_id'] is really set.
No unit test yet, productive testing has to do for now :o)
State ⇒ Accepted
a typo and already pressed the submit button :)
non-aggregate fields in the query along with an aggregate field
(MAX). This will work in mySql, but not pgsql. That being said, can
you just get rid of the MAX and use ORDER BY history_modseq DESC
and add limit => 1 instead? See
Bug: 12476I'll revisit this probably after my holidays (=October). The latest changes
to the Kolab Horde History already make use of it but as my
pull request doesn't see any sign of live, it's not a problem anyway :P
non-aggregate fields in the query along with an aggregate field (MAX).
This will work in mySql, but not pgsql. That being said, can you just
get rid of the MAX and use ORDER BY history_modseq DESC and add limit
=> 1 instead? See
Bug: 12476Also, would be great if you could add a test as well :)
New Attachment: 0001-Add-getLatestEntry-guid-to-get-the-latest-history-en.patch
State ⇒ Feedback
State ⇒ New
New Attachment: 0001-Remove-empty-birthday-or-anniversary-fields-during-K.patch
Patch ⇒ Yes
Milestone ⇒
Priority ⇒ 1. Low
Type ⇒ Enhancement
Summary ⇒ History: Add getLatestEntry($guid)
Queue ⇒ Horde Framework Packages
I needed a way to get the latest history entry for a given $guid.
Since I needed it in two places now, I thought it's a good
idea to have a generic implementation in Horde_History.
I've also written an efficient version for the SQL driver
and tested both. Please see the attached patch.
Cheers,
Thomas