本文整理了Java中java.sql.Clob.setCharacterStream()
方法的一些代码示例,展示了Clob.setCharacterStream()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Clob.setCharacterStream()
方法的具体详情如下:
包路径:java.sql.Clob
类名称:Clob
方法名:setCharacterStream
[英]Retrieves a stream which can be used to write a stream of unicode characters to this Clob object, at a specified position.
[中]检索可用于在指定位置将unicode字符流写入此Clob对象的流。
代码示例来源:origin: spring-projects/spring-framework
@Override
public void setClobAsCharacterStream(
PreparedStatement ps, int paramIndex, @Nullable Reader characterStream, int contentLength)
throws SQLException {
if (characterStream != null) {
Clob clob = ps.getConnection().createClob();
try {
FileCopyUtils.copy(characterStream, clob.setCharacterStream(1));
}
catch (IOException ex) {
throw new DataAccessResourceFailureException("Could not copy into LOB stream", ex);
}
this.temporaryClobs.add(clob);
ps.setClob(paramIndex, clob);
}
else {
ps.setClob(paramIndex, (Clob) null);
}
if (logger.isDebugEnabled()) {
logger.debug(characterStream != null ?
"Copied character stream into temporary CLOB with length " + contentLength :
"Set CLOB to null");
}
}
代码示例来源:origin: alibaba/druid
@Override
public java.io.Writer clob_setCharacterStream(ClobProxy clob, long pos) throws SQLException {
if (this.pos < filterSize) {
return nextFilter().clob_setCharacterStream(this, clob, pos);
}
return clob.getRawClob().setCharacterStream(pos);
}
代码示例来源:origin: davidmoten/rxjava-jdbc
/**
* Sets the clob parameter for the prepared statement.
*
* @param ps
* @param i
* @param o
* @param cls
* @throws SQLException
*/
private static void setClob(PreparedStatement ps, int i, Object o, Class<?> cls)
throws SQLException {
final Reader r;
if (o instanceof String)
r = new StringReader((String) o);
else if (o instanceof Reader)
r = (Reader) o;
else
throw new RuntimeException(
"cannot insert parameter of type " + cls + " into clob column " + i);
Clob c = ps.getConnection().createClob();
Writer w = c.setCharacterStream(1);
copy(r, w);
ps.setClob(i, c);
}
代码示例来源:origin: com.alibaba/druid
@Override
public java.io.Writer clob_setCharacterStream(ClobProxy clob, long pos) throws SQLException {
if (this.pos < filterSize) {
return nextFilter().clob_setCharacterStream(this, clob, pos);
}
return clob.getRawClob().setCharacterStream(pos);
}
代码示例来源:origin: io.snappydata/gemfirexd
/**
* {@inheritDoc}
*/
@Override
public Writer setCharacterStream(long pos) throws SQLException {
return this.clob.setCharacterStream(pos);
}
代码示例来源:origin: io.snappydata/gemfirexd-core
/**
* {@inheritDoc}
*/
@Override
public Writer setCharacterStream(long pos) throws SQLException {
return this.clob.setCharacterStream(pos);
}
代码示例来源:origin: io.snappydata/snappydata-store-core
/**
* {@inheritDoc}
*/
@Override
public Writer setCharacterStream(long pos) throws SQLException {
return this.clob.setCharacterStream(pos);
}
代码示例来源:origin: stackoverflow.com
Clob myClob = this.con.createClob();
Writer clobWriter = myClob.setCharacterStream(1);
代码示例来源:origin: org.teiid/teiid-common-core
/**
* @see java.sql.Clob#setCharacterStream(long)
*/
public Writer setCharacterStream(long pos) throws SQLException {
return this.reference.setCharacterStream(pos);
}
代码示例来源:origin: co.paralleluniverse/comsat-jdbc
@Override
public Writer call() throws SQLException {
return clob.setCharacterStream(pos);
}
});
代码示例来源:origin: teiid/teiid
/**
* @see java.sql.Clob#setCharacterStream(long)
*/
public Writer setCharacterStream(long pos) throws SQLException {
return this.reference.setCharacterStream(pos);
}
代码示例来源:origin: org.apache.openjpa/openjpa-all
/**
* Invoke the JDK 1.4 <code>setCharacterStream</code> method on the given
* CLOB object.
*/
public void putChars(Clob clob, char[] data)
throws SQLException {
Writer writer = clob.setCharacterStream(1L);
try {
writer.write(data);
writer.flush();
} catch (IOException ioe) {
throw new SQLException(ioe.toString());
}
}
代码示例来源:origin: jboss.jboss-embeddable-ejb3/hibernate-all
public Writer setCharacterStream(long pos) throws SQLException {
return getWrappedClob().setCharacterStream(pos);
}
代码示例来源:origin: stackoverflow.com
java.sql.Connection con;
javax.xml.bind.Marshaller marshaller;
Clob xmlClob = con.createClob();
try {
try (Writer xmlClobWriter = xmlClob.setCharacterStream(1)) {
m.marshal(jaxbObject, xmlClobWriter);
} // xmlClobWriter.close();
try (PreparedStatement stmt = con.prepareStatement("INSERT INTO table (xml) values(?)")) {
stmt.setClob(1, xmlClob);
stmt.executeUpdate();
}
} finally {
xmlClob.free();
}
代码示例来源:origin: com.amazon.carbonado/carbonado
public Writer openWriter(long pos) throws PersistException {
try {
return getInternalClobForPersist().setCharacterStream(pos);
} catch (SQLException e) {
throw mRepo.toPersistException(e);
}
}
代码示例来源:origin: Carbonado/Carbonado
public Writer openWriter(long pos) throws PersistException {
try {
return getInternalClobForPersist().setCharacterStream(pos);
} catch (SQLException e) {
throw mRepo.toPersistException(e);
}
}
代码示例来源:origin: com.impossibl.pgjdbc-ng/pgjdbc-ng
@Override
public void setClob(int parameterIndex, Reader reader) throws SQLException {
checkClosed();
Clob clob = connection.createClob();
try {
CharStreams.copy(reader, clob.setCharacterStream(1));
}
catch (IOException e) {
throw new SQLException(e);
}
set(parameterIndex, clob, JDBCType.CLOB);
}
代码示例来源:origin: com.eventsourcing/pgjdbc-ng
@Override
public void setClob(int parameterIndex, Reader reader) throws SQLException {
checkClosed();
Clob clob = connection.createClob();
try {
CharStreams.copy(reader, clob.setCharacterStream(1));
}
catch (IOException e) {
throw new SQLException(e);
}
set(parameterIndex, clob, Types.CLOB);
}
代码示例来源:origin: com.impossibl.pgjdbc-ng/pgjdbc-ng
@Override
public void updateClob(int columnIndex, Reader x) throws SQLException {
checkClosed();
checkUpdate();
Clob clob = statement.connection.createClob();
try {
CharStreams.copy(x, clob.setCharacterStream(1));
}
catch (IOException e) {
throw new SQLException(e);
}
set(columnIndex, clob, null);
}
代码示例来源:origin: com.eventsourcing/pgjdbc-ng
@Override
public void updateClob(int columnIndex, Reader x) throws SQLException {
checkClosed();
checkUpdate();
Clob clob = statement.connection.createClob();
try {
CharStreams.copy(x, clob.setCharacterStream(1));
}
catch (IOException e) {
throw new SQLException(e);
}
set(columnIndex, clob);
}
内容来源于网络,如有侵权,请联系作者删除!