public LiteralParseNode literal(Object value, PDataType expectedType) throws SQLException { PDataType actualType = PDataType.fromLiteral(value); if (actualType != null && actualType != expectedType) { checkTypeMatch(expectedType, actualType); value = expectedType.toObject(value, actualType); } return new LiteralParseNode(value); /* Object typedValue = expectedType.toObject(value.toString()); return new LiteralParseNode(typedValue); */ }
public LiteralParseNode coerce(LiteralParseNode literalNode, PDataType expectedType) throws SQLException { PDataType actualType = literalNode.getType(); if (actualType != null) { Object before = literalNode.getValue(); checkTypeMatch(expectedType, actualType); Object after = expectedType.toObject(before, actualType); if (before != after) { literalNode = literal(after); } } return literalNode; }
public LiteralParseNode literal(Object value, PDataType expectedType) throws SQLException { PDataType actualType = PDataType.fromLiteral(value); if (actualType != null && actualType != expectedType) { checkTypeMatch(expectedType, actualType); value = expectedType.toObject(value, actualType); } return new LiteralParseNode(value); /* Object typedValue = expectedType.toObject(value.toString()); return new LiteralParseNode(typedValue); */ }
public LiteralParseNode literal(Object value, PDataType expectedType) throws SQLException { PDataType actualType = PDataType.fromLiteral(value); if (actualType != null && actualType != expectedType) { checkTypeMatch(expectedType, actualType); value = expectedType.toObject(value, actualType); } return new LiteralParseNode(value); /* Object typedValue = expectedType.toObject(value.toString()); return new LiteralParseNode(typedValue); */ }
public LiteralParseNode coerce(LiteralParseNode literalNode, PDataType expectedType) throws SQLException { PDataType actualType = literalNode.getType(); if (actualType != null) { Object before = literalNode.getValue(); checkTypeMatch(expectedType, actualType); Object after = expectedType.toObject(before, actualType); if (before != after) { literalNode = literal(after); } } return literalNode; }
public LiteralParseNode coerce(LiteralParseNode literalNode, PDataType expectedType) throws SQLException { PDataType actualType = literalNode.getType(); if (actualType != null) { Object before = literalNode.getValue(); checkTypeMatch(expectedType, actualType); Object after = expectedType.toObject(before, actualType); if (before != after) { literalNode = literal(after); } } return literalNode; }