select() public static method

select('column0', 'column1') => "SELECT column0,column1"
public static select ( $param0 = '*', $_ = null ) : FromRule
$param0 columns
return phprs\ezsql\rules\select\FromRule
Example #1
0
 public function deleteUserByAccount($account)
 {
     $this->db->beginTransaction();
     try {
         $res = Sql::select('uid')->from('uc_members')->where('username=?', $account)->forUpdate()->get($this->db);
         if (count($res) == 0) {
             $this->db->rollBack();
             return false;
         }
         $uid = $res[0]['uid'];
         Sql::deleteFrom('pre_common_member_profile')->where('uid=?', $uid)->exec($this->db);
         Sql::deleteFrom('uc_members')->where('uid=?', $uid)->exec($this->db);
         $this->db->commit();
     } catch (Exception $e) {
         $this->db->rollBack();
         throw $e;
     }
     return true;
 }
Example #2
0
 public function testSelect18()
 {
     // SELECT * FROM tab FOR UPDATE of col
     $this->db->setExpected('SELECT * FROM tab FOR UPDATE OF col');
     Sql::select('*')->from('tab')->forUpdate()->of('col')->get($this->db);
 }