<commit_before>var csv = require('csv');
var stream = require('stream');
var util = require('util');
var mysql = require('mysql');
var path = require('path');
var nodemailer = require('nodemailer');
var smtpPool = require('nodemailer-smtp-pool');
var fs = require('fs');
var express = require('express');
var compress = require('compression');
var favicon = require('serve-favicon');
var logger = require('morgan');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
var multiparty = require('multiparty');
var jade = require('jade');
var crypto = require('crypto');
var iconv = require('iconv-lite');

var mysqlPool = mysql.createPool({
    connectionLimit: 10,
    host: '127.0.0.1',
    user: 'dhrc',
    password: '<PASSWORD>',
    database: "weez_wx",
    multipleStatements: true
});

mysqlPool.callSP = function (spName, params, res, next, then, cleanUp) {
    this.query("call " + spName, params, function (err, returns) {
        if (err) {
            if (cleanUp) {
                cleanUp();
            }
            next(err);
            return;
        }
        if (returns.length === 0) {
            if (cleanUp) {
                cleanUp();
            }
            next(new Error("db error!"));
            return;
        }
        var response = {}, i = 0, l = returns.length, rows;
        while (i < l) {
            rows = returns[i];
            if (rows instanceof Array) {
                if (rows.length == 1) {
                    var row = rows[0];
                    if (row._type_ === 'array') {
                        response[row._field_] = returns[++i];
                    } else {
                        response[row._field_] = row;
                        delete row._type_;
                        delete row._field_;
                    }
                } else {
                    //error!
                }
            }
            i++;
        }
        if (then && !response.errors) {
            then(response);
            if (cleanUp) {
                cleanUp();
            }
        } else {
            if (cleanUp) {
                cleanUp();
            }
            res.json(response);
        }
    });
};

mysqlPool.callSql = function (next, sql, params, then) {
    var callback = function (err, returns) {
        if (err) {
            next(err);
        } else {
            then(returns);
        }
    };
    if (typeof params === 'function') {
        then = params;
        params = callback;
        callback = undefined;
    }
    this.query(sql, params, callback);
};

var __mailFrom = '<EMAIL>';
__mailFromTitle = "德合睿创<" + __mailFrom + ">";
__mailTeller = __mailFrom;

var mailTransport = nodemailer.createTransport(smtpPool({
    host: 'smtp.126.com',
    port: 25,
    auth: {
        user: __mailFrom,
        pass: "<PASSWORD>"
    },
    maxConnections: 5,
    maxMessages: 100
}));

var app = express();
app.set("view engine", "jade");
// uncomment after placing your favicon in /public
//app.use(favicon(__dirname + '/public/favicon.ico'));
app.use(compress());
app.use(logger('dev'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended: false}));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public')));
/*
 app.use(multer({
 dest: path.join(__dirname, '/uploads/'),
 rename: function (fieldname, filename) {
 return crypto.randomBytes(16).toString('hex');<commit_msg>changes<commit_after>var csv = require('csv');
var stream = require('stream');
var util = require('util');
var mysql = require('mysql');
var path = require('path');
var nodemailer = require('nodemailer');
var smtpPool = require('nodemailer-smtp-pool');
var fs = require('fs');
var express = require('express');
var compress = require('compression');
var favicon = require('serve-favicon');
var logger = require('morgan');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
var multiparty = require('multiparty');
var jade = require('jade');
var crypto = require('crypto');
var iconv = require('iconv-lite');

var mysqlPool = mysql.createPool({
    connectionLimit: 10,
    host: '127.0.0.1',
    user: 'dhrc',
    password: '<PASSWORD>',
    database: "weez_wx",
    multipleStatements: true
});

mysqlPool.callSP = function (spName, params, res, next, then, cleanUp) {
    this.query("call " + spName, params, function (err, returns) {
        if (err) {
            if (cleanUp) {
                cleanUp();
            }
            next(err);
            return;
        }
        if (returns.length === 0) {
            if (cleanUp) {
                cleanUp();
            }
            next(new Error("db error!"));
            return;
        }
        var response = {}, i = 0, l = returns.length, rows;
        while (i < l) {
            rows = returns[i];
            if (rows instanceof Array) {
                if (rows.length == 1) {
                    var row = rows[0];
                    if (row._type_ === 'array') {
                        response[row._field_] = returns[++i];
                    } else {
                        response[row._field_] = row;
                        delete row._type_;
                        delete row._field_;
                    }
                } else {
                    //error!
                }
            }
            i++;
        }
        if (then && !response.errors) {
            then(response);
            if (cleanUp) {
                cleanUp();
            }
        } else {
            if (cleanUp) {
                cleanUp();
            }
            res.json(response);
        }
    });
};

mysqlPool.callSql = function (next, sql, params, then) {
    var callback = function (err, returns) {
        if (err) {
            next(err);
        } else {
            then(returns);
        }
    };
    if (typeof params === 'function') {
        then = params;
        params = callback;
        callback = undefined;
    }
    this.query(sql, params, callback);
};

var __mailFrom = '<EMAIL>';
__mailFromTitle = "德合睿创<" + __mailFrom + ">";
__mailTeller = '<EMAIL>';

var mailTransport = nodemailer.createTransport(smtpPool({
    host: 'smtp.126.com',
    port: 25,
    auth: {
        user: __mailFrom,
        pass: "<PASSWORD>"
    },
    maxConnections: 5,
    maxMessages: 100
}));

var app = express();
app.set("view engine", "jade");
// uncomment after placing your favicon in /public
//app.use(favicon(__dirname + '/public/favicon.ico'));
app.use(compress());
app.use(logger('dev'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended: false}));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public')));
/*
 app.use(multer({
 dest: path.join(__dirname, '/uploads/'),
 rename: function (fieldname, filename) {
 return crypto.randomBytes(16).toString('hex');
{'fraction_non_alphanumeric': 0.15366671526461584, 'fraction_numerical': 0.006706516984983234, 'mean_word_length': 1.9379014989293362, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '3530192', 'n_tokens_mistral': 2069, 'n_tokens_neox': 1984, 'n_words': 469}