本文整理匯總了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);
}
示例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);
}
示例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());
}
}
示例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 );
}
示例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);
}
}
示例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;
}
示例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 );
}
}
示例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
}
示例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;
}
}
示例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);
}
}
示例11: updateNClob
import java.sql.NClob; //導入依賴的package包/類
@Override
public void updateNClob(String columnLabel, NClob nClob) throws SQLException
{
throw new SQLFeatureNotSupportedException();
}
示例12: updateNClob
import java.sql.NClob; //導入依賴的package包/類
@Override
public void updateNClob(String columnLabel, NClob nClob) throws SQLException {
throw new UnsupportedOperationException("Not supported yet.");
}
示例13: getNClob
import java.sql.NClob; //導入依賴的package包/類
public NClob getNClob(String parameterName) throws SQLException
{
return realCallableStatement.getNClob(parameterName);
}
示例14: getNClob
import java.sql.NClob; //導入依賴的package包/類
@Override
public NClob getNClob(String columnLabel) throws SQLException {
throw new UnsupportedOperationException("Not supported yet.");
}
示例15: getNClob
import java.sql.NClob; //導入依賴的package包/類
@Override
public NClob getNClob( String columnLabel ) throws SQLException {
checkNotClosed();
return super.getNClob( columnLabel );
}