Skip to content
Browse files

Special handling for Buffers in prepared query values

  • Loading branch information...
1 parent 186a8d0 commit 0b418fa6452ccea3e22edc0c26590fb6da6d44c5 @mscdex committed Sep 13, 2012
Showing with 6 additions and 2 deletions.
  1. +6 −2 lib/Client.js
View
8 lib/Client.js
@@ -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)

0 comments on commit 0b418fa

Please sign in to comment.
Something went wrong with that request. Please try again.