lib/user.js
function session_load(sid, callback) {
  var rows = [];

  db.query("SELECT * FROM sessions WHERE sid = $1;", [sid], function (err, rows) {
    if (err) {
      callback(err, null);
      return;
    }

    if (rows.length > 0) {
      callback(null, rows[0]);
    }
    else {
      callback('Session not found', null);
    }
  });
}
function session_load(sid, callback) {
  var rows = [];

  db.query("SELECT * FROM sessions WHERE sid = $1;", [sid], function (err, rows) {
    if (err) {
      callback(err, null);
      return;
    }

    if (rows.length > 0) {
      callback(null, rows[0]);
    }
    else {
      callback('Session not found', null);
    }
  });
}
function session_load ( sid , callback ) { var rows = [ ] ; db . query ( "SELECT * FROM sessions WHERE sid = $1;" , [ sid ] , function ( err , rows ) { if ( err ) { callback ( err , null ) ; return ; } if ( rows . length > 0 ) { callback ( null , rows [ 0 ] ) ; } else { callback ( 'Session not found' , null ) ; } } ) ; }
Load a user session.

This function does not exist in Drupal core, as it uses PHPs rather
complex session system we do not attempt to reconstruct here.

This only works when Drupal uses the (default) database session
backend. Memcache and other session backends not supported.
Load a user session .