lib/meta_db/connection.rb in meta_db-0.1.1 vs lib/meta_db/connection.rb in meta_db-0.2.0
- old
+ new
@@ -1,7 +1,10 @@
module MetaDb
+
+ # FIXME Why on earth did I do this?
+ #
class Connection
# In derived classes, no initialization may take place after the call to
# super because otherwise #initialize would call the user-supplied block
# with a partial initialized object
def initialize(options)
@@ -41,9 +44,23 @@
end
class Result
def initialize(result) @result = result end
def size() raise end
+
+ # Returns the value of the first field of the first record in the result
+ # set
+ def value() each_tuple.first.first end
+
+ # Returns a hash of the first record in the result set
+ def record() each_hash.first end
+
+ # Returns an array of the first record in the result set
+ def tuple() each_tupe.first end
+
+ def each_record() each_hash end
+ def each_tuple() each_array end
+
def each_hash() raise end
def each_array() raise end
def to_a() each_array end
end