Node-oracledb: ExecuteMany() Method Missing

Created on 2 May 2019  路  6Comments  路  Source: oracle/node-oracledb

Hey I noticed that in my oracledb installation, the ExecuteMany() function is not available.

Is there any way to install the files (maybe Typescript?) needed to use the method/function manually? OracleDB is already installed, and I can connect to my DB's, I'm just not sure why the ExecuteMany() function wouldn't be installed?

Answer the following questions:

  1. What is your Node.js version: v8.11.3 64-bit

  2. What is your node-oracledb version: 3.1.2

  3. What OS (and version) is Node.js executing on: win32

  4. What is your Oracle client (e.g. Instant Client) version: use 11.2.0.4.0? 64-bit installed on the C drive.

  5. What is your Oracle Database version: 11.2.0.4.0

  6. What is the PATH environment variable (on Windows) or LD_LIBRARY_PATH (on Linux) set to? On macOS, what is in ~/lib? Not sure

question

Most helpful comment

node-oracledb currently doesn't have an official Typescript definition file -- so you'll have to contact whoever created the Typescript definition file you are using and see if they can include executeMany(), or add it yourself!

All 6 comments

Can you share your code? The method name is executeMany() -- note the case of the name. You can see the documentation for this method here.

Sure - I when I hover over execute() for example, I can get a definition in a typescript file. When i hover over executeMany(), no such definition. So I'm thinking the 'class' is not installed. I was thinking if the 'class' typescript source code exists in github, maybe I could just copy the file into the 3.4.3 type folder and it would be fixed?

Code

var oracledb = require("oracledb");
var dbConfig = require("C:/node_modules/oracledb/examples/dbconfig.js");

var sql = "INSERT INTO mytab VALUES (:a, :b)";

var binds = [{ a: 1, b: "One" }, { a: 2, b: "Two" }, { a: 3, b: "Three" }];

var options = {
  autoCommit: true,
  bindDefs: {
    a: { type: oracledb.NUMBER },
    b: { type: oracledb.STRING, maxSize: 5 }
  }
};
connection = oracledb.getConnection({
  user: dbConfig.user,
  password: dbConfig.password,
  connectString: dbConfig.connectString
});

connection.executeMany(sql, binds, options, function(err, result) {
  if (err) {
    console.error(err);
  } else {
    console.log(result); // { rowsAffected: 3 }
  }
});

Debugger attached.
c:\exemany.js:21
connection.executeMany(sql, binds, options, function(err, result) {
^

TypeError: connection.executeMany is not a function
at Object. (c:\exemany.js:21:12)
at Module._compile (module.js:649:14)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Function.Module.runMain (module.js:693:10)
at startup (bootstrap_node.js:191:16)
at bootstrap_node.js:612:3

node-oracledb currently doesn't have an official Typescript definition file -- so you'll have to contact whoever created the Typescript definition file you are using and see if they can include executeMany(), or add it yourself!

The typescript file is out of date. You could submit a PR with an update if you like.
See https://github.com/oracle/node-oracledb/issues/169

If it's not clear: you should still be able to call executeMany()

thanks, I was going mental over misunderstanding typescript... curse my .NET background............ Thank you guys!!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ronnn picture ronnn  路  3Comments

cristian-programmer picture cristian-programmer  路  4Comments

JocelynDalle picture JocelynDalle  路  3Comments

ChrisHAdams picture ChrisHAdams  路  3Comments

chsnt picture chsnt  路  3Comments