use of java.sql.Ref in project robovm by robovm.
the class OldPreparedStatementTest method testSetRef.
public void testSetRef() {
ResultSet res = null;
PreparedStatement ps = null;
Ref mock = new MockRef();
try {
String neverExecutedQuery = "select TBlob from type;";
ps = conn.prepareStatement(neverExecutedQuery);
ps.setRef(1, mock);
fail("Exception expected not supported");
} catch (SQLException e) {
//ok
}
}
use of java.sql.Ref in project druid by alibaba.
the class ResultSetProxyImpl method getRef.
@Override
public Ref getRef(String columnLabel) throws SQLException {
FilterChainImpl chain = createChain();
Ref value = chain.resultSet_getRef(this, columnLabel);
recycleFilterChain(chain);
return value;
}
use of java.sql.Ref in project druid by alibaba.
the class ResultSetProxyImpl method getRef.
@Override
public Ref getRef(int columnIndex) throws SQLException {
FilterChainImpl chain = createChain();
Ref value = chain.resultSet_getRef(this, columnIndex);
recycleFilterChain(chain);
return value;
}
use of java.sql.Ref in project dbeaver by serge-rider.
the class JDBCReferenceValueHandler method getValueFromObject.
@Override
public JDBCReference getValueFromObject(@NotNull DBCSession session, @NotNull DBSTypedObject type, Object object, boolean copy) throws DBCException {
String typeName;
try {
if (object instanceof Ref) {
typeName = ((Ref) object).getBaseTypeName();
} else {
typeName = type.getTypeName();
}
} catch (SQLException e) {
throw new DBCException(e, session.getDataSource());
}
DBSDataType dataType = null;
try {
dataType = DBUtils.resolveDataType(session.getProgressMonitor(), session.getDataSource(), typeName);
} catch (DBException e) {
log.error("Error resolving data type '" + typeName + "'", e);
}
if (dataType == null) {
dataType = new JDBCDataType(session.getDataSource().getContainer(), Types.REF, typeName, "Synthetic struct type for reference '" + typeName + "'", false, false, 0, 0, 0);
}
if (object == null) {
return new JDBCReference(dataType, null);
} else if (object instanceof JDBCReference) {
return (JDBCReference) object;
} else if (object instanceof Ref) {
return new JDBCReference(dataType, (Ref) object);
} else {
throw new DBCException("Unsupported struct type: " + object.getClass().getName());
}
}
Aggregations