List of usage examples for java.sql Types LONGVARCHAR
int LONGVARCHAR
To view the source code for java.sql Types LONGVARCHAR.
Click Source Link
The constant in the Java programming language, sometimes referred to as a type code, that identifies the generic SQL type LONGVARCHAR
.
From source file:org.apache.ddlutils.platform.mssql.MSSqlPlatform.java
/** * Creates a new platform instance./*from www. java 2s . com*/ */ public MSSqlPlatform() { PlatformInfo info = getPlatformInfo(); info.setMaxIdentifierLength(128); info.setPrimaryKeyColumnAutomaticallyRequired(true); info.setIdentityColumnAutomaticallyRequired(true); info.setMultipleIdentityColumnsSupported(false); info.setSupportedOnUpdateActions( new CascadeActionEnum[] { CascadeActionEnum.CASCADE, CascadeActionEnum.NONE }); info.addEquivalentOnUpdateActions(CascadeActionEnum.NONE, CascadeActionEnum.RESTRICT); info.setSupportedOnDeleteActions( new CascadeActionEnum[] { CascadeActionEnum.CASCADE, CascadeActionEnum.NONE }); info.addEquivalentOnDeleteActions(CascadeActionEnum.NONE, CascadeActionEnum.RESTRICT); info.addNativeTypeMapping(Types.ARRAY, "IMAGE", Types.LONGVARBINARY); // BIGINT will be mapped back to BIGINT by the model reader info.addNativeTypeMapping(Types.BIGINT, "DECIMAL(19,0)"); info.addNativeTypeMapping(Types.BLOB, "IMAGE", Types.LONGVARBINARY); info.addNativeTypeMapping(Types.BOOLEAN, "BIT", Types.BIT); info.addNativeTypeMapping(Types.CLOB, "TEXT", Types.LONGVARCHAR); info.addNativeTypeMapping(Types.DATALINK, "IMAGE", Types.LONGVARBINARY); info.addNativeTypeMapping(Types.DATE, "DATETIME", Types.TIMESTAMP); info.addNativeTypeMapping(Types.DISTINCT, "IMAGE", Types.LONGVARBINARY); info.addNativeTypeMapping(Types.DOUBLE, "FLOAT", Types.FLOAT); info.addNativeTypeMapping(Types.INTEGER, "INT"); info.addNativeTypeMapping(Types.JAVA_OBJECT, "IMAGE", Types.LONGVARBINARY); info.addNativeTypeMapping(Types.LONGVARBINARY, "IMAGE"); info.addNativeTypeMapping(Types.LONGVARCHAR, "TEXT"); info.addNativeTypeMapping(Types.NULL, "IMAGE", Types.LONGVARBINARY); info.addNativeTypeMapping(Types.OTHER, "IMAGE", Types.LONGVARBINARY); info.addNativeTypeMapping(Types.REF, "IMAGE", Types.LONGVARBINARY); info.addNativeTypeMapping(Types.STRUCT, "IMAGE", Types.LONGVARBINARY); info.addNativeTypeMapping(Types.TIME, "DATETIME", Types.TIMESTAMP); info.addNativeTypeMapping(Types.TIMESTAMP, "DATETIME"); info.addNativeTypeMapping(Types.TINYINT, "SMALLINT", Types.SMALLINT); info.setDefaultSize(Types.CHAR, 254); info.setDefaultSize(Types.VARCHAR, 254); info.setDefaultSize(Types.BINARY, 254); info.setDefaultSize(Types.VARBINARY, 254); setSqlBuilder(new MSSqlBuilder(this)); setModelReader(new MSSqlModelReader(this)); }
From source file:org.apache.openjpa.jdbc.schema.Schemas.java
/** * Return the {@link Types} constant for the given SQL type name. *///from www. j a va 2s.c om public static int getJDBCType(String name) { if ("array".equalsIgnoreCase(name)) return Types.ARRAY; if ("bigint".equalsIgnoreCase(name)) return Types.BIGINT; if ("binary".equalsIgnoreCase(name)) return Types.BINARY; if ("bit".equalsIgnoreCase(name)) return Types.BIT; if ("blob".equalsIgnoreCase(name)) return Types.BLOB; if ("char".equalsIgnoreCase(name)) return Types.CHAR; if ("clob".equalsIgnoreCase(name)) return Types.CLOB; if ("date".equalsIgnoreCase(name)) return Types.DATE; if ("decimal".equalsIgnoreCase(name)) return Types.DECIMAL; if ("distinct".equalsIgnoreCase(name)) return Types.DISTINCT; if ("double".equalsIgnoreCase(name)) return Types.DOUBLE; if ("float".equalsIgnoreCase(name)) return Types.FLOAT; if ("integer".equalsIgnoreCase(name)) return Types.INTEGER; if ("java_object".equalsIgnoreCase(name)) return Types.JAVA_OBJECT; if ("longvarbinary".equalsIgnoreCase(name)) return Types.LONGVARBINARY; if ("longvarchar".equalsIgnoreCase(name)) return Types.LONGVARCHAR; if ("null".equalsIgnoreCase(name)) return Types.NULL; if ("numeric".equalsIgnoreCase(name)) return Types.NUMERIC; if ("other".equalsIgnoreCase(name)) return Types.OTHER; if ("real".equalsIgnoreCase(name)) return Types.REAL; if ("ref".equalsIgnoreCase(name)) return Types.REF; if ("smallint".equalsIgnoreCase(name)) return Types.SMALLINT; if ("struct".equalsIgnoreCase(name)) return Types.STRUCT; if ("time".equalsIgnoreCase(name)) return Types.TIME; if ("timestamp".equalsIgnoreCase(name)) return Types.TIMESTAMP; if ("tinyint".equalsIgnoreCase(name)) return Types.TINYINT; if ("varbinary".equalsIgnoreCase(name)) return Types.VARBINARY; if ("varchar".equalsIgnoreCase(name)) return Types.VARCHAR; if (name == null || name.toLowerCase().startsWith("unknown")) return Types.OTHER; throw new IllegalArgumentException("name = " + name); }
From source file:com.cloudera.sqoop.mapreduce.db.DataDrivenDBInputFormat.java
/** * @return the DBSplitter implementation to use to divide the table/query * into InputSplits./*w ww .j av a2 s. c o m*/ */ protected DBSplitter getSplitter(int sqlDataType) { switch (sqlDataType) { case Types.NUMERIC: case Types.DECIMAL: return new BigDecimalSplitter(); case Types.BIT: case Types.BOOLEAN: return new BooleanSplitter(); case Types.INTEGER: case Types.TINYINT: case Types.SMALLINT: case Types.BIGINT: return new IntegerSplitter(); case Types.REAL: case Types.FLOAT: case Types.DOUBLE: return new FloatSplitter(); case Types.CHAR: case Types.VARCHAR: case Types.LONGVARCHAR: return new TextSplitter(); case Types.DATE: case Types.TIME: case Types.TIMESTAMP: return new DateSplitter(); default: // TODO: Support BINARY, VARBINARY, LONGVARBINARY, DISTINCT, CLOB, // BLOB, ARRAY, STRUCT, REF, DATALINK, and JAVA_OBJECT. return null; } }
From source file:co.nubetech.apache.hadoop.DataDrivenDBInputFormat.java
/** * @return the DBSplitter implementation to use to divide the table/query * into InputSplits.//ww w. j a v a 2 s .c o m */ protected DBSplitter getSplitter(int sqlDataType) { switch (sqlDataType) { case Types.NUMERIC: case Types.DECIMAL: return new BigDecimalSplitter(); case Types.BIT: case Types.BOOLEAN: return new BooleanSplitter(); case Types.INTEGER: case Types.TINYINT: case Types.SMALLINT: case Types.BIGINT: return new IntegerSplitter(); case Types.REAL: case Types.FLOAT: case Types.DOUBLE: return new FloatSplitter(); case Types.CHAR: case Types.VARCHAR: case Types.LONGVARCHAR: return new TextSplitter(); case Types.DATE: case Types.TIME: case Types.TIMESTAMP: return new DateSplitter(); default: // TODO: Support BINARY, VARBINARY, LONGVARBINARY, DISTINCT, CLOB, // BLOB, ARRAY // STRUCT, REF, DATALINK, and JAVA_OBJECT. return null; } }
From source file:org.apache.ddlutils.platform.JdbcModelReader.java
/** * Creates a new model reader instance.//from ww w. j a v a 2 s .co m * * @param platform The plaftform this builder belongs to */ public JdbcModelReader(Platform platform) { _platform = platform; _defaultSizes.put(new Integer(Types.CHAR), "254"); _defaultSizes.put(new Integer(Types.VARCHAR), "254"); _defaultSizes.put(new Integer(Types.LONGVARCHAR), "254"); _defaultSizes.put(new Integer(Types.BINARY), "254"); _defaultSizes.put(new Integer(Types.VARBINARY), "254"); _defaultSizes.put(new Integer(Types.LONGVARBINARY), "254"); _defaultSizes.put(new Integer(Types.INTEGER), "32"); _defaultSizes.put(new Integer(Types.BIGINT), "64"); _defaultSizes.put(new Integer(Types.REAL), "7,0"); _defaultSizes.put(new Integer(Types.FLOAT), "15,0"); _defaultSizes.put(new Integer(Types.DOUBLE), "15,0"); _defaultSizes.put(new Integer(Types.DECIMAL), "15,15"); _defaultSizes.put(new Integer(Types.NUMERIC), "15,15"); _columnsForTable = initColumnsForTable(); _columnsForColumn = initColumnsForColumn(); _columnsForPK = initColumnsForPK(); _columnsForFK = initColumnsForFK(); _columnsForIndex = initColumnsForIndex(); }
From source file:co.nubetech.hiho.mapreduce.lib.db.apache.DataDrivenDBInputFormat.java
/** * @return the DBSplitter implementation to use to divide the table/query into InputSplits. *///from w w w . j a v a2 s.c o m protected DBSplitter getSplitter(int sqlDataType) { switch (sqlDataType) { case Types.NUMERIC: case Types.DECIMAL: return new BigDecimalSplitter(); case Types.BIT: case Types.BOOLEAN: return new BooleanSplitter(); case Types.INTEGER: case Types.TINYINT: case Types.SMALLINT: case Types.BIGINT: return new IntegerSplitter(); case Types.REAL: case Types.FLOAT: case Types.DOUBLE: return new FloatSplitter(); case Types.CHAR: case Types.VARCHAR: case Types.LONGVARCHAR: return new TextSplitter(); case Types.DATE: case Types.TIME: case Types.TIMESTAMP: return new DateSplitter(); default: // TODO: Support BINARY, VARBINARY, LONGVARBINARY, DISTINCT, CLOB, BLOB, ARRAY // STRUCT, REF, DATALINK, and JAVA_OBJECT. return null; } }
From source file:org.jumpmind.db.platform.oracle.OracleDdlReader.java
@Override protected Integer mapUnknownJdbcTypeForColumn(Map<String, Object> values) { String typeName = (String) values.get("TYPE_NAME"); if (typeName != null && typeName.startsWith("DATE")) { return Types.DATE; } else if (typeName != null && typeName.startsWith("TIMESTAMP") && !typeName.endsWith("TIME ZONE")) { // This is for Oracle's TIMESTAMP(9) return Types.TIMESTAMP; } else if (typeName != null && typeName.startsWith("TIMESTAMP") && typeName.endsWith("WITH TIME ZONE")) { return ColumnTypes.ORACLE_TIMESTAMPTZ; } else if (typeName != null && typeName.startsWith("TIMESTAMP") && typeName.endsWith("WITH LOCAL TIME ZONE")) { return ColumnTypes.ORACLE_TIMESTAMPLTZ; } else if (typeName != null && typeName.startsWith("NVARCHAR")) { // This is for Oracle's NVARCHAR type return Types.VARCHAR; } else if (typeName != null && typeName.startsWith("LONGNVARCHAR")) { return Types.LONGVARCHAR; } else if (typeName != null && typeName.startsWith("NCHAR")) { return Types.CHAR; } else if (typeName != null && typeName.startsWith("XML")) { return Types.LONGVARCHAR; } else if (typeName != null && typeName.endsWith("CLOB")) { return Types.LONGVARCHAR; } else if (typeName != null && typeName.startsWith("BINARY_FLOAT")) { return Types.FLOAT; } else if (typeName != null && typeName.startsWith("BINARY_DOUBLE")) { return Types.DOUBLE; } else if (typeName != null && typeName.startsWith("BFILE")) { return Types.VARCHAR; } else {//w w w . ja v a 2 s . c o m return super.mapUnknownJdbcTypeForColumn(values); } }
From source file:org.apache.tajo.storage.jdbc.JdbcMetadataProviderBase.java
private TypeDesc convertDataType(ResultSet res) throws SQLException { final int typeId = res.getInt("DATA_TYPE"); switch (typeId) { case Types.BOOLEAN: return new TypeDesc(newSimpleDataType(Type.BOOLEAN)); case Types.TINYINT: case Types.SMALLINT: case Types.INTEGER: return new TypeDesc(newSimpleDataType(Type.INT4)); case Types.DISTINCT: // sequence for postgresql case Types.BIGINT: return new TypeDesc(newSimpleDataType(Type.INT8)); case Types.FLOAT: return new TypeDesc(newSimpleDataType(Type.FLOAT4)); case Types.NUMERIC: case Types.DECIMAL: case Types.DOUBLE: return new TypeDesc(newSimpleDataType(Type.FLOAT8)); case Types.DATE: return new TypeDesc(newSimpleDataType(Type.DATE)); case Types.TIME: return new TypeDesc(newSimpleDataType(Type.TIME)); case Types.TIMESTAMP: return new TypeDesc(newSimpleDataType(Type.TIMESTAMP)); case Types.CHAR: case Types.NCHAR: case Types.VARCHAR: case Types.NVARCHAR: case Types.CLOB: case Types.NCLOB: case Types.LONGVARCHAR: case Types.LONGNVARCHAR: return new TypeDesc(newSimpleDataType(Type.TEXT)); case Types.BINARY: case Types.VARBINARY: case Types.BLOB: return new TypeDesc(newSimpleDataType(Type.BLOB)); default:/* w ww .j a v a2s . c o m*/ throw SQLExceptionUtil.toSQLException(new UnsupportedDataTypeException(typeId + "")); } }
From source file:org.jumpmind.db.platform.mssql.MsSqlDdlReader.java
protected Integer mapUnknownJdbcTypeForColumn(Map<String, Object> values) { String typeName = (String) values.get("TYPE_NAME"); int size = -1; String columnSize = (String) values.get("COLUMN_SIZE"); if (isNotBlank(columnSize)) { size = Integer.parseInt(columnSize); }/* w ww .j a v a2 s. co m*/ if (typeName != null && typeName.toLowerCase().startsWith("text")) { return Types.LONGVARCHAR; } else if (typeName != null && typeName.toLowerCase().startsWith("ntext")) { return Types.CLOB; } else if (typeName != null && typeName.toUpperCase().contains(TypeMap.GEOMETRY)) { return Types.VARCHAR; } else if (typeName != null && typeName.toUpperCase().contains("VARCHAR") && size > 8000) { return Types.LONGVARCHAR; } else if (typeName != null && typeName.toUpperCase().contains("NVARCHAR") && size > 8000) { return Types.LONGNVARCHAR; } else if (typeName != null && typeName.toUpperCase().equals("SQL_VARIANT")) { return Types.BINARY; } else { return super.mapUnknownJdbcTypeForColumn(values); } }