pQuery.setBinaryStream¶
Signature: pQuery.setBinaryStream(parameterName, inputStream)
Returns: ParameterizedQuery pQuery - this ParameterizedQuery object. To see what methods can be used on a ParameterizedQuery, refer to the 'Parameterized Query' functions.
Sets the parameterName to the given inputStream.
Note
When a very large binary value is input to a LONGVARBINARY database column, it may be more practical to send it via a java.io.InputStream object. The data will be read from the inputStream as needed until end-of-file is reached.
Note
The inputStream can either be a standard Java stream object or your own subclass that implements the standard interface.
Note
The parameterName may include the parameter prefix character (colon ':' or at sign '@') but is not required. For example: ':fieldValue' and 'fieldValue' will reference the same named parameter.
Parameters¶
| Type | Name | Description | Default |
|---|---|---|---|
| String | parameterName | the name of the parameter | |
| InputStream | inputStream | the value to use for parameterName |
Example¶
// Create the pQuery object with the SQL to be called
var pQuery = qie.getParameterizedQuery("update patient set name = :name, photo = :picture where patient_id = 1");
var avatarStream = new java.io.ByteArrayInputStream(qie.base64DecodeToBytes("aGVsbG8="));
// Set the values for the input parameters
pQuery.setString("name", "Jonathan");
pQuery.setBinaryStream('picture', avatarStream);
// Execute the query
var queryResult = pQuery.doQuery("EMR Database");