Results 1 to 3 of 3

Thread: SQLite en transactions

  1. #1
    John Kuiper
    Join Date
    Apr 2007
    Location
    Almere
    Posts
    8,747

    SQLite en transactions

    Ik maak een demo met een SQLite database en SQLdb. Nu heb ik gemerkt dat met SQLite geen gebruik gemaakt kan worden van meer transactions.

    Voorbeeld:
    Ik heb een form met twee DBLookupboxes. Daar hangt voor elke lookup een listtabel aan. Maar als ik elk component individueel een transaction component geef, krijg ik de melding : A transaction can not start within a transaction.

    Heeft dat te maken dat een SQLite database gemaakt is voor 1 gebruiker per keer?

    Zover ik heb gemerkt heb ik geen problemen met Firedbird Embedded.
    Delphi is great. Lazarus is more powerfull

  2. #2
    https://stackoverflow.com/questions/...tabase-connect

    In SQLite, one connection corresponds to one transaction. To get separate transactions, you need separate connections.
    Multiple independant transation in same single connexion simply does not make sense: since you use the same connection, every other transaction is seen by the database as nested in the already existing one, so the error.
    Overigens zijn ze volgens mij wel bezig met nested transactions.
    Nested transaction support was added in silverstripe/silverstripe-sqlite3#39, though there's not been a tag since then.
    https://github.com/silverstripe/silv...ned/issues/152
    https://github.com/silverstripe/silv...qlite3/pull/39

    Geen idee of dat het probleem op zou lossen.

    PS. Overigens staat dat ook duidelijk hier:
    No Isolation Between Operations On The Same Database Connection

    SQLite provides isolation between operations in separate database connections. However, there is no isolation between operations that occur within the same database connection.

    In other words, if X begins a write transaction using BEGIN IMMEDIATE then issues one or more UPDATE, DELETE, and/or INSERT statements, then those changes are visible to subsequent SELECT statements that are evaluated in database connection X. SELECT statements on a different database connection Y will show no changes until the X transaction commits. But SELECT statements in X will show the changes prior to the commit.
    https://www.sqlite.org/isolation.html
    Last edited by rvk; 24-May-18 at 12:12.

  3. #3
    John Kuiper
    Join Date
    Apr 2007
    Location
    Almere
    Posts
    8,747
    Daar was ik inmiddels achter gekomen, maar heb nu bevestiging

    Had alleen even geen tijd om het uit te zoeken. Heb het demo app zaterdag nodig. Inmiddels werken alle tabellen op 1 transaction.
    In het verleden had ik nog al last van data, die niet werd geupdatet. Daardoor maak ik bij FB gebruik van verschillende transactions.
    Delphi is great. Lazarus is more powerfull

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •