Skip to content

qie.doUpdateQuery

Signature: qie.doUpdateQuery(connection, query, useReadOnlyConnection*, timeoutSeconds*)

Returns: Integer updateCount - either the row count for SQL statements such as INSERT, UPDATE or DELETE, or 0 for SQL statements that return nothing

Execute a database query and return the number of rows touched by the query.

Note

This method uses the java.sql.PreparedStatement.executeUpdate() method. You will usually use the qie.doQuery() and qie.doConditionQuery() methods. Some JDBC drivers will require you to use this java.sql.PreparedStatement.executeUpdate() method instead.

Parameters

Type Name Description Default
String connection the name of the database connection
String query the SQL query statement to execute (may contain node tags to be evaluated)
Boolean useReadOnlyConnection* (optional) use a read-only database connection false
Integer timeoutSeconds* (optional) the SQL query timeout in seconds; 0 means no timeout 0

Example

// execute the query
var numberOfRowsAffected = qie.doUpdateQuery("EMR Database",
   "update patient set name = 'John Doe' where patient_id = 1");