def next_row
row = []
case rc = @stmt_api.step
when ResultCode::ROW
result_meta.each_with_index do |col, idx|
value = nil
column_type = @stmt_api.column_type( idx )
case column_type
when DataType::TEXT
value = @stmt_api.column_text( idx )
when DataType::FLOAT
value = @stmt_api.column_double( idx )
when DataType::INTEGER
value = @stmt_api.column_int64( idx )
when DataType::NULL
value = nil
when DataType::BLOB
if using_rowid_column? then
value = Amalgalite::Blob.new( :db_blob => SQLite3::Blob.new( db.api,
col.schema.db,
col.schema.table,
col.schema.name,
@stmt_api.column_int64( @rowid_index ),
"r"),
:column => col.schema)
else
value = Amalgalite::Blob.new( :string => @stmt_api.column_blob( idx ), :column => col.schema )
end
else
raise ::Amalgalite::Error, "BUG! : Unknown SQLite column type of #{column_type}"
end
row << db.type_map.result_value_of( col.schema.declared_data_type, value )
end
row.fields = result_fields
when ResultCode::DONE
row = nil
write_blobs
else
self.close
msg = "SQLITE ERROR #{rc} (#{Amalgalite::SQLite3::Constants::ResultCode.name_from_value( rc )}) : #{@db.api.last_error_message}"
raise Amalgalite::SQLite3::Error, msg
end
return row
end