
SQLite open shared
SQLite open shared
How to open SQLite Database as shared 

My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Re: SQLite open shared
In general: bad idea.
It is not build for multi user usage.
There is no record locking and so on.
But there are attempts to do it.
http://purebasic.fr/english/viewtopic.php?f=14&t=43203
http://www.purebasic.fr/english/viewtop ... 14&t=63738
Bernd
It is not build for multi user usage.
There is no record locking and so on.
But there are attempts to do it.
http://purebasic.fr/english/viewtopic.php?f=14&t=43203
http://www.purebasic.fr/english/viewtop ... 14&t=63738
Bernd
Re: SQLite open shared
I mean this
https://www.sqlite.org/lockingv3.html#shared_lock
I think Purebasic open database as unlocked
https://www.sqlite.org/lockingv3.html#shared_lock
I think Purebasic open database as unlocked
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Re: SQLite open shared
I am looking into this at the moment as well.
This article states the SQLite can be used for multiple concurrent read connections, but only a single write connection. https://www.sqlite.org/whentouse.html. From using PB, it appears the database is locked, even when only reading from the database.
mk-soft, are you planning on accessing the database via network share?
This article states the SQLite can be used for multiple concurrent read connections, but only a single write connection. https://www.sqlite.org/whentouse.html. From using PB, it appears the database is locked, even when only reading from the database.
mk-soft, are you planning on accessing the database via network share?
Re: SQLite open shared
Hi,
maybe this helps:
See here:
https://www.sqlite.org/pragma.html
Bernd
maybe this helps:
Code: Select all
UseSQLiteDatabase()
DB = OpenDatabase(#PB_Any, ":memory:", "", "")
If DB
If DatabaseUpdate(DB, "PRAGMA query_only=true") = 0
Debug DatabaseError()
EndIf
If DatabaseUpdate(DB, "CREATE TABLE test (text VARCHAR(255))") = 0
Debug DatabaseError()
EndIf
If DatabaseUpdate(DB, "PRAGMA query_only=false") = 0
Debug DatabaseError()
EndIf
If DatabaseUpdate(DB, "CREATE TABLE test (text VARCHAR(255))") = 0
Debug DatabaseError()
Else
Debug "Created"
EndIf
CloseDatabase(DB)
EndIf
https://www.sqlite.org/pragma.html
Bernd
Re: SQLite open shared
Maybe you have to set the PRAGMA locking_mode to NORMAL.
Maybe it is set to EXCLUSIVE by PB.
Bernd
Maybe it is set to EXCLUSIVE by PB.
Bernd
Re: SQLite open shared
What about Write-Ahead Logging https://www.sqlite.org/wal.html?
This appears to be working as intended, but I haven't tested it yet. Would this create the desired result of concurrent access?
Code: Select all
If DatabaseUpdate(DB, "PRAGMA journal_mode=WAL") = 0
Debug DatabaseError()
EndIf
Re: SQLite open shared
I think it´s a question to Fred.
Needed an optional parameter for open database as shared.
Needed an optional parameter for open database as shared.
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Re: SQLite open shared
Hi,
I think you are wrong.
This SHARED is only handled internal of SQLite.
Read 5.0 Writing to a database file on the link you provided above.
I think it has nothing todo with how you open the database file.
Bernd
I think you are wrong.
This SHARED is only handled internal of SQLite.
Read 5.0 Writing to a database file on the link you provided above.
I think it has nothing todo with how you open the database file.
Bernd