Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const express = require('express');
const router = express.Router();
const mssql = require('mssql');
const fs = require('fs');
const sqldevops = require('../modules/sqldevops.js');
const sqlFile = './src/sql/queryperf.sql';
const dbconfig = require('../config/dbconfig.json');
const nav = require('../config/navconfig.json');
const viewName = 'queryperf';
const title = 'Query Performance';
const pool = mssql.globalConnectionPool;
/* GET directory page. */
router.get('/', (req, res, next) => {
fs.readFile(sqlFile, 'utf8', (err, script) => {
const request = new mssql.Request(pool);
request.query(script, (err, rec) => {
if (err) {
const sqlerror = sqldevops.getSqlError(err);
res.render('error', {
message: sqlerror.message,
error: sqlerror
});
}
else {
// for debugging
// console.log(rec.recordset);
res.render(viewName, {
const express = require('express');
const router = express.Router();
const mssql = require('mssql');
const fs = require('fs');
const sqldevops = require('../modules/sqldevops.js');
const sqlFile = './src/sql/users.sql';
const dbconfig = require('../config/dbconfig.json');
const nav = require('../config/navconfig.json');
const viewName = 'users';
const title = 'Database Users';
const pool = mssql.globalConnectionPool;
/* GET directory page. */
router.get('/', (req, res, next) => {
fs.readFile(sqlFile, 'utf8', (err, script) => {
const request = new mssql.Request(pool);
request.query(script, (err, rec) => {
if (err) {
const sqlerror = sqldevops.getSqlError(err);
res.render('error', {
message: sqlerror.message,
error: sqlerror
});
}
else {
// for debugging
// console.log(rec.recordset);
// Author: Eric Kang
// License: MIT
// ------------------------------------------------------------------------//
'use strict';
const express = require('express');
const router = express.Router();
const mssql = require('mssql');
const fs = require('fs');
const sqldevops = require('../modules/sqldevops.js');
const dbconfig = require('../config/dbconfig.json');
const directorySqlFile = './src/sql/customers_wwi.sql';
const nav = require('../config/navconfig.json');
const pool = mssql.globalConnectionPool;
/* GET directory page. */
router.get('/', (req, res, next) => {
fs.readFile(directorySqlFile, 'utf8', (err, script) => {
pool.connect((err) => {
const request = new mssql.Request(pool);
request.query(script, (err, rec) => {
if (err) {
const sqlerror = sqldevops.getSqlError(err);
res.render('error', {
message: sqlerror.message,
error: sqlerror
});
}
else {
// for debugging
// console.log(rec.recordset);
// ------------------------------------------------------------------------//
'use strict';
const express = require('express');
const path = require('path');
const favicon = require('serve-favicon');
const logger = require('morgan');
const cookieParser = require('cookie-parser');
const bodyParser = require('body-parser');
//database
const mssql = require('mssql');
const dbconfig = require('./src/config/dbconfig.json');
const pool = new mssql.ConnectionPool(dbconfig);
mssql.globalConnectionPool = pool;
//open database connection
pool.connect((err)=>{
if (err){
console.log('connection failed to server:' + dbconfig.server + ' database:' + dbconfig.database);
console.log(err);
}
else {
console.log ('Connected to ' + dbconfig.server
+ '/' + dbconfig.database
+ ' (' + dbconfig.user + ')');
const request = new mssql.Request(pool);
request.query('select @@version',(err,rec)=>{
console.log(JSON.stringify(rec.recordset, null, 0)
.replace('[{"":"', '')
.replace('"}]','')
);
const express = require('express');
const router = express.Router();
const mssql = require('mssql');
const fs = require('fs');
const sqldevops = require('../modules/sqldevops.js');
const sqlFile = './src/sql/servermemorybydb.sql';
const dbconfig = require('../config/dbconfig.json');
const nav = require('../config/navconfig.json');
const viewName = 'servermemorybydb';
const title = 'Memory Usage by Database';
const pool = mssql.globalConnectionPool;
/* GET directory page. */
router.get('/', (req, res, next) => {
fs.readFile(sqlFile, 'utf8', (err, script) => {
const request = new mssql.Request(pool);
request.query(script, (err, rec) => {
if (err) {
const sqlerror = sqldevops.getSqlError(err);
res.render('error', {
message: sqlerror.message,
error: sqlerror
});
}
else {
// for debugging
// console.log(rec.recordset);
const express = require('express');
const router = express.Router();
const mssql = require('mssql');
const fs = require('fs');
const sqldevops = require('../modules/sqldevops.js');
const sqlFile = './src/sql/backuphistory.sql';
const dbconfig = require('../config/dbconfig.json');
const nav = require('../config/navconfig.json');
const viewName = 'backuphistory';
const title = 'Backup History';
const description = 'Backup history for all databases.';
const pool = mssql.globalConnectionPool;
/* GET directory page. */
router.get('/', (req, res, next) => {
fs.readFile(sqlFile, 'utf8', (err, script) => {
const request = new mssql.Request(pool);
request.query(script, (err, rec) => {
if (err) {
const sqlerror = sqldevops.getSqlError(err);
res.render('error', {
message: sqlerror.message,
error: sqlerror
});
}
else {
// for debugging
// console.log(rec.recordset);
// License: MIT
// ------------------------------------------------------------------------//
'use strict';
const express = require('express');
const router = express.Router();
const mssql = require('mssql');
const fs = require('fs');
const sqldevops = require('../modules/sqldevops.js');
const dbconfig = require('../config/dbconfig.json');
const tablespaceSqlFile = './src/sql/tablespace.sql';
const nav = require('../config/navconfig.json');
const pool = mssql.globalConnectionPool;
/* GET home page. */
router.get('/', (req, res, next) => {
fs.readFile(tablespaceSqlFile, 'utf8', (err, script) => {
pool.connect((err) => {
const request = new mssql.Request(pool);
request.query(script, (err, rec) => {
if (err) {
const sqlerror = sqldevops.getSqlError(err);
res.render('error', {
message: sqlerror.message,
error: sqlerror
});
}
else {
// for debugging
// ------------------------------------------------------------------------//
'use strict';
const express = require('express');
const router = express.Router();
const mssql = require('mssql');
const fs = require('fs');
const sqldevops = require('../modules/sqldevops.js');
const dbconfig = require('../config/dbconfig.json');
const tablespaceSqlFile = './src/sql/tablespace.sql';
const nav = require('../config/navconfig.json');
const pool = mssql.globalConnectionPool;
/* GET home page. */
router.get('/', (req, res, next) => {
const request = new mssql.Request(pool);
fs.readFile(tablespaceSqlFile, 'utf8', (err, script) => {
const request = new mssql.Request(pool);
request.query(script, (err, rec) => {
if (err) {
const sqlerror = sqldevops.getSqlError(err);
res.render('error', {
message: sqlerror.message,
error: sqlerror
});
}
else {
// for debugging