View difference between Paste ID: iypBHEnR and eVXrLUqi
SHOW: | | - or go back to the newest paste.
1
var db = new mysql.Database({
2
    hostname: 'localhost',
3
    ....etc...
4
});
5
db.on('error', function(error) {
6
    console.log('ERROR: ' + error);
7
}).on('ready', function(server) {
8
    console.log('Connected to ' + server.hostname + ' (' + server.version + ')');
9-
}).connect(_dbConnected());
9+
}).connect(function(error){
10
	_dbConnected();
11
});
12
13
function _dbConnected(){
14
	db.query("SELECT ta.ukey, tu.login, tu.accid, tu.id, tu.buddyicon, tu.private FROM "+ACCOUNTS_TABLE+" as ta JOIN "+USERS_TABLE+" as tu ON tu.accid=ta.accid").
15
		execute(function(error, rows, cols) {
16
			if( error ){
17
				console.log('ERROR: ' + error);
18
				return;
19
			}
20
			_.each(rows, function(row){
21
				new User(row);
22
			});
23
			_usersLoaded();
24
		});
25
}