There are frequently questions about how to get the results of a REST query (JSON) into a database table. This can of course be done manually, by using the „while not EOF do“ approach, but there are actually components in Delphi that make this job relatively easy and flexible.
So I created a video, demonstrating how to take the JSON response of a REST request and insert it into a database table.
I am using TFDMemTable, TFDQuery, and TFDBatchmove to move the data from the original TRESTResponse into an SQLite table – just by using FireDAC components.
There are frequently questions about how to get the results of a REST query (JSON) into a database table. This can of course be done manually, by using the „while not EOF do“ approach, but there are actually components in Delphi that make this job relatively easy and flexible.
So I created a video, demonstrating how to take the JSON response of a REST request and insert it into a database table.
I am using TFDMemTable, TFDQuery, and TFDBatchmove to move the data from the original TRESTResponse into an SQLite table – just by using FireDAC components.
In this video, I will guide you through the steps to get your Delphi app published in Microsoft’s App Store. For this demonstration, I will use a Firemonkey app, but technically the same thing would work with VCL apps as well.
This is the appx that I published and got certified by Microsoft. It’s a simple Hash calculator. Nothing too fancy, but useful enough to successfully pass Microsoft’s verification procedures: Microsoft Store – HashExpert
In this video, I will guide you through the steps to get your Delphi app published in Microsoft’s App Store. For this demonstration, I will use a Firemonkey app, but technically the same thing would work with VCL apps as well.
This is the appx that I published and got certified by Microsoft. It’s a simple Hash calculator. Nothing too fancy, but useful enough to successfully pass Microsoft’s verification procedures: Microsoft Store – HashExpert
In this episode of my „Delphi Quick Thoughts“ series, I am demonstrating how to connect to a WordPress site from Delphi. I am using CData’s WordPress Enterprise connector for that.
CData has more than one hundred „Enterprise Connectors“ that connect to almost every data source, that you can imagine: SAP, Twillio, WordPress, ActiveDirectory, SalesForce – just to name a few. These Connectors are implemented as FireDAC drivers. In other words, you can talk to all of these data sources by using SQL Queries and/or Stored Procedures, you don’t have to learn new syntaxes and components but just check the available schema and methods.
You can download the sources that I used in the video here. Note: I left the app id and secret in the sources for your references but changed them on my server, so the app won’t be able to connect to my server anymore. You will need your own WordPress instance that is.
Mein Beitrag, der um 17:00 MESZ zu sehen war, behandelt das das Thema TMessage und TMessageDlg: Wie triggert man aus Businesslogik Benutzerabfragen ohne sich an die UI zu koppeln?
Weiterhin gibt es noch zahlreiche interessante Beiträge meiner Kollegen Matthias Eißing, Dr. Holger Flick, Volker Hillmann, Frank Lauter, Olaf Monien, Uwe Raabe, Bernd Ua und Daniel Wolf.
Die Anmeldung, der Zeitplan und weitere Informationen finden sich auf der CodeRage Seite.
Last week I had my „Threading and Performance Tuning“ lecture at Embarcadero Academy. It was an interesting experience and it looks like I’ll be using that platform for more courseware in the near future.
So if you are interested in how to work with TThread and TTask in Delphi, then feel free to checkout my lecture at Embarcadero Academy.
Below is the replay of the live Q&A session, which is a good teaser on what to expect in the full lecture. (The sound is a little bit flakey, as it was recorded live. The actual lectures have better sound)
Many Delphi applications, esp. mobile iOS or Android apps, are using REST, to retrieve data from a backend. Often TRESTClient and TRESTRequest are used to get access to an external REST api. There several Blogs and CodeRage videos (including from me), that demonstrate how to do this. Even the Delphi online documentation has a fairly simple tutorial on this topic:
Most of these sample have on thing in common: They are slower as possible!
Most REST APIs are hosted on more or less modern WEb server, be it IIS, Apache, Nginx or whatever. All those support HTTP(S) compression. The actual api implementation usually doesn’t know about that.
Following the example from Delphi’s documentation, after executing the following request from a Webbrowser and investigating the transferred data in the browser’s Web console, you will probably think like „Excellent, that chatty XML has been compressed down to just about 10%“. And indeed this may result in an important speedup for your app.
In Firefox‘ Web Console you can easily identify the compression – obviously the XML data is shrunk down to less than 10%:
Komprimierte Daten
If you now do the same test with Delphi’s RESTDebugger (which internally uses TRESTClient), then the problem gets apparent immediately:
Clearly, data is transferred uncompressed here – slowly that is. The reason is, that an HTTP-Sever usually doesn’t compress data „just so“. The browser/client has to ask for it. Common Web browsers automatically ask the server to compress data. Delphi’s TRESTClient does not do this automatically.
Solution:
procedure TForm1.Button1Click(Sender: TObject);
var
LValue:TJSONValue;
begin
RESTRequest1.AcceptEncoding := 'gzip, deflate, br';
RESTRequest1.Execute;
LValue:=RESTResponse1.JSONValue;
MemoContent.Text:= LValue.ToString;
end;
This asks the Web server to compress data, preferably using „gzip“. You can try that in Delphi’s RESTDebugger by adding a „Header Parameter“ like that:
and – surprise – the server sends back compressed data:
Setting Accept-Encoding via TRESTRequest.AcceptEncoding or via Header-Parameter, does not matter. Important though, check that “ Do not encode“ checkbox in RESTDebugger. Or set „DoNotEncode“ in your source code (without that, the spaces and commas will be URL encoded) :
//Either like this
LRequest.AcceptEncoding := 'gzip, deflate, br';
//OR like this
LParam := LRequest.Params.AddHeader('Accept-Encoding', 'br, gzip, deflate');
LParam.Options := [poDoNotEncode];
//-->> same result!
Hinweispflicht zu Cookies
Webseitenbetreiber müssen, um Ihre Webseiten DSGVO konform zu publizieren, ihre Besucher auf die Verwendung von Cookies hinweisen und darüber informieren, dass bei weiterem Besuch der Webseite von der Einwilligung des Nutzers
in die Verwendung von Cookies ausgegangen wird.
Der eingeblendete Hinweis Banner dient dieser Informationspflicht.
Sie können das Setzen von Cookies in Ihren Browser Einstellungen allgemein oder für bestimmte Webseiten verhindern.
Eine Anleitung zum Blockieren von Cookies finden Sie
hier.