コード例 #1
0
		find: function find(params, callback) {

			var values = [
				params.userId
			];

			var sql = "select userId, taskId, description from task"+
					" where userId = ?";

			db.query({
				sql : sql, 
				values: values,
				callback : callback
			});
		},
コード例 #2
0
		findByID: function findByID(params, callback) {

			var values = [
				params.taskId,
				params.userId
			];

			var sql = "select taskId, description from task"+
					" where taskId = ?"+
					" and userId = ?";

			db.query({
				sql : sql, 
				values: values,
				callback : callback
			});
		},
コード例 #3
0
		delete: function (params, callback) {

			var values = [
				params.taskId,
				params.userId
			];

			var sql = "delete from task"+
					" where taskId = ?"+
					" and userId = ?";

			db.query({
				sql : sql, 
				values: values,
				callback : callback
			});
		},
コード例 #4
0
		insert: function insert (params, callback) {

			var values = [
				params.userId,
				params.description
			];

			var sql = "insert into task "+
					" (userId, description)"+
					" values (?,?)";

			db.query({
				sql : sql, 
				values: values,
				callback : callback
			});
		},
コード例 #5
0
		update: function update (params, callback) {

			var values = [
				params.description,
				params.userId,
				params.taskId
			];

			var sql = "update task "+
					" set description = ? "+
					" where userId = ? "+
					" and taskId = ? ";

			db.query({
				sql : sql, 
				values: values,
				callback : callback
			});
		},