Search in sources :

Example 11 with BinaryData

use of org.hsqldb_voltpatches.types.BinaryData in project voltdb by VoltDB.

the class RowInputText method readBinary.

protected BinaryData readBinary() throws IOException {
    String s = readString();
    if (s == null) {
        return null;
    }
    BinaryData data = scanner.convertToBinary(s);
    return data;
}
Also used : BinaryData(org.hsqldb_voltpatches.types.BinaryData)

Example 12 with BinaryData

use of org.hsqldb_voltpatches.types.BinaryData in project voltdb by VoltDB.

the class ExpressionValue method voltMutateToBigintType.

// A VoltDB extension to allow X'..' as numeric literals
/**
     * Given a ExpressionValue that is a VARBINARY constant,
     * convert it to a BIGINT constant.  Returns true for a
     * successful conversion and false otherwise.
     *
     * For more details on how the conversion is performed, see BinaryData.toLong().
     *
     * @param parent      Reference of parent expression
     * @param childIndex  Index of this node in parent
     * @return true for a successful conversion and false otherwise.
     */
public static boolean voltMutateToBigintType(Expression maybeConstantNode, Expression parent, int childIndex) {
    if (maybeConstantNode.opType == OpTypes.VALUE && maybeConstantNode.dataType != null && maybeConstantNode.dataType.isBinaryType()) {
        ExpressionValue exprVal = (ExpressionValue) maybeConstantNode;
        if (exprVal.valueData == null) {
            return false;
        }
        BinaryData data = (BinaryData) exprVal.valueData;
        parent.nodes[childIndex] = new ExpressionValue(data.toLong(), Type.SQL_BIGINT);
        return true;
    }
    return false;
}
Also used : BinaryData(org.hsqldb_voltpatches.types.BinaryData)

Aggregations

BinaryData (org.hsqldb_voltpatches.types.BinaryData)12 BitMap (org.hsqldb_voltpatches.store.BitMap)2 JavaObjectData (org.hsqldb_voltpatches.types.JavaObjectData)2 NumberType (org.hsqldb_voltpatches.types.NumberType)2 Serializable (java.io.Serializable)1 BigDecimal (java.math.BigDecimal)1 HSQLParseException (org.hsqldb_voltpatches.HSQLInterface.HSQLParseException)1 HsqlException (org.hsqldb_voltpatches.HsqlException)1 HsqlByteArrayOutputStream (org.hsqldb_voltpatches.lib.HsqlByteArrayOutputStream)1 DTIType (org.hsqldb_voltpatches.types.DTIType)1 TimestampData (org.hsqldb_voltpatches.types.TimestampData)1 Type (org.hsqldb_voltpatches.types.Type)1