Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 1 to 7 of 7 total |
Dataset question and IIS |
Tue, Jul 7 2015 7:26 AM | Permanent Link |
Michael Dreher | Hi,
I am asking for some starting help. 1) I've managed to create and configure an EWB Module. This is because we use Sybase Adaptive Anywhere as the DB system with database connection authentication, which is handled in the module and works fine. The dataset adapter in the module deligates the DB handling to a TDataSet descendant. Loading the tabledata in the EWB browser application fills the dataset and a associated TEdit Component (to make the contents visible) via the dataset property (I can debug the incomming request in the module DLL), local navigation (next/prior) works as expected, but I can't change the data and update the database (the DLL is not called on TDataset::Save command). The main code is this: ------------------------------------------------------- procedure TForm1.Form1Create(Sender: TObject); begin Database.BaseURL := 'datasets'; // namespace -> see config = datasets = default Database.BaseURL := 'customdatasets'; // namespace -> remap to Custom Module LoadFromServer; end; procedure TForm1.ShowLoadProgress; begin Application.Surface.ShowProgress('Loading....'); end; procedure TForm1.LoadFromServer; begin ShowLoadProgress; Database.LoadRows(ds); end; procedure TForm1.btDataSetSaveClick(Sender: TObject); begin ds.Update; // Use this method to begin updating the active row in the dataset. ds.Columns['WGWareGroupDescription'].AsString := 'Verkaufsartikel 2'; ds.Save; // Use this method to complete an Insert or Update operation. end; ------------------------------------------------------- Any idea? 2) What about the primary key definitions of tables(using for UPDATEs and DELETEs); is the TEwbDataSetAdapter able to get the primary key information itself, or do I have to give this information at some place? 3) Our customer want the IIS as the websever. How does the EWB-Module DLL fits in here? Do I have to write an ISAPI Filter or redirect incomming requersts from the IIS when addressing the /// http://<Domain Name>/<Modules Resource Name>/<Module Name> or /// https://<Domain Name>/<Modules Resource Name>/<Module Name> scheme? Regards, Michael Dreher |
Tue, Jul 7 2015 9:00 AM | Permanent Link |
Raul Team Elevate | On 7/7/2015 7:26 AM, Michael Dreher wrote:
> 1) I've managed to create and configure an EWB Module. This is because we use Sybase Adaptive Anywhere as the DB system with database connection authentication, which is handled in the module and works fine. The dataset adapter in the module deligates the DB handling to a TDataSet descendant. > Loading the tabledata in the EWB browser application fills the dataset and a associated TEdit Component (to make the contents visible) via the dataset property (I can debug the incomming request in the module DLL), local navigation (next/prior) works as expected, but I can't change the data and update the database (the DLL is not called on TDataset::Save command). You need to start a transaction and commit in EWB for any data to be sent back to server - otherwise all edits are local to dataset in the EWB itself. See here in manual : http://www.elevatesoft.com/manual?action=viewtopic&id=ewb2&topic=Transactions Raul |
Tue, Jul 7 2015 1:56 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Michael,
<< Loading the tabledata in the EWB browser application fills the dataset and a associated TEdit Component (to make the contents visible) via the dataset property (I can debug the incomming request in the module DLL), local navigation (next/prior) works as expected, but I can't change the data and update the database (the DLL is not called on TDataset::Save command). >> As Raul indicated, you need to use transactions in order to have updates be sent back to the web server application/modules: procedure TForm1.btDataSetSaveClick(Sender: TObject); begin Database.StartTransaction; ds.Update; // Use this method to begin updating the active row in the dataset. ds.Columns['WGWareGroupDescription'].AsString := 'Verkaufsartikel 2'; ds.Save; // Use this method to complete an Insert or Update operation. Database.Commit; end; You can use an Database.OnCommitError event handler to rollback or retry a commit that fails. << 2) What about the primary key definitions of tables(using for UPDATEs and DELETEs); is the TEwbDataSetAdapter able to get the primary key information itself, or do I have to give this information at some place? >> You have to use an event handler for the TEWBDataSetAdapter.OnInitialize event in order to provide this information to the dataset adapter. Here's an example of this from the datasetmodule sample module project included with EWB: procedure TExampleDataSetModule.BiolifeAdapterInitialize( Adapter: TEWBDataSetAdapter); var I: Integer; TempIndexDef: TIndexDef; TempFieldName: String; begin { If we're dealing with a table, then we can go ahead and automatically set the key field information here. If not, then code will have to be manually added to identify the key fields. They key fields are used to when updating the dataset, as well as when loading BLOBs such as images. It should normally correspond to the primary key for the table underlying the dataset, but a unique key can be used also. } Adapter.KeyFields:=''; Adapter.NumKeyFields:=0; if (Adapter.Dataset <> nil) and (Adapter.DataSet is TEDBTable) then begin with TEDBTable(Adapter.DataSet) do begin IndexDefs.Update; TempIndexDef:=nil; for I:=0 to IndexDefs.Count-1 do begin if (ixPrimary in IndexDefs[I].Options) then begin TempIndexDef:=IndexDefs[I]; Break; end; end; if (TempIndexDef=nil) then begin for I:=0 to IndexDefs.Count-1 do begin if (ixUnique in IndexDefs[I].Options) then begin TempIndexDef:=IndexDefs[I]; Break; end; end; end; if (TempIndexDef <> nil) then begin with TempIndexDef do begin I:=1; while (I <= Length(Fields)) do begin TempFieldName:=ExtractFieldName(Fields,I); if (Adapter.KeyFields <> '') then Adapter.KeyFields:=(Adapter.KeyFields+';'); Adapter.KeyFields:=(Adapter.KeyFields+TempFieldName); Adapter.NumKeyFields:=(Adapter.NumKeyFields+1); end; end; end; end; end; end; Queries are a little more difficult, but not by much because updateable queries are normally only a single table. You simply need to know the base table name of the query. << 3) Our customer want the IIS as the websever. How does the EWB-Module DLL fits in here? >> It doesn't, at least for now. You'll have to use the WebBroker functionality included with Delphi to create a WebBroker module instead. However, the good part is that all of the database/dataset adapter code stays the same. If you have any other questions, please let me know. Tim Young Elevate Software www.elevatesoft.com |
Thu, Jul 9 2015 8:03 AM | Permanent Link |
Helli f&t Software GmbH | Michael Dreher's writing (using the account of my boss, because of the support policy update, and this accout has a customer ID).
Thanks for answer. After using the Transaction and setting up the primary key fields (and hours seaching my programm bugs) writing back to the database was successfull. "Tim Young [Elevate Software]" wrote: // Queries are a little more difficult, but not by much because updateable // queries are normally only a single table. You simply need to know the base // table name of the query. I had to use the query component, a TTable descendant is not supported bei our component supplyer (NativeDB). The hard work was to find out the reason for Exceptions in dbAdapter1.HandleRequest(Request,'customdatasets'); like "Invalid Argument" without any info about the context (SQL, paraemeters, keys) or the the invalid argument value itself. // << 3) Our customer want the IIS as the websever. // How does the EWB-Module DLL // fits in here? >> // It doesn't, at least for now. You'll have to use the WebBroker // functionality included with Delphi to create a WebBroker module instead. // However, the good part is that all of the database/dataset adapter code // stays the same. Now I've to move to the IIS without the EWB Server and the TEWBModule, using the WebBroker and the database- and dataset-adaptors. I hope the EWB IDE- and module-manuals are complete in that an extersion DLL for the IIS can be drived from this. Thanks again Michael Dreher |
Thu, Jul 9 2015 12:23 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Michael,
<< Michael Dreher's writing (using the account of my boss, because of the support policy update, and this accout has a customer ID). >> Just so you know, you can have multiple user accounts associated with a given customer ID. Just update your user profile here: http://www.elevatesoft.com/user?action=view using the "Update User Profile" link in the upper-right corner, and set your customer information: Customer # Customer ID Customer Password After you're done, you'll both be able to access any applicable downloads and post on the support forums. << Thanks for answer. After using the Transaction and setting up the primary key fields (and hours seaching my programm bugs) writing back to the database was successfull. >> Good, I'm glad that it’s working for you. << I had to use the query component, a TTable descendant is not supported bei our component supplyer (NativeDB). The hard work was to find out the reason for Exceptions in dbAdapter1.HandleRequest(Request,'customdatasets'); like "Invalid Argument" without any info about the context (SQL, paraemeters, keys) or the the invalid argument value itself. >> Hmm, I'm not sure where that exception is coming from, but it’s not coming directly from our code. You received it with a HandleRequest call ? Do you remember the details of how you called the method when the error occurred ? << Now I've to move to the IIS without the EWB Server and the TEWBModule, using the WebBroker and the database- and dataset-adaptors. I hope the EWB IDE- and module-manuals are complete in that an extersion DLL for the IIS can be drived from this. >> Well, I forgot to mention that you won't be able to still use the HandleRequest method - that uses the TEWBServerRequest class, which is part of the EWB module code. What I may end up doing is just modify the TEWBModule code to support ISAPI DLL generation. Let me look into this further, and I'll see what’s involved. Tim Young Elevate Software www.elevatesoft.com |
Mon, Oct 5 2015 1:22 AM | Permanent Link |
Michael Dreher | Tim,
// "Tim Young [Elevate Software]" wrote: // // Well, I forgot to mention that you won't be able to still use the // HandleRequest method - that uses the TEWBServerRequest class, which is part // of the EWB module code. What I may end up doing is just modify the // TEWBModule code to support ISAPI DLL generation. Let me look into this // further, and I'll see what’s involved. we're still using ewbsrv with the TEWBModule and have to go to the IIS. When do you expect the TEWBModule supports the ISAPI DLL generation? Michael Dreher |
Mon, Oct 5 2015 10:49 AM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Michael,
<< we're still using ewbsrv with the TEWBModule and have to go to the IIS. When do you expect the TEWBModule supports the ISAPI DLL generation? >> I don't know yet. I still have to start putting together the 2.03 list of enhancements, and ISAPI support inclusion depends upon what's going into 2.03 in terms of new controls. Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Friday, December 6, 2024 at 05:39 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |