<commit_before>var mysql = require('mysql');
var sql = null;
var config = null;
exports.connected = false;

// on Error automatically tries to reconnect to the mysql-server on Connection-Loss
var onError = function(err){
    if(err){
        console.log(err);
        if(err.code === "PROTOCOL_CONNECTION_LOST")
            exports.connected = false;
    }
    if(!exports.connected){
        var re = setInterval(function(){
            sql = mysql.createConnection(config);
            if(exports.connect())
                clearInterval(re);
        }, 5000);
    }
};

exports.connect = function(config){
	db_config = config;
	sql = mysql.createConnection(db_config);
	sql.connect(function(err){
		if(err) {
			console.log(err);
			exports.connected = false;
		} else {
			exports.connected = true;
			sql.on("error", onError);
		}
		return exports.connected;
	});
};

var get = function(statement, callback){process.stdout.write(statement);process.stdin.once('data', function(data){callback(data.toString().trim());});};
exports.getInformation = function(callback){
	var r = {};
	get("\t- user: ", function(user){<commit_msg>fix #84<commit_after>var mysql = require('mysql');
var sql = null;
var config = null;
exports.connected = false;

// on Error automatically tries to reconnect to the mysql-server on Connection-Loss
var onError = function(err){
	if(err){
		console.log(err);
		if(err.code === "PROTOCOL_CONNECTION_LOST")
			exports.connected = false;
	}
	if(!exports.connected){
		var re = setInterval(function(){
			if(exports.connect(config))
				clearInterval(re);
			else
				console.log("re-connect-attempt failed");
		}, 5000);
	}
};

exports.connect = function(db_config){
	config = db_config;
	sql = mysql.createConnection(config);
	sql.connect(function(err){
		if(err) {
			console.log(err);
			exports.connected = false;
		} else {
			exports.connected = true;
			sql.on("error", onError);
		}
		return exports.connected;
	});
};

exports.getInformation = function(callback){
	var get = function(statement, callback){process.stdout.write(statement);process.stdin.once('data', function(data){callback(data.toString().trim());});};
	var r = {};
	get("\t- user: ", function(user){
{'fraction_non_alphanumeric': 0.1582537517053206, 'fraction_numerical': 0.004547521600727604, 'mean_word_length': 3.9327354260089686, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '793498', 'n_tokens_mistral': 730, 'n_tokens_neox': 678, 'n_words': 141}