Comparing version 9.0.1 to 9.1.0
@@ -30,2 +30,5 @@ "use strict"; | ||
/** | ||
* @private | ||
*/ | ||
const FLAGS = { | ||
@@ -50,2 +53,6 @@ nullable: 1 << 0, | ||
}; | ||
/** | ||
* @private | ||
*/ | ||
const DONE_STATUS = { | ||
@@ -60,5 +67,27 @@ FINAL: 0x00, | ||
}; | ||
/** | ||
* @private | ||
*/ | ||
// A transform that converts rows to packets. | ||
class RowTransform extends _readableStream.Transform { | ||
/** | ||
* @private | ||
*/ | ||
/** | ||
* @private | ||
*/ | ||
/** | ||
* @private | ||
*/ | ||
/** | ||
* @private | ||
*/ | ||
/** | ||
* @private | ||
*/ | ||
constructor(bulkLoad) { | ||
@@ -77,3 +106,7 @@ super({ | ||
} | ||
/** | ||
* @private | ||
*/ | ||
_transform(row, _encoding, callback) { | ||
@@ -115,3 +148,7 @@ if (!this.columnMetadataWritten) { | ||
} | ||
/** | ||
* @private | ||
*/ | ||
_flush(callback) { | ||
@@ -123,4 +160,104 @@ this.push(this.bulkLoad.createDoneToken()); | ||
} | ||
/** | ||
* A BulkLoad instance is used to perform a bulk insert. | ||
* | ||
* Use [[Connection.newBulkLoad]] to create a new instance, and [[Connection.execBulkLoad]] to execute it. | ||
* | ||
* Example of BulkLoad Usages: | ||
* | ||
* ```js | ||
* // optional BulkLoad options | ||
* const options = { keepNulls: true }; | ||
* | ||
* // instantiate - provide the table where you'll be inserting to, options and a callback | ||
* const bulkLoad = connection.newBulkLoad('MyTable', options, (error, rowCount) => { | ||
* console.log('inserted %d rows', rowCount); | ||
* }); | ||
* | ||
* // setup your columns - always indicate whether the column is nullable | ||
* bulkLoad.addColumn('myInt', TYPES.Int, { nullable: false }); | ||
* bulkLoad.addColumn('myString', TYPES.NVarChar, { length: 50, nullable: true }); | ||
* | ||
* // add rows | ||
* bulkLoad.addRow({ myInt: 7, myString: 'hello' }); | ||
* bulkLoad.addRow({ myInt: 23, myString: 'world' }); | ||
* | ||
* // execute | ||
* connection.execBulkLoad(bulkLoad); | ||
* ``` | ||
*/ | ||
class BulkLoad extends _events.EventEmitter { | ||
/** | ||
* @private | ||
*/ | ||
/** | ||
* @private | ||
*/ | ||
/** | ||
* @private | ||
*/ | ||
/** | ||
* @private | ||
*/ | ||
/** | ||
* @private | ||
*/ | ||
/** | ||
* @private | ||
*/ | ||
/** | ||
* @private | ||
*/ | ||
/** | ||
* @private | ||
*/ | ||
/** | ||
* @private | ||
*/ | ||
/** | ||
* @private | ||
*/ | ||
/** | ||
* @private | ||
*/ | ||
/** | ||
* @private | ||
*/ | ||
/** | ||
* @private | ||
*/ | ||
/** | ||
* @private | ||
*/ | ||
/** | ||
* @private | ||
*/ | ||
/** | ||
* @private | ||
*/ | ||
/** | ||
* @private | ||
*/ | ||
/** | ||
* @private | ||
*/ | ||
constructor(table, connectionOptions, { | ||
@@ -154,8 +291,3 @@ checkConstraints = false, | ||
this.table = void 0; | ||
this.connection = void 0; | ||
this.timeout = void 0; | ||
this.rows = void 0; | ||
this.rst = void 0; | ||
this.rowCount = void 0; | ||
this.paused = void 0; | ||
this.options = void 0; | ||
@@ -168,2 +300,6 @@ this.callback = void 0; | ||
this.bulkOptions = void 0; | ||
this.connection = void 0; | ||
this.rows = void 0; | ||
this.rst = void 0; | ||
this.rowCount = void 0; | ||
this.error = undefined; | ||
@@ -188,3 +324,23 @@ this.canceled = false; | ||
} | ||
/** | ||
* Adds a column to the bulk load. | ||
* | ||
* The column definitions should match the table you are trying to insert into. | ||
* Attempting to call addColumn after the first row has been added will throw an exception. | ||
* | ||
* ```js | ||
* bulkLoad.addColumn('MyIntColumn', TYPES.Int, { nullable: false }); | ||
* ``` | ||
* | ||
* @param name The name of the column. | ||
* @param type One of the supported `data types`. | ||
* @param __namedParameters Type [[ColumnOptions]]<p> Additional column type information. At a minimum, `nullable` must be set to true or false. | ||
* @param length For VarChar, NVarChar, VarBinary. Use length as `Infinity` for VarChar(max), NVarChar(max) and VarBinary(max). | ||
* @param nullable Indicates whether the column accepts NULL values. | ||
* @param objName If the name of the column is different from the name of the property found on `rowObj` arguments passed to [[addRow]], then you can use this option to specify the property name. | ||
* @param precision For Numeric, Decimal. | ||
* @param scale For Numeric, Decimal, Time, DateTime2, DateTimeOffset. | ||
*/ | ||
addColumn(name, type, { | ||
@@ -235,3 +391,27 @@ output = false, | ||
} | ||
/** | ||
* Adds a row to the bulk insert. This method accepts arguments in three different formats: | ||
* | ||
* ```js | ||
* bulkLoad.addRow( rowObj ) | ||
* bulkLoad.addRow( columnArray ) | ||
* bulkLoad.addRow( col0, col1, ... colN )` | ||
* ``` | ||
* * `rowObj` | ||
* | ||
* An object of key/value pairs representing column name (or objName) and value. | ||
* | ||
* * `columnArray` | ||
* | ||
* An array representing the values of each column in the same order which they were added to the bulkLoad object. | ||
* | ||
* * `col0, col1, ... colN` | ||
* | ||
* If there are at least two columns, values can be passed as multiple arguments instead of an array. They | ||
* must be in the same order the columns were added in. | ||
* | ||
* @param input | ||
*/ | ||
addRow(...input) { | ||
@@ -257,3 +437,7 @@ this.firstRowWritten = true; | ||
} | ||
/** | ||
* @private | ||
*/ | ||
getOptionsSql() { | ||
@@ -284,3 +468,7 @@ const addOptions = []; | ||
} | ||
/** | ||
* @private | ||
*/ | ||
getBulkInsertSql() { | ||
@@ -303,3 +491,15 @@ let sql = 'insert bulk ' + this.table + '('; | ||
} | ||
/** | ||
* This is simply a helper utility function which returns a `CREATE TABLE SQL` statement based on the columns added to the bulkLoad object. | ||
* This may be particularly handy when you want to insert into a temporary table (a table which starts with `#`). | ||
* | ||
* ```js | ||
* var sql = bulkLoad.getTableCreationSql(); | ||
* ``` | ||
* | ||
* A side note on bulk inserting into temporary tables: if you want to access a local temporary table after executing the bulk load, | ||
* you'll need to use the same connection and execute your requests using [[Connection.execSqlBatch]] instead of [[Connection.execSql]] | ||
*/ | ||
getTableCreationSql() { | ||
@@ -325,3 +525,7 @@ let sql = 'CREATE TABLE ' + this.table + '(\n'; | ||
} | ||
/** | ||
* @private | ||
*/ | ||
getColMetaData() { | ||
@@ -361,7 +565,22 @@ const tBuf = new _writableTrackingBuffer.default(100, null, true); // TokenType | ||
} | ||
/** | ||
* Sets a timeout for this bulk load. | ||
* | ||
* ```js | ||
* bulkLoad.setTimeout(timeout); | ||
* ``` | ||
* | ||
* @param timeout The number of milliseconds before the bulk load is considered failed, or 0 for no timeout. | ||
* When no timeout is set for the bulk load, the [[ConnectionOptions.requestTimeout]] of the Connection is used. | ||
*/ | ||
setTimeout(timeout) { | ||
this.timeout = timeout; | ||
} | ||
/** | ||
* @private | ||
*/ | ||
createDoneToken() { | ||
@@ -382,4 +601,24 @@ // It might be nice to make DoneToken a class if anything needs to create them, but for now, just do it here | ||
return tBuf.data; | ||
} // This method switches the BulkLoad object into streaming mode and returns | ||
// a stream.Writable for streaming rows to the server. | ||
} | ||
/** | ||
* Switches the `BulkLoad` object into streaming mode and returns a | ||
* [writable stream](https://nodejs.org/dist/latest-v10.x/docs/api/stream.html#stream_writable_streams) | ||
* that can be used to send a large amount of rows to the server. | ||
* | ||
* ```js | ||
* const bulkLoad = connection.newBulkLoad(...); | ||
* bulkLoad.addColumn(...); | ||
* | ||
* const rowStream = bulkLoad.getRowStream(); | ||
* | ||
* connection.execBulkLoad(bulkLoad); | ||
* ``` | ||
* | ||
* In streaming mode, [[addRow]] cannot be used. Instead all data rows must be written to the returned stream object. | ||
* The stream implementation uses data flow control to prevent memory overload. [`stream.write()`](https://nodejs.org/dist/latest-v10.x/docs/api/stream.html#stream_writable_write_chunk_encoding_callback) | ||
* returns `false` to indicate that data transfer should be paused. | ||
* | ||
* After that, the stream emits a ['drain' event](https://nodejs.org/dist/latest-v10.x/docs/api/stream.html#stream_event_drain) | ||
* when it is ready to resume data transfer. | ||
*/ | ||
@@ -399,3 +638,7 @@ | ||
} | ||
/** | ||
* @private | ||
*/ | ||
getMessageStream() { | ||
@@ -418,3 +661,7 @@ const message = new _message.default({ | ||
} | ||
/** | ||
* @private | ||
*/ | ||
cancel() { | ||
@@ -421,0 +668,0 @@ if (this.canceled) { |
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports.typeByName = exports.TYPE = void 0; | ||
exports.typeByName = exports.TYPES = exports.TYPE = void 0; | ||
@@ -130,4 +130,310 @@ var _null = _interopRequireDefault(require("./data-types/null")); | ||
}; | ||
/** | ||
* <table> | ||
* <thead> | ||
* <tr> | ||
* <th>Type</th> | ||
* <th>Constant</th> | ||
* <th>JavaScript</th> | ||
* <th>Result set</th> | ||
* <th>Parameter</th> | ||
* </tr> | ||
* </thead> | ||
* | ||
* <tbody> | ||
* <tr class="group-heading"> | ||
* <th colspan="5">Exact numerics</th> | ||
* </tr> | ||
* <tr> | ||
* <td><code>bit</code></td> | ||
* <td><code>[[TYPES.Bit]]</code></td> | ||
* <td><code>boolean</code></td> | ||
* <td>✓</td> | ||
* <td>✓</td> | ||
* </tr> | ||
* <tr> | ||
* <td><code>tinyint</code></td> | ||
* <td><code>[[TYPES.TinyInt]]</code></td> | ||
* <td><code>number</code></td> | ||
* <td>✓</td> | ||
* <td>✓</td> | ||
* </tr> | ||
* <tr> | ||
* <td><code>smallint</code></td> | ||
* <td><code>[[TYPES.SmallInt]]</code></td> | ||
* <td><code>number</code></td> | ||
* <td>✓</td> | ||
* <td>✓</td> | ||
* </tr> | ||
* <tr> | ||
* <td><code>int</code></td> | ||
* <td><code>[[TYPES.Int]]</code></td> | ||
* <td><code>number</code></td> | ||
* <td>✓</td> | ||
* <td>✓</td> | ||
* </tr> | ||
* <tr> | ||
* <td><code>bigint</code><sup>1</sup></td> | ||
* <td><code>[[TYPES.BigInt]]</code></td> | ||
* <td><code>string</code></td> | ||
* <td>✓</td> | ||
* <td>✓</td> | ||
* </tr> | ||
* <tr> | ||
* <td><code>numeric</code><sup>2</sup></td> | ||
* <td><code>[[TYPES.Numeric]]</code></td> | ||
* <td><code>number</code></td> | ||
* <td>✓</td> | ||
* <td>✓</td> | ||
* </tr> | ||
* <tr> | ||
* <td><code>decimal</code><sup>2</sup></td> | ||
* <td><code>[[TYPES.Decimal]]</code></td> | ||
* <td><code>number</code></td> | ||
* <td>✓</td> | ||
* <td>✓</td> | ||
* </tr> | ||
* <tr> | ||
* <td><code>smallmoney</code></td> | ||
* <td><code>[[TYPES.SmallMoney]]</code></td> | ||
* <td><code>number</code></td> | ||
* <td>✓</td> | ||
* <td>✓</td> | ||
* </tr> | ||
* <tr> | ||
* <td><code>money</code></td> | ||
* <td><code>[[TYPES.Money]]</code></td> | ||
* <td><code>number</code></td> | ||
* <td>✓</td> | ||
* <td>✓</td> | ||
* </tr> | ||
* </tbody> | ||
* | ||
* <tbody> | ||
* <tr class="group-heading"> | ||
* <th colspan="5">Approximate numerics</th> | ||
* </tr> | ||
* <tr> | ||
* <td><code>float</code></td> | ||
* <td><code>[[TYPES.Float]]</code></td> | ||
* <td><code>number</code></td> | ||
* <td>✓</td> | ||
* <td>✓</td> | ||
* </tr> | ||
* <tr> | ||
* <td><code>real</code></td> | ||
* <td><code>[[TYPES.Real]]</code></td> | ||
* <td><code>number</code></td> | ||
* <td>✓</td> | ||
* <td>✓</td> | ||
* </tr> | ||
* </tbody> | ||
* | ||
* <tbody> | ||
* <tr class="group-heading"> | ||
* <th colspan="4">Date and Time</th> | ||
* </tr> | ||
* <tr> | ||
* <td><code>smalldatetime</code></td> | ||
* <td><code>[[TYPES.SmallDateTime]]</code></td> | ||
* <td><code>Date</code></td> | ||
* <td>✓</td> | ||
* <td>✓</td> | ||
* </tr> | ||
* <tr> | ||
* <td><code>datetime</code></td> | ||
* <td><code>[[TYPES.DateTime]]</code></td> | ||
* <td><code>Date</code></td> | ||
* <td>✓</td> | ||
* <td>✓</td> | ||
* </tr> | ||
* <tr> | ||
* <td><code>datetime2</code></td> | ||
* <td><code>[[TYPES.DateTime2]]</code></td> | ||
* <td><code>Date</code></td> | ||
* <td>✓</td> | ||
* <td>✓</td> | ||
* </tr> | ||
* <tr> | ||
* <td><code>datetimeoffset</code></td> | ||
* <td><code>[[TYPES.DateTimeOffset]]</code></td> | ||
* <td><code>Date</code></td> | ||
* <td>✓</td> | ||
* <td>✓</td> | ||
* </tr> | ||
* <tr> | ||
* <td><code>time</code></td> | ||
* <td><code>[[TYPES.Time]]</code></td> | ||
* <td><code>Date</code></td> | ||
* <td>✓</td> | ||
* <td>✓</td> | ||
* </tr> | ||
* <tr> | ||
* <td><code>date</code></td> | ||
* <td><code>[[TYPES.Date]]</code></td> | ||
* <td><code>Date</code></td> | ||
* <td>✓</td> | ||
* <td>✓</td> | ||
* </tr> | ||
* </tbody> | ||
* | ||
* <tbody> | ||
* <tr class="group-heading"> | ||
* <th colspan="4">Character Strings</th> | ||
* </tr> | ||
* <tr> | ||
* <td><code>char</code></td> | ||
* <td><code>[[TYPES.Char]]</code></td> | ||
* <td><code>string</code></td> | ||
* <td>✓</td> | ||
* <td>✓</td> | ||
* </tr> | ||
* <tr> | ||
* <td><code>varchar</code><sup>3</sup></td> | ||
* <td><code>[[TYPES.VarChar]]</code></td> | ||
* <td><code>string</code></td> | ||
* <td>✓</td> | ||
* <td>✓</td> | ||
* </tr> | ||
* <tr> | ||
* <td><code>text</code></td> | ||
* <td><code>[[TYPES.Text]]</code></td> | ||
* <td><code>string</code></td> | ||
* <td>✓</td> | ||
* <td>✓</td> | ||
* </tr> | ||
* </tbody> | ||
* | ||
* <tbody> | ||
* <tr class="group-heading"> | ||
* <th colspan="4">Unicode Strings</th> | ||
* </tr> | ||
* <tr> | ||
* <td><code>nchar</code></td> | ||
* <td><code>[[TYPES.NChar]]</code></td> | ||
* <td><code>string</code></td> | ||
* <td>✓</td> | ||
* <td>✓</td> | ||
* </tr> | ||
* <tr> | ||
* <td><code>nvarchar</code><sup>3</sup></td> | ||
* <td><code>[[TYPES.NVarChar]]</code></td> | ||
* <td><code>string</code></td> | ||
* <td>✓</td> | ||
* <td>✓</td> | ||
* </tr> | ||
* <tr> | ||
* <td><code>ntext</code></td> | ||
* <td><code>[[TYPES.NText]]</code></td> | ||
* <td><code>string</code></td> | ||
* <td>✓</td> | ||
* <td>-</td> | ||
* </tr> | ||
* </tbody> | ||
* | ||
* <tbody> | ||
* <tr class="group-heading"> | ||
* <th colspan="5">Binary Strings<sup>4</sup></th> | ||
* </tr> | ||
* <tr> | ||
* <td><code>binary</code></td> | ||
* <td><code>[[TYPES.Binary]]</code></td> | ||
* <td><code>Buffer</code></td> | ||
* <td>✓</td> | ||
* <td>✓</td> | ||
* </tr> | ||
* <tr> | ||
* <td><code>varbinary</code></td> | ||
* <td><code>[[TYPES.VarBinary]]</code></td> | ||
* <td><code>Buffer</code></td> | ||
* <td>✓</td> | ||
* <td>✓</td> | ||
* </tr> | ||
* <tr> | ||
* <td><code>image</code></td> | ||
* <td><code>[[TYPES.Image]]</code></td> | ||
* <td><code>Buffer</code></td> | ||
* <td>✓</td> | ||
* <td>✓</td> | ||
* </tr> | ||
* </tbody> | ||
* | ||
* <tbody> | ||
* <tr class="group-heading"> | ||
* <th colspan="5">Other Data Types</th> | ||
* </tr> | ||
* <tr> | ||
* <td><code>TVP</code></td> | ||
* <td><code>[[TYPES.TVP]]</code></td> | ||
* <td><code>Object</code></td> | ||
* <td>-</td> | ||
* <td>✓</td> | ||
* </tr> | ||
* <tr> | ||
* <td><code>UDT</code></td> | ||
* <td><code>[[TYPES.UDT]]</code></td> | ||
* <td><code>Buffer</code></td> | ||
* <td>✓</td> | ||
* <td>-</td> | ||
* </tr> | ||
* <tr> | ||
* <td><code>uniqueidentifier</code><sup>4</sup></td> | ||
* <td><code>[[TYPES.UniqueIdentifier]]</code></td> | ||
* <td><code>string</code></td> | ||
* <td>✓</td> | ||
* <td>✓</td> | ||
* </tr> | ||
* <tr> | ||
* <td><code>variant</code></td> | ||
* <td><code>[[TYPES.Variant]]</code></td> | ||
* <td><code>any</code></td> | ||
* <td>✓</td> | ||
* <td>-</td> | ||
* </tr> | ||
* <tr> | ||
* <td><code>xml</code></td> | ||
* <td><code>[[TYPES.Xml]]</code></td> | ||
* <td><code>string</code></td> | ||
* <td>✓</td> | ||
* <td>-</td> | ||
* </tr> | ||
* </tbody> | ||
* </table> | ||
* | ||
* <ol> | ||
* <li> | ||
* <h4>BigInt</h4> | ||
* <p> | ||
* Values are returned as a string. This is because values can exceed 53 bits of significant data, which is greater than a | ||
* Javascript <code>number</code> type can represent as an integer. | ||
* </p> | ||
* </li> | ||
* <li> | ||
* <h4>Numerical, Decimal</h4> | ||
* <p> | ||
* For input parameters, default precision is 18 and default scale is 0. Maximum supported precision is 19. | ||
* </p> | ||
* </li> | ||
* <li> | ||
* <h4>VarChar, NVarChar</h4> | ||
* <p> | ||
* <code>varchar(max)</code> and <code>nvarchar(max)</code> are also supported. | ||
* </p> | ||
* </li> | ||
* <li> | ||
* <h4>UniqueIdentifier</h4> | ||
* <p> | ||
* Values are returned as a 16 byte hexadecimal string. | ||
* </p> | ||
* <p> | ||
* Note that the order of bytes is not the same as the character representation. See | ||
* <a href="http://msdn.microsoft.com/en-us/library/ms190215.aspx">Using uniqueidentifier Data</a> | ||
* for an example of the different ordering of bytes. | ||
* </p> | ||
* </li> | ||
* </ol> | ||
*/ | ||
exports.TYPE = TYPE; | ||
const typeByName = { | ||
const TYPES = { | ||
TinyInt: _tinyint.default, | ||
@@ -165,2 +471,4 @@ Bit: _bit.default, | ||
}; | ||
exports.TYPES = TYPES; | ||
const typeByName = TYPES; | ||
exports.typeByName = typeByName; |
@@ -14,3 +14,153 @@ "use strict"; | ||
/** | ||
* ```js | ||
* const { Request } = require('tedious'); | ||
* const request = new Request("select 42, 'hello world'", (err, rowCount) { | ||
* // Request completion callback... | ||
* }); | ||
* connection.execSql(request); | ||
* ``` | ||
*/ | ||
class Request extends _events.EventEmitter { | ||
/** | ||
* @private | ||
*/ | ||
/** | ||
* @private | ||
*/ | ||
/** | ||
* @private | ||
*/ | ||
/** | ||
* @private | ||
*/ | ||
/** | ||
* @private | ||
*/ | ||
/** | ||
* @private | ||
*/ | ||
/** | ||
* @private | ||
*/ | ||
/** | ||
* @private | ||
*/ | ||
/** | ||
* @private | ||
*/ | ||
/** | ||
* @private | ||
*/ | ||
/** | ||
* @private | ||
*/ | ||
/** | ||
* @private | ||
*/ | ||
/** | ||
* @private | ||
*/ | ||
/** | ||
* @private | ||
*/ | ||
/** | ||
* @private | ||
*/ | ||
/** | ||
* @private | ||
*/ | ||
/** | ||
* This event, describing result set columns, will be emitted before row | ||
* events are emitted. This event may be emited multiple times when more | ||
* than one recordset is produced by the statement. | ||
* | ||
* An array like object, where the columns can be accessed either by index | ||
* or name. Columns with a name that is an integer are not accessible by name, | ||
* as it would be interpreted as an array index. | ||
*/ | ||
/** | ||
* The request has been prepared and can be used in subsequent calls to execute and unprepare. | ||
*/ | ||
/** | ||
* The request encountered an error and has not been prepared. | ||
*/ | ||
/** | ||
* A row resulting from execution of the SQL statement. | ||
*/ | ||
/** | ||
* All rows from a result set have been provided (through `row` events). | ||
* | ||
* This token is used to indicate the completion of a SQL statement. | ||
* As multiple SQL statements can be sent to the server in a single SQL batch, multiple `done` can be generated. | ||
* An `done` event is emited for each SQL statement in the SQL batch except variable declarations. | ||
* For execution of SQL statements within stored procedures, `doneProc` and `doneInProc` events are used in place of `done`. | ||
* | ||
* If you are using [[Connection.execSql]] then SQL server may treat the multiple calls with the same query as a stored procedure. | ||
* When this occurs, the `doneProc` and `doneInProc` events may be emitted instead. You must handle both events to ensure complete coverage. | ||
*/ | ||
/** | ||
* `request.on('doneInProc', function (rowCount, more, rows) { });` | ||
* | ||
* Indicates the completion status of a SQL statement within a stored procedure. All rows from a statement | ||
* in a stored procedure have been provided (through `row` events). | ||
* | ||
* This event may also occur when executing multiple calls with the same query using [[execSql]]. | ||
*/ | ||
/** | ||
* Indicates the completion status of a stored procedure. This is also generated for stored procedures | ||
* executed through SQL statements.\ | ||
* This event may also occur when executing multiple calls with the same query using [[execSql]]. | ||
*/ | ||
/** | ||
* A value for an output parameter (that was added to the request with [[addOutputParameter]]). | ||
* See also `Using Parameters`. | ||
*/ | ||
/** | ||
* This event gives the columns by which data is ordered, if `ORDER BY` clause is executed in SQL Server. | ||
*/ | ||
on(event, listener) { | ||
return super.on(event, listener); | ||
} | ||
/** | ||
* @private | ||
*/ | ||
emit(event, ...args) { | ||
return super.emit(event, ...args); | ||
} | ||
/** | ||
* @param sqlTextOrProcedure | ||
* The SQL statement to be executed | ||
* | ||
* @param callback | ||
* The callback to execute once the request has been fully completed. | ||
*/ | ||
constructor(sqlTextOrProcedure, callback) { | ||
@@ -61,3 +211,19 @@ super(); | ||
}; | ||
} // TODO: `type` must be a valid TDS value type | ||
} | ||
/** | ||
* @param name | ||
* The parameter name. This should correspond to a parameter in the SQL, | ||
* or a parameter that a called procedure expects. The name should not start with `@`. | ||
* | ||
* @param type | ||
* One of the supported data types. | ||
* | ||
* @param value | ||
* The value that the parameter is to be given. The Javascript type of the | ||
* argument should match that documented for data types. | ||
* | ||
* @param options | ||
* Additional type options. Optional. | ||
*/ | ||
// TODO: `type` must be a valid TDS value type | ||
@@ -87,3 +253,18 @@ | ||
this.parametersByName[name] = parameter; | ||
} // TODO: `type` must be a valid TDS value type | ||
} | ||
/** | ||
* @param name | ||
* The parameter name. This should correspond to a parameter in the SQL, | ||
* or a parameter that a called procedure expects. | ||
* | ||
* @param type | ||
* One of the supported data types. | ||
* | ||
* @param value | ||
* The value that the parameter is to be given. The Javascript type of the | ||
* argument should match that documented for data types | ||
* | ||
* @param options | ||
* Additional type options. Optional. | ||
*/ | ||
@@ -99,3 +280,7 @@ | ||
} | ||
/** | ||
* @private | ||
*/ | ||
makeParamsParameter(parameters) { | ||
@@ -121,3 +306,7 @@ let paramsParameter = ''; | ||
} | ||
/** | ||
* @private | ||
*/ | ||
transformIntoExecuteSqlRpc() { | ||
@@ -143,3 +332,7 @@ if (this.validateParameters()) { | ||
} | ||
/** | ||
* @private | ||
*/ | ||
transformIntoPrepareRpc() { | ||
@@ -161,3 +354,7 @@ this.originalParameters = this.parameters; | ||
} | ||
/** | ||
* @private | ||
*/ | ||
transformIntoUnprepareRpc() { | ||
@@ -168,3 +365,7 @@ this.parameters = []; | ||
} | ||
/** | ||
* @private | ||
*/ | ||
transformIntoExecuteRpc(parameters) { | ||
@@ -186,3 +387,7 @@ this.parameters = []; | ||
} | ||
/** | ||
* @private | ||
*/ | ||
validateParameters() { | ||
@@ -201,4 +406,7 @@ for (let i = 0, len = this.parameters.length; i < len; i++) { | ||
return null; | ||
} // Temporarily suspends the flow of data from the database. | ||
// No more 'row' events will be emitted until resume() is called. | ||
} | ||
/** | ||
* Temporarily suspends the flow of data from the database. No more `row` events will be emitted until [[resume] is called. | ||
* If this request is already in a paused state, calling [[pause]] has no effect. | ||
*/ | ||
@@ -216,3 +424,7 @@ | ||
} | ||
} // Resumes the flow of data from the database. | ||
} | ||
/** | ||
* Resumes the flow of data from the database. | ||
* If this request is not in a paused state, calling [[resume]] has no effect. | ||
*/ | ||
@@ -231,3 +443,7 @@ | ||
} | ||
/** | ||
* Cancels a request while waiting for a server response. | ||
*/ | ||
cancel() { | ||
@@ -241,3 +457,12 @@ if (this.canceled) { | ||
} | ||
/** | ||
* Sets a timeout for this request. | ||
* | ||
* @param timeout | ||
* The number of milliseconds before the request is considered failed, | ||
* or `0` for no timeout. When no timeout is set for the request, | ||
* the [[ConnectionOptions.requestTimeout]] of the [[Connection]] is used. | ||
*/ | ||
setTimeout(timeout) { | ||
@@ -244,0 +469,0 @@ this.timeout = timeout; |
@@ -40,3 +40,3 @@ "use strict"; | ||
get: function get() { | ||
return _dataType.typeByName; | ||
return _dataType.TYPES; | ||
} | ||
@@ -43,0 +43,0 @@ }); |
@@ -30,3 +30,3 @@ { | ||
"license": "MIT", | ||
"version": "9.0.1", | ||
"version": "9.1.0", | ||
"main": "./lib/tedious.js", | ||
@@ -86,5 +86,7 @@ "repository": { | ||
"sinon": "^7.5.0", | ||
"typedoc": "^0.17.0-3", | ||
"typescript": "^3.8.3" | ||
}, | ||
"scripts": { | ||
"docs": "typedoc", | ||
"lint": "eslint src test --ext .js,.ts && tsc", | ||
@@ -91,0 +93,0 @@ "test": "mocha test/unit test/unit/token test/unit/tracking-buffer", |
@@ -17,3 +17,11 @@ { | ||
"test/**/*.ts", | ||
] | ||
], | ||
"typedocOptions": { | ||
"name": "Tedious", | ||
"mode": "library", | ||
"out": "./docs", | ||
"exclude": "**/node_modules/**", | ||
"inputFiles": ["./src/tedious.ts"] | ||
} | ||
} |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
428432
11983
32