Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

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.1.8 to 0.1.9

44

docs/api.md

@@ -64,3 +64,4 @@ ## Classes

* [#modifyParams(argumentsArray)](#Connection+modifyParams) ⇒ <code>object</code> ℗
* [#createCallback(callback, commit, [output])](#Connection+createCallback) ⇒ <code>function</code> ℗
* [#createQueryCallback(callback, [options], handleType, [stream])](#Connection+createQueryCallback) ⇒ <code>function</code> ℗
* [#createModifyCallback(callback, commit, [output])](#Connection+createModifyCallback) ⇒ <code>function</code> ℗
* _static_

@@ -159,3 +160,3 @@ * [.wrapOnConnection(callback)](#Connection.wrapOnConnection) ⇒ <code>function</code>

Provides simpler interface than the original oracledb connection.execute function to enable simple insert invocation with LOB support.<br>
The callback output will be the same as oracledb conection.execute.<br>
The callback output will be the same as oracledb connection.execute.<br>
All LOBs will be written to the DB via streams and only after all LOBs are written the callback will be called.<br>

@@ -194,3 +195,3 @@ The function arguments used to execute the 'insert' are exactly as defined in the oracledb connection.execute function, however the options are mandatory.

Provides simpler interface than the original oracledb connection.execute function to enable simple update invocation with LOB support.<br>
The callback output will be the same as oracledb conection.execute.<br>
The callback output will be the same as oracledb connection.execute.<br>
All LOBs will be written to the DB via streams and only after all LOBs are written the callback will be called.<br>

@@ -335,3 +336,3 @@ The function arguments used to execute the 'update' are exactly as defined in the oracledb connection.execute function, however the options are mandatory.

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>
The callback output will be an array of objects of same as oracledb connection.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>

@@ -379,3 +380,3 @@ The function arguments used to execute the 'insert' are exactly as defined in the oracledb connection.execute function, however the options are mandatory and

This allows to update 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>
The callback output will be an array of objects of same as oracledb connection.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>

@@ -489,4 +490,4 @@ The function arguments used to execute the 'update' are exactly as defined in the oracledb connection.execute function, however the options are mandatory and

<a name="Connection+createCallback"></a>
### Connection#createCallback(callback, commit, [output]) ⇒ <code>function</code> ℗
<a name="Connection+createQueryCallback"></a>
### Connection#createQueryCallback(callback, [options], handleType, [stream]) ⇒ <code>function</code> ℗
Internal function used to wrap the original callback.

@@ -500,2 +501,16 @@

| callback | <code>function</code> | The callback function to invoke |
| [options] | <code>object</code> | Optional execute options |
| handleType | <code>number</code> | 1 to split results, 2 to stream results, else default behaviour |
| [stream] | <code>[ResultSetReadStream](#ResultSetReadStream)</code> | The stream to read the results from (if streamResults=true in options) |
<a name="Connection+createModifyCallback"></a>
### Connection#createModifyCallback(callback, commit, [output]) ⇒ <code>function</code> ℗
Internal function used to wrap the original callback.
**Returns**: <code>function</code> - A wrapper callback
**Access:** private
| Param | Type | Description |
| --- | --- | --- |
| callback | <code>function</code> | The callback function to invoke |
| commit | <code>boolean</code> | True to run commit |

@@ -725,5 +740,6 @@ | [output] | <code>object</code> | Optional output to pass to the callback |

* [new ResultSetReadStream()](#new_ResultSetReadStream_new)
* [.nextRow(streamCallback)](#ResultSetReadStream.nextRow(2)) ℗
* [.nextRow.set(nextRow)](#ResultSetReadStream.nextRow.set) ℗
* [#_read()](#ResultSetReadStream+_read) ℗
* [.nextRow(streamCallback)](#ResultSetReadStream.nextRow) ℗
* [.nextRow(streamCallback)](#ResultSetReadStream.nextRow(1)) ℗

@@ -734,2 +750,12 @@ <a name="new_ResultSetReadStream_new"></a>

<a name="ResultSetReadStream.nextRow(2)"></a>
### ResultSetReadStream.nextRow(streamCallback) ℗
Pushes error event to the stream.
**Access:** private
| Param | Type | Description |
| --- | --- | --- |
| streamCallback | <code>function</code> | The callback function |
<a name="ResultSetReadStream.nextRow.set"></a>

@@ -750,3 +776,3 @@ ### ResultSetReadStream.nextRow.set(nextRow) ℗

**Access:** private
<a name="ResultSetReadStream.nextRow"></a>
<a name="ResultSetReadStream.nextRow(1)"></a>
### ResultSetReadStream.nextRow(streamCallback) ℗

@@ -753,0 +779,0 @@ Reads the next rows from the resultset and pushes via events.

@@ -135,21 +135,21 @@ 'use strict';

var options = argumentsArray[argumentsArray.length - 1];
var splitResults = false;
var streamResults = false;
var noCallback = false;
var handleType = 0;
var output;
if (typeof options === 'object') {
splitResults = options.splitResults;
streamResults = options.streamResults || options.stream; //support also the oracledb stream option
if (options.splitResults) {
handleType = 1;
} else if (options.streamResults || options.stream) { //support also the oracledb stream option
handleType = 2;
//use simple-oracledb streaming instead of oracledb stream capability (which is actually based on this project)
delete options.stream;
//use simple-oracledb streaming instead of oracledb stream capability (which is actually based on this project)
delete options.stream;
if (splitResults || streamResults) {
output = new ResultSetReadStream();
}
if (handleType) {
options.resultSet = true;
if (!callback) {
if (streamResults) {
noCallback = true;
} else {
throw new Error('Missing callback');
}
if ((!output) && (!callback)) {
throw new Error('Missing callback');
}

@@ -159,33 +159,4 @@ }

var output;
if (streamResults) {
output = new ResultSetReadStream();
}
argumentsArray.push(self.createQueryCallback(callback, options, handleType, output));
argumentsArray.push(function onExecute(error, results) {
if (error || (!results)) {
if (noCallback) {
output.nextRow = function emitError(streamCallback) {
streamCallback(error || new Error('No Results'));
};
} else {
callback(error, results);
}
} else if (results.resultSet) {
if (splitResults) {
resultSetReader.readBulks(results.metaData, results.resultSet, options, callback);
} else if (streamResults) {
resultSetReader.stream(results.metaData, results.resultSet, output);
if (callback) {
callback(null, output);
}
} else {
resultSetReader.readFully(results.metaData, results.resultSet, options, callback);
}
} else {
rowsReader.read(results.metaData, results.rows, callback);
}
});
self.execute.apply(self, argumentsArray);

@@ -198,3 +169,3 @@

* Provides simpler interface than the original oracledb connection.execute function to enable simple insert invocation with LOB support.<br>
* The callback output will be the same as oracledb conection.execute.<br>
* The callback output will be the same as oracledb connection.execute.<br>
* All LOBs will be written to the DB via streams and only after all LOBs are written the callback will be called.<br>

@@ -236,3 +207,3 @@ * The function arguments used to execute the 'insert' are exactly as defined in the oracledb connection.execute function, however the options are mandatory.

* Provides simpler interface than the original oracledb connection.execute function to enable simple update invocation with LOB support.<br>
* The callback output will be the same as oracledb conection.execute.<br>
* The callback output will be the same as oracledb connection.execute.<br>
* All LOBs will be written to the DB via streams and only after all LOBs are written the callback will be called.<br>

@@ -292,3 +263,3 @@ * The function arguments used to execute the 'update' are exactly as defined in the oracledb connection.execute function, however the options are mandatory.

argumentsArray.push(function onExecute(error, results) {
var wrapper = self.createCallback(callback, autoCommit, results);
var wrapper = self.createModifyCallback(callback, autoCommit, results);

@@ -465,3 +436,3 @@ if ((!error) && results && lobColumns && lobColumns.length) {

* 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>
* The callback output will be an array of objects of same as oracledb connection.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>

@@ -511,3 +482,3 @@ * The function arguments used to execute the 'insert' are exactly as defined in the oracledb connection.execute function, however the options are mandatory and

* This allows to update 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>
* The callback output will be an array of objects of same as oracledb connection.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>

@@ -593,3 +564,3 @@ * The function arguments used to execute the 'update' are exactly as defined in the oracledb connection.execute function, however the options are mandatory and

asyncLib.parallel(tasks, function onBatchDone(error, results) {
var batchCallback = self.createCallback(callback, commit, results);
var batchCallback = self.createModifyCallback(callback, commit, results);
batchCallback(error);

@@ -652,3 +623,3 @@ });

asyncLib.parallel(actions, function onTransactionEnd(error, results) {
var transactionCallback = self.createCallback(callback, true, results);
var transactionCallback = self.createModifyCallback(callback, true, results);

@@ -754,2 +725,55 @@ self.inTransaction = false;

* @param {function} callback - The callback function to invoke
* @param {object} [options] - Optional execute options
* @param {number} handleType - 1 to split results, 2 to stream results, else default behaviour
* @param {ResultSetReadStream} [stream] - The stream to read the results from (if streamResults=true in options)
* @returns {function} A wrapper callback
*/
Connection.prototype.createQueryCallback = function (callback, options, handleType, stream) {
return function onCallback(error, results) {
if (error || (!results)) {
if (callback) {
callback(error, results);
} else {
/**
* Pushes error event to the stream.
*
* @function
* @memberof! ResultSetReadStream
* @alias ResultSetReadStream.nextRow
* @variation 2
* @private
* @param {function} streamCallback - The callback function
*/
stream.nextRow = function emitError(streamCallback) {
streamCallback(error || new Error('No Results'));
};
}
} else if (results.resultSet) {
switch (handleType) {
case 1: //options.splitResults
resultSetReader.readBulks(results.metaData, results.resultSet, options, callback);
break;
case 2: //options.streamResults
resultSetReader.stream(results.metaData, results.resultSet, stream);
if (callback) {
callback(null, stream);
}
break;
default:
resultSetReader.readFully(results.metaData, results.resultSet, options, callback);
}
} else {
rowsReader.read(results.metaData, results.rows, callback);
}
};
};
/**
* Internal function used to wrap the original callback.
*
* @function
* @memberof! Connection
* @private
* @param {function} callback - The callback function to invoke
* @param {boolean} commit - True to run commit

@@ -759,3 +783,3 @@ * @param {object} [output] - Optional output to pass to the callback

*/
Connection.prototype.createCallback = function (callback, commit, output) {
Connection.prototype.createModifyCallback = function (callback, commit, output) {
var self = this;

@@ -762,0 +786,0 @@

@@ -142,2 +142,3 @@ 'use strict';

* @alias ResultSetReadStream.nextRow
* @variation 1
* @private

@@ -144,0 +145,0 @@ * @param {function} streamCallback - The callback function

{
"name": "simple-oracledb",
"version": "0.1.8",
"version": "0.1.9",
"description": "Extend capabilities of oracledb with simplified API for quicker development.",

@@ -5,0 +5,0 @@ "author": {

@@ -226,3 +226,3 @@ # simple-oracledb

Provides simpler interface than the original oracledb connection.execute function to enable simple insert invocation with LOB support.<br>
The callback output will be the same as oracledb conection.execute.<br>
The callback output will be the same as oracledb connection.execute.<br>
All LOBs will be written to the DB via streams and only after all LOBs are written the callback will be called.<br>

@@ -250,3 +250,3 @@ The function arguments used to execute the 'insert' are exactly as defined in the oracledb connection.execute function, however the options are mandatory.

Provides simpler interface than the original oracledb connection.execute function to enable simple update invocation with LOB support.<br>
The callback output will be the same as oracledb conection.execute.<br>
The callback output will be the same as oracledb connection.execute.<br>
All LOBs will be written to the DB via streams and only after all LOBs are written the callback will be called.<br>

@@ -301,3 +301,3 @@ The function arguments used to execute the 'update' are exactly as defined in the oracledb connection.execute function, however the options are mandatory.

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>
The callback output will be an array of objects of same as oracledb connection.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>

@@ -334,3 +334,3 @@ The function arguments used to execute the 'insert' are exactly as defined in the oracledb connection.execute function, however the options are mandatory and

This allows to update 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>
The callback output will be an array of objects of same as oracledb connection.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>

@@ -463,2 +463,3 @@ The function arguments used to execute the 'update' are exactly as defined in the oracledb connection.execute function, however the options are mandatory and

| ----------- | ------- | ----------- |
| 2016-01-12 | v0.1.9 | Maintenance |
| 2016-01-12 | v0.1.8 | Avoid issues with oracledb stream option which is based on this library |

@@ -465,0 +466,0 @@ | 2016-01-07 | v0.1.7 | connection.query with streamResults=true returns a readable stream |

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