Guest User

Untitled

a guest
May 15th, 2012
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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());
  10.  
  11. function _dbConnected(){
  12.     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").
  13.         execute(function(error, rows, cols) {
  14.             if( error ){
  15.                 console.log('ERROR: ' + error);
  16.                 return;
  17.             }
  18.             _.each(rows, function(row){
  19.                 new User(row);
  20.             });
  21.             _usersLoaded();
  22.         });
  23. }
Advertisement
Add Comment
Please, Sign In to add comment