本文整理汇总了Java中java.sql.JDBCType.VARCHAR属性的典型用法代码示例。如果您正苦于以下问题:Java JDBCType.VARCHAR属性的具体用法?Java JDBCType.VARCHAR怎么用?Java JDBCType.VARCHAR使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类java.sql.JDBCType
的用法示例。
在下文中一共展示了JDBCType.VARCHAR属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: rowsetUsingDataTypes
@DataProvider(name = "rowsetUsingDataTypes")
protected Object[][] rowsetUsingDataTypes() throws Exception {
CachedRowSet rs = createDataTypesRowSet();
return new Object[][]{
{rs, JDBCType.INTEGER},
{rs, JDBCType.CHAR},
{rs, JDBCType.VARCHAR},
{rs, JDBCType.BIGINT},
{rs, JDBCType.BOOLEAN},
{rs, JDBCType.SMALLINT},
{rs, JDBCType.DOUBLE},
{rs, JDBCType.DECIMAL},
{rs, JDBCType.REAL},
{rs, JDBCType.TINYINT},
{rs, JDBCType.DATE},
{rs, JDBCType.TIME},
{rs, JDBCType.TIMESTAMP},
{rs, JDBCType.VARBINARY},
{rs, JDBCType.ARRAY},
{rs, JDBCType.REF},
{rs, JDBCType.FLOAT}
};
}
示例2: initialized
/**
* 初始化阶段
* 具体执行顺序 http://www.mybatis.org/generator/reference/pluggingIn.html
* @param introspectedTable
* @return
*/
@Override
public void initialized(IntrospectedTable introspectedTable) {
// 1. 首先获取全局配置
Properties properties = getProperties();
String logicalDeleteColumn = properties.getProperty(PRO_LOGICAL_DELETE_COLUMN);
this.logicalDeleteValue = properties.getProperty(PRO_LOGICAL_DELETE_VALUE);
this.logicalUnDeleteValue = properties.getProperty(PRO_LOGICAL_UN_DELETE_VALUE);
// 2. 获取表单独配置,如果有则覆盖全局配置
if (introspectedTable.getTableConfigurationProperty(PRO_LOGICAL_DELETE_COLUMN) != null) {
logicalDeleteColumn = introspectedTable.getTableConfigurationProperty(PRO_LOGICAL_DELETE_COLUMN);
}
if (introspectedTable.getTableConfigurationProperty(PRO_LOGICAL_DELETE_VALUE) != null) {
this.logicalDeleteValue = introspectedTable.getTableConfigurationProperty(PRO_LOGICAL_DELETE_VALUE);
}
if (introspectedTable.getTableConfigurationProperty(PRO_LOGICAL_UN_DELETE_VALUE) != null) {
this.logicalUnDeleteValue = introspectedTable.getTableConfigurationProperty(PRO_LOGICAL_UN_DELETE_VALUE);
}
// 3. 判断该表是否存在逻辑删除列
this.logicalDeleteColumn = null;
List<IntrospectedColumn> columns = introspectedTable.getAllColumns();
for (IntrospectedColumn column : columns) {
if (column.getActualColumnName().equalsIgnoreCase(logicalDeleteColumn)) {
// 判断字段类型
JDBCType type = JDBCType.valueOf(column.getJdbcType());
if (JDBCType.BIGINT == type
|| JDBCType.BIT == type
|| JDBCType.BOOLEAN == type
|| JDBCType.CHAR == type
|| JDBCType.DECIMAL == type
|| JDBCType.DOUBLE == type
|| JDBCType.FLOAT == type
|| JDBCType.INTEGER == type
|| JDBCType.LONGNVARCHAR == type
|| JDBCType.LONGVARCHAR == type
|| JDBCType.NCHAR == type
|| JDBCType.NUMERIC == type
|| JDBCType.NVARCHAR == type
|| JDBCType.SMALLINT == type
|| JDBCType.TINYINT == type
|| JDBCType.VARCHAR == type) {
this.logicalDeleteColumn = column;
} else {
warnings.add("itfsw(逻辑删除插件):" + introspectedTable.getFullyQualifiedTable() + "逻辑删除列(" + introspectedTable.getTableConfigurationProperty(PRO_LOGICAL_DELETE_COLUMN) + ")的类型不在支持范围(请使用数字列,字符串列,布尔列)!");
}
}
}
if (introspectedTable.getTableConfigurationProperty(PRO_LOGICAL_DELETE_COLUMN) != null && this.logicalDeleteColumn == null) {
warnings.add("itfsw(逻辑删除插件):" + introspectedTable.getFullyQualifiedTable() + "没有找到您配置的逻辑删除列(" + introspectedTable.getTableConfigurationProperty(PRO_LOGICAL_DELETE_COLUMN) + ")!");
}
// 4. 判断逻辑删除值是否配置了
if (this.logicalDeleteColumn != null && (this.logicalDeleteValue == null || this.logicalUnDeleteValue == null)) {
warnings.add("itfsw(逻辑删除插件):" + introspectedTable.getFullyQualifiedTable() + "没有找到您配置的逻辑删除值,请全局或者局部配置logicalDeleteValue和logicalUnDeleteValue值!");
}
// 5. 获取逻辑删除常量值
this.logicalDeleteConstName = properties.getProperty(PRO_LOGICAL_DELETE_CONST_NAME) != null ? properties.getProperty(PRO_LOGICAL_DELETE_CONST_NAME).toUpperCase() : DEFAULT_LOGICAL_DELETE_CONST_NAME;
this.logicalUnDeleteConstName = properties.getProperty(PRO_LOGICAL_UN_DELETE_CONST_NAME) != null ? properties.getProperty(PRO_LOGICAL_UN_DELETE_CONST_NAME).toUpperCase() : DEFAULT_LOGICAL_UN_DELETE_CONST_NAME;
// 6. 防止增强的selectByPrimaryKey中逻辑删除键冲突
if (this.logicalDeleteColumn != null) {
Field logicalDeleteField = JavaBeansUtil.getJavaBeansField(this.logicalDeleteColumn, context, introspectedTable);
if (logicalDeleteField.getName().equals(PARAMETER_LOGICAL_DELETED)) {
this.logicalDeleteColumn = null;
warnings.add("itfsw(逻辑删除插件):" + introspectedTable.getFullyQualifiedTable() + "配置的逻辑删除列和插件保留关键字(" + PARAMETER_LOGICAL_DELETED + ")冲突!");
}
}
}
示例3: initColumnValueConvert
protected ValueConverter initColumnValueConvert(JDBCType jdbcType, Class javaType) {
boolean isBasicClass = !classMapping
.values()
.contains(javaType) || javaType != Map.class || javaType != List.class;
switch (jdbcType) {
case BLOB:
if (!isBasicClass) {
return new JSONValueConverter(javaType, new BlobValueConverter());
}
return new BlobValueConverter();
case CLOB:
if (!isBasicClass) {
return new JSONValueConverter(javaType, new ClobValueConverter());
}
return new ClobValueConverter();
case NUMERIC:
case BIGINT:
case INTEGER:
case SMALLINT:
case TINYINT:
return new NumberValueConverter(javaType);
case DATE:
case TIMESTAMP:
case TIME:
return new DateTimeConverter("yyyy-MM-dd HH:mm:ss", javaType);
default:
if (!isBasicClass) {
return new JSONValueConverter(javaType, new DefaultValueConverter());
}
if (javaType == String.class && (jdbcType == JDBCType.VARCHAR || jdbcType == JDBCType.NVARCHAR)) {
return new DefaultValueConverter() {
@Override
public Object getData(Object value) {
if (value instanceof Number) {
return value.toString();
}
return super.getData(value);
}
};
}
return new DefaultValueConverter();
}
}
示例4: getSqlType
@Override
public SQLType getSqlType() {
return JDBCType.VARCHAR;
}
示例5: getSqlType
@Override
public SQLType getSqlType () {
return JDBCType.VARCHAR;
}
示例6: getSqlType
/**
* From the Postgres manual, on character types:
* There is no performance difference among these three types, apart from increased storage space when using
* the blank-padded type, and a few extra CPU cycles to check the length when storing into a length-constrained
* column. While character(n) has performance advantages in some other database systems, there is no such advantage
* in PostgreSQL; in fact character(n) is usually the slowest of the three because of its additional storage costs.
*
* Arguably colors are integers expressed in hex though.
*/
@Override
public SQLType getSqlType() {
return JDBCType.VARCHAR;
}