<?xml version="1.0" encoding="UTF-8"?> 
<?xml-stylesheet href="https://dev.horde.org/themes/horde//default/feed-rss.xsl" type="text/xsl"?> 
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> 
 <channel> 
  <title>History: Add getLatestEntry($guid)</title> 
  <pubDate>Fri, 10 Apr 2026 19:28:21 +0000</pubDate> 
  <link>https://bugs.horde.org/ticket/12558</link> 
  <atom:link rel="self" type="application/rss+xml" title="History: Add getLatestEntry($guid)" href="https://bugs.horde.org/ticket/12558/rss" /> 
  <description>History: Add getLatestEntry($guid)</description> 
 
   
   
  <item> 
   <title>Hi,

I needed a way to get the latest history entry for a </title> 
   <description>Hi,

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&#039;s a good
idea to have a generic implementation in Horde_History.

I&#039;ve also written an efficient version for the SQL driver
and tested both. Please see the attached patch.

Cheers,
Thomas
</description> 
   <pubDate>Sat, 10 Aug 2013 15:42:00 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/12558#t79919</link> 
  </item> 
   
  <item> 
   <title>Looks like you attached the wrong patch?</title> 
   <description>Looks like you attached the wrong patch?</description> 
   <pubDate>Mon, 12 Aug 2013 18:23:43 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/12558#t79935</link> 
  </item> 
   
  <item> 
   <title>&gt; Looks like you attached the wrong patch?

thanks, this i</title> 
   <description>&gt; Looks like you attached the wrong patch?

thanks, this is the right one :)
</description> 
   <pubDate>Mon, 12 Aug 2013 18:53:14 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/12558#t79940</link> 
  </item> 
   
  <item> 
   <title>You will need to add a GROUP BY clause if you are returning </title> 
   <description>You will need to add a GROUP BY clause if you are returning 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 =&gt; 1 instead? See Bug: 12476


Also, would be great if you could add a test as well :)

</description> 
   <pubDate>Mon, 12 Aug 2013 19:28:56 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/12558#t79944</link> 
  </item> 
   
  <item> 
   <title>&gt; You will need to add a GROUP BY clause if you are returnin</title> 
   <description>&gt; You will need to add a GROUP BY clause if you are returning 
&gt; non-aggregate fields in the query along with an aggregate field 
&gt; (MAX). This will work in mySql, but not pgsql. That being said, can 
&gt; you just get rid of the MAX and use ORDER BY history_modseq DESC  and 
&gt; add limit =&gt; 1 instead? See Bug: 12476

ok, can do.

&gt; Also, would be great if you could add a test as well :)

I knew you would say that :o)

I&#039;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&#039;t see any sign of live, it&#039;s not a problem anyway :P
</description> 
   <pubDate>Mon, 12 Aug 2013 20:31:43 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/12558#t79947</link> 
  </item> 
   
  <item> 
   <title>&gt; sign of live

...we all love this moment in life when yo</title> 
   <description>&gt; sign of live

...we all love this moment in life when you spot
a typo and already pressed the submit button :)
</description> 
   <pubDate>Mon, 12 Aug 2013 20:33:23 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/12558#t79948</link> 
  </item> 
   
  <item> 
   <title>I&#039;ve updated the code with the optimized SQL statement using</title> 
   <description>I&#039;ve updated the code with the optimized SQL statement using ORDER BY.

Also I&#039;ve fixed a bug that only occurred during productive testing:
If db-&gt;selectOne() didn&#039;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&#039;ve adapted the code to check if $row[&#039;history_id&#039;] is really set.
No unit test yet, productive testing has to do for now :o)
</description> 
   <pubDate>Wed, 21 Aug 2013 09:13:46 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/12558#t80160</link> 
  </item> 
   
  <item> 
   <title>Changes have been made in Git (master):

commit e5df3a27d590</title> 
   <description>Changes have been made in Git (master):

commit e5df3a27d590dfe98ec936cfc6706784593c5399
Author: Thomas Jarosch &lt;thomas.jarosch@intra2net.com&gt;
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 12558
    
    Signed-off-by: Michael J Rubinsky &lt;mrubinsk@horde.org&gt;

 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</description> 
   <pubDate>Thu, 22 Aug 2013 03:57:40 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/12558#t80183</link> 
  </item> 
   
  <item> 
   <title>Committed, thanks!</title> 
   <description>Committed, thanks!</description> 
   <pubDate>Thu, 22 Aug 2013 03:58:04 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/12558#t80184</link> 
  </item> 
   
   
 
 </channel> 
</rss> 
