Skip to content

pQuery.setShort

Signature: pQuery.setShort(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 Short value.

Note

The JDBC driver converts this to an SQL SMALLINT value 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
String or Short value the value to use for parameterName

Example

// Create the pQuery object with the SQL to be called
var pQuery = qie.getParameterizedQuery(
   "update patient set balance = :age where patient_id = 1"
);

// Example: value as Short
pQuery.setShort("age", 4);

// Execute the query
var queryResult = pQuery.doQuery("EMR Database");


// Example: value as String
pQuery = qie.getParameterizedQuery(
   "update patient set balance = :age where patient_id = 1"
);

pQuery.setShort("age", "12");

queryResult = pQuery.doQuery("EMR Database");


// Example: parameterName with prefix and value as String
pQuery = qie.getParameterizedQuery(
   "update patient set balance = :age where patient_id = 1"
);

pQuery.setShort(":age", "25");

queryResult = pQuery.doQuery("EMR Database");