Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Feb 26th, 2013  |  syntax: None  |  size: 0.49 KB  |  views: 17  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1.         Member MemberMapper::getMemberByID(int membershipID) const
  2.         {
  3.                 DBControl db;
  4.                 db.connect();
  5.  
  6.                 stringstream id;
  7.                 id << membershipID;
  8.  
  9.                 string SQL = "SELECT * FROM member "
  10.                                          "WHERE membershipID = " + id.str();
  11.  
  12.                 MYSQL_RES* result = db.query(SQL);
  13.  
  14.                 if(mysql_num_rows(result) > 0)
  15.                 {
  16.                         MYSQL_ROW row = mysql_fetch_row(result);
  17.                         return fromRow(row); // Just copies row data to member and returns the object
  18.                 }
  19.                 else
  20.                 {
  21.                         throw InvalidMemberException()
  22.                 }
  23.         }
clone this paste RAW Paste Data