Sqlite Database in Ares 0.2.9 with enyo 2.3

edited January 2014 in Newbie Questions
Hi All,

I am trying to re-design my previously working sqlite app in Ares from enyo 2.2 but the following does not seem to work as I expect.
enyo.kind({
	name: "App", kind: "FittableRows", fit: true, components: [
				{kind: "onyx.Toolbar", content: "Hello World", fit: false, showing: true, allowHtml: true, style: "text-align: center;"},
				{kind: "enyo.FittableColumns", components: [
						{kind: "onyx.Button", content: "Create DB", fit: "true", ontap: "createDB"},
						{kind: "onyx.Button", content: "Create Table", ontap: "createTable", fit: "true"},
						{kind: "onyx.Button", content: "Insert Data", ontap: "insertData", fit: "true"},
						{kind: "onyx.Button", content: "Show Data", ontap: "showData", fit: "true"}
					]},
				{kind: "enyo.FittableColumns", style: "background-color: #2EFF2E;", components: [
						{kind: "onyx.Input", placeholder: "Input1"},
						{kind: "onyx.Input", placeholder: "Input2"},
						{kind: "onyx.Input", placeholder: "Input3"},
						{kind: "onyx.Input", placeholder: "Input4"}
					]},
				{name: "alerts", allowHtml: true},
				{kind: "enyo.List", fit: true, options: {isRepeater: true}},
				{kind: "onyx.Toolbar", components: [
						{kind: "onyx.Button", content: "Tap me", ontap: "helloWorldTap"}
					]}
			],
	helloWorldTap: function(inSender, inEvent) {
		this.$.main.addContent("The button was tapped.<br/>");
	},
	createDB: function(inSender, inEvent) {
	try {
     this.db = openDatabase('ext:TestDB', '', 'Test Data Store', 85836);
     this.$.alerts.setContent("TestDB Created Successfully");
		
	}
	catch (e)
	{
	this.$.alerts.setContent(e);	
	}
	
	},
	createTable: function(inSender, inEvent) {
		try {
			this.nullHandleCount = 0;
			
			var string = 'CREATE TABLE tableB (id INTEGER PRIMARY KEY, Value1 TEXT NOT NULL DEFAULT "nothing", Value2 TEXT NOT NULL DEFAULT "nothing", Value3 TEXT NOT NULL DEFAULT "nothing", Value4 TEXT NOT NULL DEFAULT "nothing")';
			this.db.transaction( 
			enyo.bind(this,(function (transaction) { 
			transaction.executeSql('DROP TABLE IF EXISTS tableB;', []); 
			transaction.executeSql(string, [], enyo.bind(this,this.<b>createTableDataHandler</b>), enyo.bind(this,this.errorHandler)); 
			}))
			);

			}
			catch (e)
			{
			this.$.alerts.setContent(e);
			}
	},
	
	<b>createTableDataHandler</b>: function(transaction, results) {
			this.$.alerts.setContent("Created TableB Successfully.");
			},
	
	insertData: function(inSender, inEvent) {
		// TODO - Auto-generated code
	},
	showData: function(inSender, inEvent) {
		// TODO - Auto-generated code
	}
});
My problem is that my createTableDataHandler does not alert me that the table was successfully created.

any pointer to the problem much appreciated

Comments

Sign In or Register to comment.