<commit_before># WARNING!!!

```
#################################################################
WORK IN PROGRESS - NOT IN NPM - WILL BE MAKING BREAKING CHANGES
#################################################################
```

# mssql-ng

Next Generation MS-SQL Client Interface for Node.js/io.js

This module provides an interface to use JavaScript (ES6/ES2015) Template strings in order to construct SQL requests. 

This library inherits [mssql](https://www.npmjs.com/package/mssql)  module under the covers.

## Requirements

* Promises - Requires a native or [i-promise](https://www.npmjs.com/package/i-promise) compatible Promise implementation
* mssql - mssql `^2.1.2` required, which is the latest as of this module's release


## Usage

Responses with multiple recordsets are not supported.  Use `mssql` directly.

```
var sql = require('mssql-ng');
var opts = {...} // mssql's connection options
```

The module itself is a method that returns a Promise that will resolve with the active connection, similar to `mssql.connect()` ... there will be additional methods for template parsers attached to the Promise itself (these will not carry forward).  This allows one to resolve the connection object directly (since mssql's resolver doesn't include a reference to the connection object).

```
sql(opts)
  .then(function(conn){
    //use connection
    var request = new mssql.Request(conn);
    ...
  });
```

The promise returned from `sql(options)` will have two additional methods (`.query` and `.queryStream`).  These methods do not get carried forward with the Promise chain.


### sql(opts).query - returns Promise - resolves {parameters,recordset}

For output parameters, use the module's `out` method, passing the name of the parameter, as well as the datatype of the parameter from `mssql`

```
function validateLogin(email, password) {
  var app = '89265a96-07ae-4463-a8d6-00a18140a030';

  return sql(opts).query`
    SET ${sql.out('paramName', mssql.Int)} = 5;<commit_msg>save work in progress, adjust specified parameters<commit_after># WARNING!!!

```
#################################################################
WORK IN PROGRESS - NOT IN NPM - WILL BE MAKING BREAKING CHANGES
#################################################################
```

# mssql-ng

Next Generation MS-SQL Client Interface for Node.js/io.js

This module provides an interface to use JavaScript (ES6/ES2015) Template strings in order to construct SQL requests. 

This library inherits [mssql](https://www.npmjs.com/package/mssql)  module under the covers.

## Requirements

* Promises - Requires a native or [i-promise](https://www.npmjs.com/package/i-promise) compatible Promise implementation
* mssql - mssql `^2.1.2` required, which is the latest as of this module's release


## Usage

Responses with multiple recordsets are not supported.  Use `mssql` directly.

```
var sql = require('mssql-ng');
var opts = {...} // mssql's connection options
```

The module itself is a method that returns a Promise that will resolve with the active connection, similar to `mssql.connect()` ... there will be additional methods for template parsers attached to the Promise itself (these will not carry forward).  This allows one to resolve the connection object directly (since mssql's resolver doesn't include a reference to the connection object).

```
sql(opts)
  .then(function(conn){
    //use connection
    var request = new mssql.Request(conn);
    ...
  });
```

The promise returned from `sql(options)` will have two additional methods (`.query` and `.queryStream`).  These methods do not get carried forward with the Promise chain.


### sql(opts).query - returns Promise - resolves {parameters,recordset}

For output parameters, use the module's `out` method, passing the name of the parameter, as well as the datatype of the parameter from `mssql`

```
function validateLogin(email, password) {
  var app = '89265a96-07ae-4463-a8d6-00a18140a030';

  return sql(opts).query`
    SET ${sql.output('paramName', mssql.Int)} = 5;
{'fraction_non_alphanumeric': 0.16262376237623763, 'fraction_numerical': 0.016831683168316833, 'mean_word_length': 4.54320987654321, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5743964', 'n_tokens_mistral': 1202, 'n_tokens_neox': 1100, 'n_words': 443}