Article Preview
Buy Now
COLUMN
SQLiteDatabase
The differences between SQLiteDatabase and REALSQLDatabase
Issue: 11.5 (September/October 2013)
Author: Seth Verrinder
Author Bio: Seth is a consultant who uses Xojo and Real Studio every day in his job at BKeeney Software, Inc.
Article Description: No description available.
Article Length (in bytes): 6,605
Starting Page Number: 74
Article Number: 11511
Related Link(s): None
Excerpt of article text...
Xojo has deprecated REALSQLDatabase although it still works for now. If you use it, you should probably begin thinking about moving to the new SQLiteDatabase class. This article explores some of the differences between the two classes. Fortunately there aren’t too many differences and there are some new features in SQLiteDatabase that might make your life easier.
AutoCommit
The main difference is that the new class doesn’t have the AutoCommit property. AutoCommit in the old class defaulted to false and this meant that when you issued any kind of statement that changed the database it didn’t get committed immediately. At some point in your program you had to call the Commit method, only then would your changes up to that point actually be saved in the database file.
In older versions of REALbasic, the database would automatically do a commit when the application shut down. Unfortunately, if your application crashed, this commit couldn’t happen and, as I understand it, there were cases where the commit wasn’t reliable even when the application didn’t crash. For this reason, in recent versions of Real Studio and Xojo (I don’t know the exact version where this changed), there is no automatic commit when the program quits. If you make changes to the database and don’t call commit yourself, all of your changes will be lost.
Another problem with having AutoCommit off is that internally this meant there was a transaction in progress all the time. This only works if one program and one database object within that program are accessing the database at a time.
How Transactions Work
...End of Excerpt. Please purchase the magazine to read the full article.