Skip to content

Commit

Permalink
Return blobs as Sequel::SQL::Blob when using H2
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyevans committed Dec 19, 2009
1 parent 5d1b216 commit 83d375b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
=== HEAD

* Return blobs as Sequel::SQL::Blob when using H2 (jeremyevans, paulfras)

* Add Database#each_server, which yields a new Database object for each server in the connection pool which is connected to only that server (jeremyevans)

* Add Dataset#each_server, which yields a dataset for each server in the connection pool which is will execute on that server (jeremyevans)
Expand Down
2 changes: 2 additions & 0 deletions lib/sequel/adapters/jdbc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,8 @@ def convert_type(v)
BigDecimal.new(v.to_string)
when Java::byte[]
Sequel::SQL::Blob.new(String.from_java_bytes(v))
when Java::JavaSQL::Blob
convert_type(v.getBytes(0, v.length))
else
v
end
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/type_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def create_items_table_with_column(name, type, opts={})
ds.first[:tim].strftime('%Y%m%d%H%M%S').should == t.strftime('%Y%m%d%H%M%S')
end

cspecify "should support generic file type", [:do], :h2, [:odbc, :mssql] do
cspecify "should support generic file type", [:do], [:odbc, :mssql] do
ds = create_items_table_with_column(:name, File)
ds.insert(:name => ("a\0"*300).to_sequel_blob)
ds.all.should == [{:name=>("a\0"*300).to_sequel_blob}]
Expand Down

0 comments on commit 83d375b

Please sign in to comment.