Guest User

Untitled

a guest
Dec 19th, 2011
135
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. savePerson: function( person_id, callback )
  2. {
  3.   this.db.get( 'SELECT * FROM `person` WHERE person_id = ' + person_id + ' LIMIT 1;', function( err, res )
  4.   {
  5.      if( err || !res.length )
  6.      {
  7.         callback( false, true );
  8.      }
  9.  
  10.      var person = res.person[0];
  11.      this.db.get( 'SELECT * FROM `person_' + person.person_type + ' WHERE person_id = ' + person_id + ' LIMIT 1;', function( err, res )
  12.      {
  13.        person.data = res;
  14.  
  15.        this.saveFile( 'person_' + person_id, function( err, res )
  16.        {
  17.          if( err )
  18.          {
  19.            callback( err, false );
  20.          }
  21.  
  22.          callback( false, { time: new Date(), person: person } );
  23.        }
  24.     }
  25.   }
  26. }
RAW Paste Data