當前位置: 首頁>>代碼示例>>Java>>正文


Java Types.NCLOB屬性代碼示例

本文整理匯總了Java中java.sql.Types.NCLOB屬性的典型用法代碼示例。如果您正苦於以下問題:Java Types.NCLOB屬性的具體用法?Java Types.NCLOB怎麽用?Java Types.NCLOB使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在java.sql.Types的用法示例。


在下文中一共展示了Types.NCLOB屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: 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;
}
   }
 
開發者ID:kawansoft,項目名稱:aceql-http,代碼行數:22,代碼來源:ResultSetWriter.java

示例2: getSqlTypeDescriptorOverride

@Override
protected SqlTypeDescriptor getSqlTypeDescriptorOverride(final int sqlCode) {
	switch ( sqlCode ) {
	case Types.BOOLEAN:
		return BitTypeDescriptor.INSTANCE;
	case Types.CLOB:
		return HANA_CLOB_STREAM_BINDING;
	case Types.NCLOB:
		return HANA_NCLOB_STREAM_BINDING;
	case Types.TINYINT:
		// tinyint is unsigned on HANA
		return SmallIntTypeDescriptor.INSTANCE;
	default:
		return super.getSqlTypeDescriptorOverride( sqlCode );
	}
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:16,代碼來源:AbstractHANADialect.java

示例3: isBlob

/**
 * Return if a given data type is blob type or not. Note: CLOB should really
 * not be in this list, use isLob method for that.
 *
 * @param type the type from java.sql.Types return true if the give type is
 * blob type; false otherwise
 */
static public boolean isBlob(int type) {
    switch (type) {
        case Types.BLOB:
        case Types.CLOB:
        case Types.BINARY:
        case Types.VARBINARY:
        case Types.LONGVARBINARY:
        case Types.OTHER:
        case Types.NCLOB:
            return true;
    }

    return false;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:21,代碼來源:SQLTypeUtil.java

示例4: encoding

public static String encoding(String source, int sqlType, String sourceEncoding, String targetEncoding) {
    switch (sqlType) {
        case Types.CHAR:
        case Types.VARCHAR:
        case Types.LONGVARCHAR:
        case Types.NCHAR:
        case Types.NVARCHAR:
        case Types.LONGNVARCHAR:
        case Types.CLOB:
        case Types.NCLOB:
            if (false == StringUtils.isEmpty(source)) {
                String fromEncoding = StringUtils.isBlank(sourceEncoding) ? "UTF-8" : sourceEncoding;
                String toEncoding = StringUtils.isBlank(targetEncoding) ? "UTF-8" : targetEncoding;

                // if (false == StringUtils.equalsIgnoreCase(fromEncoding,
                // toEncoding)) {
                try {
                    return new String(source.getBytes(fromEncoding), toEncoding);
                } catch (UnsupportedEncodingException e) {
                    throw new IllegalArgumentException(e.getMessage(), e);
                }
                // }
            }
    }

    return source;
}
 
開發者ID:luoyaogui,項目名稱:otter-G,代碼行數:27,代碼來源:SqlUtils.java

示例5: 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

示例6: buildWithCallback

@SuppressWarnings("unchecked")
public static final void buildWithCallback(AbstractConfig config, ResultSet rs, final Callback callback) throws SQLException {
	ResultSetMetaData rsmd = rs.getMetaData();
	int columnCount = rsmd.getColumnCount();
	String[] labelNames = new String[columnCount + 1];
	int[] types = new int[columnCount + 1];
	buildLabelNamesAndTypes(rsmd, labelNames, types);
	while (rs.next()) {
		Record record = new Record();
		record.setColumnsMap(config.containerFactory.getColumnsMap());
		Map<String, Object> columns = record.getColumns();
		for (int i=1; i<=columnCount; i++) {
			Object value;
			if (types[i] < Types.BLOB)
				value = rs.getObject(i);
			else if (types[i] == Types.CLOB)
				value = ModelBuilder.handleClob(rs.getClob(i));
			else if (types[i] == Types.NCLOB)
				value = ModelBuilder.handleClob(rs.getNClob(i));
			else if (types[i] == Types.BLOB)
				value = ModelBuilder.handleBlob(rs.getBlob(i));
			else
				value = rs.getObject(i);
			
			columns.put(labelNames[i], value);
		}
		int rowIndex = rs.getRow();
		if (callback != null) {
			callback.invoke(record, rowIndex);
		}
	}
}
 
開發者ID:WhatAKitty,項目名稱:spark-project,代碼行數:32,代碼來源:RecordBuilder.java

示例7: buildRecord

private List<Record> buildRecord(ResultSet rs, int pageSize) throws SQLException {
	List<Record> result = new ArrayList<Record>();
	ResultSetMetaData rsmd = rs.getMetaData();
	int columnCount = rsmd.getColumnCount();
	String[] labelNames = new String[columnCount + 1];
	int[] types = new int[columnCount + 1];
	buildLabelNamesAndTypes(rsmd, labelNames, types);
	for (int k=0; k<pageSize && rs.next(); k++) {
		Record record = new Record();
		Map<String, Object> columns = record.getColumns();
		for (int i=1; i<=columnCount; i++) {
			Object value;
			if (types[i] < Types.BLOB)
				value = rs.getObject(i);
			else if (types[i] == Types.CLOB)
				value = ModelBuilder.handleClob(rs.getClob(i));
			else if (types[i] == Types.NCLOB)
				value = ModelBuilder.handleClob(rs.getNClob(i));
			else if (types[i] == Types.BLOB)
				value = ModelBuilder.handleBlob(rs.getBlob(i));
			else
				value = rs.getObject(i);
			
			columns.put(labelNames[i], value);
		}
		result.add(record);
	}
	return result;
}
 
開發者ID:WhatAKitty,項目名稱:spark-project,代碼行數:29,代碼來源:AnsiSqlDialect.java

示例8: buildModel

@SuppressWarnings({"rawtypes", "unchecked"})
public final <T> List<T> buildModel(ResultSet rs, Class<? extends Model> modelClass, int pageSize) throws SQLException, InstantiationException, IllegalAccessException {
	List<T> result = new ArrayList<T>();
	ResultSetMetaData rsmd = rs.getMetaData();
	int columnCount = rsmd.getColumnCount();
	String[] labelNames = new String[columnCount + 1];
	int[] types = new int[columnCount + 1];
	buildLabelNamesAndTypes(rsmd, labelNames, types);
	for (int k=0; k<pageSize && rs.next(); k++) {
		Model<?> ar = modelClass.newInstance();
		Map<String, Object> attrs = CPI.getAttrs(ar);
		for (int i=1; i<=columnCount; i++) {
			Object value;
			if (types[i] < Types.BLOB)
				value = rs.getObject(i);
			else if (types[i] == Types.CLOB)
				value = ModelBuilder.handleClob(rs.getClob(i));
			else if (types[i] == Types.NCLOB)
				value = ModelBuilder.handleClob(rs.getNClob(i));
			else if (types[i] == Types.BLOB)
				value = ModelBuilder.handleBlob(rs.getBlob(i));
			else
				value = rs.getObject(i);
			
			attrs.put(labelNames[i], value);
		}
		result.add((T)ar);
	}
	return result;
}
 
開發者ID:WhatAKitty,項目名稱:spark-project,代碼行數:30,代碼來源:AnsiSqlDialect.java

示例9: getSQLType

/**
 * Get the SQLType for the given java.sql.Type type.
 *
 * @param type the java.sql.Type type specifier
 * @return SQLType.the SQLType for this java.sql.Type, or null if it's not recognized
 */
public static SQLType getSQLType(int type) {
    switch (type) {
        case Types.BIT: return SQLType.BIT;
        case Types.TINYINT: return SQLType.TINYINT;
        case Types.SMALLINT: return SQLType.SMALLINT;
        case Types.INTEGER: return SQLType.INTEGER;
        case Types.BIGINT: return SQLType.BIGINT;
        case Types.FLOAT: return SQLType.FLOAT;
        case Types.REAL: return SQLType.REAL;
        case Types.DOUBLE: return SQLType.DOUBLE;
        case Types.NUMERIC: return SQLType.NUMERIC;
        case Types.DECIMAL: return SQLType.DECIMAL;
        case Types.CHAR: return SQLType.CHAR;
        case Types.VARCHAR: return SQLType.VARCHAR;
        case Types.LONGVARCHAR: return SQLType.LONGVARCHAR;
        case Types.DATE: return SQLType.DATE;
        case Types.TIME: return SQLType.TIME;
        case Types.TIMESTAMP: return SQLType.TIMESTAMP;
        case Types.BINARY: return SQLType.BINARY;
        case Types.VARBINARY: return SQLType.VARBINARY;
        case Types.LONGVARBINARY: return SQLType.LONGVARBINARY;
        case Types.NULL: return SQLType.NULL;
        case Types.OTHER: return SQLType.OTHER;
        case Types.JAVA_OBJECT: return SQLType.JAVA_OBJECT;
        case Types.DISTINCT: return SQLType.DISTINCT;
        case Types.STRUCT: return SQLType.STRUCT;
        case Types.ARRAY: return SQLType.ARRAY;
        case Types.BLOB: return SQLType.BLOB;
        case Types.CLOB: return SQLType.CLOB;
        case Types.REF: return SQLType.REF;
        case Types.DATALINK: return SQLType.DATALINK;
        case Types.BOOLEAN: return SQLType.BOOLEAN;
        case Types.LONGNVARCHAR: return SQLType.LONGVARCHAR;
        case Types.NCHAR: return SQLType.CHAR;
        case Types.NCLOB: return SQLType.CLOB;
        case Types.NVARCHAR: return SQLType.VARCHAR;
        case Types.SQLXML: return SQLType.SQLXML;
        case Types.ROWID: return SQLType.ROWID;
        default:
            Logger.getLogger(JDBCUtils.class.getName()).log(Level.WARNING, "Unknown JDBC column type: " + type + ". Returns null.");
            return null;
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:49,代碼來源:JDBCUtils.java

示例10: 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;
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:56,代碼來源:ResultSetTableModel.java

示例11: getSqlTypeString

/**
 * Convert sql types to String for display
 *
 * @param sqlType the type number from java.sql.Types
 * @return the type name
 */
static public String getSqlTypeString(int sqlType) {
    switch (sqlType) {
        case Types.BIGINT:
            return "BIGINT"; //NOI18N
        case Types.BINARY:
            return "BINARY"; //NOI18N
        case Types.BIT:
            return "BIT"; //NOI18N
        case Types.NCHAR:
            return "NCHAR"; //NOI18N
        case Types.CHAR:
            return "CHAR"; //NOI18N
        case Types.DATE:
            return "DATE"; //NOI18N
        case Types.DECIMAL:
            return "DECIMAL"; //NOI18N
        case Types.DOUBLE:
            return "DOUBLE"; //NOI18N
        case Types.FLOAT:
            return "FLOAT"; //NOI18N
        case Types.INTEGER:
            return "INTEGER"; //NOI18N
        case Types.LONGVARBINARY:
            return "LONGVARBINARY"; //NOI18N
        case Types.LONGNVARCHAR:
            return "LONGNVARCHAR"; //NOI18N
        case Types.LONGVARCHAR:
            return "LONGVARCHAR"; //NOI18N
        case Types.NULL:
            return "NULL"; //NOI18N
        case Types.NUMERIC:
            return "NUMERIC"; //NOI18N
        case Types.OTHER:
            return "OTHER"; //NOI18N
        case Types.REAL:
            return "REAL"; //NOI18N
        case Types.SMALLINT:
            return "SMALLINT"; //NOI18N
        case Types.TIME:
            return "TIME"; //NOI18N
        case Types.TIMESTAMP:
            return "TIMESTAMP"; //NOI18N
        case Types.TINYINT:
            return "TINYINT"; //NOI18N
        case Types.VARBINARY:
            return "VARBINARY"; //NOI18N
        case Types.NVARCHAR:
            return "NVARCHAR";
        case Types.VARCHAR:
            return "VARCHAR"; //NOI18N
        case Types.JAVA_OBJECT:
            return "JAVA_OBJECT"; //NOI18N
        case Types.DISTINCT:
            return "DISTINCT"; //NOI18N
        case Types.STRUCT:
            return "STRUCT"; //NOI18N
        case Types.ARRAY:
            return "ARRAY"; //NOI18N
        case Types.BLOB:
            return "BLOB"; //NOI18N
        case Types.NCLOB:
            return "NCLOB";
        case Types.CLOB:
            return "CLOB"; //NOI18N
        case Types.REF:
            return "REF"; //NOI18N
        default:
            Logger.getLogger(SQLTypeUtil.class.getName()).log(Level.WARNING, "Unknown JDBC column type: {0}. Returns null.", sqlType);
            return "UNKNOWN"; //NOI18N
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:77,代碼來源:SQLTypeUtil.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:DomKing,項目名稱:server-utility,代碼行數:6,代碼來源:IntrospectedColumn.java

示例13: isLOB

public boolean isLOB() {
    return jdbcType == Types.BLOB || jdbcType == Types.CLOB || jdbcType == Types.NCLOB || 
    	name.endsWith("CLOB") || "BLOB".equals(name);
}
 
開發者ID:aravindc,項目名稱:jdbacl,代碼行數:4,代碼來源:DBDataType.java

示例14: dataTypeFromSqlType

/**
 * Converts a given SQL data type to a {@link DataType}.
 *
 * @param sqlType The jdbc data type to convert.
 * @param typeName The (potentially database specific) type name
 * @param width The width of the column
 * @return The Cryo DataType that represents the sql connection data type
 *         given in <var>sqlType</var>.
 */
protected DataType dataTypeFromSqlType(int sqlType, String typeName, @SuppressWarnings("unused") int width) {
  switch (sqlType) {
    case Types.TINYINT:
    case Types.SMALLINT:
    case Types.INTEGER:
      return DataType.INTEGER;
    case Types.BIGINT:
      return DataType.BIG_INTEGER;
    case Types.FLOAT:
    case Types.REAL:
    case Types.DOUBLE:
    case Types.NUMERIC:
    case Types.DECIMAL:
      return DataType.DECIMAL;

    case Types.CHAR:
    case Types.VARCHAR:
    case Types.LONGVARCHAR:
    case Types.LONGNVARCHAR:
    case Types.NVARCHAR:
      return DataType.STRING;

    case Types.BOOLEAN:
    case Types.BIT:
      return DataType.BOOLEAN;
    case Types.BINARY:
      return DataType.BOOLEAN;
    case Types.DATE:
      return DataType.DATE;
    case Types.BLOB:
    case Types.VARBINARY:
    case Types.LONGVARBINARY:
      return DataType.BLOB;
    case Types.NCLOB:
    case Types.CLOB:
      return DataType.CLOB;

    default:
      throw new IllegalArgumentException("Unknown SQL data type [" + typeName + "] (" + sqlType + ")");
  }
}
 
開發者ID:alfasoftware,項目名稱:morf,代碼行數:50,代碼來源:DatabaseMetaDataProvider.java

示例15: javaTypeMysql

public static int javaTypeMysql(int javaType) {

		switch (javaType) {
		case Types.NUMERIC:
			return MysqlDefs.FIELD_TYPE_DECIMAL;

		case Types.DECIMAL:
			return MysqlDefs.FIELD_TYPE_NEW_DECIMAL;

		case Types.TINYINT:
			return MysqlDefs.FIELD_TYPE_TINY;

		case Types.SMALLINT:
			return MysqlDefs.FIELD_TYPE_SHORT;

		case Types.INTEGER:
			return MysqlDefs.FIELD_TYPE_LONG;

		case Types.REAL:
			return MysqlDefs.FIELD_TYPE_FLOAT;

		case Types.DOUBLE:
			return MysqlDefs.FIELD_TYPE_DOUBLE;

		case Types.NULL:
			return MysqlDefs.FIELD_TYPE_NULL;

		case Types.TIMESTAMP:
			return MysqlDefs.FIELD_TYPE_TIMESTAMP;

		case Types.BIGINT:
			return MysqlDefs.FIELD_TYPE_LONGLONG;

		case Types.DATE:
			return MysqlDefs.FIELD_TYPE_DATE;

		case Types.TIME:
			return MysqlDefs.FIELD_TYPE_TIME;

		case Types.VARBINARY:
			return MysqlDefs.FIELD_TYPE_TINY_BLOB;

		case Types.LONGVARBINARY:
			return MysqlDefs.FIELD_TYPE_BLOB;
            //對應sqlserver的image類型
            case 27:
                return MysqlDefs.FIELD_TYPE_BLOB;

		case Types.VARCHAR:
			return MysqlDefs.FIELD_TYPE_VAR_STRING;

		case Types.CHAR:
			return MysqlDefs.FIELD_TYPE_STRING;

		case Types.BINARY:
			return MysqlDefs.FIELD_TYPE_GEOMETRY;

		case Types.BIT:
			return MysqlDefs.FIELD_TYPE_BIT;
		case Types.CLOB:
			return MysqlDefs.FIELD_TYPE_VAR_STRING;
		case Types.BLOB:
			return MysqlDefs.FIELD_TYPE_BLOB;

		//修改by     [email protected]
		// 當jdbc連接非mysql的數據庫時,需要把對應類型映射為mysql的類型,否則應用端會出錯
			case Types.NVARCHAR:
				return MysqlDefs.FIELD_TYPE_VAR_STRING;
			case Types.NCHAR:
				return MysqlDefs.FIELD_TYPE_STRING;
			case Types.NCLOB:
				return MysqlDefs.FIELD_TYPE_VAR_STRING;
			case Types.LONGNVARCHAR:
				return MysqlDefs.FIELD_TYPE_VAR_STRING;

		default:
			return MysqlDefs.FIELD_TYPE_VAR_STRING;   //其他未知類型返回字符類型
		//	return Types.VARCHAR;
		}

	}
 
開發者ID:huang-up,項目名稱:mycat-src-1.6.1-RELEASE,代碼行數:81,代碼來源:MysqlDefs.java


注:本文中的java.sql.Types.NCLOB屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。