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


Java NClob類代碼示例

本文整理匯總了Java中java.sql.NClob的典型用法代碼示例。如果您正苦於以下問題:Java NClob類的具體用法?Java NClob怎麽用?Java NClob使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: getObject

import java.sql.NClob; //導入依賴的package包/類
@SuppressWarnings("unchecked")
public <T> T getObject(int columnIndex, Class<T> type) throws SQLException {
    if (type == null) {
        throw SQLError.createSQLException("Type parameter can not be null", SQLError.SQL_STATE_ILLEGAL_ARGUMENT, getExceptionInterceptor());
    }

    if (type.equals(Struct.class)) {
        throw new SQLFeatureNotSupportedException();
    } else if (type.equals(RowId.class)) {
        return (T) getRowId(columnIndex);
    } else if (type.equals(NClob.class)) {
        return (T) getNClob(columnIndex);
    } else if (type.equals(SQLXML.class)) {
        return (T) getSQLXML(columnIndex);
    }

    return super.getObject(columnIndex, type);
}
 
開發者ID:JuanJoseFJ,項目名稱:ProyectoPacientes,代碼行數:19,代碼來源:JDBC4ResultSet.java

示例2: getNClob

import java.sql.NClob; //導入依賴的package包/類
/**
 * JDBC 4.0 Get a NCLOB column.
 * 
 * @param i
 *            the first column is 1, the second is 2, ...
 * 
 * @return an object representing a NCLOB
 * 
 * @throws SQLException
 *             if an error occurs
 */
public NClob getNClob(int columnIndex) throws SQLException {
    String fieldEncoding = this.fields[columnIndex - 1].getEncoding();

    if (fieldEncoding == null || !fieldEncoding.equals("UTF-8")) {
        throw new SQLException("Can not call getNClob() when field's charset isn't UTF-8");
    }

    if (!this.isBinaryEncoded) {
        String asString = getStringForNClob(columnIndex);

        if (asString == null) {
            return null;
        }

        return new com.mysql.jdbc.JDBC4NClob(asString, getExceptionInterceptor());
    }

    return getNativeNClob(columnIndex);
}
 
開發者ID:rafallis,項目名稱:BibliotecaPS,代碼行數:31,代碼來源:JDBC4UpdatableResultSet.java

示例3: updateNClob

import java.sql.NClob; //導入依賴的package包/類
/**
 * @see ResultSet#updateNClob(int, NClob)
 */
public void updateNClob(int columnIndex, java.sql.NClob nClob) throws SQLException {
    String fieldEncoding = this.fields[columnIndex - 1].getEncoding();
    if (fieldEncoding == null || !fieldEncoding.equals("UTF-8")) {
        throw new SQLException("Can not call updateNClob() when field's character set isn't UTF-8");
    }

    if (nClob == null) {
        updateNull(columnIndex);
    } else {
        updateNCharacterStream(columnIndex, nClob.getCharacterStream(), (int) nClob.length());
    }
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:16,代碼來源:JDBC4UpdatableResultSet.java

示例4: unwrap

import java.sql.NClob; //導入依賴的package包/類
@SuppressWarnings({ "unchecked" })
public <X> X unwrap(final NClob value, Class<X> type, WrapperOptions options) {
	if ( value == null ) {
		return null;
	}

	try {
		if ( CharacterStream.class.isAssignableFrom( type ) ) {
			if ( NClobImplementer.class.isInstance( value ) ) {
				// if the incoming NClob is a wrapper, just pass along its BinaryStream
				return (X) ( (NClobImplementer) value ).getUnderlyingStream();
			}
			else {
				// otherwise we need to build a BinaryStream...
				return (X) new CharacterStreamImpl( DataHelper.extractString( value.getCharacterStream() ) );
			}
		}
		else if (NClob.class.isAssignableFrom( type )) {
			final NClob nclob =  WrappedNClob.class.isInstance( value )
					? ( (WrappedNClob) value ).getWrappedNClob()
					: value;
			return (X) nclob;
		}
	}
	catch ( SQLException e ) {
		throw new HibernateException( "Unable to access nclob stream", e );
	}
	
	throw unknownUnwrap( type );
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:31,代碼來源:NClobTypeDescriptor.java

示例5: getNClob

import java.sql.NClob; //導入依賴的package包/類
@Override
public NClob getNClob(int columnIndex) throws SQLException {
    checkColumnBounds(columnIndex);
    try {
        return new JDBC4NClob(table.getString(columnIndex - 1)
                .toCharArray());
    } catch (Exception x) {
        throw SQLError.get(x);
    }
}
 
開發者ID:s-store,項目名稱:s-store,代碼行數:11,代碼來源:JDBC4ResultSet.java

示例6: getNClob

import java.sql.NClob; //導入依賴的package包/類
public NClob getNClob(int parameterIndex) throws SQLException {
    try {
        if (this.wrappedStmt != null) {
            return ((CallableStatement) this.wrappedStmt).getNClob(parameterIndex);
        } else {
            throw SQLError.createSQLException("No operations allowed after statement closed", SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor);
        }
    } catch (SQLException sqlEx) {
        checkAndFireConnectionError(sqlEx);
    }

    return null;
}
 
開發者ID:rafallis,項目名稱:BibliotecaPS,代碼行數:14,代碼來源:JDBC4CallableStatementWrapper.java

示例7: createNClob

import java.sql.NClob; //導入依賴的package包/類
@Override
public NClob createNClob(String string) {
	try {
		final NClob nclob = createNClob();
		nclob.setString( 1, string );
		return nclob;
	}
	catch ( SQLException e ) {
		throw new JDBCException( "Unable to set NCLOB string after creation", e );
	}
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:12,代碼來源:ContextualLobCreator.java

示例8: createNClob

import java.sql.NClob; //導入依賴的package包/類
/**
 * @see java.sql.Connection#createNClob()
 */
public NClob createNClob() throws SQLException {
    checkClosed();

    try {
        return ((java.sql.Connection) this.mc).createNClob();
    } catch (SQLException sqlException) {
        checkAndFireConnectionError(sqlException);
    }

    return null; // never reached, but compiler can't tell
}
 
開發者ID:JuanJoseFJ,項目名稱:ProyectoPacientes,代碼行數:15,代碼來源:JDBC4ConnectionWrapper.java

示例9: createNClob

import java.sql.NClob; //導入依賴的package包/類
public NClob createNClob() throws SQLException
{
	try
	{
		return realConnection.createNClob();
	}
	catch(SQLException s)
	{
		String methodCall = "createNClob()";
		reportException(methodCall, s, null);
		throw s;
	}
}
 
開發者ID:skeychen,項目名稱:dswork.jdbc,代碼行數:14,代碼來源:ConnectionSpy.java

示例10: setNClob

import java.sql.NClob; //導入依賴的package包/類
public void setNClob(String parameterName, NClob value) throws SQLException {
    try {
        if (this.wrappedStmt != null) {
            ((CallableStatement) this.wrappedStmt).setNClob(parameterName, value);
        } else {
            throw SQLError.createSQLException("No operations allowed after statement closed", SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor);
        }
    } catch (SQLException sqlEx) {
        checkAndFireConnectionError(sqlEx);
    }
}
 
開發者ID:rafallis,項目名稱:BibliotecaPS,代碼行數:12,代碼來源:JDBC4CallableStatementWrapper.java

示例11: updateNClob

import java.sql.NClob; //導入依賴的package包/類
@Override
public void updateNClob(String columnLabel, NClob nClob) throws SQLException
{
	throw new SQLFeatureNotSupportedException();
}
 
開發者ID:olavloite,項目名稱:spanner-jdbc,代碼行數:6,代碼來源:AbstractCloudSpannerResultSet.java

示例12: updateNClob

import java.sql.NClob; //導入依賴的package包/類
@Override
public void updateNClob(String columnLabel, NClob nClob) throws SQLException {
    throw new UnsupportedOperationException("Not supported yet.");
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:5,代碼來源:StubJoinRowSetImpl.java

示例13: getNClob

import java.sql.NClob; //導入依賴的package包/類
public NClob getNClob(String parameterName) throws SQLException
{
	return realCallableStatement.getNClob(parameterName);
}
 
開發者ID:skeychen,項目名稱:dswork.jdbc,代碼行數:5,代碼來源:CallableStatementSpy.java

示例14: getNClob

import java.sql.NClob; //導入依賴的package包/類
@Override
public NClob getNClob(String columnLabel) throws SQLException {
    throw new UnsupportedOperationException("Not supported yet.");
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:5,代碼來源:StubJoinRowSetImpl.java

示例15: getNClob

import java.sql.NClob; //導入依賴的package包/類
@Override
public NClob getNClob( String columnLabel ) throws SQLException {
  checkNotClosed();
  return super.getNClob( columnLabel );
}
 
開發者ID:skhalifa,項目名稱:QDrill,代碼行數:6,代碼來源:DrillResultSetImpl.java


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