node-db-oracle icon indicating copy to clipboard operation
node-db-oracle copied to clipboard

Failure when inserting single quote (')

Open joeferner opened this issue 14 years ago • 0 comments

The following code causes this error. If I remove the single quote from "Bob O'Neill" (ie "Bob ONeill") it works.

var oracle = require('db-oracle');

var client = new oracle.Database({
  hostname: "localhost",
  user: "test",
  password: "test"
});
client.connect(function(err) {
  if(err) { callback(err); return; }
  client.query().execute("INSERT INTO Person(name,age) VALUES(?,?)", [ 'Bob O\'Neill', 21 ], function(err, results) {
    console.log(err, results);
  });
});
terminate called after throwing an instance of 'oracle::occi::SQLException'
  what():  ORA-01756: quoted string not properly terminated

joeferner avatar Dec 16 '11 21:12 joeferner