Kindly tell me sqlite example


#1
.factory('DbAccess', function ($q) {
		var DbAccess = {};
		var db = window.openDatabase("epl.sqlite", "1.0", "Database", -1);`

		DbAccess.ClearDownDB = function(tx) {
			// Drop Tables
			//console.log("Dropping Tables");

			//tx.executeSql('DROP TABLE PROFILE');
			//tx.executeSql('DROP TABLE TABLE1');


		};
		DbAccess.PopulateDB = function(tx) {

			// CREATE THE TABLES
			//console.log("CREATING TABLES IF NOT EXISTS ");

			// TABLE1
			//console.log("creating TABLE1 table");
			tx.executeSql('CREATE TABLE IF NOT EXISTS TABLE1 (id INTEGER NOT NULL PRIMARY KEY UNIQUE, vin TEXT NOT NULL, name TEXT NOT NULL, make TEXT, model TEXT, year TEXT, fuelTypeId INTEGER, consumptionTypeId INTEGER, currencyId INTEGER, purchaseDate TEXT, purchaseAmount INTEGER, purchaseOdoReading INTEGER, tyreSize TEXT, fuelUnitTypeId INTEGER)');

			console.log("COMPLETED CREATION");
		};
		
		DbAccess.SingleResultHandler = function(deferred) {
			return function(tx, results) {
				var len = results.rows.length;
				var output_results = [];

				for (var i = 0; i < len; i++) {
					output_results.push(results.rows.item(i));
				}

				deferred.resolve(output_results[0]);

			};
		};

		DbAccess.MultipleResultHandler = function(deferred) {
			return function(tx, results) {
				var len = results.rows.length;
				var output_results = [];

				for (var i = 0; i < len; i++) {
					output_results.push(results.rows.item(i));
				}

				deferred.resolve(output_results);

			};
		};

		DbAccess.DefaultErrorHandler = function(err) {
			console.log("Error processing SQL: " + err.code);
		};

		DbAccess.promisedQuery = function(query, successCB, errorCB) {
			//console.log(query);
			var deferred = $q.defer();
			db.transaction(function(tx) {
				tx.executeSql(query, [], successCB(deferred), errorCB);
			}, errorCB);
			return deferred.promise;
		};

		DbAccess.InitDB= function() {
			db.transaction(DbAccess.PopulateDB, DbAccess.DefaultErrorHandler, DbAccess.MultipleResultHandler);
		};

		DbAccess.ResetDB= function() {
			db.transaction(DbAccess.ClearDownDB, DbAccess.DefaultErrorHandler, DbAccess.MultipleResultHandler);
		};

		return DbAccess;
	})
	
	.factory('DBQueries', function(DbAccess) {
		var DBQueries = {};


		DBQueries.GatTable = function(TABLE1) {
			var query = 'Select * FROM '+TABLE1;
			console.log(query);
			return DbAccess.promisedQuery(query, DbAccess.SingleResultHandler, DbAccess.DefaultErrorHandler);
		};


		return DBQueries;
	});

kindly tell me what the problem with this code