zend db select
public function fetchById($margin_id, $forupdate = false)
{
if(!is_numeric($margin_id) OR $margin_id <= 0){
throw new Exception("Invalid margin id", BTCChina_ErrorCode::INVALID_PARAMETER);
}
$margin_id = (int)$margin_id;
$select = $this->_db->select()
->from("margin")
->where("margin_id = ?", $margin_id)
->forUpdate($forupdate);
return $this->_db->fetchRow($select);
}