Skip to content

Instantly share code, notes, and snippets.

@kmaglione
Created April 16, 2014 22:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kmaglione/10938460 to your computer and use it in GitHub Desktop.
Save kmaglione/10938460 to your computer and use it in GitHub Desktop.
saveSettings : function(settings) {
var q1 = "INSERT INTO gmailchecker (minute, ssl, inbox, sound, wav, leftClick, autologin, tab, notifyOnce, mailFetcher, hideIcon, uncategorised, notifyPopup) VALUES (?1,?2,?3,?4,?5,?6,?7,?8,?9,?10,?11,?12,?13)";
var q2 = "UPDATE gmailchecker SET minute=?1, ssl=?2, inbox=?3, sound=?4, wav=?5, leftClick=?6, autologin=?7, tab=?8, notifyOnce=?9, mailFetcher=?10, hideIcon=?11, uncategorised=?12, notifyPopup=?13";
var s = this.getSettings();
var updateFlag = s._db;
if (this.conn) {
var stmt = null;
try {
stmt = this.conn.createStatement(updateFlag? q2 : q1);
stmt.bindDoubleParameter(0, settings.minute);
stmt.bindInt32Parameter(1, settings.ssl);
stmt.bindInt32Parameter(2, settings.inbox);
stmt.bindInt32Parameter(3, settings.sound);
stmt.bindStringParameter(4, settings.wav);
stmt.bindInt32Parameter(5, settings.leftClick);
stmt.bindInt32Parameter(6, settings.autologin);
stmt.bindInt32Parameter(7, settings.tab);
stmt.bindInt32Parameter(8, settings.notifyOnce);
stmt.bindInt32Parameter(9, settings.mailFetcher);
stmt.bindInt32Parameter(10, settings.hideIcon);
stmt.bindInt32Parameter(11, settings.uncategorised);
stmt.bindInt32Parameter(12, settings.notifyPopup);
stmt.execute();
} catch (e) {
GMC_Storage.debug(e);
} finally {
GMC_Storage.closeStatement(stmt);
}
}
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment