FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Microservice with Fivewin
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Microservice with Fivewin
Posted: Wed Jul 02, 2025 08:37 AM
Hello,
here again to illustrate the speed (around 130โ€ฏms).
Every change is written immediately to the DBF! USE ( ) โ€“ CLOSE DATA
In the bottom right corner, you can see the beating heart, indicating that the microservice is active.

Worth mentioning: This displayed XBrowse web clone is simply called with xbrowse.html?db=DATABASE_PATH and DBF name โ€“ and everything works just like on the desktop.

And the best part: This is where the microservice writes the data into the DBF โ€“ really simple and robust!

The request file (JSON) is read using memoread(), and then:
if valtype( hReq ) != "H"
   RETURN
endif

cAction := LOWER( hReq["action"] )
cDbf    := hReq["databasePath"]

DO CASE
   CASE cAction == "editrecord"
      DoEditRecord( cDbf, hReq )
   CASE cAction == "addrecord"
      DoAddRecord( cDbf, hReq )
   CASE cAction == "deleterecord"
      DoDeleteRecord( cDbf, hReq )
ENDCASE

FERASE( cPath )

RETURN

//----------------------------------------------------------------------------//

PROCEDURE DoEditRecord( cDbf, h )
   USE ( cDbf ) NEW ALIAS DATA SHARED
   GOTO VAL( h["recordId"] )
   IF !EOF()
      DBRLOCK()
      FIELD->&( h["columnName"] ) := h["newValue"]
      DBUNLOCK()
   ENDIF
   CLOSE DATA
RETURN
Best regards,
Otto

Continue the discussion