本文整理汇总了Java中java.sql.ResultSet.updateBinaryStream方法的典型用法代码示例。如果您正苦于以下问题:Java ResultSet.updateBinaryStream方法的具体用法?Java ResultSet.updateBinaryStream怎么用?Java ResultSet.updateBinaryStream使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.sql.ResultSet
的用法示例。
在下文中一共展示了ResultSet.updateBinaryStream方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testUpdatableStream
import java.sql.ResultSet; //导入方法依赖的package包/类
/**
* Tests fix for updatable streams being supported in updatable result sets.
*
* @throws Exception
* if the test fails.
*/
public void testUpdatableStream() throws Exception {
try {
this.stmt.executeUpdate("DROP TABLE IF EXISTS updateStreamTest");
this.stmt.executeUpdate("CREATE TABLE updateStreamTest (keyField INT NOT NULL AUTO_INCREMENT PRIMARY KEY, field1 BLOB)");
int streamLength = 16385;
byte[] streamData = new byte[streamLength];
/* create an updatable statement */
Statement updStmt = this.conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
/* fill the resultset with some values */
ResultSet updRs = updStmt.executeQuery("SELECT * FROM updateStreamTest");
/* move to insertRow */
updRs.moveToInsertRow();
/* update the table */
updRs.updateBinaryStream("field1", new ByteArrayInputStream(streamData), streamLength);
updRs.insertRow();
} finally {
this.stmt.executeUpdate("DROP TABLE IF EXISTS updateStreamTest");
}
}
示例2: fileToField
import java.sql.ResultSet; //导入方法依赖的package包/类
public void fileToField(ResultSet resultset, String s)
throws ServletException, IOException, SmartUploadException, SQLException
{
long l = 0L;
int i = 0x10000;
int j = 0;
int k = m_startData;
if(resultset == null)
throw new IllegalArgumentException("The RecordSet cannot be null (1145).");
if(s == null)
throw new IllegalArgumentException("The columnName cannot be null (1150).");
if(s.length() == 0)
throw new IllegalArgumentException("The columnName cannot be empty (1155).");
l = BigInteger.valueOf(m_size).divide(BigInteger.valueOf(i)).longValue();
j = BigInteger.valueOf(m_size).mod(BigInteger.valueOf(i)).intValue();
try
{
for(int i1 = 1; (long)i1 < l; i1++)
{
resultset.updateBinaryStream(s, new ByteArrayInputStream(m_parent.m_binArray, k, i), i);
k = k != 0 ? k : 1;
k = i1 * i + m_startData;
}
if(j > 0)
resultset.updateBinaryStream(s, new ByteArrayInputStream(m_parent.m_binArray, k, j), j);
}
catch(SQLException sqlexception)
{
byte abyte0[] = new byte[m_size];
System.arraycopy(m_parent.m_binArray, m_startData, abyte0, 0, m_size);
resultset.updateBytes(s, abyte0);
}
catch(Exception exception)
{
throw new SmartUploadException("Unable to save file in the DataBase (1130).");
}
}
示例3: test4
import java.sql.ResultSet; //导入方法依赖的package包/类
public void test4( ResultSet rs ) throws SQLException {
rs.updateBinaryStream( 1, null, 0 );
}