View Issue Details

IDProjectCategoryView StatusLast Update
0034278FPCDatabasepublic2018-10-28 15:28
ReporterThaddy de KoningAssigned ToMichael Van Canneyt 
PrioritynormalSeverityminorReproducibilityhave not tried
Status resolvedResolutionfixed 
PlatformallOSallOS Versionall
Product Version3.3.1Product Build 
Target Version3.2.0Fixed in Version3.3.1 
Summary0034278: feature request: support for sqlite3_open_v2() in all sqlite3 components
DescriptionAll sqlite3 code use sqlite3_open and there is no high level support for sqlite3_open_v2().
The latter is backwards compatible with sqlite3_open but also enables features for VFS and multithreading.
See the sqlite documentation.
Additional Informationwould also mitigate 0034274 as well as other intermittantly surfacing threading problems with sqlite.
TagsNo tags attached.
Fixed in Revision40063
FPCOldBugId
FPCTarget
Attached Files

Relationships

related to 0034274 assignedMichael Van Canneyt SQLite from SQLdb and Multithreading makes some trouble 

Activities

asdf121

2018-09-14 11:28

reporter   ~0110736

Using sqlite3_open_v2() is a good idea as it allows to open a database in read-only mode and somewhere is mentioned, that it should be used for all new code.

But it does not fix the threading issues if sqlite was compiled with threading support (that's the case for my issues):
"If neither flag is specified or if sqlite3_open() or sqlite3_open16() are used instead of sqlite3_open_v2(), then the default mode determined by the compile-time and start-time settings is used."
https://www.sqlite.org/threadsafe.html

Thaddy de Koning

2018-09-14 12:13

reporter   ~0110741

The point is to be able to select the threading mode at runtime using the SQLITE_OPEN_NOMUTEX and SQLITE_OPEN_FULLMUTEX flags. Your example code needs the latter.

Michael Van Canneyt

2018-10-28 15:28

administrator   ~0111637

Fixed. Introduced OpenFlags property.

  // VFS not supported at this time.
  // Do not change the order. See NativeFlags constant in GetSQLiteOpenFlags.

  TSQLiteOpenFlag = (
    sofReadOnly,
    sofReadWrite,
    sofCreate,
    sofNoMutex,
    sofFullMutex,
    sofSharedCache,
    sofPrivateCache,
    sofURI,
    sofMemory
  );
  TSQLiteOpenFlags = set of TSQLiteOpenFlag;

Default is set to
DefaultOpenFlags = [sofReadWrite,sofCreate];

Which should be backwards compatible.

Issue History

Date Modified Username Field Change
2018-09-14 10:02 Thaddy de Koning New Issue
2018-09-14 10:06 Michael Van Canneyt Assigned To => Michael Van Canneyt
2018-09-14 10:06 Michael Van Canneyt Status new => assigned
2018-09-14 11:28 asdf121 Note Added: 0110736
2018-09-14 12:13 Thaddy de Koning Note Added: 0110741
2018-09-19 11:06 Marco van de Voort Relationship added related to 0034274
2018-10-28 15:28 Michael Van Canneyt Fixed in Revision => 40063
2018-10-28 15:28 Michael Van Canneyt Note Added: 0111637
2018-10-28 15:28 Michael Van Canneyt Status assigned => resolved
2018-10-28 15:28 Michael Van Canneyt Fixed in Version => 3.3.1
2018-10-28 15:28 Michael Van Canneyt Resolution open => fixed
2018-10-28 15:28 Michael Van Canneyt Target Version => 3.2.0