Hello We are getting memory leaks when inserting and updating records, as you can see we are using transactions as recommended on your documentation.
// Create a new record
dim db as SQLiteDatabase = DatabaseManager.Instance.ProjectDb
if db.connect and tname <> “” then
db.SQLExecute(“BEGIN TRANSACTION”)
dim data as DatabaseRecord = obj.ToRecord()
db.InsertRecord(tname, data)
if db.Error then
Debug.Error(obj, "Error inserting record: " + db.ErrorMessage)
db.Rollback()
db.Close()
else
//obj.CachedCopy = obj.Clone
db.Commit()
db.Close()
end if
else
Debug.Error(obj, “Error connecting, Nil DataRecord, or Unhandled Object Type”)
end if
// Update dbrec with values from objrec if values are changed
dim db as SQLiteDatabase = DatabaseManager.Instance.ProjectDb()
if db.Connect then
db.SQLExecute(“BEGIN TRANSACTION”)
dim queryStr as String = "SELECT * FROM " + tableName + " WHERE Id = " + itemId
dim dbrec as RecordSet = db.SQLSelect(queryStr)
dbrec.Edit()
for each key as EnumSqlDataType in objprops.Keys
//We update the dbrec here
next
dbRec.Update()
dbRec.Close()
if db.Error then
db.Rollback()
db.Close()
Debug.Error(obj, "Error Updating Object: " + db.ErrorMessage)
Raise New FException(db.ErrorMessage)
else
//obj.CachedCopy = obj.Clone
db.Commit()
db.Close()
end if
end if