Sha256: 83b852f0b30949b7db71a56bc8b497bb42289446241963de884282135af1a95e
Contents?: true
Size: 803 Bytes
Versions: 2
Compression:
Stored size: 803 Bytes
Contents
#This class handels results when running in JRuby. class Baza::Driver::Sqlite3::ResultJava def initialize(driver, rs) @index = 0 retkeys = driver.baza.opts[:return_keys] if rs metadata = rs.getMetaData columns_count = metadata.getColumnCount @rows = [] while rs.next row_data = {} for i in (1..columns_count) col_name = metadata.getColumnName(i).to_sym row_data[col_name] = rs.getString(i) end @rows << row_data end end end #Returns a single result. def fetch return false unless @rows ret = @rows[@index] return false unless ret @index += 1 return ret end #Loops over every result and yields them. def each while data = fetch yield data end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
baza-0.0.17 | include/drivers/sqlite3/sqlite3_result_java.rb |
baza-0.0.16 | include/drivers/sqlite3/sqlite3_result_java.rb |