Skip to content

Commit 7903bd1

Browse files
committed
Add Result#the_value the return the first value of the first row of a result.
1 parent bfe15d4 commit 7903bd1

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/vertica/result.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,14 @@ def empty?
4747
@rows.empty?
4848
end
4949

50+
def the_value
51+
if empty?
52+
nil
53+
else
54+
@row_style == :array ? rows[0][0] : rows[0][columns[0].name]
55+
end
56+
end
57+
5058
alias_method :each, :each_row
5159

5260
def row_count

0 commit comments

Comments
 (0)