function update($tableName, $arUpdates, $sWhere = null) {
   $arSet = array();
   foreach($arUpdates as $name => $value) {
      $arSet[] = $name . ' = ' . $this->conn->quoteSmart($value);
   }
   $sSet = implode(', ', $arSet);

   // cytuje nazw tabeli
   $tableName = $this->conn->quoteIdentifier($tableName);

   $sql = "UPDATE $tableName SET $sSet";
   if($sWhere) {
      $sql .= " WHERE $sWhere";
   }

   $result = $this->conn->query($sql);

   if(DB::isError($result)) {
      throw new Exception($result->getMessage(), $result->getCode());
   }

   // zwraca liczb wierszy, na ktre zapytanie miao wpyw
   return $this->conn->affectedRows();
}