Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt C++ FireBase Update Unique Value
QtWS25 Last Chance

Qt C++ FireBase Update Unique Value

Scheduled Pinned Locked Moved Unsolved General and Desktop
qt5c++firebasedatabase
2 Posts 2 Posters 493 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O Offline
    O Offline
    OguzhanOzturk
    wrote on 29 Sept 2022, 14:30 last edited by
    #1

    I have a database in FreeBase.

    There is a database structure as in the photo .
    Capture.PNG

    When I want to make changes in the database, I need to change all the data, but I want to change only one data. The codes I wrote below update all the data.

    manager = new QNetworkAccessManager();

    request.setUrl(QUrl("https://xxx/Printers/Syra123/3333.json"));
    request.setHeader(QNetworkRequest::ContentTypeHeader, QVariant("application/json"));

    QVariantMap newPrinter;

    newPrinter["AvailableModels"] = value.getAvailableModels();
    newPrinter["CurrentBedTemp"] = value.getCurrentBedTemp();
    newPrinter["CurrentNozzleTemp"] = value.getCurrentNozzleTemp();
    newPrinter["Percentage"] = value.getPercentage();
    newPrinter["PrintedTime"] = value.getPrintTime();
    newPrinter["PrinterStatus"] = value.getPrinterStatus();
    newPrinter["PrintingStatus"] = value.getPrintingStatus();
    newPrinter["SelectedBedTemp"] = value.getSelectedBedTemp();
    newPrinter["SelectedModel"] = value.getSelectedModel();
    newPrinter["SelectedNozzleTemp"] = value.getSelectedNozzleTemp();
    newPrinter["SelectedPositionX"] = value.getSelectedNozzleX();
    newPrinter["SelectedPositionY"] = value.getSelectedNozzleY();
    newPrinter["SelectedPositionZ"] = value.getSelectedNozzleZ();
    newPrinter["SelectedPrintSpeed"] = value.getSelectedPrintSpeed();
    newPrinter["SelectedPrintingStatus"] = value.getSelectedPrintingStatus();
    newPrinter["StartingTime"] = value.getStartingTime();
    
    QJsonDocument jsonDoc = QJsonDocument::fromVariant(newPrinter);
    
    manager->put(request,jsonDoc.toJson());
    

    When I write and send only one data, it destroys all other values ​​in the database and only the data I sent remains. How can I change only the data I want without deleting the data in the DataBase?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 29 Sept 2022, 18:12 last edited by
      #2

      Hi,

      Not knowing the FreeBase API it's hard to answer. Do you have a link of it ?

      In any case, the worst case scenario would be to fetch the whole data, change the fields you want and then send again the whole data.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0

      1/2

      29 Sept 2022, 14:30

      • Login

      • Login or register to search.
      1 out of 2
      • First post
        1/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved