@powersync/web 1.38.6 → 1.39.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.umd.js CHANGED
@@ -1564,6 +1564,198 @@ class Lock {
1564
1564
  }
1565
1565
 
1566
1566
 
1567
+ /***/ },
1568
+
1569
+ /***/ "../../node_modules/.pnpm/@journeyapps+wa-sqlite@1.7.0/node_modules/@journeyapps/wa-sqlite/src/examples/MemoryVFS.js"
1570
+ /*!***************************************************************************************************************************!*\
1571
+ !*** ../../node_modules/.pnpm/@journeyapps+wa-sqlite@1.7.0/node_modules/@journeyapps/wa-sqlite/src/examples/MemoryVFS.js ***!
1572
+ \***************************************************************************************************************************/
1573
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
1574
+
1575
+ __webpack_require__.r(__webpack_exports__);
1576
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1577
+ /* harmony export */ MemoryVFS: () => (/* binding */ MemoryVFS)
1578
+ /* harmony export */ });
1579
+ /* harmony import */ var _FacadeVFS_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../FacadeVFS.js */ "../../node_modules/.pnpm/@journeyapps+wa-sqlite@1.7.0/node_modules/@journeyapps/wa-sqlite/src/FacadeVFS.js");
1580
+ /* harmony import */ var _VFS_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../VFS.js */ "../../node_modules/.pnpm/@journeyapps+wa-sqlite@1.7.0/node_modules/@journeyapps/wa-sqlite/src/VFS.js");
1581
+ // Copyright 2024 Roy T. Hashimoto. All Rights Reserved.
1582
+
1583
+
1584
+
1585
+ // Sample in-memory filesystem.
1586
+ class MemoryVFS extends _FacadeVFS_js__WEBPACK_IMPORTED_MODULE_0__.FacadeVFS {
1587
+ // Map of existing files, keyed by filename.
1588
+ mapNameToFile = new Map();
1589
+
1590
+ // Map of open files, keyed by id (sqlite3_file pointer).
1591
+ mapIdToFile = new Map();
1592
+
1593
+ static async create(name, module) {
1594
+ const vfs = new MemoryVFS(name, module);
1595
+ await vfs.isReady();
1596
+ return vfs;
1597
+ }
1598
+
1599
+ constructor(name, module) {
1600
+ super(name, module);
1601
+ }
1602
+
1603
+ close() {
1604
+ for (const fileId of this.mapIdToFile.keys()) {
1605
+ this.jClose(fileId);
1606
+ }
1607
+ }
1608
+
1609
+ /**
1610
+ * @param {string?} filename
1611
+ * @param {number} fileId
1612
+ * @param {number} flags
1613
+ * @param {DataView} pOutFlags
1614
+ * @returns {number|Promise<number>}
1615
+ */
1616
+ jOpen(filename, fileId, flags, pOutFlags) {
1617
+ const url = new URL(filename || Math.random().toString(36).slice(2), 'file://');
1618
+ const pathname = url.pathname;
1619
+
1620
+ let file = this.mapNameToFile.get(pathname);
1621
+ if (!file) {
1622
+ if (flags & _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_OPEN_CREATE) {
1623
+ // Create a new file object.
1624
+ file = {
1625
+ pathname,
1626
+ flags,
1627
+ size: 0,
1628
+ data: new ArrayBuffer(0)
1629
+ };
1630
+ this.mapNameToFile.set(pathname, file);
1631
+ } else {
1632
+ return _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_CANTOPEN;
1633
+ }
1634
+ }
1635
+
1636
+ // Put the file in the opened files map.
1637
+ this.mapIdToFile.set(fileId, file);
1638
+ pOutFlags.setInt32(0, flags, true);
1639
+ return _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_OK;
1640
+ }
1641
+
1642
+ /**
1643
+ * @param {number} fileId
1644
+ * @returns {number|Promise<number>}
1645
+ */
1646
+ jClose(fileId) {
1647
+ const file = this.mapIdToFile.get(fileId);
1648
+ this.mapIdToFile.delete(fileId);
1649
+
1650
+ if (file.flags & _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_OPEN_DELETEONCLOSE) {
1651
+ this.mapNameToFile.delete(file.pathname);
1652
+ }
1653
+ return _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_OK;
1654
+ }
1655
+
1656
+ /**
1657
+ * @param {number} fileId
1658
+ * @param {Uint8Array} pData
1659
+ * @param {number} iOffset
1660
+ * @returns {number|Promise<number>}
1661
+ */
1662
+ jRead(fileId, pData, iOffset) {
1663
+ const file = this.mapIdToFile.get(fileId);
1664
+
1665
+ // Clip the requested read to the file boundary.
1666
+ const bgn = Math.min(iOffset, file.size);
1667
+ const end = Math.min(iOffset + pData.byteLength, file.size);
1668
+ const nBytes = end - bgn;
1669
+
1670
+ if (nBytes) {
1671
+ pData.set(new Uint8Array(file.data, bgn, nBytes));
1672
+ }
1673
+
1674
+ if (nBytes < pData.byteLength) {
1675
+ // Zero unused area of read buffer.
1676
+ pData.fill(0, nBytes);
1677
+ return _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_IOERR_SHORT_READ;
1678
+ }
1679
+ return _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_OK;
1680
+ }
1681
+
1682
+ /**
1683
+ * @param {number} fileId
1684
+ * @param {Uint8Array} pData
1685
+ * @param {number} iOffset
1686
+ * @returns {number|Promise<number>}
1687
+ */
1688
+ jWrite(fileId, pData, iOffset) {
1689
+ const file = this.mapIdToFile.get(fileId);
1690
+ if (iOffset + pData.byteLength > file.data.byteLength) {
1691
+ // Resize the ArrayBuffer to hold more data.
1692
+ const newSize = Math.max(iOffset + pData.byteLength, 2 * file.data.byteLength);
1693
+ const data = new ArrayBuffer(newSize);
1694
+ new Uint8Array(data).set(new Uint8Array(file.data, 0, file.size));
1695
+ file.data = data;
1696
+ }
1697
+
1698
+ // Copy data.
1699
+ new Uint8Array(file.data, iOffset, pData.byteLength).set(pData.subarray());
1700
+ file.size = Math.max(file.size, iOffset + pData.byteLength);
1701
+ return _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_OK;
1702
+ }
1703
+
1704
+ /**
1705
+ * @param {number} fileId
1706
+ * @param {number} iSize
1707
+ * @returns {number|Promise<number>}
1708
+ */
1709
+ jTruncate(fileId, iSize) {
1710
+ const file = this.mapIdToFile.get(fileId);
1711
+
1712
+ // For simplicity we don't make the ArrayBuffer smaller.
1713
+ file.size = Math.min(file.size, iSize);
1714
+ return _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_OK;
1715
+ }
1716
+
1717
+ /**
1718
+ * @param {number} fileId
1719
+ * @param {DataView} pSize64
1720
+ * @returns {number|Promise<number>}
1721
+ */
1722
+ jFileSize(fileId, pSize64) {
1723
+ const file = this.mapIdToFile.get(fileId);
1724
+
1725
+ pSize64.setBigInt64(0, BigInt(file.size), true);
1726
+ return _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_OK;
1727
+ }
1728
+
1729
+ /**
1730
+ * @param {string} name
1731
+ * @param {number} syncDir
1732
+ * @returns {number|Promise<number>}
1733
+ */
1734
+ jDelete(name, syncDir) {
1735
+ const url = new URL(name, 'file://');
1736
+ const pathname = url.pathname;
1737
+
1738
+ this.mapNameToFile.delete(pathname);
1739
+ return _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_OK;
1740
+ }
1741
+
1742
+ /**
1743
+ * @param {string} name
1744
+ * @param {number} flags
1745
+ * @param {DataView} pResOut
1746
+ * @returns {number|Promise<number>}
1747
+ */
1748
+ jAccess(name, flags, pResOut) {
1749
+ const url = new URL(name, 'file://');
1750
+ const pathname = url.pathname;
1751
+
1752
+ const file = this.mapNameToFile.get(pathname);
1753
+ pResOut.setInt32(0, file ? 1 : 0, true);
1754
+ return _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_OK;
1755
+ }
1756
+ }
1757
+
1758
+
1567
1759
  /***/ },
1568
1760
 
1569
1761
  /***/ "../../node_modules/.pnpm/@journeyapps+wa-sqlite@1.7.0/node_modules/@journeyapps/wa-sqlite/src/examples/OPFSWriteAheadVFS.js"
@@ -5469,10 +5661,8 @@ class RawSqliteConnection {
5469
5661
  * The `sqlite3*` connection pointer.
5470
5662
  */
5471
5663
  db = 0;
5472
- _moduleFactory;
5473
5664
  constructor(options) {
5474
5665
  this.options = options;
5475
- this._moduleFactory = _vfs_js__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_MODULE_FACTORIES[this.options.vfs];
5476
5666
  }
5477
5667
  get isOpen() {
5478
5668
  return this.db != 0;
@@ -5482,17 +5672,14 @@ class RawSqliteConnection {
5482
5672
  this.db = await api.open_v2(this.options.dbFilename, this.options.isReadOnly ? 1 /* SQLITE_OPEN_READONLY */ : 6 /* SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE */);
5483
5673
  await this.executeRaw(`PRAGMA temp_store = ${this.options.temporaryStorage};`);
5484
5674
  if (this.options.encryptionKey) {
5485
- const escapedKey = this.options.encryptionKey.replace("'", "''");
5486
- await this.executeRaw(`PRAGMA key = '${escapedKey}'`);
5675
+ const escapedKey = this.options.encryptionKey.replaceAll("'", "''");
5676
+ await this.executeRaw(`PRAGMA key = '${escapedKey}';`);
5487
5677
  }
5488
5678
  await this.executeRaw(`PRAGMA cache_size = -${this.options.cacheSizeKb};`);
5489
5679
  await this.executeRaw(`SELECT powersync_update_hooks('install');`);
5490
5680
  }
5491
5681
  async openSQLiteAPI() {
5492
- const { module, vfs } = await this._moduleFactory({
5493
- dbFileName: this.options.dbFilename,
5494
- encryptionKey: this.options.encryptionKey
5495
- });
5682
+ const { module, vfs } = await (0,_vfs_js__WEBPACK_IMPORTED_MODULE_1__.loadModuleAndVfs)(this.options);
5496
5683
  const sqlite3 = (0,_journeyapps_wa_sqlite__WEBPACK_IMPORTED_MODULE_0__.Factory)(module);
5497
5684
  sqlite3.vfs_register(vfs, true);
5498
5685
  /**
@@ -5820,8 +6007,8 @@ class WASQLitePowerSyncDatabaseOpenFactory extends _AbstractWebPowerSyncDatabase
5820
6007
 
5821
6008
  __webpack_require__.r(__webpack_exports__);
5822
6009
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
5823
- /* harmony export */ DEFAULT_MODULE_FACTORIES: () => (/* binding */ DEFAULT_MODULE_FACTORIES),
5824
6010
  /* harmony export */ WASQLiteVFS: () => (/* binding */ WASQLiteVFS),
6011
+ /* harmony export */ loadModuleAndVfs: () => (/* binding */ loadModuleAndVfs),
5825
6012
  /* harmony export */ vfsRequiresDedicatedWorkers: () => (/* binding */ vfsRequiresDedicatedWorkers)
5826
6013
  /* harmony export */ });
5827
6014
  /**
@@ -5833,9 +6020,26 @@ var WASQLiteVFS;
5833
6020
  WASQLiteVFS["OPFSCoopSyncVFS"] = "OPFSCoopSyncVFS";
5834
6021
  WASQLiteVFS["AccessHandlePoolVFS"] = "AccessHandlePoolVFS";
5835
6022
  WASQLiteVFS["OPFSWriteAheadVFS"] = "OPFSWriteAheadVFS";
6023
+ /**
6024
+ * A virtual file system storing data in-memory only, without persistence.
6025
+ *
6026
+ * This file system can be used in three configurations:
6027
+ *
6028
+ * 1. In shared workers (the default when available): All tabs share the same in-memory database, which is cleared
6029
+ * once the last tab is closed.
6030
+ * 2. In dedicated workers (used when `enableMultiTabs` is disabled). Each tab has its own in-memory database cleared
6031
+ * when the tab is closed. Queries are offloaded to a dedicated worker.
6032
+ * 3. In the context of the tab itself (used when both `enableMultiTabs` and `useWebWorker` are disabled). The per-tab
6033
+ * database is hosted in the tab itself, and queries run synchronously. This is _a lot_ faster than any other
6034
+ * single-threadedVFS, but can block JavaScript for computationally-intensive queries.
6035
+ *
6036
+ * This VFS primarily intended for development, but it also useful for online-first deployments not syncing large
6037
+ * amounts of data, as it is quicker to start up.
6038
+ */
6039
+ WASQLiteVFS["InMemoryVfs"] = "InMemoryVFS";
5836
6040
  })(WASQLiteVFS || (WASQLiteVFS = {}));
5837
6041
  function vfsRequiresDedicatedWorkers(vfs) {
5838
- return vfs != WASQLiteVFS.IDBBatchAtomicVFS;
6042
+ return vfs != WASQLiteVFS.IDBBatchAtomicVFS && vfs != WASQLiteVFS.InMemoryVfs;
5839
6043
  }
5840
6044
  async function asyncModuleFactory(encryptionKey) {
5841
6045
  if (encryptionKey) {
@@ -5860,46 +6064,47 @@ async function syncModuleFactory(encryptionKey) {
5860
6064
  /**
5861
6065
  * @internal
5862
6066
  */
5863
- const DEFAULT_MODULE_FACTORIES = {
5864
- [WASQLiteVFS.IDBBatchAtomicVFS]: async (options) => {
5865
- const module = await asyncModuleFactory(options.encryptionKey);
5866
- const { IDBBatchAtomicVFS } = await Promise.resolve(/*! import() */).then(__webpack_require__.t.bind(__webpack_require__, /*! @journeyapps/wa-sqlite/src/examples/IDBBatchAtomicVFS.js */ "@journeyapps/wa-sqlite/src/examples/IDBBatchAtomicVFS.js", 19));
5867
- return {
5868
- module,
6067
+ async function loadModuleAndVfs({ vfs, dbFilename, encryptionKey }) {
6068
+ let moduleFactory = syncModuleFactory;
6069
+ let resolveVfs;
6070
+ switch (vfs) {
6071
+ case WASQLiteVFS.IDBBatchAtomicVFS: {
6072
+ moduleFactory = asyncModuleFactory;
6073
+ const { IDBBatchAtomicVFS } = await Promise.resolve(/*! import() */).then(__webpack_require__.t.bind(__webpack_require__, /*! @journeyapps/wa-sqlite/src/examples/IDBBatchAtomicVFS.js */ "@journeyapps/wa-sqlite/src/examples/IDBBatchAtomicVFS.js", 19));
6074
+ resolveVfs = (module) => {
6075
+ // @ts-expect-error The types for this static method are missing upstream
6076
+ return IDBBatchAtomicVFS.create(dbFilename, module, { lockPolicy: 'exclusive' });
6077
+ };
6078
+ break;
6079
+ }
6080
+ case WASQLiteVFS.AccessHandlePoolVFS: {
6081
+ // @ts-expect-error The types for this import are missing upstream
6082
+ const { AccessHandlePoolVFS } = await Promise.resolve(/*! import() */).then(__webpack_require__.t.bind(__webpack_require__, /*! @journeyapps/wa-sqlite/src/examples/AccessHandlePoolVFS.js */ "@journeyapps/wa-sqlite/src/examples/AccessHandlePoolVFS.js", 19));
6083
+ resolveVfs = (module) => AccessHandlePoolVFS.create(dbFilename, module);
6084
+ break;
6085
+ }
6086
+ case WASQLiteVFS.OPFSCoopSyncVFS: {
6087
+ // @ts-expect-error The types for this import are missing upstream
6088
+ const { OPFSCoopSyncVFS } = await Promise.resolve(/*! import() */).then(__webpack_require__.t.bind(__webpack_require__, /*! @journeyapps/wa-sqlite/src/examples/OPFSCoopSyncVFS.js */ "@journeyapps/wa-sqlite/src/examples/OPFSCoopSyncVFS.js", 19));
6089
+ resolveVfs = (module) => OPFSCoopSyncVFS.create(dbFilename, module);
6090
+ break;
6091
+ }
6092
+ case WASQLiteVFS.OPFSWriteAheadVFS: {
6093
+ // @ts-expect-error The types for this import are missing upstream
6094
+ const { OPFSWriteAheadVFS } = await Promise.resolve(/*! import() */).then(__webpack_require__.bind(__webpack_require__, /*! @journeyapps/wa-sqlite/src/examples/OPFSWriteAheadVFS.js */ "../../node_modules/.pnpm/@journeyapps+wa-sqlite@1.7.0/node_modules/@journeyapps/wa-sqlite/src/examples/OPFSWriteAheadVFS.js"));
6095
+ resolveVfs = (module) => OPFSWriteAheadVFS.create(dbFilename, module, {});
6096
+ break;
6097
+ }
6098
+ case WASQLiteVFS.InMemoryVfs: {
6099
+ const { MemoryVFS } = await Promise.resolve(/*! import() */).then(__webpack_require__.bind(__webpack_require__, /*! @journeyapps/wa-sqlite/src/examples/MemoryVFS.js */ "../../node_modules/.pnpm/@journeyapps+wa-sqlite@1.7.0/node_modules/@journeyapps/wa-sqlite/src/examples/MemoryVFS.js"));
5869
6100
  // @ts-expect-error The types for this static method are missing upstream
5870
- vfs: await IDBBatchAtomicVFS.create(options.dbFileName, module, { lockPolicy: 'exclusive' })
5871
- };
5872
- },
5873
- [WASQLiteVFS.AccessHandlePoolVFS]: async (options) => {
5874
- const module = await syncModuleFactory(options.encryptionKey);
5875
- // @ts-expect-error The types for this static method are missing upstream
5876
- const { AccessHandlePoolVFS } = await Promise.resolve(/*! import() */).then(__webpack_require__.t.bind(__webpack_require__, /*! @journeyapps/wa-sqlite/src/examples/AccessHandlePoolVFS.js */ "@journeyapps/wa-sqlite/src/examples/AccessHandlePoolVFS.js", 19));
5877
- return {
5878
- module,
5879
- vfs: await AccessHandlePoolVFS.create(options.dbFileName, module)
5880
- };
5881
- },
5882
- [WASQLiteVFS.OPFSCoopSyncVFS]: async (options) => {
5883
- const module = await syncModuleFactory(options.encryptionKey);
5884
- // @ts-expect-error The types for this static method are missing upstream
5885
- const { OPFSCoopSyncVFS } = await Promise.resolve(/*! import() */).then(__webpack_require__.t.bind(__webpack_require__, /*! @journeyapps/wa-sqlite/src/examples/OPFSCoopSyncVFS.js */ "@journeyapps/wa-sqlite/src/examples/OPFSCoopSyncVFS.js", 19));
5886
- const vfs = await OPFSCoopSyncVFS.create(options.dbFileName, module);
5887
- return {
5888
- module,
5889
- vfs
5890
- };
5891
- },
5892
- [WASQLiteVFS.OPFSWriteAheadVFS]: async (options) => {
5893
- const module = await syncModuleFactory(options.encryptionKey);
5894
- // @ts-expect-error The types for this static method are missing upstream
5895
- const { OPFSWriteAheadVFS } = await Promise.resolve(/*! import() */).then(__webpack_require__.bind(__webpack_require__, /*! @journeyapps/wa-sqlite/src/examples/OPFSWriteAheadVFS.js */ "../../node_modules/.pnpm/@journeyapps+wa-sqlite@1.7.0/node_modules/@journeyapps/wa-sqlite/src/examples/OPFSWriteAheadVFS.js"));
5896
- const vfs = await OPFSWriteAheadVFS.create(options.dbFileName, module, {});
5897
- return {
5898
- module,
5899
- vfs
5900
- };
6101
+ resolveVfs = (module) => MemoryVFS.create(dbFilename, module);
6102
+ break;
6103
+ }
5901
6104
  }
5902
- };
6105
+ const module = await moduleFactory(encryptionKey);
6106
+ return { module, vfs: await resolveVfs(module) };
6107
+ }
5903
6108
 
5904
6109
 
5905
6110
  /***/ },
@@ -6517,6 +6722,8 @@ __webpack_require__.r(__webpack_exports__);
6517
6722
  /* harmony import */ var _shared_navigator_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../shared/navigator.js */ "./lib/src/shared/navigator.js");
6518
6723
  /* harmony import */ var _db_adapters_wa_sqlite_RawSqliteConnection_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../db/adapters/wa-sqlite/RawSqliteConnection.js */ "./lib/src/db/adapters/wa-sqlite/RawSqliteConnection.js");
6519
6724
  /* harmony import */ var _db_adapters_wa_sqlite_ConcurrentConnection_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../db/adapters/wa-sqlite/ConcurrentConnection.js */ "./lib/src/db/adapters/wa-sqlite/ConcurrentConnection.js");
6725
+ /* harmony import */ var _db_adapters_wa_sqlite_vfs_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../db/adapters/wa-sqlite/vfs.js */ "./lib/src/db/adapters/wa-sqlite/vfs.js");
6726
+
6520
6727
 
6521
6728
 
6522
6729
 
@@ -6565,13 +6772,14 @@ class MultiDatabaseServer {
6565
6772
  }
6566
6773
  async databaseOpenAttempt(options) {
6567
6774
  return (0,_shared_navigator_js__WEBPACK_IMPORTED_MODULE_2__.getNavigatorLocks)().request(OPEN_DB_LOCK, async () => {
6568
- const { dbFilename } = options;
6775
+ const { dbFilename, isReadOnly, vfs } = options;
6569
6776
  let server = this.activeDatabases.get(dbFilename);
6570
6777
  if (server == null) {
6571
6778
  // We don't need navigator locks for shared workers because all queries run in this shared worker exclusively.
6572
6779
  // For read-only connections, we use a VFS that supports concurrent reads (so a single lock on the connection is
6573
- // fine).
6574
- const needsNavigatorLocks = !(isSharedWorker || options.isReadOnly);
6780
+ // fine). In-memory databases either run in a shared worker or aren't shared across tabs at all, so the internal
6781
+ // lock is enough.
6782
+ const needsNavigatorLocks = !(isSharedWorker || isReadOnly || vfs == _db_adapters_wa_sqlite_vfs_js__WEBPACK_IMPORTED_MODULE_5__.WASQLiteVFS.InMemoryVfs);
6575
6783
  const connection = new _db_adapters_wa_sqlite_RawSqliteConnection_js__WEBPACK_IMPORTED_MODULE_3__.RawSqliteConnection(options);
6576
6784
  const withSafeConcurrency = new _db_adapters_wa_sqlite_ConcurrentConnection_js__WEBPACK_IMPORTED_MODULE_4__.ConcurrentSqliteConnection(connection, needsNavigatorLocks);
6577
6785
  // Initializing the RawSqliteConnection will run some pragmas that might write to the database file, so we want