本文整理汇总了Java中java.sql.Types.LONGNVARCHAR属性的典型用法代码示例。如果您正苦于以下问题:Java Types.LONGNVARCHAR属性的具体用法?Java Types.LONGNVARCHAR怎么用?Java Types.LONGNVARCHAR使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类java.sql.Types
的用法示例。
在下文中一共展示了Types.LONGNVARCHAR属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isCharacter
/**
* Returns if the given data type is character type or not.
*
* @param type the type from java.sql.Types
* @return true if the given type is character type; false otherwise
*/
static public boolean isCharacter(int type) {
switch (type) {
case Types.BINARY:
case Types.CHAR:
case Types.LONGVARCHAR:
case Types.VARCHAR:
case Types.VARBINARY:
case Types.NCHAR:
case Types.NVARCHAR:
case Types.LONGNVARCHAR:
return true;
}
return false;
}
示例2: getSQLValue
public String getSQLValue(Table table, Row row, int index) {
Column column = table.getColumns().get(index);
int type = column.getDataType();
if (row.get(index) == null) {
return "null";
} else {
switch (type) {
case Types.CHAR:
case Types.VARCHAR:
case Types.LONGNVARCHAR:
case Types.NCHAR:
case Types.NVARCHAR:
case Types.LONGVARCHAR:
return "\"" + row.getString(index) + "\"";
case Types.DATE:
return "\"" + DATE_FORMAT_THREAD_LOCAL.get().format(row.getDate(index)) + "\"";
case Types.TIME:
return "\"" + TIME_FORMAT_THREAD_LOCAL.get().format(row.getDate(index)) + "\"";
case Types.TIMESTAMP:
return "\"" + DATE_TIME_FORMAT_THREAD_LOCAL.get().format(row.getDate(index)) + "\"";
default:
return row.getString(index);
}
}
}
示例3: isStringValue
public boolean isStringValue() {
if(this.dataType==Types.CHAR || this.dataType==Types.VARCHAR || this.dataType==Types.LONGVARCHAR ||
this.dataType==Types.NCHAR || this.dataType==Types.NVARCHAR || this.dataType==Types.LONGNVARCHAR)
{
return true;
}
else
{
return false;
}
}
示例4: isCharColumn
/**
* Determine if a column is char or a char-variant type.
* @return true if column type is CHAR, VARCHAR, LONGVARCHAR
* or their N version. These are used to store strings.
*/
public boolean isCharColumn(int columnType) {
return (columnType == Types.VARCHAR)
|| (columnType == Types.NVARCHAR)
|| (columnType == Types.CHAR)
|| (columnType == Types.NCHAR)
|| (columnType == Types.LONGVARCHAR)
|| (columnType == Types.LONGNVARCHAR);
}
示例5: isNStringColumn
/**
* Says if a column is N Type
*
* @param columnType
* the SQL Column Type
* @return true if a column is N Type
*/
private boolean isNStringColumn(int columnType) {
if (columnType == Types.NCHAR || columnType == Types.NVARCHAR
|| columnType == Types.LONGNVARCHAR) {
return true;
} else {
return false;
}
}
示例6: encoding
public static String encoding(String source, int sqlType, String sourceEncoding, String targetEncoding) {
switch (sqlType) {
case Types.CHAR:
case Types.VARCHAR:
case Types.LONGVARCHAR:
case Types.NCHAR:
case Types.NVARCHAR:
case Types.LONGNVARCHAR:
case Types.CLOB:
case Types.NCLOB:
if (false == StringUtils.isEmpty(source)) {
String fromEncoding = StringUtils.isBlank(sourceEncoding) ? "UTF-8" : sourceEncoding;
String toEncoding = StringUtils.isBlank(targetEncoding) ? "UTF-8" : targetEncoding;
// if (false == StringUtils.equalsIgnoreCase(fromEncoding,
// toEncoding)) {
try {
return new String(source.getBytes(fromEncoding), toEncoding);
} catch (UnsupportedEncodingException e) {
throw new IllegalArgumentException(e.getMessage(), e);
}
// }
}
}
return source;
}
示例7: getSQLType
/**
* Get the SQLType for the given java.sql.Type type.
*
* @param type the java.sql.Type type specifier
* @return SQLType.the SQLType for this java.sql.Type, or null if it's not recognized
*/
public static SQLType getSQLType(int type) {
switch (type) {
case Types.BIT: return SQLType.BIT;
case Types.TINYINT: return SQLType.TINYINT;
case Types.SMALLINT: return SQLType.SMALLINT;
case Types.INTEGER: return SQLType.INTEGER;
case Types.BIGINT: return SQLType.BIGINT;
case Types.FLOAT: return SQLType.FLOAT;
case Types.REAL: return SQLType.REAL;
case Types.DOUBLE: return SQLType.DOUBLE;
case Types.NUMERIC: return SQLType.NUMERIC;
case Types.DECIMAL: return SQLType.DECIMAL;
case Types.CHAR: return SQLType.CHAR;
case Types.VARCHAR: return SQLType.VARCHAR;
case Types.LONGVARCHAR: return SQLType.LONGVARCHAR;
case Types.DATE: return SQLType.DATE;
case Types.TIME: return SQLType.TIME;
case Types.TIMESTAMP: return SQLType.TIMESTAMP;
case Types.BINARY: return SQLType.BINARY;
case Types.VARBINARY: return SQLType.VARBINARY;
case Types.LONGVARBINARY: return SQLType.LONGVARBINARY;
case Types.NULL: return SQLType.NULL;
case Types.OTHER: return SQLType.OTHER;
case Types.JAVA_OBJECT: return SQLType.JAVA_OBJECT;
case Types.DISTINCT: return SQLType.DISTINCT;
case Types.STRUCT: return SQLType.STRUCT;
case Types.ARRAY: return SQLType.ARRAY;
case Types.BLOB: return SQLType.BLOB;
case Types.CLOB: return SQLType.CLOB;
case Types.REF: return SQLType.REF;
case Types.DATALINK: return SQLType.DATALINK;
case Types.BOOLEAN: return SQLType.BOOLEAN;
case Types.LONGNVARCHAR: return SQLType.LONGVARCHAR;
case Types.NCHAR: return SQLType.CHAR;
case Types.NCLOB: return SQLType.CLOB;
case Types.NVARCHAR: return SQLType.VARCHAR;
case Types.SQLXML: return SQLType.SQLXML;
case Types.ROWID: return SQLType.ROWID;
default:
Logger.getLogger(JDBCUtils.class.getName()).log(Level.WARNING, "Unknown JDBC column type: " + type + ". Returns null.");
return null;
}
}
示例8: getTypeClass
protected static Class<? extends Object> getTypeClass(DBColumn col) {
int colType = col.getJdbcType();
if (colType == Types.BIT && col.getPrecision() <= 1) {
colType = Types.BOOLEAN;
}
switch (colType) {
case Types.BOOLEAN:
return Boolean.class;
case Types.TIME:
return Time.class;
case Types.DATE:
return Date.class;
case Types.TIMESTAMP:
case DBReadWriteHelper.SQL_TYPE_ORACLE_TIMESTAMP:
case DBReadWriteHelper.SQL_TYPE_ORACLE_TIMESTAMP_WITH_TZ:
return Timestamp.class;
case Types.BIGINT:
return BigInteger.class;
case Types.DOUBLE:
return Double.class;
case Types.FLOAT:
case Types.REAL:
return Float.class;
case Types.DECIMAL:
case Types.NUMERIC:
return BigDecimal.class;
case Types.INTEGER:
case Types.SMALLINT:
case Types.TINYINT:
return Long.class;
case Types.CHAR:
case Types.VARCHAR:
case Types.NCHAR:
case Types.NVARCHAR:
case Types.ROWID:
return String.class;
case Types.BIT:
case Types.BINARY:
case Types.VARBINARY:
case Types.LONGVARBINARY:
case Types.BLOB:
return Blob.class;
case Types.LONGVARCHAR:
case Types.LONGNVARCHAR:
case Types.CLOB:
case Types.NCLOB: /*NCLOB */
return Clob.class;
case Types.OTHER:
default:
return Object.class;
}
}
示例9: getFieldType
/**
* 根据Types获取字段类型
*
* @see Types
* @return 对应字段的java类型
*/
public static FieldType getFieldType(Integer sqlType) {
FieldType fieldType = sqlTypes.get("UNKNOWN");
if (sqlType == null) {
return fieldType;
}
// https://docs.oracle.com/javase/1.5.0/docs/guide/jdbc/getstart/mapping.html
if (sqlType == Types.INTEGER) {
fieldType = sqlTypes.get("INTEGER");
} else if (sqlType == Types.VARCHAR) {
fieldType = sqlTypes.get("STRING");
} else if (sqlType == Types.CHAR) {
fieldType = sqlTypes.get("STRING");
} else if (sqlType == Types.LONGVARCHAR) {
fieldType = sqlTypes.get("STRING");
} else if (sqlType == Types.NVARCHAR) {
fieldType = sqlTypes.get("STRING");
} else if (sqlType == Types.NCHAR) {
fieldType = sqlTypes.get("STRING");
} else if (sqlType == Types.LONGNVARCHAR) {
fieldType = sqlTypes.get("STRING");
} else if (sqlType == Types.NUMERIC) {
fieldType = sqlTypes.get("DECIMAL");
} else if (sqlType == Types.DECIMAL) {
fieldType = sqlTypes.get("DECIMAL");
} else if (sqlType == Types.BIT) {
fieldType = sqlTypes.get("BOOLEAN");
} else if (sqlType == Types.BOOLEAN) {
fieldType = sqlTypes.get("BOOLEAN");
} else if (sqlType == Types.TINYINT) {
fieldType = sqlTypes.get("INTEGER");
} else if (sqlType == Types.SMALLINT) {
fieldType = sqlTypes.get("INTEGER");
} else if (sqlType == Types.BIGINT) {
fieldType = sqlTypes.get("BIGINT");
} else if (sqlType == Types.REAL) {
fieldType = sqlTypes.get("REAL");
} else if (sqlType == Types.FLOAT) {
fieldType = sqlTypes.get("FLOAT");
} else if (sqlType == Types.DOUBLE) {
fieldType = sqlTypes.get("DOUBLE");
} else if (sqlType == Types.DATE) {
// java.sql.Date ?
fieldType = sqlTypes.get("DATE");
} else if (sqlType == Types.TIME) {
// java.sql.Time ?
fieldType = sqlTypes.get("TIME");
} else if (sqlType == Types.TIMESTAMP) {
// java.sql.Timestamp ?
fieldType = sqlTypes.get("TIMESTAMP");
} else if (sqlType == Types.BINARY
|| sqlType == Types.VARBINARY) {
fieldType = sqlTypes.get("BINARY");
} else if (sqlType == Types.CLOB) {
fieldType = sqlTypes.get("CLOB");
} else if (sqlType == Types.BLOB
|| sqlType == Types.LONGVARBINARY) {
fieldType = sqlTypes.get("BLOB");
} else {
// DISTINCT, ARRAY, STRUCT, REF, JAVA_OBJECT.
return fieldType;
}
return fieldType;
}
示例10: convertValue
private Object convertValue() throws SQLException {
switch (componentType.id) {
case Types.BOOLEAN:
case Types.BIT:
return componentAccessor.getBoolean();
case Types.TINYINT:
return componentAccessor.getByte();
case Types.SMALLINT:
return componentAccessor.getShort();
case Types.INTEGER:
return componentAccessor.getInt();
case Types.BIGINT:
return componentAccessor.getLong();
case Types.FLOAT:
return componentAccessor.getFloat();
case Types.DOUBLE:
return componentAccessor.getDouble();
case Types.ARRAY:
return componentAccessor.getArray();
case Types.CHAR:
case Types.VARCHAR:
case Types.LONGVARCHAR:
case Types.NCHAR:
case Types.LONGNVARCHAR:
return componentAccessor.getString();
case Types.BINARY:
case Types.VARBINARY:
case Types.LONGVARBINARY:
return componentAccessor.getBytes();
case Types.DECIMAL:
return componentAccessor.getBigDecimal();
case Types.DATE:
case Types.TIME:
case Types.TIMESTAMP:
case Types.STRUCT:
case Types.JAVA_OBJECT:
return componentAccessor.getObject();
default:
throw new IllegalStateException("Unhandled ARRAY component type: " + componentType.rep
+ ", id: " + componentType.id);
}
}
示例11: toHCatType
/**
* Resolve a database-specific type to HCat data type. Largely follows Sqoop's
* hive translation.
* @param sqlType
* sql type
* @return hcat type
*/
public static String toHCatType(int sqlType) {
switch (sqlType) {
// Ideally TINYINT and SMALLINT should be mapped to their
// HCat equivalents tinyint and smallint respectively
// But the Sqoop Java type conversion has them mapped to Integer
// Even though the referenced Java doc clearly recommends otherwise.
// Changing this now can cause many of the sequence file usages to
// break as value class implementations will change. So, we
// just use the same behavior here.
case Types.SMALLINT:
case Types.TINYINT:
case Types.INTEGER:
return "int";
case Types.VARCHAR:
return "varchar";
case Types.CHAR:
return "char";
case Types.LONGVARCHAR:
case Types.NVARCHAR:
case Types.NCHAR:
case Types.LONGNVARCHAR:
case Types.DATE:
case Types.TIME:
case Types.TIMESTAMP:
case Types.CLOB:
return "string";
case Types.FLOAT:
case Types.REAL:
return "float";
case Types.NUMERIC:
case Types.DECIMAL:
return "decimal";
case Types.DOUBLE:
return "double";
case Types.BIT:
case Types.BOOLEAN:
return "boolean";
case Types.BIGINT:
return "bigint";
case Types.BINARY:
case Types.VARBINARY:
case Types.BLOB:
case Types.LONGVARBINARY:
return "binary";
default:
throw new IllegalArgumentException(
"Cannot convert SQL type to HCatalog type " + sqlType);
}
}
示例12: isJdbcCharacterColumn
public boolean isJdbcCharacterColumn() {
return jdbcType == Types.CHAR || jdbcType == Types.CLOB
|| jdbcType == Types.LONGVARCHAR || jdbcType == Types.VARCHAR
|| jdbcType == Types.LONGNVARCHAR || jdbcType == Types.NCHAR
|| jdbcType == Types.NCLOB || jdbcType == Types.NVARCHAR;
}
示例13: getValue
private static Value getValue(String columnName,int type,ResultSet rs)
{
Value value = new Value(type);
try
{
switch(type)
{
case Types.CHAR:
case Types.VARCHAR:
case Types.LONGVARCHAR:
case Types.NCHAR:
case Types.NVARCHAR:
case Types.LONGNVARCHAR:
value.setString_value(rs.getString(columnName));
break;
case Types.FLOAT:
case Types.DOUBLE:
value.setDouble_value(rs.getDouble(columnName));
break;
case Types.INTEGER:
case Types.SMALLINT:
value.setInt_value(rs.getInt(columnName));
break;
case Types.BINARY:
case Types.VARBINARY:
case Types.LONGVARBINARY:
value.setBytes_value(rs.getBytes(columnName));
break;
case Types.BLOB:
value.setBlob_value(rs.getBlob(columnName));
break;
case Types.NUMERIC:
case Types.DECIMAL:
value.setBigdecimal_value(rs.getBigDecimal(columnName));
break;
case Types.BIT:
case Types.BOOLEAN:
value.setBoolean_value(rs.getBoolean(columnName));
break;
case Types.TINYINT:
value.setByte_value(rs.getByte(columnName));
break;
case Types.BIGINT:
value.setLong_value(rs.getLong(columnName));
break;
case Types.REAL:
value.setFloat_value(rs.getFloat(columnName));
break;
case Types.DATE:
value.setDate_value(rs.getDate(columnName));
break;
case Types.TIME:
case Types.TIMESTAMP:
value.setTime_value(rs.getTime(columnName));
break;
default:
value.setObject_value(rs.getObject(columnName));
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
DBCException.logException(DBCException.E_ResultSet, e);
return null;
}
return value;
}
示例14: toJavaType
/**
* Resolve a database-specific type to the Java type that should contain it.
* @param sqlType sql type
* @return the name of a Java type to hold the sql datatype, or null if none.
*/
public String toJavaType(int sqlType) {
// Mappings taken from:
// http://java.sun.com/j2se/1.3/docs/guide/jdbc/getstart/mapping.html
if (sqlType == Types.INTEGER) {
return "Integer";
} else if (sqlType == Types.VARCHAR) {
return "String";
} else if (sqlType == Types.CHAR) {
return "String";
} else if (sqlType == Types.LONGVARCHAR) {
return "String";
} else if (sqlType == Types.NVARCHAR) {
return "String";
} else if (sqlType == Types.NCHAR) {
return "String";
} else if (sqlType == Types.LONGNVARCHAR) {
return "String";
} else if (sqlType == Types.NUMERIC) {
return "java.math.BigDecimal";
} else if (sqlType == Types.DECIMAL) {
return "java.math.BigDecimal";
} else if (sqlType == Types.BIT) {
return "Boolean";
} else if (sqlType == Types.BOOLEAN) {
return "Boolean";
} else if (sqlType == Types.TINYINT) {
return "Integer";
} else if (sqlType == Types.SMALLINT) {
return "Integer";
} else if (sqlType == Types.BIGINT) {
return "Long";
} else if (sqlType == Types.REAL) {
return "Float";
} else if (sqlType == Types.FLOAT) {
return "Double";
} else if (sqlType == Types.DOUBLE) {
return "Double";
} else if (sqlType == Types.DATE) {
return "java.sql.Date";
} else if (sqlType == Types.TIME) {
return "java.sql.Time";
} else if (sqlType == Types.TIMESTAMP) {
return "java.sql.Timestamp";
} else if (sqlType == Types.BINARY
|| sqlType == Types.VARBINARY) {
return BytesWritable.class.getName();
} else if (sqlType == Types.CLOB) {
return ClobRef.class.getName();
} else if (sqlType == Types.BLOB
|| sqlType == Types.LONGVARBINARY) {
return BlobRef.class.getName();
} else {
// TODO(aaron): Support DISTINCT, ARRAY, STRUCT, REF, JAVA_OBJECT.
// Return null indicating database-specific manager should return a
// java data type if it can find one for any nonstandard type.
return null;
}
}
示例15: getParameterJavaClass
static public Class<?> getParameterJavaClass(int param_type) {
switch (param_type) {
case Types.ARRAY:
return Object[].class;
case Types.BIGINT:
return Long.class;
case Types.BINARY:
return byte[].class;
case Types.BIT:
return Boolean.class;
case Types.BLOB:
return java.sql.Blob.class;
case Types.BOOLEAN:
return Boolean.class;
case Types.CHAR:
return String.class;
case Types.CLOB:
return java.sql.Clob.class;
case Types.DATALINK:
return java.net.URL.class;
case Types.DATE:
return java.sql.Date.class;
case Types.DECIMAL:
return java.math.BigDecimal.class;
case Types.DISTINCT:
return Object.class;
case Types.DOUBLE:
return Double.class;
case Types.FLOAT:
return Double.class;
case Types.INTEGER:
return Integer.class;
case Types.JAVA_OBJECT:
return Object.class;
case Types.LONGVARBINARY:
return byte[].class;
case Types.LONGVARCHAR:
return String.class;
case Types.NCLOB:
return java.sql.NClob.class;
case Types.NULL:
return Object.class;
case Types.NUMERIC:
return java.math.BigDecimal.class;
case Types.NCHAR:
case Types.NVARCHAR:
case Types.LONGNVARCHAR:
return String.class;
case Types.OTHER:
return Object.class;
case Types.REAL:
return Float.class;
case Types.REF:
return java.sql.Ref.class;
case Types.ROWID:
return java.sql.RowId.class;
case Types.SMALLINT:
return Short.class;
case Types.STRUCT:
return java.sql.Struct.class;
case Types.SQLXML:
return java.sql.SQLXML.class;
case Types.TIME:
return java.sql.Time.class;
case Types.TIMESTAMP:
return java.sql.Timestamp.class;
case Types.TINYINT:
return Byte.class;
case Types.VARBINARY:
return byte[].class;
case Types.VARCHAR:
return String.class;
default:
return Object.class;
}
}