@Test(expected = IllegalArgumentException.class) public void testWrapObjectThrowsIllegalArgumentExceptionUsingDateType() { KylinClient.wrapObject("OQ? PYC6BWm`kOE", Types.DATE); }
public static Object wrapObject(String value, int sqlType) { if (null == value) { return null; } switch (sqlType) { case Types.CHAR: case Types.VARCHAR: case Types.LONGVARCHAR: return value; case Types.NUMERIC: case Types.DECIMAL: return new BigDecimal(value); case Types.BIT: case Types.BOOLEAN: return Boolean.valueOf(value); case Types.TINYINT: return Byte.valueOf(value); case Types.SMALLINT: return Short.valueOf(value); case Types.INTEGER: return Integer.valueOf(value); case Types.BIGINT: return Long.valueOf(value); case Types.FLOAT: return Float.valueOf(value); case Types.REAL: case Types.DOUBLE: return Double.valueOf(value); case Types.BINARY: case Types.VARBINARY: case Types.LONGVARBINARY: return value.getBytes(StandardCharsets.UTF_8); case Types.DATE: return dateConvert(value); case Types.TIME: return Time.valueOf(value); case Types.TIMESTAMP: return timestampConvert(value); default: break; } return value; }
KylinClient implements IRemoteClient { public static Object wrapObject(String value, int sqlType) { if (null == value) { return null; } switch (sqlType) { case Types.CHAR: case Types.VARCHAR: case Types.LONGVARCHAR: return value; case Types.NUMERIC: case Types.DECIMAL: return new BigDecimal(value); case Types.BIT: case Types.BOOLEAN: return Boolean.valueOf(value); case Types.TINYINT: return Byte.valueOf(value); case Types.SMALLINT: return Short.valueOf(value); case Types.INTEGER: return Integer.valueOf(value); case Types.BIGINT: return Long.valueOf(value); case Types.FLOAT: return Float.valueOf(value); case Types.REAL: case Types.DOUBLE: return Double.valueOf(value); case Types.BINARY: case Types.VARBINARY: case Types.LONGVARBINARY: return value.getBytes(StandardCharsets.UTF_8); case Types.DATE: return dateConvert(value); case Types.TIME: return Time.valueOf(value); case Types.TIMESTAMP: return timestampConvert(value); default: break; } return value; } }
KylinClient implements IRemoteClient { public static Object wrapObject(String value, int sqlType) { if (null == value) { return null; } switch (sqlType) { case Types.CHAR: case Types.VARCHAR: case Types.LONGVARCHAR: return value; case Types.NUMERIC: case Types.DECIMAL: return new BigDecimal(value); case Types.BIT: case Types.BOOLEAN: return Boolean.valueOf(value); case Types.TINYINT: return Byte.valueOf(value); case Types.SMALLINT: return Short.valueOf(value); case Types.INTEGER: return Integer.valueOf(value); case Types.BIGINT: return Long.valueOf(value); case Types.FLOAT: return Float.valueOf(value); case Types.REAL: case Types.DOUBLE: return Double.valueOf(value); case Types.BINARY: case Types.VARBINARY: case Types.LONGVARBINARY: return value.getBytes(StandardCharsets.UTF_8); case Types.DATE: return dateConvert(value); case Types.TIME: return Time.valueOf(value); case Types.TIMESTAMP: return timestampConvert(value); default: break; } return value; } KylinClient(KylinConnectionInfo connInfo); }
KylinClient implements IRemoteClient { public static Object wrapObject(String value, int sqlType) { if (null == value) { return null; } switch (sqlType) { case Types.CHAR: case Types.VARCHAR: case Types.LONGVARCHAR: return value; case Types.NUMERIC: case Types.DECIMAL: return new BigDecimal(value); case Types.BIT: case Types.BOOLEAN: return Boolean.valueOf(value); case Types.TINYINT: return Byte.valueOf(value); case Types.SMALLINT: return Short.valueOf(value); case Types.INTEGER: return Integer.valueOf(value); case Types.BIGINT: return Long.valueOf(value); case Types.FLOAT: return Float.valueOf(value); case Types.REAL: case Types.DOUBLE: return Double.valueOf(value); case Types.BINARY: case Types.VARBINARY: case Types.LONGVARBINARY: return value.getBytes(StandardCharsets.UTF_8); case Types.DATE: return dateConvert(value); case Types.TIME: return Time.valueOf(value); case Types.TIMESTAMP: return timestampConvert(value); default: break; } return value; } KylinClient(KylinConnectionInfo connInfo); @SuppressWarnings("rawtypes") static Class convertType(int sqlType); static Object wrapObject(String value, int sqlType); @Override void connect(); @Override KMetaProject retrieveMetaData(String project); @Override QueryResult executeQuery(String sql, List<Object> paramValues,
            Map<String, String> queryToggles); @Override void close(); }
KylinClient implements IRemoteClient { public static Object wrapObject(String value, int sqlType) { if (null == value) { return null; } switch (sqlType) { case Types.CHAR: case Types.VARCHAR: case Types.LONGVARCHAR: return value; case Types.NUMERIC: case Types.DECIMAL: return new BigDecimal(value); case Types.BIT: case Types.BOOLEAN: return Boolean.valueOf(value); case Types.TINYINT: return Byte.valueOf(value); case Types.SMALLINT: return Short.valueOf(value); case Types.INTEGER: return Integer.valueOf(value); case Types.BIGINT: return Long.valueOf(value); case Types.FLOAT: return Float.valueOf(value); case Types.REAL: case Types.DOUBLE: return Double.valueOf(value); case Types.BINARY: case Types.VARBINARY: case Types.LONGVARBINARY: return value.getBytes(StandardCharsets.UTF_8); case Types.DATE: return dateConvert(value); case Types.TIME: return Time.valueOf(value); case Types.TIMESTAMP: return timestampConvert(value); default: break; } return value; } KylinClient(KylinConnectionInfo connInfo); @SuppressWarnings("rawtypes") static Class convertType(int sqlType); static Object wrapObject(String value, int sqlType); @Override void connect(); @Override KMetaProject retrieveMetaData(String project); @Override QueryResult executeQuery(String sql, List<Object> paramValues,
            Map<String, String> queryToggles); @Override void close();  }