Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 6 of 6 total
Thread Custom module Db connection
Wed, Aug 7 2013 4:42 PMPermanent Link

mex51151

Hi,

i'm really new to Web Builder... i'm tryng to evaluate it. I've looked through the forums and manuals, but i'havent found a response to a doubt.

When i make a custom module (.dll) with Delphi, i've seen that the external Elevate Web Server for every request
1. creates the module,
2. calls OnExecute and then
3. destroys the instance of the module.

So, if i have to use a db, i have to open the connection to db in the oncreate event of the module, and then close the connection in the odDestroy event. And this for every request that comes to dll.

Am i right ? I've understood correctly ? If this is the correct usage, i don't comprehend how i can open a table, make some changes to data with the browser and then commit the changes to db (with the instance of custom module already destoyed after the first request.....).

Thank you !!!
Wed, Aug 7 2013 6:35 PMPermanent Link

Raul

Team Elevate Team Elevate

On 8/7/2013 4:42 PM, mex51151 wrote:
> So, if i have to use a db, i have to open the connection to db in the oncreate event of the module, and then close the connection in the odDestroy event. And this for every request that comes to dll.
> Am i right ? I've understood correctly ? If this is the correct usage, i don't comprehend how i can open a table, make some changes to data with the browser and then commit the changes to db (with the instance of custom module already destoyed after the first request.....).
>

Generally yes - you need to think in terms of web requests here. Meaning
completely stateless and separate requests.

So for edit you would have 2 of these requests (at minimum):

1. request 1 is when you retrieve the data (i.e. sql select basically)
and send it to EWB app (in browser) to display.

2. Assuming user does some editing you would then send the changes back
(EWB TDataSet does this for you) and to you this looks like a new
request so you can commit the changes (e.g. sql update or insert or
delete). This is one reason you need a primary key on the tables so the
2nd request would "know" what to update.

Raul


Thu, Aug 8 2013 4:16 AMPermanent Link

mex51151

Thank you Raul.

In this way, i can't use the db transactions to drive the changes of records. I have to rethink the flow. What scares me it's the (possible) slowness of connecting everytime to some SqlServer / Firebird / Oracle remote database. When i have some master/detail form, and the user scrolls the masters records, i have to respond to a request, finding the details records in db with a sql select. This means possibly a huge number of following connections/select to db.

Until now, i've used Intraweb to make web applications (using Delphi), but i don't like it....

Thanks

Arnaldo
Thu, Aug 8 2013 8:58 AMPermanent Link

Raul

Team Elevate Team Elevate

Arnaldo,

This is what EWB offers out of the box and based on my testing it works
quite well. Note that the browser can still keep the connection alive so
you might not have the delay of making a new http connection every time
(though don't count on that when writing an app Smile

If you need more smarts or scalability in the middle you can look into
either writing a more custom server side yourself (for example with
connection pooling and/or transactions, etc support) or look into
various multi-tier solutions already existing existing (from remobjects
to mORMot to even any non-delphi related ones since you're using ms sql
or oracle)

Raul

On 8/8/2013 4:16 AM, mex51151 wrote:
> In this way, i can't use the db transactions to drive the changes of records. I have to rethink the flow. What scares me it's the (possible) slowness of connecting everytime to some SqlServer / Firebird / Oracle remote database. When i have some master/detail form, and the user scrolls the masters records, i have to respond to a request, finding the details records in db with a sql select. This means possibly a huge number of following connections/select to db.
> Until now, i've used Intraweb to make web applications (using Delphi), but i don't like it....
Thu, Aug 8 2013 2:55 PMPermanent Link

mex51151

Thank you Raul.

i really think that EWB is wonderful for some applications. Now i'm testing it, and my concern is only to find how "far" i can go with EWB, and how much i can "stress" EWB to solve our problems. So, i'm thinking in terms of complex applications, and for our use "complex" means process data of dozens of tables of relational db servers.

Thank you again !

Arnaldo
Wed, Aug 14 2013 1:46 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Arnaldo,

<< i really think that EWB is wonderful for some applications. Now i'm
testing it, and my concern is only to find how "far" i can go with EWB, and
how much i can "stress" EWB to solve our problems. So, i'm thinking in terms
of complex applications, and for our use "complex" means process data of
dozens of tables of relational db servers. >>

Just a quick note: the EWB Server, as is the case with EWB in general, will
slowly evolve into something capable of handling more complex requirements
such as the caching of module instances for better DB connection re-use.
The EWB Server was actually an afterthought and was not intended to be part
of the product, so it's a little "behind the curve".

Tim Young
Elevate Software
www.elevatesoft.com
Image