Forum > Databases

IBX : Can it handle database operation when network connection is not stable?

<< < (2/9) > >>

MarkMLl:

--- Quote from: Zvoni on November 24, 2021, 12:33:35 pm ---a "manual" Workaround could be
1) Check Connected-Property before saving. If True everything OK, if False you have no Network.
2) If 1) is answered False, instead of "saving" implement a "queue" (Could be a StringList with the SQL-Statement).
You would also need a Procedure to try to reconnect back (own Thread?). TIBConnection's Ancestor TCustomConnection offers a published "AfterDisconnect"-Event. You could start the reconnect try from there. You would need a logic to exempt this code, if the User really wants to disconnect.
3) TIBConnection's Ancestor TCustomConnection offers a published "AfterConnect"-Event. If in 2) you reconnect successfully, "AfterConnect" should fire, and you could check if there are SQL-Statements waiting in the Queue

--- End quote ---

@Zvoni: can you confirm that the DB-aware grids etc. aren't really suitable for this sort of thing, and that if a user wants to continue to show the current row etc. he should parse/copy the data into standard (i.e. non-DB) components?

MarkMLl

Zvoni:
Mark,

honestly? No Idea. Never used DB-bound controls (never in 20 years of Visual Basic, and never in 4 years of Lazarus),
since i want to do the CRUD's on a Database myself (more fine-control).

But i think you're on the right path.

incendio:
Checking Connected property isn't enough.

When there are a lots of data, such as in the Dbgrid, network connection, could be disconnected and reconnected again during ApplyUpdate process.

Zvoni:
Then the only "fail"-safe method i know of would be to use a local database, which replicates itself to the server if network is available
https://www.firebirdfaq.org/faq249/

MarkMLl:

--- Quote from: Zvoni on November 24, 2021, 01:12:01 pm ---honestly? No Idea. Never used DB-bound controls (never in 20 years of Visual Basic, and never in 4 years of Lazarus), since i want to do the CRUD's on a Database myself (more fine-control).

But i think you're on the right path.

--- End quote ---

Where I've got to in the past is that for real robustness I needed to do app the result parsing myself, in at least one case with scripted control of queries. However there's a real possibility that Delphi/Lazarus developments have moved beyond that, hence the question.

However I'd imagine that a hybrid approach would be viable: use the DB-aware controls for all of the parsing etc. with the result shadowed onto a standard control. If the program has reason to think that the connection is bad (which might take a ping etc.) it switches the shadows to the foreground.

MarkMLl

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version