<commit_before>const logger = require('../../../log.js');

module.exports = {
    disconnect,
    connect,
    addParams
};

function connect() {
    const config = require('../../config');
    const Connection = require('tedious').Connection;

    let connection = new Connection({
        userName: config.db.username,
        password: <PASSWORD>,
        server: config.db.server,
        options: {
            encrypt: true,
            database: config.db.database,
            useColumnNames: true,
            rowCollectionOnRequestCompletion: true
        }
    });

    connection.on('error', function(err) {
        if(err.message === 'Connection lost - read ECONNRESET') {
            logger.warn('Connection lost - read ECONNRESET');
            logger.info('Azure loadbalancer timeout error - see https://github.com/tediousjs/tedious/issues/300');
        } else {
            logger.error('DB error: ' + err.message);
        }
    });

    logger.debug('Created new DB connection');
    return connection;
}

function addParams(params, request) {
    params.forEach(function(param) {
        let paramValue = param.value;

        if (isNaN(paramValue)) {
            paramValue = paramValue.toUpperCase();
        }

        request.addParameter(
            param.column,
            param.type,
            paramValue);
    });
}

function disconnect(connection) {
    logger.debug('Closing DB connection on disconnect');
    connection.close();
}<commit_msg>Stop converting to upper case<commit_after>const logger = require('../../../log.js');

module.exports = {
    disconnect,
    connect,
    addParams
};

function connect() {
    const config = require('../../config');
    const Connection = require('tedious').Connection;

    let connection = new Connection({
        userName: config.db.username,
        password: <PASSWORD>,
        server: config.db.server,
        options: {
            encrypt: true,
            database: config.db.database,
            useColumnNames: true,
            rowCollectionOnRequestCompletion: true
        }
    });

    connection.on('error', function(err) {
        if(err.message === 'Connection lost - read ECONNRESET') {
            logger.warn('Connection lost - read ECONNRESET');
            logger.info('Azure loadbalancer timeout error - see https://github.com/tediousjs/tedious/issues/300');
        } else {
            logger.error('DB error: ' + err.message);
        }
    });

    logger.debug('Created new DB connection');
    return connection;
}

function addParams(params, request) {
    params.forEach(function(param) {
        let paramValue = param.value;

        request.addParameter(
            param.column,
            param.type,
            paramValue);
    });
}

function disconnect(connection) {
    logger.debug('Closing DB connection on disconnect');
    connection.close();
}
{'fraction_non_alphanumeric': 0.12816950329975685, 'fraction_numerical': 0.0020840569642236887, 'mean_word_length': 2.221476510067114, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, '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': '2985726', 'n_tokens_mistral': 775, 'n_tokens_neox': 759, 'n_words': 168}