From 36b76b3a0e2f01af5548584747d6f55b6569482f Mon Sep 17 00:00:00 2001 From: Eric Waldheim Date: Wed, 22 Oct 2014 19:44:40 -0600 Subject: [PATCH] add prepare statement test --- test/integration.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/integration.js b/test/integration.js index d93b444..9ed09f5 100644 --- a/test/integration.js +++ b/test/integration.js @@ -199,6 +199,24 @@ exports['IntegrationTest'] = nodeunit.testCase({ }); }, + "prepare statement": function(test) { + var self = this; + var stmt = self.connection.prepare("INSERT INTO person (name) VALUES (:1)"); + stmt.execute(["Bill O'Neil"], function(err, count) { + if(err) { console.error(err); return; } + stmt.execute(["Bob Johnson"], function(err, count) { + if(err) { console.error(err); return; } + self.connection.execute("SELECT * FROM person WHERE name = :1", ["Bill O'Neil"], function(err, results) { + if(err) { console.error(err); return; } + //console.log(results); + test.equal(results.length, 1); + test.equal(results[0]['NAME'], "Bill O'Neil"); + test.done(); + }); + }); + }); + }, + "utf8_chars_in_query": function(test) { var self = this, cyrillicString = "ั‚ะตัั‚";