c++/EEDB/JobQueue/Job.cpp
//////////////////////////////////////////////////////////////////////////////////////////////////
//
// class level MQDB style fetch methods
//
//////////////////////////////////////////////////////////////////////////////////////////////////
class level MQDB style fetch methods
class level MQDB style fetch methods
void  EEDB::JobQueue::Job::init_from_row_map(map<string, dynadata> &row_map) {
  _primary_db_id   = row_map["job_id"].i_int;
  _status          = row_map["status"].i_string;
  _user_id         = row_map["user_id"].i_int;
  _analysis_id     = row_map["analysis_id"].i_int;
  if(row_map["completed"].type == MQDB::STRING) {
    string date_string = row_map["completed"].i_string;
    _completed = MQDB::seconds_from_epoch(date_string);
  }
  if(row_map["completed"].type == MQDB::TIMESTAMP) {
    _completed = row_map["completed"].i_timestamp;
  }
  if(row_map["created"].type == MQDB::STRING) {
    string date_string = row_map["created"].i_string;
    _created = MQDB::seconds_from_epoch(date_string);
  }
  if(row_map["created"].type == MQDB::TIMESTAMP) {
    _created = row_map["created"].i_timestamp;
  }
}
void EEDB :: JobQueue :: Job :: init_from_row_map ( map < string , dynadata > & row_map ) { _primary_db_id = row_map [ " " ] . i_int ; _status = row_map [ " " ] . i_string ; _user_id = row_map [ " " ] . i_int ; _analysis_id = row_map [ " " ] . i_int ; if ( row_map [ " " ] . type == MQDB :: STRING ) { string date_string = row_map [ " " ] . i_string ; _completed = MQDB :: seconds_from_epoch ( date_string ) ; } if ( row_map [ " " ] . type == MQDB :: TIMESTAMP ) { _completed = row_map [ " " ] . i_timestamp ; } if ( row_map [ " " ] . type == MQDB :: STRING ) { string date_string = row_map [ " " ] . i_string ; _created = MQDB :: seconds_from_epoch ( date_string ) ; } if ( row_map [ " " ] . type == MQDB :: TIMESTAMP ) { _created = row_map [ " " ] . i_timestamp ; } }
class level MQDB style fetch methods
class level MQDB style fetch methods
/*
   | job_id       | int(11)                                                 |      | PRI | NULL                | auto_increment |
   | analysis_id  | int(11)                                                 |      | MUL | 0                   |                |
   | user_id      | int(11)                                                 |      |     | 0                   |                |
   | job_claim    | char(40)                                                |      | MUL |                     |                |
   | worker_id    | int(11)                                                 |      | MUL | 0                   |                |
   | status       | enum('READY','BLOCKED','CLAIMED','RUN','DONE','FAILED') |      |     | READY               |                |
   | retry_count  | int(11)                                                 |      |     | 0                   |                |
   | created      | timestamp                                               | YES  |     | CURRENT_TIMESTAMP   |                |
   | completed    | datetime                                                |      |     | 0000-00-00 00:00:00 |                |
   | branch_code  | int(11)                                                 |      |     | 1                   |                |
   | runtime_msec | int(11)                                                 |      |     | 0                   |                |
   | query_count  | int(11)                                                 |      |     | 0                   |                |   
   */ /*
   _taxon_id        = row_map["taxon_id"].i_int;
   _ucsc_name       = row_map["ucsc_name"].i_string;
   _primary_db_id   = row_map["collaboration_id"].i_int;
   _group_uuid      = row_map["uuid"].i_string;
   _owner_identity  = row_map["owner_openid"].i_string;
   _display_name    = row_map["display_name"].i_string;
   _member_status   = row_map["member_status"].i_string;
      
   if(row_map["openID"].type == STRING) {
   if(row_map["openID"].i_string == _owner_identity) { _member_status = "OWNER"; }
   }
   if(_member_status.empty()) { _member_status = "not_member"; }   
   */