1. Ferdinand Fischer
  2. PowerBuilder
  3. Friday, 14 June 2019 22:20 PM UTC

Hi,

after watching the webinar i have been thinkinhg about how  one could use rest for database interaction as first step to make an application 3 tier.

Doing that i have not found a solution on how to do that with embedded sql and datawindow /datastore retrieval.

 

embedded sq:

I have found nothing about using embedded sql through a rest service.

 

datawindow /datastore retrieval:

There is the RestClient,that can be used to fill a datawindow with a rest service.

But you would have to replace every .retrieve with RestClient.Retrieve.

You could maybe make some abstraction, but you still have to change every retrieve by hand, since you cant overwrite methods with var list argumenst or create youre own.

 

Am i missing something or how you do it?

 

Thanks

 

Ferdinand

 

 

 

 

Armeen Mazda @Appeon Accepted Answer Pending Moderation
  1. Friday, 14 June 2019 23:50 PM UTC
  2. PowerBuilder
  3. # 1

Hi, Sorry, the webinar was not meant to be an in-depth or complete tutorial.  There is only so much that can be covered in short time.  Anyway, what you are outlining is not a problem, but of course you need to make changes to the existing code on the client.

Basically, you would move the embedded SQL and related logic from the client into your new C# Web API.  We provide a SQLExecutor object to execute the SQL in C# using the DataContext (equivalent to transaction object in PowerScript).  With the SQLExecutor, only minor changes required to the syntax of your embedded SQL.

Comment
There are no comments made yet.
Roland Smith Accepted Answer Pending Moderation
  1. Saturday, 15 June 2019 03:37 AM UTC
  2. PowerBuilder
  3. # 2

REST is more of a design philosophy than anything technical. In practical terms it is using HTTP to transmit JSON formatted text between a client and server.

PB 2017 helped by adding JSON import/export to the DataWindow/DataStore and by adding the HTTPClient object.

 

Comment
There are no comments made yet.
Sivaprakash BKR Accepted Answer Pending Moderation
  1. Monday, 17 June 2019 06:18 AM UTC
  2. PowerBuilder
  3. # 3

Yes, something simpler, with no changes in the way we used to update the dw, would have been better.

Say

sqlca.dbms = 'REST ...'
sqlca.URL = 'x123.com'   or 
sqlca.dbparm = 'x123.com'   [  somewhere inside dbparm ]

and no changes in the dw_1.update() statement.  

Happiness Always
BKR Sivaprakash

 

Comment
  1. Roland Smith
  2. Monday, 17 June 2019 13:17 PM UTC
You could implement that yourself in the ancestor objects.
  1. Helpful
There are no comments made yet.
Kevin Ridley Accepted Answer Pending Moderation
  1. Monday, 17 June 2019 18:10 PM UTC
  2. PowerBuilder
  3. # 4

Adding to what Roland said, you can setup REST services that pass JSON back and forth using the ImportJSON and ExportJSON  methods, similar to how EA Server did it back in the day with GetFullState and SetFullState blobs.  The JSON can contain all of the state info or can be just plain JSON.  It's also nice using JSON if you ever end up replacing the PB client, your service layer can stay basically the same (minus passing state in the JSON)

 

For the READ operation, your service will do a retrieve, then ds.ExportJSON and return the JSON

CREATE and UPDATE operations will take JSON from the client and use ds.ImportJSON, then ds.Update() (Note: the JSON will contain the state info so the ds will know if it needs to do inserts or update.

DELETE is easy, just take a key id value and do a Delete with SQL in your service.

 

KR

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.