<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,4 +1,11 @@
 = Amalgalite Changelog
+== Version 0.7.4 - 2009-02-08
+
+=== Bug Fixes
+
+* fix Database#first_row_from not behaving the same as Database#execute() when
+  there are no results. [reported by James Edward Gray II]
+
 == Version 0.7.3 - 2009-02-08
 
 === Enhancements</diff>
      <filename>HISTORY</filename>
    </modified>
    <modified>
      <diff>@@ -334,21 +334,21 @@ module Amalgalite
     ##
     # Execute a sql statment, and only return the first row of results.  This
     # is a shorthand method when you only want a single row of results from a
-    # query.
+    # query.  If there is no result, then return an empty array
     #
     # It is in all other was, exactly like #execute()
     #
     def first_row_from( sql, *bind_params ) 
       stmt = prepare( sql )
       stmt.bind( *bind_params)
-      row = stmt.next_row
+      row = stmt.next_row || []
       stmt.close
       return row
     end
 
     ##
     # Execute an sql statement, and return only the first column of the first
-    # row.  
+    # row.  If there is no result, return nil.
     #
     # It is in all other ways, exactly like #first_row_from()
     #</diff>
      <filename>lib/amalgalite/database.rb</filename>
    </modified>
    <modified>
      <diff>@@ -9,7 +9,7 @@ module Amalgalite
 
     MAJOR   = 0
     MINOR   = 7
-    BUILD   = 3
+    BUILD   = 4
 
     #
     # return the Version as an array of MAJOR, MINOR, BUILD</diff>
      <filename>lib/amalgalite/version.rb</filename>
    </modified>
    <modified>
      <diff>@@ -122,6 +122,11 @@ describe Amalgalite::Database do
     db.execute_batch( @schema ).should == 5
   end
 
+  it &quot;returns an empty array when there are no results&quot; do
+    row = @iso_db.execute(&quot;SELECT * from subcountry where country = 'Antarctica'&quot;)
+    row.should be_empty
+  end
+
   it &quot;traces the execution of code&quot; do
     db = Amalgalite::Database.new( SpecInfo.test_db )
     sql = &quot;CREATE TABLE trace_test( x, y, z)&quot;
@@ -360,6 +365,7 @@ describe Amalgalite::Database do
     all_sub.should == ( us_sub + other_sub )
 
   end
+
   it &quot;rolls back a savepoint&quot; do
     all_sub = @iso_db.execute(&quot;SELECT count(*) as cnt from subcountry&quot;).first['cnt']
     lambda {
@@ -413,6 +419,16 @@ describe Amalgalite::Database do
     row['count'].should == 232
   end
 
+  it &quot;returns and empty row if there are no results for the first row&quot; do
+    row = @iso_db.first_row_from(&quot;SELECT * from subcountry where country = 'Antarctica'&quot;)
+    row.should be_empty
+  end
+
+  it &quot;returns nil if there is no value in the first value&quot; do
+    val = @iso_db.first_value_from(&quot;select * from subcountry where country = 'Antarctica'&quot; )
+    val.should == nil
+  end
+
   it &quot;returns the first value of results as a conveinience&quot; do
     val = @iso_db.first_value_from(&quot;SELECT count(*) from subcountry &quot;)
     val.should == 3995</diff>
      <filename>spec/database_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>e616d67d0cfa3173a9c28a5aa303075104c3c694</id>
    </parent>
  </parents>
  <author>
    <name>Jeremy Hinegardner</name>
    <email>jeremy@hinegardner.org</email>
  </author>
  <url>http://github.com/copiousfreetime/amalgalite/commit/fcec18d7467621f145fbda84078bfd4724a010fb</url>
  <id>fcec18d7467621f145fbda84078bfd4724a010fb</id>
  <committed-date>2009-02-08T19:48:11-08:00</committed-date>
  <authored-date>2009-02-08T19:48:11-08:00</authored-date>
  <message>Fix Database#first_row_from on empty result

* Database#first_row_from is supposed to behave the same as #execute() but was
  not in the case where there were no results.</message>
  <tree>d6e61ff7f8e94096ecc69181808766dac49afc73</tree>
  <committer>
    <name>Jeremy Hinegardner</name>
    <email>jeremy@hinegardner.org</email>
  </committer>
</commit>
