I am using Appcelerator. I am using the following code to fetch db records. I am using an SQLite Client, NavCatLite as a SQLite GUI for viewing and Inserting Data. I am having a Weird issue that when I update a record via SQLite client, it does reflect in my code. Why is it not refreshing the data? I even closed the client as I thought it would be caching the connection but it did not help either. Code is given below:
/** * All Db Functions Goes here */
var resumeDB = Titanium.Database.install('resume.db', 'myResume');
//var resumeDB = Titanium.Database.open('cold');
//Iterate through ResultSet
var myResultSet = resumeDB.execute('SELECT * FROM cvs');
while (myResultSet.isValidRow())
{
Ti.API.info("Result iS = "+myResultSet.fieldByName('sb_title'));
myResultSet.next();
} // Do something that iterates
resumeDB.close();
P.s: This is not a Read-only Database. The user will be inserting and fetching Data every time.
The database file that you initally store in /Resources
is not the database file that is used by the app post-install.
Per the guide
On the other hand, install() will copy a pre-existing database file from Titanium's Resources directory, or one of its descendants, to applicationDataDirectory/../databases/ and return a reference to the opened database. If a file already exists with the same name, the copy action will silently fail and the database will simply be opened.
In short, it just doesn't work that way.