当前位置: 首页>>代码示例>>Java>>正文


Java Types.CLOB属性代码示例

本文整理汇总了Java中java.sql.Types.CLOB属性的典型用法代码示例。如果您正苦于以下问题:Java Types.CLOB属性的具体用法?Java Types.CLOB怎么用?Java Types.CLOB使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在java.sql.Types的用法示例。


在下文中一共展示了Types.CLOB属性的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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);
    }
}
 
开发者ID:zavtech,项目名称:morpheus-core,代码行数:25,代码来源:SQLType.java

示例2: setClob

/**
 * JDBC 2.0 Set a CLOB parameter.
 * 
 * @param i
 *            the first parameter is 1, the second is 2, ...
 * @param x
 *            an object representing a CLOB
 * 
 * @throws SQLException
 *             if a database error occurs
 */
public void setClob(int i, Clob x) throws SQLException {
    synchronized (checkClosed().getConnectionMutex()) {
        if (x == null) {
            setNull(i, Types.CLOB);
        } else {

            String forcedEncoding = this.connection.getClobCharacterEncoding();

            if (forcedEncoding == null) {
                setString(i, x.getSubString(1L, (int) x.length()));
            } else {
                try {
                    setBytes(i, StringUtils.getBytes(x.getSubString(1L, (int) x.length()), forcedEncoding));
                } catch (UnsupportedEncodingException uee) {
                    throw SQLError.createSQLException("Unsupported character encoding " + forcedEncoding, SQLError.SQL_STATE_ILLEGAL_ARGUMENT,
                            getExceptionInterceptor());
                }
            }

            this.parameterTypes[i - 1 + getParameterIndexOffset()] = Types.CLOB;
        }
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:34,代码来源:PreparedStatement.java

示例3: setType

public void setType(int columnType) {
  switch (columnType) {
    case Types.CHAR:
    case Types.VARCHAR:
    case Types.LONGNVARCHAR:
    case Types.CLOB:
    case Types.LONGVARCHAR:
    case Types.NCHAR:
    case Types.NCLOB:
    case Types.NVARCHAR:
    case Types.SQLXML:
      this.isString = true;
      break;

    default:
      this.isString = false;
      break;
  }
}
 
开发者ID:jgperrin,项目名称:net.jgp.labs.db.informix,代码行数:19,代码来源:PrettyFormatterColumn.java

示例4: useBufferRowExplicit

public static boolean useBufferRowExplicit(Field[] fields) {
    if (fields == null) {
        return false;
    }

    for (int i = 0; i < fields.length; i++) {
        switch (fields[i].getSQLType()) {
            case Types.BLOB:
            case Types.CLOB:
            case Types.LONGVARBINARY:
            case Types.LONGVARCHAR:
                return true;
        }
    }

    return false;
}
 
开发者ID:JuanJoseFJ,项目名称:ProyectoPacientes,代码行数:17,代码来源:MysqlIO.java

示例5: doColumn

private JSONObject doColumn(EventColumn column) {
    JSONObject obj = new JSONObject();
    obj.put("name", column.getColumnName());
    obj.put("update", column.isUpdate());
    obj.put("key", column.isKey());
    if (column.getColumnType() != Types.BLOB && column.getColumnType() != Types.CLOB) {
        obj.put("value", column.getColumnValue());
    } else {
        obj.put("value", "");
    }
    return obj;
}
 
开发者ID:luoyaogui,项目名称:otter-G,代码行数:12,代码来源:TestEventProcessor.java

示例6: 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);
}
 
开发者ID:Jugendhackt,项目名称:OpenVertretung,代码行数:42,代码来源:ResultSetImpl.java

示例7: 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;
    }
}
 
开发者ID:luoyaogui,项目名称:otter-G,代码行数:9,代码来源:SqlUtils.java

示例8: 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;
}
 
开发者ID:hykes,项目名称:CodeGen,代码行数:70,代码来源:ParserUtils.java

示例9: getSqlType

@Override
public int getSqlType() {
	return Types.CLOB;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:4,代码来源:ClobTypeDescriptor.java

示例10: test_oracle

@Test(expectedExceptions = RuntimeException.class)
public void test_oracle() {
    DbDataMedia media = getOracleMedia();
    final DbDialect dbDialect = dbDialectFactory.getDbDialect(1L, media.getSource());

    want.object(dbDialect).clazIs(OracleDialect.class);
    final SqlTemplate sqlTemplate = dbDialect.getSqlTemplate();
    final JdbcTemplate jdbcTemplate = dbDialect.getJdbcTemplate();
    final TransactionTemplate transactionTemplate = dbDialect.getTransactionTemplate();
    final int[] pkColumnTypes = { Types.NUMERIC, Types.VARCHAR };
    final int[] columnTypes = { Types.CHAR, Types.NUMERIC, Types.BLOB, Types.CLOB, Types.DATE, Types.DATE,
            Types.DATE };
    transactionTemplate.execute(new TransactionCallback() {

        public Object doInTransaction(TransactionStatus status) {
            int affect = 0;
            String sql = null;
            // 执行insert
            sql = sqlTemplate.getInsertSql(ORACLE_SCHEMA_NAME, TABLE_NAME, pkColumns, columns);
            System.out.println(sql);
            affect = (Integer) jdbcTemplate.execute(sql, new PreparedStatementCallback() {

                public Object doInPreparedStatement(PreparedStatement ps) throws SQLException, DataAccessException {
                    doPreparedStatement(ps,
                        dbDialect,
                        toTypes(columnTypes, pkColumnTypes),
                        toValues(columnValues, pkColumnValues));
                    return ps.executeUpdate();
                }

            });
            want.number(affect).isEqualTo(1);
            // 执行update
            sql = sqlTemplate.getUpdateSql(ORACLE_SCHEMA_NAME, TABLE_NAME, pkColumns, columns);
            System.out.println(sql);
            affect = (Integer) jdbcTemplate.execute(sql, new PreparedStatementCallback() {

                public Object doInPreparedStatement(PreparedStatement ps) throws SQLException, DataAccessException {
                    doPreparedStatement(ps,
                        dbDialect,
                        toTypes(columnTypes, pkColumnTypes),
                        toValues(columnValues, pkColumnValues));
                    return ps.executeUpdate();
                }

            });
            want.number(affect).isEqualTo(1);
            // 执行deleate
            sql = sqlTemplate.getDeleteSql(ORACLE_SCHEMA_NAME, TABLE_NAME, pkColumns);
            System.out.println(sql);
            affect = (Integer) jdbcTemplate.execute(sql, new PreparedStatementCallback() {

                public Object doInPreparedStatement(PreparedStatement ps) throws SQLException, DataAccessException {
                    doPreparedStatement(ps, dbDialect, toTypes(pkColumnTypes), toValues(pkColumnValues));
                    return ps.executeUpdate();
                }

            });
            want.number(affect).isEqualTo(1);
            // 执行merge
            sql = sqlTemplate.getMergeSql(ORACLE_SCHEMA_NAME, TABLE_NAME, pkColumns, columns, null);
            System.out.println(sql);

            affect = (Integer) jdbcTemplate.execute(sql, new PreparedStatementCallback() {

                public Object doInPreparedStatement(PreparedStatement ps) throws SQLException, DataAccessException {
                    doPreparedStatement(ps,
                        dbDialect,
                        toTypes(columnTypes, pkColumnTypes),
                        toValues(columnValues, pkColumnValues));
                    return ps.executeUpdate();
                }

            });
            want.number(affect).isEqualTo(1);
            throw new RuntimeException("rollback");
        }
    });
}
 
开发者ID:luoyaogui,项目名称:otter-G,代码行数:79,代码来源:DbDialectTest.java

示例11: setAsciiStream

public void setAsciiStream(int parameterIndex, InputStream x, long length) throws SQLException {
    setAsciiStream(parameterIndex, x, (int) length);
    this.parameterTypes[parameterIndex - 1 + getParameterIndexOffset()] = Types.CLOB;
}
 
开发者ID:JuanJoseFJ,项目名称:ProyectoPacientes,代码行数:4,代码来源:PreparedStatement.java

示例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;
}
 
开发者ID:bandaotixi,项目名称:generator_mybatis,代码行数:6,代码来源:IntrospectedColumn.java

示例13: test_mysql

@Test(expectedExceptions = RuntimeException.class)
public void test_mysql() {
    DbDataMedia media = getMysqlMedia();
    final DbDialect dbDialect = dbDialectFactory.getDbDialect(2L, media.getSource());
    want.object(dbDialect).clazIs(MysqlDialect.class);

    final SqlTemplate sqlTemplate = dbDialect.getSqlTemplate();
    final JdbcTemplate jdbcTemplate = dbDialect.getJdbcTemplate();
    final TransactionTemplate transactionTemplate = dbDialect.getTransactionTemplate();
    final int[] pkColumnTypes = { Types.INTEGER, Types.VARCHAR };
    final int[] columnTypes = { Types.CHAR, Types.DECIMAL, Types.BLOB, Types.CLOB, Types.DATE, Types.TIMESTAMP,
            Types.TIMESTAMP };
    transactionTemplate.execute(new TransactionCallback() {

        public Object doInTransaction(TransactionStatus status) {
            int affect = 0;
            String sql = null;
            // 执行insert
            sql = sqlTemplate.getInsertSql(MYSQL_SCHEMA_NAME, TABLE_NAME, pkColumns, columns);
            System.out.println(sql);
            affect = (Integer) jdbcTemplate.execute(sql, new PreparedStatementCallback() {

                public Object doInPreparedStatement(PreparedStatement ps) throws SQLException, DataAccessException {
                    doPreparedStatement(ps,
                        dbDialect,
                        toTypes(columnTypes, pkColumnTypes),
                        toValues(columnValues, pkColumnValues));
                    return ps.executeUpdate();
                }

            });
            want.number(affect).isEqualTo(1);
            // 执行update
            sql = sqlTemplate.getUpdateSql(MYSQL_SCHEMA_NAME, TABLE_NAME, pkColumns, columns);
            System.out.println(sql);
            affect = (Integer) jdbcTemplate.execute(sql, new PreparedStatementCallback() {

                public Object doInPreparedStatement(PreparedStatement ps) throws SQLException, DataAccessException {
                    doPreparedStatement(ps,
                        dbDialect,
                        toTypes(columnTypes, pkColumnTypes),
                        toValues(columnValues, pkColumnValues));
                    return ps.executeUpdate();
                }

            });
            want.number(affect).isEqualTo(1);
            // 执行deleate
            sql = sqlTemplate.getDeleteSql(MYSQL_SCHEMA_NAME, TABLE_NAME, pkColumns);
            System.out.println(sql);
            affect = (Integer) jdbcTemplate.execute(sql, new PreparedStatementCallback() {

                public Object doInPreparedStatement(PreparedStatement ps) throws SQLException, DataAccessException {
                    doPreparedStatement(ps, dbDialect, toTypes(pkColumnTypes), toValues(pkColumnValues));
                    return ps.executeUpdate();
                }

            });
            want.number(affect).isEqualTo(1);
            // 执行merge
            sql = sqlTemplate.getMergeSql(MYSQL_SCHEMA_NAME, TABLE_NAME, pkColumns, columns, null);
            System.out.println(sql);
            affect = (Integer) jdbcTemplate.execute(sql, new PreparedStatementCallback() {

                public Object doInPreparedStatement(PreparedStatement ps) throws SQLException, DataAccessException {
                    doPreparedStatement(ps,
                        dbDialect,
                        toTypes(columnTypes, pkColumnTypes),
                        toValues(columnValues, pkColumnValues));
                    return ps.executeUpdate();
                }

            });
            want.number(affect).isEqualTo(1);
            throw new RuntimeException("rollback");
        }
    });

}
 
开发者ID:luoyaogui,项目名称:otter-G,代码行数:79,代码来源:DbDialectTest.java

示例14: setUnicodeStream

/**
 * When a very large Unicode value is input to a LONGVARCHAR parameter, it
 * may be more practical to send it via a java.io.InputStream. JDBC will
 * read the data from the stream as needed, until it reaches end-of-file.
 * The JDBC driver will do any necessary conversion from UNICODE to the
 * database char format.
 * 
 * <P>
 * <B>Note:</B> This stream object can either be a standard Java stream object or your own subclass that implements the standard interface.
 * </p>
 * 
 * @param parameterIndex
 *            the first parameter is 1...
 * @param x
 *            the parameter value
 * @param length
 *            the number of bytes to read from the stream
 * 
 * @throws SQLException
 *             if a database access error occurs
 * 
 * @deprecated
 */
@Deprecated
public void setUnicodeStream(int parameterIndex, InputStream x, int length) throws SQLException {
    if (x == null) {
        setNull(parameterIndex, java.sql.Types.VARCHAR);
    } else {
        setBinaryStream(parameterIndex, x, length);

        this.parameterTypes[parameterIndex - 1 + getParameterIndexOffset()] = Types.CLOB;
    }
}
 
开发者ID:bragex,项目名称:the-vigilantes,代码行数:33,代码来源:PreparedStatement.java


注:本文中的java.sql.Types.CLOB属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。