pQuery.setBytes¶
Signature: pQuery.setBytes(parameterName, value)
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 Java Byte[] or byte[] value.
Note
The JDBC driver converts this to an SQL VARBINARY or LONGVARBINARY (depending on the argument's size relative to the driver's limits on VARBINARY values) when it sends it to the database.
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 | |
| byte[] | value | the value to use for parameterName |
Example¶
// Create the pQuery object with the stored procedure to be called
var pQuery = qie.getParameterizedQuery("update patient set name = :name, photo = :picture where patient_id = 1");
var imageBytes = qie.base64DecodeToBytes("aGVsbG8=");
// Set the values for the input parameters
pQuery.setString("name", "Jonathan");
pQuery.setBytes('picture', imageBytes);
// Execute the stored procedure
var queryResult = pQuery.doQuery("EMR Database");