wepApp, how is excecuted the code ?

hi, if i have a webPage with a webButtonA
in this webButtonA there is a lot of code that changes datas in database …
for example
… retrive 1000 record
… cicle from first to last record and make changes on each of these records and then save the changes
… then close this recordset
the execution of all of this code employes 10 minutes

suppose that a customer, open my webPage (of my webApp) then click on webButtonA
the code contained in webButtonA is now excecuted
but now the customer close his browser, or connection from customer browser and webApp go down (and session.timout is generated)
and it is past only 2 minutes (in this time the code has processed only 200 records)
the webApp stops the executinig of the code conteined in webButtonA or not ???

if yes, how can i prevent this problem ?

Do the processing in a Thread. Since the thread is not connected to a Session, it will run to completion.

Alternatively, you might get better performance by having your web app call a “helper” console app on the web server to do this processing.

thakk you, ok i think that best way is call a thread, if thread is not legacy to the life of the session.
my othe ask is this :
i have this potential problem for any data manipulation code ?
if i have a small code, but the db i very slovely, and connection from client browser and webapp going down, i must encapsulate all
data manipulation code in n. different threads ??

I had the same issue, I was uploading data from a txt file into a Sqlite database and was commiting (db.Commit) after each inserted or modified record.

For a file with 5000 records this process took about 15 minutes. I changed the code to commit only if the last record was inserted/modified and the process-log contained no errors. Now the whole process of uploading data to the webapp takes only a few seconds.

[quote=114716:@Jury Buono]if i have a small code, but the db i very slovely, and connection from client browser and webapp going down, i must encapsulate all
data manipulation code in n. different threads ??[/quote]
Only long-running code needs to be considered for a thread. If all your DB code is taking a long time to run, perhaps you can re-think your DB design to improve it. Or do as Jacco recommends and make use of transactions to improve performance.

ok.
can you advise me a good manual for best pratice of developing webApp that useing db, in Xojo ?

I learned from the desktop examples. In a web app this works pretty much the same. In this post you find a simple add-update-delete records example: https://forum.xojo.com/2630-example-project-using-xojo-s-sqlitedatabase/0

http://great-white-software.com/rblibrary/index.php?main_page=product_info&cPath=12&products_id=130 is a manual by Eugene, for Sqlite databases with Xojo, 300 pages for 9 dollars. A lot can be used for web Apps.