DB

Database tables must be created manually be the server admin. Following function exist to access the database:

Example insert:

function onUpdated(pl) {
    DB.save("supportticket", {
        userid: pl.id,
        date_created: new Date(),
        nickname: pl.name,
        category: "general",
        subject: "Test2",
        description: "Test " + uuid()
    });
}  

Example load and update:

function onUpdated(pl) {
    var self = this;
    DB.load("supportticket", {}, function(tickets) {
        self.say("Load tickets from DB: " + tickets.length + " - " + tickets[0].description);

        tickets[0].description = "Update Test " + uuid();
        DB.save("supportticket", tickets[0]);
    });
}  

Example delete:

function onUpdated(pl) {
    DB.delete("supportticket", {ticket_id: 2});
}