Socket
Socket
Sign inDemoInstall

simple-oracledb

Package Overview
Dependencies
Maintainers
1
Versions
239
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-oracledb - npm Package Compare versions

Comparing version 0.0.15 to 0.0.16

71

docs/api.md

@@ -46,3 +46,5 @@ ## Classes

* [#release([callback])](#Connection+release)
* [#rollback([callback])](#Connection+rollback)
* [#queryJSON(sql, [bindParams], [options], callback)](#Connection+queryJSON)
* [#batchInsert(sql, bindParamsArray, options, callback)](#Connection+batchInsert)
* [#modifyParams(argumentsArray)](#Connection+modifyParams) ⇒ <code>object</code> ℗

@@ -111,3 +113,3 @@ * [#createCallback(callback, commit, [output])](#Connection+createCallback) ⇒ <code>function</code> ℗

| options | <code>object</code> | Any execute options |
| [options.autoCommit] | <code>object</code> | If you wish to commit after the update, this property must be set to true in the options (oracledb.autoCommit is not checked) |
| [options.autoCommit] | <code>object</code> | If you wish to commit after the insert, this property must be set to true in the options (oracledb.autoCommit is not checked) |
| [options.lobMetaInfo] | <code>object</code> | For LOB support this object must hold a mapping between DB column name and bind variable name |

@@ -192,2 +194,26 @@ | callback | <code>[AsyncCallback](#AsyncCallback)</code> | Invoked with an error or the insert results (if LOBs are provided, the callback will be triggered after they have been fully written to the DB) |

```
<a name="Connection+rollback"></a>
### Connection#rollback([callback])
This function modifies the existing connection.rollback function by enabling the input
callback to be an optional parameter.<br>
If rollback fails, you can't really rollback again the data, so the callback is not always needed.<br>
Therefore this function allows you to ignore the need to pass a callback and makes it as an optional parameter.
**Access:** public
| Param | Type | Description |
| --- | --- | --- |
| [callback] | <code>function</code> | An optional rollback callback function (see oracledb docs) |
**Example**
```js
connection.rollback(); //no callback needed
//still possible to call with a rollback callback function
connection.rollback(function onRollback(error) {
if (error) {
//now what?
}
});
```
<a name="Connection+queryJSON"></a>

@@ -227,2 +253,45 @@ ### Connection#queryJSON(sql, [bindParams], [options], callback)

```
<a name="Connection+batchInsert"></a>
### Connection#batchInsert(sql, bindParamsArray, options, callback)
Enables to run an INSERT SQL statement multiple times for each of the provided bind params.<br>
This allows to insert to same table multiple different rows with one single call.<br>
The callback output will be an array of objects of same as oracledb conection.execute (per row).<br>
All LOBs for all rows will be written to the DB via streams and only after all LOBs are written the callback will be called.<br>
The function arguments used to execute the 'insert' are exactly as defined in the oracledb connection.execute function, however the options are mandatory and
the bind params is now an array of bind params (one per row).
**Access:** public
| Param | Type | Description |
| --- | --- | --- |
| sql | <code>string</code> | The SQL to execute |
| bindParamsArray | <code>Array</code> | An array of instances of object/Array bind parameters used to specify the values for the columns per row |
| options | <code>object</code> | Any execute options |
| [options.autoCommit] | <code>object</code> | If you wish to commit after the update, this property must be set to true in the options (oracledb.autoCommit is not checked) |
| [options.lobMetaInfo] | <code>object</code> | For LOB support this object must hold a mapping between DB column name and bind variable name |
| callback | <code>[AsyncCallback](#AsyncCallback)</code> | Invoked with an error or the insert results (if LOBs are provided, the callback will be triggered after they have been fully written to the DB) |
**Example**
```js
connection.batchInsert('INSERT INTO mylobs (id, clob_column1, blob_column2) VALUES (:id, EMPTY_CLOB(), EMPTY_BLOB())', [ //no need to specify the RETURNING clause in the SQL
{ //first row values
id: 110,
clobText1: 'some long clob string', //add bind variable with LOB column name and text content (need to map that name in the options)
blobBuffer2: new Buffer('some blob content, can be binary...') //add bind variable with LOB column name and text content (need to map that name in the options)
},
{ //second row values
id: 111,
clobText1: 'second row',
blobBuffer2: new Buffer('second rows')
}
], {
autoCommit: true, //must be set to true in options to support auto commit after insert is done, otherwise the auto commit will be false (oracledb.autoCommit is not checked)
lobMetaInfo: { //if LOBs are provided, this data structure must be provided in the options object and the bind variables parameter must be an object (not array)
clob_column1: 'clobText1', //map oracle column name to bind variable name
blob_column2: 'blobBuffer2'
}
}, function onResults(error, output) {
//continue flow...
});
```
<a name="Connection+modifyParams"></a>

@@ -229,0 +298,0 @@ ### Connection#modifyParams(argumentsArray) ⇒ <code>object</code> ℗

'use strict';
var asyncLib = require('async');
var rowsReader = require('./rows-reader');

@@ -100,3 +101,3 @@ var resultSetReader = require('./resultset-reader');

* @param {object} options - Any execute options
* @param {object} [options.autoCommit] - If you wish to commit after the update, this property must be set to true in the options (oracledb.autoCommit is not checked)
* @param {object} [options.autoCommit] - If you wish to commit after the insert, this property must be set to true in the options (oracledb.autoCommit is not checked)
* @param {object} [options.lobMetaInfo] - For LOB support this object must hold a mapping between DB column name and bind variable name

@@ -236,2 +237,30 @@ * @param {AsyncCallback} callback - Invoked with an error or the insert results (if LOBs are provided, the callback will be triggered after they have been fully written to the DB)

/**
* This function modifies the existing connection.rollback function by enabling the input
* callback to be an optional parameter.<br>
* If rollback fails, you can't really rollback again the data, so the callback is not always needed.<br>
* Therefore this function allows you to ignore the need to pass a callback and makes it as an optional parameter.
*
* @function
* @memberof! Connection
* @public
* @param {function} [callback] - An optional rollback callback function (see oracledb docs)
* @example
* ```js
* connection.rollback(); //no callback needed
*
* //still possible to call with a rollback callback function
* connection.rollback(function onRollback(error) {
* if (error) {
* //now what?
* }
* });
* ```
*/
Connection.prototype.rollback = function (callback) {
callback = callback || this.noop;
this.baseRollback(callback);
};
/**
* This function will invoke the provided SQL SELECT and return a results object with the returned row count and the JSONs.<br>

@@ -311,2 +340,64 @@ * The json property will hold a single JSON object in case the returned row count is 1, and an array of JSONs in case the row count is higher.<br>

/**
* Enables to run an INSERT SQL statement multiple times for each of the provided bind params.<br>
* This allows to insert to same table multiple different rows with one single call.<br>
* The callback output will be an array of objects of same as oracledb conection.execute (per row).<br>
* All LOBs for all rows will be written to the DB via streams and only after all LOBs are written the callback will be called.<br>
* The function arguments used to execute the 'insert' are exactly as defined in the oracledb connection.execute function, however the options are mandatory and
* the bind params is now an array of bind params (one per row).
*
* @function
* @memberof! Connection
* @public
* @param {string} sql - The SQL to execute
* @param {Array} bindParamsArray - An array of instances of object/Array bind parameters used to specify the values for the columns per row
* @param {object} options - Any execute options
* @param {object} [options.autoCommit] - If you wish to commit after the update, this property must be set to true in the options (oracledb.autoCommit is not checked)
* @param {object} [options.lobMetaInfo] - For LOB support this object must hold a mapping between DB column name and bind variable name
* @param {AsyncCallback} callback - Invoked with an error or the insert results (if LOBs are provided, the callback will be triggered after they have been fully written to the DB)
* @example
* ```js
* connection.batchInsert('INSERT INTO mylobs (id, clob_column1, blob_column2) VALUES (:id, EMPTY_CLOB(), EMPTY_BLOB())', [ //no need to specify the RETURNING clause in the SQL
* { //first row values
* id: 110,
* clobText1: 'some long clob string', //add bind variable with LOB column name and text content (need to map that name in the options)
* blobBuffer2: new Buffer('some blob content, can be binary...') //add bind variable with LOB column name and text content (need to map that name in the options)
* },
* { //second row values
* id: 111,
* clobText1: 'second row',
* blobBuffer2: new Buffer('second rows')
* }
* ], {
* autoCommit: true, //must be set to true in options to support auto commit after insert is done, otherwise the auto commit will be false (oracledb.autoCommit is not checked)
* lobMetaInfo: { //if LOBs are provided, this data structure must be provided in the options object and the bind variables parameter must be an object (not array)
* clob_column1: 'clobText1', //map oracle column name to bind variable name
* blob_column2: 'blobBuffer2'
* }
* }, function onResults(error, output) {
* //continue flow...
* });
* ```
*/
Connection.prototype.batchInsert = function (sql, bindParamsArray, options, callback) {
var self = this;
//auto commit should wrap all commands
var commit = options.autoCommit;
options.autoCommit = false;
//create tasks
var tasks = [];
bindParamsArray.forEach(function createTask(bindParams) {
tasks.push(function executeTask(asyncCallback) {
self.insert(sql, bindParams, options, asyncCallback);
});
});
asyncLib.parallel(tasks, function onBatchDone(error, results) {
var batchCallback = self.createCallback(callback, commit, results);
batchCallback(error);
});
};
/**
* Internal function used to modify the INSERT/UPDATE SQL arguments.<br>

@@ -412,3 +503,9 @@ * This function will add the RETURNING clause to the SQL to support LOBs modification after the INSERT/UPDATE finished.<br>

if (error) {
callback(error);
if (commit) {
self.rollback(function onRollback() {
callback(error);
});
} else {
callback(error);
}
} else if (commit) {

@@ -415,0 +512,0 @@ self.commit(function onCommit(commitError) {

4

package.json
{
"name": "simple-oracledb",
"version": "0.0.15",
"version": "0.0.16",
"description": "Extend capabilities of oracledb with simplified API for quicker development.",

@@ -43,3 +43,3 @@ "author": {

"grunt": "latest",
"grunt-blanket": "latest",
"grunt-blanket": "0.0.9",
"grunt-cli": "latest",

@@ -46,0 +46,0 @@ "grunt-contrib-clean": "latest",

@@ -15,3 +15,5 @@ # simple-oracledb

* [queryJSON](#usage-queryJSON)
* [batchInsert](#usage-batchInsert)
* [release](#usage-release)
* [rollback](#usage-rollback)
* [terminate](#usage-terminate)

@@ -187,2 +189,34 @@ * [Installation](#installation)

<a name="usage-batchInsert"></a>
## 'connection.batchInsert(sql, bindVariablesArray, options, callback)'
Enables to run an INSERT SQL statement multiple times for each of the provided bind params.<br>
This allows to insert to same table multiple different rows with one single call.<br>
The callback output will be an array of objects of same as oracledb conection.execute (per row).<br>
All LOBs for all rows will be written to the DB via streams and only after all LOBs are written the callback will be called.<br>
The function arguments used to execute the 'insert' are exactly as defined in the oracledb connection.execute function, however the options are mandatory and
the bind params is now an array of bind params (one per row).
```js
connection.batchInsert('INSERT INTO mylobs (id, clob_column1, blob_column2) VALUES (:id, EMPTY_CLOB(), EMPTY_BLOB())', [ //no need to specify the RETURNING clause in the SQL
{ //first row values
id: 110,
clobText1: 'some long clob string', //add bind variable with LOB column name and text content (need to map that name in the options)
blobBuffer2: new Buffer('some blob content, can be binary...') //add bind variable with LOB column name and text content (need to map that name in the options)
},
{ //second row values
id: 111,
clobText1: 'second row',
blobBuffer2: new Buffer('second rows')
}
], {
autoCommit: true, //must be set to true in options to support auto commit after insert is done, otherwise the auto commit will be false (oracledb.autoCommit is not checked)
lobMetaInfo: { //if LOBs are provided, this data structure must be provided in the options object and the bind variables parameter must be an object (not array)
clob_column1: 'clobText1', //map oracle column name to bind variable name
blob_column2: 'blobBuffer2'
}
}, function onResults(error, output) {
//continue flow...
});
```
<a name="usage-release"></a>

@@ -205,2 +239,20 @@ ## 'connection.release([callback])'

<a name="usage-rollback"></a>
## 'connection.rollback([callback])'
This function modifies the existing connection.rollback function by enabling the input
callback to be an optional parameter.<br>
If rollback fails, you can't really rollback again the data, so the callback is not always needed.<br>
Therefore this function allows you to ignore the need to pass a callback and makes it as an optional parameter.
```js
connection.rollback(); //no callback needed
//still possible to call with a rollback callback function
connection.rollback(function onRollback(error) {
if (error) {
//now what?
}
});
```
<a name="usage-terminate"></a>

@@ -253,2 +305,3 @@ ## 'pool.terminate([callback])'

| ----------- | ------- | ----------- |
| 2015-11-15 | v0.0.16 | Added connection.batchInsert and connection.rollback |
| 2015-11-05 | v0.0.15 | Maintenance |

@@ -255,0 +308,0 @@ | 2015-10-20 | v0.0.10 | Added connection.queryJSON |

@@ -712,3 +712,75 @@ 'use strict';

});
describe('batchInsert', function () {
it('batchInsert - LOB data', function (done) {
var table = 'TEST_ORA_BTCH_INST1';
var longClobText = 'this is a really long line of test data\n';
var index;
var buffer = [];
for (index = 0; index < 1000; index++) {
buffer.push(longClobText);
}
longClobText = buffer.join('');
initDB(table, [], function (pool) {
pool.getConnection(function (err, connection) {
assert.isUndefined(err);
connection.batchInsert('INSERT INTO ' + table + ' (COL1, COL2, LOB1, LOB2) values (:value1, :value2, EMPTY_CLOB(), EMPTY_BLOB())', [
{
value1: 'test',
value2: 123,
clob1: longClobText,
blob2: new Buffer('blob text here')
},
{
value1: 'test2',
value2: 455,
clob1: longClobText,
blob2: new Buffer('second row')
}
], {
autoCommit: true,
lobMetaInfo: {
LOB1: 'clob1',
LOB2: 'blob2'
}
}, function (error, results) {
assert.isNull(error);
assert.equal(2, results.length);
assert.equal(1, results[0].rowsAffected);
assert.equal(1, results[1].rowsAffected);
connection.query('SELECT * FROM ' + table + ' ORDER BY COL1 ASC', [], {
resultSet: false
}, function (queryError, jsRows) {
assert.isNull(queryError);
assert.deepEqual([
{
COL1: 'test',
COL2: 123,
COL3: undefined,
COL4: undefined,
LOB1: longClobText,
LOB2: new Buffer('blob text here')
},
{
COL1: 'test2',
COL2: 455,
COL3: undefined,
COL4: undefined,
LOB1: longClobText,
LOB2: new Buffer('second row')
}
], jsRows);
end(done, connection);
});
});
});
});
});
});
}
});

@@ -888,2 +888,36 @@ 'use strict';

describe('rollback', function () {
it('callback provided', function (done) {
var connection = {
rollback: function (cb) {
assert.isFunction(cb);
cb();
done();
}
};
Connection.extend(connection);
assert.isFunction(connection.baseRollback);
connection.rollback(function () {
return undefined;
});
});
it('callback undefined', function (done) {
var connection = {
rollback: function (cb) {
assert.isFunction(cb);
cb();
done();
}
};
Connection.extend(connection);
assert.isFunction(connection.baseRollback);
connection.rollback();
});
});
describe('queryJSON', function () {

@@ -1151,2 +1185,456 @@ it('error in query', function () {

});
describe('batchInsert', function () {
it('no lobs', function (done) {
var connection = {};
Connection.extend(connection);
var vars = [
{
id1: 1,
id2: 2
},
{
id1: 3,
id2: 4
}
];
var counter = 0;
connection.execute = function (sql, bindVars, options, callback) {
assert.equal(sql, 'INSERT INTO nolobs (id, id2) VALUES (:id1, :id2)');
assert.deepEqual(bindVars, vars[counter]);
counter++;
assert.deepEqual(options, {
lobMetaInfo: {},
autoCommit: false
});
callback(null, {
rowsAffected: 1,
outBinds: {}
});
};
connection.batchInsert('INSERT INTO nolobs (id, id2) VALUES (:id1, :id2)', [
{
id1: 1,
id2: 2
},
{
id1: 3,
id2: 4
}
], {
lobMetaInfo: {}
}, function (error, results) {
assert.isNull(error);
assert.deepEqual([
{
outBinds: {},
rowsAffected: 1
},
{
outBinds: {},
rowsAffected: 1
}
], results);
assert.equal(counter, 2);
done();
});
});
it('multiple lobs', function (done) {
var connection = {};
Connection.extend(connection);
var commitCalled = false;
connection.commit = function (callback) {
commitCalled = true;
callback();
};
var lobsWritten = 0;
var vars = [
{
id: 1,
lob1: {
type: constants.clobType,
dir: constants.bindOut
},
lob2: {
type: constants.clobType,
dir: constants.bindOut
},
lob3: {
type: constants.blobType,
dir: constants.bindOut
}
},
{
id: 2,
lob1: {
type: constants.clobType,
dir: constants.bindOut
},
lob2: {
type: constants.clobType,
dir: constants.bindOut
},
lob3: {
type: constants.blobType,
dir: constants.bindOut
}
}
];
var counter = 0;
connection.execute = function (sql, bindVars, options, callback) {
assert.equal(sql, 'INSERT INTO mylobs (id, c1, c2, b) VALUES (:id, EMPTY_CLOB(), EMPTY_CLOB(), EMPTY_CLOB()) RETURNING c1, c2, b INTO :lob1, :lob2, :lob3');
assert.deepEqual(bindVars, vars[counter]);
counter++;
assert.deepEqual(options, {
autoCommit: false,
lobMetaInfo: {
c1: 'lob1',
c2: 'lob2',
b: 'lob3'
}
});
var lob1 = helper.createCLOB();
lob1.testData = 'clob text';
lob1.once('end', function () {
lobsWritten++;
});
var lob2 = helper.createCLOB();
lob2.testData = 'second clob text';
lob2.once('end', function () {
lobsWritten++;
});
var lob3 = helper.createBLOB();
lob3.testData = 'binary data';
lob3.once('end', function () {
lobsWritten++;
});
callback(null, {
rowsAffected: 1,
outBinds: {
lob1: [lob1],
lob2: [lob2],
lob3: [lob3]
}
});
};
connection.batchInsert('INSERT INTO mylobs (id, c1, c2, b) VALUES (:id, EMPTY_CLOB(), EMPTY_CLOB(), EMPTY_CLOB())', [
{
id: 1,
lob1: 'clob text',
lob2: 'second clob text',
lob3: new Buffer('binary data')
},
{
id: 2,
lob1: 'clob text',
lob2: 'second clob text',
lob3: new Buffer('binary data')
}
], {
autoCommit: true,
lobMetaInfo: {
c1: 'lob1',
c2: 'lob2',
b: 'lob3'
}
}, function (error, results) {
assert.isNull(error);
assert.equal(counter, 2);
assert.equal(lobsWritten, 6);
assert.isTrue(commitCalled);
done();
});
});
it('error while writing lobs', function (done) {
var rollbackCalled = false;
var connection = {
rollback: function (cb) {
rollbackCalled = true;
cb();
}
};
Connection.extend(connection);
var vars = [
{
id: 1,
lob1: {
type: constants.clobType,
dir: constants.bindOut
},
lob2: {
type: constants.clobType,
dir: constants.bindOut
},
lob3: {
type: constants.blobType,
dir: constants.bindOut
}
},
{
id: 2,
lob1: {
type: constants.clobType,
dir: constants.bindOut
},
lob2: {
type: constants.clobType,
dir: constants.bindOut
},
lob3: {
type: constants.blobType,
dir: constants.bindOut
}
}
];
var counter = 0;
connection.execute = function (sql, bindVars, options, callback) {
assert.equal(sql, 'INSERT INTO mylobs (id, c1, c2, b) VALUES (:id, EMPTY_CLOB(), EMPTY_CLOB(), EMPTY_CLOB()) RETURNING c1, c2, b INTO :lob1, :lob2, :lob3');
assert.deepEqual(bindVars, vars[counter]);
counter++;
assert.deepEqual(options, {
autoCommit: false,
lobMetaInfo: {
c1: 'lob1',
c2: 'lob2',
b: 'lob3'
}
});
var lob1 = helper.createCLOB();
lob1.testData = 'clob text';
var lob2 = helper.createCLOB();
lob2.testData = 'second clob text';
lob2.end = function () {
var cb = Array.prototype.pop.call(arguments);
lob2.emit('error', new Error('lob test error'));
setTimeout(cb, 10);
};
var lob3 = helper.createBLOB();
lob3.testData = 'binary data';
callback(null, {
rowsAffected: 1,
outBinds: {
lob1: [lob1],
lob2: [lob2],
lob3: [lob3]
}
});
};
connection.batchInsert('INSERT INTO mylobs (id, c1, c2, b) VALUES (:id, EMPTY_CLOB(), EMPTY_CLOB(), EMPTY_CLOB())', [
{
id: 1,
lob1: 'clob text',
lob2: 'second clob text',
lob3: new Buffer('binary data')
},
{
id: 2,
lob1: 'clob text',
lob2: 'second clob text',
lob3: new Buffer('binary data')
}
], {
autoCommit: true,
lobMetaInfo: {
c1: 'lob1',
c2: 'lob2',
b: 'lob3'
}
}, function (error, results) {
assert.isDefined(error);
assert.equal(error.message, 'lob test error');
assert.isUndefined(results);
assert.isTrue(rollbackCalled);
done();
});
});
it('error on execute', function (done) {
var rollbackCalled = false;
var connection = {
rollback: function (cb) {
rollbackCalled = true;
cb();
}
};
Connection.extend(connection);
var vars = [
{
id: 1,
lob1: {
type: constants.clobType,
dir: constants.bindOut
},
lob2: {
type: constants.clobType,
dir: constants.bindOut
},
lob3: {
type: constants.blobType,
dir: constants.bindOut
}
},
{
id: 2,
lob1: {
type: constants.clobType,
dir: constants.bindOut
},
lob2: {
type: constants.clobType,
dir: constants.bindOut
},
lob3: {
type: constants.blobType,
dir: constants.bindOut
}
}
];
var counter = 0;
connection.execute = function (sql, bindVars, options, callback) {
assert.equal(sql, 'INSERT INTO mylobs (id, c1, c2, b) VALUES (:id, EMPTY_CLOB(), EMPTY_CLOB(), EMPTY_CLOB()) RETURNING c1, c2, b INTO :lob1, :lob2, :lob3');
assert.deepEqual(bindVars, vars[counter]);
counter++;
assert.deepEqual(options, {
autoCommit: false,
lobMetaInfo: {
c1: 'lob1',
c2: 'lob2',
b: 'lob3'
}
});
if (counter < 2) {
callback(null, {
rowsAffected: 1,
outBinds: {}
});
} else {
callback(new Error('execute error test'));
}
};
connection.batchInsert('INSERT INTO mylobs (id, c1, c2, b) VALUES (:id, EMPTY_CLOB(), EMPTY_CLOB(), EMPTY_CLOB())', [
{
id: 1,
lob1: 'clob text',
lob2: 'second clob text',
lob3: new Buffer('binary data')
},
{
id: 2,
lob1: 'clob text',
lob2: 'second clob text',
lob3: new Buffer('binary data')
}
], {
autoCommit: true,
lobMetaInfo: {
c1: 'lob1',
c2: 'lob2',
b: 'lob3'
}
}, function (error, results) {
assert.isDefined(error);
assert.equal(error.message, 'execute error test');
assert.isUndefined(results);
assert.isTrue(rollbackCalled);
done();
});
});
it('error on commit', function (done) {
var connection = {};
Connection.extend(connection);
connection.commit = function (callback) {
callback(new Error('commit error'));
};
var lobsWritten = 0;
connection.execute = function (sql, bindVars, options, callback) {
assert.equal(sql, 'INSERT INTO mylobs (id, c1, c2, b) VALUES (:id, EMPTY_CLOB(), EMPTY_CLOB(), EMPTY_CLOB()) RETURNING c1, c2, b INTO :lob1, :lob2, :lob3');
assert.deepEqual(options, {
autoCommit: false,
lobMetaInfo: {
c1: 'lob1',
c2: 'lob2',
b: 'lob3'
}
});
var lob1 = helper.createCLOB();
lob1.testData = 'clob text';
lob1.once('end', function () {
lobsWritten++;
});
var lob2 = helper.createCLOB();
lob2.testData = 'second clob text';
lob2.once('end', function () {
lobsWritten++;
});
var lob3 = helper.createBLOB();
lob3.testData = 'binary data';
lob3.once('end', function () {
lobsWritten++;
});
callback(null, {
rowsAffected: 1,
outBinds: {
lob1: [lob1],
lob2: [lob2],
lob3: [lob3]
}
});
};
connection.batchInsert('INSERT INTO mylobs (id, c1, c2, b) VALUES (:id, EMPTY_CLOB(), EMPTY_CLOB(), EMPTY_CLOB())', [
{
id: 1,
lob1: 'clob text',
lob2: 'second clob text',
lob3: new Buffer('binary data')
},
{
id: 2,
lob1: 'clob text',
lob2: 'second clob text',
lob3: new Buffer('binary data')
}
], {
autoCommit: true,
lobMetaInfo: {
c1: 'lob1',
c2: 'lob2',
b: 'lob3'
}
}, function (error) {
assert.isDefined(error);
assert.equal(error.message, 'commit error');
assert.equal(lobsWritten, 6);
done();
});
});
});
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc