<commit_before>var mysql = require('mysql');

var pool = mysql.createPool(global.config.DB);

module.exports = {
	query: function(){
		var sql_args = [];
		var args = [];
		for(var i=0; i<arguments.length; i++){
			args.push(arguments[i]);
		}
		var callback = args[args.length-1]; //last arg is callback
		pool.getConnection(function(err, connection) {
    	if(err) {
				console.log(err);
				callback(err);
				return;
			}
			if(args.length > 2){
				sql_args = args[1];
			}
	    connection.query(args[0], sql_args, function(err, results) {
	      connection.release(); // always put connection back in pool after last query
	      if(err){
					console.log(err);
					callback(err);
					return;
				}
	      callback(null, results);
	    });
		});
	}
};<commit_msg>question mark escapes were not behaving as documented<commit_after>var mysql = require('mysql');

var pool = mysql.createPool(global.config.DB);

module.exports = {
	query: function(){
		var sql_args = [];
		var args = [];
		for(var i=0; i<arguments.length; i++){
			args.push(arguments[i]);
		}
		var callback = args[args.length-1]; //last arg is callback
		pool.getConnection(function(err, connection) {
    	if(err) {
				console.log(err);
				callback(err);
				return;
			}
			if(args.length > 2){
				sql_args = args[1];
			}
	    connection.query(args[0], sql_args, function(err, results) {
	      connection.release(); // always put connection back in pool after last query
	      if(err){
					console.log(err);
					callback(err);
					return;
				}
	      callback(null, results);
	    });
		});
	},
	escape: function(arg){
		return mysql.escape(arg);
	}
};
{'fraction_non_alphanumeric': 0.15853658536585366, 'fraction_numerical': 0.006097560975609756, 'mean_word_length': 3.002439024390244, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '4071018', 'n_tokens_mistral': 637, 'n_tokens_neox': 537, 'n_words': 121}