Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 4 of 4 total
Thread TEWBDatabaseAdapter - GetDataSetAdapter
Wed, Jan 21 2015 1:26 AMPermanent Link

Eivind

All

I have been building an EWB project lately that utilizes the TEWBDatSetAdapter and the TEWBDatabaseAdapter components in a Delphi ISAPI dll for IIS. I'm struggling a bit to understand how to best use the GetDataSetAdapter Event that are being called every time a commit is called. In the example project that comes with the components, the code is:

  if AnsiSameText(DataSetName,'Biolife') then
     Adapter:=BiolifeAdapter
  else
     Adapter:=nil;

This works when all users share the same data. However, in a real life application, user logs in and will only be able to access their data. Until now I have been using the Database.Username and Database.Password to get around this from EWB. All requests to the web server has to have a session id. I put the SID in the Username parameter of the database when calling Commit. In the Database.Password I have been putting the master id of the detail table I'm updating. In the "GetDataSetAdapter" in Delphi I'm then using the master id i send in the Database.Password to open the Query and all worked well.

The problem comes when I'm batch updating multiple dataset's in one commit request from EWB. Now I'm getting "Cannot find the row for updating". Obviously because all the affected query's in Delphi need to be opened with the correct id. As the Database class in EWB don't have any params property, how is this done?

Or am I totally misunderstanding how to use the "GetDataSetAdapter" event?

Thanks for any help regarding this

Cheers

Eivind



Sat, Jan 24 2015 4:13 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Eivind,

<< This works when all users share the same data. However, in a real life
application, user logs in and will only be able to access their data. Until
now I have been using the Database.Username and Database.Password to get
around this from EWB. All requests to the web server has to have a session
id. I put the SID in the Username parameter of the database when calling
Commit. In the Database.Password I have been putting the master id of the
detail table I'm updating. In the "GetDataSetAdapter" in Delphi I'm then
using the master id i send in the Database.Password to open the Query and
all worked well.

The problem comes when I'm batch updating multiple dataset's in one commit
request from EWB. Now I'm getting "Cannot find the row for updating".
Obviously because all the affected query's in Delphi need to be opened with
the correct id. As the Database class in EWB don't have any params property,
how is this done? >>

Actually, the TDatabase class does have a Params property (it was added in
1.03 B6).

Are you using the EWB Web Server, or another web server ?

Thanks,

Tim Young
Elevate Software
www.elevatesoft.com
Sun, Jan 25 2015 11:33 AMPermanent Link

Eivind

Tim

Ok, I might not have the latest build. My subscription ended a few month ago. Will renew once the V2.0 is out.

I'm using ISAPI Dll's with IIS by the way. Working perfectly so far... I actually fixed the issue by altering the WebData unit to add more headers with my master / detail key set. Will start using params once I get a hold of V2.0

Cheers

Eivind
Sun, Jan 25 2015 4:31 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Eivind,

<< Ok, I might not have the latest build. My subscription ended a few month
ago. Will renew once the V2.0 is out. >>

That won't make any difference for this issue.

<< I'm using ISAPI Dll's with IIS by the way. >>

Sorry about that - I completely forgot that you already specified your
environment in your first post.  Working too much... Smile

The X-EWBUser and X-EWBPassword headers are sent over with both dataset
"rows" requests and "commit" requests.  I'm working on a solution to dynamic
authentication of dataset "load" requests, which are a hole in the dataset
design because they aren't being triggered from a dynamic server request,
and so can't have custom http headers.

So, as long as you can detect and grab those custom headers in your ISAPI
DLL, then you can use them to authenticate both dataset row request and
commit requests.

These headers come from what you set in the TDatabase.UserName and
TDatabase.Password properties in the EWB client application.

If you have any other questions, please let me know.

Tim Young
Elevate Software
www.elevatesoft.com
Image