Java Utililty Methods SQL Type

List of utility methods to do SQL Type

Description

The list of methods to do SQL Type are organized into topic(s).

Method

java.io.InputStreamgetAsciiStream(Object value, int columnType)
get Ascii Stream
InputStream asciiStream = null;
if (value == null) {
    return null;
try {
    if (isString(columnType)) {
        asciiStream = new ByteArrayInputStream(((String) value).getBytes("ASCII"));
    } else {
...
StringgetBinary(Object value, int columnType)
get Binary
String result = null;
InputStream stream = null;
char[] buffer = new char[1024];
try {
    if ((columnType == java.sql.Types.BINARY) || (columnType == java.sql.Types.VARBINARY)
            || (columnType == java.sql.Types.LONGVARBINARY) || (columnType == java.sql.Types.BLOB)) {
        byte[] blobData = ((Blob) value).getBytes(1, (int) ((Blob) value).length());
        result = new String(blobData, "US-ASCII");
...
java.io.InputStreamgetBinaryStream(Object value, int columnType)
get Binary Stream
InputStream binaryStream = null;
if (value == null) {
    return null;
if ((isBinary(columnType) == false) && (isString(columnType) == false)) {
    throw new Exception(
            "binaryStream conversion failed. (" + value.toString().trim() + "/" + columnType + ")");
binaryStream = new ByteArrayInputStream((byte[]) value);
return (java.io.InputStream) binaryStream;
StringgetBIRTDataType(Integer datatype)
get BIRT Data Type
switch (datatype) {
case Types.BOOLEAN:
    return "boolean";
case Types.DATE:
    return "date-time";
case Types.DECIMAL:
    return "decimal";
case Types.DOUBLE:
...
ObjectgetCallableStatementValue(CallableStatement cstm, int index)
Gets the callable statement value.
Object obj = cstm.getObject(index);
if (obj instanceof Blob) {
    obj = cstm.getBytes(index);
} else if (obj instanceof Clob) {
    obj = cstm.getString(index);
} else if (obj != null && obj.getClass().getName().startsWith("oracle.sql.TIMESTAMP")) {
    obj = cstm.getTimestamp(index);
} else if (obj != null && obj.getClass().getName().startsWith("oracle.sql.DATE")) {
...
StringgetCastExpression(Class aClass)
get Cast Expression
if (Clob.class.isAssignableFrom(aClass))
    return "CAST (? as CLOB(1G))";
if (Blob.class.isAssignableFrom(aClass))
    return "CAST (? as BLOB(2G))";
return CAST_EPXPRESSIONS.get(aClass);
java.io.InputStreamgetCharStream(Object value, int columnType)
get Char Stream
java.io.InputStream charStream = null;
if (value == null) {
    return null;
if (isBinary(columnType)) {
    charStream = new ByteArrayInputStream((byte[]) value);
} else if (isString(columnType)) {
    charStream = new ByteArrayInputStream(value.toString().getBytes(StandardCharsets.UTF_8));
...
ClassgetClass(int sqlType, int precision, int scale)
get Class
switch (sqlType) {
case Types.BLOB:
case Types.BINARY:
case Types.LONGVARBINARY:
case Types.VARBINARY:
    return byte[].class;
case Types.BOOLEAN:
case Types.BIT:
...
ClassgetClassByJdbcType(int type, int decimalDigits)
get Class By Jdbc Type
switch (type) {
case Types.CHAR:
case Types.VARCHAR:
case Types.LONGVARCHAR:
    return String.class;
case Types.BIT:
case Types.BOOLEAN:
    return Boolean.class;
...
StringgetCloverTypeFromJdbcType(int jdbcDataType)
get Clover Type From Jdbc Type
switch (jdbcDataType) {
case Types.DATE:
case Types.TIME:
case Types.TIMESTAMP:
    return "date";
case Types.ARRAY:
case Types.BINARY:
case Types.DATALINK:
...