How to use the Connection function from mssql
Find comprehensive JavaScript mssql.Connection code examples handpicked from public code repositorys.
GitHub: ironSource/sqlpad
205 206 207 208 209 210 211 212 213 214
requestTimeout: 1000 * 60 * 60, // one hour options: { encrypt: connection.sqlserverEncrypt } } var mssqlConnection = new mssql.Connection(sqlconfig, function (err) { if (err) { callback(err, queryResult) } else { var rowCounter = 0
759
0
7
+ 5 other calls in file
GitHub: glg/node-mssql
42 43 44 45 46 47 48 49 50 51
options: { encrypt: true // Use this if you're on Windows Azure } } var connection = new sql.Connection(config, function(err) { // ... error checks // Query
463
0
0
+ 29 other calls in file
GitHub: soheilpro/sqlcmd
126 127 128 129 130 131 132 133 134 135
port: argv.port || 1433, database: argv.database || 'master', requestTimeout: (argv.timeout || 60) * 1000 } var connection = new sql.Connection(config, function(error) { if (error) return callback(error); callback(null, connection);
7
21
5
+ 9 other calls in file
386 387 388 389 390 391 392 393 394
}; })(); let runWithConnection = (() => { var _ref39 = _asyncToGenerator(function* (conn, run) { const connection = yield new _mssql.Connection(conn.dbConfig).connect(); return run(connection); });
68
0
2
+ 3 other calls in file
107 108 109 110 111 112 113 114 115 116
var upsert = function (items) { if (!items || items.length === 0) { return } var connection = new sql.Connection(config, function (err) { if (err) { console.log('ERROR:', err) throw err }
7
4
2
59 60 61 62 63 64 65 66 67 68
var config async.series([ function defineConnection (cb) { connection = new sql.Connection(localConfig = { server: opts.mssql_server, port: +opts.mssql_port, user: opts.mssql_user, password: opts.mssql_password,
9
0
53
+ 33 other calls in file
127 128 129 130 131 132 133 134 135 136
app.get('/', function (req, res) { res.sendFile(path.join(process.cwd(), '..', 'index.html')); }); app.get('/api/matchups', function (req, res){ let conSQL = new sql.Connection(dbConfig); let reqSQL = new sql.Request(conSQL); conSQL.connect(function(err) { if (err) { console.log(err);
0
4
7
+ 3 other calls in file
116 117 118 119 120 121 122 123 124 125
adapter.log.error(error.message); } var connectionPromise = q.defer(); function getConnection() { if (!sqlConnection) { sqlConnection = new sql.Connection(dbConfig, function (error) { if (error) { traceError(error); sqlConnection = null; connectionPromise = q.defer();
0
3
3
GitHub: catdad/sails-sqlserver
183 184 185 186 187 188 189 190 191 192
} else if (!persistent && !connected) { if (!assigned) { connection.mssqlConnection = []; } connection.mssqlConnection[uniqId] = new mssql.Connection(marshalConfig(connection.config), function (err) { cb(err, uniqId); }); registerErrorHandler(connection.mssqlConnection[uniqId]); } else {
87
3
3
+ 3 other calls in file
GitHub: panaxit/panaxjs
80 81 82 83 84 85 86 87 88 89
lang: params.lang || 'DEFAULT', } } this.sqlConn = new Promise(function(resolve, reject) { var conn = new sql.Connection(config.db, function(err) { if (err) { return reject(err) } return resolve(conn)
1
1
2
+ 5 other calls in file
GitHub: nextgearcapital/nitrodata
19 20 21 22 23 24 25 26 27 28
return config; } function connectToDb(_config, cb) { config = _config; connection = new sql.Connection(config, function (err) { if (!err) { logger.info( 'connected to [' + config.database + '] database on [' + config.server + ']' );
3
1
13
+ 5 other calls in file
8 9 10 11 12 13 14 15 16 17
var fs = require('fs'); var utils = require('./../../utils/utils'); var config = require('./../../config/config'); var Connection = mssql.Connection; // Connection to db var __connection = { context: new Connection(config.db),
1
0
4
GitHub: deepaknverma/querysql
80 81 82 83 84 85 86 87 88 89
} __connection() { const self = this; return new Promise((success, fail) => { new sql.Connection(self.config) .connect() .then((connection) => { self.connection = connection; self.connection.on('error', (err) => {
0
0
2
+ 3 other calls in file
GitHub: jhenriquez/arianne
6 7 8 9 10 11 12 13 14 15
"SELECT ProcessName, LastID, LastActivityDate, @MAXID - LastID AS Delta " + "FROM [dbo].[ProcessHistory] (nolock) " + "WHERE ProcessName LIKE 'Engine%' "; this.getRecentHistoryDelta = function getRecentHistoryDelta (onErr, onSucc) { cnn = new sql.Connection(config, function (err) { if (err) return onErr(err); cnn.request().query(internalDetalQuery, function (err, rows) {
0
0
2
17 18 19 20 21 22 23 24 25 26
DECIMAL: sql.Decimal(18, 5), STRING: sql.VarChar(8000), DATE: sql.DateTime, BIT: sql.bit } this.connection = new sql.Connection(connectionString); }; //método genérico para acciones get DataAccess.prototype.query = function(stored, params, callback) {
0
0
5
29 30 31 32 33 34 35 36 37 38
'PostDistrikt', 'Latitude', 'Longitude' ]; this.connection = new sql.Connection({ user: this.config.user, password: this.config.password, server: this.config.server, database: this.config.database
0
0
5
128 129 130 131 132 133 134 135 136 137
if ( linksCount < maxLinks ) { var link = { ts: Date.now(), id: linkId, connection: new mssql.Connection(marshalConfig(connections[connection].config)) }; link.connection.connect(function (err) { return cb(err, link); });
0
0
1
mssql.connect is the most popular function in mssql (5681 examples)