Created
June 25, 2012 17:26
-
-
Save alejandro/2990018 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var bind = function (str, vars) { | |
| return str.replace(/(^|[^\\])\:(\w*)/g, function (v, w, x) { | |
| return w + vars[x] | |
| }) | |
| } | |
| var query = bind('INSERT INTO table1 SER field1 = :field1, field2 = :field2 ON DUPLICATE KEY UPDATE field2 = :field2', {field1: 1, field2: 2})) | |
| conn.query(query); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment