Java Code Examples for java.sql.JDBCType#TIMESTAMP

The following examples show how to use java.sql.JDBCType#TIMESTAMP . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CommonCachedRowSetTests.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
@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}
    };
}
 
Example 2
Source File: CommonCachedRowSetTests.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
@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}
    };
}
 
Example 3
Source File: CommonCachedRowSetTests.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
@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}
    };
}
 
Example 4
Source File: CommonCachedRowSetTests.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
@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}
    };
}
 
Example 5
Source File: CommonCachedRowSetTests.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
@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}
    };
}
 
Example 6
Source File: CommonCachedRowSetTests.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@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}
    };
}
 
Example 7
Source File: CommonCachedRowSetTests.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
@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}
    };
}
 
Example 8
Source File: CommonCachedRowSetTests.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
@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}
    };
}
 
Example 9
Source File: CommonCachedRowSetTests.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
@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}
    };
}
 
Example 10
Source File: TaskAdapter.java    From das with Apache License 2.0 5 votes vote down vote up
/**
 * If there is version column and it is updatable, the column can not be null and it will always use the update version template.
 */
private void initVersionColumnUpdateTemplate() {
	String versionColumn = parser.getVersionColumn();
	updateCriteriaTmpl = pkSql;

	if(versionColumn == null) {
           return;
       }
	
	String quotedVersionColumn = quote(parser.getVersionColumn());
	updateCriteriaTmpl += AND + String.format(TMPL_SET_VALUE, quotedVersionColumn);
	
	if(!isVersionUpdatable) {
           return;
       }

	JDBCType versionType = getColumnType(versionColumn);

	String valueTmpl = null;
	if(versionType == JDBCType.TIMESTAMP){
		valueTmpl = dbCategory.getTimestampExp();
	}else{
		valueTmpl = quote(parser.getVersionColumn()) + "+1";
	}
	
	setVersionValueTmpl = quotedVersionColumn + "=" + valueTmpl;
}
 
Example 11
Source File: EasyOrmSqlBuilder.java    From hsweb-framework with Apache License 2.0 4 votes vote down vote up
protected RDBTableMetaData createMeta(String tableName, String resultMapId) {
//        tableName = getRealTableName(tableName);
        RDBDatabaseMetaData active = getActiveDatabase();
        String cacheKey = tableName.concat("-").concat(resultMapId);
        Map<String, RDBTableMetaData> cache = metaCache.computeIfAbsent(active, k -> new ConcurrentHashMap<>());

        RDBTableMetaData cached = cache.get(cacheKey);
        if (cached != null) {
            return cached;
        }

        RDBTableMetaData rdbTableMetaData = new RDBTableMetaData() {
            @Override
            public String getName() {
                //动态切换表名
                return getRealTableName(tableName);
            }
        };
        ResultMap resultMaps = MybatisUtils.getResultMap(resultMapId);
        rdbTableMetaData.setName(tableName);
        rdbTableMetaData.setDatabaseMetaData(active);

        List<ResultMapping> resultMappings = new ArrayList<>(resultMaps.getResultMappings());
        resultMappings.addAll(resultMaps.getIdResultMappings());

        resultMappings.stream()
                .map(mapping -> this.createColumn(null, null, mapping))
                .flatMap(Collection::stream)
                .forEach(rdbTableMetaData::addColumn);

        if (useJpa) {
            Class type = entityFactory == null ? resultMaps.getType() : entityFactory.getInstanceType(resultMaps.getType());
            RDBTableMetaData parseResult = JpaAnnotationParser.parseMetaDataFromEntity(type);
            if (parseResult != null) {
                for (RDBColumnMetaData columnMetaData : parseResult.getColumns()) {
                    if (rdbTableMetaData.findColumn(columnMetaData.getName()) == null) {
                        columnMetaData = columnMetaData.clone();
                        columnMetaData.setProperty("fromJpa", true);
                        rdbTableMetaData.addColumn(columnMetaData);
                    }
                }
            }
        }
        for (RDBColumnMetaData column : rdbTableMetaData.getColumns()) {
            //时间
            if (column.getJdbcType() == JDBCType.DATE || column.getJdbcType() == JDBCType.TIMESTAMP) {
                ValueConverter dateConvert = new DateTimeConverter("yyyy-MM-dd HH:mm:ss", column.getJavaType()) {
                    @Override
                    public Object getData(Object value) {
                        if (value instanceof Number) {
                            return new Date(((Number) value).longValue());
                        }
                        return super.getData(value);
                    }
                };
                column.setValueConverter(dateConvert);
            } else if (column.getJavaType() == boolean.class || column.getJavaType() == Boolean.class) {
                column.setValueConverter(new BooleanValueConverter(column.getJdbcType()));
                column.setProperty("typeHandler", NumberBooleanTypeHandler.class.getName());
            } else if (TypeUtils.isNumberType(column)) { //数字
                //数字
                column.setValueConverter(new NumberValueConverter(column.getJavaType()));
            }
        }
        cache.put(cacheKey, rdbTableMetaData);
        return rdbTableMetaData;
    }