Skip to content

Commit

Permalink
Add support for CLOB attributes in DerbyPlugIn
Browse files Browse the repository at this point in the history
Fetching data from CLOB attributes always returns null when using the Derby database. This patch returns a java.sql.Clob or the String representation of the CLOB column in the result set.
  • Loading branch information
hprange committed Jun 10, 2014
1 parent 4d8ec1c commit 4d3f685
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
import java.io.InputStream;
import java.lang.reflect.Method;
import java.math.BigDecimal;
import java.sql.Clob;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;

import com.webobjects.eoaccess.EOAdaptor;
Expand Down Expand Up @@ -380,6 +383,21 @@ public Class defaultExpressionClass() {
return DerbyExpression.class;
}

@Override
public Object fetchCLOB(ResultSet resultSet, int column, EOAttribute attribute, boolean materialize) throws SQLException {
Clob clob = resultSet.getClob(column);

if (clob == null) {
return null;
}

if (!materialize) {
return clob;
}

return clob.getSubString(1L, (int)clob.length());
}

/**
* This is usually extracted from the the database using JDBC, but this is
* really inconvenient for users who are trying to generate SQL at some. A
Expand Down

0 comments on commit 4d3f685

Please sign in to comment.