iobroker.sql 2.0.2 → 2.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,61 +1,61 @@
1
- // Generated by CoffeeScript 2.3.2
2
- (function() {
3
- const ConnectionFactory = require('sql-client/lib/connection-factory').ConnectionFactory;
4
- const SQLClient = require('sql-client/lib/sql-client').SQLClient;
5
- const SQLClientPool = require('sql-client/lib/sql-client-pool').SQLClientPool;
6
- const mssql = require('mssql');
7
-
8
- const MSSQLConnectionFactory = class MSSQLConnectionFactory extends ConnectionFactory {
9
- constructor() {
10
- super(...arguments);
11
- this.open_connection = this.open_connection.bind(this);
12
- this.execute = this.execute.bind(this);
13
- }
14
-
15
- open_connection(options, callback) {
16
- let connection;
17
- const pos = options.server.indexOf(':');
18
- if (pos !== -1) {
19
- options.port = parseInt(options.server.substring(pos + 1), 10);
20
- options.server = options.server.substring(0, pos);
21
- }
22
- options.pool = options.pool || {};
23
- options.pool.min = 0;
24
- options.pool.max = 1;
25
-
26
- return connection = new mssql.ConnectionPool(options, err => {
27
- if (err != null) {
28
- return callback(err);
29
- } else {
30
- return callback(null, connection);
31
- }
32
- });
33
- };
34
-
35
- execute(connection, sql, bindvars, callback) {
36
- const request = new mssql.Request(connection);
37
- return request.query(sql, (err, result) => callback(err, result && result.recordset ? result.recordset : result));
38
- };
39
- };
40
-
41
- const MSSQLClient = class MSSQLClient extends SQLClient {
42
- constructor(...options) {
43
- super(...options, new MSSQLConnectionFactory());
44
- }
45
-
46
- };
47
-
48
- const MSSQLClientPool = class MSSQLClientPool extends SQLClientPool {
49
- constructor(...options) {
50
- super(...options, new MSSQLConnectionFactory());
51
- }
52
-
53
- };
54
-
55
- exports.MSSQLConnectionFactory = MSSQLConnectionFactory;
56
-
57
- exports.MSSQLClient = MSSQLClient;
58
-
59
- exports.MSSQLClientPool = MSSQLClientPool;
60
-
61
- }).call(this);
1
+ // Generated by CoffeeScript 2.3.2
2
+ (function() {
3
+ const ConnectionFactory = require('sql-client/lib/connection-factory').ConnectionFactory;
4
+ const SQLClient = require('sql-client/lib/sql-client').SQLClient;
5
+ const SQLClientPool = require('sql-client/lib/sql-client-pool').SQLClientPool;
6
+ const mssql = require('mssql');
7
+
8
+ const MSSQLConnectionFactory = class MSSQLConnectionFactory extends ConnectionFactory {
9
+ constructor() {
10
+ super(...arguments);
11
+ this.open_connection = this.open_connection.bind(this);
12
+ this.execute = this.execute.bind(this);
13
+ }
14
+
15
+ open_connection(options, callback) {
16
+ let connection;
17
+ const pos = options.server.indexOf(':');
18
+ if (pos !== -1) {
19
+ options.port = parseInt(options.server.substring(pos + 1), 10);
20
+ options.server = options.server.substring(0, pos);
21
+ }
22
+ options.pool = options.pool || {};
23
+ options.pool.min = 0;
24
+ options.pool.max = 1;
25
+
26
+ return connection = new mssql.ConnectionPool(options, err => {
27
+ if (err != null) {
28
+ return callback(err);
29
+ } else {
30
+ return callback(null, connection);
31
+ }
32
+ });
33
+ };
34
+
35
+ execute(connection, sql, bindvars, callback) {
36
+ const request = new mssql.Request(connection);
37
+ return request.query(sql, (err, result) => callback(err, result && result.recordset ? result.recordset : result));
38
+ };
39
+ };
40
+
41
+ const MSSQLClient = class MSSQLClient extends SQLClient {
42
+ constructor(...options) {
43
+ super(...options, new MSSQLConnectionFactory());
44
+ }
45
+
46
+ };
47
+
48
+ const MSSQLClientPool = class MSSQLClientPool extends SQLClientPool {
49
+ constructor(...options) {
50
+ super(...options, new MSSQLConnectionFactory());
51
+ }
52
+
53
+ };
54
+
55
+ exports.MSSQLConnectionFactory = MSSQLConnectionFactory;
56
+
57
+ exports.MSSQLClient = MSSQLClient;
58
+
59
+ exports.MSSQLClientPool = MSSQLClientPool;
60
+
61
+ }).call(this);