Currently, I am working on executing the SQLite statement in an iOS application. To verify the count of affected records, I have implemented success and error callback methods.
Upon receiving the results, although the variables are correctly defined, I encounter an issue when trying to perform an "if" check on the rowsAffected variable as it is being considered as an object instead of a value.
This code snippet belongs to an Angular service where I handle the SQL query execution:
$DBService.ExecuteQuery(script, params,
function (insertId, rowsAffected, rows) {
window.logger.logIt("rowsAffected: " + rowsAffected.toString());
if (rowsAffected !== 1) {
deferred.reject("Failed to update record. Query did not return 1 record affected.");
} else {
deferred.resolve();
}
},
function (error) {
deferred.reject("Failed to update record. " + error.message);
}
);
While debugging, I noticed that hovering over the rowsAffected variable displays insertId, rowsAffected = 1, and rows as if they were properties of a class. This behavior raises confusion as rowsAffected should just be a single variable. Additionally, writing to the console log with window.logger.logIt() results in [object object], further indicating that it may be treated as a class rather than a simple variable within the class.
If anyone can shed some light on this situation, I would greatly appreciate it.