Work around missing functionality in ResultSet implementations.

This commit is contained in:
hns 2002-11-18 14:16:40 +00:00
parent 8c25c9f30b
commit b2159e9aef

View file

@ -16,6 +16,7 @@ import java.sql.*;
import helma.objectmodel.*; import helma.objectmodel.*;
import helma.util.*; import helma.util.*;
import helma.framework.IPathElement; import helma.framework.IPathElement;
import java.math.BigDecimal;
// import com.workingdogs.village.*; // import com.workingdogs.village.*;
@ -275,20 +276,20 @@ public final class Node implements INode, Serializable {
if (rel.reftype != Relation.PRIMITIVE && rel.reftype != Relation.REFERENCE) if (rel.reftype != Relation.PRIMITIVE && rel.reftype != Relation.REFERENCE)
continue; continue;
// Value val = rec.getValue (rel.getDbField ());
// if (val.isNull ())
// continue;
Property newprop = new Property (rel.propName, this); Property newprop = new Property (rel.propName, this);
// if (val.isNull ())
// newprop.setStringValue (null);
// else
switch (rel.getColumnType()) { switch (rel.getColumnType()) {
case Types.BIT: case Types.BIT:
newprop.setBooleanValue (rs.getBoolean(rel.getDbField())); String tmp = rs.getString (rel.getDbField());
if (tmp == null)
newprop.setBooleanValue (false);
else if (tmp.equalsIgnoreCase ("true") ||
tmp.equalsIgnoreCase ("yes") ||
tmp.equals ("1"))
newprop.setBooleanValue (true);
else
newprop.setBooleanValue (false);
break; break;
case Types.TINYINT: case Types.TINYINT:
@ -306,7 +307,7 @@ public final class Node implements INode, Serializable {
case Types.DECIMAL: case Types.DECIMAL:
case Types.NUMERIC: case Types.NUMERIC:
java.math.BigDecimal num = rs.getBigDecimal (rel.getDbField()); BigDecimal num = new BigDecimal (rs.getString (rel.getDbField()));
if (num.scale() > 0) if (num.scale() > 0)
newprop.setFloatValue (rs.getDouble(rel.getDbField())); newprop.setFloatValue (rs.getDouble(rel.getDbField()));
else else