GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
Sequel Blob translation to literal SQL was not implemented.
Note: I disabled the integration test regarding escaping 'binary' data for jdbc/db2. By default, the DB2 adapter will use the DB datatype :clob to represent 'File' via the use_clob_as_blob setting. I'm not sure why that's the default but the integration test would need to check that setting the cast differently. I simply omitted the adapter from the test as I believe it is now covered in the adapter spec.
clean up test
fix binary data escaping for DB2
This looks good. I'll test on DB2 and assuming no problems this will get merged with some minor changes.
use_clob_as_blob is the default because the person who added the original DB2 support set it up that way. I'm open to changing that to false. The last time I tried, the integration tests failed, but if they can be made to work with it set to false, I'm all for it.
Note that what cspecify does is skip the example for matching adapter/database (actually running the test for all other adapters/databases). So you should only remove the jdbc/db2 from the cspecify line if you have tested on jdbc/db2 and found that the example works there.
Minor other note: we don't use let in the Sequel specs (for consistency with the existing specs). In general, Sequel does not use RSpec features introduced after 1.2.
I'm getting failures with both the jdbc/db2 and ibmdb adapters when running rake spec_db2. Did you run rake spec_db2 to test your changes before submitting the pull request?
Example with ibmdb:
12) Sequel::DatabaseError in 'Bound Argument Types should handle boolean type'
Sequel::IBMDB::Connection::Error: [IBM][CLI Driver][DB2/LINUX] SQL0408N A value is not compatible with the data type of its assignment target. Target name is "FILE". SQLSTATE=42821 SQLCODE=-408 ./spec/integration/prepared_statement_test.rb:277:
My guess is this is because we are using the clob type due to use_clob_as_blob being true by default, but the code is use the BLOB casting. We should probably make blob literalization respect use_clob_as_blob, so that it uses a regular string if use_clob_as_blob is true. I'll see if I can work on that tomorrow.