Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 6 of 6 total
Thread Receiving info after committing transaction
Sun, Feb 17 2019 10:32 AMPermanent Link


Hi all,
I'm implementing the database API on a IIS web server via a C# interface to an EWB app.
Sometimes I need to insert a row in a table and I need the db generated key (often but not always an integer ID) to insert other related rows in other tables where that is a foreign key.
Waiting for a EWB release where there could be mapped an ID on a return value for OnAfterCommit event I think the only way is executing a two phase commit and emulate an error with a conventional error code sending needed data (the ID) in the html response body and trace (and manage) it on OnCommitError event with a CancelPendingRequests call after managed.
Any different ideas to give a more clean solution? Any other solutions?
Many thanks in advance
Sun, Feb 17 2019 3:38 PMPermanent Link

Walter Matte

Tactical Business Corporation

Sometimes I have a table that holds the next id on server and use a server request to get the next id before I do the insert in EWB (so have I have a unique id.)

Sometimes if I know the table does not get many inserts I use a 64 bit integer as a unique primary key and just use Now to get a large int.      id := integer(now);

Sometimes I have the unique primary key as a Guid and set a Gid in EWB using an external JavaScript to generate it.

Sometimes I make a ServerRequest to a procedure that will insert the record and send me back the unique id which I then use to loadrows for that table for the user to add the data to fields.


Mon, Feb 18 2019 3:26 AMPermanent Link

Matthew Jones

Bill wrote:

> implementing the database API

What I did was implement my own API...


Matthew Jones
Mon, Feb 18 2019 9:38 AMPermanent Link


>"Matthew Jones" wrote:
> What I did was implement my own API...
> Matthew Jones

Hi Matthew, what did you do for passing primary key back to ewb client? Any suggestion?
Tue, Feb 19 2019 11:57 AMPermanent Link

Matthew Jones

Bill wrote:

> passing primary key back

Well, I didn't do any of the EWB mode of database transfer, but used JSON for all my data back and forth. So when I posted an object, the API can return the ID as the result data. I used grids etc but I filled them manually. So it probably doesn't apply directly, but if you can give up the built in data transfers, then you can do what you want, given you are writing your own server code.


Matthew Jones
Fri, Feb 22 2019 2:48 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.


Email timyoung@elevatesoft.com


This is something that is coming soon in EWB 3.  It allows you to set up any SQL to echo any output parameters back to the client, so you can do this with identity/autoinc/generated columns, or any other column that you want.

It's still asynchronous, which is a bit of a pain, but it will allow you to do what you want.

Tim Young
Elevate Software