I'm getting the Uncaught error: no such table while compiling error. I was initially creating a database thru code and was able to insert and read the data in my tables without any problems. I changed it so that I would install a minimally populated database. I've uninstalled the app, did a clean build, but still get the error. I've double checked the sqlite db to verify the names are correct. I'm running build 2.1.1.
app.js
(function () { //var ApplicationWindow = require('CalculatorWindow'); //new ApplicationWindow().open(); var win; Ti.Database.install('referralDB1.sqlite', 'referralDB'); var tabtest = require('lib/tablet'); if (tabtest.isTablet()) { //Ti.API.info("this is a tablet"); win = require('ui/tablet/ApplicationWindow'); } else { if (tabtest.osname === 'iphone'){ win = require('ui/handheld/ios/ApplicationWindow'); } else { win = require('ui/handheld/android/ApplicationWindow'); } }; new win().open(); })();CategoryTable.js
var CategoryTableView = function() { var tv = Ti.UI.createTableView({ backgroundColor: 'transparent' }); function populateData() { var db = require('lib/db'); var results = db.list(); tv.setData(results); } Ti.App.addEventListener('databaseUpdated', populateData); //run initial query populateData(); return tv; }; module.exports = CategoryTableView;db.js
exports.list = function() { var categoryList = []; var db = Ti.Database.open('referralDB'); var result = db.execute('SELECT * FROM categories ORDER BY category ASC'); while (result.isValidRow()) { categoryList.push({ //add these attributes for the benefit of a table view title: result.fieldByName('category'), id: result.fieldByName('category_id'), //custom data attribute to pass to detail page hasChild:true, //color: '#fff', name: result.fieldByName('category'), //captured: (Number(result.fieldByName('captured')) === 1) }); result.next(); } result.close(); //make sure to close the result set db.close(); return categoryList; };
1 Answer
see this for some more information on how databases are installed
http://developer.appcelerator.com/question/116628/tidatabaseinstall-works-in-mysterious-ways
Your Answer
Think you can help? Login to answer this question!