本文整理汇总了Java中java.sql.Types.LONGVARCHAR属性的典型用法代码示例。如果您正苦于以下问题:Java Types.LONGVARCHAR属性的具体用法?Java Types.LONGVARCHAR怎么用?Java Types.LONGVARCHAR使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类java.sql.Types
的用法示例。
在下文中一共展示了Types.LONGVARCHAR属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildResultSet
static java.sql.ResultSet buildResultSet(com.mysql.jdbc.Field[] fields, java.util.ArrayList<ResultSetRow> rows, MySQLConnection c) throws SQLException {
int fieldsLength = fields.length;
for (int i = 0; i < fieldsLength; i++) {
int jdbcType = fields[i].getSQLType();
switch (jdbcType) {
case Types.CHAR:
case Types.VARCHAR:
case Types.LONGVARCHAR:
fields[i].setEncoding(c.getCharacterSetMetadata(), c);
break;
default:
// do nothing
}
fields[i].setConnection(c);
fields[i].setUseOldNameMetadata(true);
}
return com.mysql.jdbc.ResultSetImpl.getInstance(c.getCatalog(), fields, new RowDataStatic(rows), c, null, false);
}
示例2: isClobColumn
/**
* return true if the column is a Types.CLOB || Types.NCLOB
*
* @param columnType
* the sql column type
* @return true if it's (N)CLOB
*/
private boolean isClobColumn(int columnType) {
// 18/11/11 23:20 NDP : ResultSetWriter: no file dump for
// ResultSetMetaData queries
if (sqlOrder.equals("ResultSetMetaData")) {
return false;
}
if (columnType == Types.CLOB || columnType == Types.LONGVARCHAR
|| columnType == Types.NCLOB) {
return true;
} else {
return false;
}
}
示例3: isOrdinal
private boolean isOrdinal(int paramType) {
switch ( paramType ) {
case Types.INTEGER:
case Types.NUMERIC:
case Types.SMALLINT:
case Types.TINYINT:
case Types.BIGINT:
case Types.DECIMAL: //for Oracle Driver
case Types.DOUBLE: //for Oracle Driver
case Types.FLOAT: //for Oracle Driver
return true;
case Types.CHAR:
case Types.LONGVARCHAR:
case Types.VARCHAR:
return false;
default:
throw new HibernateException( "Unable to persist an Enum in a column of SQL Type: " + paramType );
}
}
示例4: isPrecisionRequired
public static boolean isPrecisionRequired(int jdbcType) {
switch (jdbcType) {
case Types.BIGINT:
case Types.BOOLEAN:
case Types.INTEGER:
case Types.SMALLINT:
case Types.TINYINT:
case Types.FLOAT:
case Types.REAL:
case Types.DOUBLE:
case Types.DATE:
case Types.TIMESTAMP:
case Types.JAVA_OBJECT:
case Types.LONGVARCHAR:
case Types.LONGVARBINARY:
case Types.BLOB:
case Types.CLOB:
case Types.ARRAY:
case Types.STRUCT:
case Types.DISTINCT:
case Types.REF:
case Types.DATALINK:
return false;
default:
return true;
}
}
示例5: setupForUtf8StringInBlob
private void setupForUtf8StringInBlob() {
if (this.length == MysqlDefs.LENGTH_TINYBLOB || this.length == MysqlDefs.LENGTH_BLOB) {
this.mysqlType = MysqlDefs.FIELD_TYPE_VARCHAR;
this.sqlType = Types.VARCHAR;
} else {
this.mysqlType = MysqlDefs.FIELD_TYPE_VAR_STRING;
this.sqlType = Types.LONGVARCHAR;
}
this.collationIndex = CharsetMapping.MYSQL_COLLATION_INDEX_utf8;
}
示例6: isCaseSensitive
/**
* Does a column's case matter?
*
* @param column
* the first column is 1, the second is 2...
*
* @return true if so
*
* @throws java.sql.SQLException
* if a database access error occurs
*/
public boolean isCaseSensitive(int column) throws java.sql.SQLException {
Field field = getField(column);
int sqlType = field.getSQLType();
switch (sqlType) {
case Types.BIT:
case Types.TINYINT:
case Types.SMALLINT:
case Types.INTEGER:
case Types.BIGINT:
case Types.FLOAT:
case Types.REAL:
case Types.DOUBLE:
case Types.DATE:
case Types.TIME:
case Types.TIMESTAMP:
return false;
case Types.CHAR:
case Types.VARCHAR:
case Types.LONGVARCHAR:
if (field.isBinary()) {
return true;
}
String collationName = field.getCollation();
return ((collationName != null) && !collationName.endsWith("_ci"));
default:
return true;
}
}
示例7: 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);
}
示例8: getNativeCharacterStream
/**
* JDBC 2.0
*
* <p>
* Get the value of a column in the current row as a java.io.Reader.
* </p>
*
* @param columnIndex
* the column to get the value from
*
* @return the value in the column as a java.io.Reader.
*
* @throws SQLException
* if an error occurs
*/
protected java.io.Reader getNativeCharacterStream(int columnIndex) throws SQLException {
int columnIndexMinusOne = columnIndex - 1;
switch (this.fields[columnIndexMinusOne].getSQLType()) {
case Types.CHAR:
case Types.VARCHAR:
case Types.LONGVARCHAR:
case Types.CLOB:
if (this.thisRow.isNull(columnIndexMinusOne)) {
this.wasNullFlag = true;
return null;
}
this.wasNullFlag = false;
return this.thisRow.getReader(columnIndexMinusOne);
}
String asString = getStringForClob(columnIndex);
if (asString == null) {
return null;
}
return getCharacterStreamFromString(asString);
}
示例9: isTextType
public static boolean isTextType(int sqlType) {
if (sqlType == Types.CHAR || sqlType == Types.VARCHAR || sqlType == Types.CLOB || sqlType == Types.LONGVARCHAR
|| sqlType == Types.NCHAR || sqlType == Types.NVARCHAR || sqlType == Types.NCLOB
|| sqlType == Types.LONGNVARCHAR) {
return true;
} else {
return false;
}
}
示例10: 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;
}
示例11: 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;
}
}
示例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: sqlTypeToGraphQLTypeString
protected static String sqlTypeToGraphQLTypeString(int dataType) {
String typeString;
switch (dataType) {
case Types.TINYINT:
case Types.BIGINT:
case Types.INTEGER:
case Types.SMALLINT:
typeString = "Int";
break;
case Types.CHAR:
case Types.VARCHAR:
case Types.LONGVARCHAR:
typeString = "String";
break;
case Types.DOUBLE:
case Types.FLOAT:
case Types.REAL:
case Types.NUMERIC:
case Types.DECIMAL:
typeString = "Float";
break;
case Types.DATE:
case Types.TIMESTAMP:
case Types.TIME:
typeString = "Date";
break;
case Types.BIT:
typeString = "Boolean";
break;
case Types.OTHER:
typeString = "Object";
break;
case Types.BINARY:
case Types.VARBINARY:
case Types.LONGVARBINARY:
typeString = "Object";
break;
default:
typeString = "Object";
break;
}
return typeString;
}
示例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: isLob
/**
* Return if a given data type is LOB (large object) type or not. Note:
* Implementation of this method uses isBlob method but also duplicates the
* check of CLOB because CLOB should really not return true from isBlob.
* However, there might be other non-IDE callers of the isBlob method (like
* appserver) so the CLOB check is left in both places for now.
*
* @param type the type from java.sql.Types return true if the give type is
* lob type; false otherwise
*/
static public boolean isLob(int type) {
return (isBlob(type)
|| (Types.CLOB == type)
|| (Types.LONGVARCHAR == type));
}