本文整理汇总了Java中java.sql.Types.BIGINT属性的典型用法代码示例。如果您正苦于以下问题:Java Types.BIGINT属性的具体用法?Java Types.BIGINT怎么用?Java Types.BIGINT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类java.sql.Types
的用法示例。
在下文中一共展示了Types.BIGINT属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getColumnTypeName
@Override
public String getColumnTypeName(int column) throws SQLException {
// 数据库特定的类型名称
switch (keytype[column-1]){
case Types.INTEGER: return "INTEGER";
case Types.BOOLEAN: return "BOOLEAN";
case Types.BIT: return "BITT";
case Types.FLOAT: return "FLOAT";
case Types.BIGINT: return "BIGINT";
case Types.DOUBLE: return "DOUBLE";
case Types.DATE: return "DATE";
case Types.TIME: return "TIME";
case Types.TIMESTAMP: return "TIMESTAMP";
default: return "varchar";
}
}
示例2: determineNeedsQuoting
private boolean determineNeedsQuoting() {
boolean retVal = false;
switch (this.sqlType) {
case Types.BIGINT:
case Types.BIT:
case Types.DECIMAL:
case Types.DOUBLE:
case Types.FLOAT:
case Types.INTEGER:
case Types.NUMERIC:
case Types.REAL:
case Types.SMALLINT:
case Types.TINYINT:
retVal = false;
break;
default:
retVal = true;
}
return retVal;
}
示例3: createIndexInfoFields
protected Field[] createIndexInfoFields() {
Field[] fields = new Field[13];
fields[0] = new Field("", "TABLE_CAT", Types.CHAR, 255);
fields[1] = new Field("", "TABLE_SCHEM", Types.CHAR, 0);
fields[2] = new Field("", "TABLE_NAME", Types.CHAR, 255);
fields[3] = new Field("", "NON_UNIQUE", Types.BOOLEAN, 4);
fields[4] = new Field("", "INDEX_QUALIFIER", Types.CHAR, 1);
fields[5] = new Field("", "INDEX_NAME", Types.CHAR, 32);
fields[6] = new Field("", "TYPE", Types.SMALLINT, 32);
fields[7] = new Field("", "ORDINAL_POSITION", Types.SMALLINT, 5);
fields[8] = new Field("", "COLUMN_NAME", Types.CHAR, 32);
fields[9] = new Field("", "ASC_OR_DESC", Types.CHAR, 1);
if (Util.isJdbc42()) {
fields[10] = new Field("", "CARDINALITY", Types.BIGINT, 20);
fields[11] = new Field("", "PAGES", Types.BIGINT, 20);
} else {
fields[10] = new Field("", "CARDINALITY", Types.INTEGER, 20);
fields[11] = new Field("", "PAGES", Types.INTEGER, 10);
}
fields[12] = new Field("", "FILTER_CONDITION", Types.CHAR, 32);
return fields;
}
示例4: getType
@Override
public SQLType getType(int sqlCode, String typeName) {
switch (sqlCode) {
case Types.BIT: return SQLType.BIT;
case Types.BOOLEAN: return SQLType.BOOLEAN;
case Types.INTEGER: return SQLType.INTEGER;
case Types.TINYINT: return SQLType.TINYINT;
case Types.SMALLINT: return SQLType.SMALLINT;
case Types.BIGINT: return SQLType.BIGINT;
case Types.DOUBLE: return SQLType.DOUBLE;
case Types.NUMERIC: return SQLType.NUMERIC;
case Types.DECIMAL: return SQLType.DECIMAL;
case Types.FLOAT: return SQLType.FLOAT;
case Types.REAL: return SQLType.REAL;
case Types.NVARCHAR: return SQLType.NVARCHAR;
case Types.CHAR: return SQLType.CHAR;
case Types.VARCHAR: return SQLType.VARCHAR;
case Types.CLOB: return SQLType.CLOB;
case Types.DATE: return SQLType.DATE;
case Types.TIME: return SQLType.TIME;
case Types.TIMESTAMP: return SQLType.DATETIME;
default:
throw new RuntimeException("Unsupported data type for " + typeName + ", sqlType: " + sqlCode);
}
}
示例5: getGeneratedKeys
/**
* @throws SQLException
*/
public java.sql.ResultSet getGeneratedKeys() throws SQLException {
synchronized (checkClosed().getConnectionMutex()) {
if (!this.retrieveGeneratedKeys) {
throw SQLError.createSQLException(Messages.getString("Statement.GeneratedKeysNotRequested"), SQLError.SQL_STATE_ILLEGAL_ARGUMENT,
getExceptionInterceptor());
}
if (this.batchedGeneratedKeys == null) {
if (this.lastQueryIsOnDupKeyUpdate) {
return this.generatedKeysResults = getGeneratedKeysInternal(1);
}
return this.generatedKeysResults = getGeneratedKeysInternal();
}
Field[] fields = new Field[1];
fields[0] = new Field("", "GENERATED_KEY", Types.BIGINT, 20);
fields[0].setConnection(this.connection);
this.generatedKeysResults = com.mysql.jdbc.ResultSetImpl.getInstance(this.currentCatalog, fields, new RowDataStatic(this.batchedGeneratedKeys),
this.connection, this, false);
return this.generatedKeysResults;
}
}
示例6: getObject
public Object getObject(int parameterIndex) throws SQLException {
checkBounds(parameterIndex, 0);
if (this.parameterIsNull[parameterIndex - 1]) {
return null;
}
// we can't rely on the default mapping for JDBC's ResultSet.getObject() for numerics, they're not one-to-one with PreparedStatement.setObject
switch (PreparedStatement.this.parameterTypes[parameterIndex - 1]) {
case Types.TINYINT:
return Byte.valueOf(getByte(parameterIndex));
case Types.SMALLINT:
return Short.valueOf(getShort(parameterIndex));
case Types.INTEGER:
return Integer.valueOf(getInt(parameterIndex));
case Types.BIGINT:
return Long.valueOf(getLong(parameterIndex));
case Types.FLOAT:
return Float.valueOf(getFloat(parameterIndex));
case Types.DOUBLE:
return Double.valueOf(getDouble(parameterIndex));
default:
return this.bindingsAsRs.getObject(parameterIndex);
}
}
示例7: isDecimalType
/**
* Checks if the SQL Type is a Decimal/Number Type
*
* @param type
* SQL Type
*/
private static final boolean isDecimalType(int type) {
switch (type) {
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.NUMERIC:
case Types.DECIMAL:
return true;
}
return false;
}
示例8: getSplitter
/**
* @return the DBSplitter implementation to use to divide the table/query into InputSplits.
*/
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;
}
}
示例9: getObjectToType
public static int getObjectToType(Object ob){
if (ob instanceof Integer) {
return Types.INTEGER;
}
else if (ob instanceof Boolean) {
return Types.BOOLEAN;
}
else if (ob instanceof Byte) {
return Types.BIT;
}
else if (ob instanceof Short) {
return Types.INTEGER;
}
else if (ob instanceof Float) {
return Types.FLOAT;
}
else if (ob instanceof Long) {
return Types.BIGINT;
}
else if (ob instanceof Double) {
return Types.DOUBLE;
}
else if (ob instanceof Date) {
return Types.DATE;
}
else if (ob instanceof Time) {
return Types.TIME;
}
else if (ob instanceof Timestamp) {
return Types.TIMESTAMP;
}
else if (ob instanceof String) {
return Types.VARCHAR;
}
else {
return Types.VARCHAR;
}
}
示例10: throwRangeException
private void throwRangeException(String valueAsString, int columnIndex, int jdbcType) throws SQLException {
String datatype = null;
switch (jdbcType) {
case Types.TINYINT:
datatype = "TINYINT";
break;
case Types.SMALLINT:
datatype = "SMALLINT";
break;
case Types.INTEGER:
datatype = "INTEGER";
break;
case Types.BIGINT:
datatype = "BIGINT";
break;
case Types.REAL:
datatype = "REAL";
break;
case Types.FLOAT:
datatype = "FLOAT";
break;
case Types.DOUBLE:
datatype = "DOUBLE";
break;
case Types.DECIMAL:
datatype = "DECIMAL";
break;
default:
datatype = " (JDBC type '" + jdbcType + "')";
}
throw SQLError.createSQLException("'" + valueAsString + "' in column '" + columnIndex + "' is outside valid range for the datatype " + datatype + ".",
SQLError.SQL_STATE_NUMERIC_VALUE_OUT_OF_RANGE, getExceptionInterceptor());
}
示例11: fromSqlToJava
/**
* Decode the String param type passed by user on client side into a Types
* corresponding value.
*
* @param sqlParamType
* @return
*/
public static int fromSqlToJava(String sqlParamType) {
int javaType = 0;
if (sqlParamType.equals(AceQLTypes.CHARACTER)) {
javaType = Types.CHAR;
} else if (sqlParamType.equals(AceQLTypes.VARCHAR)) {
javaType = Types.VARCHAR;
} else if (sqlParamType.equals(AceQLTypes.LONGVARCHAR)) {
javaType = Types.LONGVARCHAR;
} else if (sqlParamType.equals(AceQLTypes.BIT)) {
javaType = Types.BIT;
} else if (sqlParamType.equals(AceQLTypes.NUMERIC)) {
javaType = Types.NUMERIC;
} else if (sqlParamType.equals(AceQLTypes.TINYINT)) {
javaType = Types.TINYINT;
} else if (sqlParamType.equals(AceQLTypes.SMALLINT)) {
javaType = Types.SMALLINT;
} else if (sqlParamType.equals(AceQLTypes.INTEGER)) {
javaType = Types.INTEGER;
} else if (sqlParamType.equals(AceQLTypes.BIGINT)) {
javaType = Types.BIGINT;
} else if (sqlParamType.equals(AceQLTypes.REAL)) {
javaType = Types.REAL;
} else if (sqlParamType.equals(AceQLTypes.FLOAT)) {
javaType = Types.FLOAT;
} else if (sqlParamType.equals(AceQLTypes.DOUBLE_PRECISION)) {
javaType = Types.DOUBLE;
} else if (sqlParamType.equals(AceQLTypes.DATE)) {
javaType = Types.DATE;
} else if (sqlParamType.equals(AceQLTypes.TIME)) {
javaType = Types.TIME;
} else if (sqlParamType.equals(AceQLTypes.TIMESTAMP)) {
javaType = Types.TIMESTAMP;
} else if (sqlParamType.equals(AceQLTypes.BINARY)) {
javaType = Types.BINARY;
} else if (sqlParamType.equals(AceQLTypes.VARBINARY)) {
javaType = Types.VARBINARY;
} else if (sqlParamType.equals(AceQLTypes.DATE)) {
javaType = Types.LONGVARBINARY;
} else if (sqlParamType.equals(AceQLTypes.BLOB)) {
javaType = Types.BLOB;
} else if (sqlParamType.equals(AceQLTypes.CLOB)) {
javaType = Types.CLOB;
} else if (sqlParamType.startsWith("TYPE_NULL")) {
String javaTypeStr = StringUtils.substringAfter(sqlParamType,
"TYPE_NULL");
javaType = Integer.parseInt(javaTypeStr);
} else {
throw new IllegalArgumentException(
"Unsuported data type for null setting: " + sqlParamType);
}
return javaType;
}
示例12: generatePingResultSet
protected ResultSetInternalMethods generatePingResultSet() throws SQLException {
synchronized (checkClosed().getConnectionMutex()) {
Field[] fields = { new Field(null, "1", Types.BIGINT, 1) };
ArrayList<ResultSetRow> rows = new ArrayList<ResultSetRow>();
byte[] colVal = new byte[] { (byte) '1' };
rows.add(new ByteArrayRow(new byte[][] { colVal }, getExceptionInterceptor()));
return (ResultSetInternalMethods) DatabaseMetaData.buildResultSet(fields, rows, this.connection);
}
}
示例13: getColumnClass
@Override
public Class<?> getColumnClass(int column) {
int type;
try {
type = metaData.getColumnType(column + 1);
} catch (SQLException e) {
return super.getColumnClass(column);
}
switch (type) {
case Types.CHAR:
case Types.VARCHAR:
case Types.LONGVARCHAR:
return String.class;
case Types.BIT:
return Boolean.class;
case Types.TINYINT:
case Types.SMALLINT:
case Types.INTEGER:
return Integer.class;
case Types.BIGINT:
return Long.class;
case Types.FLOAT:
case Types.DOUBLE:
return Double.class;
case Types.DATE:
return java.sql.Date.class;
default:
return Object.class;
}
}
示例14: 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;
}
示例15: jdbcTypeToClass
/**
* Get the Java type which corresponds to given SQL type.
* @param type SQL type
* @return The Java type
*/
public static Class<?> jdbcTypeToClass(int type) {
Class<?> result = Object.class;
switch (type) {
case Types.CHAR:
case Types.VARCHAR:
case Types.LONGVARCHAR:
result = String.class;
break;
case Types.NUMERIC:
case Types.DECIMAL:
result = java.math.BigDecimal.class;
break;
case Types.BIT:
result = Boolean.class;
break;
case Types.TINYINT:
result = Byte.class;
break;
case Types.SMALLINT:
result = Short.class;
break;
case Types.INTEGER:
result = Integer.class;
break;
case Types.BIGINT:
result = Long.class;
break;
case Types.REAL:
case Types.FLOAT:
result = Float.class;
break;
case Types.DOUBLE:
result = Double.class;
break;
case Types.BINARY:
case Types.VARBINARY:
case Types.LONGVARBINARY:
result = byte[].class;
break;
case Types.DATE:
result = java.sql.Date.class;
break;
case Types.TIME:
result = java.sql.Time.class;
break;
case Types.TIMESTAMP:
result = java.sql.Timestamp.class;
break;
default:
break;
}
return result;
}