9a19f18cc7f495b4fca89751c4d1d0045a8f1dab
[vchess.git] / models / Variant.js
1 var db = require("../utils/database");
2
3 /*
4 * Structure:
5 * _id: integer
6 * name: varchar
7 * description: varchar
8 */
9
10 exports.getByName = function(name, callback)
11 {
12 db.serialize(function() {
13 db.get(
14 "SELECT * FROM Variants " +
15 "WHERE name='" + name + "'",
16 callback);
17 });
18 }
19
20 exports.getAll = function(callback)
21 {
22 db.serialize(function() {
23 db.all("SELECT * FROM Variants", callback);
24 });
25 }
26
27 //create, update, delete: directly in DB