本文整理匯總了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 );
}