liquibase/liquibase — pull request #190 by dmitrygusev (2013-10-14 22:58:29+00:00)
Title: Support for relative paths in valueBlobFile and valueClobFile attributes

This PR allows valueBlobFile and valueClobFile contain relative paths.
Paths may be relative to current change log file.

Also previous implementation doesn't allowed to load CLOB content from classpath resources, this patch fixes this.

Previous implementation of loading BLOBs from classpath might not working as expected, because it used value of `file.length()` of non-existing files, which is 0L, by passing it to http://docs.oracle.com/javase/6/docs/api/java/sql/PreparedStatement.html#setBinaryStream(int,%20java.io.InputStream,%20int).
I couldn't find any tests for this in liquibase, but I think that some JDBC drivers might not support 0L as value of length (or might simply take 0 bytes, i.e. nothing, from the stream).

What I did in this PR is copied the LOBs from streams into memory entirely to calculate the length, which may not work good by the means of memory consumption for really large files. Another way may be to use http://docs.oracle.com/javase/6/docs/api/java/sql/PreparedStatement.html#setBinaryStream(int,%20java.io.InputStream) without length parameter, but this requires Java 6 and JDBC 4.