Skip to content

Commit

Permalink
fix: encode binary data
Browse files Browse the repository at this point in the history
  • Loading branch information
gajus committed Oct 23, 2019
1 parent b0890c5 commit fcb6488
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/routines/executeQuery.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,25 @@ export default async (

try {
try {
let finalValues = actualQuery.values;

if (connection.native && actualQuery.values) {
finalValues = [];

for (const value of actualQuery.values) {
if (Buffer.isBuffer(value)) {
// $FlowFixMe
finalValues.push('\\x' + value.toString('hex'));
} else {
finalValues.push(value);
}
}
}

result = await executionRoutine(
connection,
actualQuery.sql,
actualQuery.values,
finalValues,
executionContext,
actualQuery
);
Expand Down

0 comments on commit fcb6488

Please sign in to comment.