phprs\ezsql\Sql::deleteFrom PHP Method

deleteFrom() public static method

deleteFrom('table') => "DELETE FROM table"
public static deleteFrom ( string $table ) : WhereRule
$table string
return phprs\ezsql\rules\basic\WhereRule
    public static function deleteFrom($table)
    {
        $obj = new DeleteRule(new SqlConetxt());
        return $obj->deleteFrom($table);
    }

Usage Example

Ejemplo n.º 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;
 }
All Usage Examples Of phprs\ezsql\Sql::deleteFrom