@logExceptions(_LOGGER)<EOL><INDENT>@g_retrySQL<EOL>def jobSetFieldIfEqual(self, jobID, fieldName, newValue, curValue):<DEDENT>
<EOL>dbFieldName = self._jobs.pubToDBNameDict[fieldName]<EOL>conditionValue = []<EOL>if isinstance(curValue, bool):<EOL><INDENT>conditionExpression = '<STR_LIT>' % (<EOL>dbFieldName, {True:'<STR_LIT>', False:'<STR_LIT>'}[curValue])<EOL><DEDENT>elif curValue is None:<EOL><INDENT>conditionExpression = '<STR_LIT>' % (dbFieldName,)<EOL><DEDENT>else:<EOL><INDENT>conditionExpression = '<STR_LIT>' % (dbFieldName,)<EOL>conditionValue.append(curValue)<EOL><DEDENT>query = '<STR_LIT>''<STR_LIT>'% (self.jobsTableName, dbFieldName, conditionExpression)<EOL>sqlParams = [newValue, jobID] + conditionValue<EOL>with ConnectionFactory.get() as conn:<EOL><INDENT>result = conn.cursor.execute(query, sqlParams)<EOL><DEDENT>return (result == <NUM_LIT:1>)<EOL>
Change the value of 1 field in a job to 'newValue', but only if the
        current value matches 'curValue'. The 'fieldName' is the public name of
        the field (camelBack, not the lower_case_only form as stored in the DB).

        This method is used for example by HypersearcWorkers to update the
        engWorkerState field periodically. By qualifying on curValue, it insures
        that only 1 worker at a time is elected to perform the next scheduled
        periodic sweep of the models.

        Parameters:
        ----------------------------------------------------------------
        jobID:        jobID of the job record to modify
        fieldName:    public field name of the field
        newValue:     new value of the field to set
        curValue:     current value to qualify against

        retval:       True if we successfully modified the field
                      False if curValue did not match