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 1.1.40 to 1.1.41

test/helpers/test.sql

27

docs/api.md

@@ -51,2 +51,3 @@ ## Classes

* [#transaction(actions, [options], [callback])](#Connection+transaction) ⇒ <code>Promise</code>
* [#executeFile(file, [options], [callback])](#Connection+executeFile) ⇒ <code>Promise</code>
* _instance_

@@ -678,2 +679,28 @@ * ["release"](#Connection+event_release)

```
<a name="Connection+executeFile"></a>
### Connection#executeFile(file, [options], [callback]) ⇒ <code>Promise</code>
Reads the sql string from the provided file and executes it.<br>
The file content must be a single valid SQL command string.<br>
This function is basically a quick helper to reduce the coding needed to read the sql file.
**Returns**: <code>Promise</code> - In case of no callback provided in input, this function will return a promise
**Access:** public
| Param | Type | Description |
| --- | --- | --- |
| file | <code>string</code> | The file which contains the sql command |
| [options] | <code>object</code> | Optional execute options |
| [callback] | <code>[AsyncCallback](#AsyncCallback)</code> | Callback function with the execution results |
**Example**
```js
connection.executeFile('./populate_table.sql', function onResults(error, results) {
if (error) {
//handle error...
} else {
//continue
}
});
```
<a name="Connection+event_release"></a>

@@ -680,0 +707,0 @@

1

docs/CHANGELOG.md
| Date | Version | Description |
| ----------- | ------- | ----------- |
| 2016-11-15 | v1.1.41 | Added connection.executeFile to read SQL statement from file and execute it |
| 2016-11-05 | v1.1.40 | Maintenance |

@@ -4,0 +5,0 @@ | 2016-10-07 | v1.1.26 | Added oracledb.run |

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

'Connection+run': 'Connection+run',
'Connection+executeFile': 'Connection+executeFile',
'Connection+release': {

@@ -36,0 +37,0 @@ tag: 'Connection+release',

'use strict';
var fs = require('fs');
var debug = require('debuglog')('simple-oracledb');

@@ -1154,2 +1155,88 @@ var asyncLib = require('async');

/*eslint-disable valid-jsdoc*/
//jscs:disable jsDoc
/**
* Reads the sql string from the provided file and executes it.<br>
* The file content must be a single valid SQL command string.<br>
* This function is basically a quick helper to reduce the coding needed to read the sql file.
*
* @function
* @memberof! Connection
* @public
* @param {string} file - The file which contains the sql command
* @param {object} [options] - Optional execute options
* @param {AsyncCallback} [callback] - Callback function with the execution results
* @returns {Promise} In case of no callback provided in input, this function will return a promise
* @example
* ```js
* connection.executeFile('./populate_table.sql', function onResults(error, results) {
* if (error) {
* //handle error...
* } else {
* //continue
* }
* });
* ```
*/
Connection.prototype.executeFile = function (file, options, callback) {
var self = this;
var input = self.getExecuteArguments(file, [], options, callback);
file = input.sql;
options = input.options;
callback = input.callback;
if (typeof file === 'function') {
callback = file;
file = null;
}
if (file) {
self.readFile(file, function onRead(readError, sql) {
if (readError) {
callback(readError);
} else {
sql = sql.trim();
self.execute(sql, [], options, callback);
}
});
} else {
callback(new Error('SQL file not provided.'));
}
};
//jscs:enable jsDoc
/*eslint-enable valid-jsdoc*/
//add promise support
Connection.prototype.executeFile = promiseHelper.promisify(Connection.prototype.executeFile, {
force: true
});
/**
* Reads and returns the requested text file content.
*
* @function
* @memberof! Connection
* @private
* @param {string} file - The file to read
* @param {AsyncCallback} [callback] - Callback function with the file content
* @example
* ```js
* connection.readFile('./populate_table.sql', function onRead(error, text) {
* if (error) {
* //handle error...
* } else {
* //continue
* }
* });
* ```
*/
Connection.prototype.readFile = function (file, callback) {
fs.readFile(file, {
encoding: 'utf8'
}, callback);
};
/*jshint -W074*/

@@ -1156,0 +1243,0 @@ /**

2

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

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

@@ -36,2 +36,3 @@ # {"gitdown": "gitinfo", "name": "name"}

* [run](#Connection+run)
* [executeFile](#Connection+executeFile)
* [release](#Connection+release)

@@ -235,2 +236,4 @@ * [close](#Connection+release)

<a name="Connection+executeFile"></a>
<a name="Connection+release"></a>

@@ -237,0 +240,0 @@ ### 'connection.release([options], [callback]) ⇒ [Promise]'

@@ -36,2 +36,3 @@ # simple-oracledb

* [run](#Connection+run)
* [executeFile](#Connection+executeFile)
* [release](#Connection+release)

@@ -723,2 +724,21 @@ * [close](#Connection+release)

<a name="Connection+executeFile"></a>
<!-- markdownlint-disable MD009 MD031 MD036 -->
### 'connection.executeFile(file, [options], [callback]) ⇒ [Promise]'
Reads the sql string from the provided file and executes it.<br>
The file content must be a single valid SQL command string.<br>
This function is basically a quick helper to reduce the coding needed to read the sql file.
**Example**
```js
connection.executeFile('./populate_table.sql', function onResults(error, results) {
if (error) {
//handle error...
} else {
//continue
}
});
```
<!-- markdownlint-enable MD009 MD031 MD036 -->
<a name="Connection+release"></a>

@@ -918,2 +938,3 @@ ### 'connection.release([options], [callback]) ⇒ [Promise]'

| ----------- | ------- | ----------- |
| 2016-11-15 | v1.1.41 | Added connection.executeFile to read SQL statement from file and execute it |
| 2016-11-05 | v1.1.40 | Maintenance |

@@ -920,0 +941,0 @@ | 2016-10-07 | v1.1.26 | Added oracledb.run |

Sorry, the diff of this file is too big to display

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