Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Special handling for Buffers in prepared query values
  • Loading branch information
mscdex committed Sep 13, 2012
1 parent 186a8d0 commit 0b418fa
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/Client.js
Expand Up @@ -219,11 +219,15 @@ Client.prototype.prepare = function(query) {
parts.push(query.substring(curpos));

fn = function(values) {
var ret = '', j, len;
var ret = '', j, len, str;
for (j=0,len=tokens.length; j<len; ++j) {
if (Buffer.isBuffer(values[tokens[j]]))
str = values[tokens[j]].toString('utf8');
else
str = values[tokens[j]] + '';
ret += parts[j];
ret += "'";
ret += addon.escape(values[tokens[j]] + '');
ret += addon.escape(str);
ret += "'";
}
if (j < parts.length)
Expand Down

0 comments on commit 0b418fa

Please sign in to comment.