Skip to content

Commit

Permalink
add support of CLOB to H2
Browse files Browse the repository at this point in the history
  • Loading branch information
darkv committed Jul 26, 2012
1 parent ec07c31 commit 68e9de2
Showing 1 changed file with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.io.InputStream;
import java.math.BigDecimal;
import java.sql.Blob;
import java.sql.Clob;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
Expand All @@ -26,10 +27,6 @@
import com.webobjects.foundation.NSPropertyListSerialization;
import com.webobjects.foundation.NSTimestamp;
import com.webobjects.foundation._NSStringUtilities;
import com.webobjects.jdbcadaptor.JDBCAdaptor;
import com.webobjects.jdbcadaptor.JDBCAdaptorException;
import com.webobjects.jdbcadaptor.JDBCExpression;
import com.webobjects.jdbcadaptor.JDBCPlugIn;

public class _H2PlugIn extends JDBCPlugIn {
static final boolean USE_NAMED_CONSTRAINTS = true;
Expand Down Expand Up @@ -85,6 +82,19 @@ public Object fetchBLOB(ResultSet rs, int column, EOAttribute attribute, boolean
return data;
}

@Override
public Object fetchCLOB(ResultSet rs, int column, EOAttribute attribute, boolean materialize) throws SQLException {
Clob clob = rs.getClob(column);
if (clob == null) {
return null;
}
if (!materialize) {
return clob;
} else {
return clob.getSubString(1L, (int) clob.length());
}
}

public static class H2Expression extends JDBCExpression {

public H2Expression(final EOEntity entity) {
Expand Down

0 comments on commit 68e9de2

Please sign in to comment.