[Gambas-user] DataView Help

Christof Thalhofer chrisml at deganius.de
Wed Jul 12 21:23:23 CEST 2023


Am 12.07.23 um 02:38 schrieb BB:

> I don't believe using transaction blocks is the answer here.
> Transactions will guarantee the integrity of the enclosed set of queries
> but does not guarantee that they are all "atomic" from the point of view
> of the database. Christof's algorithm, while logically and technically
> correct looks to me to be suspicious on busy databases. Multiple and
> non-resolvable collisions could occur even for just two connections.

AFAICS the piece of code I wrote, was the (ever used) equivalent of 
INSERT/UPDATE plus RETURNING. And it keeps you from wasting serial 
numbers on errors.

I doubt that INSERT/UPDATE plus RETURNING will protect the users from 
deadlocks more than my construct does.

> The "correct" way to to this in postgresql is to use INSERT/UPDATE
> RETURNING which will return the serial for the inserted record. However
> this is NOT standard SQL. Note also that INSERT ... RETURNING was added
> in MariaDB 10.5.0
> <https://mariadb.com/kb/en/mariadb-1050-release-notes/>, I don't know if
> it is supported properly by MySQL. The RETURNING syntax has been
> supported by SQLite since version 3.35.0 (2021-03-12) and is modelled on
> the postgresql one.

Thanks for the hint! I didn't have that on the screen because I never 
used it.

Alles Gute

Christof Thalhofer

-- 
Dies ist keine Signatur

-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20230712/f149d240/attachment.sig>


More information about the User mailing list