Recent

Author Topic: Realtime Database  (Read 1008 times)

sergio.garcia

  • Newbie
  • Posts: 2
Realtime Database
« on: September 29, 2022, 05:41:35 pm »
Please, does anyone know how to authenticate and access Firebase's Realtime database through Lazarus? Thanks
« Last Edit: September 29, 2022, 05:46:21 pm by sergio.garcia »

Thaddy

  • Hero Member
  • *****
  • Posts: 14214
  • Probably until I exterminate Putin.
Re: Realtime Database
« Reply #1 on: September 29, 2022, 06:01:08 pm »
FireBIRD is not a good idea for real time or near-real time access. Use a proper database ( and yes that is expensive)
Specialize a type, not a var.

Zoran

  • Hero Member
  • *****
  • Posts: 1829
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: Realtime Database
« Reply #2 on: September 29, 2022, 09:10:07 pm »
FireBIRD is not a good idea for real time or near-real time access. Use a proper database ( and yes that is expensive)

Thaddy, the question is about Google's Firebase Realtime Database, not Firebird.

Zvoni

  • Hero Member
  • *****
  • Posts: 2319
Re: Realtime Database
« Reply #3 on: September 30, 2022, 08:23:00 am »
Since FireBase is a NoSQL-Database --> https://forum.lazarus.freepascal.org/index.php?topic=36965.0
mORMot?
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

Leledumbo

  • Hero Member
  • *****
  • Posts: 8747
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Realtime Database
« Reply #4 on: October 12, 2022, 11:25:24 am »
Fortunately, Google always implements things in language independent way, despite providing easy to use wrappers for certain languages.
Rest API is the way to go. Follow all steps in that link then you can turn the cURL commands into the equivalent for fphttpclient or whatever HTTP client library of your choice. After all, that's what the wrappers do.

For instance, the example:
Code: Bash  [Select][+][-]
  1. curl -X PUT -d '{
  2.  "alanisawesome": {
  3.    "name": "Alan Turing",
  4.    "birthday": "June 23, 1912"
  5.  }
  6. }' 'https://docs-examples.firebaseio.com/fireblog/users.json'
  7.  
is equivalent to:
Code: Pascal  [Select][+][-]
  1. uses
  2.   fphttpclient,fpjson;
  3. ...
  4. var
  5.    obj: TJSONObject;
  6. ...
  7. with TFPHTTPClient.Create(nil) do
  8.   try
  9.     obj := TJSONObject.Create;
  10.     obj.Strings['author'] := 'alanisawesome';
  11.     obj.Strings['title'] := 'The Turing Machine';
  12.     RequestBody := TRawByteStringStream.Create(obj.AsJSON);
  13.     obj.Free;
  14.  
  15.     WriteLn(Put('https://docs-examples.firebaseio.com/fireblog/users.json'));
  16.   finally
  17.     Free;
  18.   end;
  19.  

 

TinyPortal © 2005-2018