// based on code from Brian White @mscdex mariasql library - https://github.com/mscdex/node-mariasql/blob/master/lib/Client.js#L272-L332 // License: https://github.com/mscdex/node-mariasql/blob/master/LICENSE var RE_PARAM = /(?:\?)|(?::(\d+|(?:[a-zA-Z][a-zA-Z0-9_]*)))/g, DQUOTE = 34, SQUOTE = 39, BSLASH = 92; var parse = function(query) { var cqfn; if (this._queryCache && (cqfn = this._queryCache.get(query))) return cqfn; var ppos = RE_PARAM.exec(query), curpos = 0, start = 0, end, parts = [], i, chr, inQuote = false, escape = false, qchr, tokens = [], qcnt = 0, fn; if (ppos) { do { for (i=curpos,end=ppos.index; i