var Stmt = require ('./stmt'); var Holder = require ('./holder'); /** * Literal SQL string. */ module.exports = new Class ({ Extends: Stmt ,Properties: { query: { type: String ,value: null } } ,regexp: /#\w+/g ,replaceFunc: function (params, token) { var holder = new Holder ({id: token.substr (1)}); return holder.render (params); } ,render: function (params) { if (!this.query) return null; return this.query.replace (this.regexp, this.replaceFunc.bind (this, params)); } ,findHolders: function () { var ids = this.query.match (this.regexp); if (ids) for (var i = 0; i < ids.length; i++) ids[i] = ids[i].substr (1); return ids; } });