[
  {
    "path": ".github/FUNDING.yml",
    "content": "github: [stephencelis, jberkel, NathanFallet]\n"
  },
  {
    "path": ".github/issue_template.md",
    "content": "> Issues are used to track bugs and feature requests.\n> Need help or have a general question? Ask on Stack Overflow (tag sqlite.swift).\n\n## Build Information\n\n- Include the SQLite.swift version, commit or branch experiencing the issue.\n- Mention Xcode and OS X versions affected.\n- How do do you integrate SQLite.swift in your project?\n    - manual\n    - CocoaPods\n    - Carthage\n    - Swift Package manager\n\n## General guidelines\n\n- Be as descriptive as possible.\n- Provide as much information needed to _reliably reproduce_ the issue.\n- Attach screenshots if possible.\n- Better yet: attach GIFs or link to video.\n- Even better: link to a sample project exhibiting the issue.\n"
  },
  {
    "path": ".github/pull_request_template.md",
    "content": "Thanks for taking the time to submit a pull request.\n\nBefore submitting, please do the following:\n\n- Run `make lint` to check if there are any format errors (install [swiftlint](https://github.com/realm/SwiftLint#installation) first)\n- Run `swift test` to see if the tests pass.\n- Write new tests for new functionality.\n- Update documentation comments where applicable.\n\n"
  },
  {
    "path": ".github/workflows/build.yml",
    "content": "name: Build and test\non:\n  push:\n    branches:\n      - master\n  pull_request:\n    branches:\n      - master\nconcurrency:\n  group: ci-${{ github.ref }}\n  cancel-in-progress:  ${{ github.ref != 'refs/heads/master' }}\njobs:\n  build:\n    strategy:\n      matrix:\n        os: [macos-15, macos-26]\n    runs-on: ${{ matrix.os }}\n    env:\n      IOS_SIMULATOR: ${{ matrix.os == 'macos-15' && 'iPhone 16' || 'iPhone 16e' }}\n      IOS_VERSION: ${{ matrix.os == 'macos-15' && '18.5' || '26.0.1' }}\n    steps:\n    - uses: actions/checkout@v4\n    - name: \"xcrun simctl list\"\n      run: \"xcrun simctl list\"\n    - name: Update pod repo\n      run: pod repo update\n    - name: \"Lint\"\n      run: make lint\n    - name: \"Run tests (PACKAGE_MANAGER_COMMAND: test)\"\n      env:\n        PACKAGE_MANAGER_COMMAND: test -Xswiftc -warnings-as-errors\n      run: ./run-tests.sh\n    - name: \"Run tests (PACKAGE_MANAGER_COMMAND: test --traits SQLiteSwiftCSQLite)\"\n      env:\n        PACKAGE_MANAGER_COMMAND: test -Xswiftc -warnings-as-errors --traits SQLiteSwiftCSQLite\n      run: ./run-tests.sh\n    - name: \"Run tests (PACKAGE_MANAGER_COMMAND: test --traits SQLiteSwiftCSQLite,FTS5)\"\n      env:\n        PACKAGE_MANAGER_COMMAND: test -Xswiftc -warnings-as-errors --traits SQLiteSwiftCSQLite,FTS5\n      run: ./run-tests.sh\n    - name: \"Run tests (PACKAGE_MANAGER_COMMAND: test --traits SQLCipher)\"\n      env:\n        PACKAGE_MANAGER_COMMAND: test -Xswiftc -warnings-as-errors --traits SQLCipher\n      run: ./run-tests.sh\n    - name: \"Run tests (SPM integration test)\"\n      env:\n        SPM: run\n      run: ./run-tests.sh\n    - name: \"Run tests (BUILD_SCHEME: SQLite iOS)\"\n      env:\n        BUILD_SCHEME: SQLite iOS\n      run: ./run-tests.sh\n    - name: \"Run tests (BUILD_SCHEME: SQLite Mac)\"\n      env:\n        BUILD_SCHEME: SQLite Mac\n      run: ./run-tests.sh\n    - name: \"Run tests (VALIDATOR_SUBSPEC: none)\"\n      env:\n        VALIDATOR_SUBSPEC: none\n      run: ./run-tests.sh\n    - name: \"Run tests (VALIDATOR_SUBSPEC: standard)\"\n      env:\n        VALIDATOR_SUBSPEC: standard\n      run: ./run-tests.sh\n    - name: \"Run tests (VALIDATOR_SUBSPEC: standalone)\"\n      env:\n        VALIDATOR_SUBSPEC: standalone\n      run: ./run-tests.sh\n    - name: \"Run tests (VALIDATOR_SUBSPEC: SQLCipher)\"\n      env:\n        VALIDATOR_SUBSPEC: SQLCipher\n      run: ./run-tests.sh\n    - name: \"Run tests (tuist)\"\n      run: |\n        brew install tuist\n        cd Tests/Tuist/SQLite-Test\n        tuist install\n        tuist test\n  build-linux:\n    runs-on: ubuntu-latest\n    steps:\n    - uses: actions/checkout@v4\n    - name: Install\n      run: |\n        sudo apt-get update -qq\n        sudo apt-get install -y libsqlite3-dev\n    - name: Test (default trait)\n      run: swift test\n    - name: Test (SQLiteSwiftCSQLite)\n      run: swift test --traits SQLiteSwiftCSQLite\n    - name: \"Run tests (SPM integration test)\"\n      env:\n        SPM: run\n      run: ./run-tests.sh\n  build-android:\n    runs-on: ubuntu-latest\n    steps:\n    - uses: actions/checkout@v4\n    - name: Run tests on Android\n      uses: skiptools/swift-android-action@v2\n      with:\n        # Ubuntu runners low on space causes the emulator to fail to install\n        free-disk-space: true\n        swift-build-flags: --traits SQLiteSwiftCSQLite\n"
  },
  {
    "path": ".gitignore",
    "content": "# OS X\n.DS_Store\n\n# Xcode\nbuild/\n*.pbxuser\n!default.pbxuser\n*.mode1v3\n!default.mode1v3\n*.mode2v3\n!default.mode2v3\n*.perspectivev3\n!default.perspectivev3\nxcuserdata\n*.xccheckout\n*.moved-aside\nDerivedData\n*.hmap\n*.ipa\n*.xcuserstate\n\n# Carthage\n/Carthage/\n\n# Makefile\nbin/\n\n# Swift Package Manager\n.build\nPackages/\n.swiftpm/\nPackage.resolved\nDerived/\n"
  },
  {
    "path": ".swiftlint.yml",
    "content": "opt_in_rules:\n  - shorthand_optional_binding\ndisabled_rules: # rule identifiers to exclude from running\n  - todo\n  - function_name_whitespace\n  - large_tuple\n  - closure_parameter_position\n  - inclusive_language  # sqlite_master etc.\n  - blanket_disable_command\nincluded: # paths to include during linting. `--path` is ignored if present. takes precendence over `excluded`.\n  - Sources\n  - Tests\n  - Package.swift\nexcluded: # paths to ignore during linting. overridden by `included`.\n  - \"*/.build/*\"\n\nidentifier_name:\n  excluded:\n    - db\n    - in\n    - to\n    - by\n    - or\n    - eq\n    - gt\n    - lt\n    - fn\n    - a\n    - b\n    - q\n    - SQLITE_TRANSIENT\n\ntype_body_length:\n  warning: 350\n  error: 350\n\nfunction_body_length:\n  warning: 60\n  error: 60\n\nline_length:\n  warning: 150\n  error: 150\n  ignores_comments: true\n\nfile_length:\n  warning: 500\n  error: 500\n  ignore_comment_only_lines: true\n"
  },
  {
    "path": "CHANGELOG.md",
    "content": "0.16.0 (28-01-2026), [diff][diff-0.16.0]\n========================================\n* Revert trait changes for Linux\n* Remove SwiftToolchainCSQLite (replaced with fork)\n\n0.15.5 (22-01-2026), [diff][diff-0.15.5]\n========================================\n* Support more package traits ([#1341][]), including FTS5 ([#1343][])\n* SQLCipher package manager integration ([#1336][], [#1340][])\n* Provide a dynamic library in SPM ([#1342][])\n* Added sendability conformance ([#1332][])\n\n0.15.4 (13-06-2025), [diff][diff-0.15.4]\n========================================\n* Fix cross compilation for linux on macOS fails ([#1317][])\n* Support creating tables in schema changer ([#1315][])\n* Update oldest supported platform versions ([#1280][])\n* Add CustomStringConvertible for Setter ([#1279][])\n\n0.15.3 (19-04-2024), [diff][diff-0.15.3]\n========================================\n* Update `podspec` to include privacy manifest ([#1265][])\n\n0.15.2 (16-04-2024), [diff][diff-0.15.2]\n========================================\n* fix: visionos to CocoaPods ([#1260][])\n\n0.15.1 (14-04-2024), [diff][diff-0.15.1]\n========================================\n\n* Update CoreFunctions.swift fix typo ([#1249][])\n* Fix #1247 support nil case when decoding optionals ([#1248][])\n* Change deployment targets for Xcode 15 and add dependency on custom Cocoapods fork ([#1255][])\n* Add VisionOS support ([#1237][])\n\n0.15.0 (24-02-2024), [diff][diff-0.15.0]\n========================================\n\n* Fix incorrect behavior when preparing `SELECT *` preceded by a `WITH` ([#1179][])\n* Adds support for returning extended error codes ([#1178][])\n* Fix typos ([#1182][])\n* fix Xcode build error ([#1192][])\n* Make the IndexDefinition properties public ([#1196][])\n* Fix GitHub Actions build badge ([#1200][])\n* Run CI on macOS 13 ([#1206][])\n* SchemaReader: return the correct column definition for a composite primary key ([#1217][])\n* Add optional support for decoding ([#1224][])\n* make fromDatatypeValue throw ([#1242][])\n* Implements built-in window functions ([#1228][])\n* Fix column affinity parsing to match how SQLite determines affinity ([#1218][])\n* Handle FK definitions w/o key references ([#1210][])\n* Add privacy manifest ([#1245][])\n* New minimum deployment targets: iOS/tvOS 11.0, watchOS 4.0\n\n0.14.1 (01-11-2022), [diff][diff-0.14.1]\n========================================\n\n* Reverted `Blob` changes (See [#1167][] for rationale).\n\n0.14.0 (27-10-2022), [diff][diff-0.14.0]\n========================================\nFor breaking changes, see [Upgrading.md](Documentation/Upgrading.md).\n\n* Support more complex schema changes and queries ([#1073][], [#1146][] [#1148][])\n* Support `ATTACH`/`DETACH` ([#30][], [#1142][])\n* Expose connection flags (via `URIQueryParameter`) to open db ([#1074][])\n* Support `WITH` clause ([#1139][])\n* Add `Value` conformance for `NSURL` ([#1110][], [#1141][])\n* Add decoding for `UUID` ([#1137][])\n* SQLCipher: improve documentation ([#1098][]), add `sqlcipher_export` ([#1101][])\n* Fix `insertMany([Encodable])` ([#1130][], [#1138][])\n* Fix incorrect spelling of `remove_diacritics` ([#1128][])\n* Fix project build order ([#1131][])\n* Blob performance improvements ([#416][], [#1167][])\n* Various performance improvements ([#1109][], [#1115][], [#1132][])\n* Removed FTS3/4 tokenizer integration (`registerTokenizer`, [#1104][], [#1144][])\n\n0.13.3 (27-03-2022), [diff][diff-0.13.3]\n========================================\n\n* UUID Fix ([#1112][])\n* Add prepareRowIterator method to an extension of Statement. ([#1119][])\n* Adding primary key support to column with references ([#1121][])\n\n0.13.2 (25-01-2022), [diff][diff-0.13.2]\n========================================\n\n* Closing bracket position ([#1100][])\n* Native user_version support in Connection ([#1105][])\n\n0.13.1 (17-11-2021), [diff][diff-0.13.1]\n========================================\n\n* Support for database backup ([#919][])\n* Support for custom SQL aggregates ([#881][])\n* Restore previous behavior in `FailableIterator` ([#1075][])\n* Fix compilation on Linux ([#1077][])\n* Align platform versions in SPM manifest and Xcode ([#1094][])\n* Revert OSX deployment target back to 10.10 ([#1095][])\n\n0.13.0 (22-08-2021), [diff][diff-0.13.0]\n========================================\n\n* Swift 5.3 support\n* Xcode 12.5 support\n* Bumps minimum deployment versions\n* Fixes up Package.swift to build SQLiteObjc module\n\n0.12.1, 0.12.2 (21-06-2019) [diff][diff-0.12.2]\n========================================\n\n* CocoaPods modular headers support\n\n0.12.0 (24-04-2019) [diff][diff-0.12.0]\n========================================\n\n* Version with Swift 5 Support\n\n0.11.6 (19-04-2019), [diff][diff-0.11.6]\n========================================\n\n* Swift 4.2, SQLCipher 4.x ([#866][])\n\n0.11.5 (04-14-2018), [diff][diff-0.11.5]\n========================================\n\n* Swift 4.1 ([#797][])\n\n0.11.4 (30-09-2017), [diff][diff-0.11.4]\n========================================\n\n* Collate `.nocase` strictly enforces `NOT NULL` even when using Optional ([#697][])\n* Fix transactions not being rolled back when committing fails ([#426][])\n* Add possibility to have expression on right hand side of like ([#591][])\n* Added Date and Time functions ([#142][])\n* Add Swift4 Coding support ([#733][])\n* Preliminary Linux support ([#315][], [#681][])\n* Add `RowIterator` for more safety ([#647][], [#726][])\n* Make `Row.get` throw instead of crash ([#649][])\n* Fix create/drop index functions ([#666][])\n* Revert deployment target to 8.0 ([#625][], [#671][], [#717][])\n* Added support for the union query clause ([#723][])\n* Add support for `ORDER` and `LIMIT` on `UPDATE` and `DELETE` ([#657][], [#722][])\n* Swift 4 support ([#668][])\n\n0.11.3 (30-03-2017), [diff][diff-0.11.3]\n========================================\n\n* Fix compilation problems when using Carthage ([#615][])\n* Add `WITHOUT ROWID` table option ([#541][])\n* Argument count fixed for binary custom functions ([#481][])\n* Documentation updates\n* Tested with Xcode 8.3 / iOS 10.3\n\n0.11.2 (25-12-2016), [diff][diff-0.11.2]\n========================================\n\n* Fixed SQLCipher integration with read-only databases ([#559][])\n* Preliminary Swift Package Manager support ([#548][], [#560][])\n* Fixed null pointer when fetching an empty BLOB ([#561][])\n* Allow `where` as alias for `filter` ([#571][])\n\n0.11.1 (06-12-2016), [diff][diff-0.11.1]\n========================================\n\n* Integrate SQLCipher via CocoaPods ([#546][], [#553][])\n* Made lastInsertRowid consistent with other SQLite wrappers ([#532][])\n* Fix for `~=` operator used with Double ranges\n* Various documentation updates\n\n0.11.0 (19-10-2016)\n===================\n\n* Swift3 migration ([diff][diff-0.11.0])\n\n\n[diff-0.11.0]: https://github.com/stephencelis/SQLite.swift/compare/0.10.1...0.11.0\n[diff-0.11.1]: https://github.com/stephencelis/SQLite.swift/compare/0.11.0...0.11.1\n[diff-0.11.2]: https://github.com/stephencelis/SQLite.swift/compare/0.11.1...0.11.2\n[diff-0.11.3]: https://github.com/stephencelis/SQLite.swift/compare/0.11.2...0.11.3\n[diff-0.11.4]: https://github.com/stephencelis/SQLite.swift/compare/0.11.3...0.11.4\n[diff-0.11.5]: https://github.com/stephencelis/SQLite.swift/compare/0.11.4...0.11.5\n[diff-0.11.6]: https://github.com/stephencelis/SQLite.swift/compare/0.11.5...0.11.6\n[diff-0.12.0]: https://github.com/stephencelis/SQLite.swift/compare/0.11.6...0.12.0\n[diff-0.12.2]: https://github.com/stephencelis/SQLite.swift/compare/0.12.0...0.12.2\n[diff-0.13.0]: https://github.com/stephencelis/SQLite.swift/compare/0.12.2...0.13.0\n[diff-0.13.1]: https://github.com/stephencelis/SQLite.swift/compare/0.13.0...0.13.1\n[diff-0.13.2]: https://github.com/stephencelis/SQLite.swift/compare/0.13.1...0.13.2\n[diff-0.13.3]: https://github.com/stephencelis/SQLite.swift/compare/0.13.2...0.13.3\n[diff-0.14.0]: https://github.com/stephencelis/SQLite.swift/compare/0.13.3...0.14.0\n[diff-0.14.1]: https://github.com/stephencelis/SQLite.swift/compare/0.14.0...0.14.1\n[diff-0.15.0]: https://github.com/stephencelis/SQLite.swift/compare/0.14.0...0.15.0\n[diff-0.15.1]: https://github.com/stephencelis/SQLite.swift/compare/0.15.0...0.15.1\n[diff-0.15.2]: https://github.com/stephencelis/SQLite.swift/compare/0.15.1...0.15.2\n[diff-0.15.3]: https://github.com/stephencelis/SQLite.swift/compare/0.15.2...0.15.3\n[diff-0.15.4]: https://github.com/stephencelis/SQLite.swift/compare/0.15.3...0.15.4\n[diff-0.15.5]: https://github.com/stephencelis/SQLite.swift/compare/0.15.4...0.15.5\n[diff-0.16.0]: https://github.com/stephencelis/SQLite.swift/compare/0.15.5...0.16.0\n\n[#30]: https://github.com/stephencelis/SQLite.swift/issues/30\n[#142]: https://github.com/stephencelis/SQLite.swift/issues/142\n[#315]: https://github.com/stephencelis/SQLite.swift/issues/315\n[#416]: https://github.com/stephencelis/SQLite.swift/pull/416\n[#426]: https://github.com/stephencelis/SQLite.swift/pull/426\n[#481]: https://github.com/stephencelis/SQLite.swift/pull/481\n[#532]: https://github.com/stephencelis/SQLite.swift/issues/532\n[#541]: https://github.com/stephencelis/SQLite.swift/issues/541\n[#546]: https://github.com/stephencelis/SQLite.swift/issues/546\n[#548]: https://github.com/stephencelis/SQLite.swift/pull/548\n[#553]: https://github.com/stephencelis/SQLite.swift/pull/553\n[#559]: https://github.com/stephencelis/SQLite.swift/pull/559\n[#560]: https://github.com/stephencelis/SQLite.swift/pull/560\n[#561]: https://github.com/stephencelis/SQLite.swift/issues/561\n[#571]: https://github.com/stephencelis/SQLite.swift/issues/571\n[#591]: https://github.com/stephencelis/SQLite.swift/pull/591\n[#615]: https://github.com/stephencelis/SQLite.swift/pull/615\n[#625]: https://github.com/stephencelis/SQLite.swift/issues/625\n[#647]: https://github.com/stephencelis/SQLite.swift/pull/647\n[#649]: https://github.com/stephencelis/SQLite.swift/pull/649\n[#657]: https://github.com/stephencelis/SQLite.swift/issues/657\n[#666]: https://github.com/stephencelis/SQLite.swift/pull/666\n[#668]: https://github.com/stephencelis/SQLite.swift/pull/668\n[#671]: https://github.com/stephencelis/SQLite.swift/issues/671\n[#681]: https://github.com/stephencelis/SQLite.swift/issues/681\n[#697]: https://github.com/stephencelis/SQLite.swift/issues/697\n[#717]: https://github.com/stephencelis/SQLite.swift/issues/717\n[#722]: https://github.com/stephencelis/SQLite.swift/pull/722\n[#723]: https://github.com/stephencelis/SQLite.swift/pull/723\n[#733]: https://github.com/stephencelis/SQLite.swift/pull/733\n[#726]: https://github.com/stephencelis/SQLite.swift/pull/726\n[#797]: https://github.com/stephencelis/SQLite.swift/pull/797\n[#866]: https://github.com/stephencelis/SQLite.swift/pull/866\n[#881]: https://github.com/stephencelis/SQLite.swift/pull/881\n[#919]: https://github.com/stephencelis/SQLite.swift/pull/919\n[#1073]: https://github.com/stephencelis/SQLite.swift/issues/1073\n[#1074]: https://github.com/stephencelis/SQLite.swift/issues/1074\n[#1075]: https://github.com/stephencelis/SQLite.swift/pull/1075\n[#1077]: https://github.com/stephencelis/SQLite.swift/issues/1077\n[#1094]: https://github.com/stephencelis/SQLite.swift/pull/1094\n[#1095]: https://github.com/stephencelis/SQLite.swift/pull/1095\n[#1098]: https://github.com/stephencelis/SQLite.swift/issues/1098\n[#1100]: https://github.com/stephencelis/SQLite.swift/pull/1100\n[#1101]: https://github.com/stephencelis/SQLite.swift/issues/1101\n[#1104]: https://github.com/stephencelis/SQLite.swift/issues/1104\n[#1105]: https://github.com/stephencelis/SQLite.swift/pull/1105\n[#1109]: https://github.com/stephencelis/SQLite.swift/issues/1109\n[#1110]: https://github.com/stephencelis/SQLite.swift/pull/1110\n[#1112]: https://github.com/stephencelis/SQLite.swift/pull/1112\n[#1115]: https://github.com/stephencelis/SQLite.swift/pull/1115\n[#1119]: https://github.com/stephencelis/SQLite.swift/pull/1119\n[#1121]: https://github.com/stephencelis/SQLite.swift/pull/1121\n[#1128]: https://github.com/stephencelis/SQLite.swift/issues/1128\n[#1130]: https://github.com/stephencelis/SQLite.swift/issues/1130\n[#1131]: https://github.com/stephencelis/SQLite.swift/pull/1131\n[#1132]: https://github.com/stephencelis/SQLite.swift/pull/1132\n[#1137]: https://github.com/stephencelis/SQLite.swift/pull/1137\n[#1138]: https://github.com/stephencelis/SQLite.swift/pull/1138\n[#1139]: https://github.com/stephencelis/SQLite.swift/pull/1139\n[#1141]: https://github.com/stephencelis/SQLite.swift/pull/1141\n[#1142]: https://github.com/stephencelis/SQLite.swift/pull/1142\n[#1144]: https://github.com/stephencelis/SQLite.swift/pull/1144\n[#1146]: https://github.com/stephencelis/SQLite.swift/pull/1146\n[#1148]: https://github.com/stephencelis/SQLite.swift/pull/1148\n[#1167]: https://github.com/stephencelis/SQLite.swift/pull/1167\n[#1179]: https://github.com/stephencelis/SQLite.swift/pull/1179\n[#1178]: https://github.com/stephencelis/SQLite.swift/pull/1178\n[#1182]: https://github.com/stephencelis/SQLite.swift/pull/1182\n[#1192]: https://github.com/stephencelis/SQLite.swift/pull/1192\n[#1196]: https://github.com/stephencelis/SQLite.swift/pull/1196\n[#1200]: https://github.com/stephencelis/SQLite.swift/pull/1200\n[#1206]: https://github.com/stephencelis/SQLite.swift/pull/1206\n[#1217]: https://github.com/stephencelis/SQLite.swift/pull/1217\n[#1224]: https://github.com/stephencelis/SQLite.swift/pull/1224\n[#1242]: https://github.com/stephencelis/SQLite.swift/pull/1242\n[#1228]: https://github.com/stephencelis/SQLite.swift/pull/1228\n[#1218]: https://github.com/stephencelis/SQLite.swift/pull/1218\n[#1210]: https://github.com/stephencelis/SQLite.swift/pull/1210\n[#1245]: https://github.com/stephencelis/SQLite.swift/pull/1245\n[#1249]: https://github.com/stephencelis/SQLite.swift/pull/1249\n[#1248]: https://github.com/stephencelis/SQLite.swift/pull/1248\n[#1255]: https://github.com/stephencelis/SQLite.swift/pull/1255\n[#1237]: https://github.com/stephencelis/SQLite.swift/pull/1237\n[#1260]: https://github.com/stephencelis/SQLite.swift/pull/1260\n[#1265]: https://github.com/stephencelis/SQLite.swift/pull/1265\n[#1279]: https://github.com/stephencelis/SQLite.swift/pull/1279\n[#1280]: https://github.com/stephencelis/SQLite.swift/pull/1280\n[#1315]: https://github.com/stephencelis/SQLite.swift/pull/1315\n[#1317]: https://github.com/stephencelis/SQLite.swift/pull/1317\n[#1332]: https://github.com/stephencelis/SQLite.swift/pull/1332\n[#1336]: https://github.com/stephencelis/SQLite.swift/pull/1336\n[#1340]: https://github.com/stephencelis/SQLite.swift/pull/1340\n[#1341]: https://github.com/stephencelis/SQLite.swift/pull/1341\n[#1342]: https://github.com/stephencelis/SQLite.swift/pull/1342\n[#1343]: https://github.com/stephencelis/SQLite.swift/pull/1343\n"
  },
  {
    "path": "CONTRIBUTING.md",
    "content": "# Contributing\n\nThe where and when to open an [issue](#issues) or [pull\nrequest](#pull-requests).\n\n\n## Issues\n\nIssues are used to track **bugs** and **feature requests**. Need **help** or\nhave a **general question**? [Ask on Stack Overflow][] (tag `sqlite.swift`).\n\nBefore reporting a bug or requesting a feature, [run a few searches][Search] to\nsee if a similar issue has already been opened and ensure you’re not submitting\na duplicate.\n\nIf you find a similar issue, read the existing conversation and see if it\naddresses everything. If it doesn’t, continue the conversation there.\n\nIf your searches return empty, see the [bug](#bugs) or [feature\nrequest](#feature-requests) guidelines below.\n\n[Ask on Stack Overflow]: https://stackoverflow.com/questions/tagged/sqlite.swift\n[Search]: https://github.com/stephencelis/SQLite.swift/search?type=Issues\n\n\n### Bugs\n\nThink you’ve discovered a new **bug**? Let’s try troubleshooting a few things\nfirst.\n\n  - **Is it an installation issue?** <a name='bugs-1'/>\n\n    If this is your first time building SQLite.swift in your project, you may\n    encounter a build error, _e.g._:\n\n        No such module 'SQLite'\n\n    Please carefully re-read the [installation instructions][] to make sure\n    everything is in order.\n\n  - **Have you read the documentation?** <a name='bugs-2'/>\n\n    If you can’t seem to get something working, check\n    [the documentation][See Documentation] to see if the solution is there.\n\n  - **Are you up-to-date?** <a name='bugs-3'/>\n\n    If you’re perusing [the documentation][See Documentation] online and find\n    that an example is just not working, please upgrade to the latest version\n    of SQLite.swift and try again before continuing.\n\n  - **Is it an unhelpful build error?** <a name='bugs-4'/>\n\n    While Swift error messaging is improving with each release, complex\n    expressions still lend themselves to misleading errors. If you encounter an\n    error on a complex line, breaking it down into smaller pieces generally\n    yields a more understandable error.\n\n  - **Is it an _even more_ unhelpful build error?** <a name='bugs-5'/>\n\n    Have you updated Xcode recently? Did your project stop building out of the\n    blue?\n\n    Hold down the **option** key and select **Clean Build Folder…** from the\n    **Product** menu (⌥⇧⌘K).\n\nMade it through everything above and still having trouble? Sorry!\n[Open an issue][]! And _please_:\n\n  - Be as descriptive as possible.\n  - Provide as much information needed to _reliably reproduce_ the issue.\n  - Attach screenshots if possible.\n  - Better yet: attach GIFs or link to video.\n  - Even better: link to a sample project exhibiting the issue.\n  - Include the SQLite.swift commit or branch experiencing the issue.\n  - Include devices and operating systems affected.\n  - Include build information: the Xcode and macOS versions affected.\n\n[installation instructions]: Documentation/Index.md#installation\n[See Documentation]: Documentation/Index.md#sqliteswift-documentation\n[Open an issue]: https://github.com/stephencelis/SQLite.swift/issues/new\n\n\n### Feature Requests\n\nHave an innovative **feature request**? [Open an issue][]! Be thorough! Provide\ncontext and examples. Be open to discussion.\n\n\n## Pull Requests\n\nInterested in contributing but don’t know where to start? Try the [`help\nwanted`][help wanted] label.\n\nReady to submit a fix or a feature? [Submit a pull request][]! And _please_:\n\n  - If code changes, run the tests and make sure everything still works.\n  - Write new tests for new functionality.\n  - Update documentation comments where applicable.\n  - Maintain the existing style.\n  - Don’t forget to have fun.\n\nWhile we cannot guarantee a merge to every pull request, we do read each one\nand love your input.\n\n\n[help wanted]: https://github.com/stephencelis/SQLite.swift/labels/help%20wanted\n[Submit a pull request]: https://github.com/stephencelis/SQLite.swift/fork\n"
  },
  {
    "path": "Documentation/Index.md",
    "content": "# SQLite.swift Documentation\n\n- [SQLite.swift Documentation](#sqliteswift-documentation)\n  - [Installation](#installation)\n    - [Swift Package Manager](#swift-package-manager)\n        - [Using SQLite.swift with SQLCipher](#using-sqliteswift-with-sqlcipher)\n    - [Carthage](#carthage)\n    - [CocoaPods](#cocoapods)\n      - [Requiring a specific version of SQLite](#requiring-a-specific-version-of-sqlite)\n    - [Manual](#manual)\n  - [Getting Started](#getting-started)\n    - [Connecting to a Database](#connecting-to-a-database)\n      - [Read-Write Databases](#read-write-databases)\n      - [Read-Only Databases](#read-only-databases)\n      - [In a shared group container](#in-a-shared-group-container)\n      - [In-Memory Databases](#in-memory-databases)\n      - [URI parameters](#uri-parameters)\n      - [Thread-Safety](#thread-safety)\n  - [Building Type-Safe SQL](#building-type-safe-sql)\n    - [Expressions](#expressions)\n    - [Compound Expressions](#compound-expressions)\n    - [Queries](#queries)\n  - [Creating a Table](#creating-a-table)\n    - [Create Table Options](#create-table-options)\n    - [Column Constraints](#column-constraints)\n    - [Table Constraints](#table-constraints)\n  - [Inserting Rows](#inserting-rows)\n    - [Handling SQLite errors](#handling-sqlite-errors)\n    - [Setters](#setters)\n          - [Infix Setters](#infix-setters)\n          - [Postfix Setters](#postfix-setters)\n  - [Selecting Rows](#selecting-rows)\n    - [Iterating and Accessing Values](#iterating-and-accessing-values)\n      - [Failable iteration](#failable-iteration)\n    - [Plucking Rows](#plucking-rows)\n    - [Building Complex Queries](#building-complex-queries)\n      - [Selecting Columns](#selecting-columns)\n      - [Joining Other Tables](#joining-other-tables)\n        - [Column Namespacing](#column-namespacing)\n        - [Table Aliasing](#table-aliasing)\n      - [Filtering Rows](#filtering-rows)\n        - [Filter Operators and Functions](#filter-operators-and-functions)\n          - [Infix Filter Operators](#infix-filter-operators)\n          - [Prefix Filter Operators](#prefix-filter-operators)\n          - [Filtering Functions](#filtering-functions)\n      - [Sorting Rows](#sorting-rows)\n      - [Limiting and Paging Results](#limiting-and-paging-results)\n      - [Recursive and Hierarchical Queries](#recursive-and-hierarchical-queries)\n      - [Aggregation](#aggregation)\n  - [Upserting Rows](#upserting-rows)\n  - [Updating Rows](#updating-rows)\n  - [Deleting Rows](#deleting-rows)\n  - [Transactions and Savepoints](#transactions-and-savepoints)\n  - [Querying the Schema](#querying-the-schema)\n    - [Indexes and Columns](#indexes-and-columns)\n  - [Altering the Schema](#altering-the-schema)\n    - [Renaming Tables](#renaming-tables)\n    - [Dropping Tables](#dropping-tables)\n    - [Adding Columns](#adding-columns)\n      - [Added Column Constraints](#added-column-constraints)\n    - [SchemaChanger](#schemachanger)\n      - [Adding Columns](#adding-columns-1)\n      - [Renaming Columns](#renaming-columns)\n      - [Dropping Columns](#dropping-columns)\n      - [Renaming/Dropping Tables](#renamingdropping-tables)\n      - [Creating Tables](#creating-tables)      \n    - [Indexes](#indexes)\n      - [Creating Indexes](#creating-indexes)\n      - [Dropping Indexes](#dropping-indexes)\n    - [Migrations and Schema Versioning](#migrations-and-schema-versioning)\n  - [Custom Types](#custom-types)\n    - [Date-Time Values](#date-time-values)\n    - [Binary Data](#binary-data)\n  - [Codable Types](#codable-types)\n    - [Inserting Codable Types](#inserting-codable-types)\n    - [Updating Codable Types](#updating-codable-types)\n    - [Retrieving Codable Types](#retrieving-codable-types)\n    - [Restrictions](#restrictions)\n  - [Other Operators](#other-operators)\n          - [Other Infix Operators](#other-infix-operators)\n          - [Other Prefix Operators](#other-prefix-operators)\n  - [Core SQLite Functions](#core-sqlite-functions)\n  - [Aggregate SQLite Functions](#aggregate-sqlite-functions)\n  - [Window SQLite Functions](#window-sqlite-functions)\n  - [Date and Time functions](#date-and-time-functions)\n  - [Custom SQL Functions](#custom-sql-functions)\n  - [Custom Aggregations](#custom-aggregations)\n  - [Custom Collations](#custom-collations)\n  - [Full-text Search](#full-text-search)\n    - [FTS5](#fts5)\n  - [Executing Arbitrary SQL](#executing-arbitrary-sql)\n  - [Online Database Backup](#online-database-backup)\n  - [Attaching and detaching databases](#attaching-and-detaching-databases)\n  - [Logging](#logging)\n  - [Vacuum](#vacuum)\n\n[↩]: #sqliteswift-documentation\n\n\n## Installation\n\n### Swift Package Manager\n\nThe [Swift Package Manager][] is a tool for managing the distribution of\nSwift code. It’s integrated with the Swift build system to automate the\nprocess of downloading, compiling, and linking dependencies.\n\n 1. Add the following to your `Package.swift` file:\n\n  ```swift\n  dependencies: [\n    .package(url: \"https://github.com/stephencelis/SQLite.swift.git\", from: \"0.16.0\")\n  ]\n  ```\n\n 2. Build your project:\n\n  ```sh\n  $ swift build\n  ```\n\n#### Available traits\n\nThe Swift package manager now supports [traits][], which can be used to configure\nSQLite.swift for different use cases.\n\n  ```swift\n  dependencies: [\n    .package(url: \"https://github.com/stephencelis/SQLite.swift.git\", \n             from: \"0.16.0\",\n             traits: [\"XXX\"])\n  ]\n  ```\n\n| Trait                    | Description                                             | SQLite version                       |\n|--------------------------|---------------------------------------------------------|--------------------------------------|\n| `SystemSQLite` (default) | Uses the system SQLite (provided by Apple)              | macOS 15.7.x: `3.43.2`, 26: `3.50.2` |\n| `SQLiteSwiftCSQLite`     | Embeds a [custom SQLite][] based on [swift-toolchain][] | `3.50.4`                             |\n| `StandaloneSQLite`       | Only used by CocoaPods                                  |                                      |\n| `SQLCipher`              | Embeds [SQLCipher][] (see below)                        | 4.13.0: `3.51.2`                     |\n| `FTS5`                   | Enables FTS5, only works with `SQLiteSwiftCSQLite`      |                                      |\n\n[traits]: https://docs.swift.org/swiftpm/documentation/packagemanagerdocs/packagetraits/\n[custom SQLite]: https://github.com/stephencelis/CSQLite/tree/SQLite.swift\n[swift-toolchain]: https://github.com/swiftlang/swift-toolchain-sqlite \n\n#### Using SQLite.swift with SQLCipher\n\nIf you want to use [SQLCipher][] with SQLite.swift you can specify the `SQLCipher` trait when consuming SQLite.swift.\n\n```swift\ndepdencies: [\n  .package(url: \"https://github.com/stephencelis/SQLite.swift.git\", from: \"0.16.0\", traits: [\"SQLCipher\"])\n]\n```\n\nAs of Xcode 26.2 (17C52), there's no direct way in the Xcode UI to select trait variations so you'll need to use a local wrapper package to pull in the SQLite.swift dependency with the `SQLCipher` trait enabled:\n\n```swift\n// swift-tools-version: 6.1\n// The swift-tools-version declares the minimum version of Swift required to build this package.\n\nimport PackageDescription\n\nlet package = Package(\n    name: \"AppDependencies\",\n    platforms: [\n        .macOS(.v10_14),\n        .iOS(.v13),\n        .macCatalyst(.v13),\n        .watchOS(.v8),\n        .tvOS(.v15),\n        .visionOS(.v1)\n    ],\n    products: [\n        .library(\n            name: \"AppDependencies\",\n            targets: [\"AppDependencies\"]),\n    ],\n    dependencies: [\n        .package(\n            url: \"https://github.com/stephencelis/SQLite.swift.git\",\n            from: \"0.16.0\",\n            traits: [\"SQLCipher\"])\n    ],\n    targets: [\n        .target(\n            name: \"AppDependencies\",\n            dependencies: [\n                .product(\n                    name: \"SQLite\",\n                    package: \"SQLite.swift\")\n            ],\n            // necessary if you have other Package dependencies which explicitly link sqlite3\n            linkerSettings: [\n              .linkedFramework(\"SQLCipher\")\n            ]\n        )\n    ]\n)\n```\n\n_Note: It's important to include the linkerSettings to link SQLCipher framework first if you have any other Package dependencies in your wrapper package which explicitly link standard sqlite3. This ensures SQLCipher is linked first and properly used._\n\nWithin Xcode add your local `AppDependencies` wrapper package as a package dependency and SQLite.swift with SQLCipher functionality will be accessible.\n\nUsing the `SQLCipher` trait will cause SQLite.swift to include a dependency on SQLCipher.swift and enable `Connection` methods to set and change the database key:\n\n```swift\nimport SQLite\n\nlet db = try Connection(\"path/to/encrypted.sqlite3\")\ntry db.key(\"secret\")\ntry db.rekey(\"new secret\") // changes encryption key on already encrypted db\n```\n\nTo encrypt an existing database:\n\n```swift\nlet db = try Connection(\"path/to/unencrypted.sqlite3\")\ntry db.sqlcipher_export(.uri(\"encrypted.sqlite3\"), key: \"secret\")\n```\n\n[Swift Package Manager]: https://swift.org/package-manager\n[SQLCipher]: https://www.zetetic.net/sqlcipher/\n\n### Carthage\n\n[Carthage][] is a simple, decentralized dependency manager for Cocoa. To\ninstall SQLite.swift with Carthage:\n 1. Make sure Carthage is [installed][Carthage Installation].\n\n 2. Update your Cartfile to include the following:\n\n    ```ruby\n    github \"stephencelis/SQLite.swift\" ~> 0.16.0\n    ```\n\n 3. Run `carthage update` and [add the appropriate framework][Carthage Usage].\n\n\n[Carthage]: https://github.com/Carthage/Carthage\n[Carthage Installation]: https://github.com/Carthage/Carthage#installing-carthage\n[Carthage Usage]: https://github.com/Carthage/Carthage#adding-frameworks-to-an-application\n\n\n### CocoaPods\n\n[CocoaPods][] is a dependency manager for Cocoa projects. To install SQLite.swift with CocoaPods:\n\n 1. Make sure CocoaPods is [installed][CocoaPods Installation] (SQLite.swift\n    requires version 1.6.1 or greater).\n\n    ```sh\n    # Using the default Ruby install will require you to use sudo when\n    # installing and updating gems.\n    [sudo] gem install cocoapods\n    ```\n\n 2. Update your Podfile to include the following:\n\n    ```ruby\n    use_frameworks!\n\n    target 'YourAppTargetName' do\n        pod 'SQLite.swift', '~> 0.16.0'\n    end\n    ```\n\n 3. Run `pod install --repo-update`.\n\n\n#### Requiring a specific version of SQLite\n\nIf you want to use a more recent version of SQLite than what is provided\nwith the OS you can require the `standalone` subspec:\n\n```ruby\ntarget 'YourAppTargetName' do\n  pod 'SQLite.swift/standalone', '~> 0.16.0'\nend\n```\n\nBy default this will use the most recent version of SQLite without any\nextras. If you want you can further customize this by adding another\ndependency to sqlite3 or one of its subspecs:\n\n```ruby\ntarget 'YourAppTargetName' do\n  pod 'SQLite.swift/standalone', '~> 0.16.0'\n  pod 'sqlite3/fts5', '= 3.15.0'  # SQLite 3.15.0 with FTS5 enabled\nend\n```\n\nSee the [sqlite3 podspec][sqlite3pod] for more details.\n\n[CocoaPods]: https://cocoapods.org\n[CocoaPods Installation]: https://guides.cocoapods.org/using/getting-started.html#getting-started\n[sqlite3pod]: https://github.com/clemensg/sqlite3pod\n\n### Manual\n\nTo install SQLite.swift as an Xcode sub-project:\n\n 1. Drag the **SQLite.xcodeproj** file into your own project.\n    ([Submodule](http://git-scm.com/book/en/Git-Tools-Submodules), clone, or\n    [download](https://github.com/stephencelis/SQLite.swift/archive/master.zip)\n    the project first.)\n\n    ![Installation Screen Shot](Resources/installation@2x.png)\n\n 2. In your target’s **General** tab, click the **+** button under **Linked\n    Frameworks and Libraries**.\n\n 3. Select the appropriate **SQLite.framework** for your platform.\n\n 4. **Add**.\n\nYou should now be able to `import SQLite` from any of your target’s source\nfiles and begin using SQLite.swift.\n\nSome additional steps are required to install the application on an actual\ndevice:\n\n 5. In the **General** tab, click the **+** button under **Embedded\n    Binaries**.\n\n 6. Select the appropriate **SQLite.framework** for your platform.\n\n 7. **Add**.\n\n## Getting Started\n\nTo use SQLite.swift classes or structures in your target’s source file, first\nimport the `SQLite` module.\n\n```swift\nimport SQLite\n```\n\n\n### Connecting to a Database\n\nDatabase connections are established using the `Connection` class. A\nconnection is initialized with a path to a database. SQLite will attempt to\ncreate the database file if it does not already exist.\n\n```swift\nlet db = try Connection(\"path/to/db.sqlite3\")\n```\n\n\n#### Read-Write Databases\n\nOn iOS, you can create a writable database in your app’s **Documents**\ndirectory.\n\n```swift\nlet path = NSSearchPathForDirectoriesInDomains(\n    .documentDirectory, .userDomainMask, true\n).first!\n\nlet db = try Connection(\"\\(path)/db.sqlite3\")\n```\n\nIf you have bundled it in your application, you can use FileManager to copy it to the Documents directory:\n\n```swift\nfunc copyDatabaseIfNeeded(sourcePath: String) -> Bool {\n    let documents = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).first!\n    let destinationPath = documents + \"/db.sqlite3\"\n    let exists = FileManager.default.fileExists(atPath: destinationPath)\n    guard !exists else { return false }\n    do {\n        try FileManager.default.copyItem(atPath: sourcePath, toPath: destinationPath)\n        return true\n    } catch {\n      print(\"error during file copy: \\(error)\")\n\t    return false\n    }\n}\n```\n\nOn macOS, you can use your app’s **Application Support** directory:\n\n\n```swift\n// set the path corresponding to application support\nvar path = NSSearchPathForDirectoriesInDomains(\n    .applicationSupportDirectory, .userDomainMask, true\n).first! + \"/\" + Bundle.main.bundleIdentifier!\n\n// create parent directory inside application support if it doesn’t exist\ntry FileManager.default.createDirectory(\natPath: path, withIntermediateDirectories: true, attributes: nil\n)\n\nlet db = try Connection(\"\\(path)/db.sqlite3\")\n```\n\n#### Read-Only Databases\n\nIf you bundle a database with your app (_i.e._, you’ve copied a database file\ninto your Xcode project and added it to your application target), you can\nestablish a _read-only_ connection to it.\n\n```swift\nlet path = Bundle.main.path(forResource: \"db\", ofType: \"sqlite3\")!\n\nlet db = try Connection(path, readonly: true)\n```\n\n> _Note:_ Signed applications cannot modify their bundle resources. If you\n> bundle a database file with your app for the purpose of bootstrapping, copy\n> it to a writable location _before_ establishing a connection (see\n> [Read-Write Databases](#read-write-databases), above, for typical, writable\n> locations).\n>\n> See these two Stack Overflow questions for more information about iOS apps\n> with SQLite databases: [1](https://stackoverflow.com/questions/34609746/what-different-between-store-database-in-different-locations-in-ios),\n> [2](https://stackoverflow.com/questions/34614968/ios-how-to-copy-pre-seeded-database-at-the-first-running-app-with-sqlite-swift).\n> We welcome changes to the above sample code to show how to successfully copy and use a bundled \"seed\"\n> database for writing in an app.\n\n#### In a shared group container\n\nIt is not recommend to store databases in a [shared group container],\nsome users have reported crashes ([#1042](https://github.com/stephencelis/SQLite.swift/issues/1042)).\n\n[shared group container]: https://developer.apple.com/documentation/foundation/filemanager/1412643-containerurl#\n\n#### In-Memory Databases\n\nIf you omit the path, SQLite.swift will provision an [in-memory\ndatabase](https://www.sqlite.org/inmemorydb.html).\n\n```swift\nlet db = try Connection() // equivalent to `Connection(.inMemory)`\n```\n\nTo create a temporary, disk-backed database, pass an empty file name.\n\n```swift\nlet db = try Connection(.temporary)\n```\n\nIn-memory databases are automatically deleted when the database connection is\nclosed.\n\n#### URI parameters\n\nWe can pass `.uri` to the `Connection` initializer to control more aspects of\nthe database connection with the help of `URIQueryParameter`s:\n\n```swift\nlet db = try Connection(.uri(\"file.sqlite\", parameters: [.cache(.private), .noLock(true)]))\n```\n\nSee [Uniform Resource Identifiers](https://www.sqlite.org/uri.html#recognized_query_parameters) for more details.\n\n#### Thread-Safety\n\nEvery Connection comes equipped with its own serial queue for statement\nexecution and can be safely accessed across threads. Threads that open\ntransactions and savepoints will block other threads from executing\nstatements while the transaction is open.\n\nIf you maintain multiple connections for a single database, consider setting a timeout\n(in seconds) *or* a busy handler. There can only be one active at a time, so setting a busy\nhandler will effectively override `busyTimeout`.\n\n```swift\ndb.busyTimeout = 5 // error after 5 seconds (does multiple retries)\n\ndb.busyHandler({ tries in\n    tries < 3  // error after 3 tries\n})\n```\n\n> _Note:_ The default timeout is 0, so if you see `database is locked`\n> errors, you may be trying to access the same database simultaneously from\n> multiple connections.\n\n\n## Building Type-Safe SQL\n\nSQLite.swift comes with a typed expression layer that directly maps\n[Swift types](https://developer.apple.com/library/prerelease/ios/documentation/General/Reference/SwiftStandardLibraryReference/)\nto their [SQLite counterparts](https://www.sqlite.org/datatype3.html).\n\n| Swift Type      | SQLite Type |\n| --------------- | ----------- |\n| `Int64`*        | `INTEGER`   |\n| `Double`        | `REAL`      |\n| `String`        | `TEXT`      |\n| `nil`           | `NULL`      |\n| `SQLite.Blob`†  | `BLOB`      |\n| `URL`           | `TEXT`      |\n| `UUID`          | `TEXT`      |\n| `Date`          | `TEXT`      |\n\n> *While `Int64` is the basic, raw type (to preserve 64-bit integers on\n> 32-bit platforms), `Int` and `Bool` work transparently.\n>\n> †SQLite.swift defines its own `Blob` structure, which safely wraps the\n> underlying bytes.\n>\n> See [Custom Types](#custom-types) for more information about extending\n> other classes and structures to work with SQLite.swift.\n>\n> See [Executing Arbitrary SQL](#executing-arbitrary-sql) to forego the typed\n> layer and execute raw SQL, instead.\n\nThese expressions (in the form of the structure,\n[`Expression`](#expressions)) build on one another and, with a query\n([`QueryType`](#queries)), can create and execute SQL statements.\n\n\n### Expressions\n\nExpressions are generic structures associated with a type ([built-in\n](#building-type-safe-sql) or [custom](#custom-types)), raw SQL, and\n(optionally) values to bind to that SQL. Typically, you will only explicitly\ncreate expressions to describe your columns, and typically only once per\ncolumn.\n\n```swift\nlet id = Expression<Int64>(\"id\")\nlet email = Expression<String>(\"email\")\nlet balance = Expression<Double>(\"balance\")\nlet verified = Expression<Bool>(\"verified\")\n```\n\nUse optional generics for expressions that can evaluate to `NULL`.\n\n```swift\nlet name = Expression<String?>(\"name\")\n```\n\n> _Note:_ The default `Expression` initializer is for [quoted\n> identifiers](https://www.sqlite.org/lang_keywords.html) (_i.e._, column\n> names). To build a literal SQL expression, use `init(literal:)`.\n> <!-- FIXME -->\n\n\n### Compound Expressions\n\nExpressions can be combined with other expressions and types using\n[filter operators and functions](#filter-operators-and-functions)\n(as well as other [non-filter operators](#other-operators) and\n[functions](#core-sqlite-functions)). These building blocks can create complex SQLite statements.\n\n\n### Queries\n\nQueries are structures that reference a database and table name, and can be\nused to build a variety of statements using expressions. We can create a\nquery by initializing a `Table`, `View`, or `VirtualTable`.\n\n```swift\nlet users = Table(\"users\")\n```\n\nAssuming [the table exists](#creating-a-table), we can immediately [insert\n](#inserting-rows), [select](#selecting-rows), [update](#updating-rows), and\n[delete](#deleting-rows) rows.\n\n\n## Creating a Table\n\nWe can build [`CREATE TABLE`\nstatements](https://www.sqlite.org/lang_createtable.html) by calling the\n`create` function on a `Table`. The following is a basic example of\nSQLite.swift code (using the [expressions](#expressions) and\n[query](#queries) above) and the corresponding SQL it generates.\n\n```swift\ntry db.run(users.create { t in     // CREATE TABLE \"users\" (\n    t.column(id, primaryKey: true) //     \"id\" INTEGER PRIMARY KEY NOT NULL,\n    t.column(email, unique: true)  //     \"email\" TEXT UNIQUE NOT NULL,\n    t.column(name)                 //     \"name\" TEXT\n})                                 // )\n```\n\n> _Note:_ `Expression<T>` structures (in this case, the `id` and `email`\n> columns), generate `NOT NULL` constraints automatically, while\n> `Expression<T?>` structures (`name`) do not.\n\n\n### Create Table Options\n\nThe `Table.create` function has several default parameters we can override.\n\n  - `temporary` adds a `TEMPORARY` clause to the `CREATE TABLE` statement (to\n    create a temporary table that will automatically drop when the database\n    connection closes). Default: `false`.\n\n    ```swift\n    try db.run(users.create(temporary: true) { t in /* ... */ })\n    // CREATE TEMPORARY TABLE \"users\" -- ...\n    ```\n\n  - `ifNotExists` adds an `IF NOT EXISTS` clause to the `CREATE TABLE`\n    statement (which will bail out gracefully if the table already exists).\n    Default: `false`.\n\n    ```swift\n    try db.run(users.create(ifNotExists: true) { t in /* ... */ })\n    // CREATE TABLE \"users\" IF NOT EXISTS -- ...\n    ```\n\n### Column Constraints\n\nThe `column` function is used for a single column definition. It takes an\n[expression](#expressions) describing the column name and type, and accepts\nseveral parameters that map to various column constraints and clauses.\n\n  - `primaryKey` adds a `PRIMARY KEY` constraint to a single column.\n\n    ```swift\n    t.column(id, primaryKey: true)\n    // \"id\" INTEGER PRIMARY KEY NOT NULL\n\n    t.column(id, primaryKey: .autoincrement)\n    // \"id\" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL\n    ```\n\n    > _Note:_ The `primaryKey` parameter cannot be used alongside\n    > `references`. If you need to create a column that has a default value\n    > and is also a primary and/or foreign key, use the `primaryKey` and\n    > `foreignKey` functions mentioned under\n    > [Table Constraints](#table-constraints).\n    >\n    > Primary keys cannot be optional (_e.g._, `Expression<Int64?>`).\n    >\n    > Only an `INTEGER PRIMARY KEY` can take `.autoincrement`.\n\n  - `unique` adds a `UNIQUE` constraint to the column. (See the `unique`\n    function under [Table Constraints](#table-constraints) for uniqueness\n    over multiple columns).\n\n    ```swift\n    t.column(email, unique: true)\n    // \"email\" TEXT UNIQUE NOT NULL\n    ```\n\n  - `check` attaches a `CHECK` constraint to a column definition in the form\n    of a boolean expression (`Expression<Bool>`). Boolean expressions can be\n    easily built using\n    [filter operators and functions](#filter-operators-and-functions).\n    (See also the `check` function under\n    [Table Constraints](#table-constraints).)\n\n    ```swift\n    t.column(email, check: email.like(\"%@%\"))\n    // \"email\" TEXT NOT NULL CHECK (\"email\" LIKE '%@%')\n    ```\n\n  - `defaultValue` adds a `DEFAULT` clause to a column definition and _only_\n    accepts a value (or expression) matching the column’s type. This value is\n    used if none is explicitly provided during\n    [an `INSERT`](#inserting-rows).\n\n    ```swift\n    t.column(name, defaultValue: \"Anonymous\")\n    // \"name\" TEXT DEFAULT 'Anonymous'\n    ```\n\n    > _Note:_ The `defaultValue` parameter cannot be used alongside\n    > `primaryKey` and `references`. If you need to create a column that has\n    > a default value and is also a primary and/or foreign key, use the\n    > `primaryKey` and `foreignKey` functions mentioned under\n    > [Table Constraints](#table-constraints).\n\n  - `collate` adds a `COLLATE` clause to `Expression<String>` (and\n    `Expression<String?>`) column definitions with\n    [a collating sequence](https://www.sqlite.org/datatype3.html#collation)\n    defined in the `Collation` enumeration.\n\n    ```swift\n    t.column(email, collate: .nocase)\n    // \"email\" TEXT NOT NULL COLLATE \"NOCASE\"\n\n    t.column(name, collate: .rtrim)\n    // \"name\" TEXT COLLATE \"RTRIM\"\n    ```\n\n  - `references` adds a `REFERENCES` clause to `Expression<Int64>` (and\n    `Expression<Int64?>`) column definitions and accepts a table\n    (`SchemaType`) or namespaced column expression. (See the `foreignKey`\n    function under [Table Constraints](#table-constraints) for non-integer\n    foreign key support.)\n\n    ```swift\n    t.column(user_id, references: users, id)\n    // \"user_id\" INTEGER REFERENCES \"users\" (\"id\")\n    ```\n\n    > _Note:_ The `references` parameter cannot be used alongside\n    > `primaryKey` and `defaultValue`. If you need to create a column that\n    > has a default value and is also a primary and/or foreign key, use the\n    > `primaryKey` and `foreignKey` functions mentioned under\n    > [Table Constraints](#table-constraints).\n\n\n### Table Constraints\n\nAdditional constraints may be provided outside the scope of a single column\nusing the following functions.\n\n  - `primaryKey` adds a `PRIMARY KEY` constraint to the table. Unlike [the\n    column constraint, above](#column-constraints), it supports all SQLite\n    types, [ascending and descending orders](#sorting-rows), and composite\n    (multiple column) keys.\n\n    ```swift\n    t.primaryKey(email.asc, name)\n    // PRIMARY KEY(\"email\" ASC, \"name\")\n    ```\n\n  - `unique` adds a `UNIQUE` constraint to the table. Unlike\n    [the column constraint, above](#column-constraints), it\n    supports composite (multiplecolumn) constraints.\n\n    ```swift\n    t.unique(local, domain)\n    // UNIQUE(\"local\", \"domain\")\n    ```\n\n  - `check` adds a `CHECK` constraint to the table in the form of a boolean\n    expression (`Expression<Bool>`). Boolean expressions can be easily built\n    using [filter operators and functions](#filter-operators-and-functions).\n    (See also the `check` parameter under\n    [Column Constraints](#column-constraints).)\n\n    ```swift\n    t.check(balance >= 0)\n    // CHECK (\"balance\" >= 0.0)\n    ```\n\n  - `foreignKey` adds a `FOREIGN KEY` constraint to the table. Unlike [the\n    `references` constraint, above](#column-constraints), it supports all\n    SQLite types, both [`ON UPDATE` and `ON DELETE`\n    actions](https://www.sqlite.org/foreignkeys.html#fk_actions), and\n    composite (multiple column) keys.\n\n    ```swift\n    t.foreignKey(user_id, references: users, id, delete: .setNull)\n    // FOREIGN KEY(\"user_id\") REFERENCES \"users\"(\"id\") ON DELETE SET NULL\n    ```\n\n<!-- TODO\n### Creating a Table from a Select Statement\n-->\n\n\n## Inserting Rows\n\nWe can insert rows into a table by calling a [query’s](#queries) `insert`\nfunction with a list of [setters](#setters)—typically [typed column\nexpressions](#expressions) and values (which can also be expressions)—each\njoined by the `<-` operator.\n\n```swift\ntry db.run(users.insert(email <- \"alice@mac.com\", name <- \"Alice\"))\n// INSERT INTO \"users\" (\"email\", \"name\") VALUES ('alice@mac.com', 'Alice')\n\ntry db.run(users.insert(or: .replace, email <- \"alice@mac.com\", name <- \"Alice B.\"))\n// INSERT OR REPLACE INTO \"users\" (\"email\", \"name\") VALUES ('alice@mac.com', 'Alice B.')\n```\n\nThe `insert` function, when run successfully, returns an `Int64` representing\nthe inserted row’s [`ROWID`][ROWID].\n\n```swift\ndo {\n    let rowid = try db.run(users.insert(email <- \"alice@mac.com\"))\n    print(\"inserted id: \\(rowid)\")\n} catch {\n    print(\"insertion failed: \\(error)\")\n}\n```\n\nMultiple rows can be inserted at once by similarly calling `insertMany` with an array of\nper-row [setters](#setters).\n\n```swift\ndo {\n    let lastRowid = try db.run(users.insertMany([mail <- \"alice@mac.com\"], [email <- \"geoff@mac.com\"]))\n    print(\"last inserted id: \\(lastRowid)\")\n} catch {\n    print(\"insertion failed: \\(error)\")\n}\n```\n\n\nThe [`update`](#updating-rows) and [`delete`](#deleting-rows) functions\nfollow similar patterns.\n\n> _Note:_ If `insert` is called without any arguments, the statement will run\n> with a `DEFAULT VALUES` clause. The table must not have any constraints\n> that aren’t fulfilled by default values.\n>\n> ```swift\n> try db.run(timestamps.insert())\n> // INSERT INTO \"timestamps\" DEFAULT VALUES\n> ```\n\n### Handling SQLite errors\n\nYou can pattern match on the error to selectively catch SQLite errors. For example, to\nspecifically handle constraint errors ([SQLITE_CONSTRAINT](https://sqlite.org/rescode.html#constraint)):\n\n```swift\ndo {\n    try db.run(users.insert(email <- \"alice@mac.com\"))\n    try db.run(users.insert(email <- \"alice@mac.com\"))\n} catch let Result.error(message, code, statement) where code == SQLITE_CONSTRAINT {\n    print(\"constraint failed: \\(message), in \\(statement)\")\n} catch let error {\n    print(\"insertion failed: \\(error)\")\n}\n```\n\nThe `Result.error` type contains the English-language text that describes the error (`message`),\nthe error `code` (see [SQLite result code list](https://sqlite.org/rescode.html#primary_result_code_list)\nfor details) and a optional reference to the `statement` which produced the error.\n\n### Setters\n\nSQLite.swift typically uses the `<-` operator to set values during [inserts\n](#inserting-rows) and [updates](#updating-rows).\n\n```swift\ntry db.run(counter.update(count <- 0))\n// UPDATE \"counters\" SET \"count\" = 0 WHERE (\"id\" = 1)\n```\n\nThere are also a number of convenience setters that take the existing value\ninto account using native Swift operators.\n\nFor example, to atomically increment a column, we can use `++`:\n\n```swift\ntry db.run(counter.update(count++)) // equivalent to `counter.update(count -> count + 1)`\n// UPDATE \"counters\" SET \"count\" = \"count\" + 1 WHERE (\"id\" = 1)\n```\n\nTo take an amount and “move” it via transaction, we can use `-=` and `+=`:\n\n```swift\nlet amount = 100.0\ntry db.transaction {\n    try db.run(alice.update(balance -= amount))\n    try db.run(betty.update(balance += amount))\n}\n// BEGIN DEFERRED TRANSACTION\n// UPDATE \"users\" SET \"balance\" = \"balance\" - 100.0 WHERE (\"id\" = 1)\n// UPDATE \"users\" SET \"balance\" = \"balance\" + 100.0 WHERE (\"id\" = 2)\n// COMMIT TRANSACTION\n```\n\n\n###### Infix Setters\n\n| Operator | Types              |\n| -------- | ------------------ |\n| `<-`     | `Value -> Value`   |\n| `+=`     | `Number -> Number` |\n| `-=`     | `Number -> Number` |\n| `*=`     | `Number -> Number` |\n| `/=`     | `Number -> Number` |\n| `%=`     | `Int -> Int`       |\n| `<<=`    | `Int -> Int`       |\n| `>>=`    | `Int -> Int`       |\n| `&=`     | `Int -> Int`       |\n| `\\|\\|=`  | `Int -> Int`       |\n| `^=`     | `Int -> Int`       |\n| `+=`     | `String -> String` |\n\n\n###### Postfix Setters\n\n| Operator | Types        |\n| -------- | ------------ |\n| `++`     | `Int -> Int` |\n| `--`     | `Int -> Int` |\n\n\n## Selecting Rows\n\n[Query structures](#queries) are `SELECT` statements waiting to happen. They\nexecute via [iteration](#iterating-and-accessing-values) and [other means\n](#plucking-values) of sequence access.\n\n\n### Iterating and Accessing Values\n\nPrepared [queries](#queries) execute lazily upon iteration. Each row is\nreturned as a `Row` object, which can be subscripted with a [column\nexpression](#expressions) matching one of the columns returned.\n\n```swift\nfor user in try db.prepare(users) {\n    print(\"id: \\(user[id]), email: \\(user[email]), name: \\(user[name])\")\n    // id: 1, email: alice@mac.com, name: Optional(\"Alice\")\n}\n// SELECT * FROM \"users\"\n```\n\n`Expression<T>` column values are _automatically unwrapped_ (we’ve made a\npromise to the compiler that they’ll never be `NULL`), while `Expression<T?>`\nvalues remain wrapped.\n\n⚠ Column subscripts on `Row` will force try and abort execution in error cases.\nIf you want to handle this yourself, use `Row.get(_ column: Expression<V>)`:\n\n```swift\nfor user in try db.prepare(users) {\n    do {\n        print(\"name: \\(try user.get(name))\")\n    } catch {\n        // handle\n    }\n}\n```\n\nNote that the iterator can throw *undeclared* database errors at any point during\niteration:\n\n```swift\nlet query = try db.prepare(users)\nfor user in query {\n    // 💥 can throw an error here\n}\n```\n\n#### Failable iteration\n\nIt is therefore recommended using the `RowIterator` API instead,\nwhich has explicit error handling:\n\n```swift\n// option 1: convert results into an Array of rows\nlet rowIterator = try db.prepareRowIterator(users)\nfor user in try Array(rowIterator) {\n    print(\"id: \\(user[id]), email: \\(user[email])\")\n}\n\n/// option 2: transform results using `map()`\nlet mapRowIterator = try db.prepareRowIterator(users)\nlet userIds = try mapRowIterator.map { $0[id] }\n\n/// option 3: handle each row individually with `failableNext()`\ndo {\n    while let row = try rowIterator.failableNext() {\n        // Handle row\n    }\n} catch {\n    // Handle error\n}\n```\n\n### Plucking Rows\n\nWe can pluck the first row by passing a query to the `pluck` function on a\ndatabase connection.\n\n```swift\nif let user = try db.pluck(users) { /* ... */ } // Row\n// SELECT * FROM \"users\" LIMIT 1\n```\n\nTo collect all rows into an array, we can simply wrap the sequence (though\nthis is not always the most memory-efficient idea).\n\n```swift\nlet all = Array(try db.prepare(users))\n// SELECT * FROM \"users\"\n```\n\n\n### Building Complex Queries\n\n[Queries](#queries) have a number of chainable functions that can be used\n(with [expressions](#expressions)) to add and modify [a number of\nclauses](https://www.sqlite.org/lang_select.html) to the underlying\nstatement.\n\n```swift\nlet query = users.select(email)           // SELECT \"email\" FROM \"users\"\n                 .filter(name != nil)     // WHERE \"name\" IS NOT NULL\n                 .order(email.desc, name) // ORDER BY \"email\" DESC, \"name\"\n                 .limit(5, offset: 1)     // LIMIT 5 OFFSET 1\n```\n\n\n#### Selecting Columns\n\nBy default, [queries](#queries) select every column of the result set (using\n`SELECT *`). We can use the `select` function with a list of\n[expressions](#expressions) to return specific columns instead.\n\n```swift\nfor user in try db.prepare(users.select(id, email)) {\n    print(\"id: \\(user[id]), email: \\(user[email])\")\n    // id: 1, email: alice@mac.com\n}\n// SELECT \"id\", \"email\" FROM \"users\"\n```\n\nWe can access the results of more complex expressions by holding onto a\nreference of the expression itself.\n\n```swift\nlet sentence = name + \" is \" + cast(age) as Expression<String?> + \" years old!\"\nfor user in users.select(sentence) {\n    print(user[sentence])\n    // Optional(\"Alice is 30 years old!\")\n}\n// SELECT (((\"name\" || ' is ') || CAST (\"age\" AS TEXT)) || ' years old!') FROM \"users\"\n```\n\n\n#### Joining Other Tables\n\nWe can join tables using a [query’s](#queries) `join` function.\n\n```swift\nusers.join(posts, on: user_id == users[id])\n// SELECT * FROM \"users\" INNER JOIN \"posts\" ON (\"user_id\" = \"users\".\"id\")\n```\n\nThe `join` function takes a [query](#queries) object (for the table being\njoined on), a join condition (`on`), and is prefixed with an optional join\ntype (default: `.inner`). Join conditions can be built using [filter\noperators and functions](#filter-operators-and-functions), generally require\n[namespacing](#column-namespacing), and sometimes require\n[aliasing](#table-aliasing).\n\n\n##### Column Namespacing\n\nWhen joining tables, column names can become ambiguous. _E.g._, both tables\nmay have an `id` column.\n\n```swift\nlet query = users.join(posts, on: user_id == id)\n// assertion failure: ambiguous column 'id'\n```\n\nWe can disambiguate by namespacing `id`.\n\n```swift\nlet query = users.join(posts, on: user_id == users[id])\n// SELECT * FROM \"users\" INNER JOIN \"posts\" ON (\"user_id\" = \"users\".\"id\")\n```\n\nNamespacing is achieved by subscripting a [query](#queries) with a [column\nexpression](#expressions) (_e.g._, `users[id]` above becomes `users.id`).\n\n> _Note:_ We can namespace all of a table’s columns using `*`.\n>\n> ```swift\n> let query = users.select(users[*])\n> // SELECT \"users\".* FROM \"users\"\n> ```\n\n\n##### Table Aliasing\n\nOccasionally, we need to join a table to itself, in which case we must alias\nthe table with another name. We can achieve this using the\n[query’s](#queries) `alias` function.\n\n```swift\nlet managers = users.alias(\"managers\")\n\nlet query = users.join(managers, on: managers[id] == users[managerId])\n// SELECT * FROM \"users\"\n// INNER JOIN (\"users\") AS \"managers\" ON (\"managers\".\"id\" = \"users\".\"manager_id\")\n```\n\nIf query results can have ambiguous column names, row values should be\naccessed with namespaced [column expressions](#expressions). In the above\ncase, `SELECT *` immediately namespaces all columns of the result set.\n\n```swift\nlet user = try db.pluck(query)\nuser[id]           // fatal error: ambiguous column 'id'\n                   // (please disambiguate: [\"users\".\"id\", \"managers\".\"id\"])\n\nuser[users[id]]    // returns \"users\".\"id\"\nuser[managers[id]] // returns \"managers\".\"id\"\n```\n\n\n#### Filtering Rows\n\nSQLite.swift filters rows using a [query’s](#queries) `filter` function with\na boolean [expression](#expressions) (`Expression<Bool>`).\n\n```swift\nusers.filter(id == 1)\n// SELECT * FROM \"users\" WHERE (\"id\" = 1)\n\nusers.filter([1, 2, 3, 4, 5].contains(id))\n// SELECT * FROM \"users\" WHERE (\"id\" IN (1, 2, 3, 4, 5))\n\nusers.filter(email.like(\"%@mac.com\"))\n// SELECT * FROM \"users\" WHERE (\"email\" LIKE '%@mac.com')\n\nusers.filter(verified && name.lowercaseString == \"alice\")\n// SELECT * FROM \"users\" WHERE (\"verified\" AND (lower(\"name\") == 'alice'))\n\nusers.filter(verified || balance >= 10_000)\n// SELECT * FROM \"users\" WHERE (\"verified\" OR (\"balance\" >= 10000.0))\n```\n\nWe can build our own boolean expressions by using one of the many [filter\noperators and functions](#filter-operators-and-functions).\n\nInstead of `filter` we can also use the `where` function which is an alias:\n\n```swift\nusers.where(id == 1)\n// SELECT * FROM \"users\" WHERE (\"id\" = 1)\n```\n\n##### Filter Operators and Functions\n\nSQLite.swift defines a number of operators for building filtering predicates.\nOperators and functions work together in a type-safe manner, so attempting to\nequate or compare different types will prevent compilation.\n\n\n###### Infix Filter Operators\n\n| Swift | Types                            | SQLite         |\n| ----- | -------------------------------- | -------------- |\n| `==`  | `Equatable -> Bool`              | `=`/`IS`*      |\n| `!=`  | `Equatable -> Bool`              | `!=`/`IS NOT`* |\n| `>`   | `Comparable -> Bool`             | `>`            |\n| `>=`  | `Comparable -> Bool`             | `>=`           |\n| `<`   | `Comparable -> Bool`             | `<`            |\n| `<=`  | `Comparable -> Bool`             | `<=`           |\n| `~=`  | `(Interval, Comparable) -> Bool` | `BETWEEN`      |\n| `&&`  | `Bool -> Bool`                   | `AND`          |\n| `\\|\\|`| `Bool -> Bool`                   | `OR`           |\n| `===` | `Equatable -> Bool`              | `IS`           |\n| `!==` | `Equatable -> Bool`              | `IS NOT`       |\n\n> * When comparing against `nil`, SQLite.swift will use `IS` and `IS NOT`\n> accordingly.\n\n\n###### Prefix Filter Operators\n\n| Swift | Types              | SQLite |\n| ----- | ------------------ | ------ |\n| `!`   | `Bool -> Bool`     | `NOT`  |\n\n\n###### Filtering Functions\n\n| Swift      | Types                   | SQLite  |\n| ---------- | ----------------------- | ------- |\n| `like`     | `String -> Bool`        | `LIKE`  |\n| `glob`     | `String -> Bool`        | `GLOB`  |\n| `match`    | `String -> Bool`        | `MATCH` |\n| `contains` | `(Array<T>, T) -> Bool` | `IN`    |\n\n\n<!-- TODO\n#### Grouping Results\n-->\n\n\n#### Sorting Rows\n\nWe can pre-sort returned rows using the [query’s](#queries) `order` function.\n\n_E.g._, to return users sorted by `email`, then `name`, in ascending order:\n\n```swift\nusers.order(email, name)\n// SELECT * FROM \"users\" ORDER BY \"email\", \"name\"\n```\n\nThe `order` function takes a list of [column expressions](#expressions).\n\n`Expression` objects have two computed properties to assist sorting: `asc`\nand `desc`. These properties append the expression with `ASC` and `DESC` to\nmark ascending and descending order respectively.\n\n```swift\nusers.order(email.desc, name.asc)\n// SELECT * FROM \"users\" ORDER BY \"email\" DESC, \"name\" ASC\n```\n\n\n#### Limiting and Paging Results\n\nWe can limit and skip returned rows using a [query’s](#queries) `limit`\nfunction (and its optional `offset` parameter).\n\n```swift\nusers.limit(5)\n// SELECT * FROM \"users\" LIMIT 5\n\nusers.limit(5, offset: 5)\n// SELECT * FROM \"users\" LIMIT 5 OFFSET 5\n```\n\n\n#### Recursive and Hierarchical Queries\n\nWe can perform a recursive or hierarchical query using a [query's](#queries)\n[`WITH`](https://sqlite.org/lang_with.html) function.\n\n```swift\n// Get the management chain for the manager with id == 8\n\nlet chain = Table(\"chain\")\nlet id = Expression<Int64>(\"id\")\nlet managerId = Expression<Int64>(\"manager_id\")\n\nlet query = managers\n    .where(id == 8)\n    .union(chain.join(managers, on: chain[managerId] == managers[id])\n\nchain.with(chain, recursive: true, as: query)\n// WITH RECURSIVE\n//   \"chain\" AS (\n//     SELECT * FROM \"managers\" WHERE \"id\" = 8\n//     UNION\n//     SELECT * from \"chain\"\n//     JOIN \"managers\" ON \"chain\".\"manager_id\" = \"managers\".\"id\"\n//   )\n// SELECT * FROM \"chain\"\n```\n\nColumn names and a materialization hint can optionally be provided.\n\n```swift\n// Add a \"level\" column to the query representing manager's position in the chain\nlet level = Expression<Int64>(\"level\")\n\nlet queryWithLevel =\n    managers\n        .select(id, managerId, 0)\n        .where(id == 8)\n        .union(\n            chain\n                .select(managers[id], managers[manager_id], level + 1)\n                .join(managers, on: chain[managerId] == managers[id])\n        )\n\nchain.with(chain,\n           columns: [id, managerId, level],\n           recursive: true,\n           hint: .materialize,\n           as: queryWithLevel)\n// WITH RECURSIVE\n//   \"chain\" (\"id\", \"manager_id\", \"level\") AS MATERIALIZED (\n//     SELECT (\"id\", \"manager_id\", 0) FROM \"managers\" WHERE \"id\" = 8\n//     UNION\n//     SELECT (\"manager\".\"id\", \"manager\".\"manager_id\", \"level\" + 1) FROM \"chain\"\n//     JOIN \"managers\" ON \"chain\".\"manager_id\" = \"managers\".\"id\"\n//   )\n// SELECT * FROM \"chain\"\n```\n\n\n#### Aggregation\n\n[Queries](#queries) come with a number of functions that quickly return\naggregate scalar values from the table. These mirror the [core aggregate\nfunctions](#aggregate-sqlite-functions) and are executed immediately against\nthe query.\n\n```swift\nlet count = try db.scalar(users.count)\n// SELECT count(*) FROM \"users\"\n```\n\nFiltered queries will appropriately filter aggregate values.\n\n```swift\nlet count = try db.scalar(users.filter(name != nil).count)\n// SELECT count(*) FROM \"users\" WHERE \"name\" IS NOT NULL\n```\n\n  - `count` as a computed property on a query (see examples above) returns\n    the total number of rows matching the query.\n\n    `count` as a computed property on a column expression returns the total\n    number of rows where that column is not `NULL`.\n\n    ```swift\n    let count = try db.scalar(users.select(name.count)) // -> Int\n    // SELECT count(\"name\") FROM \"users\"\n    ```\n\n  - `max` takes a comparable column expression and returns the largest value\n    if any exists.\n\n    ```swift\n    let max = try db.scalar(users.select(id.max)) // -> Int64?\n    // SELECT max(\"id\") FROM \"users\"\n    ```\n\n  - `min` takes a comparable column expression and returns the smallest value\n    if any exists.\n\n    ```swift\n    let min = try db.scalar(users.select(id.min)) // -> Int64?\n    // SELECT min(\"id\") FROM \"users\"\n    ```\n\n  - `average` takes a numeric column expression and returns the average row\n    value (as a `Double`) if any exists.\n\n    ```swift\n    let average = try db.scalar(users.select(balance.average)) // -> Double?\n    // SELECT avg(\"balance\") FROM \"users\"\n    ```\n\n  - `sum` takes a numeric column expression and returns the sum total of all\n    rows if any exist.\n\n    ```swift\n    let sum = try db.scalar(users.select(balance.sum)) // -> Double?\n    // SELECT sum(\"balance\") FROM \"users\"\n    ```\n\n  - `total`, like `sum`, takes a numeric column expression and returns the\n    sum total of all rows, but in this case always returns a `Double`, and\n    returns `0.0` for an empty query.\n\n    ```swift\n    let total = try db.scalar(users.select(balance.total)) // -> Double\n    // SELECT total(\"balance\") FROM \"users\"\n    ```\n\n> _Note:_ Expressions can be prefixed with a `DISTINCT` clause by calling the\n> `distinct` computed property.\n>\n> ```swift\n> let count = try db.scalar(users.select(name.distinct.count) // -> Int\n> // SELECT count(DISTINCT \"name\") FROM \"users\"\n> ```\n\n## Upserting Rows\n\nWe can upsert rows into a table by calling a [query’s](#queries) `upsert`\nfunction with a list of [setters](#setters)—typically [typed column\nexpressions](#expressions) and values (which can also be expressions)—each\njoined by the `<-` operator. Upserting is like inserting, except if there is a\nconflict on the specified column value, SQLite will perform an update on the row instead.\n\n```swift\ntry db.run(users.upsert(email <- \"alice@mac.com\", name <- \"Alice\", onConflictOf: email))\n// INSERT INTO \"users\" (\"email\", \"name\") VALUES ('alice@mac.com', 'Alice') ON CONFLICT (\\\"email\\\") DO UPDATE SET \\\"name\\\" = \\\"excluded\\\".\\\"name\\\"\n```\n\nThe `upsert` function, when run successfully, returns an `Int64` representing\nthe inserted row’s [`ROWID`][ROWID].\n\n```swift\ndo {\n    let rowid = try db.run(users.upsert(email <- \"alice@mac.com\", name <- \"Alice\", onConflictOf: email))\n    print(\"inserted id: \\(rowid)\")\n} catch {\n    print(\"insertion failed: \\(error)\")\n}\n```\n\nThe [`insert`](#inserting-rows), [`update`](#updating-rows), and [`delete`](#deleting-rows) functions\nfollow similar patterns.\n\n## Updating Rows\n\nWe can update a table’s rows by calling a [query’s](#queries) `update`\nfunction with a list of [setters](#setters)—typically [typed column\nexpressions](#expressions) and values (which can also be expressions)—each\njoined by the `<-` operator.\n\nWhen an unscoped query calls `update`, it will update _every_ row in the\ntable.\n\n```swift\ntry db.run(users.update(email <- \"alice@me.com\"))\n// UPDATE \"users\" SET \"email\" = 'alice@me.com'\n```\n\nBe sure to scope `UPDATE` statements beforehand using [the `filter` function\n](#filtering-rows).\n\n```swift\nlet alice = users.filter(id == 1)\ntry db.run(alice.update(email <- \"alice@me.com\"))\n// UPDATE \"users\" SET \"email\" = 'alice@me.com' WHERE (\"id\" = 1)\n```\n\nThe `update` function returns an `Int` representing the number of updated\nrows.\n\n```swift\ndo {\n    if try db.run(alice.update(email <- \"alice@me.com\")) > 0 {\n        print(\"updated alice\")\n    } else {\n        print(\"alice not found\")\n    }\n} catch {\n    print(\"update failed: \\(error)\")\n}\n```\n\n\n## Deleting Rows\n\nWe can delete rows from a table by calling a [query’s](#queries) `delete`\nfunction.\n\nWhen an unscoped query calls `delete`, it will delete _every_ row in the\ntable.\n\n```swift\ntry db.run(users.delete())\n// DELETE FROM \"users\"\n```\n\nBe sure to scope `DELETE` statements beforehand using\n[the `filter` function](#filtering-rows).\n\n```swift\nlet alice = users.filter(id == 1)\ntry db.run(alice.delete())\n// DELETE FROM \"users\" WHERE (\"id\" = 1)\n```\n\nThe `delete` function returns an `Int` representing the number of deleted\nrows.\n\n```swift\ndo {\n    if try db.run(alice.delete()) > 0 {\n        print(\"deleted alice\")\n    } else {\n        print(\"alice not found\")\n    }\n} catch {\n    print(\"delete failed: \\(error)\")\n}\n```\n\n\n## Transactions and Savepoints\n\nUsing the `transaction` and `savepoint` functions, we can run a series of\nstatements in a transaction. If a single statement fails or the block throws\nan error, the changes will be rolled back.\n\n```swift\ntry db.transaction {\n    let rowid = try db.run(users.insert(email <- \"betty@icloud.com\"))\n    try db.run(users.insert(email <- \"cathy@icloud.com\", managerId <- rowid))\n}\n// BEGIN DEFERRED TRANSACTION\n// INSERT INTO \"users\" (\"email\") VALUES ('betty@icloud.com')\n// INSERT INTO \"users\" (\"email\", \"manager_id\") VALUES ('cathy@icloud.com', 2)\n// COMMIT TRANSACTION\n```\n\n> _Note:_ Transactions run in a serial queue.\n\n## Querying the Schema\n\nWe can obtain generic information about objects in the current schema with a `SchemaReader`:\n\n```swift\nlet schema = db.schema\n```\n\nTo query the data:\n\n```swift\nlet indexes = try schema.objectDefinitions(type: .index)\nlet tables = try schema.objectDefinitions(type: .table)\nlet triggers = try schema.objectDefinitions(type: .trigger)\n```\n\n### Indexes and Columns\n\nSpecialized methods are available to get more detailed information:\n\n```swift\nlet indexes = try schema.indexDefinitions(\"users\")\nlet columns = try schema.columnDefinitions(\"users\")\n\nfor index in indexes {\n    print(\"\\(index.name) columns:\\(index.columns))\")\n}\nfor column in columns {\n    print(\"\\(column.name) pk:\\(column.primaryKey) nullable: \\(column.nullable)\")\n}\n```\n\n## Altering the Schema\n\nSQLite.swift comes with several functions (in addition to `Table.create`) for\naltering a database schema in a type-safe manner.\n\n### Renaming Tables\n\nWe can build an `ALTER TABLE … RENAME TO` statement by calling the `rename`\nfunction on a `Table` or `VirtualTable`.\n\n```swift\ntry db.run(users.rename(Table(\"users_old\")))\n// ALTER TABLE \"users\" RENAME TO \"users_old\"\n```\n\n### Dropping Tables\n\nWe can build\n[`DROP TABLE` statements](https://www.sqlite.org/lang_droptable.html)\nby calling the `dropTable` function on a `SchemaType`.\n\n```swift\ntry db.run(users.drop())\n// DROP TABLE \"users\"\n```\n\nThe `drop` function has one additional parameter, `ifExists`, which (when\n`true`) adds an `IF EXISTS` clause to the statement.\n\n```swift\ntry db.run(users.drop(ifExists: true))\n// DROP TABLE IF EXISTS \"users\"\n```\n\n### Adding Columns\n\nWe can add columns to a table by calling `addColumn` function on a `Table`.\nSQLite.swift enforces\n[the same limited subset](https://www.sqlite.org/lang_altertable.html) of\n`ALTER TABLE` that SQLite supports.\n\n```swift\ntry db.run(users.addColumn(suffix))\n// ALTER TABLE \"users\" ADD COLUMN \"suffix\" TEXT\n```\n\n#### Added Column Constraints\n\nThe `addColumn` function shares several of the same [`column` function\nparameters](#column-constraints) used when [creating\ntables](#creating-a-table).\n\n  - `check` attaches a `CHECK` constraint to a column definition in the form\n    of a boolean expression (`Expression<Bool>`). (See also the `check`\n    function under [Table Constraints](#table-constraints).)\n\n    ```swift\n    try db.run(users.addColumn(suffix, check: [\"JR\", \"SR\"].contains(suffix)))\n    // ALTER TABLE \"users\" ADD COLUMN \"suffix\" TEXT CHECK (\"suffix\" IN ('JR', 'SR'))\n    ```\n\n  - `defaultValue` adds a `DEFAULT` clause to a column definition and _only_\n    accepts a value matching the column’s type. This value is used if none is\n    explicitly provided during [an `INSERT`](#inserting-rows).\n\n    ```swift\n    try db.run(users.addColumn(suffix, defaultValue: \"SR\"))\n    // ALTER TABLE \"users\" ADD COLUMN \"suffix\" TEXT DEFAULT 'SR'\n    ```\n\n    > _Note:_ Unlike the [`CREATE TABLE` constraint](#table-constraints),\n    > default values may not be expression structures (including\n    > `CURRENT_TIME`, `CURRENT_DATE`, or `CURRENT_TIMESTAMP`).\n\n  - `collate` adds a `COLLATE` clause to `Expression<String>` (and\n    `Expression<String?>`) column definitions with [a collating\n    sequence](https://www.sqlite.org/datatype3.html#collation) defined in the\n    `Collation` enumeration.\n\n    ```swift\n    try db.run(users.addColumn(email, collate: .nocase))\n    // ALTER TABLE \"users\" ADD COLUMN \"email\" TEXT NOT NULL COLLATE \"NOCASE\"\n\n    try db.run(users.addColumn(name, collate: .rtrim))\n    // ALTER TABLE \"users\" ADD COLUMN \"name\" TEXT COLLATE \"RTRIM\"\n    ```\n\n  - `references` adds a `REFERENCES` clause to `Int64` (and `Int64?`) column\n    definitions and accepts a table or namespaced column expression. (See the\n    `foreignKey` function under [Table Constraints](#table-constraints) for\n    non-integer foreign key support.)\n\n    ```swift\n    try db.run(posts.addColumn(userId, references: users, id)\n    // ALTER TABLE \"posts\" ADD COLUMN \"user_id\" INTEGER REFERENCES \"users\" (\"id\")\n    ```\n\n### SchemaChanger\n\nVersion 0.14.0 introduces `SchemaChanger`, an alternative API to perform more complex\nmigrations such as renaming columns. These operations work with all versions of\nSQLite but use SQL statements such as `ALTER TABLE RENAME COLUMN` when available.\n\n#### Adding Columns\n\n```swift\nlet newColumn = ColumnDefinition(\n    name: \"new_text_column\",\n    type: .TEXT,\n    nullable: true,\n    defaultValue: .stringLiteral(\"foo\")\n)\n\nlet schemaChanger = SchemaChanger(connection: db)\n\ntry schemaChanger.alter(table: \"users\") { table in\n    table.add(column: newColumn)\n}\n```\n\n#### Renaming Columns\n\n```swift\nlet schemaChanger = SchemaChanger(connection: db)\ntry schemaChanger.alter(table: \"users\") { table in\n    table.rename(column: \"old_name\", to: \"new_name\")\n}\n```\n\n#### Dropping Columns\n\n```swift\nlet schemaChanger = SchemaChanger(connection: db)\ntry schemaChanger.alter(table: \"users\") { table in\n    table.drop(column: \"email\")\n}\n```\n\n#### Renaming/Dropping Tables\n\n```swift\nlet schemaChanger = SchemaChanger(connection: db)\n\ntry schemaChanger.rename(table: \"users\", to: \"users_new\")\ntry schemaChanger.drop(table: \"emails\", ifExists: false)\n```\n\n#### Creating Tables\n\n```swift\nlet schemaChanger = SchemaChanger(connection: db)\n\ntry schemaChanger.create(table: \"users\") { table in \n    table.add(column: .init(name: \"id\", primaryKey: .init(autoIncrement: true), type: .INTEGER))\n    table.add(column: .init(name: \"name\", type: .TEXT, nullable: false))            \n}\n``` \n\n### Indexes\n\n\n#### Creating Indexes\n\nWe can build\n[`CREATE INDEX` statements](https://www.sqlite.org/lang_createindex.html)\nby calling the `createIndex` function on a `SchemaType`.\n\n```swift\ntry db.run(users.createIndex(email))\n// CREATE INDEX \"index_users_on_email\" ON \"users\" (\"email\")\n```\n\nThe index name is generated automatically based on the table and column\nnames.\n\nThe `createIndex` function has a couple default parameters we can override.\n\n  - `unique` adds a `UNIQUE` constraint to the index. Default: `false`.\n\n    ```swift\n    try db.run(users.createIndex(email, unique: true))\n    // CREATE UNIQUE INDEX \"index_users_on_email\" ON \"users\" (\"email\")\n    ```\n\n  - `ifNotExists` adds an `IF NOT EXISTS` clause to the `CREATE TABLE`\n    statement (which will bail out gracefully if the table already exists).\n    Default: `false`.\n\n    ```swift\n    try db.run(users.createIndex(email, ifNotExists: true))\n    // CREATE INDEX IF NOT EXISTS \"index_users_on_email\" ON \"users\" (\"email\")\n    ```\n\n\n#### Dropping Indexes\n\nWe can build\n[`DROP INDEX` statements](https://www.sqlite.org/lang_dropindex.html) by\ncalling the `dropIndex` function on a `SchemaType`.\n\n```swift\ntry db.run(users.dropIndex(email))\n// DROP INDEX \"index_users_on_email\"\n```\n\nThe `dropIndex` function has one additional parameter, `ifExists`, which\n(when `true`) adds an `IF EXISTS` clause to the statement.\n\n```swift\ntry db.run(users.dropIndex(email, ifExists: true))\n// DROP INDEX IF EXISTS \"index_users_on_email\"\n```\n\n### Migrations and Schema Versioning\n\nYou can use the convenience property on `Connection` to query and set the\n[`PRAGMA user_version`](https://sqlite.org/pragma.html#pragma_user_version).\n\nThis is a great way to manage your schema’s version over migrations.\nYou can conditionally run your migrations along the lines of:\n\n```swift\nif db.userVersion == 0 {\n    // handle first migration\n    db.userVersion = 1\n}\nif db.userVersion == 1 {\n    // handle second migration\n    db.userVersion = 2\n}\n```\n\nFor more complex migration requirements check out the schema management\nsystem [SQLiteMigrationManager.swift][].\n\n## Custom Types\n\nSQLite.swift supports serializing and deserializing any custom type as long\nas it conforms to the `Value` protocol.\n\n```swift\nprotocol Value {\n    typealias Datatype: Binding\n    class var declaredDatatype: String { get }\n    class func fromDatatypeValue(datatypeValue: Datatype) -> Self\n    var datatypeValue: Datatype { get }\n}\n```\n\nThe `Datatype` must be one of the basic Swift types that values are bridged\nthrough before serialization and deserialization (see [Building Type-Safe SQL\n](#building-type-safe-sql) for a list of types).\n\n> ⚠ _Note:_ `Binding` is a protocol that SQLite.swift uses internally to\n> directly map SQLite types to Swift types. **Do _not_** conform custom types\n> to the `Binding` protocol.\n\n\n### Date-Time Values\n\nIn SQLite, `DATETIME` columns can be treated as strings or numbers, so we can\ntransparently bridge `Date` objects through Swift’s `String` types.\n\nWe can use these types directly in SQLite statements.\n\n```swift\nlet published_at = Expression<Date>(\"published_at\")\n\nlet published = posts.filter(published_at <= Date())\n// SELECT * FROM \"posts\" WHERE \"published_at\" <= '2014-11-18T12:45:30.000'\n\nlet startDate = Date(timeIntervalSince1970: 0)\nlet published = posts.filter(startDate...Date() ~= published_at)\n// SELECT * FROM \"posts\" WHERE \"published_at\" BETWEEN '1970-01-01T00:00:00.000' AND '2014-11-18T12:45:30.000'\n```\n\n\n### Binary Data\n\nWe can bridge any type that can be initialized from and encoded to `Data`.\n\n```swift\nextension UIImage: Value {\n    public class var declaredDatatype: String {\n        return Blob.declaredDatatype\n    }\n    public class func fromDatatypeValue(blobValue: Blob) -> UIImage {\n        return UIImage(data: Data.fromDatatypeValue(blobValue))!\n    }\n    public var datatypeValue: Blob {\n        return UIImagePNGRepresentation(self)!.datatypeValue\n    }\n\n}\n```\n\n> _Note:_ See the [Archives and Serializations Programming Guide][] for more\n> information on encoding and decoding custom types.\n\n\n[Archives and Serializations Programming Guide]: https://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/Archiving/Archiving.html\n\n## Codable Types\n\n[Codable types][Encoding and Decoding Custom Types] were introduced as a part\nof Swift 4 to  allow serializing and deserializing types. SQLite.swift supports\nthe insertion, updating, and retrieval of basic Codable types.\n\n[Encoding and Decoding Custom Types]: https://developer.apple.com/documentation/foundation/archives_and_serialization/encoding_and_decoding_custom_types\n\n### Inserting Codable Types\n\nQueries have a method to allow inserting an [Encodable][] type.\n\n```swift\nstruct User: Encodable {\n    let name: String\n}\ntry db.run(users.insert(User(name: \"test\")))\n\n```\n\nThere are two other parameters also available to this method:\n\n- `userInfo` is a dictionary that is passed to the encoder and made available\n  to encodable types to allow customizing their behavior.\n\n- `otherSetters` allows you to specify additional setters on top of those\n  that are generated from the encodable types themselves.\n\n[Encodable]: https://developer.apple.com/documentation/swift/encodable\n\n### Updating Codable Types\n\nQueries have a method to allow updating an Encodable type.\n\n```swift\ntry db.run(users.filter(id == userId).update(user))\n\n```\n\n> ⚠ Unless filtered, using the update method on an instance of a Codable\n> type updates all table rows.\n\nThere are two other parameters also available to this method:\n\n- `userInfo` is a dictionary that is passed to the encoder and made available\n  to encodable types to allow customizing their behavior.\n\n- `otherSetters` allows you to specify additional setters on top of those\n  that are generated from the encodable types themselves.\n\n### Retrieving Codable Types\n\nRows have a method to decode a [Decodable][] type.\n\n```swift\nlet loadedUsers: [User] = try db.prepare(users).map { row in\n    return try row.decode()\n}\n```\n\nYou can also create a decoder to use manually yourself. This can be useful\nfor example if you are using the\n[Facade pattern](https://en.wikipedia.org/wiki/Facade_pattern) to hide\nsubclasses behind a super class. For example, you may want to encode an Image\ntype that can be multiple different formats such as PNGImage, JPGImage, or\nHEIFImage. You will need to determine the correct subclass before you know\nwhich type to decode.\n\n```swift\nenum ImageCodingKeys: String, CodingKey {\n    case kind\n}\n\nenum ImageKind: Int, Codable {\n    case png, jpg, heif\n}\n\nlet loadedImages: [Image] = try db.prepare(images).map { row in\n    let decoder = row.decoder()\n    let container = try decoder.container(keyedBy: ImageCodingKeys.self)\n    switch try container.decode(ImageKind.self, forKey: .kind) {\n    case .png:\n        return try PNGImage(from: decoder)\n    case .jpg:\n        return try JPGImage(from: decoder)\n    case .heif:\n        return try HEIFImage(from: decoder)\n    }\n}\n```\n\nBoth of the above methods also have the following optional parameter:\n\n- `userInfo` is a dictionary that is passed to the decoder and made available\n  to decodable types to allow customizing their behavior.\n\n[Decodable]: https://developer.apple.com/documentation/swift/decodable\n\n### Restrictions\n\nThere are a few restrictions on using Codable types:\n\n- The encodable and decodable objects can only use the following types:\n    - Int, Bool, Float, Double, String, Date\n    - Nested Codable types that will be encoded as JSON to a single column\n- These methods will not handle object relationships for you. You must write\n  your own Codable and Decodable implementations if you wish to support this.\n- The Codable types may not try to access nested containers or nested unkeyed\n  containers\n- The Codable types may not access single value containers or unkeyed\n  containers\n- The Codable types may not access super decoders or encoders\n\n## Other Operators\n\nIn addition to [filter operators](#filtering-infix-operators), SQLite.swift\ndefines a number of operators that can modify expression values with\narithmetic, bitwise operations, and concatenation.\n\n\n###### Other Infix Operators\n\n| Swift | Types                            | SQLite   |\n| ----- | -------------------------------- | -------- |\n| `+`   | `Number -> Number`               | `+`      |\n| `-`   | `Number -> Number`               | `-`      |\n| `*`   | `Number -> Number`               | `*`      |\n| `/`   | `Number -> Number`               | `/`      |\n| `%`   | `Int -> Int`                     | `%`      |\n| `<<`  | `Int -> Int`                     | `<<`     |\n| `>>`  | `Int -> Int`                     | `>>`     |\n| `&`   | `Int -> Int`                     | `&`      |\n| `\\|`  | `Int -> Int`                     | `\\|`     |\n| `+`   | `String -> String`               | `\\|\\|`   |\n\n> _Note:_ SQLite.swift also defines a bitwise XOR operator, `^`, which\n> expands the expression `lhs ^ rhs` to `~(lhs & rhs) & (lhs | rhs)`.\n\n\n###### Other Prefix Operators\n\n| Swift | Types              | SQLite |\n| ----- | ------------------ | ------ |\n| `~`   | `Int -> Int`       | `~`    |\n| `-`   | `Number -> Number` | `-`    |\n\n\n## Core SQLite Functions\n\nMany of SQLite’s [core functions](https://www.sqlite.org/lang_corefunc.html)\nhave been surfaced in and type-audited for SQLite.swift.\n\n> _Note:_ SQLite.swift aliases the `??` operator to the `ifnull` function.\n>\n> ```swift\n> name ?? email // ifnull(\"name\", \"email\")\n> ```\n\n\n## Aggregate SQLite Functions\n\nMost of SQLite’s\n[aggregate functions](https://www.sqlite.org/lang_aggfunc.html) have been\nsurfaced in and type-audited for SQLite.swift.\n\n## Window SQLite Functions\n\nMost of SQLite's [window functions](https://www.sqlite.org/windowfunctions.html) have been\nsurfaced in and type-audited for SQLite.swift. Currently only `OVER (ORDER BY ...)` windowing is possible. \n\n## Date and Time functions\n\nSQLite's [date and time](https://www.sqlite.org/lang_datefunc.html)\nfunctions are available:\n\n```swift\nDateFunctions.date(\"now\")\n// date('now')\nDate().date\n// date('2007-01-09T09:41:00.000')\nExpression<Date>(\"date\").date\n// date(\"date\")\n```\n\n## Custom SQL Functions\n\nWe can create custom SQL functions by calling `createFunction` on a database\nconnection.\n\nFor example, to give queries access to\n[`MobileCoreServices.UTTypeConformsTo`][UTTypeConformsTo], we can\nwrite the following:\n\n```swift\nimport MobileCoreServices\n\nlet typeConformsTo: (Expression<String>, Expression<String>) -> Expression<Bool> = (\n    try db.createFunction(\"typeConformsTo\", deterministic: true) { UTI, conformsToUTI in\n        return UTTypeConformsTo(UTI, conformsToUTI)\n    }\n)\n```\n\n> _Note:_ The optional `deterministic` parameter is an optimization that\n> causes the function to be created with\n> [`SQLITE_DETERMINISTIC`](https://www.sqlite.org/c3ref/c_deterministic.html).\n\nNote `typeConformsTo`’s signature:\n\n```swift\n(Expression<String>, Expression<String>) -> Expression<Bool>\n```\n\nBecause of this, `createFunction` expects a block with the following\nsignature:\n\n```swift\n(String, String) -> Bool\n```\n\nOnce assigned, the closure can be called wherever boolean expressions are\naccepted.\n\n```swift\nlet attachments = Table(\"attachments\")\nlet UTI = Expression<String>(\"UTI\")\n\nlet images = attachments.filter(typeConformsTo(UTI, kUTTypeImage))\n// SELECT * FROM \"attachments\" WHERE \"typeConformsTo\"(\"UTI\", 'public.image')\n```\n\n> _Note:_ The return type of a function must be\n> [a core SQL type](#building-type-safe-sql) or [conform to `Value`](#custom-types).\n\nWe can create loosely-typed functions by handling an array of raw arguments,\ninstead.\n\n```swift\ndb.createFunction(\"typeConformsTo\", deterministic: true) { args in\n    guard let UTI = args[0] as? String, conformsToUTI = args[1] as? String else { return nil }\n    return UTTypeConformsTo(UTI, conformsToUTI)\n}\n```\n\nCreating a loosely-typed function cannot return a closure and instead must be\nwrapped manually or executed [using raw SQL](#executing-arbitrary-sql).\n\n```swift\nlet stmt = try db.prepare(\"SELECT * FROM attachments WHERE typeConformsTo(UTI, ?)\")\nfor row in stmt.bind(kUTTypeImage) { /* ... */ }\n```\n\n> _Note:_ Prepared queries can be reused, and long lived prepared queries should be `reset()` after each use. Otherwise, the transaction (either [implicit or explicit](https://www.sqlite.org/lang_transaction.html#implicit_versus_explicit_transactions)) will be held open until the query is reset or finalized. This can affect performance. Statements are reset automatically during `deinit`.\n>\n> ```swift\n> someObj.statement = try db.prepare(\"SELECT * FROM attachments WHERE typeConformsTo(UTI, ?)\")\n> for row in someObj.statement.bind(kUTTypeImage) { /* ... */ }\n> someObj.statement.reset()\n> ```\n\n[UTTypeConformsTo]: https://developer.apple.com/documentation/coreservices/1444079-uttypeconformsto\n\n## Custom Aggregations\n\nWe can create custom aggregation functions by calling `createAggregation`:\n\n```swift\nlet reduce: (String, [Binding?]) -> String = { (last, bindings) in\n    last + \" \" + (bindings.first as? String ?? \"\")\n}\n\ndb.createAggregation(\"customConcat\", initialValue: \"\", reduce: reduce, result: { $0 })\nlet result = db.prepare(\"SELECT customConcat(email) FROM users\").scalar() as! String\n```\n\n## Custom Collations\n\nWe can create custom collating sequences by calling `createCollation` on a\ndatabase connection.\n\n```swift\ntry db.createCollation(\"NODIACRITIC\") { lhs, rhs in\n    return lhs.compare(rhs, options: .diacriticInsensitiveSearch)\n}\n```\n\nWe can reference a custom collation using the `Custom` member of the\n`Collation` enumeration.\n\n```swift\nrestaurants.order(collate(.custom(\"NODIACRITIC\"), name))\n// SELECT * FROM \"restaurants\" ORDER BY \"name\" COLLATE \"NODIACRITIC\"\n```\n\n\n## Full-text Search\n\nWe can create a virtual table using the [FTS4\nmodule](http://www.sqlite.org/fts3.html) by calling `create` on a\n`VirtualTable`.\n\n```swift\nlet emails = VirtualTable(\"emails\")\nlet subject = Expression<String>(\"subject\")\nlet body = Expression<String>(\"body\")\n\ntry db.run(emails.create(.FTS4(subject, body)))\n// CREATE VIRTUAL TABLE \"emails\" USING fts4(\"subject\", \"body\")\n```\n\nWe can specify a [tokenizer](http://www.sqlite.org/fts3.html#tokenizer) using the `tokenize` parameter.\n\n```swift\ntry db.run(emails.create(.FTS4([subject, body], tokenize: .Porter)))\n// CREATE VIRTUAL TABLE \"emails\" USING fts4(\"subject\", \"body\", tokenize=porter)\n```\n\nWe can set the full range of parameters by creating a `FTS4Config` object.\n\n```swift\nlet emails = VirtualTable(\"emails\")\nlet subject = Expression<String>(\"subject\")\nlet body = Expression<String>(\"body\")\nlet config = FTS4Config()\n    .column(subject)\n    .column(body, [.unindexed])\n    .languageId(\"lid\")\n    .order(.desc)\n\ntry db.run(emails.create(.FTS4(config))\n// CREATE VIRTUAL TABLE \"emails\" USING fts4(\"subject\", \"body\", notindexed=\"body\", languageid=\"lid\", order=\"desc\")\n```\n\nOnce we insert a few rows, we can search using the `match` function, which\ntakes a table or column as its first argument and a query string as its\nsecond.\n\n```swift\ntry db.run(emails.insert(\n    subject <- \"Just Checking In\",\n    body <- \"Hey, I was just wondering...did you get my last email?\"\n))\n\nlet wonderfulEmails: QueryType = emails.match(\"wonder*\")\n// SELECT * FROM \"emails\" WHERE \"emails\" MATCH 'wonder*'\n\nlet replies = emails.filter(subject.match(\"Re:*\"))\n// SELECT * FROM \"emails\" WHERE \"subject\" MATCH 'Re:*'\n```\n\n### FTS5\n\nWhen linking against a version of SQLite with\n[FTS5](http://www.sqlite.org/fts5.html) enabled we can create the virtual\ntable in a similar fashion.\n\n```swift\nlet emails = VirtualTable(\"emails\")\nlet subject = Expression<String>(\"subject\")\nlet body = Expression<String>(\"body\")\nlet config = FTS5Config()\n    .column(subject)\n    .column(body, [.unindexed])\n\ntry db.run(emails.create(.FTS5(config)))\n// CREATE VIRTUAL TABLE \"emails\" USING fts5(\"subject\", \"body\" UNINDEXED)\n\n// Note that FTS5 uses a different syntax to select columns, so we need to rewrite\n// the last FTS4 query above as:\nlet replies = emails.filter(emails.match(\"subject:\\\"Re:\\\"*\"))\n// SELECT * FROM \"emails\" WHERE \"emails\" MATCH 'subject:\"Re:\"*'\n```\n\n## Executing Arbitrary SQL\n\nThough we recommend you stick with SQLite.swift’s\n[type-safe system](#building-type-safe-sql) whenever possible, it is possible\nto simply and safely prepare and execute raw SQL statements via a `Database` connection\nusing the following functions.\n\n  - `execute` runs an arbitrary number of SQL statements as a convenience.\n\n    ```swift\n    try db.execute(\"\"\"\n        BEGIN TRANSACTION;\n        CREATE TABLE users (\n            id INTEGER PRIMARY KEY NOT NULL,\n            email TEXT UNIQUE NOT NULL,\n            name TEXT\n        );\n        CREATE TABLE posts (\n            id INTEGER PRIMARY KEY NOT NULL,\n            title TEXT NOT NULL,\n            body TEXT NOT NULL,\n            published_at DATETIME\n        );\n        PRAGMA user_version = 1;\n        COMMIT TRANSACTION;\n        \"\"\"\n    )\n    ```\n\n  - `prepare` prepares a single `Statement` object from a SQL string,\n      optionally binds values to it (using the statement’s `bind` function),\n      and returns the statement for deferred execution.\n\n    ```swift\n    let stmt = try db.prepare(\"INSERT INTO users (email) VALUES (?)\")\n    ```\n\n    Once prepared, statements may be executed using `run`, binding any\n    unbound parameters.\n\n    ```swift\n    try stmt.run(\"alice@mac.com\")\n    db.changes // -> {Some 1}\n    ```\n\n    Statements with results may be iterated over, using the columnNames if\n    useful.\n\n    ```swift\n    let stmt = try db.prepare(\"SELECT id, email FROM users\")\n    for row in stmt {\n        for (index, name) in stmt.columnNames.enumerated() {\n            print (\"\\(name):\\(row[index]!)\")\n            // id: Optional(1), email: Optional(\"alice@mac.com\")\n        }\n    }\n    ```\n\n  - `run` prepares a single `Statement` object from a SQL string, optionally\n    binds values to it (using the statement’s `bind` function), executes,\n    and returns the statement.\n\n    ```swift\n    try db.run(\"INSERT INTO users (email) VALUES (?)\", \"alice@mac.com\")\n    ```\n\n  - `scalar` prepares a single `Statement` object from a SQL string,\n      optionally binds values to it (using the statement’s `bind` function),\n      executes, and returns the first value of the first row.\n\n    ```swift\n    let count = try db.scalar(\"SELECT count(*) FROM users\") as! Int64\n    ```\n\n    Statements also have a `scalar` function, which can optionally re-bind\n    values at execution.\n\n    ```swift\n    let stmt = try db.prepare(\"SELECT count (*) FROM users\")\n    let count = try stmt.scalar() as! Int64\n    ```\n\n## Online Database Backup\n\nTo copy a database to another using the\n[SQLite Online Backup API](https://sqlite.org/backup.html):\n\n```swift\n// creates an in-memory copy of db.sqlite\nlet db = try Connection(\"db.sqlite\")\nlet target = try Connection(.inMemory)\n\nlet backup = try db.backup(usingConnection: target)\ntry backup.step()\n```\n\n## Attaching and detaching databases\n\nWe can [ATTACH](https://www3.sqlite.org/lang_attach.html) and [DETACH](https://www3.sqlite.org/lang_detach.html)\ndatabases to an existing connection:\n\n```swift\nlet db = try Connection(\"db.sqlite\")\n\ntry db.attach(.uri(\"external.sqlite\", parameters: [.mode(.readOnly)]), as: \"external\")\n// ATTACH DATABASE 'file:external.sqlite?mode=ro' AS 'external'\n\nlet table = Table(\"table\", database: \"external\")\nlet count = try db.scalar(table.count)\n// SELECT count(*) FROM 'external.table'\n\ntry db.detach(\"external\")\n// DETACH DATABASE 'external'\n```\n\nWhen compiled for SQLCipher, we can additionally pass a `key` parameter to `attach`:\n\n```swift\ntry db.attach(.uri(\"encrypted.sqlite\"), as: \"encrypted\", key: \"secret\")\n// ATTACH DATABASE 'encrypted.sqlite' AS 'encrypted' KEY 'secret'\n```\n\n## Logging\n\nWe can log SQL using the database’s `trace` function.\n\n```swift\n#if DEBUG\n    db.trace { print($0) }\n#endif\n```\n\n## Vacuum\n\nTo run the [vacuum](https://www.sqlite.org/lang_vacuum.html) command:\n\n```swift\ntry db.vacuum()\n```\n\n\n[ROWID]: https://sqlite.org/lang_createtable.html#rowid\n[SQLiteMigrationManager.swift]: https://github.com/garriguv/SQLiteMigrationManager.swift\n"
  },
  {
    "path": "Documentation/Linux.md",
    "content": "# Linux\n\n## Limitations\n\n* Custom functions/aggregations are currently not supported and crash, caused by a bug in Swift.\nSee [#1071](https://github.com/stephencelis/SQLite.swift/issues/1071).\n\n## Installation\n\nOn Linux you should enable the `SQLiteSwiftCSQLite` trait to automatically\nembed SQLite:\n\n  ```swift\n  dependencies: [\n    .package(url: \"https://github.com/stephencelis/SQLite.swift.git\", \n             from: \"0.16.0\",\n             traits: [\"SQLiteSwiftCSQLite\"])\n  ]\n  ```\n\nSee the [main documentation](Index.md#available-traits) for a list of all available traits.\n\n## Debugging\n\n### Create and launch docker container\n\n```shell\n$ docker container create swift:focal\n$ docker run --cap-add=SYS_PTRACE \\\n  --security-opt seccomp=unconfined \\\n  --security-opt apparmor=unconfined \\\n  -i -t swift:focal bash\n```\n\n### Compile and run tests in debugger\n\n```shell\n$ apt-get update && apt-get install libsqlite3-dev\n$ git clone https://github.com/stephencelis/SQLite.swift.git\n$ swift test\n$ lldb .build/x86_64-unknown-linux-gnu/debug/SQLite.swiftPackageTests.xctest\n(lldb) target create \".build/x86_64-unknown-linux-gnu/debug/SQLite.swiftPackageTests.xctest\"\n(lldb) run\n```\n"
  },
  {
    "path": "Documentation/Planning.md",
    "content": "# SQLite.swift Planning\n\nThis document captures both near term steps (aka Roadmap) and feature\nrequests. The goal is to add some visibility and guidance for future\nadditions and Pull Requests, as well as to keep the Issues list clear of\nenhancement requests so that bugs are more visible.\n\n> ⚠ This document is currently not actively maintained. See\n> the [0.14.1 milestone](https://github.com/stephencelis/SQLite.swift/issues?q=is%3Aopen+is%3Aissue+milestone%3A0.14.1)\n> on Github for additional information about planned features for the next release.\n\n## Roadmap\n\n_Lists agreed upon next steps in approximate priority order._\n\n## Feature Requests\n\n_A gathering point for ideas for new features. In general, the corresponding\nissue will be closed once it is added here, with the assumption that it will\nbe referred to when it comes time to add the corresponding feature._\n\n### Features\n\n * provide separate threads for update vs read, so updates don't block reads,\n   per [#236](https://github.com/stephencelis/SQLite.swift/issues/236)\n * expose triggers, per\n   [#164](https://github.com/stephencelis/SQLite.swift/issues/164)\n\n## Suspended Feature Requests\n\n_Features that are not actively being considered, perhaps because of no clean\ntype-safe way to implement them with the current Swift, or bugs, or just\ngeneral uncertainty._\n"
  },
  {
    "path": "Documentation/Release.md",
    "content": "# SQLite.swift Release checklist\n\n* [ ] Make sure current master branch has a green build\n* [ ] Make sure `SQLite.playground` runs without errors\n* [ ] Make sure `CHANGELOG.md` is up-to-date\n* [ ] Add content to `Documentation/Upgrading.md` if needed\n* [ ] Update the version number in `SQLite.swift.podspec`\n* [ ] Run `pod lib lint` locally\n* [ ] Update the version numbers mentioned in `README.md`, `Documentation/Index.md`\n* [ ] Update `MARKETING_VERSION` in `SQLite.xcodeproj/project.pbxproj`\n* [ ] Create a tag with the version number (`x.y.z`)\n* [ ] Publish to CocoaPods: `pod trunk push`\n* [ ] Update the release information on GitHub\n"
  },
  {
    "path": "Documentation/Upgrading.md",
    "content": "# Upgrading\n\n## 0.13 → 0.14\n\n- `Expression.asSQL()` is no longer available. Expressions now implement `CustomStringConvertible`,\n  where `description` returns the SQL.\n- `Statement.prepareRowIterator()` is no longer available. Instead, use the methods\n  of the same name on `Connection`.\n- `Connection.registerTokenizer` is no longer available to register custom FTS4 tokenizers.\n- `Setter.asSQL()` is no longer available. Instead, Setter now implement `CustomStringConvertible`,\n  where `description` returns the SQL.\n"
  },
  {
    "path": "Gemfile",
    "content": "source \"https://rubygems.org\"\n\n# https://github.com/CocoaPods/CocoaPods/pull/12816\ngem 'cocoapods', :git => 'https://github.com/jberkel/CocoaPods.git', branch: 'watchos-fourflusher'\n"
  },
  {
    "path": "LICENSE.txt",
    "content": "(The MIT License)\n\nCopyright (c) 2014-2015 Stephen Celis (<stephen@stephencelis.com>)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
  },
  {
    "path": "Makefile",
    "content": "XCODEBUILD = xcodebuild\nBUILD_SCHEME = SQLite Mac\nIOS_SIMULATOR = iPhone 14\nIOS_VERSION = 16.4\n\n# tool settings\nSWIFTLINT_VERSION=0.63.1\nSWIFTLINT=bin/swiftlint-$(SWIFTLINT_VERSION)\nSWIFTLINT_URL=https://github.com/realm/SwiftLint/releases/download/$(SWIFTLINT_VERSION)/portable_swiftlint.zip\nXCBEAUTIFY_VERSION=3.1.2\nXCBEAUTIFY=bin/xcbeautify-$(XCBEAUTIFY_VERSION)\nifeq ($(shell uname), Linux)\n\tXCBEAUTIFY_PLATFORM=x86_64-unknown-linux-gnu.tar.xz\nelse\n\tXCBEAUTIFY_PLATFORM=universal-apple-macosx.zip\nendif\nXCBEAUTIFY_URL=https://github.com/cpisciotta/xcbeautify/releases/download/$(XCBEAUTIFY_VERSION)/xcbeautify-$(XCBEAUTIFY_VERSION)-$(XCBEAUTIFY_PLATFORM)\nCURL_OPTS=--fail --silent -L --retry 3\n\nifeq ($(BUILD_SCHEME),SQLite iOS)\n\tBUILD_ARGUMENTS = -scheme \"$(BUILD_SCHEME)\" -destination \"platform=iOS Simulator,name=$(IOS_SIMULATOR),OS=$(IOS_VERSION)\"\nelse\n\tBUILD_ARGUMENTS = -scheme \"$(BUILD_SCHEME)\"\nendif\n\ntest: $(XCBEAUTIFY)\n\tset -o pipefail; \\\n\t$(XCODEBUILD) $(BUILD_ARGUMENTS) test | $(XCBEAUTIFY)\n\nbuild: $(XCBEAUTIFY)\n\tset -o pipefail; \\\n\t$(XCODEBUILD) $(BUILD_ARGUMENTS) | $(XCBEAUTIFY)\n\nlint: $(SWIFTLINT)\n\t$< --strict\n\nlint-fix: $(SWIFTLINT)\n\t$< --fix\n\nclean:\n\t$(XCODEBUILD) $(BUILD_ARGUMENTS) clean\n\nrepl:\n\t@$(XCODEBUILD) $(BUILD_ARGUMENTS) -derivedDataPath $(TMPDIR)/SQLite.swift > /dev/null && \\\n\t\tswift repl -F '$(TMPDIR)/SQLite.swift/Build/Products/Debug'\n\nsloc:\n\t@zsh -c \"grep -vE '^ *//|^$$' Sources/**/*.{swift,h} | wc -l\"\n\n$(SWIFTLINT):\n\tset -e ; \\\n\tcurl $(CURL_OPTS) $(SWIFTLINT_URL) -o swiftlint.zip; \\\n\tunzip -o swiftlint.zip swiftlint; \\\n\tmkdir -p bin; \\\n\tmv swiftlint $@ && rm -f swiftlint.zip\n\n$(XCBEAUTIFY):\n\tset -e; \\\n\tFILE=$(XCBEAUTIFY_PLATFORM); \\\n\tcurl $(CURL_OPTS) $(XCBEAUTIFY_URL) -o $$FILE; \\\n\tcase \"$${FILE#*.}\" in \\\n\t  \"zip\") \\\n\t\tunzip -o $$FILE release/xcbeautify; \\\n\t\t;; \\\n\t  \"tar.xz\") \\\n\t  \ttar -xvf $$FILE release/xcbeautify; \\\n\t\t;; \\\n\t  *) \\\n\t\techo \"unknown extension $${FILE#*.}!\"; \\\n\t\texit 1; \\\n\t\t;; \\\n\tesac; \\\n\tmkdir -p bin; \\\n\tmv release/xcbeautify $@ && rm -f $$FILE;\n\n.PHONY: test clean repl sloc\n"
  },
  {
    "path": "Package.swift",
    "content": "// swift-tools-version: 6.1\nimport PackageDescription\nlet applePlatforms: [PackageDescription.Platform] = [.iOS, .macOS, .watchOS, .tvOS, .visionOS]\n\nlet target: Target = .target(\n    name: \"SQLite\",\n    dependencies: [\n        .product(name: \"SQLiteSwiftCSQLite\",\n                 package: \"CSQLite\",\n                 condition: .when(traits: [\"SQLiteSwiftCSQLite\"])),\n        .product(name: \"SQLCipher\",\n                 package: \"SQLCipher.swift\",\n                 condition: .when(platforms: applePlatforms, traits: [\"SQLCipher\"]))\n    ],\n    exclude: [\"Info.plist\"],\n    resources: [.copy(\"PrivacyInfo.xcprivacy\")],\n    cSettings: [\n        .define(\"SQLITE_HAS_CODEC\", .when(platforms: applePlatforms, traits: [\"SQLCipher\"]))\n    ]\n)\n\nlet testTarget: Target = .testTarget(\n    name: \"SQLiteTests\",\n    dependencies: [\"SQLite\"],\n    exclude: [\"Info.plist\"],\n    resources: [.copy(\"Resources\")]\n)\n\nlet defaultTraits: Set<String>\n#if os(Linux)\ndefaultTraits = [\"SQLiteSwiftCSQLite\"]\n#else\ndefaultTraits = [\"SystemSQLite\"]\n#endif\n\nlet package = Package(\n    name: \"SQLite.swift\",\n    platforms: [\n        .iOS(.v12),\n        .macOS(.v10_13),\n        .watchOS(.v4),\n        .tvOS(.v12),\n        .visionOS(.v1)\n    ],\n    products: [\n        .library(name: \"SQLite\", targets: [\"SQLite\"]),\n        .library(name: \"SQLite-Dynamic\", type: .dynamic, targets: [\"SQLite\"])\n    ],\n    traits: [\n        .trait(name: \"SystemSQLite\",\n              description: \"Uses the system-provided SQLite (on Apple platforms)\"),\n        .trait(name: \"SQLiteSwiftCSQLite\",\n               description: \"Include SQLite from SQLite.swift, based on the toolchain version\"),\n        // this will note compile, just included for sake of completeness\n        .trait(name: \"StandaloneSQLite\",\n               description: \"Assumes SQLite to be already available as 'sqlite3'\"),\n        .trait(name: \"SQLCipher\",\n               description: \"Enables SQLCipher encryption when a key is supplied to Connection\"),\n        .trait(name: \"FTS5\",\n              description: \"Enables FTS5 in the embedded SQLite (only supported by SQLiteSwiftCSQLite)\"),\n        .default(enabledTraits: defaultTraits)\n    ],\n    dependencies: [\n        .package(url: \"https://github.com/stephencelis/CSQLite\", from: \"3.50.4\", traits: [.trait(name: \"FTS5\", condition: .when(traits: [\"FTS5\"]))]),\n        .package(url: \"https://github.com/sqlcipher/SQLCipher.swift\", from: \"4.11.0\")\n    ],\n    targets: [target, testTarget],\n    swiftLanguageModes: [.v5],\n)\n"
  },
  {
    "path": "README.md",
    "content": "# SQLite.swift\n\n![Build Status][GitHubActionBadge] [![CocoaPods Version][CocoaPodsVersionBadge]][CocoaPodsVersionLink] [![Swift5 compatible][Swift5Badge]][Swift5Link] [![Platform][PlatformBadge]][PlatformLink] [![Carthage compatible][CartagheBadge]][CarthageLink] [![Join the chat at https://gitter.im/stephencelis/SQLite.swift][GitterBadge]][GitterLink]\n\nA type-safe, [Swift][]-language layer over [SQLite3][].\n\n[SQLite.swift][] provides compile-time confidence in SQL statement\nsyntax _and_ intent.\n\n## Features\n\n - A pure-Swift interface\n - A type-safe, optional-aware SQL expression builder\n - A flexible, chainable, lazy-executing query layer\n - Automatically-typed data access\n - A lightweight, uncomplicated query and parameter binding interface\n - Developer-friendly error handling and debugging\n - [Full-text search][] support\n - [Well-documented][See Documentation]\n - Extensively tested\n - [SQLCipher][] support via Swift Package Manager\n - [Schema query/migration][]\n - Works on [Linux](Documentation/Linux.md) (with some limitations)\n - Active support at\n   [StackOverflow](https://stackoverflow.com/questions/tagged/sqlite.swift),\n   and [Gitter Chat Room](https://gitter.im/stephencelis/SQLite.swift)\n   (_experimental_)\n\n[SQLCipher]: https://www.zetetic.net/sqlcipher/\n[Full-text search]: Documentation/Index.md#full-text-search\n[Schema query/migration]: Documentation/Index.md#querying-the-schema\n[See Documentation]: Documentation/Index.md#sqliteswift-documentation\n\n\n## Usage\n\n```swift\nimport SQLite\n\n// Wrap everything in a do...catch to handle errors\ndo {\n    let db = try Connection(\"path/to/db.sqlite3\")\n\n    let users = Table(\"users\")\n    let id = SQLite.Expression<Int64>(\"id\")\n    let name = SQLite.Expression<String?>(\"name\")\n    let email = SQLite.Expression<String>(\"email\")\n\n    try db.run(users.create { t in\n        t.column(id, primaryKey: true)\n        t.column(name)\n        t.column(email, unique: true)\n    })\n    // CREATE TABLE \"users\" (\n    //     \"id\" INTEGER PRIMARY KEY NOT NULL,\n    //     \"name\" TEXT,\n    //     \"email\" TEXT NOT NULL UNIQUE\n    // )\n\n    let insert = users.insert(name <- \"Alice\", email <- \"alice@mac.com\")\n    let rowid = try db.run(insert)\n    // INSERT INTO \"users\" (\"name\", \"email\") VALUES ('Alice', 'alice@mac.com')\n\n    for user in try db.prepare(users) {\n        print(\"id: \\(user[id]), name: \\(user[name]), email: \\(user[email])\")\n        // id: 1, name: Optional(\"Alice\"), email: alice@mac.com\n    }\n    // SELECT * FROM \"users\"\n\n    let alice = users.filter(id == rowid)\n\n    try db.run(alice.update(email <- email.replace(\"mac.com\", with: \"me.com\")))\n    // UPDATE \"users\" SET \"email\" = replace(\"email\", 'mac.com', 'me.com')\n    // WHERE (\"id\" = 1)\n\n    try db.run(alice.delete())\n    // DELETE FROM \"users\" WHERE (\"id\" = 1)\n\n    try db.scalar(users.count) // 0\n    // SELECT count(*) FROM \"users\"\n} catch {\n    print (error)\n}\n```\n\nNote that `Expression` should be written as `SQLite.Expression` to avoid\nconflicts with the `SwiftUI.Expression` if you are using SwiftUI too.\n\nSQLite.swift also works as a lightweight, Swift-friendly wrapper over the C\nAPI.\n\n```swift\n// Wrap everything in a do...catch to handle errors\ndo {\n    // ...\n\n    let stmt = try db.prepare(\"INSERT INTO users (email) VALUES (?)\")\n    for email in [\"betty@icloud.com\", \"cathy@icloud.com\"] {\n        try stmt.run(email)\n    }\n\n    db.totalChanges    // 3\n    db.changes         // 1\n    db.lastInsertRowid // 3\n\n    for row in try db.prepare(\"SELECT id, email FROM users\") {\n        print(\"id: \\(row[0]), email: \\(row[1])\")\n        // id: Optional(2), email: Optional(\"betty@icloud.com\")\n        // id: Optional(3), email: Optional(\"cathy@icloud.com\")\n    }\n\n    try db.scalar(\"SELECT count(*) FROM users\") // 2\n} catch {\n    print (error)\n}\n```\n\n[Read the documentation][See Documentation] or explore more,\ninteractively, from the Xcode project’s playground.\n\n![SQLite.playground Screen Shot](Documentation/Resources/playground@2x.png)\n\n## Installation\n\n### Swift Package Manager\n\nThe [Swift Package Manager][] is a tool for managing the distribution of\nSwift code.\n\n1. Add the following to your `Package.swift` file:\n\n  ```swift\n  dependencies: [\n      .package(url: \"https://github.com/stephencelis/SQLite.swift.git\", from: \"0.16.0\")\n  ]\n  ```\n\n2. Build your project:\n\n  ```sh\n  $ swift build\n  ```\n\nSee the [Tests/SPM](https://github.com/stephencelis/SQLite.swift/tree/master/Tests/SPM) folder for a small demo project which uses SPM.\n\n[Swift Package Manager]: https://swift.org/package-manager\n\n### Carthage\n\n[Carthage][] is a simple, decentralized dependency manager for Cocoa. To\ninstall SQLite.swift with Carthage:\n\n 1. Make sure Carthage is [installed][Carthage Installation].\n\n 2. Update your Cartfile to include the following:\n\n    ```ruby\n    github \"stephencelis/SQLite.swift\" ~> 0.16.0\n    ```\n\n 3. Run `carthage update` and\n    [add the appropriate framework][Carthage Usage].\n\n\n[Carthage]: https://github.com/Carthage/Carthage\n[Carthage Installation]: https://github.com/Carthage/Carthage#installing-carthage\n[Carthage Usage]: https://github.com/Carthage/Carthage#adding-frameworks-to-an-application\n\n\n### CocoaPods\n\n[CocoaPods][] is a dependency manager for Cocoa projects. To install\nSQLite.swift with CocoaPods:\n\n 1. Make sure CocoaPods is [installed][CocoaPods Installation].\n\n    ```sh\n    # Using the default Ruby install will require you to use sudo when\n    # installing and updating gems.\n    [sudo] gem install cocoapods\n    ```\n\n 2. Update your Podfile to include the following:\n\n    ```ruby\n    use_frameworks!\n\n    target 'YourAppTargetName' do\n        pod 'SQLite.swift', '~> 0.15.0'\n    end\n    ```\n\n 3. Run `pod install --repo-update`.\n\n[CocoaPods]: https://cocoapods.org\n[CocoaPods Installation]: https://guides.cocoapods.org/using/getting-started.html#getting-started\n\n### Manual\n\nTo install SQLite.swift as an Xcode sub-project:\n\n 1. Drag the **SQLite.xcodeproj** file into your own project.\n    ([Submodule][], clone, or [download][] the project first.)\n\n    ![Installation Screen Shot](Documentation/Resources/installation@2x.png)\n\n 2. In your target’s **General** tab, click the **+** button under **Linked\n    Frameworks and Libraries**.\n\n 3. Select the appropriate **SQLite.framework** for your platform.\n\n 4. **Add**.\n\nSome additional steps are required to install the application on an actual\ndevice:\n\n 5. In the **General** tab, click the **+** button under **Embedded\n    Binaries**.\n\n 6. Select the appropriate **SQLite.framework** for your platform.\n\n 7. **Add**.\n\n\n[Xcode]: https://developer.apple.com/xcode/downloads/\n[Submodule]: https://git-scm.com/book/en/Git-Tools-Submodules\n[download]: https://github.com/stephencelis/SQLite.swift/archive/master.zip\n\n\n## Communication\n\n[Read the contributing guidelines][]. The _TL;DR_ (but please; _R_):\n\n - Need **help** or have a **general question**? [Ask on Stack\n   Overflow][] (tag `sqlite.swift`).\n - Found a **bug** or have a **feature request**? [Open an issue][].\n - Want to **contribute**? [Submit a pull request][].\n\n[Read the contributing guidelines]: ./CONTRIBUTING.md#contributing\n[Ask on Stack Overflow]: https://stackoverflow.com/questions/tagged/sqlite.swift\n[Open an issue]: https://github.com/stephencelis/SQLite.swift/issues/new\n[Submit a pull request]: https://github.com/stephencelis/SQLite.swift/fork\n\n\n## Original author\n\n - [Stephen Celis](mailto:stephen@stephencelis.com)\n   ([@stephencelis](https://twitter.com/stephencelis))\n\n\n## License\n\nSQLite.swift is available under the MIT license. See [the LICENSE\nfile](./LICENSE.txt) for more information.\n\n## Related\n\nThese projects enhance or use SQLite.swift:\n\n - [SQLiteMigrationManager.swift][] (inspired by\n   [FMDBMigrationManager][])\n\n## Alternatives\n\nLooking for something else? Try another Swift wrapper (or [FMDB][]):\n\n - [GRDB](https://github.com/groue/GRDB.swift)\n - [SQLiteDB](https://github.com/FahimF/SQLiteDB)\n\n[Swift]: https://swift.org/\n[SQLite3]: https://www.sqlite.org\n[SQLite.swift]: https://github.com/stephencelis/SQLite.swift\n\n[GitHubActionBadge]: https://img.shields.io/github/actions/workflow/status/stephencelis/SQLite.swift/build.yml?branch=master\n\n[CocoaPodsVersionBadge]: https://img.shields.io/cocoapods/v/SQLite.swift.svg?style=flat\n[CocoaPodsVersionLink]: https://cocoapods.org/pods/SQLite.swift\n\n[PlatformBadge]: https://img.shields.io/cocoapods/p/SQLite.swift.svg?style=flat\n[PlatformLink]: https://cocoapods.org/pods/SQLite.swift\n\n[CartagheBadge]: https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat\n[CarthageLink]: https://github.com/Carthage/Carthage\n\n[GitterBadge]: https://badges.gitter.im/stephencelis/SQLite.swift.svg\n[GitterLink]: https://gitter.im/stephencelis/SQLite.swift\n\n[Swift5Badge]: https://img.shields.io/badge/swift-5-orange.svg?style=flat\n[Swift5Link]: https://developer.apple.com/swift/\n\n[SQLiteMigrationManager.swift]: https://github.com/garriguv/SQLiteMigrationManager.swift\n[FMDB]: https://github.com/ccgus/fmdb\n[FMDBMigrationManager]: https://github.com/layerhq/FMDBMigrationManager\n"
  },
  {
    "path": "SQLite.playground/Contents.swift",
    "content": "import SQLite\n\n/// Create an in-memory database\nlet db = try Connection(.inMemory)\n\n/// enable statement logging\ndb.trace { print($0) }\n\n/// define a \"users\" table with some fields\nlet users = Table(\"users\")\n\nlet id = Expression<Int64>(\"id\")\nlet email = Expression<String>(\"email\") // non-null\nlet name = Expression<String?>(\"name\")  // nullable\n\n/// prepare the query\nlet statement = users.create { t in\n    t.column(id, primaryKey: true)\n    t.column(email, unique: true, check: email.like(\"%@%\"))\n    t.column(name)\n}\n\n/// …and run it\ntry db.run(statement)\n\n/// insert \"alice\"\nlet rowid = try db.run(users.insert(email <- \"alice@mac.com\"))\n\n/// insert multiple rows using `insertMany`\nlet lastRowid = try db.run(users.insertMany([\n  [email <- \"bob@mac.com\"],\n  [email <- \"mallory@evil.com\"]\n]))\n\n\nlet query = try db.prepare(users)\nfor user in query {\n    print(\"id: \\(user[id]), email: \\(user[email])\")\n}\n\n// re-requery just rowid of Alice\nlet alice = try db.prepare(users.filter(id == rowid))\nfor user in alice {\n    print(\"id: \\(user[id]), email: \\(user[email])\")\n}\n\n/// using the `RowIterator` API\nlet rowIterator = try db.prepareRowIterator(users)\nfor user in try Array(rowIterator) {\n    print(\"id: \\(user[id]), email: \\(user[email])\")\n}\n\n/// also with `map()`\nlet mapRowIterator = try db.prepareRowIterator(users)\n\nlet userIds = try mapRowIterator.map { $0[id] }\n\n/// using `failableNext()` on `RowIterator`\nlet iterator = try db.prepareRowIterator(users)\ndo {\n    while let row = try rowIterator.failableNext() {\n        print(row)\n    }\n} catch {\n    // Handle error\n}\n\n/// define a virtual table for the FTS index\nlet emails = VirtualTable(\"emails\")\n\nlet subject = Expression<String>(\"subject\")\nlet body = Expression<String?>(\"body\")\n\n/// create the index\ntry db.run(emails.create(.FTS5(\n    FTS5Config()\n      .column(subject)\n      .column(body)\n)))\n\n/// populate with data\ntry db.run(emails.insert(\n    subject <- \"Hello, world!\",\n    body <- \"This is a hello world message.\"\n))\n\n/// run a query\nlet ftsQuery = try db.prepare(emails.match(\"hello\"))\n\nfor row in ftsQuery {\n    print(row[subject])\n}\n\n/// custom aggregations\nlet reduce: (String, [Binding?]) -> String = { (last, bindings) in\n    last + \" \" + (bindings.first as? String ?? \"\")\n}\n\ndb.createAggregation(\"customConcat\",\n                     initialValue: \"users:\",\n                     reduce: reduce,\n                     result: { $0 })\nlet result = try db.prepare(\"SELECT customConcat(email) FROM users\").scalar() as! String\nprint(result)\n\n/// schema queries\nlet schema = db.schema\nlet objects = try schema.objectDefinitions()\nprint(objects)\n\nlet columns = try schema.columnDefinitions(table: \"users\")\nprint(columns)\n\n/// schema alteration\n\nlet schemaChanger = SchemaChanger(connection: db)\ntry schemaChanger.alter(table: \"users\") { table in\n    table.add(column: ColumnDefinition(name: \"age\", type: .INTEGER))\n    table.rename(column: \"email\", to: \"electronic_mail\")\n    table.drop(column: \"name\")\n}\n\nlet changedColumns = try schema.columnDefinitions(table: \"users\")\nprint(changedColumns)\n\nlet age = Expression<Int?>(\"age\")\nlet electronicMail = Expression<String>(\"electronic_mail\")\n\nlet newRowid = try db.run(users.insert(\n    electronicMail <- \"carol@mac.com\",\n    age <- 33\n))\n"
  },
  {
    "path": "SQLite.playground/contents.xcplayground",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<playground version='5.0' target-platform='macos' display-mode='rendered' buildActiveScheme='true' importAppTypes='true'>\n    <timeline fileName='timeline.xctimeline'/>\n</playground>"
  },
  {
    "path": "SQLite.playground/playground.xcworkspace/contents.xcworkspacedata",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Workspace\n   version = \"1.0\">\n   <FileRef\n      location = \"self:\">\n   </FileRef>\n</Workspace>\n"
  },
  {
    "path": "SQLite.swift.podspec",
    "content": "Pod::Spec.new do |s|\n  s.name             = \"SQLite.swift\"\n  s.version          = \"0.16.0\"\n  s.summary          = \"A type-safe, Swift-language layer over SQLite3.\"\n\n  s.description      = <<-DESC\n    SQLite.swift provides compile-time confidence in SQL statement syntax and\n    intent.\n                       DESC\n\n  s.homepage         = \"https://github.com/stephencelis/SQLite.swift\"\n  s.license          = 'MIT'\n  s.author           = { \"Stephen Celis\" => \"stephen@stephencelis.com\" }\n  s.source           = { :git => \"https://github.com/stephencelis/SQLite.swift.git\", :tag => s.version.to_s }\n  s.social_media_url = 'https://twitter.com/stephencelis'\n\n  s.module_name      = 'SQLite'\n  s.default_subspec  = 'standard'\n  s.swift_versions = ['5']\n\n  s.ios.deployment_target = '12.0'\n  s.tvos.deployment_target = '12.0'\n  s.osx.deployment_target = '10.13'\n  s.watchos.deployment_target = '4.0'\n  s.visionos.deployment_target = '1.0'\n\n  # uses the built-in sqlite3 library\n  s.subspec 'standard' do |ss|\n    ss.library = 'sqlite3'\n    ss.source_files = 'Sources/SQLite/**/*.{c,h,m,swift}'\n    ss.exclude_files = 'Sources/**/Cipher.swift'\n    ss.resource_bundle = { 'SQLite.swift' => 'Sources/SQLite/PrivacyInfo.xcprivacy' }\n    ss.xcconfig = {\n      'OTHER_SWIFT_FLAGS' => '$(inherited) -DSystemSQLite'\n    }\n    ss.test_spec 'tests' do |test_spec|\n      test_spec.resources = 'Tests/SQLiteTests/Resources/*'\n      test_spec.source_files = 'Tests/SQLiteTests/**/*.swift'\n    end\n  end\n\n  # uses SQLite from https://github.com/clemensg/sqlite3pod\n  s.subspec 'standalone' do |ss|\n    ss.dependency 'sqlite3'\n    ss.source_files = 'Sources/SQLite/**/*.{c,h,m,swift}'\n    ss.exclude_files = 'Sources/**/Cipher.swift'\n    ss.resource_bundle = { 'SQLite.swift' => 'Sources/SQLite/PrivacyInfo.xcprivacy' }\n    ss.xcconfig = {\n      'OTHER_SWIFT_FLAGS' => '$(inherited) -DStandaloneSQLite'\n    }\n    ss.test_spec 'tests' do |test_spec|\n      test_spec.resources = 'Tests/SQLiteTests/Resources/*'\n      test_spec.source_files = 'Tests/SQLiteTests/**/*.swift'\n    end\n  end\n\n  # uses SQLCipher from https://github.com/sqlcipher/sqlcipher\n  s.subspec 'SQLCipher' do |ss|\n    ss.dependency 'SQLCipher', '>= 4.0.0'\n    # Disable unsupported visionOS\n    # https://github.com/sqlcipher/sqlcipher/issues/483\n    ss.ios.deployment_target = s.deployment_target(:ios)\n    ss.tvos.deployment_target = s.deployment_target(:tvos)\n    ss.osx.deployment_target = s.deployment_target(:osx)\n    ss.watchos.deployment_target = s.deployment_target(:watchos)\n    ss.source_files = 'Sources/SQLite/**/*.{c,h,m,swift}'\n    ss.resource_bundle = { 'SQLite.swift' => 'Sources/SQLite/PrivacyInfo.xcprivacy' }\n    ss.xcconfig = {\n      'OTHER_SWIFT_FLAGS' => '$(inherited) -DSQLCipher',\n      'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) SQLITE_HAS_CODEC=1'\n    }\n    ss.test_spec 'tests' do |test_spec|\n      test_spec.resources = 'Tests/SQLiteTests/Resources/*'\n      test_spec.source_files = 'Tests/SQLiteTests/**/*.swift'\n    end\n  end\nend\n"
  },
  {
    "path": "SQLite.xcodeproj/project.pbxproj",
    "content": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 46;\n\tobjects = {\n\n/* Begin PBXBuildFile section */\n\t\t02A43A9822738CF100FEC494 /* Backup.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02A43A9722738CF100FEC494 /* Backup.swift */; };\n\t\t02A43A9922738CF100FEC494 /* Backup.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02A43A9722738CF100FEC494 /* Backup.swift */; };\n\t\t02A43A9A22738CF100FEC494 /* Backup.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02A43A9722738CF100FEC494 /* Backup.swift */; };\n\t\t02A43A9B22738CF100FEC494 /* Backup.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02A43A9722738CF100FEC494 /* Backup.swift */; };\n\t\t03A65E641C6BB0F60062603F /* SQLite.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 03A65E5A1C6BB0F50062603F /* SQLite.framework */; };\n\t\t03A65E721C6BB2D30062603F /* SQLite.h in Headers */ = {isa = PBXBuildFile; fileRef = EE247AD61C3F04ED00AE3E12 /* SQLite.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t03A65E731C6BB2D80062603F /* Foundation.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AF71C3F06E900AE3E12 /* Foundation.swift */; };\n\t\t03A65E741C6BB2DA0062603F /* Helpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AF81C3F06E900AE3E12 /* Helpers.swift */; };\n\t\t03A65E761C6BB2E60062603F /* Blob.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AEE1C3F06E900AE3E12 /* Blob.swift */; };\n\t\t03A65E771C6BB2E60062603F /* Connection.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AEF1C3F06E900AE3E12 /* Connection.swift */; };\n\t\t03A65E7A1C6BB2F70062603F /* Statement.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AF21C3F06E900AE3E12 /* Statement.swift */; };\n\t\t03A65E7B1C6BB2F70062603F /* Value.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AF31C3F06E900AE3E12 /* Value.swift */; };\n\t\t03A65E7C1C6BB2F70062603F /* FTS4.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AF51C3F06E900AE3E12 /* FTS4.swift */; };\n\t\t03A65E7D1C6BB2F70062603F /* RTree.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AF61C3F06E900AE3E12 /* RTree.swift */; };\n\t\t03A65E7E1C6BB2FB0062603F /* AggregateFunctions.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AFA1C3F06E900AE3E12 /* AggregateFunctions.swift */; };\n\t\t03A65E7F1C6BB2FB0062603F /* Collation.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AFB1C3F06E900AE3E12 /* Collation.swift */; };\n\t\t03A65E801C6BB2FB0062603F /* CoreFunctions.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AFC1C3F06E900AE3E12 /* CoreFunctions.swift */; };\n\t\t03A65E811C6BB2FB0062603F /* CustomFunctions.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AFD1C3F06E900AE3E12 /* CustomFunctions.swift */; };\n\t\t03A65E821C6BB2FB0062603F /* Expression.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AFE1C3F06E900AE3E12 /* Expression.swift */; };\n\t\t03A65E831C6BB2FB0062603F /* Operators.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AFF1C3F06E900AE3E12 /* Operators.swift */; };\n\t\t03A65E841C6BB2FB0062603F /* Query.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247B001C3F06E900AE3E12 /* Query.swift */; };\n\t\t03A65E851C6BB2FB0062603F /* Schema.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247B011C3F06E900AE3E12 /* Schema.swift */; };\n\t\t03A65E861C6BB2FB0062603F /* Setter.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247B021C3F06E900AE3E12 /* Setter.swift */; };\n\t\t03A65E951C6BB3030062603F /* TestHelpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247B161C3F127200AE3E12 /* TestHelpers.swift */; };\n\t\t03A65E971C6BB3210062603F /* libsqlite3.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 03A65E961C6BB3210062603F /* libsqlite3.tbd */; };\n\t\t19A17018F250343BD0F9F4B0 /* Connection+Pragmas.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17F285B767BFACD96714B /* Connection+Pragmas.swift */; };\n\t\t19A17021286A4D8D6C2EF12D /* ConnectionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17855BD524FF888265B3C /* ConnectionTests.swift */; };\n\t\t19A17026DCDCDA405B09A229 /* Connection+AttachTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A170C08525D3D27CB5F83C /* Connection+AttachTests.swift */; };\n\t\t19A17073552293CA063BEA66 /* Result.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17E723300E5ED3771DCB5 /* Result.swift */; };\n\t\t19A1708D3D58D7BC1168E55F /* CipherTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A1787E16C8562C09C076F5 /* CipherTests.swift */; };\n\t\t19A1709C3E7A406E62293B2A /* Fixtures.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17B93B48B5560E6E51791 /* Fixtures.swift */; };\n\t\t19A170ACC97B19730FB7BA4D /* Connection+Aggregation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A175A9CB446640AE6F2200 /* Connection+Aggregation.swift */; };\n\t\t19A170AEBAA56DC3355A73B3 /* DateAndTimeFunctionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A178AEF32ABC8BF2993FB5 /* DateAndTimeFunctionTests.swift */; };\n\t\t19A170C56745F9D722A73D77 /* AggregateFunctionsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17613F00A3F4D4A257A04 /* AggregateFunctionsTests.swift */; };\n\t\t19A170D938343E30119EDFB3 /* RowTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A174FE5B47A97937A27276 /* RowTests.swift */; };\n\t\t19A1714F7CF964D568AB14E0 /* BlobTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A171A2ED4E2640F197F48C /* BlobTests.swift */; };\n\t\t19A17152E32A9585831E3FE0 /* DateAndTimeFunctions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17BA55DABB480F9020C8A /* DateAndTimeFunctions.swift */; };\n\t\t19A1716BF8E15F91A6B5CB7A /* CustomFunctionsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17F2B5959B212A33C383F /* CustomFunctionsTests.swift */; };\n\t\t19A1717B10CC941ACB5533D6 /* FTS5.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A1730E4390C775C25677D1 /* FTS5.swift */; };\n\t\t19A17188B4D96636F9C0C209 /* Connection+SchemaTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17CA1DF7D0F7C9A94C51C /* Connection+SchemaTests.swift */; };\n\t\t19A171F12AB8B07F2FD7201A /* Cipher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A178A39ACA9667A62663CC /* Cipher.swift */; };\n\t\t19A171F243A589C5EBC47937 /* OperatorsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17475DCA068453F787613 /* OperatorsTests.swift */; };\n\t\t19A1725658E480B9B378F28B /* Connection+SchemaTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17CA1DF7D0F7C9A94C51C /* Connection+SchemaTests.swift */; };\n\t\t19A1726002D24C14F876C8FE /* ValueTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17AE284BB1DF31D1B753E /* ValueTests.swift */; };\n\t\t19A172F71EFD65342072D8D2 /* SchemaTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A171A7714C6524093255C5 /* SchemaTests.swift */; };\n\t\t19A173088B85A7E18E8582A7 /* FTS5IntegrationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17BE1CC4AD4036BAB8EE0 /* FTS5IntegrationTests.swift */; };\n\t\t19A173389E53CB24DFA8CEDD /* QueryIntegrationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17CAE60446607E99C22A6 /* QueryIntegrationTests.swift */; };\n\t\t19A173465F23C64DF3DF469B /* ConnectionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17855BD524FF888265B3C /* ConnectionTests.swift */; };\n\t\t19A173668D948AD4DF1F5352 /* DateAndTimeFunctions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17BA55DABB480F9020C8A /* DateAndTimeFunctions.swift */; };\n\t\t19A1737286A74F3CF7412906 /* DateAndTimeFunctions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17BA55DABB480F9020C8A /* DateAndTimeFunctions.swift */; };\n\t\t19A173EFEF0B3BD0B3ED406C /* Result.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17E723300E5ED3771DCB5 /* Result.swift */; };\n\t\t19A173F25449876761347072 /* Connection+AttachTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A170C08525D3D27CB5F83C /* Connection+AttachTests.swift */; };\n\t\t19A173F429D7E46289EB2167 /* ResultTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A1745BE8623D8C6808DB3C /* ResultTests.swift */; };\n\t\t19A17408007B182F884E3A53 /* Fixtures.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17B93B48B5560E6E51791 /* Fixtures.swift */; };\n\t\t19A1740EACD47904AA24B8DC /* SchemaDefinitions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17268AE67B746B96AC125 /* SchemaDefinitions.swift */; };\n\t\t19A17411403D60640467209E /* ExpressionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A170F141BF21946D159083 /* ExpressionTests.swift */; };\n\t\t19A174118D11B93DA5DAAF79 /* DateAndTimeFunctionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A178AEF32ABC8BF2993FB5 /* DateAndTimeFunctionTests.swift */; };\n\t\t19A17437659BD7FD787D94A6 /* CustomAggregationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A177EF5E2D91BA86DA4480 /* CustomAggregationTests.swift */; };\n\t\t19A17444861E1443143DEB44 /* FTS4Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A1715904F7B6851FCB5EF6 /* FTS4Tests.swift */; };\n\t\t19A174506543905D71BF0518 /* Connection+Schema.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A170A97B51DC5EE365F3C5 /* Connection+Schema.swift */; };\n\t\t19A17457B0461F484AF6BE40 /* CustomFunctionsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17F2B5959B212A33C383F /* CustomFunctionsTests.swift */; };\n\t\t19A17482E6FC5E563F3E6A47 /* OperatorsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17475DCA068453F787613 /* OperatorsTests.swift */; };\n\t\t19A17490543609FCED53CACC /* Errors.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A1710E73A46D5AC721CDA9 /* Errors.swift */; };\n\t\t19A1750CEE9B05267995CF3D /* FTS5.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A1730E4390C775C25677D1 /* FTS5.swift */; };\n\t\t19A1750EF4A5F92954A451FF /* Connection+Schema.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A170A97B51DC5EE365F3C5 /* Connection+Schema.swift */; };\n\t\t19A1755C49154C87304C9146 /* FTS5IntegrationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17BE1CC4AD4036BAB8EE0 /* FTS5IntegrationTests.swift */; };\n\t\t19A1760CE25615CA015E2E5F /* Connection+Pragmas.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17F285B767BFACD96714B /* Connection+Pragmas.swift */; };\n\t\t19A176376CB6A94759F7980A /* Connection+Aggregation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A175A9CB446640AE6F2200 /* Connection+Aggregation.swift */; };\n\t\t19A1766135CE9786B1878603 /* ValueTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17AE284BB1DF31D1B753E /* ValueTests.swift */; };\n\t\t19A1766AC10D13C4EFF349AD /* SchemaChangerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17FDB0B0CFB8987906FD0 /* SchemaChangerTests.swift */; };\n\t\t19A176B3316281F004F92276 /* RowTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A174FE5B47A97937A27276 /* RowTests.swift */; };\n\t\t19A177290558991BCC60E4E3 /* SchemaChanger.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A171B262DDE8718513CFDA /* SchemaChanger.swift */; };\n\t\t19A1772EBE65173EDFB1AFCA /* CustomAggregationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A177EF5E2D91BA86DA4480 /* CustomAggregationTests.swift */; };\n\t\t19A1773155AC2BF2CA86A473 /* SetterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A1709D5BDD2691BA160012 /* SetterTests.swift */; };\n\t\t19A1773A335CAB9D0AE14E8E /* SchemaChanger.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A171B262DDE8718513CFDA /* SchemaChanger.swift */; };\n\t\t19A17746150A815944A6820B /* SelectTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17EC0C43015063945D32E /* SelectTests.swift */; };\n\t\t19A1776BD5127DFDF847FF1F /* FTS5Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17B96EBD42C878E609CDC /* FTS5Tests.swift */; };\n\t\t19A177909023B7B940C5805E /* FTS5IntegrationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17BE1CC4AD4036BAB8EE0 /* FTS5IntegrationTests.swift */; };\n\t\t19A177AA5922527BBDC77CF9 /* QueryIntegrationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17CAE60446607E99C22A6 /* QueryIntegrationTests.swift */; };\n\t\t19A177C25834473FAB32CF3B /* SchemaChangerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17FDB0B0CFB8987906FD0 /* SchemaChangerTests.swift */; };\n\t\t19A177D5C6542E2D572162E5 /* QueryIntegrationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17CAE60446607E99C22A6 /* QueryIntegrationTests.swift */; };\n\t\t19A178072B371489E6A1E839 /* FoundationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A1794CC4D7827E997E32A7 /* FoundationTests.swift */; };\n\t\t19A1781CBA8968ABD3E00877 /* ExpressionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A170F141BF21946D159083 /* ExpressionTests.swift */; };\n\t\t19A1782444437C7FC6B75CBC /* BlobTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A171A2ED4E2640F197F48C /* BlobTests.swift */; };\n\t\t19A17835FD5886FDC5A3228F /* Cipher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A178A39ACA9667A62663CC /* Cipher.swift */; };\n\t\t19A178767223229E61C5066F /* FTS4Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A1715904F7B6851FCB5EF6 /* FTS4Tests.swift */; };\n\t\t19A17885B646CB0201BE4BD5 /* QueryTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A171ED017645C8B04DF9F2 /* QueryTests.swift */; };\n\t\t19A178A8B2A34FB6B565DEDA /* Connection+Pragmas.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17F285B767BFACD96714B /* Connection+Pragmas.swift */; };\n\t\t19A178C041DDCF80B533AD13 /* BlobTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A171A2ED4E2640F197F48C /* BlobTests.swift */; };\n\t\t19A178DA2BB5970778CCAF13 /* FTS5Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17B96EBD42C878E609CDC /* FTS5Tests.swift */; };\n\t\t19A178DF5A96CFEFF1E271F6 /* AggregateFunctionsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17613F00A3F4D4A257A04 /* AggregateFunctionsTests.swift */; };\n\t\t19A178F9008614B8A8425635 /* Connection+PragmaTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17C60D3464461057E4D63 /* Connection+PragmaTests.swift */; };\n\t\t19A17900387FDCF578B31E3E /* OperatorsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17475DCA068453F787613 /* OperatorsTests.swift */; };\n\t\t19A17912DB9D3AC8FECF948B /* ResultTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A1745BE8623D8C6808DB3C /* ResultTests.swift */; };\n\t\t19A17923494236793893BF72 /* StatementTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A1756EB81E9F7F45B12A78 /* StatementTests.swift */; };\n\t\t19A1792C0520D4E83C2EB075 /* Errors.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A1710E73A46D5AC721CDA9 /* Errors.swift */; };\n\t\t19A1793972BDDDB027C113BB /* CustomAggregationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A177EF5E2D91BA86DA4480 /* CustomAggregationTests.swift */; };\n\t\t19A179786A6826D58A70F8BC /* AggregateFunctionsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17613F00A3F4D4A257A04 /* AggregateFunctionsTests.swift */; };\n\t\t19A17986405D9A875698408F /* Connection+Pragmas.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17F285B767BFACD96714B /* Connection+Pragmas.swift */; };\n\t\t19A1799AF6643CF5081BFA15 /* DateAndTimeFunctionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A178AEF32ABC8BF2993FB5 /* DateAndTimeFunctionTests.swift */; };\n\t\t19A179B59450FE7C4811AB8A /* Connection+Aggregation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A175A9CB446640AE6F2200 /* Connection+Aggregation.swift */; };\n\t\t19A179BB9A6665B2B99DA546 /* CoreFunctionsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17B55F2409B7031443495 /* CoreFunctionsTests.swift */; };\n\t\t19A179BCD483DEA21661FD37 /* Connection+AttachTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A170C08525D3D27CB5F83C /* Connection+AttachTests.swift */; };\n\t\t19A179CCF9671E345E5A9811 /* Cipher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A178A39ACA9667A62663CC /* Cipher.swift */; };\n\t\t19A179E76EA6207669B60C1B /* Cipher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A178A39ACA9667A62663CC /* Cipher.swift */; };\n\t\t19A17A33EA026C2E2CEBAF36 /* Connection+Schema.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A170A97B51DC5EE365F3C5 /* Connection+Schema.swift */; };\n\t\t19A17A391BF056E3D729E70A /* SchemaTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A171A7714C6524093255C5 /* SchemaTests.swift */; };\n\t\t19A17A52BF29D27C9AA229E7 /* QueryTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A171ED017645C8B04DF9F2 /* QueryTests.swift */; };\n\t\t19A17A7B3E3B7E76364A2AEE /* CipherTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A1787E16C8562C09C076F5 /* CipherTests.swift */; };\n\t\t19A17A7DF99B0379FD3396B1 /* CustomFunctionsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17F2B5959B212A33C383F /* CustomFunctionsTests.swift */; };\n\t\t19A17A9520802ACF45907970 /* RTreeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17162C9861E5C4900455D /* RTreeTests.swift */; };\n\t\t19A17ABCF0EB4808BDC5B5FF /* RowTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A174FE5B47A97937A27276 /* RowTests.swift */; };\n\t\t19A17B0DF1DDB6BBC9C95D64 /* SchemaDefinitions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17268AE67B746B96AC125 /* SchemaDefinitions.swift */; };\n\t\t19A17B1D9B5CEBE9CE09280C /* RTreeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17162C9861E5C4900455D /* RTreeTests.swift */; };\n\t\t19A17B36ABC6006AB80F693C /* Connection+SchemaTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17CA1DF7D0F7C9A94C51C /* Connection+SchemaTests.swift */; };\n\t\t19A17B62A4125AF4F6014CF5 /* SchemaDefinitionsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A176174862D0F0139B3987 /* SchemaDefinitionsTests.swift */; };\n\t\t19A17BA13FD35F058787B7D3 /* SchemaDefinitions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17268AE67B746B96AC125 /* SchemaDefinitions.swift */; };\n\t\t19A17BACF4C032513DE1F879 /* Connection+PragmaTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17C60D3464461057E4D63 /* Connection+PragmaTests.swift */; };\n\t\t19A17C74233AFC2EDAFA23DC /* ResultTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A1745BE8623D8C6808DB3C /* ResultTests.swift */; };\n\t\t19A17CA4D7B63D845428A9C5 /* StatementTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A1756EB81E9F7F45B12A78 /* StatementTests.swift */; };\n\t\t19A17CA6ADB78A2E545BF836 /* CipherTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A1787E16C8562C09C076F5 /* CipherTests.swift */; };\n\t\t19A17CF65C0196E03BC64519 /* ConnectionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17855BD524FF888265B3C /* ConnectionTests.swift */; };\n\t\t19A17D1BEABA610ABF003D67 /* SchemaDefinitions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17268AE67B746B96AC125 /* SchemaDefinitions.swift */; };\n\t\t19A17D6EC40BC35A5DC81BA8 /* StatementTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A1756EB81E9F7F45B12A78 /* StatementTests.swift */; };\n\t\t19A17D993398B8215B73E1EA /* CoreFunctionsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17B55F2409B7031443495 /* CoreFunctionsTests.swift */; };\n\t\t19A17DAD5975D9367EAA46E2 /* RTreeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17162C9861E5C4900455D /* RTreeTests.swift */; };\n\t\t19A17DC282E36C4F41AA440B /* Errors.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A1710E73A46D5AC721CDA9 /* Errors.swift */; };\n\t\t19A17DD33C2E43DD6EE05A60 /* ExpressionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A170F141BF21946D159083 /* ExpressionTests.swift */; };\n\t\t19A17DE1FCDB5695702AD24D /* SelectTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17EC0C43015063945D32E /* SelectTests.swift */; };\n\t\t19A17DE34C477232592A8F6B /* CoreFunctionsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17B55F2409B7031443495 /* CoreFunctionsTests.swift */; };\n\t\t19A17DF8D4F13A20F5D2269E /* Result.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17E723300E5ED3771DCB5 /* Result.swift */; };\n\t\t19A17DFE05ED8B1F7C45F7EE /* SchemaChanger.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A171B262DDE8718513CFDA /* SchemaChanger.swift */; };\n\t\t19A17E04C4C0956715C5676A /* FoundationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A1794CC4D7827E997E32A7 /* FoundationTests.swift */; };\n\t\t19A17E0ABA6C415F014CD51C /* SetterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A1709D5BDD2691BA160012 /* SetterTests.swift */; };\n\t\t19A17E1DD976D5CE80018749 /* FTS4Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A1715904F7B6851FCB5EF6 /* FTS4Tests.swift */; };\n\t\t19A17E29278A12BC4F542506 /* DateAndTimeFunctions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17BA55DABB480F9020C8A /* DateAndTimeFunctions.swift */; };\n\t\t19A17E3F47DA087E2B76D087 /* QueryTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A171ED017645C8B04DF9F2 /* QueryTests.swift */; };\n\t\t19A17E80F736EEE8EE2AA4CE /* SchemaDefinitionsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A176174862D0F0139B3987 /* SchemaDefinitionsTests.swift */; };\n\t\t19A17EC0D68BA8C03288ADF7 /* FTS5.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A1730E4390C775C25677D1 /* FTS5.swift */; };\n\t\t19A17F0BF02896E1664F4090 /* Connection+Schema.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A170A97B51DC5EE365F3C5 /* Connection+Schema.swift */; };\n\t\t19A17F1B3F0A3C96B5ED6D64 /* Result.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17E723300E5ED3771DCB5 /* Result.swift */; };\n\t\t19A17F2096E83A3181E03317 /* SchemaTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A171A7714C6524093255C5 /* SchemaTests.swift */; };\n\t\t19A17F60B685636D1F83C2DD /* Fixtures.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17B93B48B5560E6E51791 /* Fixtures.swift */; };\n\t\t19A17F7977364EC8CD33C3C3 /* SelectTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17EC0C43015063945D32E /* SelectTests.swift */; };\n\t\t19A17F907258E524B3CA2FAE /* SetterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A1709D5BDD2691BA160012 /* SetterTests.swift */; };\n\t\t19A17FACE8E4D54A50BA934E /* FTS5Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17B96EBD42C878E609CDC /* FTS5Tests.swift */; };\n\t\t19A17FB80B94E882050AA908 /* FoundationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A1794CC4D7827E997E32A7 /* FoundationTests.swift */; };\n\t\t19A17FBAA26953EB854E790D /* Connection+PragmaTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17C60D3464461057E4D63 /* Connection+PragmaTests.swift */; };\n\t\t19A17FC04708C6ED637DDFD4 /* SchemaChangerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17FDB0B0CFB8987906FD0 /* SchemaChangerTests.swift */; };\n\t\t19A17FC07731779C1B8506FA /* SchemaChanger.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A171B262DDE8718513CFDA /* SchemaChanger.swift */; };\n\t\t19A17FD22EF43DF428DD93BA /* ValueTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17AE284BB1DF31D1B753E /* ValueTests.swift */; };\n\t\t19A17FE78A39E86F330420EC /* SchemaDefinitionsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A176174862D0F0139B3987 /* SchemaDefinitionsTests.swift */; };\n\t\t19A17FF4A10B44D3937C8CAC /* Errors.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A1710E73A46D5AC721CDA9 /* Errors.swift */; };\n\t\t3D67B3E61DB2469200A4F4C6 /* libsqlite3.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 3D67B3E51DB2469200A4F4C6 /* libsqlite3.tbd */; };\n\t\t3D67B3E71DB246BA00A4F4C6 /* Blob.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AEE1C3F06E900AE3E12 /* Blob.swift */; };\n\t\t3D67B3E81DB246BA00A4F4C6 /* Connection.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AEF1C3F06E900AE3E12 /* Connection.swift */; };\n\t\t3D67B3E91DB246D100A4F4C6 /* Statement.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AF21C3F06E900AE3E12 /* Statement.swift */; };\n\t\t3D67B3EA1DB246D100A4F4C6 /* Value.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AF31C3F06E900AE3E12 /* Value.swift */; };\n\t\t3D67B3EB1DB246D100A4F4C6 /* FTS4.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AF51C3F06E900AE3E12 /* FTS4.swift */; };\n\t\t3D67B3EC1DB246D100A4F4C6 /* RTree.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AF61C3F06E900AE3E12 /* RTree.swift */; };\n\t\t3D67B3ED1DB246D100A4F4C6 /* FTS5.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A1730E4390C775C25677D1 /* FTS5.swift */; };\n\t\t3D67B3EE1DB246D100A4F4C6 /* AggregateFunctions.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AFA1C3F06E900AE3E12 /* AggregateFunctions.swift */; };\n\t\t3D67B3EF1DB246D100A4F4C6 /* Collation.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AFB1C3F06E900AE3E12 /* Collation.swift */; };\n\t\t3D67B3F01DB246D100A4F4C6 /* CoreFunctions.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AFC1C3F06E900AE3E12 /* CoreFunctions.swift */; };\n\t\t3D67B3F11DB246D100A4F4C6 /* CustomFunctions.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AFD1C3F06E900AE3E12 /* CustomFunctions.swift */; };\n\t\t3D67B3F21DB246D100A4F4C6 /* Expression.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AFE1C3F06E900AE3E12 /* Expression.swift */; };\n\t\t3D67B3F31DB246D100A4F4C6 /* Operators.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AFF1C3F06E900AE3E12 /* Operators.swift */; };\n\t\t3D67B3F41DB246D100A4F4C6 /* Query.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247B001C3F06E900AE3E12 /* Query.swift */; };\n\t\t3D67B3F51DB246D100A4F4C6 /* Schema.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247B011C3F06E900AE3E12 /* Schema.swift */; };\n\t\t3D67B3F61DB246D100A4F4C6 /* Setter.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247B021C3F06E900AE3E12 /* Setter.swift */; };\n\t\t3D67B3F71DB246D700A4F4C6 /* Foundation.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AF71C3F06E900AE3E12 /* Foundation.swift */; };\n\t\t3D67B3F81DB246D700A4F4C6 /* Helpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AF81C3F06E900AE3E12 /* Helpers.swift */; };\n\t\t3D67B3FC1DB2471B00A4F4C6 /* SQLite.h in Headers */ = {isa = PBXBuildFile; fileRef = EE247AD61C3F04ED00AE3E12 /* SQLite.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t3DF7B78828842972005DD8CA /* Connection+Attach.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3DF7B78728842972005DD8CA /* Connection+Attach.swift */; };\n\t\t3DF7B78928842972005DD8CA /* Connection+Attach.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3DF7B78728842972005DD8CA /* Connection+Attach.swift */; };\n\t\t3DF7B78A28842972005DD8CA /* Connection+Attach.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3DF7B78728842972005DD8CA /* Connection+Attach.swift */; };\n\t\t3DF7B78B28842972005DD8CA /* Connection+Attach.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3DF7B78728842972005DD8CA /* Connection+Attach.swift */; };\n\t\t3DF7B791288449BA005DD8CA /* URIQueryParameter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3DF7B790288449BA005DD8CA /* URIQueryParameter.swift */; };\n\t\t3DF7B792288449BA005DD8CA /* URIQueryParameter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3DF7B790288449BA005DD8CA /* URIQueryParameter.swift */; };\n\t\t3DF7B793288449BA005DD8CA /* URIQueryParameter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3DF7B790288449BA005DD8CA /* URIQueryParameter.swift */; };\n\t\t3DF7B794288449BA005DD8CA /* URIQueryParameter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3DF7B790288449BA005DD8CA /* URIQueryParameter.swift */; };\n\t\t3DF7B79628846FCC005DD8CA /* Resources in Resources */ = {isa = PBXBuildFile; fileRef = 3DF7B79528846FCC005DD8CA /* Resources */; };\n\t\t3DF7B79828846FED005DD8CA /* Resources in Resources */ = {isa = PBXBuildFile; fileRef = 3DF7B79528846FCC005DD8CA /* Resources */; };\n\t\t3DF7B79928847055005DD8CA /* Resources in Resources */ = {isa = PBXBuildFile; fileRef = 3DF7B79528846FCC005DD8CA /* Resources */; };\n\t\t49EB68C41F7B3CB400D89D40 /* Coding.swift in Sources */ = {isa = PBXBuildFile; fileRef = 49EB68C31F7B3CB400D89D40 /* Coding.swift */; };\n\t\t49EB68C51F7B3CB400D89D40 /* Coding.swift in Sources */ = {isa = PBXBuildFile; fileRef = 49EB68C31F7B3CB400D89D40 /* Coding.swift */; };\n\t\t49EB68C61F7B3CB400D89D40 /* Coding.swift in Sources */ = {isa = PBXBuildFile; fileRef = 49EB68C31F7B3CB400D89D40 /* Coding.swift */; };\n\t\t49EB68C71F7B3CB400D89D40 /* Coding.swift in Sources */ = {isa = PBXBuildFile; fileRef = 49EB68C31F7B3CB400D89D40 /* Coding.swift */; };\n\t\t64A8EE432B095FBB00F583F7 /* WindowFunctions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64A8EE422B095FBB00F583F7 /* WindowFunctions.swift */; };\n\t\t64A8EE442B095FBB00F583F7 /* WindowFunctions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64A8EE422B095FBB00F583F7 /* WindowFunctions.swift */; };\n\t\t64A8EE452B095FBB00F583F7 /* WindowFunctions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64A8EE422B095FBB00F583F7 /* WindowFunctions.swift */; };\n\t\t64A8EE462B095FBB00F583F7 /* WindowFunctions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64A8EE422B095FBB00F583F7 /* WindowFunctions.swift */; };\n\t\t64B8E1702B09748000545AFB /* WindowFunctionsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64B8E16F2B09748000545AFB /* WindowFunctionsTests.swift */; };\n\t\t64B8E1712B09748000545AFB /* WindowFunctionsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64B8E16F2B09748000545AFB /* WindowFunctionsTests.swift */; };\n\t\t64B8E1722B09748000545AFB /* WindowFunctionsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64B8E16F2B09748000545AFB /* WindowFunctionsTests.swift */; };\n\t\t997DF2AE287FC06D00F8DF95 /* Query+with.swift in Sources */ = {isa = PBXBuildFile; fileRef = 997DF2AD287FC06D00F8DF95 /* Query+with.swift */; };\n\t\t997DF2AF287FC06D00F8DF95 /* Query+with.swift in Sources */ = {isa = PBXBuildFile; fileRef = 997DF2AD287FC06D00F8DF95 /* Query+with.swift */; };\n\t\t997DF2B0287FC06D00F8DF95 /* Query+with.swift in Sources */ = {isa = PBXBuildFile; fileRef = 997DF2AD287FC06D00F8DF95 /* Query+with.swift */; };\n\t\t997DF2B1287FC06D00F8DF95 /* Query+with.swift in Sources */ = {isa = PBXBuildFile; fileRef = 997DF2AD287FC06D00F8DF95 /* Query+with.swift */; };\n\t\tDB58B21128FB864300F8EEA4 /* SchemaReader.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB58B21028FB864300F8EEA4 /* SchemaReader.swift */; };\n\t\tDB58B21228FB864300F8EEA4 /* SchemaReader.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB58B21028FB864300F8EEA4 /* SchemaReader.swift */; };\n\t\tDB58B21328FB864300F8EEA4 /* SchemaReader.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB58B21028FB864300F8EEA4 /* SchemaReader.swift */; };\n\t\tDB58B21428FB864300F8EEA4 /* SchemaReader.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB58B21028FB864300F8EEA4 /* SchemaReader.swift */; };\n\t\tDB58B21628FC7C4600F8EEA4 /* SQLiteFeature.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB58B21528FC7C4600F8EEA4 /* SQLiteFeature.swift */; };\n\t\tDB58B21728FC7C4600F8EEA4 /* SQLiteFeature.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB58B21528FC7C4600F8EEA4 /* SQLiteFeature.swift */; };\n\t\tDB58B21828FC7C4600F8EEA4 /* SQLiteFeature.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB58B21528FC7C4600F8EEA4 /* SQLiteFeature.swift */; };\n\t\tDB58B21928FC7C4600F8EEA4 /* SQLiteFeature.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB58B21528FC7C4600F8EEA4 /* SQLiteFeature.swift */; };\n\t\tDB7C5DA628D7C9B6006395CF /* SQLiteVersion.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB7C5DA528D7C9B6006395CF /* SQLiteVersion.swift */; };\n\t\tDB7C5DA728D7C9B6006395CF /* SQLiteVersion.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB7C5DA528D7C9B6006395CF /* SQLiteVersion.swift */; };\n\t\tDB7C5DA828D7C9B6006395CF /* SQLiteVersion.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB7C5DA528D7C9B6006395CF /* SQLiteVersion.swift */; };\n\t\tDB7C5DA928D7C9B6006395CF /* SQLiteVersion.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB7C5DA528D7C9B6006395CF /* SQLiteVersion.swift */; };\n\t\tDBB93D5A2A22A373009BB96E /* SchemaReaderTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DBB93D592A22A373009BB96E /* SchemaReaderTests.swift */; };\n\t\tDBB93D5B2A22A373009BB96E /* SchemaReaderTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DBB93D592A22A373009BB96E /* SchemaReaderTests.swift */; };\n\t\tDBB93D5C2A22A373009BB96E /* SchemaReaderTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DBB93D592A22A373009BB96E /* SchemaReaderTests.swift */; };\n\t\tDEB306BA2B61CEF500F9D46B /* SQLite.h in Headers */ = {isa = PBXBuildFile; fileRef = EE247AD61C3F04ED00AE3E12 /* SQLite.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tDEB306BC2B61CEF500F9D46B /* CoreFunctions.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AFC1C3F06E900AE3E12 /* CoreFunctions.swift */; };\n\t\tDEB306BD2B61CEF500F9D46B /* Coding.swift in Sources */ = {isa = PBXBuildFile; fileRef = 49EB68C31F7B3CB400D89D40 /* Coding.swift */; };\n\t\tDEB306BE2B61CEF500F9D46B /* RTree.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AF61C3F06E900AE3E12 /* RTree.swift */; };\n\t\tDEB306BF2B61CEF500F9D46B /* Blob.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AEE1C3F06E900AE3E12 /* Blob.swift */; };\n\t\tDEB306C02B61CEF500F9D46B /* URIQueryParameter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3DF7B790288449BA005DD8CA /* URIQueryParameter.swift */; };\n\t\tDEB306C12B61CEF500F9D46B /* Foundation.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AF71C3F06E900AE3E12 /* Foundation.swift */; };\n\t\tDEB306C22B61CEF500F9D46B /* Connection.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AEF1C3F06E900AE3E12 /* Connection.swift */; };\n\t\tDEB306C32B61CEF500F9D46B /* Expression.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AFE1C3F06E900AE3E12 /* Expression.swift */; };\n\t\tDEB306C42B61CEF500F9D46B /* Helpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AF81C3F06E900AE3E12 /* Helpers.swift */; };\n\t\tDEB306C52B61CEF500F9D46B /* Collation.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AFB1C3F06E900AE3E12 /* Collation.swift */; };\n\t\tDEB306C62B61CEF500F9D46B /* Setter.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247B021C3F06E900AE3E12 /* Setter.swift */; };\n\t\tDEB306C72B61CEF500F9D46B /* Connection+Attach.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3DF7B78728842972005DD8CA /* Connection+Attach.swift */; };\n\t\tDEB306C82B61CEF500F9D46B /* CustomFunctions.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AFD1C3F06E900AE3E12 /* CustomFunctions.swift */; };\n\t\tDEB306C92B61CEF500F9D46B /* FTS4.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AF51C3F06E900AE3E12 /* FTS4.swift */; };\n\t\tDEB306CA2B61CEF500F9D46B /* Value.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AF31C3F06E900AE3E12 /* Value.swift */; };\n\t\tDEB306CB2B61CEF500F9D46B /* Operators.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AFF1C3F06E900AE3E12 /* Operators.swift */; };\n\t\tDEB306CC2B61CEF500F9D46B /* Schema.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247B011C3F06E900AE3E12 /* Schema.swift */; };\n\t\tDEB306CD2B61CEF500F9D46B /* Query.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247B001C3F06E900AE3E12 /* Query.swift */; };\n\t\tDEB306CE2B61CEF500F9D46B /* Statement.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AF21C3F06E900AE3E12 /* Statement.swift */; };\n\t\tDEB306CF2B61CEF500F9D46B /* AggregateFunctions.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AFA1C3F06E900AE3E12 /* AggregateFunctions.swift */; };\n\t\tDEB306D02B61CEF500F9D46B /* FTS5.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A1730E4390C775C25677D1 /* FTS5.swift */; };\n\t\tDEB306D12B61CEF500F9D46B /* Cipher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A178A39ACA9667A62663CC /* Cipher.swift */; };\n\t\tDEB306D22B61CEF500F9D46B /* Backup.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02A43A9722738CF100FEC494 /* Backup.swift */; };\n\t\tDEB306D32B61CEF500F9D46B /* Errors.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A1710E73A46D5AC721CDA9 /* Errors.swift */; };\n\t\tDEB306D42B61CEF500F9D46B /* DateAndTimeFunctions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17BA55DABB480F9020C8A /* DateAndTimeFunctions.swift */; };\n\t\tDEB306D52B61CEF500F9D46B /* SQLiteVersion.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB7C5DA528D7C9B6006395CF /* SQLiteVersion.swift */; };\n\t\tDEB306D62B61CEF500F9D46B /* Result.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17E723300E5ED3771DCB5 /* Result.swift */; };\n\t\tDEB306D72B61CEF500F9D46B /* Query+with.swift in Sources */ = {isa = PBXBuildFile; fileRef = 997DF2AD287FC06D00F8DF95 /* Query+with.swift */; };\n\t\tDEB306D82B61CEF500F9D46B /* Connection+Aggregation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A175A9CB446640AE6F2200 /* Connection+Aggregation.swift */; };\n\t\tDEB306D92B61CEF500F9D46B /* SQLiteFeature.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB58B21528FC7C4600F8EEA4 /* SQLiteFeature.swift */; };\n\t\tDEB306DA2B61CEF500F9D46B /* SchemaChanger.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A171B262DDE8718513CFDA /* SchemaChanger.swift */; };\n\t\tDEB306DB2B61CEF500F9D46B /* SchemaDefinitions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17268AE67B746B96AC125 /* SchemaDefinitions.swift */; };\n\t\tDEB306DC2B61CEF500F9D46B /* Connection+Schema.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A170A97B51DC5EE365F3C5 /* Connection+Schema.swift */; };\n\t\tDEB306DD2B61CEF500F9D46B /* Connection+Pragmas.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17F285B767BFACD96714B /* Connection+Pragmas.swift */; };\n\t\tDEB306DE2B61CEF500F9D46B /* SchemaReader.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB58B21028FB864300F8EEA4 /* SchemaReader.swift */; };\n\t\tDEB306E02B61CEF500F9D46B /* libsqlite3.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = EE9180931C46EA210038162A /* libsqlite3.tbd */; };\n\t\tDEB306EB2B61CF9500F9D46B /* TestHelpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247B161C3F127200AE3E12 /* TestHelpers.swift */; };\n\t\tDEB306EC2B61CF9500F9D46B /* FoundationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A1794CC4D7827E997E32A7 /* FoundationTests.swift */; };\n\t\tDEB306ED2B61CF9500F9D46B /* Fixtures.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17B93B48B5560E6E51791 /* Fixtures.swift */; };\n\t\tDEB306EE2B61CF9500F9D46B /* SchemaDefinitionsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A176174862D0F0139B3987 /* SchemaDefinitionsTests.swift */; };\n\t\tDEB306EF2B61CF9500F9D46B /* SchemaChangerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17FDB0B0CFB8987906FD0 /* SchemaChangerTests.swift */; };\n\t\tDEB306F02B61CF9500F9D46B /* Connection+SchemaTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17CA1DF7D0F7C9A94C51C /* Connection+SchemaTests.swift */; };\n\t\tDEB306F12B61CF9500F9D46B /* FTS5Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17B96EBD42C878E609CDC /* FTS5Tests.swift */; };\n\t\tDEB306F22B61CF9500F9D46B /* FTS5IntegrationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17BE1CC4AD4036BAB8EE0 /* FTS5IntegrationTests.swift */; };\n\t\tDEB306F32B61CF9500F9D46B /* FTS4Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A1715904F7B6851FCB5EF6 /* FTS4Tests.swift */; };\n\t\tDEB306F42B61CF9500F9D46B /* ExpressionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A170F141BF21946D159083 /* ExpressionTests.swift */; };\n\t\tDEB306F52B61CF9500F9D46B /* StatementTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A1756EB81E9F7F45B12A78 /* StatementTests.swift */; };\n\t\tDEB306F62B61CF9500F9D46B /* QueryTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A171ED017645C8B04DF9F2 /* QueryTests.swift */; };\n\t\tDEB306F72B61CF9500F9D46B /* CipherTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A1787E16C8562C09C076F5 /* CipherTests.swift */; };\n\t\tDEB306F82B61CF9500F9D46B /* BlobTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A171A2ED4E2640F197F48C /* BlobTests.swift */; };\n\t\tDEB306F92B61CF9500F9D46B /* ConnectionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17855BD524FF888265B3C /* ConnectionTests.swift */; };\n\t\tDEB306FA2B61CF9500F9D46B /* CoreFunctionsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17B55F2409B7031443495 /* CoreFunctionsTests.swift */; };\n\t\tDEB306FB2B61CF9500F9D46B /* DateAndTimeFunctionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A178AEF32ABC8BF2993FB5 /* DateAndTimeFunctionTests.swift */; };\n\t\tDEB306FC2B61CF9500F9D46B /* CustomFunctionsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17F2B5959B212A33C383F /* CustomFunctionsTests.swift */; };\n\t\tDEB306FD2B61CF9500F9D46B /* OperatorsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17475DCA068453F787613 /* OperatorsTests.swift */; };\n\t\tDEB306FE2B61CF9500F9D46B /* ResultTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A1745BE8623D8C6808DB3C /* ResultTests.swift */; };\n\t\tDEB306FF2B61CF9500F9D46B /* RTreeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17162C9861E5C4900455D /* RTreeTests.swift */; };\n\t\tDEB307002B61CF9500F9D46B /* SchemaTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A171A7714C6524093255C5 /* SchemaTests.swift */; };\n\t\tDEB307012B61CF9500F9D46B /* SelectTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17EC0C43015063945D32E /* SelectTests.swift */; };\n\t\tDEB307022B61CF9500F9D46B /* ValueTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17AE284BB1DF31D1B753E /* ValueTests.swift */; };\n\t\tDEB307032B61CF9500F9D46B /* QueryIntegrationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17CAE60446607E99C22A6 /* QueryIntegrationTests.swift */; };\n\t\tDEB307042B61CF9500F9D46B /* AggregateFunctionsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17613F00A3F4D4A257A04 /* AggregateFunctionsTests.swift */; };\n\t\tDEB307052B61CF9500F9D46B /* CustomAggregationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A177EF5E2D91BA86DA4480 /* CustomAggregationTests.swift */; };\n\t\tDEB307062B61CF9500F9D46B /* SetterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A1709D5BDD2691BA160012 /* SetterTests.swift */; };\n\t\tDEB307072B61CF9500F9D46B /* RowTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A174FE5B47A97937A27276 /* RowTests.swift */; };\n\t\tDEB307082B61CF9500F9D46B /* Connection+PragmaTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A17C60D3464461057E4D63 /* Connection+PragmaTests.swift */; };\n\t\tDEB307092B61CF9500F9D46B /* Connection+AttachTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19A170C08525D3D27CB5F83C /* Connection+AttachTests.swift */; };\n\t\tDEB3070B2B61CF9500F9D46B /* SQLite.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 03A65E5A1C6BB0F50062603F /* SQLite.framework */; };\n\t\tDEB3070D2B61CF9500F9D46B /* Resources in Resources */ = {isa = PBXBuildFile; fileRef = 3DF7B79528846FCC005DD8CA /* Resources */; };\n\t\tEAE5A0372B893C43007C7EA4 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = EAE5A0362B893C43007C7EA4 /* PrivacyInfo.xcprivacy */; };\n\t\tEAE5A0382B893C43007C7EA4 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = EAE5A0362B893C43007C7EA4 /* PrivacyInfo.xcprivacy */; };\n\t\tEAE5A0392B893C43007C7EA4 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = EAE5A0362B893C43007C7EA4 /* PrivacyInfo.xcprivacy */; };\n\t\tEAE5A03A2B893C43007C7EA4 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = EAE5A0362B893C43007C7EA4 /* PrivacyInfo.xcprivacy */; };\n\t\tEE247AD71C3F04ED00AE3E12 /* SQLite.h in Headers */ = {isa = PBXBuildFile; fileRef = EE247AD61C3F04ED00AE3E12 /* SQLite.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tEE247ADE1C3F04ED00AE3E12 /* SQLite.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EE247AD31C3F04ED00AE3E12 /* SQLite.framework */; };\n\t\tEE247B031C3F06E900AE3E12 /* Blob.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AEE1C3F06E900AE3E12 /* Blob.swift */; };\n\t\tEE247B041C3F06E900AE3E12 /* Connection.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AEF1C3F06E900AE3E12 /* Connection.swift */; };\n\t\tEE247B071C3F06E900AE3E12 /* Statement.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AF21C3F06E900AE3E12 /* Statement.swift */; };\n\t\tEE247B081C3F06E900AE3E12 /* Value.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AF31C3F06E900AE3E12 /* Value.swift */; };\n\t\tEE247B091C3F06E900AE3E12 /* FTS4.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AF51C3F06E900AE3E12 /* FTS4.swift */; };\n\t\tEE247B0A1C3F06E900AE3E12 /* RTree.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AF61C3F06E900AE3E12 /* RTree.swift */; };\n\t\tEE247B0B1C3F06E900AE3E12 /* Foundation.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AF71C3F06E900AE3E12 /* Foundation.swift */; };\n\t\tEE247B0C1C3F06E900AE3E12 /* Helpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AF81C3F06E900AE3E12 /* Helpers.swift */; };\n\t\tEE247B0D1C3F06E900AE3E12 /* AggregateFunctions.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AFA1C3F06E900AE3E12 /* AggregateFunctions.swift */; };\n\t\tEE247B0E1C3F06E900AE3E12 /* Collation.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AFB1C3F06E900AE3E12 /* Collation.swift */; };\n\t\tEE247B0F1C3F06E900AE3E12 /* CoreFunctions.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AFC1C3F06E900AE3E12 /* CoreFunctions.swift */; };\n\t\tEE247B101C3F06E900AE3E12 /* CustomFunctions.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AFD1C3F06E900AE3E12 /* CustomFunctions.swift */; };\n\t\tEE247B111C3F06E900AE3E12 /* Expression.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AFE1C3F06E900AE3E12 /* Expression.swift */; };\n\t\tEE247B121C3F06E900AE3E12 /* Operators.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AFF1C3F06E900AE3E12 /* Operators.swift */; };\n\t\tEE247B131C3F06E900AE3E12 /* Query.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247B001C3F06E900AE3E12 /* Query.swift */; };\n\t\tEE247B141C3F06E900AE3E12 /* Schema.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247B011C3F06E900AE3E12 /* Schema.swift */; };\n\t\tEE247B151C3F06E900AE3E12 /* Setter.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247B021C3F06E900AE3E12 /* Setter.swift */; };\n\t\tEE247B171C3F127200AE3E12 /* TestHelpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247B161C3F127200AE3E12 /* TestHelpers.swift */; };\n\t\tEE247B461C3F3ED000AE3E12 /* SQLite.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EE247B3C1C3F3ED000AE3E12 /* SQLite.framework */; };\n\t\tEE247B611C3F3FC700AE3E12 /* TestHelpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247B161C3F127200AE3E12 /* TestHelpers.swift */; };\n\t\tEE247B621C3F3FDB00AE3E12 /* SQLite.h in Headers */ = {isa = PBXBuildFile; fileRef = EE247AD61C3F04ED00AE3E12 /* SQLite.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tEE247B631C3F3FDB00AE3E12 /* Foundation.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AF71C3F06E900AE3E12 /* Foundation.swift */; };\n\t\tEE247B641C3F3FDB00AE3E12 /* Helpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AF81C3F06E900AE3E12 /* Helpers.swift */; };\n\t\tEE247B651C3F3FEC00AE3E12 /* Blob.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AEE1C3F06E900AE3E12 /* Blob.swift */; };\n\t\tEE247B661C3F3FEC00AE3E12 /* Connection.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AEF1C3F06E900AE3E12 /* Connection.swift */; };\n\t\tEE247B691C3F3FEC00AE3E12 /* Statement.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AF21C3F06E900AE3E12 /* Statement.swift */; };\n\t\tEE247B6A1C3F3FEC00AE3E12 /* Value.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AF31C3F06E900AE3E12 /* Value.swift */; };\n\t\tEE247B6B1C3F3FEC00AE3E12 /* FTS4.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AF51C3F06E900AE3E12 /* FTS4.swift */; };\n\t\tEE247B6C1C3F3FEC00AE3E12 /* RTree.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AF61C3F06E900AE3E12 /* RTree.swift */; };\n\t\tEE247B6D1C3F3FEC00AE3E12 /* AggregateFunctions.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AFA1C3F06E900AE3E12 /* AggregateFunctions.swift */; };\n\t\tEE247B6E1C3F3FEC00AE3E12 /* Collation.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AFB1C3F06E900AE3E12 /* Collation.swift */; };\n\t\tEE247B6F1C3F3FEC00AE3E12 /* CoreFunctions.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AFC1C3F06E900AE3E12 /* CoreFunctions.swift */; };\n\t\tEE247B701C3F3FEC00AE3E12 /* CustomFunctions.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AFD1C3F06E900AE3E12 /* CustomFunctions.swift */; };\n\t\tEE247B711C3F3FEC00AE3E12 /* Expression.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AFE1C3F06E900AE3E12 /* Expression.swift */; };\n\t\tEE247B721C3F3FEC00AE3E12 /* Operators.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AFF1C3F06E900AE3E12 /* Operators.swift */; };\n\t\tEE247B731C3F3FEC00AE3E12 /* Query.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247B001C3F06E900AE3E12 /* Query.swift */; };\n\t\tEE247B741C3F3FEC00AE3E12 /* Schema.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247B011C3F06E900AE3E12 /* Schema.swift */; };\n\t\tEE247B751C3F3FEC00AE3E12 /* Setter.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247B021C3F06E900AE3E12 /* Setter.swift */; };\n\t\tEE9180941C46EA210038162A /* libsqlite3.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = EE9180931C46EA210038162A /* libsqlite3.tbd */; };\n\t\tEE9180951C46EBCC0038162A /* libsqlite3.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = EE9180911C46E9D30038162A /* libsqlite3.tbd */; };\n/* End PBXBuildFile section */\n\n/* Begin PBXContainerItemProxy section */\n\t\t03A65E651C6BB0F60062603F /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = EE247ACA1C3F04ED00AE3E12 /* Project object */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 03A65E591C6BB0F50062603F;\n\t\t\tremoteInfo = \"SQLite tvOS\";\n\t\t};\n\t\tDEB307142B61D07F00F9D46B /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = EE247ACA1C3F04ED00AE3E12 /* Project object */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = DEB306B82B61CEF500F9D46B;\n\t\t\tremoteInfo = \"SQLite visionOS\";\n\t\t};\n\t\tEE247ADF1C3F04ED00AE3E12 /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = EE247ACA1C3F04ED00AE3E12 /* Project object */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = EE247AD21C3F04ED00AE3E12;\n\t\t\tremoteInfo = SQLite;\n\t\t};\n\t\tEE247B471C3F3ED000AE3E12 /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = EE247ACA1C3F04ED00AE3E12 /* Project object */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = EE247B3B1C3F3ED000AE3E12;\n\t\t\tremoteInfo = SQLite;\n\t\t};\n/* End PBXContainerItemProxy section */\n\n/* Begin PBXFileReference section */\n\t\t02A43A9722738CF100FEC494 /* Backup.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Backup.swift; sourceTree = \"<group>\"; };\n\t\t03A65E5A1C6BB0F50062603F /* SQLite.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SQLite.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t03A65E631C6BB0F60062603F /* SQLiteTests tvOS.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = \"SQLiteTests tvOS.xctest\"; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t03A65E961C6BB3210062603F /* libsqlite3.tbd */ = {isa = PBXFileReference; lastKnownFileType = \"sourcecode.text-based-dylib-definition\"; name = libsqlite3.tbd; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/usr/lib/libsqlite3.tbd; sourceTree = DEVELOPER_DIR; };\n\t\t19A1709D5BDD2691BA160012 /* SetterTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SetterTests.swift; sourceTree = \"<group>\"; };\n\t\t19A170A97B51DC5EE365F3C5 /* Connection+Schema.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = \"Connection+Schema.swift\"; sourceTree = \"<group>\"; };\n\t\t19A170C08525D3D27CB5F83C /* Connection+AttachTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = \"Connection+AttachTests.swift\"; sourceTree = \"<group>\"; };\n\t\t19A170F141BF21946D159083 /* ExpressionTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExpressionTests.swift; sourceTree = \"<group>\"; };\n\t\t19A1710E73A46D5AC721CDA9 /* Errors.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Errors.swift; sourceTree = \"<group>\"; };\n\t\t19A1715904F7B6851FCB5EF6 /* FTS4Tests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FTS4Tests.swift; sourceTree = \"<group>\"; };\n\t\t19A17162C9861E5C4900455D /* RTreeTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RTreeTests.swift; sourceTree = \"<group>\"; };\n\t\t19A171A2ED4E2640F197F48C /* BlobTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BlobTests.swift; sourceTree = \"<group>\"; };\n\t\t19A171A7714C6524093255C5 /* SchemaTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SchemaTests.swift; sourceTree = \"<group>\"; };\n\t\t19A171B262DDE8718513CFDA /* SchemaChanger.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SchemaChanger.swift; sourceTree = \"<group>\"; };\n\t\t19A171ED017645C8B04DF9F2 /* QueryTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = QueryTests.swift; sourceTree = \"<group>\"; };\n\t\t19A17268AE67B746B96AC125 /* SchemaDefinitions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SchemaDefinitions.swift; sourceTree = \"<group>\"; };\n\t\t19A1730E4390C775C25677D1 /* FTS5.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FTS5.swift; sourceTree = \"<group>\"; };\n\t\t19A1745BE8623D8C6808DB3C /* ResultTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ResultTests.swift; sourceTree = \"<group>\"; };\n\t\t19A17475DCA068453F787613 /* OperatorsTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OperatorsTests.swift; sourceTree = \"<group>\"; };\n\t\t19A174FE5B47A97937A27276 /* RowTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RowTests.swift; sourceTree = \"<group>\"; };\n\t\t19A1756EB81E9F7F45B12A78 /* StatementTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StatementTests.swift; sourceTree = \"<group>\"; };\n\t\t19A175A9CB446640AE6F2200 /* Connection+Aggregation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = \"Connection+Aggregation.swift\"; sourceTree = \"<group>\"; };\n\t\t19A17613F00A3F4D4A257A04 /* AggregateFunctionsTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AggregateFunctionsTests.swift; sourceTree = \"<group>\"; };\n\t\t19A176174862D0F0139B3987 /* SchemaDefinitionsTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SchemaDefinitionsTests.swift; sourceTree = \"<group>\"; };\n\t\t19A177EF5E2D91BA86DA4480 /* CustomAggregationTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomAggregationTests.swift; sourceTree = \"<group>\"; };\n\t\t19A17855BD524FF888265B3C /* ConnectionTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConnectionTests.swift; sourceTree = \"<group>\"; };\n\t\t19A1787E16C8562C09C076F5 /* CipherTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CipherTests.swift; sourceTree = \"<group>\"; };\n\t\t19A178A39ACA9667A62663CC /* Cipher.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Cipher.swift; sourceTree = \"<group>\"; };\n\t\t19A178AEF32ABC8BF2993FB5 /* DateAndTimeFunctionTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DateAndTimeFunctionTests.swift; sourceTree = \"<group>\"; };\n\t\t19A1794B7972D14330A65BBD /* Linux.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = Linux.md; sourceTree = \"<group>\"; };\n\t\t19A1794CC4D7827E997E32A7 /* FoundationTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FoundationTests.swift; sourceTree = \"<group>\"; };\n\t\t19A17AE284BB1DF31D1B753E /* ValueTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ValueTests.swift; sourceTree = \"<group>\"; };\n\t\t19A17B55F2409B7031443495 /* CoreFunctionsTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CoreFunctionsTests.swift; sourceTree = \"<group>\"; };\n\t\t19A17B93B48B5560E6E51791 /* Fixtures.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Fixtures.swift; sourceTree = \"<group>\"; };\n\t\t19A17B96EBD42C878E609CDC /* FTS5Tests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FTS5Tests.swift; sourceTree = \"<group>\"; };\n\t\t19A17BA55DABB480F9020C8A /* DateAndTimeFunctions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DateAndTimeFunctions.swift; sourceTree = \"<group>\"; };\n\t\t19A17BE1CC4AD4036BAB8EE0 /* FTS5IntegrationTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FTS5IntegrationTests.swift; sourceTree = \"<group>\"; };\n\t\t19A17C60D3464461057E4D63 /* Connection+PragmaTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = \"Connection+PragmaTests.swift\"; sourceTree = \"<group>\"; };\n\t\t19A17CA1DF7D0F7C9A94C51C /* Connection+SchemaTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = \"Connection+SchemaTests.swift\"; sourceTree = \"<group>\"; };\n\t\t19A17CAE60446607E99C22A6 /* QueryIntegrationTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = QueryIntegrationTests.swift; sourceTree = \"<group>\"; };\n\t\t19A17E723300E5ED3771DCB5 /* Result.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Result.swift; sourceTree = \"<group>\"; };\n\t\t19A17EA3A313F129011B3FA0 /* Release.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = Release.md; sourceTree = \"<group>\"; };\n\t\t19A17EC0C43015063945D32E /* SelectTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SelectTests.swift; sourceTree = \"<group>\"; };\n\t\t19A17F285B767BFACD96714B /* Connection+Pragmas.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = \"Connection+Pragmas.swift\"; sourceTree = \"<group>\"; };\n\t\t19A17F2B5959B212A33C383F /* CustomFunctionsTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomFunctionsTests.swift; sourceTree = \"<group>\"; };\n\t\t19A17FDB0B0CFB8987906FD0 /* SchemaChangerTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SchemaChangerTests.swift; sourceTree = \"<group>\"; };\n\t\t3D3C3CCB26E5568800759140 /* SQLite.playground */ = {isa = PBXFileReference; lastKnownFileType = file.playground; path = SQLite.playground; sourceTree = \"<group>\"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };\n\t\t3D67B3E51DB2469200A4F4C6 /* libsqlite3.tbd */ = {isa = PBXFileReference; lastKnownFileType = \"sourcecode.text-based-dylib-definition\"; name = libsqlite3.tbd; path = Platforms/WatchOS.platform/Developer/SDKs/WatchOS3.0.sdk/usr/lib/libsqlite3.tbd; sourceTree = DEVELOPER_DIR; };\n\t\t3DF7B78728842972005DD8CA /* Connection+Attach.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = \"Connection+Attach.swift\"; sourceTree = \"<group>\"; };\n\t\t3DF7B790288449BA005DD8CA /* URIQueryParameter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = URIQueryParameter.swift; sourceTree = \"<group>\"; };\n\t\t3DF7B79528846FCC005DD8CA /* Resources */ = {isa = PBXFileReference; lastKnownFileType = folder; path = Resources; sourceTree = \"<group>\"; };\n\t\t3DF7B79A2884C353005DD8CA /* CHANGELOG.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = CHANGELOG.md; sourceTree = \"<group>\"; };\n\t\t3DF7B79B2884C901005DD8CA /* Planning.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = Planning.md; sourceTree = \"<group>\"; };\n\t\t3DFC0B862886C239001C8FC9 /* Package.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Package.swift; sourceTree = \"<group>\"; };\n\t\t49EB68C31F7B3CB400D89D40 /* Coding.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Coding.swift; sourceTree = \"<group>\"; };\n\t\t64A8EE422B095FBB00F583F7 /* WindowFunctions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WindowFunctions.swift; sourceTree = \"<group>\"; };\n\t\t64B8E16F2B09748000545AFB /* WindowFunctionsTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WindowFunctionsTests.swift; sourceTree = \"<group>\"; };\n\t\t997DF2AD287FC06D00F8DF95 /* Query+with.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = \"Query+with.swift\"; sourceTree = \"<group>\"; };\n\t\tA121AC451CA35C79005A31D1 /* SQLite.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SQLite.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\tDB58B21028FB864300F8EEA4 /* SchemaReader.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SchemaReader.swift; sourceTree = \"<group>\"; };\n\t\tDB58B21528FC7C4600F8EEA4 /* SQLiteFeature.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SQLiteFeature.swift; sourceTree = \"<group>\"; };\n\t\tDB7C5DA528D7C9B6006395CF /* SQLiteVersion.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SQLiteVersion.swift; sourceTree = \"<group>\"; };\n\t\tDBB93D592A22A373009BB96E /* SchemaReaderTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SchemaReaderTests.swift; sourceTree = \"<group>\"; };\n\t\tDEB306E52B61CEF500F9D46B /* SQLite.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SQLite.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\tDEB307112B61CF9500F9D46B /* SQLiteTests visionOS.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = \"SQLiteTests visionOS.xctest\"; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\tDEB307132B61D04500F9D46B /* SQLite visionOS.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; name = \"SQLite visionOS.xctestplan\"; path = \"Tests/SQLite visionOS.xctestplan\"; sourceTree = \"<group>\"; };\n\t\tEAE5A0362B893C43007C7EA4 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = \"<group>\"; };\n\t\tEE247AD31C3F04ED00AE3E12 /* SQLite.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SQLite.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\tEE247AD61C3F04ED00AE3E12 /* SQLite.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SQLite.h; sourceTree = \"<group>\"; };\n\t\tEE247AD81C3F04ED00AE3E12 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = \"<group>\"; };\n\t\tEE247ADD1C3F04ED00AE3E12 /* SQLiteTests iOS.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = \"SQLiteTests iOS.xctest\"; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\tEE247AE41C3F04ED00AE3E12 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = \"<group>\"; };\n\t\tEE247AEE1C3F06E900AE3E12 /* Blob.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Blob.swift; sourceTree = \"<group>\"; };\n\t\tEE247AEF1C3F06E900AE3E12 /* Connection.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Connection.swift; sourceTree = \"<group>\"; };\n\t\tEE247AF21C3F06E900AE3E12 /* Statement.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Statement.swift; sourceTree = \"<group>\"; };\n\t\tEE247AF31C3F06E900AE3E12 /* Value.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Value.swift; sourceTree = \"<group>\"; };\n\t\tEE247AF51C3F06E900AE3E12 /* FTS4.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FTS4.swift; sourceTree = \"<group>\"; };\n\t\tEE247AF61C3F06E900AE3E12 /* RTree.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RTree.swift; sourceTree = \"<group>\"; };\n\t\tEE247AF71C3F06E900AE3E12 /* Foundation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Foundation.swift; sourceTree = \"<group>\"; };\n\t\tEE247AF81C3F06E900AE3E12 /* Helpers.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Helpers.swift; sourceTree = \"<group>\"; };\n\t\tEE247AFA1C3F06E900AE3E12 /* AggregateFunctions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AggregateFunctions.swift; sourceTree = \"<group>\"; };\n\t\tEE247AFB1C3F06E900AE3E12 /* Collation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Collation.swift; sourceTree = \"<group>\"; };\n\t\tEE247AFC1C3F06E900AE3E12 /* CoreFunctions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CoreFunctions.swift; sourceTree = \"<group>\"; };\n\t\tEE247AFD1C3F06E900AE3E12 /* CustomFunctions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomFunctions.swift; sourceTree = \"<group>\"; };\n\t\tEE247AFE1C3F06E900AE3E12 /* Expression.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Expression.swift; sourceTree = \"<group>\"; };\n\t\tEE247AFF1C3F06E900AE3E12 /* Operators.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Operators.swift; sourceTree = \"<group>\"; };\n\t\tEE247B001C3F06E900AE3E12 /* Query.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Query.swift; sourceTree = \"<group>\"; };\n\t\tEE247B011C3F06E900AE3E12 /* Schema.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Schema.swift; sourceTree = \"<group>\"; };\n\t\tEE247B021C3F06E900AE3E12 /* Setter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Setter.swift; sourceTree = \"<group>\"; };\n\t\tEE247B161C3F127200AE3E12 /* TestHelpers.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestHelpers.swift; sourceTree = \"<group>\"; };\n\t\tEE247B3C1C3F3ED000AE3E12 /* SQLite.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SQLite.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\tEE247B451C3F3ED000AE3E12 /* SQLiteTests Mac.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = \"SQLiteTests Mac.xctest\"; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\tEE247B771C3F40D700AE3E12 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = \"<group>\"; };\n\t\tEE247B8B1C3F820300AE3E12 /* CONTRIBUTING.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = CONTRIBUTING.md; sourceTree = \"<group>\"; };\n\t\tEE247B8D1C3F821200AE3E12 /* Makefile */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = \"<group>\"; };\n\t\tEE247B8F1C3F822500AE3E12 /* Index.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = Index.md; sourceTree = \"<group>\"; };\n\t\tEE247B911C3F822500AE3E12 /* installation@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = \"installation@2x.png\"; sourceTree = \"<group>\"; };\n\t\tEE247B921C3F822600AE3E12 /* playground@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = \"playground@2x.png\"; sourceTree = \"<group>\"; };\n\t\tEE247B931C3F826100AE3E12 /* SQLite.swift.podspec */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; path = SQLite.swift.podspec; sourceTree = \"<group>\"; };\n\t\tEE9180911C46E9D30038162A /* libsqlite3.tbd */ = {isa = PBXFileReference; lastKnownFileType = \"sourcecode.text-based-dylib-definition\"; name = libsqlite3.tbd; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/libsqlite3.tbd; sourceTree = DEVELOPER_DIR; };\n\t\tEE9180931C46EA210038162A /* libsqlite3.tbd */ = {isa = PBXFileReference; lastKnownFileType = \"sourcecode.text-based-dylib-definition\"; name = libsqlite3.tbd; path = usr/lib/libsqlite3.tbd; sourceTree = SDKROOT; };\n/* End PBXFileReference section */\n\n/* Begin PBXFrameworksBuildPhase section */\n\t\t03A65E561C6BB0F50062603F /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t03A65E971C6BB3210062603F /* libsqlite3.tbd in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t03A65E601C6BB0F60062603F /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t03A65E641C6BB0F60062603F /* SQLite.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tA121AC411CA35C79005A31D1 /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t3D67B3E61DB2469200A4F4C6 /* libsqlite3.tbd in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tDEB306DF2B61CEF500F9D46B /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tDEB306E02B61CEF500F9D46B /* libsqlite3.tbd in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tDEB3070A2B61CF9500F9D46B /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tDEB3070B2B61CF9500F9D46B /* SQLite.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tEE247ACF1C3F04ED00AE3E12 /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tEE9180941C46EA210038162A /* libsqlite3.tbd in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tEE247ADA1C3F04ED00AE3E12 /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tEE247ADE1C3F04ED00AE3E12 /* SQLite.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tEE247B381C3F3ED000AE3E12 /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tEE9180951C46EBCC0038162A /* libsqlite3.tbd in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tEE247B421C3F3ED000AE3E12 /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tEE247B461C3F3ED000AE3E12 /* SQLite.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXFrameworksBuildPhase section */\n\n/* Begin PBXGroup section */\n\t\t19A1792D261C689FC988A90A /* Schema */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tDB58B21028FB864300F8EEA4 /* SchemaReader.swift */,\n\t\t\t\t19A171B262DDE8718513CFDA /* SchemaChanger.swift */,\n\t\t\t\t19A17268AE67B746B96AC125 /* SchemaDefinitions.swift */,\n\t\t\t\t19A170A97B51DC5EE365F3C5 /* Connection+Schema.swift */,\n\t\t\t);\n\t\t\tpath = Schema;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t19A1798E3459573BEE50FA34 /* Core */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t19A1756EB81E9F7F45B12A78 /* StatementTests.swift */,\n\t\t\t\t19A171A2ED4E2640F197F48C /* BlobTests.swift */,\n\t\t\t\t19A17855BD524FF888265B3C /* ConnectionTests.swift */,\n\t\t\t\t19A17B55F2409B7031443495 /* CoreFunctionsTests.swift */,\n\t\t\t\t19A1745BE8623D8C6808DB3C /* ResultTests.swift */,\n\t\t\t\t19A17AE284BB1DF31D1B753E /* ValueTests.swift */,\n\t\t\t\t19A17C60D3464461057E4D63 /* Connection+PragmaTests.swift */,\n\t\t\t\t19A170C08525D3D27CB5F83C /* Connection+AttachTests.swift */,\n\t\t\t);\n\t\t\tpath = Core;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t19A17AECBF878B1DAE0AE3DD /* Typed */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t19A170F141BF21946D159083 /* ExpressionTests.swift */,\n\t\t\t\t19A171ED017645C8B04DF9F2 /* QueryTests.swift */,\n\t\t\t\t19A178AEF32ABC8BF2993FB5 /* DateAndTimeFunctionTests.swift */,\n\t\t\t\t19A17F2B5959B212A33C383F /* CustomFunctionsTests.swift */,\n\t\t\t\t19A17475DCA068453F787613 /* OperatorsTests.swift */,\n\t\t\t\t19A17EC0C43015063945D32E /* SelectTests.swift */,\n\t\t\t\t19A17CAE60446607E99C22A6 /* QueryIntegrationTests.swift */,\n\t\t\t\t19A17613F00A3F4D4A257A04 /* AggregateFunctionsTests.swift */,\n\t\t\t\t19A177EF5E2D91BA86DA4480 /* CustomAggregationTests.swift */,\n\t\t\t\t19A1709D5BDD2691BA160012 /* SetterTests.swift */,\n\t\t\t\t19A174FE5B47A97937A27276 /* RowTests.swift */,\n\t\t\t\t64B8E16F2B09748000545AFB /* WindowFunctionsTests.swift */,\n\t\t\t);\n\t\t\tpath = Typed;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t19A17B56FBA20E7245BC8AC0 /* Schema */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tDBB93D592A22A373009BB96E /* SchemaReaderTests.swift */,\n\t\t\t\t19A176174862D0F0139B3987 /* SchemaDefinitionsTests.swift */,\n\t\t\t\t19A17FDB0B0CFB8987906FD0 /* SchemaChangerTests.swift */,\n\t\t\t\t19A17CA1DF7D0F7C9A94C51C /* Connection+SchemaTests.swift */,\n\t\t\t\t19A171A7714C6524093255C5 /* SchemaTests.swift */,\n\t\t\t);\n\t\t\tpath = Schema;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t19A17E470E4492D287C0D12F /* Extensions */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t19A17B96EBD42C878E609CDC /* FTS5Tests.swift */,\n\t\t\t\t19A17BE1CC4AD4036BAB8EE0 /* FTS5IntegrationTests.swift */,\n\t\t\t\t19A1715904F7B6851FCB5EF6 /* FTS4Tests.swift */,\n\t\t\t\t19A1787E16C8562C09C076F5 /* CipherTests.swift */,\n\t\t\t\t19A17162C9861E5C4900455D /* RTreeTests.swift */,\n\t\t\t);\n\t\t\tpath = Extensions;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t3D67B3E41DB2469200A4F4C6 /* Frameworks */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3D67B3E51DB2469200A4F4C6 /* libsqlite3.tbd */,\n\t\t\t);\n\t\t\tname = Frameworks;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tEE247AC91C3F04ED00AE3E12 = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3D3C3CCB26E5568800759140 /* SQLite.playground */,\n\t\t\t\tEE247AD51C3F04ED00AE3E12 /* SQLite */,\n\t\t\t\tEE247AE11C3F04ED00AE3E12 /* SQLiteTests */,\n\t\t\t\tDEB307132B61D04500F9D46B /* SQLite visionOS.xctestplan */,\n\t\t\t\tEE247B8A1C3F81D000AE3E12 /* Metadata */,\n\t\t\t\tEE247AD41C3F04ED00AE3E12 /* Products */,\n\t\t\t\t3D67B3E41DB2469200A4F4C6 /* Frameworks */,\n\t\t\t);\n\t\t\tindentWidth = 4;\n\t\t\tsourceTree = \"<group>\";\n\t\t\ttabWidth = 4;\n\t\t};\n\t\tEE247AD41C3F04ED00AE3E12 /* Products */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tEE247AD31C3F04ED00AE3E12 /* SQLite.framework */,\n\t\t\t\tEE247ADD1C3F04ED00AE3E12 /* SQLiteTests iOS.xctest */,\n\t\t\t\tEE247B3C1C3F3ED000AE3E12 /* SQLite.framework */,\n\t\t\t\tEE247B451C3F3ED000AE3E12 /* SQLiteTests Mac.xctest */,\n\t\t\t\t03A65E5A1C6BB0F50062603F /* SQLite.framework */,\n\t\t\t\t03A65E631C6BB0F60062603F /* SQLiteTests tvOS.xctest */,\n\t\t\t\tA121AC451CA35C79005A31D1 /* SQLite.framework */,\n\t\t\t\tDEB306E52B61CEF500F9D46B /* SQLite.framework */,\n\t\t\t\tDEB307112B61CF9500F9D46B /* SQLiteTests visionOS.xctest */,\n\t\t\t);\n\t\t\tname = Products;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tEE247AD51C3F04ED00AE3E12 /* SQLite */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tEE247AD61C3F04ED00AE3E12 /* SQLite.h */,\n\t\t\t\tEE247AF71C3F06E900AE3E12 /* Foundation.swift */,\n\t\t\t\tEE247AF81C3F06E900AE3E12 /* Helpers.swift */,\n\t\t\t\tEAE5A0362B893C43007C7EA4 /* PrivacyInfo.xcprivacy */,\n\t\t\t\tEE247AD81C3F04ED00AE3E12 /* Info.plist */,\n\t\t\t\tEE247AED1C3F06E900AE3E12 /* Core */,\n\t\t\t\tEE247AF41C3F06E900AE3E12 /* Extensions */,\n\t\t\t\tEE247AF91C3F06E900AE3E12 /* Typed */,\n\t\t\t\t19A1792D261C689FC988A90A /* Schema */,\n\t\t\t);\n\t\t\tname = SQLite;\n\t\t\tpath = Sources/SQLite;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tEE247AE11C3F04ED00AE3E12 /* SQLiteTests */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3DF7B79528846FCC005DD8CA /* Resources */,\n\t\t\t\tEE247B161C3F127200AE3E12 /* TestHelpers.swift */,\n\t\t\t\tEE247AE41C3F04ED00AE3E12 /* Info.plist */,\n\t\t\t\t19A1794CC4D7827E997E32A7 /* FoundationTests.swift */,\n\t\t\t\t19A17B93B48B5560E6E51791 /* Fixtures.swift */,\n\t\t\t\t19A17B56FBA20E7245BC8AC0 /* Schema */,\n\t\t\t\t19A17E470E4492D287C0D12F /* Extensions */,\n\t\t\t\t19A1798E3459573BEE50FA34 /* Core */,\n\t\t\t\t19A17AECBF878B1DAE0AE3DD /* Typed */,\n\t\t\t);\n\t\t\tname = SQLiteTests;\n\t\t\tpath = Tests/SQLiteTests;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tEE247AED1C3F06E900AE3E12 /* Core */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tEE247AEE1C3F06E900AE3E12 /* Blob.swift */,\n\t\t\t\tEE247AEF1C3F06E900AE3E12 /* Connection.swift */,\n\t\t\t\tEE247AF21C3F06E900AE3E12 /* Statement.swift */,\n\t\t\t\tEE247AF31C3F06E900AE3E12 /* Value.swift */,\n\t\t\t\t19A1710E73A46D5AC721CDA9 /* Errors.swift */,\n\t\t\t\t02A43A9722738CF100FEC494 /* Backup.swift */,\n\t\t\t\t19A17E723300E5ED3771DCB5 /* Result.swift */,\n\t\t\t\t19A175A9CB446640AE6F2200 /* Connection+Aggregation.swift */,\n\t\t\t\t3DF7B78728842972005DD8CA /* Connection+Attach.swift */,\n\t\t\t\t3DF7B790288449BA005DD8CA /* URIQueryParameter.swift */,\n\t\t\t\tDB58B21528FC7C4600F8EEA4 /* SQLiteFeature.swift */,\n\t\t\t\tDB7C5DA528D7C9B6006395CF /* SQLiteVersion.swift */,\n\t\t\t\t19A17F285B767BFACD96714B /* Connection+Pragmas.swift */,\n\t\t\t);\n\t\t\tpath = Core;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tEE247AF41C3F06E900AE3E12 /* Extensions */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t19A178A39ACA9667A62663CC /* Cipher.swift */,\n\t\t\t\tEE247AF51C3F06E900AE3E12 /* FTS4.swift */,\n\t\t\t\t19A1730E4390C775C25677D1 /* FTS5.swift */,\n\t\t\t\tEE247AF61C3F06E900AE3E12 /* RTree.swift */,\n\t\t\t);\n\t\t\tpath = Extensions;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tEE247AF91C3F06E900AE3E12 /* Typed */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tEE247AFA1C3F06E900AE3E12 /* AggregateFunctions.swift */,\n\t\t\t\t64A8EE422B095FBB00F583F7 /* WindowFunctions.swift */,\n\t\t\t\tEE247AFB1C3F06E900AE3E12 /* Collation.swift */,\n\t\t\t\tEE247AFC1C3F06E900AE3E12 /* CoreFunctions.swift */,\n\t\t\t\tEE247AFD1C3F06E900AE3E12 /* CustomFunctions.swift */,\n\t\t\t\tEE247AFE1C3F06E900AE3E12 /* Expression.swift */,\n\t\t\t\tEE247AFF1C3F06E900AE3E12 /* Operators.swift */,\n\t\t\t\tEE247B001C3F06E900AE3E12 /* Query.swift */,\n\t\t\t\t997DF2AD287FC06D00F8DF95 /* Query+with.swift */,\n\t\t\t\tEE247B011C3F06E900AE3E12 /* Schema.swift */,\n\t\t\t\tEE247B021C3F06E900AE3E12 /* Setter.swift */,\n\t\t\t\t49EB68C31F7B3CB400D89D40 /* Coding.swift */,\n\t\t\t\t19A17BA55DABB480F9020C8A /* DateAndTimeFunctions.swift */,\n\t\t\t);\n\t\t\tpath = Typed;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tEE247B8A1C3F81D000AE3E12 /* Metadata */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tEE247B771C3F40D700AE3E12 /* README.md */,\n\t\t\t\t3DF7B79A2884C353005DD8CA /* CHANGELOG.md */,\n\t\t\t\tEE247B8B1C3F820300AE3E12 /* CONTRIBUTING.md */,\n\t\t\t\tEE247B931C3F826100AE3E12 /* SQLite.swift.podspec */,\n\t\t\t\t3DFC0B862886C239001C8FC9 /* Package.swift */,\n\t\t\t\tEE247B8D1C3F821200AE3E12 /* Makefile */,\n\t\t\t\tEE9180931C46EA210038162A /* libsqlite3.tbd */,\n\t\t\t\tEE9180911C46E9D30038162A /* libsqlite3.tbd */,\n\t\t\t\t03A65E961C6BB3210062603F /* libsqlite3.tbd */,\n\t\t\t\tEE247B8E1C3F822500AE3E12 /* Documentation */,\n\t\t\t);\n\t\t\tname = Metadata;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tEE247B8E1C3F822500AE3E12 /* Documentation */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tEE247B8F1C3F822500AE3E12 /* Index.md */,\n\t\t\t\t3DF7B79B2884C901005DD8CA /* Planning.md */,\n\t\t\t\tEE247B901C3F822500AE3E12 /* Resources */,\n\t\t\t\t19A17EA3A313F129011B3FA0 /* Release.md */,\n\t\t\t\t19A1794B7972D14330A65BBD /* Linux.md */,\n\t\t\t);\n\t\t\tpath = Documentation;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tEE247B901C3F822500AE3E12 /* Resources */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tEE247B911C3F822500AE3E12 /* installation@2x.png */,\n\t\t\t\tEE247B921C3F822600AE3E12 /* playground@2x.png */,\n\t\t\t);\n\t\t\tpath = Resources;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXGroup section */\n\n/* Begin PBXHeadersBuildPhase section */\n\t\t03A65E571C6BB0F50062603F /* Headers */ = {\n\t\t\tisa = PBXHeadersBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t03A65E721C6BB2D30062603F /* SQLite.h in Headers */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tA121AC421CA35C79005A31D1 /* Headers */ = {\n\t\t\tisa = PBXHeadersBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t3D67B3FC1DB2471B00A4F4C6 /* SQLite.h in Headers */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tDEB306B92B61CEF500F9D46B /* Headers */ = {\n\t\t\tisa = PBXHeadersBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tDEB306BA2B61CEF500F9D46B /* SQLite.h in Headers */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tEE247AD01C3F04ED00AE3E12 /* Headers */ = {\n\t\t\tisa = PBXHeadersBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tEE247AD71C3F04ED00AE3E12 /* SQLite.h in Headers */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tEE247B391C3F3ED000AE3E12 /* Headers */ = {\n\t\t\tisa = PBXHeadersBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tEE247B621C3F3FDB00AE3E12 /* SQLite.h in Headers */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXHeadersBuildPhase section */\n\n/* Begin PBXNativeTarget section */\n\t\t03A65E591C6BB0F50062603F /* SQLite tvOS */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 03A65E6F1C6BB0F60062603F /* Build configuration list for PBXNativeTarget \"SQLite tvOS\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t03A65E571C6BB0F50062603F /* Headers */,\n\t\t\t\t03A65E551C6BB0F50062603F /* Sources */,\n\t\t\t\t03A65E561C6BB0F50062603F /* Frameworks */,\n\t\t\t\t03A65E581C6BB0F50062603F /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = \"SQLite tvOS\";\n\t\t\tproductName = \"SQLite tvOS\";\n\t\t\tproductReference = 03A65E5A1C6BB0F50062603F /* SQLite.framework */;\n\t\t\tproductType = \"com.apple.product-type.framework\";\n\t\t};\n\t\t03A65E621C6BB0F60062603F /* SQLiteTests tvOS */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 03A65E701C6BB0F60062603F /* Build configuration list for PBXNativeTarget \"SQLiteTests tvOS\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t03A65E5F1C6BB0F60062603F /* Sources */,\n\t\t\t\t03A65E601C6BB0F60062603F /* Frameworks */,\n\t\t\t\t03A65E611C6BB0F60062603F /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t\t03A65E661C6BB0F60062603F /* PBXTargetDependency */,\n\t\t\t);\n\t\t\tname = \"SQLiteTests tvOS\";\n\t\t\tproductName = \"SQLite tvOSTests\";\n\t\t\tproductReference = 03A65E631C6BB0F60062603F /* SQLiteTests tvOS.xctest */;\n\t\t\tproductType = \"com.apple.product-type.bundle.unit-test\";\n\t\t};\n\t\tA121AC441CA35C79005A31D1 /* SQLite watchOS */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = A121AC4C1CA35C79005A31D1 /* Build configuration list for PBXNativeTarget \"SQLite watchOS\" */;\n\t\t\tbuildPhases = (\n\t\t\t\tA121AC421CA35C79005A31D1 /* Headers */,\n\t\t\t\tA121AC401CA35C79005A31D1 /* Sources */,\n\t\t\t\tA121AC411CA35C79005A31D1 /* Frameworks */,\n\t\t\t\tA121AC431CA35C79005A31D1 /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = \"SQLite watchOS\";\n\t\t\tproductName = \"SQLite watchOS\";\n\t\t\tproductReference = A121AC451CA35C79005A31D1 /* SQLite.framework */;\n\t\t\tproductType = \"com.apple.product-type.framework\";\n\t\t};\n\t\tDEB306B82B61CEF500F9D46B /* SQLite visionOS */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = DEB306E22B61CEF500F9D46B /* Build configuration list for PBXNativeTarget \"SQLite visionOS\" */;\n\t\t\tbuildPhases = (\n\t\t\t\tDEB306B92B61CEF500F9D46B /* Headers */,\n\t\t\t\tDEB306BB2B61CEF500F9D46B /* Sources */,\n\t\t\t\tDEB306DF2B61CEF500F9D46B /* Frameworks */,\n\t\t\t\tDEB306E12B61CEF500F9D46B /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = \"SQLite visionOS\";\n\t\t\tproductName = SQLite;\n\t\t\tproductReference = DEB306E52B61CEF500F9D46B /* SQLite.framework */;\n\t\t\tproductType = \"com.apple.product-type.framework\";\n\t\t};\n\t\tDEB306E72B61CF9500F9D46B /* SQLiteTests visionOS */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = DEB3070E2B61CF9500F9D46B /* Build configuration list for PBXNativeTarget \"SQLiteTests visionOS\" */;\n\t\t\tbuildPhases = (\n\t\t\t\tDEB306EA2B61CF9500F9D46B /* Sources */,\n\t\t\t\tDEB3070A2B61CF9500F9D46B /* Frameworks */,\n\t\t\t\tDEB3070C2B61CF9500F9D46B /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t\tDEB307152B61D07F00F9D46B /* PBXTargetDependency */,\n\t\t\t);\n\t\t\tname = \"SQLiteTests visionOS\";\n\t\t\tproductName = \"SQLite tvOSTests\";\n\t\t\tproductReference = DEB307112B61CF9500F9D46B /* SQLiteTests visionOS.xctest */;\n\t\t\tproductType = \"com.apple.product-type.bundle.unit-test\";\n\t\t};\n\t\tEE247AD21C3F04ED00AE3E12 /* SQLite iOS */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = EE247AE71C3F04ED00AE3E12 /* Build configuration list for PBXNativeTarget \"SQLite iOS\" */;\n\t\t\tbuildPhases = (\n\t\t\t\tEE247AD01C3F04ED00AE3E12 /* Headers */,\n\t\t\t\tEE247ACE1C3F04ED00AE3E12 /* Sources */,\n\t\t\t\tEE247ACF1C3F04ED00AE3E12 /* Frameworks */,\n\t\t\t\tEE247AD11C3F04ED00AE3E12 /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = \"SQLite iOS\";\n\t\t\tproductName = SQLite;\n\t\t\tproductReference = EE247AD31C3F04ED00AE3E12 /* SQLite.framework */;\n\t\t\tproductType = \"com.apple.product-type.framework\";\n\t\t};\n\t\tEE247ADC1C3F04ED00AE3E12 /* SQLiteTests iOS */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = EE247AEA1C3F04ED00AE3E12 /* Build configuration list for PBXNativeTarget \"SQLiteTests iOS\" */;\n\t\t\tbuildPhases = (\n\t\t\t\tEE247AD91C3F04ED00AE3E12 /* Sources */,\n\t\t\t\tEE247ADA1C3F04ED00AE3E12 /* Frameworks */,\n\t\t\t\tEE247ADB1C3F04ED00AE3E12 /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t\tEE247AE01C3F04ED00AE3E12 /* PBXTargetDependency */,\n\t\t\t);\n\t\t\tname = \"SQLiteTests iOS\";\n\t\t\tproductName = SQLiteTests;\n\t\t\tproductReference = EE247ADD1C3F04ED00AE3E12 /* SQLiteTests iOS.xctest */;\n\t\t\tproductType = \"com.apple.product-type.bundle.unit-test\";\n\t\t};\n\t\tEE247B3B1C3F3ED000AE3E12 /* SQLite Mac */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = EE247B511C3F3ED000AE3E12 /* Build configuration list for PBXNativeTarget \"SQLite Mac\" */;\n\t\t\tbuildPhases = (\n\t\t\t\tEE247B391C3F3ED000AE3E12 /* Headers */,\n\t\t\t\tEE247B371C3F3ED000AE3E12 /* Sources */,\n\t\t\t\tEE247B381C3F3ED000AE3E12 /* Frameworks */,\n\t\t\t\tEE247B3A1C3F3ED000AE3E12 /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = \"SQLite Mac\";\n\t\t\tproductName = SQLite;\n\t\t\tproductReference = EE247B3C1C3F3ED000AE3E12 /* SQLite.framework */;\n\t\t\tproductType = \"com.apple.product-type.framework\";\n\t\t};\n\t\tEE247B441C3F3ED000AE3E12 /* SQLiteTests Mac */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = EE247B521C3F3ED000AE3E12 /* Build configuration list for PBXNativeTarget \"SQLiteTests Mac\" */;\n\t\t\tbuildPhases = (\n\t\t\t\tEE247B411C3F3ED000AE3E12 /* Sources */,\n\t\t\t\tEE247B421C3F3ED000AE3E12 /* Frameworks */,\n\t\t\t\tEE247B431C3F3ED000AE3E12 /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t\tEE247B481C3F3ED000AE3E12 /* PBXTargetDependency */,\n\t\t\t);\n\t\t\tname = \"SQLiteTests Mac\";\n\t\t\tproductName = SQLiteTests;\n\t\t\tproductReference = EE247B451C3F3ED000AE3E12 /* SQLiteTests Mac.xctest */;\n\t\t\tproductType = \"com.apple.product-type.bundle.unit-test\";\n\t\t};\n/* End PBXNativeTarget section */\n\n/* Begin PBXProject section */\n\t\tEE247ACA1C3F04ED00AE3E12 /* Project object */ = {\n\t\t\tisa = PBXProject;\n\t\t\tattributes = {\n\t\t\t\tLastSwiftUpdateCheck = 0720;\n\t\t\t\tLastUpgradeCheck = 1250;\n\t\t\t\tTargetAttributes = {\n\t\t\t\t\t03A65E591C6BB0F50062603F = {\n\t\t\t\t\t\tCreatedOnToolsVersion = 7.2;\n\t\t\t\t\t\tLastSwiftMigration = 0900;\n\t\t\t\t\t};\n\t\t\t\t\t03A65E621C6BB0F60062603F = {\n\t\t\t\t\t\tCreatedOnToolsVersion = 7.2;\n\t\t\t\t\t\tLastSwiftMigration = 0900;\n\t\t\t\t\t};\n\t\t\t\t\tA121AC441CA35C79005A31D1 = {\n\t\t\t\t\t\tCreatedOnToolsVersion = 7.3;\n\t\t\t\t\t\tLastSwiftMigration = 0900;\n\t\t\t\t\t};\n\t\t\t\t\tEE247AD21C3F04ED00AE3E12 = {\n\t\t\t\t\t\tCreatedOnToolsVersion = 7.2;\n\t\t\t\t\t\tLastSwiftMigration = 0900;\n\t\t\t\t\t};\n\t\t\t\t\tEE247ADC1C3F04ED00AE3E12 = {\n\t\t\t\t\t\tCreatedOnToolsVersion = 7.2;\n\t\t\t\t\t\tLastSwiftMigration = 1020;\n\t\t\t\t\t};\n\t\t\t\t\tEE247B3B1C3F3ED000AE3E12 = {\n\t\t\t\t\t\tCreatedOnToolsVersion = 7.2;\n\t\t\t\t\t\tLastSwiftMigration = 0900;\n\t\t\t\t\t};\n\t\t\t\t\tEE247B441C3F3ED000AE3E12 = {\n\t\t\t\t\t\tCreatedOnToolsVersion = 7.2;\n\t\t\t\t\t\tLastSwiftMigration = 0900;\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t};\n\t\t\tbuildConfigurationList = EE247ACD1C3F04ED00AE3E12 /* Build configuration list for PBXProject \"SQLite\" */;\n\t\t\tcompatibilityVersion = \"Xcode 3.2\";\n\t\t\tdevelopmentRegion = en;\n\t\t\thasScannedForEncodings = 0;\n\t\t\tknownRegions = (\n\t\t\t\ten,\n\t\t\t\tBase,\n\t\t\t);\n\t\t\tmainGroup = EE247AC91C3F04ED00AE3E12;\n\t\t\tproductRefGroup = EE247AD41C3F04ED00AE3E12 /* Products */;\n\t\t\tprojectDirPath = \"\";\n\t\t\tprojectRoot = \"\";\n\t\t\ttargets = (\n\t\t\t\tEE247AD21C3F04ED00AE3E12 /* SQLite iOS */,\n\t\t\t\tEE247ADC1C3F04ED00AE3E12 /* SQLiteTests iOS */,\n\t\t\t\tEE247B3B1C3F3ED000AE3E12 /* SQLite Mac */,\n\t\t\t\tEE247B441C3F3ED000AE3E12 /* SQLiteTests Mac */,\n\t\t\t\t03A65E591C6BB0F50062603F /* SQLite tvOS */,\n\t\t\t\t03A65E621C6BB0F60062603F /* SQLiteTests tvOS */,\n\t\t\t\tA121AC441CA35C79005A31D1 /* SQLite watchOS */,\n\t\t\t\tDEB306B82B61CEF500F9D46B /* SQLite visionOS */,\n\t\t\t\tDEB306E72B61CF9500F9D46B /* SQLiteTests visionOS */,\n\t\t\t);\n\t\t};\n/* End PBXProject section */\n\n/* Begin PBXResourcesBuildPhase section */\n\t\t03A65E581C6BB0F50062603F /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tEAE5A0392B893C43007C7EA4 /* PrivacyInfo.xcprivacy in Resources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t03A65E611C6BB0F60062603F /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t3DF7B79828846FED005DD8CA /* Resources in Resources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tA121AC431CA35C79005A31D1 /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tEAE5A03A2B893C43007C7EA4 /* PrivacyInfo.xcprivacy in Resources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tDEB306E12B61CEF500F9D46B /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tDEB3070C2B61CF9500F9D46B /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tDEB3070D2B61CF9500F9D46B /* Resources in Resources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tEE247AD11C3F04ED00AE3E12 /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tEAE5A0372B893C43007C7EA4 /* PrivacyInfo.xcprivacy in Resources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tEE247ADB1C3F04ED00AE3E12 /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t3DF7B79628846FCC005DD8CA /* Resources in Resources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tEE247B3A1C3F3ED000AE3E12 /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tEAE5A0382B893C43007C7EA4 /* PrivacyInfo.xcprivacy in Resources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tEE247B431C3F3ED000AE3E12 /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t3DF7B79928847055005DD8CA /* Resources in Resources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXResourcesBuildPhase section */\n\n/* Begin PBXSourcesBuildPhase section */\n\t\t03A65E551C6BB0F50062603F /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t03A65E801C6BB2FB0062603F /* CoreFunctions.swift in Sources */,\n\t\t\t\t49EB68C61F7B3CB400D89D40 /* Coding.swift in Sources */,\n\t\t\t\t03A65E761C6BB2E60062603F /* Blob.swift in Sources */,\n\t\t\t\t03A65E7D1C6BB2F70062603F /* RTree.swift in Sources */,\n\t\t\t\t3DF7B793288449BA005DD8CA /* URIQueryParameter.swift in Sources */,\n\t\t\t\t03A65E7B1C6BB2F70062603F /* Value.swift in Sources */,\n\t\t\t\t03A65E821C6BB2FB0062603F /* Expression.swift in Sources */,\n\t\t\t\t03A65E731C6BB2D80062603F /* Foundation.swift in Sources */,\n\t\t\t\t03A65E7F1C6BB2FB0062603F /* Collation.swift in Sources */,\n\t\t\t\t03A65E861C6BB2FB0062603F /* Setter.swift in Sources */,\n\t\t\t\t3DF7B78A28842972005DD8CA /* Connection+Attach.swift in Sources */,\n\t\t\t\t03A65E811C6BB2FB0062603F /* CustomFunctions.swift in Sources */,\n\t\t\t\t03A65E7A1C6BB2F70062603F /* Statement.swift in Sources */,\n\t\t\t\t64A8EE452B095FBB00F583F7 /* WindowFunctions.swift in Sources */,\n\t\t\t\t03A65E741C6BB2DA0062603F /* Helpers.swift in Sources */,\n\t\t\t\t03A65E831C6BB2FB0062603F /* Operators.swift in Sources */,\n\t\t\t\t03A65E851C6BB2FB0062603F /* Schema.swift in Sources */,\n\t\t\t\t03A65E841C6BB2FB0062603F /* Query.swift in Sources */,\n\t\t\t\t03A65E7C1C6BB2F70062603F /* FTS4.swift in Sources */,\n\t\t\t\t03A65E771C6BB2E60062603F /* Connection.swift in Sources */,\n\t\t\t\t03A65E7E1C6BB2FB0062603F /* AggregateFunctions.swift in Sources */,\n\t\t\t\t19A17EC0D68BA8C03288ADF7 /* FTS5.swift in Sources */,\n\t\t\t\t19A179E76EA6207669B60C1B /* Cipher.swift in Sources */,\n\t\t\t\t02A43A9A22738CF100FEC494 /* Backup.swift in Sources */,\n\t\t\t\t19A17FF4A10B44D3937C8CAC /* Errors.swift in Sources */,\n\t\t\t\t19A1737286A74F3CF7412906 /* DateAndTimeFunctions.swift in Sources */,\n\t\t\t\tDB7C5DA828D7C9B6006395CF /* SQLiteVersion.swift in Sources */,\n\t\t\t\t19A17073552293CA063BEA66 /* Result.swift in Sources */,\n\t\t\t\t997DF2B0287FC06D00F8DF95 /* Query+with.swift in Sources */,\n\t\t\t\t19A179B59450FE7C4811AB8A /* Connection+Aggregation.swift in Sources */,\n\t\t\t\tDB58B21828FC7C4600F8EEA4 /* SQLiteFeature.swift in Sources */,\n\t\t\t\t19A17FC07731779C1B8506FA /* SchemaChanger.swift in Sources */,\n\t\t\t\t19A1740EACD47904AA24B8DC /* SchemaDefinitions.swift in Sources */,\n\t\t\t\t19A1750EF4A5F92954A451FF /* Connection+Schema.swift in Sources */,\n\t\t\t\t19A17986405D9A875698408F /* Connection+Pragmas.swift in Sources */,\n\t\t\t\tDB58B21328FB864300F8EEA4 /* SchemaReader.swift in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t03A65E5F1C6BB0F60062603F /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t03A65E951C6BB3030062603F /* TestHelpers.swift in Sources */,\n\t\t\t\t19A17E04C4C0956715C5676A /* FoundationTests.swift in Sources */,\n\t\t\t\t19A17F60B685636D1F83C2DD /* Fixtures.swift in Sources */,\n\t\t\t\t19A17B62A4125AF4F6014CF5 /* SchemaDefinitionsTests.swift in Sources */,\n\t\t\t\t19A17FC04708C6ED637DDFD4 /* SchemaChangerTests.swift in Sources */,\n\t\t\t\t19A17188B4D96636F9C0C209 /* Connection+SchemaTests.swift in Sources */,\n\t\t\t\t19A17FACE8E4D54A50BA934E /* FTS5Tests.swift in Sources */,\n\t\t\t\t19A177909023B7B940C5805E /* FTS5IntegrationTests.swift in Sources */,\n\t\t\t\t19A17E1DD976D5CE80018749 /* FTS4Tests.swift in Sources */,\n\t\t\t\tDBB93D5C2A22A373009BB96E /* SchemaReaderTests.swift in Sources */,\n\t\t\t\t19A17411403D60640467209E /* ExpressionTests.swift in Sources */,\n\t\t\t\t19A17CA4D7B63D845428A9C5 /* StatementTests.swift in Sources */,\n\t\t\t\t19A17885B646CB0201BE4BD5 /* QueryTests.swift in Sources */,\n\t\t\t\t19A1708D3D58D7BC1168E55F /* CipherTests.swift in Sources */,\n\t\t\t\t19A178C041DDCF80B533AD13 /* BlobTests.swift in Sources */,\n\t\t\t\t19A17021286A4D8D6C2EF12D /* ConnectionTests.swift in Sources */,\n\t\t\t\t19A17DE34C477232592A8F6B /* CoreFunctionsTests.swift in Sources */,\n\t\t\t\t19A1799AF6643CF5081BFA15 /* DateAndTimeFunctionTests.swift in Sources */,\n\t\t\t\t19A17457B0461F484AF6BE40 /* CustomFunctionsTests.swift in Sources */,\n\t\t\t\t19A17900387FDCF578B31E3E /* OperatorsTests.swift in Sources */,\n\t\t\t\t19A17C74233AFC2EDAFA23DC /* ResultTests.swift in Sources */,\n\t\t\t\t19A17A9520802ACF45907970 /* RTreeTests.swift in Sources */,\n\t\t\t\t19A17A391BF056E3D729E70A /* SchemaTests.swift in Sources */,\n\t\t\t\t19A17746150A815944A6820B /* SelectTests.swift in Sources */,\n\t\t\t\t19A1766135CE9786B1878603 /* ValueTests.swift in Sources */,\n\t\t\t\t19A177D5C6542E2D572162E5 /* QueryIntegrationTests.swift in Sources */,\n\t\t\t\t64B8E1722B09748000545AFB /* WindowFunctionsTests.swift in Sources */,\n\t\t\t\t19A178DF5A96CFEFF1E271F6 /* AggregateFunctionsTests.swift in Sources */,\n\t\t\t\t19A17437659BD7FD787D94A6 /* CustomAggregationTests.swift in Sources */,\n\t\t\t\t19A17F907258E524B3CA2FAE /* SetterTests.swift in Sources */,\n\t\t\t\t19A17ABCF0EB4808BDC5B5FF /* RowTests.swift in Sources */,\n\t\t\t\t19A17BACF4C032513DE1F879 /* Connection+PragmaTests.swift in Sources */,\n\t\t\t\t19A173F25449876761347072 /* Connection+AttachTests.swift in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tA121AC401CA35C79005A31D1 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t3DF7B78B28842972005DD8CA /* Connection+Attach.swift in Sources */,\n\t\t\t\t49EB68C71F7B3CB400D89D40 /* Coding.swift in Sources */,\n\t\t\t\t997DF2B1287FC06D00F8DF95 /* Query+with.swift in Sources */,\n\t\t\t\t3D67B3F71DB246D700A4F4C6 /* Foundation.swift in Sources */,\n\t\t\t\t3D67B3F81DB246D700A4F4C6 /* Helpers.swift in Sources */,\n\t\t\t\tDB58B21428FB864300F8EEA4 /* SchemaReader.swift in Sources */,\n\t\t\t\t3D67B3E91DB246D100A4F4C6 /* Statement.swift in Sources */,\n\t\t\t\tDB7C5DA928D7C9B6006395CF /* SQLiteVersion.swift in Sources */,\n\t\t\t\t3D67B3EA1DB246D100A4F4C6 /* Value.swift in Sources */,\n\t\t\t\t3D67B3EB1DB246D100A4F4C6 /* FTS4.swift in Sources */,\n\t\t\t\tDB58B21928FC7C4600F8EEA4 /* SQLiteFeature.swift in Sources */,\n\t\t\t\t3D67B3EC1DB246D100A4F4C6 /* RTree.swift in Sources */,\n\t\t\t\t3D67B3ED1DB246D100A4F4C6 /* FTS5.swift in Sources */,\n\t\t\t\t3D67B3EE1DB246D100A4F4C6 /* AggregateFunctions.swift in Sources */,\n\t\t\t\t3D67B3EF1DB246D100A4F4C6 /* Collation.swift in Sources */,\n\t\t\t\t3D67B3F01DB246D100A4F4C6 /* CoreFunctions.swift in Sources */,\n\t\t\t\t3D67B3F11DB246D100A4F4C6 /* CustomFunctions.swift in Sources */,\n\t\t\t\t3D67B3F21DB246D100A4F4C6 /* Expression.swift in Sources */,\n\t\t\t\t3D67B3F31DB246D100A4F4C6 /* Operators.swift in Sources */,\n\t\t\t\t3DF7B794288449BA005DD8CA /* URIQueryParameter.swift in Sources */,\n\t\t\t\t3D67B3F41DB246D100A4F4C6 /* Query.swift in Sources */,\n\t\t\t\t3D67B3F51DB246D100A4F4C6 /* Schema.swift in Sources */,\n\t\t\t\t3D67B3F61DB246D100A4F4C6 /* Setter.swift in Sources */,\n\t\t\t\t3D67B3E71DB246BA00A4F4C6 /* Blob.swift in Sources */,\n\t\t\t\t3D67B3E81DB246BA00A4F4C6 /* Connection.swift in Sources */,\n\t\t\t\t19A179CCF9671E345E5A9811 /* Cipher.swift in Sources */,\n\t\t\t\t02A43A9B22738CF100FEC494 /* Backup.swift in Sources */,\n\t\t\t\t19A17DC282E36C4F41AA440B /* Errors.swift in Sources */,\n\t\t\t\t19A173668D948AD4DF1F5352 /* DateAndTimeFunctions.swift in Sources */,\n\t\t\t\t19A17DF8D4F13A20F5D2269E /* Result.swift in Sources */,\n\t\t\t\t64A8EE462B095FBB00F583F7 /* WindowFunctions.swift in Sources */,\n\t\t\t\t19A17DFE05ED8B1F7C45F7EE /* SchemaChanger.swift in Sources */,\n\t\t\t\t19A17D1BEABA610ABF003D67 /* SchemaDefinitions.swift in Sources */,\n\t\t\t\t19A17A33EA026C2E2CEBAF36 /* Connection+Schema.swift in Sources */,\n\t\t\t\t19A178A8B2A34FB6B565DEDA /* Connection+Pragmas.swift in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tDEB306BB2B61CEF500F9D46B /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tDEB306BC2B61CEF500F9D46B /* CoreFunctions.swift in Sources */,\n\t\t\t\tDEB306BD2B61CEF500F9D46B /* Coding.swift in Sources */,\n\t\t\t\tDEB306BE2B61CEF500F9D46B /* RTree.swift in Sources */,\n\t\t\t\tDEB306BF2B61CEF500F9D46B /* Blob.swift in Sources */,\n\t\t\t\tDEB306C02B61CEF500F9D46B /* URIQueryParameter.swift in Sources */,\n\t\t\t\tDEB306C12B61CEF500F9D46B /* Foundation.swift in Sources */,\n\t\t\t\tDEB306C22B61CEF500F9D46B /* Connection.swift in Sources */,\n\t\t\t\tDEB306C32B61CEF500F9D46B /* Expression.swift in Sources */,\n\t\t\t\tDEB306C42B61CEF500F9D46B /* Helpers.swift in Sources */,\n\t\t\t\tDEB306C52B61CEF500F9D46B /* Collation.swift in Sources */,\n\t\t\t\tDEB306C62B61CEF500F9D46B /* Setter.swift in Sources */,\n\t\t\t\tDEB306C72B61CEF500F9D46B /* Connection+Attach.swift in Sources */,\n\t\t\t\tDEB306C82B61CEF500F9D46B /* CustomFunctions.swift in Sources */,\n\t\t\t\tDEB306C92B61CEF500F9D46B /* FTS4.swift in Sources */,\n\t\t\t\tDEB306CA2B61CEF500F9D46B /* Value.swift in Sources */,\n\t\t\t\tDEB306CB2B61CEF500F9D46B /* Operators.swift in Sources */,\n\t\t\t\tDEB306CC2B61CEF500F9D46B /* Schema.swift in Sources */,\n\t\t\t\tDEB306CD2B61CEF500F9D46B /* Query.swift in Sources */,\n\t\t\t\tDEB306CE2B61CEF500F9D46B /* Statement.swift in Sources */,\n\t\t\t\tDEB306CF2B61CEF500F9D46B /* AggregateFunctions.swift in Sources */,\n\t\t\t\tDEB306D02B61CEF500F9D46B /* FTS5.swift in Sources */,\n\t\t\t\tDEB306D12B61CEF500F9D46B /* Cipher.swift in Sources */,\n\t\t\t\tDEB306D22B61CEF500F9D46B /* Backup.swift in Sources */,\n\t\t\t\tDEB306D32B61CEF500F9D46B /* Errors.swift in Sources */,\n\t\t\t\tDEB306D42B61CEF500F9D46B /* DateAndTimeFunctions.swift in Sources */,\n\t\t\t\tDEB306D52B61CEF500F9D46B /* SQLiteVersion.swift in Sources */,\n\t\t\t\tDEB306D62B61CEF500F9D46B /* Result.swift in Sources */,\n\t\t\t\tDEB306D72B61CEF500F9D46B /* Query+with.swift in Sources */,\n\t\t\t\tDEB306D82B61CEF500F9D46B /* Connection+Aggregation.swift in Sources */,\n\t\t\t\tDEB306D92B61CEF500F9D46B /* SQLiteFeature.swift in Sources */,\n\t\t\t\tDEB306DA2B61CEF500F9D46B /* SchemaChanger.swift in Sources */,\n\t\t\t\tDEB306DB2B61CEF500F9D46B /* SchemaDefinitions.swift in Sources */,\n\t\t\t\tDEB306DC2B61CEF500F9D46B /* Connection+Schema.swift in Sources */,\n\t\t\t\tDEB306DD2B61CEF500F9D46B /* Connection+Pragmas.swift in Sources */,\n\t\t\t\tDEB306DE2B61CEF500F9D46B /* SchemaReader.swift in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tDEB306EA2B61CF9500F9D46B /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tDEB306EB2B61CF9500F9D46B /* TestHelpers.swift in Sources */,\n\t\t\t\tDEB306EC2B61CF9500F9D46B /* FoundationTests.swift in Sources */,\n\t\t\t\tDEB306ED2B61CF9500F9D46B /* Fixtures.swift in Sources */,\n\t\t\t\tDEB306EE2B61CF9500F9D46B /* SchemaDefinitionsTests.swift in Sources */,\n\t\t\t\tDEB306EF2B61CF9500F9D46B /* SchemaChangerTests.swift in Sources */,\n\t\t\t\tDEB306F02B61CF9500F9D46B /* Connection+SchemaTests.swift in Sources */,\n\t\t\t\tDEB306F12B61CF9500F9D46B /* FTS5Tests.swift in Sources */,\n\t\t\t\tDEB306F22B61CF9500F9D46B /* FTS5IntegrationTests.swift in Sources */,\n\t\t\t\tDEB306F32B61CF9500F9D46B /* FTS4Tests.swift in Sources */,\n\t\t\t\tDEB306F42B61CF9500F9D46B /* ExpressionTests.swift in Sources */,\n\t\t\t\tDEB306F52B61CF9500F9D46B /* StatementTests.swift in Sources */,\n\t\t\t\tDEB306F62B61CF9500F9D46B /* QueryTests.swift in Sources */,\n\t\t\t\tDEB306F72B61CF9500F9D46B /* CipherTests.swift in Sources */,\n\t\t\t\tDEB306F82B61CF9500F9D46B /* BlobTests.swift in Sources */,\n\t\t\t\tDEB306F92B61CF9500F9D46B /* ConnectionTests.swift in Sources */,\n\t\t\t\tDEB306FA2B61CF9500F9D46B /* CoreFunctionsTests.swift in Sources */,\n\t\t\t\tDEB306FB2B61CF9500F9D46B /* DateAndTimeFunctionTests.swift in Sources */,\n\t\t\t\tDEB306FC2B61CF9500F9D46B /* CustomFunctionsTests.swift in Sources */,\n\t\t\t\tDEB306FD2B61CF9500F9D46B /* OperatorsTests.swift in Sources */,\n\t\t\t\tDEB306FE2B61CF9500F9D46B /* ResultTests.swift in Sources */,\n\t\t\t\tDEB306FF2B61CF9500F9D46B /* RTreeTests.swift in Sources */,\n\t\t\t\tDEB307002B61CF9500F9D46B /* SchemaTests.swift in Sources */,\n\t\t\t\tDEB307012B61CF9500F9D46B /* SelectTests.swift in Sources */,\n\t\t\t\tDEB307022B61CF9500F9D46B /* ValueTests.swift in Sources */,\n\t\t\t\tDEB307032B61CF9500F9D46B /* QueryIntegrationTests.swift in Sources */,\n\t\t\t\tDEB307042B61CF9500F9D46B /* AggregateFunctionsTests.swift in Sources */,\n\t\t\t\tDEB307052B61CF9500F9D46B /* CustomAggregationTests.swift in Sources */,\n\t\t\t\tDEB307062B61CF9500F9D46B /* SetterTests.swift in Sources */,\n\t\t\t\tDEB307072B61CF9500F9D46B /* RowTests.swift in Sources */,\n\t\t\t\tDEB307082B61CF9500F9D46B /* Connection+PragmaTests.swift in Sources */,\n\t\t\t\tDEB307092B61CF9500F9D46B /* Connection+AttachTests.swift in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tEE247ACE1C3F04ED00AE3E12 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tEE247B0F1C3F06E900AE3E12 /* CoreFunctions.swift in Sources */,\n\t\t\t\t49EB68C41F7B3CB400D89D40 /* Coding.swift in Sources */,\n\t\t\t\tEE247B0A1C3F06E900AE3E12 /* RTree.swift in Sources */,\n\t\t\t\tEE247B031C3F06E900AE3E12 /* Blob.swift in Sources */,\n\t\t\t\t3DF7B791288449BA005DD8CA /* URIQueryParameter.swift in Sources */,\n\t\t\t\tEE247B0B1C3F06E900AE3E12 /* Foundation.swift in Sources */,\n\t\t\t\tEE247B041C3F06E900AE3E12 /* Connection.swift in Sources */,\n\t\t\t\tEE247B111C3F06E900AE3E12 /* Expression.swift in Sources */,\n\t\t\t\tEE247B0C1C3F06E900AE3E12 /* Helpers.swift in Sources */,\n\t\t\t\tEE247B0E1C3F06E900AE3E12 /* Collation.swift in Sources */,\n\t\t\t\tEE247B151C3F06E900AE3E12 /* Setter.swift in Sources */,\n\t\t\t\t3DF7B78828842972005DD8CA /* Connection+Attach.swift in Sources */,\n\t\t\t\tEE247B101C3F06E900AE3E12 /* CustomFunctions.swift in Sources */,\n\t\t\t\t64A8EE432B095FBB00F583F7 /* WindowFunctions.swift in Sources */,\n\t\t\t\tEE247B091C3F06E900AE3E12 /* FTS4.swift in Sources */,\n\t\t\t\tEE247B081C3F06E900AE3E12 /* Value.swift in Sources */,\n\t\t\t\tEE247B121C3F06E900AE3E12 /* Operators.swift in Sources */,\n\t\t\t\tEE247B141C3F06E900AE3E12 /* Schema.swift in Sources */,\n\t\t\t\tEE247B131C3F06E900AE3E12 /* Query.swift in Sources */,\n\t\t\t\tEE247B071C3F06E900AE3E12 /* Statement.swift in Sources */,\n\t\t\t\tEE247B0D1C3F06E900AE3E12 /* AggregateFunctions.swift in Sources */,\n\t\t\t\t19A1717B10CC941ACB5533D6 /* FTS5.swift in Sources */,\n\t\t\t\t19A171F12AB8B07F2FD7201A /* Cipher.swift in Sources */,\n\t\t\t\t02A43A9822738CF100FEC494 /* Backup.swift in Sources */,\n\t\t\t\t19A1792C0520D4E83C2EB075 /* Errors.swift in Sources */,\n\t\t\t\t19A17E29278A12BC4F542506 /* DateAndTimeFunctions.swift in Sources */,\n\t\t\t\tDB7C5DA628D7C9B6006395CF /* SQLiteVersion.swift in Sources */,\n\t\t\t\t19A173EFEF0B3BD0B3ED406C /* Result.swift in Sources */,\n\t\t\t\t997DF2AE287FC06D00F8DF95 /* Query+with.swift in Sources */,\n\t\t\t\t19A176376CB6A94759F7980A /* Connection+Aggregation.swift in Sources */,\n\t\t\t\tDB58B21628FC7C4600F8EEA4 /* SQLiteFeature.swift in Sources */,\n\t\t\t\t19A1773A335CAB9D0AE14E8E /* SchemaChanger.swift in Sources */,\n\t\t\t\t19A17BA13FD35F058787B7D3 /* SchemaDefinitions.swift in Sources */,\n\t\t\t\t19A174506543905D71BF0518 /* Connection+Schema.swift in Sources */,\n\t\t\t\t19A17018F250343BD0F9F4B0 /* Connection+Pragmas.swift in Sources */,\n\t\t\t\tDB58B21128FB864300F8EEA4 /* SchemaReader.swift in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tEE247AD91C3F04ED00AE3E12 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tEE247B171C3F127200AE3E12 /* TestHelpers.swift in Sources */,\n\t\t\t\t19A17FB80B94E882050AA908 /* FoundationTests.swift in Sources */,\n\t\t\t\t19A17408007B182F884E3A53 /* Fixtures.swift in Sources */,\n\t\t\t\t19A17FE78A39E86F330420EC /* SchemaDefinitionsTests.swift in Sources */,\n\t\t\t\t19A177C25834473FAB32CF3B /* SchemaChangerTests.swift in Sources */,\n\t\t\t\t19A1725658E480B9B378F28B /* Connection+SchemaTests.swift in Sources */,\n\t\t\t\t19A178DA2BB5970778CCAF13 /* FTS5Tests.swift in Sources */,\n\t\t\t\t19A1755C49154C87304C9146 /* FTS5IntegrationTests.swift in Sources */,\n\t\t\t\t19A17444861E1443143DEB44 /* FTS4Tests.swift in Sources */,\n\t\t\t\tDBB93D5A2A22A373009BB96E /* SchemaReaderTests.swift in Sources */,\n\t\t\t\t19A17DD33C2E43DD6EE05A60 /* ExpressionTests.swift in Sources */,\n\t\t\t\t19A17D6EC40BC35A5DC81BA8 /* StatementTests.swift in Sources */,\n\t\t\t\t19A17E3F47DA087E2B76D087 /* QueryTests.swift in Sources */,\n\t\t\t\t19A17A7B3E3B7E76364A2AEE /* CipherTests.swift in Sources */,\n\t\t\t\t19A1782444437C7FC6B75CBC /* BlobTests.swift in Sources */,\n\t\t\t\t19A17CF65C0196E03BC64519 /* ConnectionTests.swift in Sources */,\n\t\t\t\t19A179BB9A6665B2B99DA546 /* CoreFunctionsTests.swift in Sources */,\n\t\t\t\t19A174118D11B93DA5DAAF79 /* DateAndTimeFunctionTests.swift in Sources */,\n\t\t\t\t19A17A7DF99B0379FD3396B1 /* CustomFunctionsTests.swift in Sources */,\n\t\t\t\t19A171F243A589C5EBC47937 /* OperatorsTests.swift in Sources */,\n\t\t\t\t19A173F429D7E46289EB2167 /* ResultTests.swift in Sources */,\n\t\t\t\t19A17B1D9B5CEBE9CE09280C /* RTreeTests.swift in Sources */,\n\t\t\t\t19A172F71EFD65342072D8D2 /* SchemaTests.swift in Sources */,\n\t\t\t\t19A17F7977364EC8CD33C3C3 /* SelectTests.swift in Sources */,\n\t\t\t\t19A17FD22EF43DF428DD93BA /* ValueTests.swift in Sources */,\n\t\t\t\t19A177AA5922527BBDC77CF9 /* QueryIntegrationTests.swift in Sources */,\n\t\t\t\t64B8E1702B09748000545AFB /* WindowFunctionsTests.swift in Sources */,\n\t\t\t\t19A179786A6826D58A70F8BC /* AggregateFunctionsTests.swift in Sources */,\n\t\t\t\t19A1793972BDDDB027C113BB /* CustomAggregationTests.swift in Sources */,\n\t\t\t\t19A1773155AC2BF2CA86A473 /* SetterTests.swift in Sources */,\n\t\t\t\t19A176B3316281F004F92276 /* RowTests.swift in Sources */,\n\t\t\t\t19A17FBAA26953EB854E790D /* Connection+PragmaTests.swift in Sources */,\n\t\t\t\t19A17026DCDCDA405B09A229 /* Connection+AttachTests.swift in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tEE247B371C3F3ED000AE3E12 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tEE247B6F1C3F3FEC00AE3E12 /* CoreFunctions.swift in Sources */,\n\t\t\t\t49EB68C51F7B3CB400D89D40 /* Coding.swift in Sources */,\n\t\t\t\tEE247B651C3F3FEC00AE3E12 /* Blob.swift in Sources */,\n\t\t\t\tEE247B6C1C3F3FEC00AE3E12 /* RTree.swift in Sources */,\n\t\t\t\t3DF7B792288449BA005DD8CA /* URIQueryParameter.swift in Sources */,\n\t\t\t\tEE247B6A1C3F3FEC00AE3E12 /* Value.swift in Sources */,\n\t\t\t\tEE247B711C3F3FEC00AE3E12 /* Expression.swift in Sources */,\n\t\t\t\tEE247B631C3F3FDB00AE3E12 /* Foundation.swift in Sources */,\n\t\t\t\tEE247B6E1C3F3FEC00AE3E12 /* Collation.swift in Sources */,\n\t\t\t\tEE247B751C3F3FEC00AE3E12 /* Setter.swift in Sources */,\n\t\t\t\t3DF7B78928842972005DD8CA /* Connection+Attach.swift in Sources */,\n\t\t\t\tEE247B701C3F3FEC00AE3E12 /* CustomFunctions.swift in Sources */,\n\t\t\t\tEE247B691C3F3FEC00AE3E12 /* Statement.swift in Sources */,\n\t\t\t\t64A8EE442B095FBB00F583F7 /* WindowFunctions.swift in Sources */,\n\t\t\t\tEE247B641C3F3FDB00AE3E12 /* Helpers.swift in Sources */,\n\t\t\t\tEE247B721C3F3FEC00AE3E12 /* Operators.swift in Sources */,\n\t\t\t\tEE247B741C3F3FEC00AE3E12 /* Schema.swift in Sources */,\n\t\t\t\tEE247B731C3F3FEC00AE3E12 /* Query.swift in Sources */,\n\t\t\t\tEE247B6B1C3F3FEC00AE3E12 /* FTS4.swift in Sources */,\n\t\t\t\tEE247B661C3F3FEC00AE3E12 /* Connection.swift in Sources */,\n\t\t\t\tEE247B6D1C3F3FEC00AE3E12 /* AggregateFunctions.swift in Sources */,\n\t\t\t\t19A1750CEE9B05267995CF3D /* FTS5.swift in Sources */,\n\t\t\t\t19A17835FD5886FDC5A3228F /* Cipher.swift in Sources */,\n\t\t\t\t02A43A9922738CF100FEC494 /* Backup.swift in Sources */,\n\t\t\t\t19A17490543609FCED53CACC /* Errors.swift in Sources */,\n\t\t\t\t19A17152E32A9585831E3FE0 /* DateAndTimeFunctions.swift in Sources */,\n\t\t\t\tDB7C5DA728D7C9B6006395CF /* SQLiteVersion.swift in Sources */,\n\t\t\t\t19A17F1B3F0A3C96B5ED6D64 /* Result.swift in Sources */,\n\t\t\t\t997DF2AF287FC06D00F8DF95 /* Query+with.swift in Sources */,\n\t\t\t\t19A170ACC97B19730FB7BA4D /* Connection+Aggregation.swift in Sources */,\n\t\t\t\tDB58B21728FC7C4600F8EEA4 /* SQLiteFeature.swift in Sources */,\n\t\t\t\t19A177290558991BCC60E4E3 /* SchemaChanger.swift in Sources */,\n\t\t\t\t19A17B0DF1DDB6BBC9C95D64 /* SchemaDefinitions.swift in Sources */,\n\t\t\t\t19A17F0BF02896E1664F4090 /* Connection+Schema.swift in Sources */,\n\t\t\t\t19A1760CE25615CA015E2E5F /* Connection+Pragmas.swift in Sources */,\n\t\t\t\tDB58B21228FB864300F8EEA4 /* SchemaReader.swift in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tEE247B411C3F3ED000AE3E12 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tEE247B611C3F3FC700AE3E12 /* TestHelpers.swift in Sources */,\n\t\t\t\t19A178072B371489E6A1E839 /* FoundationTests.swift in Sources */,\n\t\t\t\t19A1709C3E7A406E62293B2A /* Fixtures.swift in Sources */,\n\t\t\t\t19A17E80F736EEE8EE2AA4CE /* SchemaDefinitionsTests.swift in Sources */,\n\t\t\t\t19A1766AC10D13C4EFF349AD /* SchemaChangerTests.swift in Sources */,\n\t\t\t\t19A17B36ABC6006AB80F693C /* Connection+SchemaTests.swift in Sources */,\n\t\t\t\t19A1776BD5127DFDF847FF1F /* FTS5Tests.swift in Sources */,\n\t\t\t\t19A173088B85A7E18E8582A7 /* FTS5IntegrationTests.swift in Sources */,\n\t\t\t\t19A178767223229E61C5066F /* FTS4Tests.swift in Sources */,\n\t\t\t\tDBB93D5B2A22A373009BB96E /* SchemaReaderTests.swift in Sources */,\n\t\t\t\t19A1781CBA8968ABD3E00877 /* ExpressionTests.swift in Sources */,\n\t\t\t\t19A17923494236793893BF72 /* StatementTests.swift in Sources */,\n\t\t\t\t19A17A52BF29D27C9AA229E7 /* QueryTests.swift in Sources */,\n\t\t\t\t19A17CA6ADB78A2E545BF836 /* CipherTests.swift in Sources */,\n\t\t\t\t19A1714F7CF964D568AB14E0 /* BlobTests.swift in Sources */,\n\t\t\t\t19A173465F23C64DF3DF469B /* ConnectionTests.swift in Sources */,\n\t\t\t\t19A17D993398B8215B73E1EA /* CoreFunctionsTests.swift in Sources */,\n\t\t\t\t19A170AEBAA56DC3355A73B3 /* DateAndTimeFunctionTests.swift in Sources */,\n\t\t\t\t19A1716BF8E15F91A6B5CB7A /* CustomFunctionsTests.swift in Sources */,\n\t\t\t\t19A17482E6FC5E563F3E6A47 /* OperatorsTests.swift in Sources */,\n\t\t\t\t19A17912DB9D3AC8FECF948B /* ResultTests.swift in Sources */,\n\t\t\t\t19A17DAD5975D9367EAA46E2 /* RTreeTests.swift in Sources */,\n\t\t\t\t19A17F2096E83A3181E03317 /* SchemaTests.swift in Sources */,\n\t\t\t\t19A17DE1FCDB5695702AD24D /* SelectTests.swift in Sources */,\n\t\t\t\t19A1726002D24C14F876C8FE /* ValueTests.swift in Sources */,\n\t\t\t\t19A173389E53CB24DFA8CEDD /* QueryIntegrationTests.swift in Sources */,\n\t\t\t\t64B8E1712B09748000545AFB /* WindowFunctionsTests.swift in Sources */,\n\t\t\t\t19A170C56745F9D722A73D77 /* AggregateFunctionsTests.swift in Sources */,\n\t\t\t\t19A1772EBE65173EDFB1AFCA /* CustomAggregationTests.swift in Sources */,\n\t\t\t\t19A17E0ABA6C415F014CD51C /* SetterTests.swift in Sources */,\n\t\t\t\t19A170D938343E30119EDFB3 /* RowTests.swift in Sources */,\n\t\t\t\t19A178F9008614B8A8425635 /* Connection+PragmaTests.swift in Sources */,\n\t\t\t\t19A179BCD483DEA21661FD37 /* Connection+AttachTests.swift in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXSourcesBuildPhase section */\n\n/* Begin PBXTargetDependency section */\n\t\t03A65E661C6BB0F60062603F /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\ttarget = 03A65E591C6BB0F50062603F /* SQLite tvOS */;\n\t\t\ttargetProxy = 03A65E651C6BB0F60062603F /* PBXContainerItemProxy */;\n\t\t};\n\t\tDEB307152B61D07F00F9D46B /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\ttarget = DEB306B82B61CEF500F9D46B /* SQLite visionOS */;\n\t\t\ttargetProxy = DEB307142B61D07F00F9D46B /* PBXContainerItemProxy */;\n\t\t};\n\t\tEE247AE01C3F04ED00AE3E12 /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\ttarget = EE247AD21C3F04ED00AE3E12 /* SQLite iOS */;\n\t\t\ttargetProxy = EE247ADF1C3F04ED00AE3E12 /* PBXContainerItemProxy */;\n\t\t};\n\t\tEE247B481C3F3ED000AE3E12 /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\ttarget = EE247B3B1C3F3ED000AE3E12 /* SQLite Mac */;\n\t\t\ttargetProxy = EE247B471C3F3ED000AE3E12 /* PBXContainerItemProxy */;\n\t\t};\n/* End PBXTargetDependency section */\n\n/* Begin XCBuildConfiguration section */\n\t\t03A65E6B1C6BB0F60062603F /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tAPPLICATION_EXTENSION_API_ONLY = YES;\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_TREAT_WARNINGS_AS_ERRORS = YES;\n\t\t\t\tINFOPLIST_FILE = \"$(SRCROOT)/Sources/SQLite/Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks @loader_path/Frameworks\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = com.stephencelis.SQLite;\n\t\t\t\tPRODUCT_NAME = SQLite;\n\t\t\t\tSDKROOT = appletvos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_TREAT_WARNINGS_AS_ERRORS = YES;\n\t\t\t\tTVOS_DEPLOYMENT_TARGET = 12.0;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t03A65E6C1C6BB0F60062603F /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tAPPLICATION_EXTENSION_API_ONLY = YES;\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_TREAT_WARNINGS_AS_ERRORS = YES;\n\t\t\t\tINFOPLIST_FILE = \"$(SRCROOT)/Sources/SQLite/Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks @loader_path/Frameworks\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = com.stephencelis.SQLite;\n\t\t\t\tPRODUCT_NAME = SQLite;\n\t\t\t\tSDKROOT = appletvos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_TREAT_WARNINGS_AS_ERRORS = YES;\n\t\t\t\tTVOS_DEPLOYMENT_TARGET = 12.0;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t03A65E6D1C6BB0F60062603F /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tGCC_TREAT_WARNINGS_AS_ERRORS = YES;\n\t\t\t\tINFOPLIST_FILE = Tests/SQLiteTests/Info.plist;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks @loader_path/Frameworks\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = com.stephencelis.SQLiteTests;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSDKROOT = appletvos;\n\t\t\t\tSWIFT_TREAT_WARNINGS_AS_ERRORS = YES;\n\t\t\t\tTVOS_DEPLOYMENT_TARGET = 12.0;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t03A65E6E1C6BB0F60062603F /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tGCC_TREAT_WARNINGS_AS_ERRORS = YES;\n\t\t\t\tINFOPLIST_FILE = Tests/SQLiteTests/Info.plist;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks @loader_path/Frameworks\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = com.stephencelis.SQLiteTests;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSDKROOT = appletvos;\n\t\t\t\tSWIFT_TREAT_WARNINGS_AS_ERRORS = YES;\n\t\t\t\tTVOS_DEPLOYMENT_TARGET = 12.0;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\tA121AC4A1CA35C79005A31D1 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tAPPLICATION_EXTENSION_API_ONLY = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_TREAT_WARNINGS_AS_ERRORS = YES;\n\t\t\t\tINFOPLIST_FILE = \"$(SRCROOT)/Sources/SQLite/Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks @loader_path/Frameworks\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = com.stephencelis.SQLite;\n\t\t\t\tPRODUCT_NAME = SQLite;\n\t\t\t\tSDKROOT = watchos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_TREAT_WARNINGS_AS_ERRORS = YES;\n\t\t\t\tTARGETED_DEVICE_FAMILY = 4;\n\t\t\t\tWATCHOS_DEPLOYMENT_TARGET = 4.0;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tA121AC4B1CA35C79005A31D1 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tAPPLICATION_EXTENSION_API_ONLY = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_TREAT_WARNINGS_AS_ERRORS = YES;\n\t\t\t\tINFOPLIST_FILE = \"$(SRCROOT)/Sources/SQLite/Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks @loader_path/Frameworks\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = com.stephencelis.SQLite;\n\t\t\t\tPRODUCT_NAME = SQLite;\n\t\t\t\tSDKROOT = watchos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_TREAT_WARNINGS_AS_ERRORS = YES;\n\t\t\t\tTARGETED_DEVICE_FAMILY = 4;\n\t\t\t\tWATCHOS_DEPLOYMENT_TARGET = 4.0;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\tDEB306E32B61CEF500F9D46B /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tAPPLICATION_EXTENSION_API_ONLY = YES;\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_TREAT_WARNINGS_AS_ERRORS = YES;\n\t\t\t\tINFOPLIST_FILE = \"$(SRCROOT)/Sources/SQLite/Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks @loader_path/Frameworks\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = com.stephencelis.SQLite;\n\t\t\t\tPRODUCT_NAME = SQLite;\n\t\t\t\tSDKROOT = xros;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Onone\";\n\t\t\t\tSWIFT_TREAT_WARNINGS_AS_ERRORS = YES;\n\t\t\t\tTARGETED_DEVICE_FAMILY = 7;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tDEB306E42B61CEF500F9D46B /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tAPPLICATION_EXTENSION_API_ONLY = YES;\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_TREAT_WARNINGS_AS_ERRORS = YES;\n\t\t\t\tINFOPLIST_FILE = \"$(SRCROOT)/Sources/SQLite/Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks @loader_path/Frameworks\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = com.stephencelis.SQLite;\n\t\t\t\tPRODUCT_NAME = SQLite;\n\t\t\t\tSDKROOT = xros;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_TREAT_WARNINGS_AS_ERRORS = YES;\n\t\t\t\tTARGETED_DEVICE_FAMILY = 7;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\tDEB3070F2B61CF9500F9D46B /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tGCC_TREAT_WARNINGS_AS_ERRORS = YES;\n\t\t\t\tINFOPLIST_FILE = Tests/SQLiteTests/Info.plist;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks @loader_path/Frameworks\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = com.stephencelis.SQLiteTests;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSDKROOT = xros;\n\t\t\t\tSWIFT_TREAT_WARNINGS_AS_ERRORS = YES;\n\t\t\t\tTARGETED_DEVICE_FAMILY = 7;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tDEB307102B61CF9500F9D46B /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tGCC_TREAT_WARNINGS_AS_ERRORS = YES;\n\t\t\t\tINFOPLIST_FILE = Tests/SQLiteTests/Info.plist;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks @loader_path/Frameworks\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = com.stephencelis.SQLiteTests;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSDKROOT = xros;\n\t\t\t\tSWIFT_TREAT_WARNINGS_AS_ERRORS = YES;\n\t\t\t\tTARGETED_DEVICE_FAMILY = 7;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\tEE247AE51C3F04ED00AE3E12 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++0x\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"iPhone Developer\";\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = dwarf;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tENABLE_TESTABILITY = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu99;\n\t\t\t\tGCC_DYNAMIC_NO_PIC = NO;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 13.0;\n\t\t\t\tMACOSX_DEPLOYMENT_TARGET = 10.13;\n\t\t\t\tMARKETING_VERSION = 0.16.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = YES;\n\t\t\t\tONLY_ACTIVE_ARCH = YES;\n\t\t\t\tPRODUCT_NAME = \"\";\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Onone\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2,3\";\n\t\t\t\tTVOS_DEPLOYMENT_TARGET = 12.0;\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t\tWATCHOS_DEPLOYMENT_TARGET = 4.0;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tEE247AE61C3F04ED00AE3E12 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++0x\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"iPhone Developer\";\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\n\t\t\t\tENABLE_NS_ASSERTIONS = NO;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu99;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 13.0;\n\t\t\t\tMACOSX_DEPLOYMENT_TARGET = 10.13;\n\t\t\t\tMARKETING_VERSION = 0.16.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = NO;\n\t\t\t\tPRODUCT_NAME = \"\";\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Owholemodule\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2,3\";\n\t\t\t\tTVOS_DEPLOYMENT_TARGET = 12.0;\n\t\t\t\tVALIDATE_PRODUCT = YES;\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t\tWATCHOS_DEPLOYMENT_TARGET = 4.0;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\tEE247AE81C3F04ED00AE3E12 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tAPPLICATION_EXTENSION_API_ONLY = YES;\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_TREAT_WARNINGS_AS_ERRORS = YES;\n\t\t\t\tINFOPLIST_FILE = \"$(SRCROOT)/Sources/SQLite/Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 12.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks @loader_path/Frameworks\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = com.stephencelis.SQLite;\n\t\t\t\tPRODUCT_NAME = SQLite;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Onone\";\n\t\t\t\tSWIFT_TREAT_WARNINGS_AS_ERRORS = YES;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tEE247AE91C3F04ED00AE3E12 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tAPPLICATION_EXTENSION_API_ONLY = YES;\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_TREAT_WARNINGS_AS_ERRORS = YES;\n\t\t\t\tINFOPLIST_FILE = \"$(SRCROOT)/Sources/SQLite/Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 12.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks @loader_path/Frameworks\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = com.stephencelis.SQLite;\n\t\t\t\tPRODUCT_NAME = SQLite;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_TREAT_WARNINGS_AS_ERRORS = YES;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\tEE247AEB1C3F04ED00AE3E12 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tGCC_TREAT_WARNINGS_AS_ERRORS = YES;\n\t\t\t\tINFOPLIST_FILE = Tests/SQLiteTests/Info.plist;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 12.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks @loader_path/Frameworks\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = com.stephencelis.SQLiteTests;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSWIFT_TREAT_WARNINGS_AS_ERRORS = YES;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tEE247AEC1C3F04ED00AE3E12 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tGCC_TREAT_WARNINGS_AS_ERRORS = YES;\n\t\t\t\tINFOPLIST_FILE = Tests/SQLiteTests/Info.plist;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 12.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks @loader_path/Frameworks\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = com.stephencelis.SQLiteTests;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSWIFT_TREAT_WARNINGS_AS_ERRORS = YES;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\tEE247B4D1C3F3ED000AE3E12 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tAPPLICATION_EXTENSION_API_ONLY = YES;\n\t\t\t\tCODE_SIGN_IDENTITY = \"\";\n\t\t\t\tCOMBINE_HIDPI_IMAGES = YES;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tFRAMEWORK_VERSION = A;\n\t\t\t\tGCC_TREAT_WARNINGS_AS_ERRORS = YES;\n\t\t\t\tINFOPLIST_FILE = \"$(SRCROOT)/Sources/SQLite/Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/../Frameworks @loader_path/Frameworks\";\n\t\t\t\tMACOSX_DEPLOYMENT_TARGET = 10.13;\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = com.stephencelis.SQLite;\n\t\t\t\tPRODUCT_NAME = SQLite;\n\t\t\t\tSDKROOT = macosx;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_INCLUDE_PATHS = \"\";\n\t\t\t\tSWIFT_TREAT_WARNINGS_AS_ERRORS = YES;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tEE247B4E1C3F3ED000AE3E12 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tAPPLICATION_EXTENSION_API_ONLY = YES;\n\t\t\t\tCODE_SIGN_IDENTITY = \"\";\n\t\t\t\tCOMBINE_HIDPI_IMAGES = YES;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tFRAMEWORK_VERSION = A;\n\t\t\t\tGCC_TREAT_WARNINGS_AS_ERRORS = YES;\n\t\t\t\tINFOPLIST_FILE = \"$(SRCROOT)/Sources/SQLite/Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/../Frameworks @loader_path/Frameworks\";\n\t\t\t\tMACOSX_DEPLOYMENT_TARGET = 10.13;\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = com.stephencelis.SQLite;\n\t\t\t\tPRODUCT_NAME = SQLite;\n\t\t\t\tSDKROOT = macosx;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_INCLUDE_PATHS = \"\";\n\t\t\t\tSWIFT_TREAT_WARNINGS_AS_ERRORS = YES;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\tEE247B4F1C3F3ED000AE3E12 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tCODE_SIGN_IDENTITY = \"-\";\n\t\t\t\tCOMBINE_HIDPI_IMAGES = YES;\n\t\t\t\tGCC_TREAT_WARNINGS_AS_ERRORS = YES;\n\t\t\t\tINFOPLIST_FILE = Tests/SQLiteTests/Info.plist;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks\";\n\t\t\t\tMACOSX_DEPLOYMENT_TARGET = 10.13;\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = com.stephencelis.SQLiteTests;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSDKROOT = macosx;\n\t\t\t\tSWIFT_TREAT_WARNINGS_AS_ERRORS = YES;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tEE247B501C3F3ED000AE3E12 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tCODE_SIGN_IDENTITY = \"-\";\n\t\t\t\tCOMBINE_HIDPI_IMAGES = YES;\n\t\t\t\tGCC_TREAT_WARNINGS_AS_ERRORS = YES;\n\t\t\t\tINFOPLIST_FILE = Tests/SQLiteTests/Info.plist;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks\";\n\t\t\t\tMACOSX_DEPLOYMENT_TARGET = 10.13;\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = com.stephencelis.SQLiteTests;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSDKROOT = macosx;\n\t\t\t\tSWIFT_TREAT_WARNINGS_AS_ERRORS = YES;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n/* End XCBuildConfiguration section */\n\n/* Begin XCConfigurationList section */\n\t\t03A65E6F1C6BB0F60062603F /* Build configuration list for PBXNativeTarget \"SQLite tvOS\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t03A65E6B1C6BB0F60062603F /* Debug */,\n\t\t\t\t03A65E6C1C6BB0F60062603F /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t03A65E701C6BB0F60062603F /* Build configuration list for PBXNativeTarget \"SQLiteTests tvOS\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t03A65E6D1C6BB0F60062603F /* Debug */,\n\t\t\t\t03A65E6E1C6BB0F60062603F /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\tA121AC4C1CA35C79005A31D1 /* Build configuration list for PBXNativeTarget \"SQLite watchOS\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tA121AC4A1CA35C79005A31D1 /* Debug */,\n\t\t\t\tA121AC4B1CA35C79005A31D1 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\tDEB306E22B61CEF500F9D46B /* Build configuration list for PBXNativeTarget \"SQLite visionOS\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tDEB306E32B61CEF500F9D46B /* Debug */,\n\t\t\t\tDEB306E42B61CEF500F9D46B /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\tDEB3070E2B61CF9500F9D46B /* Build configuration list for PBXNativeTarget \"SQLiteTests visionOS\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tDEB3070F2B61CF9500F9D46B /* Debug */,\n\t\t\t\tDEB307102B61CF9500F9D46B /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\tEE247ACD1C3F04ED00AE3E12 /* Build configuration list for PBXProject \"SQLite\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tEE247AE51C3F04ED00AE3E12 /* Debug */,\n\t\t\t\tEE247AE61C3F04ED00AE3E12 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\tEE247AE71C3F04ED00AE3E12 /* Build configuration list for PBXNativeTarget \"SQLite iOS\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tEE247AE81C3F04ED00AE3E12 /* Debug */,\n\t\t\t\tEE247AE91C3F04ED00AE3E12 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\tEE247AEA1C3F04ED00AE3E12 /* Build configuration list for PBXNativeTarget \"SQLiteTests iOS\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tEE247AEB1C3F04ED00AE3E12 /* Debug */,\n\t\t\t\tEE247AEC1C3F04ED00AE3E12 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\tEE247B511C3F3ED000AE3E12 /* Build configuration list for PBXNativeTarget \"SQLite Mac\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tEE247B4D1C3F3ED000AE3E12 /* Debug */,\n\t\t\t\tEE247B4E1C3F3ED000AE3E12 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\tEE247B521C3F3ED000AE3E12 /* Build configuration list for PBXNativeTarget \"SQLiteTests Mac\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tEE247B4F1C3F3ED000AE3E12 /* Debug */,\n\t\t\t\tEE247B501C3F3ED000AE3E12 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n/* End XCConfigurationList section */\n\t};\n\trootObject = EE247ACA1C3F04ED00AE3E12 /* Project object */;\n}\n"
  },
  {
    "path": "SQLite.xcodeproj/project.xcworkspace/contents.xcworkspacedata",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Workspace\n   version = \"1.0\">\n   <FileRef\n      location = \"self:SQLite.xcodeproj\">\n   </FileRef>\n</Workspace>\n"
  },
  {
    "path": "SQLite.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>IDEDidComputeMac32BitWarning</key>\n\t<true/>\n</dict>\n</plist>\n"
  },
  {
    "path": "SQLite.xcodeproj/xcshareddata/xcschemes/SQLite Mac.xcscheme",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n   LastUpgradeVersion = \"1250\"\n   version = \"1.3\">\n   <BuildAction\n      parallelizeBuildables = \"YES\"\n      buildImplicitDependencies = \"YES\">\n      <BuildActionEntries>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"YES\"\n            buildForArchiving = \"YES\"\n            buildForAnalyzing = \"YES\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"EE247B3B1C3F3ED000AE3E12\"\n               BuildableName = \"SQLite.framework\"\n               BlueprintName = \"SQLite Mac\"\n               ReferencedContainer = \"container:SQLite.xcodeproj\">\n            </BuildableReference>\n         </BuildActionEntry>\n      </BuildActionEntries>\n   </BuildAction>\n   <TestAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\">\n      <MacroExpansion>\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"EE247B3B1C3F3ED000AE3E12\"\n            BuildableName = \"SQLite.framework\"\n            BlueprintName = \"SQLite Mac\"\n            ReferencedContainer = \"container:SQLite.xcodeproj\">\n         </BuildableReference>\n      </MacroExpansion>\n      <Testables>\n         <TestableReference\n            skipped = \"NO\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"EE247B441C3F3ED000AE3E12\"\n               BuildableName = \"SQLiteTests Mac.xctest\"\n               BlueprintName = \"SQLiteTests Mac\"\n               ReferencedContainer = \"container:SQLite.xcodeproj\">\n            </BuildableReference>\n         </TestableReference>\n      </Testables>\n   </TestAction>\n   <LaunchAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      launchStyle = \"0\"\n      useCustomWorkingDirectory = \"NO\"\n      ignoresPersistentStateOnLaunch = \"NO\"\n      debugDocumentVersioning = \"YES\"\n      debugServiceExtension = \"internal\"\n      allowLocationSimulation = \"YES\">\n      <MacroExpansion>\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"EE247B3B1C3F3ED000AE3E12\"\n            BuildableName = \"SQLite.framework\"\n            BlueprintName = \"SQLite Mac\"\n            ReferencedContainer = \"container:SQLite.xcodeproj\">\n         </BuildableReference>\n      </MacroExpansion>\n   </LaunchAction>\n   <ProfileAction\n      buildConfiguration = \"Release\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      savedToolIdentifier = \"\"\n      useCustomWorkingDirectory = \"NO\"\n      debugDocumentVersioning = \"YES\">\n      <MacroExpansion>\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"EE247B3B1C3F3ED000AE3E12\"\n            BuildableName = \"SQLite.framework\"\n            BlueprintName = \"SQLite Mac\"\n            ReferencedContainer = \"container:SQLite.xcodeproj\">\n         </BuildableReference>\n      </MacroExpansion>\n   </ProfileAction>\n   <AnalyzeAction\n      buildConfiguration = \"Debug\">\n   </AnalyzeAction>\n   <ArchiveAction\n      buildConfiguration = \"Release\"\n      revealArchiveInOrganizer = \"YES\">\n   </ArchiveAction>\n</Scheme>\n"
  },
  {
    "path": "SQLite.xcodeproj/xcshareddata/xcschemes/SQLite iOS.xcscheme",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n   LastUpgradeVersion = \"1250\"\n   version = \"1.3\">\n   <BuildAction\n      parallelizeBuildables = \"YES\"\n      buildImplicitDependencies = \"YES\">\n      <BuildActionEntries>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"YES\"\n            buildForArchiving = \"YES\"\n            buildForAnalyzing = \"YES\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"EE247AD21C3F04ED00AE3E12\"\n               BuildableName = \"SQLite.framework\"\n               BlueprintName = \"SQLite iOS\"\n               ReferencedContainer = \"container:SQLite.xcodeproj\">\n            </BuildableReference>\n         </BuildActionEntry>\n      </BuildActionEntries>\n   </BuildAction>\n   <TestAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\">\n      <MacroExpansion>\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"EE247AD21C3F04ED00AE3E12\"\n            BuildableName = \"SQLite.framework\"\n            BlueprintName = \"SQLite iOS\"\n            ReferencedContainer = \"container:SQLite.xcodeproj\">\n         </BuildableReference>\n      </MacroExpansion>\n      <Testables>\n         <TestableReference\n            skipped = \"NO\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"EE247ADC1C3F04ED00AE3E12\"\n               BuildableName = \"SQLiteTests iOS.xctest\"\n               BlueprintName = \"SQLiteTests iOS\"\n               ReferencedContainer = \"container:SQLite.xcodeproj\">\n            </BuildableReference>\n         </TestableReference>\n      </Testables>\n   </TestAction>\n   <LaunchAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      launchStyle = \"0\"\n      useCustomWorkingDirectory = \"NO\"\n      ignoresPersistentStateOnLaunch = \"NO\"\n      debugDocumentVersioning = \"YES\"\n      debugServiceExtension = \"internal\"\n      allowLocationSimulation = \"YES\">\n      <MacroExpansion>\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"EE247AD21C3F04ED00AE3E12\"\n            BuildableName = \"SQLite.framework\"\n            BlueprintName = \"SQLite iOS\"\n            ReferencedContainer = \"container:SQLite.xcodeproj\">\n         </BuildableReference>\n      </MacroExpansion>\n   </LaunchAction>\n   <ProfileAction\n      buildConfiguration = \"Release\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      savedToolIdentifier = \"\"\n      useCustomWorkingDirectory = \"NO\"\n      debugDocumentVersioning = \"YES\">\n      <MacroExpansion>\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"EE247AD21C3F04ED00AE3E12\"\n            BuildableName = \"SQLite.framework\"\n            BlueprintName = \"SQLite iOS\"\n            ReferencedContainer = \"container:SQLite.xcodeproj\">\n         </BuildableReference>\n      </MacroExpansion>\n   </ProfileAction>\n   <AnalyzeAction\n      buildConfiguration = \"Debug\">\n   </AnalyzeAction>\n   <ArchiveAction\n      buildConfiguration = \"Release\"\n      revealArchiveInOrganizer = \"YES\">\n   </ArchiveAction>\n</Scheme>\n"
  },
  {
    "path": "SQLite.xcodeproj/xcshareddata/xcschemes/SQLite tvOS.xcscheme",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n   LastUpgradeVersion = \"1250\"\n   version = \"1.3\">\n   <BuildAction\n      parallelizeBuildables = \"YES\"\n      buildImplicitDependencies = \"YES\">\n      <BuildActionEntries>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"YES\"\n            buildForArchiving = \"YES\"\n            buildForAnalyzing = \"YES\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"03A65E591C6BB0F50062603F\"\n               BuildableName = \"SQLite.framework\"\n               BlueprintName = \"SQLite tvOS\"\n               ReferencedContainer = \"container:SQLite.xcodeproj\">\n            </BuildableReference>\n         </BuildActionEntry>\n      </BuildActionEntries>\n   </BuildAction>\n   <TestAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\">\n      <MacroExpansion>\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"03A65E591C6BB0F50062603F\"\n            BuildableName = \"SQLite.framework\"\n            BlueprintName = \"SQLite tvOS\"\n            ReferencedContainer = \"container:SQLite.xcodeproj\">\n         </BuildableReference>\n      </MacroExpansion>\n      <Testables>\n         <TestableReference\n            skipped = \"NO\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"03A65E621C6BB0F60062603F\"\n               BuildableName = \"SQLiteTests tvOS.xctest\"\n               BlueprintName = \"SQLiteTests tvOS\"\n               ReferencedContainer = \"container:SQLite.xcodeproj\">\n            </BuildableReference>\n         </TestableReference>\n      </Testables>\n   </TestAction>\n   <LaunchAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      launchStyle = \"0\"\n      useCustomWorkingDirectory = \"NO\"\n      ignoresPersistentStateOnLaunch = \"NO\"\n      debugDocumentVersioning = \"YES\"\n      debugServiceExtension = \"internal\"\n      allowLocationSimulation = \"YES\">\n      <MacroExpansion>\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"03A65E591C6BB0F50062603F\"\n            BuildableName = \"SQLite.framework\"\n            BlueprintName = \"SQLite tvOS\"\n            ReferencedContainer = \"container:SQLite.xcodeproj\">\n         </BuildableReference>\n      </MacroExpansion>\n   </LaunchAction>\n   <ProfileAction\n      buildConfiguration = \"Release\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      savedToolIdentifier = \"\"\n      useCustomWorkingDirectory = \"NO\"\n      debugDocumentVersioning = \"YES\">\n      <MacroExpansion>\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"03A65E591C6BB0F50062603F\"\n            BuildableName = \"SQLite.framework\"\n            BlueprintName = \"SQLite tvOS\"\n            ReferencedContainer = \"container:SQLite.xcodeproj\">\n         </BuildableReference>\n      </MacroExpansion>\n   </ProfileAction>\n   <AnalyzeAction\n      buildConfiguration = \"Debug\">\n   </AnalyzeAction>\n   <ArchiveAction\n      buildConfiguration = \"Release\"\n      revealArchiveInOrganizer = \"YES\">\n   </ArchiveAction>\n</Scheme>\n"
  },
  {
    "path": "SQLite.xcodeproj/xcshareddata/xcschemes/SQLite visionOS.xcscheme",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n   LastUpgradeVersion = \"1520\"\n   version = \"1.7\">\n   <BuildAction\n      parallelizeBuildables = \"YES\"\n      buildImplicitDependencies = \"YES\">\n      <BuildActionEntries>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"YES\"\n            buildForArchiving = \"YES\"\n            buildForAnalyzing = \"YES\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"DEB306B82B61CEF500F9D46B\"\n               BuildableName = \"SQLite.framework\"\n               BlueprintName = \"SQLite visionOS\"\n               ReferencedContainer = \"container:SQLite.xcodeproj\">\n            </BuildableReference>\n         </BuildActionEntry>\n      </BuildActionEntries>\n   </BuildAction>\n   <TestAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\">\n      <TestPlans>\n         <TestPlanReference\n            reference = \"container:Tests/SQLite visionOS.xctestplan\"\n            default = \"YES\">\n         </TestPlanReference>\n      </TestPlans>\n   </TestAction>\n   <LaunchAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      launchStyle = \"0\"\n      useCustomWorkingDirectory = \"NO\"\n      ignoresPersistentStateOnLaunch = \"NO\"\n      debugDocumentVersioning = \"YES\"\n      debugServiceExtension = \"internal\"\n      allowLocationSimulation = \"YES\">\n   </LaunchAction>\n   <ProfileAction\n      buildConfiguration = \"Release\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      savedToolIdentifier = \"\"\n      useCustomWorkingDirectory = \"NO\"\n      debugDocumentVersioning = \"YES\">\n      <MacroExpansion>\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"DEB306B82B61CEF500F9D46B\"\n            BuildableName = \"SQLite.framework\"\n            BlueprintName = \"SQLite visionOS\"\n            ReferencedContainer = \"container:SQLite.xcodeproj\">\n         </BuildableReference>\n      </MacroExpansion>\n   </ProfileAction>\n   <AnalyzeAction\n      buildConfiguration = \"Debug\">\n   </AnalyzeAction>\n   <ArchiveAction\n      buildConfiguration = \"Release\"\n      revealArchiveInOrganizer = \"YES\">\n   </ArchiveAction>\n</Scheme>\n"
  },
  {
    "path": "SQLite.xcodeproj/xcshareddata/xcschemes/SQLite watchOS.xcscheme",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n   LastUpgradeVersion = \"1250\"\n   version = \"1.3\">\n   <BuildAction\n      parallelizeBuildables = \"YES\"\n      buildImplicitDependencies = \"YES\">\n      <BuildActionEntries>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"YES\"\n            buildForArchiving = \"YES\"\n            buildForAnalyzing = \"YES\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"A121AC441CA35C79005A31D1\"\n               BuildableName = \"SQLite.framework\"\n               BlueprintName = \"SQLite watchOS\"\n               ReferencedContainer = \"container:SQLite.xcodeproj\">\n            </BuildableReference>\n         </BuildActionEntry>\n      </BuildActionEntries>\n   </BuildAction>\n   <TestAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\">\n      <Testables>\n      </Testables>\n   </TestAction>\n   <LaunchAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      launchStyle = \"0\"\n      useCustomWorkingDirectory = \"NO\"\n      ignoresPersistentStateOnLaunch = \"NO\"\n      debugDocumentVersioning = \"YES\"\n      debugServiceExtension = \"internal\"\n      allowLocationSimulation = \"YES\">\n      <MacroExpansion>\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"A121AC441CA35C79005A31D1\"\n            BuildableName = \"SQLite.framework\"\n            BlueprintName = \"SQLite watchOS\"\n            ReferencedContainer = \"container:SQLite.xcodeproj\">\n         </BuildableReference>\n      </MacroExpansion>\n   </LaunchAction>\n   <ProfileAction\n      buildConfiguration = \"Release\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      savedToolIdentifier = \"\"\n      useCustomWorkingDirectory = \"NO\"\n      debugDocumentVersioning = \"YES\">\n      <MacroExpansion>\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"A121AC441CA35C79005A31D1\"\n            BuildableName = \"SQLite.framework\"\n            BlueprintName = \"SQLite watchOS\"\n            ReferencedContainer = \"container:SQLite.xcodeproj\">\n         </BuildableReference>\n      </MacroExpansion>\n   </ProfileAction>\n   <AnalyzeAction\n      buildConfiguration = \"Debug\">\n   </AnalyzeAction>\n   <ArchiveAction\n      buildConfiguration = \"Release\"\n      revealArchiveInOrganizer = \"YES\">\n   </ArchiveAction>\n</Scheme>\n"
  },
  {
    "path": "Sources/SQLite/Core/Backup.swift",
    "content": "//\n// SQLite.swift\n// https://github.com/stephencelis/SQLite.swift\n// Copyright © 2014-2015 Stephen Celis.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport Foundation\nimport Dispatch\n#if StandaloneSQLite\nimport sqlite3\n#elseif SQLCipher\nimport SQLCipher\n#elseif SQLiteSwiftCSQLite\nimport SQLiteSwiftCSQLite\n#else\nimport SQLite3 // SystemSQLite\n#endif\n\n/// An object representing database backup.\n///\n/// See: <https://www.sqlite.org/backup.html>\npublic final class Backup {\n\n    /// The name of the database to backup\n    public enum DatabaseName {\n\n        /// The main database\n        case main\n\n        /// The temporary database\n        case temp\n\n        /// A database added to the connection with ATTACH statement\n        case attached(name: String)\n\n        var name: String {\n            switch self {\n            case .main:\n                return \"main\"\n            case .temp:\n                return \"temp\"\n            case .attached(let name):\n                return name\n            }\n        }\n    }\n\n    /// Number of pages to copy while performing a backup step\n    public enum Pages {\n\n        /// Indicates all remaining pages should be copied\n        case all\n\n        /// Indicates the maximal number of pages to be copied in single step\n        case limited(number: Int32)\n\n        var number: Int32 {\n            switch self {\n            case .all:\n                return -1\n            case .limited(let number):\n                return number\n            }\n        }\n    }\n\n    /// Total number of pages to copy\n    ///\n    /// See: <https://www.sqlite.org/c3ref/backup_finish.html#sqlite3backuppagecount>\n    public var pageCount: Int32 {\n        return handle.map { sqlite3_backup_pagecount($0) } ?? 0\n    }\n\n    /// Number of remaining pages to copy.\n    ///\n    /// See: <https://www.sqlite.org/c3ref/backup_finish.html#sqlite3backupremaining>\n    public var remainingPages: Int32 {\n        return handle.map { sqlite3_backup_remaining($0) } ?? 0\n    }\n\n    private let targetConnection: Connection\n    private let sourceConnection: Connection\n\n    private var handle: OpaquePointer?\n\n    /// Initializes a new SQLite backup.\n    ///\n    /// - Parameters:\n    ///\n    ///   - sourceConnection: The connection to the database to backup.\n    ///   - sourceName: The name of the database to backup.\n    ///     Default: `.main`.\n    ///\n    ///   - targetConnection: The connection to the database to save backup into.\n    ///   - targetName: The name of the database to save backup into.\n    ///     Default: `.main`.\n    ///\n    /// - Returns: A new database backup.\n    ///\n    /// See: <https://www.sqlite.org/c3ref/backup_finish.html#sqlite3backupinit>\n    public init(sourceConnection: Connection,\n                sourceName: DatabaseName = .main,\n                targetConnection: Connection,\n                targetName: DatabaseName = .main) throws {\n\n        self.targetConnection = targetConnection\n        self.sourceConnection = sourceConnection\n\n        self.handle = sqlite3_backup_init(targetConnection.handle,\n                                          targetName.name,\n                                          sourceConnection.handle,\n                                          sourceName.name)\n\n        if handle == nil, let error = Result(errorCode: sqlite3_errcode(targetConnection.handle),\n                                             connection: targetConnection) {\n            throw error\n        }\n    }\n\n    /// Performs a backup step.\n    ///\n    /// - Parameter pagesToCopy: The maximal number of pages to copy in one step\n    ///\n    /// - Throws: `Result.Error` if step fails.\n    ///\n    /// See: <https://www.sqlite.org/c3ref/backup_finish.html#sqlite3backupstep>\n    public func step(pagesToCopy pages: Pages = .all) throws {\n        let status = sqlite3_backup_step(handle, pages.number)\n\n        guard status != SQLITE_DONE else {\n            finish()\n            return\n        }\n\n        if let error = Result(errorCode: status, connection: targetConnection) {\n            throw error\n        }\n    }\n\n    /// Finalizes backup.\n    ///\n    /// See: <https://www.sqlite.org/c3ref/backup_finish.html#sqlite3backupfinish>\n    public func finish() {\n        guard let handle = self.handle else {\n            return\n        }\n\n        sqlite3_backup_finish(handle)\n        self.handle = nil\n    }\n\n    deinit {\n        finish()\n    }\n}\n"
  },
  {
    "path": "Sources/SQLite/Core/Blob.swift",
    "content": "//\n// SQLite.swift\n// https://github.com/stephencelis/SQLite.swift\n// Copyright © 2014-2015 Stephen Celis.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\npublic struct Blob: Sendable {\n\n    public let bytes: [UInt8]\n\n    public init(bytes: [UInt8]) {\n        self.bytes = bytes\n    }\n\n    public init(bytes: UnsafeRawPointer, length: Int) {\n        let i8bufptr = UnsafeBufferPointer(start: bytes.assumingMemoryBound(to: UInt8.self), count: length)\n        self.init(bytes: [UInt8](i8bufptr))\n    }\n\n    public func toHex() -> String {\n        bytes.map {\n           ($0 < 16 ? \"0\" : \"\") + String($0, radix: 16, uppercase: false)\n        }.joined(separator: \"\")\n    }\n}\n\nextension Blob: CustomStringConvertible {\n    public var description: String {\n        \"x'\\(toHex())'\"\n    }\n}\n\nextension Blob: Equatable {\n}\n\npublic func ==(lhs: Blob, rhs: Blob) -> Bool {\n    lhs.bytes == rhs.bytes\n}\n"
  },
  {
    "path": "Sources/SQLite/Core/Connection+Aggregation.swift",
    "content": "import Foundation\n#if StandaloneSQLite\nimport sqlite3\n#elseif SQLCipher\nimport SQLCipher\n#elseif SQLiteSwiftCSQLite\nimport SQLiteSwiftCSQLite\n#else\nimport SQLite3 // SystemSQLite\n#endif\n\nextension Connection {\n    private typealias Aggregate = @convention(block) (Int, Context, Int32, Argv) -> Void\n\n    /// Creates or redefines a custom SQL aggregate.\n    ///\n    /// - Parameters:\n    ///\n    ///   - aggregate: The name of the aggregate to create or redefine.\n    ///\n    ///   - argumentCount: The number of arguments that the aggregate takes. If\n    ///     `nil`, the aggregate may take any number of arguments.\n    ///\n    ///     Default: `nil`\n    ///\n    ///   - deterministic: Whether or not the aggregate is deterministic (_i.e._\n    ///     the aggregate always returns the same result for a given input).\n    ///\n    ///     Default: `false`\n    ///\n    ///   - step: A block of code to run for each row of an aggregation group.\n    ///     The block is called with an array of raw SQL values mapped to the\n    ///     aggregate’s parameters, and an UnsafeMutablePointer to a state\n    ///     variable.\n    ///\n    ///   - final: A block of code to run after each row of an aggregation group\n    ///     is processed. The block is called with an UnsafeMutablePointer to a\n    ///     state variable, and should return a raw SQL value (or nil).\n    ///\n    ///   - state: A block of code to run to produce a fresh state variable for\n    ///     each aggregation group. The block should return an\n    ///     UnsafeMutablePointer to the fresh state variable.\n    public func createAggregation<T>(\n            _ functionName: String,\n            argumentCount: UInt? = nil,\n            deterministic: Bool = false,\n            step: @escaping ([Binding?], UnsafeMutablePointer<T>) -> Void,\n            final: @escaping (UnsafeMutablePointer<T>) -> Binding?,\n            state: @escaping () -> UnsafeMutablePointer<T>) {\n\n        let argc = argumentCount.map { Int($0) } ?? -1\n        let box: Aggregate = { (stepFlag: Int, context: Context, argc: Int32, argv: Argv) in\n            let nBytes = Int32(MemoryLayout<UnsafeMutablePointer<Int64>>.size)\n            guard let aggregateContext = sqlite3_aggregate_context(context, nBytes) else {\n                fatalError(\"Could not get aggregate context\")\n            }\n            let mutablePointer = aggregateContext.assumingMemoryBound(to: UnsafeMutableRawPointer.self)\n            if stepFlag > 0 {\n                let arguments = argv.getBindings(argc: argc)\n                if aggregateContext.assumingMemoryBound(to: Int64.self).pointee == 0 {\n                    mutablePointer.pointee = UnsafeMutableRawPointer(mutating: state())\n                }\n                step(arguments, mutablePointer.pointee.assumingMemoryBound(to: T.self))\n            } else {\n                let result = final(mutablePointer.pointee.assumingMemoryBound(to: T.self))\n                context.set(result: result)\n            }\n        }\n\n        func xStep(context: Context, argc: Int32, value: Argv) {\n            unsafeBitCast(sqlite3_user_data(context), to: Aggregate.self)(1, context, argc, value)\n        }\n\n        func xFinal(context: Context) {\n            unsafeBitCast(sqlite3_user_data(context), to: Aggregate.self)(0, context, 0, nil)\n        }\n\n        let flags = SQLITE_UTF8 | (deterministic ? SQLITE_DETERMINISTIC : 0)\n        let resultCode = sqlite3_create_function_v2(\n            handle,\n            functionName,\n            Int32(argc),\n            flags,\n            /* pApp */ unsafeBitCast(box, to: UnsafeMutableRawPointer.self),\n            /* xFunc */ nil, xStep, xFinal, /* xDestroy */ nil\n        )\n        if let result = Result(errorCode: resultCode, connection: self) {\n            fatalError(\"Error creating function: \\(result)\")\n        }\n        register(functionName, argc: argc, value: box)\n    }\n\n    public func createAggregation<T: AnyObject>(\n            _ aggregate: String,\n            argumentCount: UInt? = nil,\n            deterministic: Bool = false,\n            initialValue: T,\n            reduce: @escaping (T, [Binding?]) -> T,\n            result: @escaping (T) -> Binding?\n    ) {\n        let step: ([Binding?], UnsafeMutablePointer<UnsafeMutableRawPointer>) -> Void = { (bindings, ptr) in\n            let pointer = ptr.pointee.assumingMemoryBound(to: T.self)\n            let current = Unmanaged<T>.fromOpaque(pointer).takeRetainedValue()\n            let next = reduce(current, bindings)\n            ptr.pointee = Unmanaged.passRetained(next).toOpaque()\n        }\n\n        let final: (UnsafeMutablePointer<UnsafeMutableRawPointer>) -> Binding? = { ptr in\n            let pointer = ptr.pointee.assumingMemoryBound(to: T.self)\n            let obj = Unmanaged<T>.fromOpaque(pointer).takeRetainedValue()\n            let value = result(obj)\n            ptr.deallocate()\n            return value\n        }\n\n        let state: () -> UnsafeMutablePointer<UnsafeMutableRawPointer> = {\n            let pointer = UnsafeMutablePointer<UnsafeMutableRawPointer>.allocate(capacity: 1)\n            pointer.pointee = Unmanaged.passRetained(initialValue).toOpaque()\n            return pointer\n        }\n\n        createAggregation(aggregate, step: step, final: final, state: state)\n    }\n\n    public func createAggregation<T>(\n            _ aggregate: String,\n            argumentCount: UInt? = nil,\n            deterministic: Bool = false,\n            initialValue: T,\n            reduce: @escaping (T, [Binding?]) -> T,\n            result: @escaping (T) -> Binding?\n    ) {\n\n        let step: ([Binding?], UnsafeMutablePointer<T>) -> Void = { (bindings, pointer) in\n            let current = pointer.pointee\n            let next = reduce(current, bindings)\n            pointer.pointee = next\n        }\n\n        let final: (UnsafeMutablePointer<T>) -> Binding? = { pointer in\n            let value = result(pointer.pointee)\n            pointer.deallocate()\n            return value\n        }\n\n        let state: () -> UnsafeMutablePointer<T> = {\n            let pointer = UnsafeMutablePointer<T>.allocate(capacity: 1)\n            pointer.initialize(to: initialValue)\n            return pointer\n        }\n\n        createAggregation(aggregate, step: step, final: final, state: state)\n    }\n\n}\n"
  },
  {
    "path": "Sources/SQLite/Core/Connection+Attach.swift",
    "content": "import Foundation\n\nextension Connection {\n    #if SQLCipher\n    /// See https://www.zetetic.net/sqlcipher/sqlcipher-api/#attach\n    public func attach(_ location: Location, as schemaName: String, key: String? = nil) throws {\n        if let key {\n            try run(\"ATTACH DATABASE ? AS ? KEY ?\", location.description, schemaName, key)\n        } else {\n            try run(\"ATTACH DATABASE ? AS ?\", location.description, schemaName)\n        }\n    }\n    #else\n    /// See  https://www3.sqlite.org/lang_attach.html\n    public func attach(_ location: Location, as schemaName: String) throws {\n        try run(\"ATTACH DATABASE ? AS ?\", location.description, schemaName)\n    }\n    #endif\n\n    /// See https://www3.sqlite.org/lang_detach.html\n    public func detach(_ schemaName: String) throws {\n        try run(\"DETACH DATABASE ?\", schemaName)\n    }\n}\n"
  },
  {
    "path": "Sources/SQLite/Core/Connection+Pragmas.swift",
    "content": "import Foundation\n\npublic typealias UserVersion = Int32\n\npublic extension Connection {\n    /// The user version of the database.\n    /// See SQLite [PRAGMA user_version](https://sqlite.org/pragma.html#pragma_user_version)\n    var userVersion: UserVersion? {\n        get {\n            (try? scalar(\"PRAGMA user_version\") as? Int64)?.map(Int32.init)\n        }\n        set {\n            _ = try? run(\"PRAGMA user_version = \\(newValue ?? 0)\")\n        }\n    }\n\n    /// The version of SQLite.\n    /// See SQLite [sqlite_version()](https://sqlite.org/lang_corefunc.html#sqlite_version)\n    var sqliteVersion: SQLiteVersion {\n        guard let version = (try? scalar(\"SELECT sqlite_version()\")) as? String,\n              let splits = .some(version.split(separator: \".\", maxSplits: 3)), splits.count == 3,\n              let major = Int(splits[0]), let minor = Int(splits[1]), let point = Int(splits[2]) else {\n            return .zero\n        }\n        return .init(major: major, minor: minor, point: point)\n    }\n\n    // Changing the foreign_keys setting affects the execution of all statements prepared using the database\n    // connection, including those prepared before the setting was changed.\n    //\n    // https://sqlite.org/pragma.html#pragma_foreign_keys\n    var foreignKeys: Bool {\n        get { getBoolPragma(\"foreign_keys\") }\n        set { setBoolPragma(\"foreign_keys\", newValue) }\n    }\n\n    var deferForeignKeys: Bool {\n        get { getBoolPragma(\"defer_foreign_keys\") }\n        set { setBoolPragma(\"defer_foreign_keys\", newValue) }\n    }\n\n    private func getBoolPragma(_ key: String) -> Bool {\n        guard let binding = try? scalar(\"PRAGMA \\(key)\"),\n              let intBinding = binding as? Int64 else { return false }\n        return intBinding == 1\n    }\n\n    private func setBoolPragma(_ key: String, _ newValue: Bool) {\n        _ = try? run(\"PRAGMA \\(key) = \\(newValue ? \"1\" : \"0\")\")\n    }\n}\n"
  },
  {
    "path": "Sources/SQLite/Core/Connection.swift",
    "content": "//\n// SQLite.swift\n// https://github.com/stephencelis/SQLite.swift\n// Copyright © 2014-2015 Stephen Celis.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport Foundation\nimport Dispatch\n#if StandaloneSQLite\nimport sqlite3\n#elseif SQLCipher\nimport SQLCipher\n#elseif SQLiteSwiftCSQLite\nimport SQLiteSwiftCSQLite\n#else\nimport SQLite3 // SystemSQLite\n#endif\n\n/// A connection to SQLite.\npublic final class Connection {\n\n    /// The location of a SQLite database.\n    public enum Location {\n\n        /// An in-memory database (equivalent to `.uri(\":memory:\")`).\n        ///\n        /// See: <https://www.sqlite.org/inmemorydb.html#sharedmemdb>\n        case inMemory\n\n        /// A temporary, file-backed database (equivalent to `.uri(\"\")`).\n        ///\n        /// See: <https://www.sqlite.org/inmemorydb.html#temp_db>\n        case temporary\n\n        /// A database located at the given URI filename (or path).\n        ///\n        /// See: <https://www.sqlite.org/uri.html>\n        ///\n        /// - Parameter filename: A URI filename\n        /// - Parameter parameters: optional query parameters\n        case uri(String, parameters: [URIQueryParameter] = [])\n    }\n\n    /// An SQL operation passed to update callbacks.\n    public enum Operation {\n\n        /// An INSERT operation.\n        case insert\n\n        /// An UPDATE operation.\n        case update\n\n        /// A DELETE operation.\n        case delete\n\n        fileprivate init(rawValue: Int32) {\n            switch rawValue {\n            case SQLITE_INSERT:\n                self = .insert\n            case SQLITE_UPDATE:\n                self = .update\n            case SQLITE_DELETE:\n                self = .delete\n            default:\n                fatalError(\"unhandled operation code: \\(rawValue)\")\n            }\n        }\n    }\n\n    public var handle: OpaquePointer { _handle! }\n\n    fileprivate var _handle: OpaquePointer?\n\n    /// Initializes a new SQLite connection.\n    ///\n    /// - Parameters:\n    ///\n    ///   - location: The location of the database. Creates a new database if it\n    ///     doesn’t already exist (unless in read-only mode).\n    ///\n    ///     Default: `.inMemory`.\n    ///\n    ///   - readonly: Whether or not to open the database in a read-only state.\n    ///\n    ///     Default: `false`.\n    ///\n    /// - Returns: A new database connection.\n    public init(_ location: Location = .inMemory, readonly: Bool = false) throws {\n        let flags = readonly ? SQLITE_OPEN_READONLY : (SQLITE_OPEN_CREATE | SQLITE_OPEN_READWRITE)\n        try check(sqlite3_open_v2(location.description,\n                                  &_handle,\n                                  flags | SQLITE_OPEN_FULLMUTEX | SQLITE_OPEN_URI,\n                                  nil))\n        queue.setSpecific(key: Connection.queueKey, value: queueContext)\n    }\n\n    /// Initializes a new connection to a database.\n    ///\n    /// - Parameters:\n    ///\n    ///   - filename: The location of the database. Creates a new database if\n    ///     it doesn’t already exist (unless in read-only mode).\n    ///\n    ///   - readonly: Whether or not to open the database in a read-only state.\n    ///\n    ///     Default: `false`.\n    ///\n    /// - Throws: `Result.Error` iff a connection cannot be established.\n    ///\n    /// - Returns: A new database connection.\n    public convenience init(_ filename: String, readonly: Bool = false) throws {\n        try self.init(.uri(filename), readonly: readonly)\n    }\n\n    deinit {\n        sqlite3_close(handle)\n    }\n\n    // MARK: -\n\n    /// Whether or not the database was opened in a read-only state.\n    public var readonly: Bool { sqlite3_db_readonly(handle, nil) == 1 }\n\n    /// The last rowid inserted into the database via this connection.\n    public var lastInsertRowid: Int64 {\n        sqlite3_last_insert_rowid(handle)\n    }\n\n    /// The last number of changes (inserts, updates, or deletes) made to the\n    /// database via this connection.\n    public var changes: Int {\n        Int(sqlite3_changes(handle))\n    }\n\n    /// The total number of changes (inserts, updates, or deletes) made to the\n    /// database via this connection.\n    public var totalChanges: Int {\n        Int(sqlite3_total_changes(handle))\n    }\n\n    /// Whether or not the database will return extended error codes when errors are handled.\n    public var usesExtendedErrorCodes: Bool = false {\n        didSet {\n            sqlite3_extended_result_codes(handle, usesExtendedErrorCodes ? 1 : 0)\n        }\n    }\n\n    // MARK: - Execute\n\n    /// Executes a batch of SQL statements.\n    ///\n    /// - Parameter SQL: A batch of zero or more semicolon-separated SQL\n    ///   statements.\n    ///\n    /// - Throws: `Result.Error` if query execution fails.\n    public func execute(_ SQL: String) throws {\n        _ = try sync { try check(sqlite3_exec(handle, SQL, nil, nil, nil)) }\n    }\n\n    // MARK: - Prepare\n\n    /// Prepares a single SQL statement (with optional parameter bindings).\n    ///\n    /// - Parameters:\n    ///\n    ///   - statement: A single SQL statement.\n    ///\n    ///   - bindings: A list of parameters to bind to the statement.\n    ///\n    /// - Returns: A prepared statement.\n    public func prepare(_ statement: String, _ bindings: Binding?...) throws -> Statement {\n        if !bindings.isEmpty { return try prepare(statement, bindings) }\n        return try Statement(self, statement)\n    }\n\n    /// Prepares a single SQL statement and binds parameters to it.\n    ///\n    /// - Parameters:\n    ///\n    ///   - statement: A single SQL statement.\n    ///\n    ///   - bindings: A list of parameters to bind to the statement.\n    ///\n    /// - Returns: A prepared statement.\n    public func prepare(_ statement: String, _ bindings: [Binding?]) throws -> Statement {\n        try prepare(statement).bind(bindings)\n    }\n\n    /// Prepares a single SQL statement and binds parameters to it.\n    ///\n    /// - Parameters:\n    ///\n    ///   - statement: A single SQL statement.\n    ///\n    ///   - bindings: A dictionary of named parameters to bind to the statement.\n    ///\n    /// - Returns: A prepared statement.\n    public func prepare(_ statement: String, _ bindings: [String: Binding?]) throws -> Statement {\n        try prepare(statement).bind(bindings)\n    }\n\n    // MARK: - Run\n\n    /// Runs a single SQL statement (with optional parameter bindings).\n    ///\n    /// - Parameters:\n    ///\n    ///   - statement: A single SQL statement.\n    ///\n    ///   - bindings: A list of parameters to bind to the statement.\n    ///\n    /// - Throws: `Result.Error` if query execution fails.\n    ///\n    /// - Returns: The statement.\n    @discardableResult public func run(_ statement: String, _ bindings: Binding?...) throws -> Statement {\n        try run(statement, bindings)\n    }\n\n    /// Prepares, binds, and runs a single SQL statement.\n    ///\n    /// - Parameters:\n    ///\n    ///   - statement: A single SQL statement.\n    ///\n    ///   - bindings: A list of parameters to bind to the statement.\n    ///\n    /// - Throws: `Result.Error` if query execution fails.\n    ///\n    /// - Returns: The statement.\n    @discardableResult public func run(_ statement: String, _ bindings: [Binding?]) throws -> Statement {\n        try prepare(statement).run(bindings)\n    }\n\n    /// Prepares, binds, and runs a single SQL statement.\n    ///\n    /// - Parameters:\n    ///\n    ///   - statement: A single SQL statement.\n    ///\n    ///   - bindings: A dictionary of named parameters to bind to the statement.\n    ///\n    /// - Throws: `Result.Error` if query execution fails.\n    ///\n    /// - Returns: The statement.\n    @discardableResult public func run(_ statement: String, _ bindings: [String: Binding?]) throws -> Statement {\n        try prepare(statement).run(bindings)\n    }\n\n    // MARK: - VACUUM\n\n    /// Run a vacuum on the database\n    ///\n    /// - Throws: `Result.Error` if query execution fails.\n    ///\n    /// - Returns: The statement.\n    @discardableResult public func vacuum() throws -> Statement {\n        try run(\"VACUUM\")\n    }\n\n    // MARK: - Scalar\n\n    /// Runs a single SQL statement (with optional parameter bindings),\n    /// returning the first value of the first row.\n    ///\n    /// - Parameters:\n    ///\n    ///   - statement: A single SQL statement.\n    ///\n    ///   - bindings: A list of parameters to bind to the statement.\n    ///\n    /// - Returns: The first value of the first row returned.\n    public func scalar(_ statement: String, _ bindings: Binding?...) throws -> Binding? {\n        try scalar(statement, bindings)\n    }\n\n    /// Runs a single SQL statement (with optional parameter bindings),\n    /// returning the first value of the first row.\n    ///\n    /// - Parameters:\n    ///\n    ///   - statement: A single SQL statement.\n    ///\n    ///   - bindings: A list of parameters to bind to the statement.\n    ///\n    /// - Returns: The first value of the first row returned.\n    public func scalar(_ statement: String, _ bindings: [Binding?]) throws -> Binding? {\n        try prepare(statement).scalar(bindings)\n    }\n\n    /// Runs a single SQL statement (with optional parameter bindings),\n    /// returning the first value of the first row.\n    ///\n    /// - Parameters:\n    ///\n    ///   - statement: A single SQL statement.\n    ///\n    ///   - bindings: A dictionary of named parameters to bind to the statement.\n    ///\n    /// - Returns: The first value of the first row returned.\n    public func scalar(_ statement: String, _ bindings: [String: Binding?]) throws -> Binding? {\n        try prepare(statement).scalar(bindings)\n    }\n\n    // MARK: - Transactions\n\n    /// The mode in which a transaction acquires a lock.\n    public enum TransactionMode: String {\n\n        /// Defers locking the database till the first read/write executes.\n        case deferred = \"DEFERRED\"\n\n        /// Immediately acquires a reserved lock on the database.\n        case immediate = \"IMMEDIATE\"\n\n        /// Immediately acquires an exclusive lock on all databases.\n        case exclusive = \"EXCLUSIVE\"\n\n    }\n\n    // TODO: Consider not requiring a throw to roll back?\n    /// Runs a transaction with the given mode.\n    ///\n    /// - Note: Transactions cannot be nested. To nest transactions, see\n    ///   `savepoint()`, instead.\n    ///\n    /// - Parameters:\n    ///\n    ///   - mode: The mode in which a transaction acquires a lock.\n    ///\n    ///     Default: `.deferred`\n    ///\n    ///   - block: A closure to run SQL statements within the transaction.\n    ///     The transaction will be committed when the block returns. The block\n    ///     must throw to roll the transaction back.\n    ///\n    /// - Throws: `Result.Error`, and rethrows.\n    public func transaction(_ mode: TransactionMode = .deferred, block: () throws -> Void) throws {\n        try transaction(\"BEGIN \\(mode.rawValue) TRANSACTION\", block, \"COMMIT TRANSACTION\", or: \"ROLLBACK TRANSACTION\")\n    }\n\n    // TODO: Consider not requiring a throw to roll back?\n    // TODO: Consider removing ability to set a name?\n    /// Runs a transaction with the given savepoint name (if omitted, it will\n    /// generate a UUID).\n    ///\n    /// - SeeAlso: `transaction()`.\n    ///\n    /// - Parameters:\n    ///\n    ///   - savepointName: A unique identifier for the savepoint (optional).\n    ///\n    ///   - block: A closure to run SQL statements within the transaction.\n    ///     The savepoint will be released (committed) when the block returns.\n    ///     The block must throw to roll the savepoint back.\n    ///\n    /// - Throws: `SQLite.Result.Error`, and rethrows.\n    public func savepoint(_ name: String = UUID().uuidString, block: () throws -> Void) throws {\n        let name = name.quote(\"'\")\n        let savepoint = \"SAVEPOINT \\(name)\"\n\n        try transaction(savepoint, block, \"RELEASE \\(savepoint)\", or: \"ROLLBACK TO \\(savepoint)\")\n    }\n\n    fileprivate func transaction(_ begin: String, _ block: () throws -> Void, _ commit: String, or rollback: String) throws {\n        return try sync {\n            try self.run(begin)\n            do {\n                try block()\n                try self.run(commit)\n            } catch {\n                try self.run(rollback)\n                throw error\n            }\n        }\n    }\n\n    /// Interrupts any long-running queries.\n    public func interrupt() {\n        sqlite3_interrupt(handle)\n    }\n\n    // MARK: - Handlers\n\n    /// The number of seconds a connection will attempt to retry a statement\n    /// after encountering a busy signal (lock).\n    public var busyTimeout: Double = 0 {\n        didSet {\n            sqlite3_busy_timeout(handle, Int32(busyTimeout * 1_000))\n        }\n    }\n\n    /// Sets a handler to call after encountering a busy signal (lock).\n    ///\n    /// - Parameter callback: This block is executed during a lock in which a\n    ///   busy error would otherwise be returned. It’s passed the number of\n    ///   times it’s been called for this lock. If it returns `true`, it will\n    ///   try again. If it returns `false`, no further attempts will be made.\n    public func busyHandler(_ callback: ((_ tries: Int) -> Bool)?) {\n        guard let callback else {\n            sqlite3_busy_handler(handle, nil, nil)\n            busyHandler = nil\n            return\n        }\n\n        let box: BusyHandler = { callback(Int($0)) ? 1 : 0 }\n        sqlite3_busy_handler(handle, { callback, tries in\n            unsafeBitCast(callback, to: BusyHandler.self)(tries)\n        }, unsafeBitCast(box, to: UnsafeMutableRawPointer.self))\n        busyHandler = box\n    }\n    fileprivate typealias BusyHandler = @convention(block) (Int32) -> Int32\n    fileprivate var busyHandler: BusyHandler?\n\n    /// Sets a handler to call when a statement is executed with the compiled\n    /// SQL.\n    ///\n    /// - Parameter callback: This block is invoked when a statement is executed\n    ///   with the compiled SQL as its argument.\n    ///\n    ///       db.trace { SQL in print(SQL) }\n    public func trace(_ callback: ((String) -> Void)?) {\n        if #available(iOS 10.0, OSX 10.12, tvOS 10.0, watchOS 3.0, *) {\n            trace_v2(callback)\n        } else {\n            trace_v1(callback)\n        }\n    }\n\n    @available(OSX, deprecated: 10.12)\n    @available(iOS, deprecated: 10.0)\n    @available(watchOS, deprecated: 3.0)\n    @available(tvOS, deprecated: 10.0)\n    fileprivate func trace_v1(_ callback: ((String) -> Void)?) {\n        guard let callback else {\n            sqlite3_trace(handle, nil /* xCallback */, nil /* pCtx */)\n            trace = nil\n            return\n        }\n        let box: Trace = { (pointer: UnsafeRawPointer) in\n            callback(String(cString: pointer.assumingMemoryBound(to: UInt8.self)))\n        }\n        sqlite3_trace(handle, { (context: UnsafeMutableRawPointer?, SQL: UnsafePointer<Int8>?) in\n                    if let context, let SQL {\n                        unsafeBitCast(context, to: Trace.self)(SQL)\n                    }\n            },\n            unsafeBitCast(box, to: UnsafeMutableRawPointer.self)\n        )\n        trace = box\n    }\n\n    @available(iOS 10.0, OSX 10.12, tvOS 10.0, watchOS 3.0, *)\n    fileprivate func trace_v2(_ callback: ((String) -> Void)?) {\n        guard let callback else {\n            // If the X callback is NULL or if the M mask is zero, then tracing is disabled.\n            sqlite3_trace_v2(handle, 0 /* mask */, nil /* xCallback */, nil /* pCtx */)\n            trace = nil\n            return\n        }\n\n        let box: Trace = { (pointer: UnsafeRawPointer) in\n            callback(String(cString: pointer.assumingMemoryBound(to: UInt8.self)))\n        }\n        sqlite3_trace_v2(handle, UInt32(SQLITE_TRACE_STMT) /* mask */, {\n                 // A trace callback is invoked with four arguments: callback(T,C,P,X).\n                 // The T argument is one of the SQLITE_TRACE constants to indicate why the\n                 // callback was invoked. The C argument is a copy of the context pointer.\n                 // The P and X arguments are pointers whose meanings depend on T.\n                 (_: UInt32, context: UnsafeMutableRawPointer?, pointer: UnsafeMutableRawPointer?, _: UnsafeMutableRawPointer?) in\n                 if let pointer,\n                    let expandedSQL = sqlite3_expanded_sql(OpaquePointer(pointer)) {\n                     unsafeBitCast(context, to: Trace.self)(expandedSQL)\n                     sqlite3_free(expandedSQL)\n                 }\n                 return Int32(0) // currently ignored\n             },\n             unsafeBitCast(box, to: UnsafeMutableRawPointer.self) /* pCtx */\n        )\n        trace = box\n    }\n\n    fileprivate typealias Trace = @convention(block) (UnsafeRawPointer) -> Void\n    fileprivate var trace: Trace?\n\n    /// Registers a callback to be invoked whenever a row is inserted, updated,\n    /// or deleted in a rowid table.\n    ///\n    /// - Parameter callback: A callback invoked with the `Operation` (one of\n    ///   `.Insert`, `.Update`, or `.Delete`), database name, table name, and\n    ///   rowid.\n    public func updateHook(_ callback: ((_ operation: Operation, _ db: String, _ table: String, _ rowid: Int64) -> Void)?) {\n        guard let callback else {\n            sqlite3_update_hook(handle, nil, nil)\n            updateHook = nil\n            return\n        }\n\n        let box: UpdateHook = {\n            callback(\n                Operation(rawValue: $0),\n                String(cString: $1),\n                String(cString: $2),\n                $3\n            )\n        }\n        sqlite3_update_hook(handle, { callback, operation, db, table, rowid in\n            unsafeBitCast(callback, to: UpdateHook.self)(operation, db!, table!, rowid)\n        }, unsafeBitCast(box, to: UnsafeMutableRawPointer.self))\n        updateHook = box\n    }\n    fileprivate typealias UpdateHook = @convention(block) (Int32, UnsafePointer<Int8>, UnsafePointer<Int8>, Int64) -> Void\n    fileprivate var updateHook: UpdateHook?\n\n    /// Registers a callback to be invoked whenever a transaction is committed.\n    ///\n    /// - Parameter callback: A callback invoked whenever a transaction is\n    ///   committed. If this callback throws, the transaction will be rolled\n    ///   back.\n    public func commitHook(_ callback: (() throws -> Void)?) {\n        guard let callback else {\n            sqlite3_commit_hook(handle, nil, nil)\n            commitHook = nil\n            return\n        }\n\n        let box: CommitHook = {\n            do {\n                try callback()\n            } catch {\n                return 1\n            }\n            return 0\n        }\n        sqlite3_commit_hook(handle, { callback in\n            unsafeBitCast(callback, to: CommitHook.self)()\n        }, unsafeBitCast(box, to: UnsafeMutableRawPointer.self))\n        commitHook = box\n    }\n    fileprivate typealias CommitHook = @convention(block) () -> Int32\n    fileprivate var commitHook: CommitHook?\n\n    /// Registers a callback to be invoked whenever a transaction rolls back.\n    ///\n    /// - Parameter callback: A callback invoked when a transaction is rolled\n    ///   back.\n    public func rollbackHook(_ callback: (() -> Void)?) {\n        guard let callback else {\n            sqlite3_rollback_hook(handle, nil, nil)\n            rollbackHook = nil\n            return\n        }\n\n        let box: RollbackHook = { callback() }\n        sqlite3_rollback_hook(handle, { callback in\n            unsafeBitCast(callback, to: RollbackHook.self)()\n        }, unsafeBitCast(box, to: UnsafeMutableRawPointer.self))\n        rollbackHook = box\n    }\n    fileprivate typealias RollbackHook = @convention(block) () -> Void\n    fileprivate var rollbackHook: RollbackHook?\n\n    /// Creates or redefines a custom SQL function.\n    ///\n    /// - Parameters:\n    ///\n    ///   - function: The name of the function to create or redefine.\n    ///\n    ///   - argumentCount: The number of arguments that the function takes. If\n    ///     `nil`, the function may take any number of arguments.\n    ///\n    ///     Default: `nil`\n    ///\n    ///   - deterministic: Whether or not the function is deterministic (_i.e._\n    ///     the function always returns the same result for a given input).\n    ///\n    ///     Default: `false`\n    ///\n    ///   - block: A block of code to run when the function is called. The block\n    ///     is called with an array of raw SQL values mapped to the function’s\n    ///     parameters and should return a raw SQL value (or nil).\n    public func createFunction(_ functionName: String,\n                               argumentCount: UInt? = nil,\n                               deterministic: Bool = false,\n                               _ block: @escaping (_ args: [Binding?]) -> Binding?) {\n        let argc = argumentCount.map { Int($0) } ?? -1\n        let box: Function = { (context: Context, argc, argv: Argv) in\n            context.set(result: block(argv.getBindings(argc: argc)))\n        }\n        func xFunc(context: Context, argc: Int32, value: Argv) {\n            unsafeBitCast(sqlite3_user_data(context), to: Function.self)(context, argc, value)\n        }\n        let flags = SQLITE_UTF8 | (deterministic ? SQLITE_DETERMINISTIC : 0)\n        let resultCode = sqlite3_create_function_v2(\n            handle,\n            functionName,\n            Int32(argc),\n            flags,\n            /* pApp */ unsafeBitCast(box, to: UnsafeMutableRawPointer.self),\n            xFunc, /*xStep*/ nil, /*xFinal*/ nil, /*xDestroy*/ nil\n        )\n\n        if let result = Result(errorCode: resultCode, connection: self) {\n            fatalError(\"Error creating function: \\(result)\")\n        }\n        register(functionName, argc: argc, value: box)\n    }\n\n    func register(_ functionName: String, argc: Int, value: Any) {\n        if functions[functionName] == nil {\n            functions[functionName] = [:] // fails on Linux, https://github.com/stephencelis/SQLite.swift/issues/1071\n        }\n        functions[functionName]?[argc] = value\n    }\n\n    fileprivate typealias Function = @convention(block) (Context, Int32, Argv) -> Void\n    fileprivate var functions = [String: [Int: Any]]()\n\n    /// Defines a new collating sequence.\n    ///\n    /// - Parameters:\n    ///\n    ///   - collation: The name of the collation added.\n    ///\n    ///   - block: A collation function that takes two strings and returns the\n    ///     comparison result.\n    public func createCollation(_ collation: String, _ block: @escaping (_ lhs: String, _ rhs: String) -> ComparisonResult) throws {\n        let box: Collation = { (lhs: UnsafeRawPointer, rhs: UnsafeRawPointer) in\n            let lstr = String(cString: lhs.assumingMemoryBound(to: UInt8.self))\n            let rstr = String(cString: rhs.assumingMemoryBound(to: UInt8.self))\n            return Int32(block(lstr, rstr).rawValue)\n        }\n        try check(sqlite3_create_collation_v2(handle, collation, SQLITE_UTF8,\n            unsafeBitCast(box, to: UnsafeMutableRawPointer.self), { (callback: UnsafeMutableRawPointer?, _,\n                                                                     lhs: UnsafeRawPointer?, _, rhs: UnsafeRawPointer?) in /* xCompare */\n            if let lhs, let rhs {\n                return unsafeBitCast(callback, to: Collation.self)(lhs, rhs)\n            } else {\n                fatalError(\"sqlite3_create_collation_v2 callback called with NULL pointer\")\n            }\n        }, nil /* xDestroy */))\n        collations[collation] = box\n    }\n    fileprivate typealias Collation = @convention(block) (UnsafeRawPointer, UnsafeRawPointer) -> Int32\n    fileprivate var collations = [String: Collation]()\n\n    // MARK: - Backup\n\n    /// Prepares a new backup for current connection.\n    ///\n    /// - Parameters:\n    ///\n    ///   - databaseName: The name of the database to backup.\n    ///\n    ///     Default: `.main`\n    ///\n    ///   - targetConnection: The name of the database to save backup into.\n    ///\n    ///   - targetDatabaseName: The name of the database to save backup into.\n    ///\n    ///     Default: `.main`.\n    ///\n    /// - Returns: A new database backup.\n    public func backup(databaseName: Backup.DatabaseName = .main,\n                       usingConnection targetConnection: Connection,\n                       andDatabaseName targetDatabaseName: Backup.DatabaseName = .main) throws -> Backup {\n        try Backup(sourceConnection: self, sourceName: databaseName, targetConnection: targetConnection,\n                   targetName: targetDatabaseName)\n    }\n\n    // MARK: - Error Handling\n\n    func sync<T>(_ block: () throws -> T) rethrows -> T {\n        if DispatchQueue.getSpecific(key: Connection.queueKey) == queueContext {\n            return try block()\n        } else {\n            return try queue.sync(execute: block)\n        }\n    }\n\n    @discardableResult func check(_ resultCode: Int32, statement: Statement? = nil) throws -> Int32 {\n        guard let error = Result(errorCode: resultCode, connection: self, statement: statement) else {\n            return resultCode\n        }\n\n        throw error\n    }\n\n    fileprivate var queue = DispatchQueue(label: \"SQLite.Database\", attributes: [])\n\n    fileprivate static let queueKey = DispatchSpecificKey<Int>()\n\n    fileprivate lazy var queueContext: Int = unsafeBitCast(self, to: Int.self)\n\n}\n\nextension Connection: CustomStringConvertible {\n\n    public var description: String {\n        String(cString: sqlite3_db_filename(handle, nil))\n    }\n\n}\n\nextension Connection.Location: CustomStringConvertible {\n\n    public var description: String {\n        switch self {\n        case .inMemory:\n            return \":memory:\"\n        case .temporary:\n            return \"\"\n        case let .uri(URI, parameters):\n            guard parameters.count > 0,\n                  var components = URLComponents(string: URI) else {\n                return URI\n            }\n            components.queryItems =\n                (components.queryItems ?? []) + parameters.map(\\.queryItem)\n            if components.scheme == nil {\n                components.scheme = \"file\"\n            }\n            return components.description\n        }\n    }\n\n}\n\ntypealias Context = OpaquePointer?\nextension Context {\n    func set(result: Binding?) {\n        switch result {\n        case let blob as Blob:\n            sqlite3_result_blob(self, blob.bytes, Int32(blob.bytes.count), nil)\n        case let double as Double:\n            sqlite3_result_double(self, double)\n        case let int as Int64:\n            sqlite3_result_int64(self, int)\n        case let string as String:\n            sqlite3_result_text(self, string, Int32(string.lengthOfBytes(using: .utf8)), SQLITE_TRANSIENT)\n        case .none:\n            sqlite3_result_null(self)\n        default:\n            fatalError(\"unsupported result type: \\(String(describing: result))\")\n        }\n    }\n}\n\ntypealias Argv = UnsafeMutablePointer<OpaquePointer?>?\nextension Argv {\n    func getBindings(argc: Int32) -> [Binding?] {\n        (0..<Int(argc)).map { idx in\n            let value = self![idx]\n            switch sqlite3_value_type(value) {\n            case SQLITE_BLOB:\n                return Blob(bytes: sqlite3_value_blob(value), length: Int(sqlite3_value_bytes(value)))\n            case SQLITE_FLOAT:\n                return sqlite3_value_double(value)\n            case SQLITE_INTEGER:\n                return sqlite3_value_int64(value)\n            case SQLITE_NULL:\n                return nil\n            case SQLITE_TEXT:\n                return String(cString: UnsafePointer(sqlite3_value_text(value)))\n            case let type:\n                fatalError(\"unsupported value type: \\(type)\")\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "Sources/SQLite/Core/Errors.swift",
    "content": "import Foundation\n\npublic enum QueryError: Error, CustomStringConvertible, Sendable {\n    case noSuchTable(name: String)\n    case noSuchColumn(name: String, columns: [String])\n    case ambiguousColumn(name: String, similar: [String])\n    case unexpectedNullValue(name: String)\n\n    public var description: String {\n        switch self {\n        case .noSuchTable(let name):\n            return \"No such table: \\(name)\"\n        case .noSuchColumn(let name, let columns):\n            return \"No such column `\\(name)` in columns \\(columns)\"\n        case .ambiguousColumn(let name, let similar):\n            return \"Ambiguous column `\\(name)` (please disambiguate: \\(similar))\"\n        case .unexpectedNullValue(let name):\n            return \"Unexpected null value for column `\\(name)`\"\n        }\n    }\n}\n"
  },
  {
    "path": "Sources/SQLite/Core/Result.swift",
    "content": "#if StandaloneSQLite\nimport sqlite3\n#elseif SQLCipher\nimport SQLCipher\n#elseif SQLiteSwiftCSQLite\nimport SQLiteSwiftCSQLite\n#else\nimport SQLite3 // SystemSQLite\n#endif\n\npublic enum Result: Error {\n\n    fileprivate static let successCodes: Set = [SQLITE_OK, SQLITE_ROW, SQLITE_DONE]\n\n    /// Represents a SQLite specific [error code](https://sqlite.org/rescode.html)\n    ///\n    /// - message: English-language text that describes the error\n    ///\n    /// - code: SQLite [error code](https://sqlite.org/rescode.html#primary_result_code_list)\n    ///\n    /// - statement: the statement which produced the error\n    case error(message: String, code: Int32, statement: Statement?)\n\n    /// Represents a SQLite specific [extended error code] (https://sqlite.org/rescode.html#primary_result_codes_versus_extended_result_codes)\n    ///\n    /// - message: English-language text that describes the error\n    ///\n    /// - extendedCode: SQLite [extended error code](https://sqlite.org/rescode.html#extended_result_code_list)\n    ///\n    /// - statement: the statement which produced the error\n    case extendedError(message: String, extendedCode: Int32, statement: Statement?)\n\n    init?(errorCode: Int32, connection: Connection, statement: Statement? = nil) {\n        guard !Result.successCodes.contains(errorCode) else { return nil }\n\n        let message = String(cString: sqlite3_errmsg(connection.handle))\n\n        guard connection.usesExtendedErrorCodes else {\n            self = .error(message: message, code: errorCode, statement: statement)\n            return\n        }\n\n        let extendedErrorCode = sqlite3_extended_errcode(connection.handle)\n        self = .extendedError(message: message, extendedCode: extendedErrorCode, statement: statement)\n    }\n\n}\n\nextension Result: CustomStringConvertible {\n\n    public var description: String {\n        switch self {\n        case let .error(message, errorCode, statement):\n            if let statement {\n                return \"\\(message) (\\(statement)) (code: \\(errorCode))\"\n            } else {\n                return \"\\(message) (code: \\(errorCode))\"\n            }\n        case let .extendedError(message, extendedCode, statement):\n            if let statement {\n                return \"\\(message) (\\(statement)) (extended code: \\(extendedCode))\"\n            } else {\n                return \"\\(message) (extended code: \\(extendedCode))\"\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "Sources/SQLite/Core/SQLiteFeature.swift",
    "content": "import Foundation\n\nenum SQLiteFeature {\n    case partialIntegrityCheck      // PRAGMA integrity_check(table)\n    case sqliteSchemaTable          // sqlite_master => sqlite_schema\n    case renameColumn               // ALTER TABLE ... RENAME COLUMN\n    case dropColumn                 // ALTER TABLE ... DROP COLUMN\n\n    func isSupported(by version: SQLiteVersion) -> Bool {\n        switch self {\n        case .partialIntegrityCheck, .sqliteSchemaTable:\n            return version >= .init(major: 3, minor: 33)\n        case .renameColumn:\n            return version >= .init(major: 3, minor: 25)\n        case .dropColumn:\n            return version >= .init(major: 3, minor: 35)\n        }\n    }\n}\n\nextension Connection {\n    func supports(_ feature: SQLiteFeature) -> Bool {\n        feature.isSupported(by: sqliteVersion)\n    }\n}\n"
  },
  {
    "path": "Sources/SQLite/Core/SQLiteVersion.swift",
    "content": "import Foundation\n\npublic struct SQLiteVersion: Comparable, CustomStringConvertible, Sendable {\n    public let major: Int\n    public let minor: Int\n    public var point: Int = 0\n\n    public var description: String {\n        \"SQLite \\(major).\\(minor).\\(point)\"\n    }\n\n    public static func <(lhs: SQLiteVersion, rhs: SQLiteVersion) -> Bool {\n        lhs.tuple < rhs.tuple\n    }\n\n    public static func ==(lhs: SQLiteVersion, rhs: SQLiteVersion) -> Bool {\n        lhs.tuple == rhs.tuple\n    }\n\n    static let zero: SQLiteVersion = .init(major: 0, minor: 0)\n    private var tuple: (Int, Int, Int) { (major, minor, point) }\n}\n"
  },
  {
    "path": "Sources/SQLite/Core/Statement.swift",
    "content": "//\n// SQLite.swift\n// https://github.com/stephencelis/SQLite.swift\n// Copyright © 2014-2015 Stephen Celis.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\n#if StandaloneSQLite\nimport sqlite3\n#elseif SQLCipher\nimport SQLCipher\n#elseif SQLiteSwiftCSQLite\nimport SQLiteSwiftCSQLite\n#else\nimport SQLite3 // SystemSQLite\n#endif\n\n/// A single SQL statement.\npublic final class Statement {\n\n    fileprivate var handle: OpaquePointer?\n\n    fileprivate let connection: Connection\n\n    init(_ connection: Connection, _ SQL: String) throws {\n        self.connection = connection\n        try connection.check(sqlite3_prepare_v2(connection.handle, SQL, -1, &handle, nil))\n    }\n\n    deinit {\n        sqlite3_finalize(handle)\n    }\n\n    public lazy var columnCount: Int = Int(sqlite3_column_count(handle))\n\n    public lazy var columnNames: [String] = (0..<Int32(columnCount)).map {\n        String(cString: sqlite3_column_name(handle, $0))\n    }\n\n    /// A cursor pointing to the current row.\n    public lazy var row: Cursor = Cursor(self)\n\n    /// Binds a list of parameters to a statement.\n    ///\n    /// - Parameter values: A list of parameters to bind to the statement.\n    ///\n    /// - Returns: The statement object (useful for chaining).\n    public func bind(_ values: Binding?...) -> Statement {\n        bind(values)\n    }\n\n    /// Binds a list of parameters to a statement.\n    ///\n    /// - Parameter values: A list of parameters to bind to the statement.\n    ///\n    /// - Returns: The statement object (useful for chaining).\n    public func bind(_ values: [Binding?]) -> Statement {\n        if values.isEmpty { return self }\n        reset()\n        guard values.count == Int(sqlite3_bind_parameter_count(handle)) else {\n            fatalError(\"\\(sqlite3_bind_parameter_count(handle)) values expected, \\(values.count) passed\")\n        }\n        for idx in 1...values.count { bind(values[idx - 1], atIndex: idx) }\n        return self\n    }\n\n    /// Binds a dictionary of named parameters to a statement.\n    ///\n    /// - Parameter values: A dictionary of named parameters to bind to the\n    ///   statement.\n    ///\n    /// - Returns: The statement object (useful for chaining).\n    public func bind(_ values: [String: Binding?]) -> Statement {\n        reset()\n        for (name, value) in values {\n            let idx = sqlite3_bind_parameter_index(handle, name)\n            guard idx > 0 else {\n                fatalError(\"parameter not found: \\(name)\")\n            }\n            bind(value, atIndex: Int(idx))\n        }\n        return self\n    }\n\n    fileprivate func bind(_ value: Binding?, atIndex idx: Int) {\n        switch value {\n        case .none:\n            sqlite3_bind_null(handle, Int32(idx))\n        case let value as Blob where value.bytes.count == 0:\n            sqlite3_bind_zeroblob(handle, Int32(idx), 0)\n        case let value as Blob:\n            sqlite3_bind_blob(handle, Int32(idx), value.bytes, Int32(value.bytes.count), SQLITE_TRANSIENT)\n        case let value as Double:\n            sqlite3_bind_double(handle, Int32(idx), value)\n        case let value as Int64:\n            sqlite3_bind_int64(handle, Int32(idx), value)\n        case let value as String:\n            sqlite3_bind_text(handle, Int32(idx), value, -1, SQLITE_TRANSIENT)\n        case let value as Int:\n            self.bind(value.datatypeValue, atIndex: idx)\n        case let value as Bool:\n            self.bind(value.datatypeValue, atIndex: idx)\n        case .some(let value):\n            fatalError(\"tried to bind unexpected value \\(value)\")\n        }\n    }\n\n    /// - Parameter bindings: A list of parameters to bind to the statement.\n    ///\n    /// - Throws: `Result.Error` if query execution fails.\n    ///\n    /// - Returns: The statement object (useful for chaining).\n    @discardableResult public func run(_ bindings: Binding?...) throws -> Statement {\n        guard bindings.isEmpty else {\n            return try run(bindings)\n        }\n\n        reset(clearBindings: false)\n        repeat {} while try step()\n        return self\n    }\n\n    /// - Parameter bindings: A list of parameters to bind to the statement.\n    ///\n    /// - Throws: `Result.Error` if query execution fails.\n    ///\n    /// - Returns: The statement object (useful for chaining).\n    @discardableResult public func run(_ bindings: [Binding?]) throws -> Statement {\n        try bind(bindings).run()\n    }\n\n    /// - Parameter bindings: A dictionary of named parameters to bind to the\n    ///   statement.\n    ///\n    /// - Throws: `Result.Error` if query execution fails.\n    ///\n    /// - Returns: The statement object (useful for chaining).\n    @discardableResult public func run(_ bindings: [String: Binding?]) throws -> Statement {\n        try bind(bindings).run()\n    }\n\n    /// - Parameter bindings: A list of parameters to bind to the statement.\n    ///\n    /// - Returns: The first value of the first row returned.\n    public func scalar(_ bindings: Binding?...) throws -> Binding? {\n        guard bindings.isEmpty else {\n            return try scalar(bindings)\n        }\n\n        reset(clearBindings: false)\n        _ = try step()\n        return row[0]\n    }\n\n    /// - Parameter bindings: A list of parameters to bind to the statement.\n    ///\n    /// - Returns: The first value of the first row returned.\n    public func scalar(_ bindings: [Binding?]) throws -> Binding? {\n        try bind(bindings).scalar()\n    }\n\n    /// - Parameter bindings: A dictionary of named parameters to bind to the\n    ///   statement.\n    ///\n    /// - Returns: The first value of the first row returned.\n    public func scalar(_ bindings: [String: Binding?]) throws -> Binding? {\n        try bind(bindings).scalar()\n    }\n\n    public func step() throws -> Bool {\n        try connection.sync { try connection.check(sqlite3_step(handle)) == SQLITE_ROW }\n    }\n\n    public func reset() {\n        reset(clearBindings: true)\n    }\n\n    fileprivate func reset(clearBindings shouldClear: Bool) {\n        sqlite3_reset(handle)\n        if shouldClear { sqlite3_clear_bindings(handle) }\n    }\n\n}\n\nextension Statement: Sequence {\n\n    public func makeIterator() -> Statement {\n        reset(clearBindings: false)\n        return self\n    }\n\n}\n\npublic protocol FailableIterator: IteratorProtocol {\n    func failableNext() throws -> Self.Element?\n}\n\nextension FailableIterator {\n    public func next() -> Element? {\n        // swiftlint:disable:next force_try\n        try! failableNext()\n    }\n}\n\nextension Array {\n    public init<I: FailableIterator>(_ failableIterator: I) throws where I.Element == Element {\n        self.init()\n        while let row = try failableIterator.failableNext() {\n            append(row)\n        }\n    }\n}\n\nextension Statement: FailableIterator {\n    public typealias Element = [Binding?]\n    public func failableNext() throws -> [Binding?]? {\n        try step() ? Array(row) : nil\n    }\n}\n\nextension Statement {\n    func prepareRowIterator() -> RowIterator {\n        RowIterator(statement: self, columnNames: columnNameMap)\n    }\n\n    var columnNameMap: [String: Int] {\n        var result = [String: Int]()\n        for (index, name) in self.columnNames.enumerated() {\n            result[name.quote()] = index\n        }\n\n        return result\n    }\n}\n\nextension Statement: CustomStringConvertible {\n\n    public var description: String {\n        String(cString: sqlite3_sql(handle))\n    }\n\n}\n\npublic struct Cursor {\n\n    fileprivate let handle: OpaquePointer\n\n    fileprivate let columnCount: Int\n\n    fileprivate init(_ statement: Statement) {\n        handle = statement.handle!\n        columnCount = statement.columnCount\n    }\n\n    public subscript(idx: Int) -> Double {\n        sqlite3_column_double(handle, Int32(idx))\n    }\n\n    public subscript(idx: Int) -> Int64 {\n        sqlite3_column_int64(handle, Int32(idx))\n    }\n\n    public subscript(idx: Int) -> String {\n        String(cString: UnsafePointer(sqlite3_column_text(handle, Int32(idx))))\n    }\n\n    public subscript(idx: Int) -> Blob {\n        if let pointer = sqlite3_column_blob(handle, Int32(idx)) {\n            let length = Int(sqlite3_column_bytes(handle, Int32(idx)))\n            return Blob(bytes: pointer, length: length)\n        } else {\n            // The return value from sqlite3_column_blob() for a zero-length BLOB is a NULL pointer.\n            // https://www.sqlite.org/c3ref/column_blob.html\n            return Blob(bytes: [])\n        }\n    }\n\n    // MARK: -\n\n    public subscript(idx: Int) -> Bool {\n        Bool.fromDatatypeValue(self[idx])\n    }\n\n    public subscript(idx: Int) -> Int {\n        Int.fromDatatypeValue(self[idx])\n    }\n\n}\n\n/// Cursors provide direct access to a statement’s current row.\nextension Cursor: Sequence {\n\n    public subscript(idx: Int) -> Binding? {\n        switch sqlite3_column_type(handle, Int32(idx)) {\n        case SQLITE_BLOB:\n            return self[idx] as Blob\n        case SQLITE_FLOAT:\n            return self[idx] as Double\n        case SQLITE_INTEGER:\n            return self[idx] as Int64\n        case SQLITE_NULL:\n            return nil\n        case SQLITE_TEXT:\n            return self[idx] as String\n        case let type:\n            fatalError(\"unsupported column type: \\(type)\")\n        }\n    }\n\n    public func makeIterator() -> AnyIterator<Binding?> {\n        var idx = 0\n        return AnyIterator {\n            if idx >= columnCount {\n                return .none\n            } else {\n                idx += 1\n                return self[idx - 1]\n            }\n        }\n    }\n\n}\n"
  },
  {
    "path": "Sources/SQLite/Core/URIQueryParameter.swift",
    "content": "import Foundation\n\n/// See https://www.sqlite.org/uri.html\npublic enum URIQueryParameter: CustomStringConvertible {\n    public enum FileMode: String {\n        case readOnly = \"ro\", readWrite = \"rw\", readWriteCreate = \"rwc\", memory\n    }\n\n    public enum CacheMode: String {\n        case shared, `private`\n    }\n\n    /// The cache query parameter determines if the new database is opened using shared cache mode or with a private cache.\n    case cache(CacheMode)\n\n    /// The immutable query parameter is a boolean that signals to SQLite that the underlying database file is held on read-only media\n    /// and cannot be modified, even by another process with elevated privileges.\n    case immutable(Bool)\n\n    /// When creating a new database file during `sqlite3_open_v2()` on unix systems, SQLite will try to set the permissions of the new database\n    /// file to match the existing file \"filename\".\n    case modeOf(String)\n\n    /// The mode query parameter determines if the new database is opened read-only, read-write, read-write and created if it does not exist,\n    /// or that the database is a pure in-memory database that never interacts with disk, respectively.\n    case mode(FileMode)\n\n    /// The nolock query parameter is a boolean that disables all calls to the `xLock`, ` xUnlock`, and `xCheckReservedLock` methods\n    /// of the VFS when true.\n    case nolock(Bool)\n\n    /// The psow query parameter overrides the `powersafe_overwrite` property of the database file being opened.\n    case powersafeOverwrite(Bool)\n\n    /// The vfs query parameter causes the database connection to be opened using the VFS called NAME.\n    case vfs(String)\n\n    public var description: String {\n        queryItem.description\n    }\n\n    var queryItem: URLQueryItem {\n        switch self {\n        case .cache(let mode): return .init(name: \"cache\", value: mode.rawValue)\n        case .immutable(let bool): return .init(name: \"immutable\", value: NSNumber(value: bool).description)\n        case .modeOf(let filename): return .init(name: \"modeOf\", value: filename)\n        case .mode(let fileMode): return .init(name: \"mode\", value: fileMode.rawValue)\n        case .nolock(let bool): return .init(name: \"nolock\", value: NSNumber(value: bool).description)\n        case .powersafeOverwrite(let bool): return .init(name: \"psow\", value: NSNumber(value: bool).description)\n        case .vfs(let name): return .init(name: \"vfs\", value: name)\n        }\n    }\n}\n"
  },
  {
    "path": "Sources/SQLite/Core/Value.swift",
    "content": "//\n// SQLite.swift\n// https://github.com/stephencelis/SQLite.swift\n// Copyright © 2014-2015 Stephen Celis.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\n/// - Warning: `Binding` is a protocol that SQLite.swift uses internally to\n///   directly map SQLite types to Swift types.\n///\n///   Do not conform custom types to the Binding protocol. See the `Value`\n///   protocol, instead.\npublic protocol Binding: Sendable {}\n\npublic protocol Number: Binding {}\n\npublic protocol Value: Expressible { // extensions cannot have inheritance clauses\n\n    associatedtype ValueType = Self\n\n    associatedtype Datatype: Binding\n\n    static var declaredDatatype: String { get }\n\n    static func fromDatatypeValue(_ datatypeValue: Datatype) throws -> ValueType\n\n    var datatypeValue: Datatype { get }\n\n}\n\nextension Double: Number, Value {\n\n    public static let declaredDatatype = \"REAL\"\n\n    public static func fromDatatypeValue(_ datatypeValue: Double) -> Double {\n        datatypeValue\n    }\n\n    public var datatypeValue: Double {\n        self\n    }\n\n}\n\nextension Int64: Number, Value {\n\n    public static let declaredDatatype = \"INTEGER\"\n\n    public static func fromDatatypeValue(_ datatypeValue: Int64) -> Int64 {\n        datatypeValue\n    }\n\n    public var datatypeValue: Int64 {\n        self\n    }\n\n}\n\nextension String: Binding, Value {\n\n    public static let declaredDatatype = \"TEXT\"\n\n    public static func fromDatatypeValue(_ datatypeValue: String) -> String {\n        datatypeValue\n    }\n\n    public var datatypeValue: String {\n        self\n    }\n\n}\n\nextension Blob: Binding, Value {\n\n    public static let declaredDatatype = \"BLOB\"\n\n    public static func fromDatatypeValue(_ datatypeValue: Blob) -> Blob {\n        datatypeValue\n    }\n\n    public var datatypeValue: Blob {\n        self\n    }\n\n}\n\n// MARK: -\n\nextension Bool: Binding, Value {\n\n    public static var declaredDatatype = Int64.declaredDatatype\n\n    public static func fromDatatypeValue(_ datatypeValue: Int64) -> Bool {\n        datatypeValue != 0\n    }\n\n    public var datatypeValue: Int64 {\n        self ? 1 : 0\n    }\n\n}\n\nextension Int: Number, Value {\n\n    public static var declaredDatatype = Int64.declaredDatatype\n\n    public static func fromDatatypeValue(_ datatypeValue: Int64) -> Int {\n        Int(datatypeValue)\n    }\n\n    public var datatypeValue: Int64 {\n        Int64(self)\n    }\n\n}\n"
  },
  {
    "path": "Sources/SQLite/Extensions/Cipher.swift",
    "content": "#if SQLCipher\nimport SQLCipher\n\n/// Extension methods for [SQLCipher](https://www.zetetic.net/sqlcipher/).\n/// @see [sqlcipher api](https://www.zetetic.net/sqlcipher/sqlcipher-api/)\nextension Connection {\n\n    /// Granularitly of SQLCipher log outputs\n    /// Each log level is more verbose than the last\n    ///\n    /// See https://www.zetetic.net/sqlcipher/sqlcipher-api/#cipher_log_level\n    public enum CipherLogLevel: String {\n        case none\n        case error\n        case warn\n        case info\n        case debug\n        case trace\n    }\n\n    /// - Returns: the SQLCipher version\n    ///\n    /// See https://www.zetetic.net/sqlcipher/sqlcipher-api/#cipher_version\n    public var cipherVersion: String? {\n        (try? scalar(\"PRAGMA cipher_version\")) as? String\n    }\n\n    /// - Returns: the SQLCipher fips status: 1 for fips mode, 0 for non-fips mode\n    /// The FIPS status will not be initialized until the database connection has been keyed\n    /// See https://www.zetetic.net/sqlcipher/sqlcipher-api/#cipher_fips_status\n    public var cipherFipsStatus: String? {\n        (try? scalar(\"PRAGMA cipher_fips_status\")) as? String\n    }\n\n    /// - Returns: The compiled crypto provider.\n    /// The database must be keyed before requesting the name of the crypto provider.\n    ///\n    /// See https://www.zetetic.net/sqlcipher/sqlcipher-api/#cipher_provider\n    public var cipherProvider: String? {\n        (try? scalar(\"PRAGMA cipher_provider\")) as? String\n    }\n\n    /// - Returns: the version number provided from the compiled crypto provider.\n    /// This value, if known, is available only after the database has been keyed.\n    ///\n    /// See https://www.zetetic.net/sqlcipher/sqlcipher-api/#cipher_provider_version\n    public var cipherProviderVersion: String? {\n        (try? scalar(\"PRAGMA cipher_provider_version\")) as? String\n    }\n\n    /// Specify the key for an encrypted database.  This routine should be\n    /// called right after sqlite3_open().\n    ///\n    /// @param key The key to use.The key itself can be a passphrase, which is converted to a key\n    ///            using [PBKDF2](https://en.wikipedia.org/wiki/PBKDF2) key derivation. The result\n    ///            is used as the encryption key for the database.\n    ///\n    ///            Alternatively, it is possible to specify an exact byte sequence using a blob literal.\n    ///            With this method, it is the calling application's responsibility to ensure that the data\n    ///            provided is a 64 character hex string, which will be converted directly to 32 bytes (256 bits)\n    ///            of key data.\n    ///            e.g. x'2DD29CA851E7B56E4697B0E1F08507293D761A05CE4D1B628663F411A8086D99'\n    /// @param db name of the database, defaults to 'main'\n    ///\n    /// See https://www.zetetic.net/sqlcipher/sqlcipher-api/#sqlite3_key\n    public func key(_ key: String, db: String = \"main\") throws {\n        try _key_v2(db: db, keyPointer: key, keySize: key.utf8.count)\n    }\n\n    public func key(_ key: Blob, db: String = \"main\") throws {\n        try _key_v2(db: db, keyPointer: key.bytes, keySize: key.bytes.count)\n    }\n\n    /// Same as `key(_ key: String, db: String = \"main\")`, running \"PRAGMA cipher_migrate;\"\n    /// immediately after calling `sqlite3_key_v2`, which performs the migration of\n    /// SQLCipher database created by older major version of SQLCipher, to be able to\n    /// open this database with new major version of SQLCipher\n    /// (e.g. to open database created by SQLCipher version 3.x.x with SQLCipher version 4.x.x).\n    /// As \"PRAGMA cipher_migrate;\" is time-consuming, it is recommended to use this function\n    /// only after failure of `key(_ key: String, db: String = \"main\")`, if older versions of\n    /// your app may ise older version of SQLCipher\n    ///\n    /// See https://www.zetetic.net/sqlcipher/sqlcipher-api/#cipher_migrate\n    /// and https://discuss.zetetic.net/t/upgrading-to-sqlcipher-4/3283\n    /// for more details regarding SQLCipher upgrade\n    public func keyAndMigrate(_ key: String, db: String = \"main\") throws {\n        try _key_v2(db: db, keyPointer: key, keySize: key.utf8.count, migrate: true)\n    }\n\n    /// Same as `[`keyAndMigrate(_ key: String, db: String = \"main\")` accepting byte array as key\n    public func keyAndMigrate(_ key: Blob, db: String = \"main\") throws {\n        try _key_v2(db: db, keyPointer: key.bytes, keySize: key.bytes.count, migrate: true)\n    }\n\n    /// Change the key on an open database. NB: only works if the database is already encrypted.\n    ///\n    /// To change the key on an existing encrypted database, it must first be unlocked with the\n    /// current encryption key. Once the database is readable and writeable, rekey can be used\n    /// to re-encrypt every page in the database with a new key.\n    ///\n    /// See https://www.zetetic.net/sqlcipher/sqlcipher-api/#sqlite3_rekey\n    public func rekey(_ key: String, db: String = \"main\") throws {\n        try _rekey_v2(db: db, keyPointer: key, keySize: key.utf8.count)\n    }\n\n    public func rekey(_ key: Blob, db: String = \"main\") throws {\n        try _rekey_v2(db: db, keyPointer: key.bytes, keySize: key.bytes.count)\n    }\n\n    /// Converts a non-encrypted database to an encrypted one.\n    ///\n    /// See https://www.zetetic.net/sqlcipher/sqlcipher-api/#sqlcipher_export\n    public func sqlcipher_export(_ location: Location, key: String) throws {\n        let schemaName = \"cipher_export\"\n\n        try attach(location, as: schemaName, key: key)\n        try run(\"SELECT sqlcipher_export(?)\", schemaName)\n        try detach(schemaName)\n    }\n\n    /// When using Commercial or Enterprise SQLCipher packages you must call\n    /// `PRAGMA cipher_license` with a valid license code prior to executing\n    /// cryptographic operations on an encrypted database.\n    /// Failure to provide a license code, or use of an expired trial code,\n    /// will result in an `SQLITE_AUTH (23)` error code reported from the SQLite API\n    /// License Codes will activate SQLCipher Commercial or Enterprise packages\n    /// from Zetetic: https://www.zetetic.net/sqlcipher/buy/\n    /// 15-day free trials are available by request: https://www.zetetic.net/sqlcipher/trial/\n    ///\n    /// See https://www.zetetic.net/sqlcipher/sqlcipher-api/#cipher_license\n    /// - Parameter license: base64 SQLCipher license code to activate SQLCipher commercial\n    public func applyLicense(_ license: String) throws {\n        try run(\"PRAGMA cipher_license = '\\(license)'\")\n    }\n\n    /// Instructs SQLCipher to log internal debugging and operational information\n    /// to the sepecified log target (device) using `os_log`\n    /// The supplied logLevel will determine the granularity of the logs output\n    /// Available logLevel options are: NONE, ERROR, WARN, INFO, DEBUG, TRACE\n    /// Note that each level is more verbose than the last,\n    /// and particularly with DEBUG and TRACE the logging system will generate\n    /// a significant log volume\n    ///\n    /// See https://www.zetetic.net/sqlcipher/sqlcipher-api/#cipher_log\n    /// - Parameter logLevel: CipherLogLevel The granularity to use for the logging system - defaults to `DEBUG`\n    public func enableCipherLogging(logLevel: CipherLogLevel = .debug) throws {\n        try run(\"PRAGMA cipher_log = device\")\n        try run(\"PRAGMA cipher_log_level = \\(logLevel.rawValue.uppercased())\")\n    }\n\n    /// Instructs SQLCipher to disable logging internal debugging and operational information\n    ///\n    /// See https://www.zetetic.net/sqlcipher/sqlcipher-api/#cipher_log\n    public func disableCipherLogging() throws {\n        try run(\"PRAGMA cipher_log_level = \\(CipherLogLevel.none.rawValue.uppercased())\")\n    }\n\n    // MARK: - private\n    private func _key_v2(db: String,\n                         keyPointer: UnsafePointer<UInt8>,\n                         keySize: Int,\n                         migrate: Bool = false) throws {\n        try check(sqlite3_key_v2(handle, db, keyPointer, Int32(keySize)))\n        if migrate {\n            // Run \"PRAGMA cipher_migrate;\" immediately after `sqlite3_key_v2`\n            // per recommendation of SQLCipher authors\n            let migrateResult = try scalar(\"PRAGMA cipher_migrate;\")\n            if (migrateResult as? String) != \"0\" {\n                // \"0\" is the result of successful migration\n                throw Result.error(message: \"Error in cipher migration, result \\(migrateResult.debugDescription)\", code: 1, statement: nil)\n            }\n        }\n        try cipher_key_check()\n    }\n\n    private func _rekey_v2(db: String, keyPointer: UnsafePointer<UInt8>, keySize: Int) throws {\n        try check(sqlite3_rekey_v2(handle, db, keyPointer, Int32(keySize)))\n    }\n\n    // When opening an existing database, sqlite3_key_v2 will not immediately throw an error if\n    // the key provided is incorrect. To test that the database can be successfully opened with the\n    // provided key, it is necessary to perform some operation on the database (i.e. read from it).\n    private func cipher_key_check() throws {\n        _ = try scalar(\"SELECT count(*) FROM sqlite_master;\")\n    }\n}\n#endif\n"
  },
  {
    "path": "Sources/SQLite/Extensions/FTS4.swift",
    "content": "//\n// SQLite.swift\n// https://github.com/stephencelis/SQLite.swift\n// Copyright © 2014-2015 Stephen Celis.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nextension Module {\n\n    public static func FTS4(_ column: Expressible, _ more: Expressible...) -> Module {\n        FTS4([column] + more)\n    }\n\n    public static func FTS4(_ columns: [Expressible] = [], tokenize tokenizer: Tokenizer? = nil) -> Module {\n        FTS4(FTS4Config().columns(columns).tokenizer(tokenizer))\n    }\n\n    public static func FTS4(_ config: FTS4Config) -> Module {\n        Module(name: \"fts4\", arguments: config.arguments())\n    }\n}\n\nextension VirtualTable {\n\n    /// Builds an expression appended with a `MATCH` query against the given\n    /// pattern.\n    ///\n    ///     let emails = VirtualTable(\"emails\")\n    ///\n    ///     emails.filter(emails.match(\"Hello\"))\n    ///     // SELECT * FROM \"emails\" WHERE \"emails\" MATCH 'Hello'\n    ///\n    /// - Parameter pattern: A pattern to match.\n    ///\n    /// - Returns: An expression appended with a `MATCH` query against the given\n    ///   pattern.\n    public func match(_ pattern: String) -> Expression<Bool> {\n        \"MATCH\".infix(tableName(), pattern)\n    }\n\n    public func match(_ pattern: Expression<String>) -> Expression<Bool> {\n        \"MATCH\".infix(tableName(), pattern)\n    }\n\n    public func match(_ pattern: Expression<String?>) -> Expression<Bool?> {\n        \"MATCH\".infix(tableName(), pattern)\n    }\n\n    /// Builds a copy of the query with a `WHERE … MATCH` clause.\n    ///\n    ///     let emails = VirtualTable(\"emails\")\n    ///\n    ///     emails.match(\"Hello\")\n    ///     // SELECT * FROM \"emails\" WHERE \"emails\" MATCH 'Hello'\n    ///\n    /// - Parameter pattern: A pattern to match.\n    ///\n    /// - Returns: A query with the given `WHERE … MATCH` clause applied.\n    public func match(_ pattern: String) -> QueryType {\n        filter(match(pattern))\n    }\n\n    public func match(_ pattern: Expression<String>) -> QueryType {\n        filter(match(pattern))\n    }\n\n    public func match(_ pattern: Expression<String?>) -> QueryType {\n        filter(match(pattern))\n    }\n\n}\n\n// swiftlint:disable identifier_name\npublic struct Tokenizer {\n\n    public static let Simple = Tokenizer(\"simple\")\n    public static let Porter = Tokenizer(\"porter\")\n\n    public static func Unicode61(removeDiacritics: Bool? = nil,\n                                 tokenchars: Set<Character> = [],\n                                 separators: Set<Character> = []) -> Tokenizer {\n        var arguments = [String]()\n\n        if let removeDiacritics {\n            arguments.append(\"remove_diacritics=\\(removeDiacritics ? 1 : 0)\")\n        }\n\n        if !tokenchars.isEmpty {\n            let joined = tokenchars.map { String($0) }.joined(separator: \"\")\n            arguments.append(\"tokenchars=\\(joined)\")\n        }\n\n        if !separators.isEmpty {\n            let joined = separators.map { String($0) }.joined(separator: \"\")\n            arguments.append(\"separators=\\(joined)\")\n        }\n\n        return Tokenizer(\"unicode61\", arguments)\n    }\n\n    // https://sqlite.org/fts5.html#the_experimental_trigram_tokenizer\n    public static func Trigram(caseSensitive: Bool = false) -> Tokenizer {\n        Tokenizer(\"trigram\", [\"case_sensitive\", caseSensitive ? \"1\" : \"0\"])\n    }\n\n    public static func Custom(_ name: String) -> Tokenizer {\n        Tokenizer(Tokenizer.moduleName.quote(), [name.quote()])\n    }\n\n    public let name: String\n\n    public let arguments: [String]\n\n    fileprivate init(_ name: String, _ arguments: [String] = []) {\n        self.name = name\n        self.arguments = arguments\n    }\n\n    fileprivate static let moduleName = \"SQLite.swift\"\n\n}\n\nextension Tokenizer: CustomStringConvertible {\n\n    public var description: String {\n        if arguments.isEmpty {\n            name\n        } else {\n            ([name] + arguments).joined(separator: \" \").quote()\n        }\n    }\n\n}\n\n/// Configuration options shared between the [FTS4](https://www.sqlite.org/fts3.html) and\n/// [FTS5](https://www.sqlite.org/fts5.html) extensions.\nopen class FTSConfig {\n    public enum ColumnOption {\n        /// [The notindexed= option](https://www.sqlite.org/fts3.html#section_6_5)\n        case unindexed\n    }\n\n    typealias ColumnDefinition = (Expressible, options: [ColumnOption])\n    var columnDefinitions = [ColumnDefinition]()\n    var tokenizer: Tokenizer?\n    var prefixes = [Int]()\n    var externalContentSchema: SchemaType?\n    var isContentless: Bool = false\n\n    /// Adds a column definition\n    @discardableResult open func column(_ column: Expressible, _ options: [ColumnOption] = []) -> Self {\n        columnDefinitions.append((column, options))\n        return self\n    }\n\n    @discardableResult open func columns(_ columns: [Expressible]) -> Self {\n        for column in columns {\n            self.column(column)\n        }\n        return self\n    }\n\n    /// [Tokenizers](https://www.sqlite.org/fts3.html#tokenizer)\n    @discardableResult open func tokenizer(_ tokenizer: Tokenizer?) -> Self {\n        self.tokenizer = tokenizer\n        return self\n    }\n\n    /// [The prefix= option](https://www.sqlite.org/fts3.html#section_6_6)\n    @discardableResult open func prefix(_ prefix: [Int]) -> Self {\n        prefixes += prefix\n        return self\n    }\n\n    /// [The content= option](https://www.sqlite.org/fts3.html#section_6_2)\n    @discardableResult open func externalContent(_ schema: SchemaType) -> Self {\n        externalContentSchema = schema\n        return self\n    }\n\n    /// [Contentless FTS4 Tables](https://www.sqlite.org/fts3.html#section_6_2_1)\n    @discardableResult open func contentless() -> Self {\n        isContentless = true\n        return self\n    }\n\n    func formatColumnDefinitions() -> [Expressible] {\n        columnDefinitions.map { $0.0 }\n    }\n\n    func arguments() -> [Expressible] {\n        options().arguments\n    }\n\n    func options() -> Options {\n        var options = Options()\n        options.append(formatColumnDefinitions())\n        if let tokenizer {\n            options.append(\"tokenize\", value: Expression<Void>(literal: tokenizer.description))\n        }\n        options.appendCommaSeparated(\"prefix\", values: prefixes.sorted().map { String($0) })\n        if isContentless {\n            options.append(\"content\", value: \"\")\n        } else if let externalContentSchema {\n            options.append(\"content\", value: externalContentSchema.tableName())\n        }\n        return options\n    }\n\n    struct Options {\n        var arguments = [Expressible]()\n\n        @discardableResult mutating func append(_ columns: [Expressible]) -> Options {\n            arguments.append(contentsOf: columns)\n            return self\n        }\n\n        @discardableResult mutating func appendCommaSeparated(_ key: String, values: [String]) -> Options {\n            if values.isEmpty {\n                return self\n            } else {\n                return append(key, value: values.joined(separator: \",\"))\n            }\n        }\n\n        @discardableResult mutating func append(_ key: String, value: String) -> Options {\n            append(key, value: Expression<String>(value))\n        }\n\n        @discardableResult mutating func append(_ key: String, value: Expressible) -> Options {\n            arguments.append(\"=\".join([Expression<Void>(literal: key), value]))\n            return self\n        }\n    }\n}\n\n/// Configuration for the [FTS4](https://www.sqlite.org/fts3.html) extension.\nopen class FTS4Config: FTSConfig {\n    /// [The matchinfo= option](https://www.sqlite.org/fts3.html#section_6_4)\n    public enum MatchInfo: String {\n        case fts3\n    }\n\n    /// [FTS4 options](https://www.sqlite.org/fts3.html#fts4_options)\n    public enum Order: String {\n        /// Data structures are optimized for returning results in ascending order by docid (default)\n        case asc\n        /// FTS4 stores its data in such a way as to optimize returning results in descending order by docid.\n        case desc\n    }\n\n    var compressFunction: String?\n    var uncompressFunction: String?\n    var languageId: String?\n    var matchInfo: MatchInfo?\n    var order: Order?\n\n    override public init() {\n    }\n\n    /// [The compress= and uncompress= options](https://www.sqlite.org/fts3.html#section_6_1)\n    @discardableResult open func compress(_ functionName: String) -> Self {\n        compressFunction = functionName\n        return self\n    }\n\n    /// [The compress= and uncompress= options](https://www.sqlite.org/fts3.html#section_6_1)\n    @discardableResult open func uncompress(_ functionName: String) -> Self {\n        uncompressFunction = functionName\n        return self\n    }\n\n    /// [The languageid= option](https://www.sqlite.org/fts3.html#section_6_3)\n    @discardableResult open func languageId(_ columnName: String) -> Self {\n        languageId = columnName\n        return self\n    }\n\n    /// [The matchinfo= option](https://www.sqlite.org/fts3.html#section_6_4)\n    @discardableResult open func matchInfo(_ matchInfo: MatchInfo) -> Self {\n        self.matchInfo = matchInfo\n        return self\n    }\n\n    /// [FTS4 options](https://www.sqlite.org/fts3.html#fts4_options)\n    @discardableResult open func order(_ order: Order) -> Self {\n        self.order = order\n        return self\n    }\n\n    override func options() -> Options {\n        var options = super.options()\n        for (column, _) in (columnDefinitions.filter { $0.options.contains(.unindexed) }) {\n            options.append(\"notindexed\", value: column)\n        }\n        if let languageId {\n            options.append(\"languageid\", value: languageId)\n        }\n        if let compressFunction {\n            options.append(\"compress\", value: compressFunction)\n        }\n        if let uncompressFunction {\n            options.append(\"uncompress\", value: uncompressFunction)\n        }\n        if let matchInfo {\n            options.append(\"matchinfo\", value: matchInfo.rawValue)\n        }\n        if let order {\n            options.append(\"order\", value: order.rawValue)\n        }\n        return options\n    }\n}\n"
  },
  {
    "path": "Sources/SQLite/Extensions/FTS5.swift",
    "content": "//\n// SQLite.swift\n// https://github.com/stephencelis/SQLite.swift\n// Copyright © 2014-2015 Stephen Celis.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nextension Module {\n    public static func FTS5(_ config: FTS5Config) -> Module {\n        Module(name: \"fts5\", arguments: config.arguments())\n    }\n}\n\n/// Configuration for the [FTS5](https://www.sqlite.org/fts5.html) extension.\n///\n/// **Note:** this is currently only applicable when using SQLite.swift together with a FTS5-enabled version\n/// of SQLite.\nopen class FTS5Config: FTSConfig {\n    public enum Detail: String {\n        /// store rowid, column number, term offset\n        case full\n        /// store rowid, column number\n        case column\n        /// store rowid\n        case none\n    }\n\n    var detail: Detail?\n    var contentRowId: Expressible?\n    var columnSize: Int?\n\n    override public init() {\n    }\n\n    /// [External Content Tables](https://www.sqlite.org/fts5.html#section_4_4_2)\n    @discardableResult open func contentRowId(_ column: Expressible) -> Self {\n        contentRowId = column\n        return self\n    }\n\n    /// [The Columnsize Option](https://www.sqlite.org/fts5.html#section_4_5)\n    @discardableResult open func columnSize(_ size: Int) -> Self {\n        columnSize = size\n        return self\n    }\n\n    /// [The Detail Option](https://www.sqlite.org/fts5.html#section_4_6)\n    @discardableResult open func detail(_ detail: Detail) -> Self {\n        self.detail = detail\n        return self\n    }\n\n    override func options() -> Options {\n        var options = super.options()\n        if let contentRowId {\n            options.append(\"content_rowid\", value: contentRowId)\n        }\n        if let columnSize {\n            options.append(\"columnsize\", value: Expression<Int>(value: columnSize))\n        }\n        if let detail {\n            options.append(\"detail\", value: detail.rawValue)\n        }\n        return options\n    }\n\n    override func formatColumnDefinitions() -> [Expressible] {\n        columnDefinitions.map { definition in\n            if definition.options.contains(.unindexed) {\n                return \" \".join([definition.0, Expression<Void>(literal: \"UNINDEXED\")])\n            } else {\n                return definition.0\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "Sources/SQLite/Extensions/RTree.swift",
    "content": "//\n// SQLite.swift\n// https://github.com/stephencelis/SQLite.swift\n// Copyright © 2014-2015 Stephen Celis.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nextension Module {\n    public static func RTree<T: Value, U: Value>(_ primaryKey: Expression<T>,\n                                                 _ pairs: (Expression<U>, Expression<U>)...)\n                    -> Module where T.Datatype == Int64, U.Datatype == Double {\n        var arguments: [Expressible] = [primaryKey]\n\n        for pair in pairs {\n            arguments.append(contentsOf: [pair.0, pair.1] as [Expressible])\n        }\n\n        return Module(name: \"rtree\", arguments: arguments)\n    }\n}\n"
  },
  {
    "path": "Sources/SQLite/Foundation.swift",
    "content": "//\n// SQLite.swift\n// https://github.com/stephencelis/SQLite.swift\n// Copyright © 2014-2015 Stephen Celis.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport Foundation\n\nextension Data: Value {\n\n    public static var declaredDatatype: String {\n        Blob.declaredDatatype\n    }\n\n    public static func fromDatatypeValue(_ dataValue: Blob) -> Data {\n        Data(dataValue.bytes)\n    }\n\n    public var datatypeValue: Blob {\n        withUnsafeBytes { (pointer: UnsafeRawBufferPointer) -> Blob in\n            Blob(bytes: pointer.baseAddress!, length: count)\n        }\n    }\n\n}\n\nextension Date: Value {\n\n    public static var declaredDatatype: String {\n        String.declaredDatatype\n    }\n\n    public static func fromDatatypeValue(_ stringValue: String) -> Date {\n        dateFormatter.date(from: stringValue)!\n    }\n\n    public var datatypeValue: String {\n        dateFormatter.string(from: self)\n    }\n\n}\n\n/// A global date formatter used to serialize and deserialize `NSDate` objects.\n/// If multiple date formats are used in an application’s database(s), use a\n/// custom `Value` type per additional format.\npublic var dateFormatter: DateFormatter = {\n    let formatter = DateFormatter()\n    formatter.dateFormat = \"yyyy-MM-dd'T'HH:mm:ss.SSS\"\n    formatter.locale = Locale(identifier: \"en_US_POSIX\")\n    formatter.timeZone = TimeZone(secondsFromGMT: 0)\n    return formatter\n}()\n\nextension UUID: Value {\n\n    public static var declaredDatatype: String {\n        String.declaredDatatype\n    }\n\n    public static func fromDatatypeValue(_ stringValue: String) -> UUID {\n        UUID(uuidString: stringValue)!\n    }\n\n    public var datatypeValue: String {\n        uuidString\n    }\n\n}\n\nextension URL: Value {\n\n    public static var declaredDatatype: String {\n        String.declaredDatatype\n    }\n\n    public static func fromDatatypeValue(_ stringValue: String) -> URL {\n        URL(string: stringValue)!\n    }\n\n    public var datatypeValue: String {\n        absoluteString\n    }\n\n}\n"
  },
  {
    "path": "Sources/SQLite/Helpers.swift",
    "content": "//\n// SQLite.swift\n// https://github.com/stephencelis/SQLite.swift\n// Copyright © 2014-2015 Stephen Celis.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\n#if StandaloneSQLite\nimport sqlite3\n#elseif SQLCipher\nimport SQLCipher\n#elseif SQLiteSwiftCSQLite\nimport SQLiteSwiftCSQLite\n#else\nimport SQLite3 // SystemSQLite\n#endif\n\npublic typealias Star = (Expression<Binding>?, Expression<Binding>?) -> Expression<Void>\n\npublic func *(_: Expression<Binding>?, _: Expression<Binding>?) -> Expression<Void> {\n    Expression(literal: \"*\")\n}\n\n// swiftlint:disable:next type_name\npublic protocol _OptionalType {\n\n    associatedtype WrappedType\n\n}\n\nextension Optional: _OptionalType {\n\n    public typealias WrappedType = Wrapped\n\n}\n\n// let SQLITE_STATIC = unsafeBitCast(0, sqlite3_destructor_type.self)\nlet SQLITE_TRANSIENT = unsafeBitCast(-1, to: sqlite3_destructor_type.self)\n\nextension String {\n    func quote(_ mark: Character = \"\\\"\") -> String {\n        var quoted = \"\"\n        quoted.append(mark)\n        for character in self {\n            quoted.append(character)\n            if character == mark {\n                quoted.append(character)\n            }\n        }\n        quoted.append(mark)\n        return quoted\n    }\n\n    func join(_ expressions: [Expressible]) -> Expressible {\n        var (template, bindings) = ([String](), [Binding?]())\n        for expressible in expressions {\n            let expression = expressible.expression\n            template.append(expression.template)\n            bindings.append(contentsOf: expression.bindings)\n        }\n        return Expression<Void>(template.joined(separator: self), bindings)\n    }\n\n    func infix<T>(_ lhs: Expressible, _ rhs: Expressible, wrap: Bool = true) -> Expression<T> {\n        infix([lhs, rhs], wrap: wrap)\n    }\n\n    func infix<T>(_ terms: [Expressible], wrap: Bool = true) -> Expression<T> {\n        let expression = Expression<T>(\" \\(self) \".join(terms).expression)\n        guard wrap else {\n            return expression\n        }\n        return \"\".wrap(expression)\n    }\n\n    func prefix(_ expressions: Expressible) -> Expressible {\n        \"\\(self) \".wrap(expressions) as Expression<Void>\n    }\n\n    func prefix(_ expressions: [Expressible]) -> Expressible {\n        \"\\(self) \".wrap(expressions) as Expression<Void>\n    }\n\n    func wrap<T>(_ expression: Expressible) -> Expression<T> {\n        Expression(\"\\(self)(\\(expression.expression.template))\", expression.expression.bindings)\n    }\n\n    func wrap<T>(_ expressions: [Expressible]) -> Expression<T> {\n        wrap(\", \".join(expressions))\n    }\n\n}\n\nfunc transcode(_ literal: Binding?) -> String {\n    guard let literal else { return \"NULL\" }\n\n    switch literal {\n    case let blob as Blob:\n        return blob.description\n    case let string as String:\n        return string.quote(\"'\")\n    case let binding:\n        return \"\\(binding)\"\n    }\n}\n\n// swiftlint:disable force_cast force_try\nfunc value<A: Value>(_ binding: Binding) -> A {\n    try! A.fromDatatypeValue(binding as! A.Datatype) as! A\n}\n\nfunc value<A: Value>(_ binding: Binding?) -> A {\n    value(binding!)\n}\n"
  },
  {
    "path": "Sources/SQLite/Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>CFBundleDevelopmentRegion</key>\n\t<string>en</string>\n\t<key>CFBundleExecutable</key>\n\t<string>$(EXECUTABLE_NAME)</string>\n\t<key>CFBundleIdentifier</key>\n\t<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>\n\t<key>CFBundleInfoDictionaryVersion</key>\n\t<string>6.0</string>\n\t<key>CFBundleName</key>\n\t<string>$(PRODUCT_NAME)</string>\n\t<key>CFBundlePackageType</key>\n\t<string>FMWK</string>\n\t<key>CFBundleShortVersionString</key>\n\t<string>$(MARKETING_VERSION)</string>\n\t<key>CFBundleSignature</key>\n\t<string>????</string>\n\t<key>CFBundleVersion</key>\n\t<string>$(CURRENT_PROJECT_VERSION)</string>\n\t<key>NSPrincipalClass</key>\n\t<string></string>\n</dict>\n</plist>\n"
  },
  {
    "path": "Sources/SQLite/PrivacyInfo.xcprivacy",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>NSPrivacyTrackingDomains</key>\n\t<array/>\n\t<key>NSPrivacyCollectedDataTypes</key>\n\t<array/>\n\t<key>NSPrivacyAccessedAPITypes</key>\n\t<array/>\n\t<key>NSPrivacyTracking</key>\n\t<false/>\n</dict>\n</plist>\n"
  },
  {
    "path": "Sources/SQLite/SQLite.h",
    "content": "@import Foundation;\n\nFOUNDATION_EXPORT double SQLiteVersionNumber;\nFOUNDATION_EXPORT const unsigned char SQLiteVersionString[];\n"
  },
  {
    "path": "Sources/SQLite/Schema/Connection+Schema.swift",
    "content": "import Foundation\n\npublic extension Connection {\n    var schema: SchemaReader { SchemaReader(connection: self) }\n\n    // There are four columns in each result row.\n    // The first column is the name of the table that\n    // contains the REFERENCES clause.\n    // The second column is the rowid of the row that contains the\n    // invalid REFERENCES clause, or NULL if the child table is a WITHOUT ROWID table.\n    // The third column is the name of the table that is referred to.\n    // The fourth column is the index of the specific foreign key constraint that failed.\n    //\n    // https://sqlite.org/pragma.html#pragma_foreign_key_check\n    func foreignKeyCheck(table: String? = nil) throws -> [ForeignKeyError] {\n        try run(\"PRAGMA foreign_key_check\" + (table.map { \"(\\($0.quote()))\" } ?? \"\"))\n            .compactMap { (row: [Binding?]) -> ForeignKeyError? in\n                guard let table = row[0] as? String,\n                      let rowId = row[1] as? Int64,\n                      let target = row[2] as? String else { return nil }\n\n                return ForeignKeyError(from: table, rowId: rowId, to: target)\n            }\n    }\n\n    // This pragma does a low-level formatting and consistency check of the database.\n    // https://sqlite.org/pragma.html#pragma_integrity_check\n    func integrityCheck(table: String? = nil) throws -> [String] {\n        precondition(table == nil || supports(.partialIntegrityCheck), \"partial integrity check not supported\")\n\n        return try run(\"PRAGMA integrity_check\" + (table.map { \"(\\($0.quote()))\" } ?? \"\"))\n            .compactMap { $0[0] as? String }\n            .filter { $0 != \"ok\" }\n    }\n}\n"
  },
  {
    "path": "Sources/SQLite/Schema/SchemaChanger.swift",
    "content": "import Foundation\n\n/*\n    https://www.sqlite.org/lang_altertable.html\n\n   The only schema altering commands directly supported by SQLite are the \"rename table\" and \"add column\"\n   commands shown above.\n\n    (SQLite 3.25.0: RENAME COLUMN)\n    (SQLite 3.35.0: DROP COLUMN)\n\n   However, applications can make other arbitrary changes to the format of a table using a\n   simple sequence of operations. The steps to make arbitrary changes to the schema design of some table X are as follows:\n\n        1. If foreign key constraints are enabled, disable them using PRAGMA foreign_keys=OFF.\n        2. Start a transaction.\n        3. Remember the format of all indexes and triggers associated with table X\n           (SELECT sql FROM sqlite_master WHERE tbl_name='X' AND type='index')\n        4. Use CREATE TABLE to construct a new table \"new_X\" that is in the desired revised format of table X.\n        5. Transfer content from X into new_X using a statement like: INSERT INTO new_X SELECT ... FROM X.\n        6. Drop the old table X: DROP TABLE X.\n        7. Change the name of new_X to X using: ALTER TABLE new_X RENAME TO X.\n        8. Use CREATE INDEX and CREATE TRIGGER to reconstruct indexes and triggers associated with table X.\n        9. If any views refer to table X in a way that is affected by the schema change, then drop those views using DROP VIEW\n       10. If foreign key constraints were originally enabled then run PRAGMA foreign_key_check\n       11. Commit the transaction started in step 2.\n       12. If foreign keys constraints were originally enabled, reenable them now.\n*/\npublic class SchemaChanger: CustomStringConvertible {\n    public enum Error: LocalizedError {\n        case invalidColumnDefinition(String)\n        case foreignKeyError([ForeignKeyError])\n\n        public var errorDescription: String? {\n            switch self {\n            case .foreignKeyError(let errors):\n                return \"Foreign key errors: \\(errors)\"\n            case .invalidColumnDefinition(let message):\n                return \"Invalid column definition: \\(message)\"\n            }\n        }\n    }\n\n    public enum Operation {\n        case addColumn(ColumnDefinition)\n        case addIndex(IndexDefinition, ifNotExists: Bool)\n        case dropColumn(String)\n        case dropIndex(String, ifExists: Bool)\n        case renameColumn(String, String)\n        case renameTable(String)\n        case createTable(columns: [ColumnDefinition], ifNotExists: Bool)\n\n        /// Returns non-nil if the operation can be executed with a simple SQL statement\n        func toSQL(_ table: String, version: SQLiteVersion) -> String? {\n            switch self {\n            case .addColumn(let definition):\n                return \"ALTER TABLE \\(table.quote()) ADD COLUMN \\(definition.toSQL())\"\n            case .addIndex(let definition, let ifNotExists):\n                return definition.toSQL(ifNotExists: ifNotExists)\n            case .renameColumn(let from, let to) where SQLiteFeature.renameColumn.isSupported(by: version):\n                return \"ALTER TABLE \\(table.quote()) RENAME COLUMN \\(from.quote()) TO \\(to.quote())\"\n            case .dropColumn(let column) where SQLiteFeature.dropColumn.isSupported(by: version):\n                return \"ALTER TABLE \\(table.quote()) DROP COLUMN \\(column.quote())\"\n            case .dropIndex(let name, let ifExists):\n                return \"DROP INDEX \\(ifExists ? \" IF EXISTS \" : \"\") \\(name.quote())\"\n            case .createTable(let columns, let ifNotExists):\n                return \"CREATE TABLE \\(ifNotExists ? \" IF NOT EXISTS \" : \"\") \\(table.quote()) (\" +\n                    columns.map { $0.toSQL() }.joined(separator: \", \") +\n                \")\"\n            default: return nil\n            }\n        }\n\n        func validate() throws {\n            switch self {\n            case .addColumn(let definition):\n                // The new column may take any of the forms permissible in a CREATE TABLE statement, with the following restrictions:\n                // - The column may not have a PRIMARY KEY or UNIQUE constraint.\n                // - The column may not have a default value of CURRENT_TIME, CURRENT_DATE, CURRENT_TIMESTAMP, or an expression in parentheses\n                // - If a NOT NULL constraint is specified, then the column must have a default value other than NULL.\n                guard definition.primaryKey == nil else {\n                    throw Error.invalidColumnDefinition(\"can not add primary key column\")\n                }\n                let invalidValues: [LiteralValue] = [.CURRENT_TIME, .CURRENT_DATE, .CURRENT_TIMESTAMP]\n                if invalidValues.contains(definition.defaultValue) {\n                    throw Error.invalidColumnDefinition(\"Invalid default value\")\n                }\n                if !definition.nullable && definition.defaultValue == .NULL {\n                    throw Error.invalidColumnDefinition(\"NOT NULL columns must have a default value other than NULL\")\n                }\n            case .dropColumn:\n                // The DROP COLUMN command only works if the column is not referenced by any other parts of the schema\n                // and is not a PRIMARY KEY and does not have a UNIQUE constraint\n                break\n            default: break\n            }\n        }\n    }\n\n    public class AlterTableDefinition {\n        fileprivate var operations: [Operation] = []\n\n        public let name: String\n\n        init(name: String) {\n            self.name = name\n        }\n\n        public func add(column: ColumnDefinition) {\n            operations.append(.addColumn(column))\n        }\n\n        public func add(index: IndexDefinition, ifNotExists: Bool = false) {\n            operations.append(.addIndex(index, ifNotExists: ifNotExists))\n        }\n\n        public func drop(column: String) {\n            operations.append(.dropColumn(column))\n        }\n\n        public func drop(index: String, ifExists: Bool = false) {\n            operations.append(.dropIndex(index, ifExists: ifExists))\n        }\n\n        public func rename(column: String, to: String) {\n            operations.append(.renameColumn(column, to))\n        }\n    }\n\n    public class CreateTableDefinition {\n        fileprivate var columnDefinitions: [ColumnDefinition] = []\n        fileprivate var indexDefinitions: [IndexDefinition] = []\n\n        let name: String\n        let ifNotExists: Bool\n\n        init(name: String, ifNotExists: Bool) {\n            self.name = name\n            self.ifNotExists = ifNotExists\n        }\n\n        public func add(column: ColumnDefinition) {\n            columnDefinitions.append(column)\n        }\n\n        public func add<T>(expression: Expression<T>) where T: Value {\n            add(column: .init(name: columnName(for: expression), type: .init(expression: expression), nullable: false))\n        }\n\n        public func add<T>(expression: Expression<T?>) where T: Value {\n            add(column: .init(name: columnName(for: expression), type: .init(expression: expression), nullable: true))\n        }\n\n        public func add(index: IndexDefinition) {\n            indexDefinitions.append(index)\n        }\n\n        var operations: [Operation] {\n            precondition(!columnDefinitions.isEmpty)\n            return [\n                .createTable(columns: columnDefinitions, ifNotExists: ifNotExists)\n            ] + indexDefinitions.map { .addIndex($0, ifNotExists: ifNotExists) }\n        }\n\n        private func columnName<T>(for expression: Expression<T>) -> String {\n            switch LiteralValue(expression.template) {\n            case .stringLiteral(let string): return string\n            default: fatalError(\"expression is not a literal string value\")\n            }\n        }\n    }\n\n    private let connection: Connection\n    private let schemaReader: SchemaReader\n    private let version: SQLiteVersion\n    static let tempPrefix = \"tmp_\"\n    typealias Block = () throws -> Void\n    public typealias AlterTableDefinitionBlock = (AlterTableDefinition) -> Void\n    public typealias CreateTableDefinitionBlock = (CreateTableDefinition) -> Void\n\n    struct Options: OptionSet {\n        let rawValue: Int\n        static let `default`: Options = []\n        static let temp = Options(rawValue: 1)\n    }\n\n    public convenience init(connection: Connection) {\n        self.init(connection: connection,\n                  version: connection.sqliteVersion)\n    }\n\n    init(connection: Connection, version: SQLiteVersion) {\n        self.connection = connection\n        schemaReader = connection.schema\n        self.version = version\n    }\n\n    public func alter(table: String, block: AlterTableDefinitionBlock) throws {\n        let alterTableDefinition = AlterTableDefinition(name: table)\n        block(alterTableDefinition)\n\n        for operation in alterTableDefinition.operations {\n            try run(table: table, operation: operation)\n        }\n    }\n\n    public func create(table: String, ifNotExists: Bool = false, block: CreateTableDefinitionBlock) throws {\n        let createTableDefinition = CreateTableDefinition(name: table, ifNotExists: ifNotExists)\n        block(createTableDefinition)\n\n        for operation in createTableDefinition.operations {\n            try run(table: table, operation: operation)\n        }\n    }\n\n    public func drop(table: String, ifExists: Bool = true) throws {\n        try dropTable(table, ifExists: ifExists)\n    }\n\n    // Beginning with release 3.25.0 (2018-09-15), references to the table within trigger bodies and\n    // view definitions are also renamed.\n    public func rename(table: String, to: String) throws {\n        try connection.run(\"ALTER TABLE \\(table.quote()) RENAME TO \\(to.quote())\")\n    }\n\n    // Runs arbitrary SQL. Should only be used if no predefined operations exist.\n    @discardableResult\n    public func run(_ sql: String, _ bindings: Binding?...) throws -> Statement {\n        return try connection.run(sql, bindings)\n    }\n\n    private func run(table: String, operation: Operation) throws {\n        try operation.validate()\n\n        if let sql = operation.toSQL(table, version: version) {\n            try connection.run(sql)\n        } else {\n            try doTheTableDance(table: table, operation: operation)\n        }\n    }\n\n    private func doTheTableDance(table: String, operation: Operation) throws {\n        try connection.transaction {\n            try disableRefIntegrity {\n                let tempTable = \"\\(SchemaChanger.tempPrefix)\\(table)\"\n                try moveTable(from: table, to: tempTable, options: [.temp], operation: operation)\n                try rename(table: tempTable, to: table)\n                let foreignKeyErrors = try connection.foreignKeyCheck()\n                if foreignKeyErrors.count > 0 {\n                    throw Error.foreignKeyError(foreignKeyErrors)\n                }\n            }\n        }\n    }\n\n    private func disableRefIntegrity(block: Block) throws {\n        let oldForeignKeys = connection.foreignKeys\n        let oldDeferForeignKeys = connection.deferForeignKeys\n\n        connection.deferForeignKeys = true\n        connection.foreignKeys = false\n\n        defer {\n            connection.deferForeignKeys = oldDeferForeignKeys\n            connection.foreignKeys = oldForeignKeys\n        }\n\n        try block()\n    }\n\n    private func moveTable(from: String, to: String, options: Options = .default, operation: Operation? = nil) throws {\n        try copyTable(from: from, to: to, options: options, operation: operation)\n        try dropTable(from, ifExists: true)\n    }\n\n    private func copyTable(from: String, to: String, options: Options = .default, operation: Operation?) throws {\n        let fromDefinition = TableDefinition(\n            name: from,\n            columns: try schemaReader.columnDefinitions(table: from),\n            indexes: try schemaReader.indexDefinitions(table: from)\n        )\n        let toDefinition   = fromDefinition\n                .apply(.renameTable(to))\n                .apply(operation)\n\n        try createTable(definition: toDefinition, options: options)\n        try createTableIndexes(definition: toDefinition)\n        if case .dropColumn = operation {\n            try copyTableContents(from: fromDefinition.apply(operation), to: toDefinition)\n        } else {\n            try copyTableContents(from: fromDefinition, to: toDefinition)\n        }\n    }\n\n    private func createTable(definition: TableDefinition, options: Options) throws {\n        try connection.run(definition.toSQL(temporary: options.contains(.temp)))\n    }\n\n    private func createTableIndexes(definition: TableDefinition) throws {\n        for index in definition.indexes {\n            try index.validate()\n            try connection.run(index.toSQL())\n        }\n    }\n\n    private func dropTable(_ table: String, ifExists: Bool) throws {\n        try connection.run(\"DROP TABLE \\(ifExists ? \"IF EXISTS\" : \"\") \\(table.quote())\")\n    }\n\n    private func copyTableContents(from: TableDefinition, to: TableDefinition) throws {\n        try connection.run(from.copySQL(to: to))\n    }\n\n    public var description: String {\n        \"SQLiteSchemaChanger: \\(connection.description)\"\n    }\n}\n\nextension IndexDefinition {\n    func renameTable(to: String) -> IndexDefinition {\n        func indexName() -> String {\n            if to.starts(with: SchemaChanger.tempPrefix) {\n                return \"\\(SchemaChanger.tempPrefix)\\(name)\"\n            } else if table.starts(with: SchemaChanger.tempPrefix) {\n                return name.replacingOccurrences(of: SchemaChanger.tempPrefix, with: \"\")\n            } else {\n                return name\n            }\n        }\n        return IndexDefinition(table: to, name: indexName(), unique: unique, columns: columns, where: `where`, orders: orders)\n    }\n\n    func renameColumn(from: String, to: String) -> IndexDefinition {\n        IndexDefinition(table: table, name: name, unique: unique, columns: columns.map {\n            $0 == from ? to : $0\n        }, where: `where`, orders: orders)\n    }\n}\n\nextension TableDefinition {\n    func apply(_ operation: SchemaChanger.Operation?) -> TableDefinition {\n        switch operation {\n        case .none: return self\n        case .createTable, .addIndex, .dropIndex: fatalError()\n        case .addColumn: fatalError(\"Use 'ALTER TABLE ADD COLUMN (...)'\")\n\n        case .dropColumn(let column):\n            return TableDefinition(name: name,\n                columns: columns.filter { $0.name != column },\n                indexes: indexes.filter { !$0.columns.contains(column) }\n            )\n        case .renameColumn(let from, let to):\n            return TableDefinition(\n                name: name,\n                columns: columns.map { $0.rename(from: from, to: to) },\n                indexes: indexes.map { $0.renameColumn(from: from, to: to) }\n        )\n        case .renameTable(let to):\n            return TableDefinition(name: to, columns: columns, indexes: indexes.map { $0.renameTable(to: to) })\n        }\n    }\n}\n\nextension ColumnDefinition.Affinity {\n    init<T>(expression: Expression<T>) where T: Value {\n        self.init(T.declaredDatatype)\n    }\n\n    init<T>(expression: Expression<T?>) where T: Value {\n        self.init(T.declaredDatatype)\n    }\n}\n"
  },
  {
    "path": "Sources/SQLite/Schema/SchemaDefinitions.swift",
    "content": "import Foundation\n\nstruct TableDefinition: Equatable {\n    let name: String\n    let columns: [ColumnDefinition]\n    let indexes: [IndexDefinition]\n\n    var quotedColumnList: String {\n        columns.map { $0.name.quote() }.joined(separator: \", \")\n    }\n}\n\n// https://sqlite.org/schematab.html#interpretation_of_the_schema_table\npublic struct ObjectDefinition: Equatable {\n    public enum ObjectType: String {\n        case table, index, view, trigger\n    }\n    public let type: ObjectType\n\n    // The name of the object\n    public let name: String\n\n    // The name of a table or view that the object is associated with.\n    //  * For a table or view, a copy of the name column.\n    //  * For an index, the name of the table that is indexed\n    //  * For a trigger, the column stores the name of the table or view that causes the trigger to fire.\n    public let tableName: String\n\n    // The page number of the root b-tree page for tables and indexes, otherwise 0 or NULL\n    public let rootpage: Int64\n\n    // SQL text that describes the object (NULL for the internal indexes)\n    public let sql: String?\n\n    public var isInternal: Bool {\n        name.starts(with: \"sqlite_\") || sql == nil\n    }\n}\n\n// https://sqlite.org/syntax/column-def.html\n// column-name -> type-name -> column-constraint*\npublic struct ColumnDefinition: Equatable {\n\n    // The type affinity of a column is the recommended type for data stored in that column.\n    // The important idea here is that the type is recommended, not required. Any column can still\n    // store any type of data. It is just that some columns, given the choice, will prefer to use one\n    // storage class over another. The preferred storage class for a column is called its \"affinity\".\n    public enum Affinity: String, CustomStringConvertible, CaseIterable {\n        case INTEGER\n        case NUMERIC\n        case REAL\n        case TEXT\n        case BLOB\n\n        public var description: String {\n            rawValue\n        }\n\n        init(_ string: String) {\n            let test = string.uppercased()\n            // https://sqlite.org/datatype3.html#determination_of_column_affinity\n            if test.contains(\"INT\") { // Rule 1\n                self = .INTEGER\n            } else if [\"CHAR\", \"CLOB\", \"TEXT\"].first(where: {test.contains($0)}) != nil { // Rule 2\n                self = .TEXT\n            } else if string.contains(\"BLOB\") { // Rule 3\n                self = .BLOB\n            } else if [\"REAL\", \"FLOA\", \"DOUB\"].first(where: {test.contains($0)}) != nil { // Rule 4\n                self = .REAL\n            } else { // Rule 5\n                self = .NUMERIC\n            }\n        }\n    }\n\n    public enum OnConflict: String, CaseIterable {\n        case ROLLBACK\n        case ABORT\n        case FAIL\n        case IGNORE\n        case REPLACE\n\n        init?(_ string: String) {\n            guard let value = (OnConflict.allCases.first { $0.rawValue == string }) else { return nil }\n            self = value\n        }\n    }\n\n    public struct PrimaryKey: Equatable {\n        let autoIncrement: Bool\n        let onConflict: OnConflict?\n\n        // swiftlint:disable:next force_try\n        static let pattern = try! NSRegularExpression(pattern: \"PRIMARY KEY\\\\s*(?:ASC|DESC)?\\\\s*(?:ON CONFLICT (\\\\w+)?)?\\\\s*(AUTOINCREMENT)?\")\n\n        public init(autoIncrement: Bool = true, onConflict: OnConflict? = nil) {\n            self.autoIncrement = autoIncrement\n            self.onConflict = onConflict\n        }\n\n        init?(sql: String) {\n            guard let match = PrimaryKey.pattern.firstMatch(\n                in: sql,\n                range: NSRange(location: 0, length: sql.count)) else {\n                return nil\n            }\n            let conflict = match.range(at: 1)\n            let onConflict: ColumnDefinition.OnConflict?\n            if conflict.location != NSNotFound {\n                onConflict = OnConflict((sql as NSString).substring(with: conflict))\n            } else {\n                onConflict = nil\n            }\n            let autoIncrement = match.range(at: 2).location != NSNotFound\n            self.init(autoIncrement: autoIncrement, onConflict: onConflict)\n        }\n    }\n\n    public struct ForeignKey: Equatable {\n        let fromColumn: String\n        let toTable: String\n        // when null, use primary key of \"toTable\"\n        let toColumn: String?\n        let onUpdate: String?\n        let onDelete: String?\n\n        public init(toTable: String, toColumn: String? = nil, onUpdate: String? = nil, onDelete: String? = nil) {\n            self.init(fromColumn: \"\", toTable: toTable, toColumn: toColumn, onUpdate: onUpdate, onDelete: onDelete)\n        }\n\n        public init(fromColumn: String, toTable: String, toColumn: String? = nil, onUpdate: String? = nil, onDelete: String? = nil) {\n            self.fromColumn = fromColumn\n            self.toTable = toTable\n            self.toColumn = toColumn\n            self.onUpdate = onUpdate\n            self.onDelete = onDelete\n        }\n    }\n\n    public let name: String\n    public let primaryKey: PrimaryKey?\n    public let type: Affinity\n    public let nullable: Bool\n    public let unique: Bool\n    public let defaultValue: LiteralValue\n    public let references: ForeignKey?\n\n    public init(name: String,\n                primaryKey: PrimaryKey? = nil,\n                type: Affinity,\n                nullable: Bool = true,\n                unique: Bool = false,\n                defaultValue: LiteralValue = .NULL,\n                references: ForeignKey? = nil) {\n        self.name = name\n        self.primaryKey = primaryKey\n        self.type = type\n        self.nullable = nullable\n        self.unique = unique\n        self.defaultValue = defaultValue\n        self.references = references\n    }\n\n    func rename(from: String, to: String) -> ColumnDefinition {\n        guard from == name else { return self }\n        return ColumnDefinition(name: to, primaryKey: primaryKey, type: type, nullable: nullable, defaultValue: defaultValue, references: references)\n    }\n}\n\npublic enum LiteralValue: Equatable, CustomStringConvertible {\n    // swiftlint:disable force_try\n    private static let singleQuote = try! NSRegularExpression(pattern: \"^'(.*)'$\")\n    private static let doubleQuote = try! NSRegularExpression(pattern: \"^\\\"(.*)\\\"$\")\n    private static let blob        = try! NSRegularExpression(pattern: \"^[xX]\\'(.*)\\'$\")\n    // swiftlint:enable force_try\n\n    case numericLiteral(String)\n    case stringLiteral(String)\n    // BLOB literals are string literals containing hexadecimal data and preceded by a single \"x\" or \"X\"\n    // character. Example: X'53514C697465'\n    case blobLiteral(String)\n\n    // If there is no explicit DEFAULT clause attached to a column definition, then the default value of the\n    // column is NULL\n    case NULL\n\n    // Beginning with SQLite 3.23.0 (2018-04-02), SQLite recognizes the identifiers \"TRUE\" and\n    // \"FALSE\" as boolean literals, if and only if those identifiers are not already used for some other\n    // meaning.\n    //\n    // The boolean identifiers TRUE and FALSE are usually just aliases for the integer values 1 and 0, respectively.\n    case TRUE\n    case FALSE\n    // swiftlint:disable identifier_name\n    case CURRENT_TIME\n    case CURRENT_DATE\n    case CURRENT_TIMESTAMP\n    // swiftlint:enable identifier_name\n\n    init(_ string: String?) {\n        guard let string else {\n            self = .NULL\n            return\n        }\n        switch string {\n        case \"NULL\": self = .NULL\n        case \"TRUE\": self = .TRUE\n        case \"FALSE\": self = .FALSE\n        case \"CURRENT_TIME\": self = .CURRENT_TIME\n        case \"CURRENT_TIMESTAMP\": self = .CURRENT_TIMESTAMP\n        case \"CURRENT_DATE\": self = .CURRENT_DATE\n        default: self = LiteralValue.parse(string)\n        }\n    }\n\n    public var description: String {\n        switch self {\n        case .NULL: return \"NULL\"\n        case .TRUE: return \"TRUE\"\n        case .FALSE: return \"FALSE\"\n        case .CURRENT_TIMESTAMP: return \"CURRENT_TIMESTAMP\"\n        case .CURRENT_TIME: return \"CURRENT_TIME\"\n        case .CURRENT_DATE: return \"CURRENT_DATE\"\n        case .stringLiteral(let value): return value.quote(\"'\")\n        case .blobLiteral(let value): return \"X\\(value.quote(\"'\"))\"\n        case .numericLiteral(let value): return value\n        }\n    }\n\n    func map<U>(block: (LiteralValue) -> U) -> U? {\n        if self == .NULL {\n            return nil\n        } else {\n            return block(self)\n        }\n    }\n    private static func parse(_ string: String) -> LiteralValue {\n        if let match = LiteralValue.singleQuote.firstMatch(in: string, range: NSRange(location: 0, length: string.count)) {\n            return .stringLiteral((string as NSString).substring(with: match.range(at: 1)).replacingOccurrences(of: \"''\", with: \"'\"))\n        } else if let match = LiteralValue.doubleQuote.firstMatch(in: string, range: NSRange(location: 0, length: string.count)) {\n            return .stringLiteral((string as NSString).substring(with: match.range(at: 1)).replacingOccurrences(of: \"\\\"\\\"\", with: \"\\\"\"))\n        } else if let match = LiteralValue.blob.firstMatch(in: string, range: NSRange(location: 0, length: string.count)) {\n            return .blobLiteral((string as NSString).substring(with: match.range(at: 1)))\n        } else {\n            return .numericLiteral(string)\n        }\n    }\n}\n\n// https://sqlite.org/lang_createindex.html\n// schema-name.index-name ON table-name ( indexed-column+ ) WHERE expr\npublic struct IndexDefinition: Equatable {\n    // SQLite supports index names up to 64 characters.\n    static let maxIndexLength = 64\n\n    // swiftlint:disable force_try\n    static let whereRe = try! NSRegularExpression(pattern: \"\\\\sWHERE\\\\s+(.+)$\")\n    static let orderRe = try! NSRegularExpression(pattern: \"\\\"?(\\\\w+)\\\"? DESC\")\n    // swiftlint:enable force_try\n\n    public enum Order: String { case ASC, DESC }\n\n    public init(table: String, name: String, unique: Bool = false, columns: [String], `where`: String? = nil,\n                orders: [String: Order]? = nil, origin: Origin? = nil) {\n        self.table = table\n        self.name = name\n        self.unique = unique\n        self.columns = columns\n        self.where = `where`\n        self.orders = orders\n        self.origin = origin\n    }\n\n    init (table: String, name: String, unique: Bool, columns: [String], indexSQL: String?, origin: Origin? = nil) {\n        func wherePart(sql: String) -> String? {\n            IndexDefinition.whereRe.firstMatch(in: sql, options: [], range: NSRange(location: 0, length: sql.count)).map {\n                (sql as NSString).substring(with: $0.range(at: 1))\n            }\n        }\n\n        func orders(sql: String) -> [String: IndexDefinition.Order] {\n            IndexDefinition.orderRe\n                .matches(in: sql, range: NSRange(location: 0, length: sql.count))\n                .reduce([String: IndexDefinition.Order]()) { (memo, result) in\n                        var memo2 = memo\n                        let column = (sql as NSString).substring(with: result.range(at: 1))\n                        memo2[column] = .DESC\n                        return memo2\n            }\n        }\n\n        let orders = indexSQL.flatMap(orders)\n\n        self.init(table: table,\n                  name: name,\n                  unique: unique,\n                  columns: columns,\n                  where: indexSQL.flatMap(wherePart),\n                  orders: (orders?.isEmpty ?? false) ? nil : orders,\n                  origin: origin)\n    }\n\n    public let table: String\n    public let name: String\n    public let unique: Bool\n    public let columns: [String]\n    public let `where`: String?\n    public let orders: [String: Order]?\n    public let origin: Origin?\n\n    public enum Origin: String {\n        case uniqueConstraint = \"u\" // index created from a \"CREATE TABLE (... UNIQUE)\" column constraint\n        case createIndex = \"c\"      // index created explicitly via \"CREATE INDEX ...\"\n        case primaryKey = \"pk\"      // index created from a \"CREATE TABLE PRIMARY KEY\" column constraint\n    }\n\n    enum IndexError: LocalizedError {\n        case tooLong(String, String)\n\n        var errorDescription: String? {\n            switch self {\n            case .tooLong(let name, let table):\n                return \"Index name '\\(name)' on table '\\(table)' is too long; the limit is \" +\n                     \"\\(IndexDefinition.maxIndexLength) characters\"\n            }\n        }\n    }\n\n    // Indices with names of the form \"sqlite_autoindex_TABLE_N\" that are used to implement UNIQUE and PRIMARY KEY\n    // constraints on ordinary tables.\n    // https://sqlite.org/fileformat2.html#intschema\n    var isInternal: Bool {\n        name.starts(with: \"sqlite_autoindex_\")\n    }\n\n    func validate() throws {\n        if name.count > IndexDefinition.maxIndexLength {\n            throw IndexError.tooLong(name, table)\n        }\n    }\n}\n\npublic struct ForeignKeyError: CustomStringConvertible {\n    public let from: String\n    public let rowId: Int64\n    public let to: String\n\n    public var description: String {\n        \"\\(from) [\\(rowId)] => \\(to)\"\n    }\n}\n\nextension TableDefinition {\n    func toSQL(temporary: Bool = false) -> String {\n        precondition(columns.count > 0, \"no columns to create\")\n\n        return ([\n            \"CREATE\",\n            temporary ? \"TEMPORARY\" : nil,\n            \"TABLE\",\n            name,\n            \"(\",\n            columns.map { $0.toSQL() }.joined(separator: \",\\n\"),\n            \")\"\n        ] as [String?]).compactMap { $0 }\n         .joined(separator: \" \")\n    }\n\n    func copySQL(to: TableDefinition) -> String {\n        precondition(columns.count > 0)\n        precondition(columns.count == to.columns.count, \"column counts don't match\")\n        return \"INSERT INTO \\(to.name.quote()) (\\(to.quotedColumnList)) SELECT \\(quotedColumnList) FROM \\(name.quote())\"\n    }\n}\n\nextension ColumnDefinition {\n    func toSQL() -> String {\n        [\n            name.quote(),\n            type.rawValue,\n            defaultValue.map { \"DEFAULT \\($0)\" },\n            primaryKey.map { $0.toSQL() },\n            nullable ? nil : \"NOT NULL\",\n            unique ? \"UNIQUE\" : nil,\n            references.map { $0.toSQL() }\n        ].compactMap { $0 }\n         .joined(separator: \" \")\n    }\n}\n\nextension IndexDefinition {\n    public func toSQL(ifNotExists: Bool = false) -> String {\n        let commaSeparatedColumns = columns.map { (column: String) -> String in\n            column.quote() + (orders?[column].map { \" \\($0.rawValue)\" } ?? \"\")\n        }.joined(separator: \", \")\n\n        return ([\n            \"CREATE\",\n            unique ? \"UNIQUE\" : nil,\n            \"INDEX\",\n            ifNotExists ? \"IF NOT EXISTS\" : nil,\n            name.quote(),\n            \"ON\",\n            table.quote(),\n            \"(\\(commaSeparatedColumns))\",\n            `where`.map { \"WHERE \\($0)\" }\n        ] as [String?]).compactMap { $0 }\n         .joined(separator: \" \")\n    }\n}\n\nextension ColumnDefinition.ForeignKey {\n    func toSQL() -> String {\n        ([\n            \"REFERENCES\",\n            toTable.quote(),\n            toColumn.map { \"(\\($0.quote()))\" },\n            onUpdate.map { \"ON UPDATE \\($0)\" },\n            onDelete.map { \"ON DELETE \\($0)\" }\n        ] as [String?]).compactMap { $0 }\n         .joined(separator: \" \")\n    }\n}\n\nextension ColumnDefinition.PrimaryKey {\n    func toSQL() -> String {\n        [\n            \"PRIMARY KEY\",\n            autoIncrement ? \"AUTOINCREMENT\" : nil,\n            onConflict.map { \"ON CONFLICT \\($0.rawValue)\" }\n        ].compactMap { $0 }.joined(separator: \" \")\n    }\n}\n"
  },
  {
    "path": "Sources/SQLite/Schema/SchemaReader.swift",
    "content": "import Foundation\n\npublic class SchemaReader {\n    private let connection: Connection\n\n    init(connection: Connection) {\n        self.connection = connection\n    }\n\n    // https://sqlite.org/pragma.html#pragma_table_info\n    //\n    // This pragma returns one row for each column in the named table. Columns in the result set include the\n    // column name, data type, whether or not the column can be NULL, and the default value for the column. The\n    // \"pk\" column in the result set is zero for columns that are not part of the primary key, and is the\n    // index of the column in the primary key for columns that are part of the primary key.\n    public func columnDefinitions(table: String) throws -> [ColumnDefinition] {\n        func parsePrimaryKey(column: String) throws -> ColumnDefinition.PrimaryKey? {\n            try createTableSQL(name: table).flatMap { .init(sql: $0) }\n        }\n\n        let foreignKeys: [String: [ColumnDefinition.ForeignKey]] =\n            Dictionary(grouping: try foreignKeys(table: table), by: { $0.fromColumn })\n\n        let columnDefinitions = try connection.prepareRowIterator(\"PRAGMA table_info(\\(table.quote()))\")\n            .map { (row: Row) -> ColumnDefinition in\n                ColumnDefinition(\n                    name: row[TableInfoTable.nameColumn],\n                    primaryKey: (row[TableInfoTable.primaryKeyColumn] ?? 0) > 0 ?\n                        try parsePrimaryKey(column: row[TableInfoTable.nameColumn]) : nil,\n                    type: ColumnDefinition.Affinity(row[TableInfoTable.typeColumn]),\n                    nullable: row[TableInfoTable.notNullColumn] == 0,\n                    unique: false,\n                    defaultValue: LiteralValue(row[TableInfoTable.defaultValueColumn]),\n                    references: foreignKeys[row[TableInfoTable.nameColumn]]?.first\n                )\n            }\n\n        let internalIndexes = try indexDefinitions(table: table).filter { $0.isInternal }\n        return columnDefinitions.map { definition in\n            if let index = internalIndexes.first(where: { $0.columns.contains(definition.name) }), index.origin == .uniqueConstraint {\n\n                ColumnDefinition(name: definition.name,\n                                 primaryKey: definition.primaryKey,\n                                 type: definition.type,\n                                 nullable: definition.nullable,\n                                 unique: true,\n                                 defaultValue: definition.defaultValue,\n                                 references: definition.references)\n            } else {\n                definition\n            }\n        }\n    }\n\n    public func objectDefinitions(name: String? = nil,\n                                  type: ObjectDefinition.ObjectType? = nil,\n                                  temp: Bool = false) throws -> [ObjectDefinition] {\n        var query: QueryType = SchemaTable.get(for: connection, temp: temp)\n        if let name {\n            query = query.where(SchemaTable.nameColumn == name)\n        }\n        if let type {\n            query = query.where(SchemaTable.typeColumn == type.rawValue)\n        }\n        return try connection.prepare(query).map { row -> ObjectDefinition in\n            guard let type = ObjectDefinition.ObjectType(rawValue: row[SchemaTable.typeColumn]) else {\n                fatalError(\"unexpected type\")\n            }\n            return ObjectDefinition(\n                type: type,\n                name: row[SchemaTable.nameColumn],\n                tableName: row[SchemaTable.tableNameColumn],\n                rootpage: row[SchemaTable.rootPageColumn] ?? 0,\n                sql: row[SchemaTable.sqlColumn]\n            )\n        }\n    }\n\n    public func indexDefinitions(table: String) throws -> [IndexDefinition] {\n        func indexSQL(name: String) throws -> String? {\n            try objectDefinitions(name: name, type: .index)\n                .compactMap(\\.sql)\n                .first\n        }\n\n        func indexInfos(name: String) throws -> [IndexInfo] {\n            try connection.prepareRowIterator(\"PRAGMA index_info(\\(name.quote()))\")\n                .compactMap { row in\n                    IndexInfo(name: row[IndexInfoTable.nameColumn],\n                              columnRank: row[IndexInfoTable.seqnoColumn],\n                              columnRankWithinTable: row[IndexInfoTable.cidColumn])\n\n                }\n        }\n\n        return try connection.prepareRowIterator(\"PRAGMA index_list(\\(table.quote()))\")\n            .compactMap { row -> IndexDefinition? in\n                let name = row[IndexListTable.nameColumn]\n                return IndexDefinition(\n                    table: table,\n                    name: name,\n                    unique: row[IndexListTable.uniqueColumn] == 1,\n                    columns: try indexInfos(name: name).compactMap { $0.name },\n                    indexSQL: try indexSQL(name: name),\n                    origin: IndexDefinition.Origin(rawValue: row[IndexListTable.originColumn])\n                )\n            }\n    }\n\n    func foreignKeys(table: String) throws -> [ColumnDefinition.ForeignKey] {\n        try connection.prepareRowIterator(\"PRAGMA foreign_key_list(\\(table.quote()))\")\n            .map { row in\n                ColumnDefinition.ForeignKey(\n                    fromColumn: row[ForeignKeyListTable.fromColumn],\n                    toTable: row[ForeignKeyListTable.tableColumn],\n                    toColumn: row[ForeignKeyListTable.toColumn],\n                    onUpdate: row[ForeignKeyListTable.onUpdateColumn] == TableBuilder.Dependency.noAction.rawValue\n                        ? nil : row[ForeignKeyListTable.onUpdateColumn],\n                    onDelete: row[ForeignKeyListTable.onDeleteColumn] == TableBuilder.Dependency.noAction.rawValue\n                        ? nil : row[ForeignKeyListTable.onDeleteColumn]\n                )\n            }\n    }\n\n    func tableDefinitions() throws -> [TableDefinition] {\n        try objectDefinitions(type: .table)\n                .map { table in\n                    TableDefinition(\n                        name: table.name,\n                        columns: try columnDefinitions(table: table.name),\n                        indexes: try indexDefinitions(table: table.name)\n                    )\n                }\n    }\n\n    private func createTableSQL(name: String) throws -> String? {\n        try (\n            objectDefinitions(name: name, type: .table) +\n            objectDefinitions(name: name, type: .table, temp: true)\n        ).compactMap(\\.sql).first\n    }\n\n    struct IndexInfo {\n        let name: String?\n        // The rank of the column within the index. (0 means left-most.)\n        let columnRank: Int\n        // The rank of the column within the table being indexed.\n        // A value of -1 means rowid and a value of -2 means that an expression is being used\n        let columnRankWithinTable: Int\n    }\n}\n\nprivate enum SchemaTable {\n    private static let name = Table(\"sqlite_schema\", database: \"main\")\n    private static let tempName = Table(\"sqlite_schema\", database: \"temp\")\n    // legacy names (< 3.33.0)\n    private static let masterName = Table(\"sqlite_master\")\n    private static let tempMasterName = Table(\"sqlite_temp_master\")\n\n    static func get(for connection: Connection, temp: Bool = false) -> Table {\n        if connection.supports(.sqliteSchemaTable) {\n            return temp ? SchemaTable.tempName : SchemaTable.name\n        } else {\n            return temp ? SchemaTable.tempMasterName : SchemaTable.masterName\n        }\n    }\n\n    // columns\n    static let typeColumn = Expression<String>(\"type\")\n    static let nameColumn = Expression<String>(\"name\")\n    static let tableNameColumn = Expression<String>(\"tbl_name\")\n    static let rootPageColumn = Expression<Int64?>(\"rootpage\")\n    static let sqlColumn = Expression<String?>(\"sql\")\n}\n\nprivate enum TableInfoTable {\n    static let idColumn = Expression<Int64>(\"cid\")\n    static let nameColumn = Expression<String>(\"name\")\n    static let typeColumn = Expression<String>(\"type\")\n    static let notNullColumn = Expression<Int64>(\"notnull\")\n    static let defaultValueColumn = Expression<String?>(\"dflt_value\")\n    static let primaryKeyColumn = Expression<Int64?>(\"pk\")\n}\n\nprivate enum IndexInfoTable {\n    // The rank of the column within the index. (0 means left-most.)\n    static let seqnoColumn = Expression<Int>(\"seqno\")\n    // The rank of the column within the table being indexed.\n    // A value of -1 means rowid and a value of -2 means that an expression is being used.\n    static let cidColumn = Expression<Int>(\"cid\")\n    // The name of the column being indexed.\n    // This columns is NULL if the column is the rowid or an expression.\n    static let nameColumn = Expression<String?>(\"name\")\n}\n\nprivate enum IndexListTable {\n    // A sequence number assigned to each index for internal tracking purposes.\n    static let seqColumn = Expression<Int64>(\"seq\")\n    // The name of the index\n    static let nameColumn = Expression<String>(\"name\")\n    // \"1\" if the index is UNIQUE and \"0\" if not.\n    static let uniqueColumn = Expression<Int64>(\"unique\")\n    // \"c\" if the index was created by a CREATE INDEX statement,\n    // \"u\" if the index was created by a UNIQUE constraint, or\n    // \"pk\" if the index was created by a PRIMARY KEY constraint.\n    static let originColumn = Expression<String>(\"origin\")\n    // \"1\" if the index is a partial index and \"0\" if not.\n    static let partialColumn = Expression<Int64>(\"partial\")\n}\n\nprivate enum ForeignKeyListTable {\n    static let idColumn = Expression<Int64>(\"id\")\n    static let seqColumn = Expression<Int64>(\"seq\")\n    static let tableColumn = Expression<String>(\"table\")\n    static let fromColumn = Expression<String>(\"from\")\n    static let toColumn = Expression<String?>(\"to\") // when null, use primary key\n    static let onUpdateColumn = Expression<String>(\"on_update\")\n    static let onDeleteColumn = Expression<String>(\"on_delete\")\n    static let matchColumn = Expression<String>(\"match\")\n}\n"
  },
  {
    "path": "Sources/SQLite/Typed/AggregateFunctions.swift",
    "content": "//\n// SQLite.swift\n// https://github.com/stephencelis/SQLite.swift\n// Copyright © 2014-2015 Stephen Celis.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nprivate enum Function: String, Sendable {\n    case count\n    case max\n    case min\n    case avg\n    case sum\n    case total\n\n    func wrap<T>(_ expression: Expressible) -> Expression<T> {\n        self.rawValue.wrap(expression)\n    }\n}\n\nextension ExpressionType where UnderlyingType: Value {\n\n    /// Builds a copy of the expression prefixed with the `DISTINCT` keyword.\n    ///\n    ///     let name = Expression<String>(\"name\")\n    ///     name.distinct\n    ///     // DISTINCT \"name\"\n    ///\n    /// - Returns: A copy of the expression prefixed with the `DISTINCT`\n    ///   keyword.\n    public var distinct: Expression<UnderlyingType> {\n        Expression(\"DISTINCT \\(template)\", bindings)\n    }\n\n    /// Builds a copy of the expression wrapped with the `count` aggregate\n    /// function.\n    ///\n    ///     let name = Expression<String?>(\"name\")\n    ///     name.count\n    ///     // count(\"name\")\n    ///     name.distinct.count\n    ///     // count(DISTINCT \"name\")\n    ///\n    /// - Returns: A copy of the expression wrapped with the `count` aggregate\n    ///   function.\n    public var count: Expression<Int> {\n        Function.count.wrap(self)\n    }\n\n}\n\nextension ExpressionType where UnderlyingType: _OptionalType, UnderlyingType.WrappedType: Value {\n\n    /// Builds a copy of the expression prefixed with the `DISTINCT` keyword.\n    ///\n    ///     let name = Expression<String?>(\"name\")\n    ///     name.distinct\n    ///     // DISTINCT \"name\"\n    ///\n    /// - Returns: A copy of the expression prefixed with the `DISTINCT`\n    ///   keyword.\n    public var distinct: Expression<UnderlyingType> {\n        Expression(\"DISTINCT \\(template)\", bindings)\n    }\n\n    /// Builds a copy of the expression wrapped with the `count` aggregate\n    /// function.\n    ///\n    ///     let name = Expression<String?>(\"name\")\n    ///     name.count\n    ///     // count(\"name\")\n    ///     name.distinct.count\n    ///     // count(DISTINCT \"name\")\n    ///\n    /// - Returns: A copy of the expression wrapped with the `count` aggregate\n    ///   function.\n    public var count: Expression<Int> {\n        Function.count.wrap(self)\n    }\n\n}\n\nextension ExpressionType where UnderlyingType: Value, UnderlyingType.Datatype: Comparable {\n\n    /// Builds a copy of the expression wrapped with the `max` aggregate\n    /// function.\n    ///\n    ///     let age = Expression<Int>(\"age\")\n    ///     age.max\n    ///     // max(\"age\")\n    ///\n    /// - Returns: A copy of the expression wrapped with the `max` aggregate\n    ///   function.\n    public var max: Expression<UnderlyingType?> {\n        Function.max.wrap(self)\n    }\n\n    /// Builds a copy of the expression wrapped with the `min` aggregate\n    /// function.\n    ///\n    ///     let age = Expression<Int>(\"age\")\n    ///     age.min\n    ///     // min(\"age\")\n    ///\n    /// - Returns: A copy of the expression wrapped with the `min` aggregate\n    ///   function.\n    public var min: Expression<UnderlyingType?> {\n        Function.min.wrap(self)\n    }\n\n}\n\nextension ExpressionType where UnderlyingType: _OptionalType, UnderlyingType.WrappedType: Value, UnderlyingType.WrappedType.Datatype: Comparable {\n\n    /// Builds a copy of the expression wrapped with the `max` aggregate\n    /// function.\n    ///\n    ///     let age = Expression<Int?>(\"age\")\n    ///     age.max\n    ///     // max(\"age\")\n    ///\n    /// - Returns: A copy of the expression wrapped with the `max` aggregate\n    ///   function.\n    public var max: Expression<UnderlyingType> {\n        Function.max.wrap(self)\n    }\n\n    /// Builds a copy of the expression wrapped with the `min` aggregate\n    /// function.\n    ///\n    ///     let age = Expression<Int?>(\"age\")\n    ///     age.min\n    ///     // min(\"age\")\n    ///\n    /// - Returns: A copy of the expression wrapped with the `min` aggregate\n    ///   function.\n    public var min: Expression<UnderlyingType> {\n        Function.min.wrap(self)\n    }\n\n}\n\nextension ExpressionType where UnderlyingType: Value, UnderlyingType.Datatype: Number {\n\n    /// Builds a copy of the expression wrapped with the `avg` aggregate\n    /// function.\n    ///\n    ///     let salary = Expression<Double>(\"salary\")\n    ///     salary.average\n    ///     // avg(\"salary\")\n    ///\n    /// - Returns: A copy of the expression wrapped with the `avg` aggregate\n    ///   function.\n    public var average: Expression<Double?> {\n        Function.avg.wrap(self)\n    }\n\n    /// Builds a copy of the expression wrapped with the `sum` aggregate\n    /// function.\n    ///\n    ///     let salary = Expression<Double>(\"salary\")\n    ///     salary.sum\n    ///     // sum(\"salary\")\n    ///\n    /// - Returns: A copy of the expression wrapped with the `sum` aggregate\n    ///   function.\n    public var sum: Expression<UnderlyingType?> {\n        Function.sum.wrap(self)\n    }\n\n    /// Builds a copy of the expression wrapped with the `total` aggregate\n    /// function.\n    ///\n    ///     let salary = Expression<Double>(\"salary\")\n    ///     salary.total\n    ///     // total(\"salary\")\n    ///\n    /// - Returns: A copy of the expression wrapped with the `total` aggregate\n    ///   function.\n    public var total: Expression<Double> {\n        Function.total.wrap(self)\n    }\n\n}\n\nextension ExpressionType where UnderlyingType: _OptionalType, UnderlyingType.WrappedType: Value, UnderlyingType.WrappedType.Datatype: Number {\n\n    /// Builds a copy of the expression wrapped with the `avg` aggregate\n    /// function.\n    ///\n    ///     let salary = Expression<Double?>(\"salary\")\n    ///     salary.average\n    ///     // avg(\"salary\")\n    ///\n    /// - Returns: A copy of the expression wrapped with the `min` aggregate\n    ///   function.\n    public var average: Expression<Double?> {\n        Function.avg.wrap(self)\n    }\n\n    /// Builds a copy of the expression wrapped with the `sum` aggregate\n    /// function.\n    ///\n    ///     let salary = Expression<Double?>(\"salary\")\n    ///     salary.sum\n    ///     // sum(\"salary\")\n    ///\n    /// - Returns: A copy of the expression wrapped with the `min` aggregate\n    ///   function.\n    public var sum: Expression<UnderlyingType> {\n        Function.sum.wrap(self)\n    }\n\n    /// Builds a copy of the expression wrapped with the `total` aggregate\n    /// function.\n    ///\n    ///     let salary = Expression<Double?>(\"salary\")\n    ///     salary.total\n    ///     // total(\"salary\")\n    ///\n    /// - Returns: A copy of the expression wrapped with the `min` aggregate\n    ///   function.\n    public var total: Expression<Double> {\n        Function.total.wrap(self)\n    }\n\n}\n\nextension ExpressionType where UnderlyingType == Int {\n\n    static func count(_ star: Star) -> Expression<UnderlyingType> {\n        Function.count.wrap(star(nil, nil))\n    }\n\n}\n\n/// Builds an expression representing `count(*)` (when called with the `*`\n/// function literal).\n///\n///     count(*)\n///     // count(*)\n///\n/// - Returns: An expression returning `count(*)` (when called with the `*`\n///   function literal).\npublic func count(_ star: Star) -> Expression<Int> {\n    Expression.count(star)\n}\n"
  },
  {
    "path": "Sources/SQLite/Typed/Coding.swift",
    "content": "//\n// SQLite.swift\n// https://github.com/stephencelis/SQLite.swift\n// Copyright © 2014-2015 Stephen Celis.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport Foundation\n\nextension QueryType {\n    /// Creates an `INSERT` statement by encoding the given object\n    /// This method converts any custom nested types to JSON data and does not handle any sort\n    /// of object relationships. If you want to support relationships between objects you will\n    /// have to provide your own Encodable implementations that encode the correct ids.\n    ///\n    /// - Parameters:\n    ///\n    ///   - encodable: An encodable object to insert\n    ///\n    ///   - userInfo: User info to be passed to encoder\n    ///\n    ///   - otherSetters: Any other setters to include in the insert\n    ///\n    /// - Returns: An `INSERT` statement for the encodable object\n    public func insert(_ encodable: Encodable, userInfo: [CodingUserInfoKey: Any] = [:], otherSetters: [Setter] = []) throws -> Insert {\n        let encoder = SQLiteEncoder(userInfo: userInfo)\n        try encodable.encode(to: encoder)\n        return self.insert(encoder.setters + otherSetters)\n    }\n\n    /// Creates an `INSERT` statement by encoding the given object\n    /// This method converts any custom nested types to JSON data and does not handle any sort\n    /// of object relationships. If you want to support relationships between objects you will\n    /// have to provide your own Encodable implementations that encode the correct ids.\n    /// The onConflict will be passed to the actual insert function to define what should happen\n    /// when an error occurs during the insert operation.\n    ///\n    /// - Parameters:\n    ///\n    ///   - onConlict: Define what happens when an insert operation fails\n    ///\n    ///   - encodable: An encodable object to insert\n    ///\n    ///   - userInfo: User info to be passed to encoder\n    ///\n    ///   - otherSetters: Any other setters to include in the insert\n    ///\n    /// - Returns: An `INSERT` statement fort the encodable object\n    public func insert(or onConflict: OnConflict, encodable: Encodable, userInfo: [CodingUserInfoKey: Any] = [:],\n                       otherSetters: [Setter] = []) throws -> Insert {\n        let encoder = SQLiteEncoder(userInfo: userInfo)\n        try encodable.encode(to: encoder)\n        return self.insert(or: onConflict, encoder.setters + otherSetters)\n    }\n\n    /// Creates a batch `INSERT` statement by encoding the array of given objects\n    /// This method converts any custom nested types to JSON data and does not handle any sort\n    /// of object relationships. If you want to support relationships between objects you will\n    /// have to provide your own Encodable implementations that encode the correct ids.\n    ///\n    /// - Parameters:\n    ///\n    ///   - encodables: Encodable objects to insert\n    ///\n    ///   - userInfo: User info to be passed to encoder\n    ///\n    ///   - otherSetters: Any other setters to include in the inserts, per row/object.\n    ///\n    /// - Returns: An `INSERT` statement for the encodable objects\n    public func insertMany(_ encodables: [Encodable], userInfo: [CodingUserInfoKey: Any] = [:],\n                           otherSetters: [Setter] = []) throws -> Insert {\n        let combinedSettersWithoutNils = try encodables.map { encodable -> [Setter] in\n            let encoder = SQLiteEncoder(userInfo: userInfo, forcingNilValueSetters: false)\n            try encodable.encode(to: encoder)\n            return encoder.setters + otherSetters\n        }\n        // requires the same number of setters per encodable\n        guard Set(combinedSettersWithoutNils.map(\\.count)).count == 1 else {\n            // asymmetric sets of value insertions (some nil, some not), requires NULL value to satisfy INSERT query\n            let combinedSymmetricSetters = try encodables.map { encodable -> [Setter] in\n                let encoder = SQLiteEncoder(userInfo: userInfo, forcingNilValueSetters: true)\n                try encodable.encode(to: encoder)\n                return encoder.setters + otherSetters\n            }\n            return self.insertMany(combinedSymmetricSetters)\n        }\n        return self.insertMany(combinedSettersWithoutNils)\n    }\n\n    /// Creates an `INSERT ON CONFLICT DO UPDATE` statement, aka upsert, by encoding the given object\n    /// This method converts any custom nested types to JSON data and does not handle any sort\n    /// of object relationships. If you want to support relationships between objects you will\n    /// have to provide your own Encodable implementations that encode the correct ids.\n    ///\n    /// - Parameters:\n    ///\n    ///   - encodable: An encodable object to insert\n    ///\n    ///   - userInfo: User info to be passed to encoder\n    ///\n    ///   - otherSetters: Any other setters to include in the insert\n    ///\n    ///   - onConflictOf: The column that if conflicts should trigger an update instead of insert.\n    ///\n    /// - Returns: An `INSERT` statement fort the encodable object\n    public func upsert(_ encodable: Encodable, userInfo: [CodingUserInfoKey: Any] = [:],\n                       otherSetters: [Setter] = [], onConflictOf conflicting: Expressible) throws -> Insert {\n        let encoder = SQLiteEncoder(userInfo: userInfo)\n        try encodable.encode(to: encoder)\n        return self.upsert(encoder.setters + otherSetters, onConflictOf: conflicting)\n    }\n\n    /// Creates an `UPDATE` statement by encoding the given object\n    /// This method converts any custom nested types to JSON data and does not handle any sort\n    /// of object relationships. If you want to support relationships between objects you will\n    /// have to provide your own Encodable implementations that encode the correct ids.\n    ///\n    /// - Parameters:\n    ///\n    ///   - encodable: An encodable object to insert\n    ///\n    ///   - userInfo: User info to be passed to encoder\n    ///\n    ///   - otherSetters: Any other setters to include in the insert\n    ///\n    /// - Returns: An `UPDATE` statement fort the encodable object\n    public func update(_ encodable: Encodable, userInfo: [CodingUserInfoKey: Any] = [:],\n                       otherSetters: [Setter] = []) throws -> Update {\n        let encoder = SQLiteEncoder(userInfo: userInfo)\n        try encodable.encode(to: encoder)\n        return self.update(encoder.setters + otherSetters)\n    }\n}\n\nextension Row {\n    /// Decode an object from this row\n    /// This method expects any custom nested types to be in the form of JSON data and does not handle\n    /// any sort of object relationships. If you want to support relationships between objects you will\n    /// have to provide your own Decodable implementations that decodes the correct columns.\n    ///\n    /// - Parameter: userInfo\n    ///\n    /// - Returns: a decoded object from this row\n    public func decode<V: Decodable>(userInfo: [CodingUserInfoKey: Any] = [:]) throws -> V {\n        try V(from: decoder(userInfo: userInfo))\n    }\n\n    public func decoder(userInfo: [CodingUserInfoKey: Any] = [:]) -> Decoder {\n        SQLiteDecoder(row: self, userInfo: userInfo)\n    }\n}\n\n/// Generates a list of settings for an Encodable object\nprivate class SQLiteEncoder: Encoder {\n    class SQLiteKeyedEncodingContainer<MyKey: CodingKey>: KeyedEncodingContainerProtocol {\n        // swiftlint:disable nesting\n        typealias Key = MyKey\n\n        let encoder: SQLiteEncoder\n        let codingPath: [CodingKey] = []\n        let forcingNilValueSetters: Bool\n\n        init(encoder: SQLiteEncoder, forcingNilValueSetters: Bool = false) {\n            self.encoder = encoder\n            self.forcingNilValueSetters = forcingNilValueSetters\n        }\n\n        func superEncoder() -> Swift.Encoder {\n            fatalError(\"SQLiteEncoding does not support super encoders\")\n        }\n\n        func superEncoder(forKey key: Key) -> Swift.Encoder {\n            fatalError(\"SQLiteEncoding does not support super encoders\")\n        }\n\n        func encodeNil(forKey key: SQLiteEncoder.SQLiteKeyedEncodingContainer<Key>.Key) throws {\n            encoder.setters.append(Expression<String?>(key.stringValue) <- nil)\n        }\n\n        func encode(_ value: Int, forKey key: SQLiteEncoder.SQLiteKeyedEncodingContainer<Key>.Key) throws {\n            encoder.setters.append(Expression(key.stringValue) <- value)\n        }\n\n        func encode(_ value: Bool, forKey key: Key) throws {\n            encoder.setters.append(Expression(key.stringValue) <- value)\n        }\n\n        func encode(_ value: Float, forKey key: Key) throws {\n            encoder.setters.append(Expression(key.stringValue) <- Double(value))\n        }\n\n        func encode(_ value: Double, forKey key: Key) throws {\n            encoder.setters.append(Expression(key.stringValue) <- value)\n        }\n\n        func encode(_ value: String, forKey key: Key) throws {\n            encoder.setters.append(Expression(key.stringValue) <- value)\n        }\n\n        func encodeIfPresent(_ value: Int?, forKey key: SQLiteEncoder.SQLiteKeyedEncodingContainer<Key>.Key) throws {\n            if let value {\n                try encode(value, forKey: key)\n            } else if forcingNilValueSetters {\n                encoder.setters.append(Expression<Int?>(key.stringValue) <- nil)\n            }\n        }\n\n        func encodeIfPresent(_ value: Bool?, forKey key: Key) throws {\n            if let value {\n                try encode(value, forKey: key)\n            } else if forcingNilValueSetters {\n                encoder.setters.append(Expression<Bool?>(key.stringValue) <- nil)\n            }\n        }\n\n        func encodeIfPresent(_ value: Float?, forKey key: Key) throws {\n            if let value {\n                try encode(value, forKey: key)\n            } else if forcingNilValueSetters {\n                encoder.setters.append(Expression<Double?>(key.stringValue) <- nil)\n            }\n        }\n\n        func encodeIfPresent(_ value: Double?, forKey key: Key) throws {\n            if let value {\n                try encode(value, forKey: key)\n            } else if forcingNilValueSetters {\n                encoder.setters.append(Expression<Double?>(key.stringValue) <- nil)\n            }\n        }\n\n        func encodeIfPresent(_ value: String?, forKey key: MyKey) throws {\n            if let value {\n                try encode(value, forKey: key)\n            } else if forcingNilValueSetters {\n                encoder.setters.append(Expression<String?>(key.stringValue) <- nil)\n            }\n        }\n\n        func encode<T>(_ value: T, forKey key: Key) throws where T: Swift.Encodable {\n            switch value {\n            case let data as Data:\n                encoder.setters.append(Expression(key.stringValue) <- data)\n            case let date as Date:\n                encoder.setters.append(Expression(key.stringValue) <- date.datatypeValue)\n            case let uuid as UUID:\n                encoder.setters.append(Expression(key.stringValue) <- uuid.datatypeValue)\n            default:\n                let encoded = try JSONEncoder().encode(value)\n                let string = String(data: encoded, encoding: .utf8)\n                encoder.setters.append(Expression(key.stringValue) <- string)\n            }\n        }\n\n        func encodeIfPresent<T>(_ value: T?, forKey key: Key) throws where T: Swift.Encodable {\n            guard let value else {\n                guard forcingNilValueSetters else {\n                    return\n                }\n                encoder.setters.append(Expression<String?>(key.stringValue) <- nil)\n                return\n            }\n            try encode(value, forKey: key)\n        }\n\n        func encode(_ value: Int8, forKey key: Key) throws {\n            throw EncodingError.invalidValue(value, EncodingError.Context(codingPath: codingPath,\n                                                                          debugDescription: \"encoding an Int8 is not supported\"))\n        }\n\n        func encode(_ value: Int16, forKey key: Key) throws {\n            throw EncodingError.invalidValue(value, EncodingError.Context(codingPath: codingPath,\n                                                                          debugDescription: \"encoding an Int16 is not supported\"))\n        }\n\n        func encode(_ value: Int32, forKey key: Key) throws {\n            throw EncodingError.invalidValue(value, EncodingError.Context(codingPath: codingPath,\n                                                                          debugDescription: \"encoding an Int32 is not supported\"))\n        }\n\n        func encode(_ value: Int64, forKey key: Key) throws {\n            encoder.setters.append(Expression(key.stringValue) <- value)\n        }\n\n        func encode(_ value: UInt, forKey key: Key) throws {\n            throw EncodingError.invalidValue(value, EncodingError.Context(codingPath: codingPath,\n                                                                          debugDescription: \"encoding an UInt is not supported\"))\n        }\n\n        func encode(_ value: UInt8, forKey key: Key) throws {\n            throw EncodingError.invalidValue(value, EncodingError.Context(codingPath: codingPath,\n                                                                          debugDescription: \"encoding an UInt8 is not supported\"))\n        }\n\n        func encode(_ value: UInt16, forKey key: Key) throws {\n            throw EncodingError.invalidValue(value, EncodingError.Context(codingPath: codingPath,\n                                                                          debugDescription: \"encoding an UInt16 is not supported\"))\n        }\n\n        func encode(_ value: UInt32, forKey key: Key) throws {\n            throw EncodingError.invalidValue(value, EncodingError.Context(codingPath: codingPath,\n                                                                          debugDescription: \"encoding an UInt32 is not supported\"))\n        }\n\n        func encode(_ value: UInt64, forKey key: Key) throws {\n            throw EncodingError.invalidValue(value, EncodingError.Context(codingPath: codingPath,\n                                                                          debugDescription: \"encoding an UInt64 is not supported\"))\n        }\n\n        func nestedContainer<NestedKey>(keyedBy keyType: NestedKey.Type, forKey key: Key)\n        -> KeyedEncodingContainer<NestedKey> where NestedKey: CodingKey {\n            fatalError(\"encoding a nested container is not supported\")\n        }\n\n        func nestedUnkeyedContainer(forKey key: Key) -> UnkeyedEncodingContainer {\n            fatalError(\"encoding nested values is not supported\")\n        }\n    }\n\n    fileprivate var setters: [Setter] = []\n    let codingPath: [CodingKey] = []\n    let userInfo: [CodingUserInfoKey: Any]\n    let forcingNilValueSetters: Bool\n\n    init(userInfo: [CodingUserInfoKey: Any], forcingNilValueSetters: Bool = false) {\n        self.userInfo = userInfo\n        self.forcingNilValueSetters = forcingNilValueSetters\n    }\n\n    func singleValueContainer() -> SingleValueEncodingContainer {\n        fatalError(\"not supported\")\n    }\n\n    func unkeyedContainer() -> UnkeyedEncodingContainer {\n        fatalError(\"not supported\")\n    }\n\n    func container<Key>(keyedBy type: Key.Type) -> KeyedEncodingContainer<Key> where Key: CodingKey {\n        KeyedEncodingContainer(SQLiteKeyedEncodingContainer(encoder: self, forcingNilValueSetters: forcingNilValueSetters))\n    }\n}\n\nprivate class SQLiteDecoder: Decoder {\n    class SQLiteKeyedDecodingContainer<MyKey: CodingKey>: KeyedDecodingContainerProtocol {\n        typealias Key = MyKey\n\n        let codingPath: [CodingKey] = []\n        let row: Row\n\n        init(row: Row) {\n            self.row = row\n        }\n\n        var allKeys: [Key] {\n            row.columnNames.keys.compactMap({ Key(stringValue: $0) })\n        }\n\n        func contains(_ key: Key) -> Bool {\n            row.hasValue(for: key.stringValue)\n        }\n\n        func decodeNil(forKey key: Key) throws -> Bool {\n            !contains(key)\n        }\n\n        func decode(_ type: Bool.Type, forKey key: Key) throws -> Bool {\n            try row.get(Expression(key.stringValue))\n        }\n\n        func decode(_ type: Int.Type, forKey key: Key) throws -> Int {\n            try row.get(Expression(key.stringValue))\n        }\n\n        func decode(_ type: Int8.Type, forKey key: Key) throws -> Int8 {\n            throw DecodingError.typeMismatch(type, DecodingError.Context(codingPath: codingPath,\n                                                                         debugDescription: \"decoding an Int8 is not supported\"))\n        }\n\n        func decode(_ type: Int16.Type, forKey key: Key) throws -> Int16 {\n            throw DecodingError.typeMismatch(type, DecodingError.Context(codingPath: codingPath,\n                                                                         debugDescription: \"decoding an Int16 is not supported\"))\n        }\n\n        func decode(_ type: Int32.Type, forKey key: Key) throws -> Int32 {\n            throw DecodingError.typeMismatch(type, DecodingError.Context(codingPath: codingPath,\n                                                                         debugDescription: \"decoding an Int32 is not supported\"))\n        }\n\n        func decode(_ type: Int64.Type, forKey key: Key) throws -> Int64 {\n            try row.get(Expression(key.stringValue))\n        }\n\n        func decode(_ type: UInt.Type, forKey key: Key) throws -> UInt {\n            throw DecodingError.typeMismatch(type, DecodingError.Context(codingPath: codingPath,\n                                                                         debugDescription: \"decoding an UInt is not supported\"))\n\n        }\n\n        func decode(_ type: UInt8.Type, forKey key: Key) throws -> UInt8 {\n            throw DecodingError.typeMismatch(type, DecodingError.Context(codingPath: codingPath,\n                                                                         debugDescription: \"decoding an UInt8 is not supported\"))\n        }\n\n        func decode(_ type: UInt16.Type, forKey key: Key) throws -> UInt16 {\n            throw DecodingError.typeMismatch(type, DecodingError.Context(codingPath: codingPath,\n                                                                         debugDescription: \"decoding an UInt16 is not supported\"))\n        }\n\n        func decode(_ type: UInt32.Type, forKey key: Key) throws -> UInt32 {\n            throw DecodingError.typeMismatch(type, DecodingError.Context(codingPath: codingPath,\n                                                                         debugDescription: \"decoding an UInt32 is not supported\"))\n        }\n\n        func decode(_ type: UInt64.Type, forKey key: Key) throws -> UInt64 {\n            throw DecodingError.typeMismatch(type, DecodingError.Context(codingPath: codingPath,\n                                                                         debugDescription: \"decoding an UInt64 is not supported\"))\n        }\n\n        func decode(_ type: Float.Type, forKey key: Key) throws -> Float {\n            Float(try row.get(Expression<Double>(key.stringValue)))\n        }\n\n        func decode(_ type: Double.Type, forKey key: Key) throws -> Double {\n            try row.get(Expression(key.stringValue))\n        }\n\n        func decode(_ type: String.Type, forKey key: Key) throws -> String {\n            try row.get(Expression(key.stringValue))\n        }\n\n        func decode<T>(_ type: T.Type, forKey key: Key) throws -> T where T: Swift.Decodable {\n            // swiftlint:disable force_cast\n            switch type {\n            case is Data.Type:\n                let data = try row.get(Expression<Data>(key.stringValue))\n                return data as! T\n            case is Date.Type:\n                let date = try row.get(Expression<Date>(key.stringValue))\n                return date as! T\n            case is UUID.Type:\n                let uuid = try row.get(Expression<UUID>(key.stringValue))\n                return uuid as! T\n            default:\n                // swiftlint:enable force_cast\n                guard let JSONString = try row.get(Expression<String?>(key.stringValue)) else {\n                    throw DecodingError.typeMismatch(type, DecodingError.Context(codingPath: codingPath,\n                                                                                 debugDescription: \"an unsupported type was found\"))\n                }\n                guard let data = JSONString.data(using: .utf8) else {\n                    throw DecodingError.dataCorrupted(DecodingError.Context(codingPath: codingPath,\n                                                                            debugDescription: \"invalid utf8 data found\"))\n                }\n                return try JSONDecoder().decode(type, from: data)\n            }\n        }\n\n        func decodeIfPresent(_ type: Bool.Type, forKey key: Key) throws -> Bool? {\n            try? row.get(Expression(key.stringValue))\n        }\n\n        func decodeIfPresent(_ type: Int.Type, forKey key: Key) throws -> Int? {\n            try? row.get(Expression(key.stringValue))\n        }\n\n        func decodeIfPresent(_ type: Int64.Type, forKey key: Key) throws -> Int64? {\n            try? row.get(Expression(key.stringValue))\n        }\n\n        func decodeIfPresent(_ type: Float.Type, forKey key: Key) throws -> Float? {\n            try? Float(row.get(Expression<Double>(key.stringValue)))\n        }\n\n        func decodeIfPresent(_ type: Double.Type, forKey key: Key) throws -> Double? {\n            try? row.get(Expression(key.stringValue))\n        }\n\n        func decodeIfPresent(_ type: String.Type, forKey key: Key) throws -> String? {\n            try? row.get(Expression(key.stringValue))\n        }\n\n        func decodeIfPresent<T>(_ type: T.Type, forKey key: Key) throws -> T? where T: Swift.Decodable {\n            switch type {\n            case is Data.Type:\n                return try? row.get(Expression<Data>(key.stringValue)) as? T\n            case is Date.Type:\n                return try? row.get(Expression<Date>(key.stringValue)) as? T\n            case is UUID.Type:\n                return try? row.get(Expression<UUID>(key.stringValue)) as? T\n            default:\n                guard let JSONString = try row.get(Expression<String?>(key.stringValue)) else {\n                    return nil\n                }\n                guard let data = JSONString.data(using: .utf8) else {\n                    throw DecodingError.dataCorrupted(DecodingError.Context(codingPath: codingPath,\n                                                                            debugDescription: \"invalid utf8 data found\"))\n                }\n                return try JSONDecoder().decode(type, from: data)\n            }\n        }\n\n        func nestedContainer<NestedKey>(keyedBy type: NestedKey.Type, forKey key: Key) throws\n        -> KeyedDecodingContainer<NestedKey> where NestedKey: CodingKey {\n            throw DecodingError.dataCorrupted(DecodingError.Context(codingPath: codingPath,\n                                                                    debugDescription: \"decoding nested containers is not supported\"))\n        }\n\n        func nestedUnkeyedContainer(forKey key: Key) throws -> UnkeyedDecodingContainer {\n            throw DecodingError.dataCorrupted(DecodingError.Context(codingPath: codingPath,\n                                                                    debugDescription: \"decoding unkeyed containers is not supported\"))\n        }\n\n        func superDecoder() throws -> Swift.Decoder {\n            throw DecodingError.dataCorrupted(DecodingError.Context(codingPath: codingPath,\n                                                                    debugDescription: \"decoding super encoders containers is not supported\"))\n        }\n\n        func superDecoder(forKey key: Key) throws -> Swift.Decoder {\n            throw DecodingError.dataCorrupted(DecodingError.Context(codingPath: codingPath,\n                                                                    debugDescription: \"decoding super decoders is not supported\"))\n        }\n    }\n\n    let row: Row\n    let codingPath: [CodingKey] = []\n    let userInfo: [CodingUserInfoKey: Any]\n\n    init(row: Row, userInfo: [CodingUserInfoKey: Any]) {\n        self.row = row\n        self.userInfo = userInfo\n    }\n\n    func container<Key>(keyedBy type: Key.Type) throws -> KeyedDecodingContainer<Key> where Key: CodingKey {\n        KeyedDecodingContainer(SQLiteKeyedDecodingContainer(row: row))\n    }\n\n    func unkeyedContainer() throws -> UnkeyedDecodingContainer {\n        throw DecodingError.dataCorrupted(DecodingError.Context(codingPath: codingPath,\n                                                                debugDescription: \"decoding an unkeyed container is not supported\"))\n    }\n\n    func singleValueContainer() throws -> SingleValueDecodingContainer {\n        throw DecodingError.dataCorrupted(DecodingError.Context(codingPath: codingPath,\n                                                                debugDescription: \"decoding a single value container is not supported\"))\n    }\n}\n"
  },
  {
    "path": "Sources/SQLite/Typed/Collation.swift",
    "content": "//\n// SQLite.swift\n// https://github.com/stephencelis/SQLite.swift\n// Copyright © 2014-2015 Stephen Celis.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\n/// A collating function used to compare to strings.\n///\n/// - SeeAlso: <https://www.sqlite.org/datatype3.html#collation>\npublic enum Collation: Sendable {\n\n    /// Compares string by raw data.\n    case binary\n\n    /// Like binary, but folds uppercase ASCII letters into their lowercase\n    /// equivalents.\n    case nocase\n\n    /// Like binary, but strips trailing space.\n    case rtrim\n\n    /// A custom collating sequence identified by the given string, registered\n    /// using `Database.create(collation:…)`\n    case custom(String)\n\n}\n\nextension Collation: Expressible {\n\n    public var expression: Expression<Void> {\n        Expression(literal: description)\n    }\n\n}\n\nextension Collation: CustomStringConvertible {\n\n    public var description: String {\n        switch self {\n        case .binary:\n            return \"BINARY\"\n        case .nocase:\n            return \"NOCASE\"\n        case .rtrim:\n            return \"RTRIM\"\n        case .custom(let collation):\n            return collation.quote()\n        }\n    }\n\n}\n"
  },
  {
    "path": "Sources/SQLite/Typed/CoreFunctions.swift",
    "content": "//\n// SQLite.swift\n// https://github.com/stephencelis/SQLite.swift\n// Copyright © 2014-2015 Stephen Celis.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\nimport Foundation\n\nprivate enum Function: String, Sendable {\n    case abs\n    case round\n    case random\n    case randomblob\n    case zeroblob\n    case length\n    case lower\n    case upper\n    case ltrim\n    case rtrim\n    case trim\n    case replace\n    case substr\n    case like = \"LIKE\"\n    case `in` = \"IN\"\n    case glob = \"GLOB\"\n    case match = \"MATCH\"\n    case regexp = \"REGEXP\"\n    case collate = \"COLLATE\"\n    case ifnull\n\n    func infix<T>(_ lhs: Expressible, _ rhs: Expressible, wrap: Bool = true) -> Expression<T> {\n        self.rawValue.infix(lhs, rhs, wrap: wrap)\n    }\n\n    func wrap<T>(_ expression: Expressible) -> Expression<T> {\n        self.rawValue.wrap(expression)\n    }\n\n    func wrap<T>(_ expressions: [Expressible]) -> Expression<T> {\n        self.rawValue.wrap(\", \".join(expressions))\n    }\n}\n\nextension ExpressionType where UnderlyingType: Number {\n\n    /// Builds a copy of the expression wrapped with the `abs` function.\n    ///\n    ///     let x = Expression<Int>(\"x\")\n    ///     x.absoluteValue\n    ///     // abs(\"x\")\n    ///\n    /// - Returns: A copy of the expression wrapped with the `abs` function.\n    public var absoluteValue: Expression<UnderlyingType> {\n        Function.abs.wrap(self)\n    }\n\n}\n\nextension ExpressionType where UnderlyingType: _OptionalType, UnderlyingType.WrappedType: Number {\n\n    /// Builds a copy of the expression wrapped with the `abs` function.\n    ///\n    ///     let x = Expression<Int?>(\"x\")\n    ///     x.absoluteValue\n    ///     // abs(\"x\")\n    ///\n    /// - Returns: A copy of the expression wrapped with the `abs` function.\n    public var absoluteValue: Expression<UnderlyingType> {\n        Function.abs.wrap(self)\n    }\n\n}\n\nextension ExpressionType where UnderlyingType == Double {\n\n    /// Builds a copy of the expression wrapped with the `round` function.\n    ///\n    ///     let salary = Expression<Double>(\"salary\")\n    ///     salary.round()\n    ///     // round(\"salary\")\n    ///     salary.round(2)\n    ///     // round(\"salary\", 2)\n    ///\n    /// - Returns: A copy of the expression wrapped with the `round` function.\n    public func round(_ precision: Int? = nil) -> Expression<UnderlyingType> {\n        guard let precision else {\n            return Function.round.wrap([self])\n        }\n        return Function.round.wrap([self, Int(precision)])\n    }\n\n}\n\nextension ExpressionType where UnderlyingType == Double? {\n\n    /// Builds a copy of the expression wrapped with the `round` function.\n    ///\n    ///     let salary = Expression<Double>(\"salary\")\n    ///     salary.round()\n    ///     // round(\"salary\")\n    ///     salary.round(2)\n    ///     // round(\"salary\", 2)\n    ///\n    /// - Returns: A copy of the expression wrapped with the `round` function.\n    public func round(_ precision: Int? = nil) -> Expression<UnderlyingType> {\n        guard let precision else {\n            return Function.round.wrap(self)\n        }\n        return Function.round.wrap([self, Int(precision)])\n    }\n\n}\n\nextension ExpressionType where UnderlyingType: Value, UnderlyingType.Datatype == Int64 {\n\n    /// Builds an expression representing the `random` function.\n    ///\n    ///     Expression<Int>.random()\n    ///     // random()\n    ///\n    /// - Returns: An expression calling the `random` function.\n    public static func random() -> Expression<UnderlyingType> {\n        Function.random.wrap([])\n    }\n\n}\n\nextension ExpressionType where UnderlyingType == Data {\n\n    /// Builds an expression representing the `randomblob` function.\n    ///\n    ///     Expression<Int>.random(16)\n    ///     // randomblob(16)\n    ///\n    /// - Parameter length: Length in bytes.\n    ///\n    /// - Returns: An expression calling the `randomblob` function.\n    public static func random(_ length: Int) -> Expression<UnderlyingType> {\n        Function.randomblob.wrap([])\n    }\n\n    /// Builds an expression representing the `zeroblob` function.\n    ///\n    ///     Expression<Int>.allZeros(16)\n    ///     // zeroblob(16)\n    ///\n    /// - Parameter length: Length in bytes.\n    ///\n    /// - Returns: An expression calling the `zeroblob` function.\n    public static func allZeros(_ length: Int) -> Expression<UnderlyingType> {\n        Function.zeroblob.wrap([])\n    }\n\n    /// Builds a copy of the expression wrapped with the `length` function.\n    ///\n    ///     let data = Expression<NSData>(\"data\")\n    ///     data.length\n    ///     // length(\"data\")\n    ///\n    /// - Returns: A copy of the expression wrapped with the `length` function.\n    public var length: Expression<Int> {\n        Function.length.wrap(self)\n    }\n\n}\n\nextension ExpressionType where UnderlyingType == Data? {\n\n    /// Builds a copy of the expression wrapped with the `length` function.\n    ///\n    ///     let data = Expression<NSData?>(\"data\")\n    ///     data.length\n    ///     // length(\"data\")\n    ///\n    /// - Returns: A copy of the expression wrapped with the `length` function.\n    public var length: Expression<Int?> {\n        Function.length.wrap(self)\n    }\n\n}\n\nextension ExpressionType where UnderlyingType == String {\n\n    /// Builds a copy of the expression wrapped with the `length` function.\n    ///\n    ///     let name = Expression<String>(\"name\")\n    ///     name.length\n    ///     // length(\"name\")\n    ///\n    /// - Returns: A copy of the expression wrapped with the `length` function.\n    public var length: Expression<Int> {\n        Function.length.wrap(self)\n    }\n\n    /// Builds a copy of the expression wrapped with the `lower` function.\n    ///\n    ///     let name = Expression<String>(\"name\")\n    ///     name.lowercaseString\n    ///     // lower(\"name\")\n    ///\n    /// - Returns: A copy of the expression wrapped with the `lower` function.\n    public var lowercaseString: Expression<UnderlyingType> {\n        Function.lower.wrap(self)\n    }\n\n    /// Builds a copy of the expression wrapped with the `upper` function.\n    ///\n    ///     let name = Expression<String>(\"name\")\n    ///     name.uppercaseString\n    ///     // upper(\"name\")\n    ///\n    /// - Returns: A copy of the expression wrapped with the `upper` function.\n    public var uppercaseString: Expression<UnderlyingType> {\n        Function.upper.wrap(self)\n    }\n\n    /// Builds a copy of the expression appended with a `LIKE` query against the\n    /// given pattern.\n    ///\n    ///     let email = Expression<String>(\"email\")\n    ///     email.like(\"%@example.com\")\n    ///     // \"email\" LIKE '%@example.com'\n    ///     email.like(\"99\\\\%@%\", escape: \"\\\\\")\n    ///     // \"email\" LIKE '99\\%@%' ESCAPE '\\'\n    ///\n    /// - Parameters:\n    ///\n    ///   - pattern: A pattern to match.\n    ///\n    ///   - escape: An (optional) character designated for escaping\n    ///     pattern-matching characters (*i.e.*, the `%` and `_` characters).\n    ///\n    /// - Returns: A copy of the expression appended with a `LIKE` query against\n    ///   the given pattern.\n    public func like(_ pattern: String, escape character: Character? = nil) -> Expression<Bool> {\n        guard let character else {\n            return \"LIKE\".infix(self, pattern)\n        }\n        return Expression(\"(\\(template) LIKE ? ESCAPE ?)\", bindings + [pattern, String(character)])\n    }\n\n    /// Builds a copy of the expression appended with a `LIKE` query against the\n    /// given pattern.\n    ///\n    ///     let email = Expression<String>(\"email\")\n    ///     let pattern = Expression<String>(\"pattern\")\n    ///     email.like(pattern)\n    ///     // \"email\" LIKE \"pattern\"\n    ///\n    /// - Parameters:\n    ///\n    ///   - pattern: A pattern to match.\n    ///\n    ///   - escape: An (optional) character designated for escaping\n    ///     pattern-matching characters (*i.e.*, the `%` and `_` characters).\n    ///\n    /// - Returns: A copy of the expression appended with a `LIKE` query against\n    ///   the given pattern.\n    public func like(_ pattern: Expression<String>, escape character: Character? = nil) -> Expression<Bool> {\n        guard let character else {\n            return Function.like.infix(self, pattern)\n        }\n        let like: Expression<Bool> =  Function.like.infix(self, pattern, wrap: false)\n        return Expression(\"(\\(like.template) ESCAPE ?)\", like.bindings + [String(character)])\n    }\n\n    /// Builds a copy of the expression appended with a `GLOB` query against the\n    /// given pattern.\n    ///\n    ///     let path = Expression<String>(\"path\")\n    ///     path.glob(\"*.png\")\n    ///     // \"path\" GLOB '*.png'\n    ///\n    /// - Parameter pattern: A pattern to match.\n    ///\n    /// - Returns: A copy of the expression appended with a `GLOB` query against\n    ///   the given pattern.\n    public func glob(_ pattern: String) -> Expression<Bool> {\n        Function.glob.infix(self, pattern)\n    }\n\n    /// Builds a copy of the expression appended with a `MATCH` query against\n    /// the given pattern.\n    ///\n    ///     let title = Expression<String>(\"title\")\n    ///     title.match(\"swift AND programming\")\n    ///     // \"title\" MATCH 'swift AND programming'\n    ///\n    /// - Parameter pattern: A pattern to match.\n    ///\n    /// - Returns: A copy of the expression appended with a `MATCH` query\n    ///   against the given pattern.\n    public func match(_ pattern: String) -> Expression<Bool> {\n        Function.match.infix(self, pattern)\n    }\n\n    /// Builds a copy of the expression appended with a `REGEXP` query against\n    /// the given pattern.\n    ///\n    /// - Parameter pattern: A pattern to match.\n    ///\n    /// - Returns: A copy of the expression appended with a `REGEXP` query\n    ///   against the given pattern.\n    public func regexp(_ pattern: String) -> Expression<Bool> {\n        Function.regexp.infix(self, pattern)\n    }\n\n    /// Builds a copy of the expression appended with a `COLLATE` clause with\n    /// the given sequence.\n    ///\n    ///     let name = Expression<String>(\"name\")\n    ///     name.collate(.Nocase)\n    ///     // \"name\" COLLATE NOCASE\n    ///\n    /// - Parameter collation: A collating sequence.\n    ///\n    /// - Returns: A copy of the expression appended with a `COLLATE` clause\n    ///   with the given sequence.\n    public func collate(_ collation: Collation) -> Expression<UnderlyingType> {\n        Function.collate.infix(self, collation)\n    }\n\n    /// Builds a copy of the expression wrapped with the `ltrim` function.\n    ///\n    ///     let name = Expression<String>(\"name\")\n    ///     name.ltrim()\n    ///     // ltrim(\"name\")\n    ///     name.ltrim([\" \", \"\\t\"])\n    ///     // ltrim(\"name\", ' \\t')\n    ///\n    /// - Parameter characters: A set of characters to trim.\n    ///\n    /// - Returns: A copy of the expression wrapped with the `ltrim` function.\n    public func ltrim(_ characters: Set<Character>? = nil) -> Expression<UnderlyingType> {\n        guard let characters else {\n            return Function.ltrim.wrap(self)\n        }\n        return Function.ltrim.wrap([self, String(characters)])\n    }\n\n    /// Builds a copy of the expression wrapped with the `rtrim` function.\n    ///\n    ///     let name = Expression<String>(\"name\")\n    ///     name.rtrim()\n    ///     // rtrim(\"name\")\n    ///     name.rtrim([\" \", \"\\t\"])\n    ///     // rtrim(\"name\", ' \\t')\n    ///\n    /// - Parameter characters: A set of characters to trim.\n    ///\n    /// - Returns: A copy of the expression wrapped with the `rtrim` function.\n    public func rtrim(_ characters: Set<Character>? = nil) -> Expression<UnderlyingType> {\n        guard let characters else {\n            return Function.rtrim.wrap(self)\n        }\n        return Function.rtrim.wrap([self, String(characters)])\n    }\n\n    /// Builds a copy of the expression wrapped with the `trim` function.\n    ///\n    ///     let name = Expression<String>(\"name\")\n    ///     name.trim()\n    ///     // trim(\"name\")\n    ///     name.trim([\" \", \"\\t\"])\n    ///     // trim(\"name\", ' \\t')\n    ///\n    /// - Parameter characters: A set of characters to trim.\n    ///\n    /// - Returns: A copy of the expression wrapped with the `trim` function.\n    public func trim(_ characters: Set<Character>? = nil) -> Expression<UnderlyingType> {\n        guard let characters else {\n            return Function.trim.wrap([self])\n        }\n        return Function.trim.wrap([self, String(characters)])\n    }\n\n    /// Builds a copy of the expression wrapped with the `replace` function.\n    ///\n    ///     let email = Expression<String>(\"email\")\n    ///     email.replace(\"@mac.com\", with: \"@icloud.com\")\n    ///     // replace(\"email\", '@mac.com', '@icloud.com')\n    ///\n    /// - Parameters:\n    ///\n    ///   - pattern: A pattern to match.\n    ///\n    ///   - replacement: The replacement string.\n    ///\n    /// - Returns: A copy of the expression wrapped with the `replace` function.\n    public func replace(_ pattern: String, with replacement: String) -> Expression<UnderlyingType> {\n        Function.replace.wrap([self, pattern, replacement])\n    }\n\n    public func substring(_ location: Int, length: Int? = nil) -> Expression<UnderlyingType> {\n        guard let length else {\n            return Function.substr.wrap([self, location])\n        }\n        return Function.substr.wrap([self, location, length])\n    }\n\n    public subscript(range: Range<Int>) -> Expression<UnderlyingType> {\n        substring(range.lowerBound, length: range.upperBound - range.lowerBound)\n    }\n\n}\n\nextension ExpressionType where UnderlyingType == String? {\n\n    /// Builds a copy of the expression wrapped with the `length` function.\n    ///\n    ///     let name = Expression<String?>(\"name\")\n    ///     name.length\n    ///     // length(\"name\")\n    ///\n    /// - Returns: A copy of the expression wrapped with the `length` function.\n    public var length: Expression<Int?> {\n        Function.length.wrap(self)\n    }\n\n    /// Builds a copy of the expression wrapped with the `lower` function.\n    ///\n    ///     let name = Expression<String?>(\"name\")\n    ///     name.lowercaseString\n    ///     // lower(\"name\")\n    ///\n    /// - Returns: A copy of the expression wrapped with the `lower` function.\n    public var lowercaseString: Expression<UnderlyingType> {\n        Function.lower.wrap(self)\n    }\n\n    /// Builds a copy of the expression wrapped with the `upper` function.\n    ///\n    ///     let name = Expression<String?>(\"name\")\n    ///     name.uppercaseString\n    ///     // lower(\"name\")\n    ///\n    /// - Returns: A copy of the expression wrapped with the `upper` function.\n    public var uppercaseString: Expression<UnderlyingType> {\n        Function.upper.wrap(self)\n    }\n\n    /// Builds a copy of the expression appended with a `LIKE` query against the\n    /// given pattern.\n    ///\n    ///     let email = Expression<String?>(\"email\")\n    ///     email.like(\"%@example.com\")\n    ///     // \"email\" LIKE '%@example.com'\n    ///     email.like(\"99\\\\%@%\", escape: \"\\\\\")\n    ///     // \"email\" LIKE '99\\%@%' ESCAPE '\\'\n    ///\n    /// - Parameters:\n    ///\n    ///   - pattern: A pattern to match.\n    ///\n    ///   - escape: An (optional) character designated for escaping\n    ///     pattern-matching characters (*i.e.*, the `%` and `_` characters).\n    ///\n    /// - Returns: A copy of the expression appended with a `LIKE` query against\n    ///   the given pattern.\n    public func like(_ pattern: String, escape character: Character? = nil) -> Expression<Bool?> {\n        guard let character else {\n            return Function.like.infix(self, pattern)\n        }\n        return Expression(\"(\\(template) LIKE ? ESCAPE ?)\", bindings + [pattern, String(character)])\n    }\n\n    /// Builds a copy of the expression appended with a `LIKE` query against the\n    /// given pattern.\n    ///\n    ///     let email = Expression<String>(\"email\")\n    ///     let pattern = Expression<String>(\"pattern\")\n    ///     email.like(pattern)\n    ///     // \"email\" LIKE \"pattern\"\n    ///\n    /// - Parameters:\n    ///\n    ///   - pattern: A pattern to match.\n    ///\n    ///   - escape: An (optional) character designated for escaping\n    ///     pattern-matching characters (*i.e.*, the `%` and `_` characters).\n    ///\n    /// - Returns: A copy of the expression appended with a `LIKE` query against\n    ///   the given pattern.\n    public func like(_ pattern: Expression<String>, escape character: Character? = nil) -> Expression<Bool?> {\n        guard let character else {\n            return Function.like.infix(self, pattern)\n        }\n        let like: Expression<Bool> = Function.like.infix(self, pattern, wrap: false)\n        return Expression(\"(\\(like.template) ESCAPE ?)\", like.bindings + [String(character)])\n    }\n\n    /// Builds a copy of the expression appended with a `GLOB` query against the\n    /// given pattern.\n    ///\n    ///     let path = Expression<String?>(\"path\")\n    ///     path.glob(\"*.png\")\n    ///     // \"path\" GLOB '*.png'\n    ///\n    /// - Parameter pattern: A pattern to match.\n    ///\n    /// - Returns: A copy of the expression appended with a `GLOB` query against\n    ///   the given pattern.\n    public func glob(_ pattern: String) -> Expression<Bool?> {\n        Function.glob.infix(self, pattern)\n    }\n\n    /// Builds a copy of the expression appended with a `MATCH` query against\n    /// the given pattern.\n    ///\n    ///     let title = Expression<String?>(\"title\")\n    ///     title.match(\"swift AND programming\")\n    ///     // \"title\" MATCH 'swift AND programming'\n    ///\n    /// - Parameter pattern: A pattern to match.\n    ///\n    /// - Returns: A copy of the expression appended with a `MATCH` query\n    ///   against the given pattern.\n    public func match(_ pattern: String) -> Expression<Bool> {\n        Function.match.infix(self, pattern)\n    }\n\n    /// Builds a copy of the expression appended with a `REGEXP` query against\n    /// the given pattern.\n    ///\n    /// - Parameter pattern: A pattern to match.\n    ///\n    /// - Returns: A copy of the expression appended with a `REGEXP` query\n    ///   against the given pattern.\n    public func regexp(_ pattern: String) -> Expression<Bool?> {\n        Function.regexp.infix(self, pattern)\n    }\n\n    /// Builds a copy of the expression appended with a `COLLATE` clause with\n    /// the given sequence.\n    ///\n    ///     let name = Expression<String?>(\"name\")\n    ///     name.collate(.Nocase)\n    ///     // \"name\" COLLATE NOCASE\n    ///\n    /// - Parameter collation: A collating sequence.\n    ///\n    /// - Returns: A copy of the expression appended with a `COLLATE` clause\n    ///   with the given sequence.\n    public func collate(_ collation: Collation) -> Expression<UnderlyingType> {\n        Function.collate.infix(self, collation)\n    }\n\n    /// Builds a copy of the expression wrapped with the `ltrim` function.\n    ///\n    ///     let name = Expression<String?>(\"name\")\n    ///     name.ltrim()\n    ///     // ltrim(\"name\")\n    ///     name.ltrim([\" \", \"\\t\"])\n    ///     // ltrim(\"name\", ' \\t')\n    ///\n    /// - Parameter characters: A set of characters to trim.\n    ///\n    /// - Returns: A copy of the expression wrapped with the `ltrim` function.\n    public func ltrim(_ characters: Set<Character>? = nil) -> Expression<UnderlyingType> {\n        guard let characters else {\n            return Function.ltrim.wrap(self)\n        }\n        return Function.ltrim.wrap([self, String(characters)])\n    }\n\n    /// Builds a copy of the expression wrapped with the `rtrim` function.\n    ///\n    ///     let name = Expression<String?>(\"name\")\n    ///     name.rtrim()\n    ///     // rtrim(\"name\")\n    ///     name.rtrim([\" \", \"\\t\"])\n    ///     // rtrim(\"name\", ' \\t')\n    ///\n    /// - Parameter characters: A set of characters to trim.\n    ///\n    /// - Returns: A copy of the expression wrapped with the `rtrim` function.\n    public func rtrim(_ characters: Set<Character>? = nil) -> Expression<UnderlyingType> {\n        guard let characters else {\n            return Function.rtrim.wrap(self)\n        }\n        return Function.rtrim.wrap([self, String(characters)])\n    }\n\n    /// Builds a copy of the expression wrapped with the `trim` function.\n    ///\n    ///     let name = Expression<String?>(\"name\")\n    ///     name.trim()\n    ///     // trim(\"name\")\n    ///     name.trim([\" \", \"\\t\"])\n    ///     // trim(\"name\", ' \\t')\n    ///\n    /// - Parameter characters: A set of characters to trim.\n    ///\n    /// - Returns: A copy of the expression wrapped with the `trim` function.\n    public func trim(_ characters: Set<Character>? = nil) -> Expression<UnderlyingType> {\n        guard let characters else {\n            return Function.trim.wrap(self)\n        }\n        return Function.trim.wrap([self, String(characters)])\n    }\n\n    /// Builds a copy of the expression wrapped with the `replace` function.\n    ///\n    ///     let email = Expression<String?>(\"email\")\n    ///     email.replace(\"@mac.com\", with: \"@icloud.com\")\n    ///     // replace(\"email\", '@mac.com', '@icloud.com')\n    ///\n    /// - Parameters:\n    ///\n    ///   - pattern: A pattern to match.\n    ///\n    ///   - replacement: The replacement string.\n    ///\n    /// - Returns: A copy of the expression wrapped with the `replace` function.\n    public func replace(_ pattern: String, with replacement: String) -> Expression<UnderlyingType> {\n        Function.replace.wrap([self, pattern, replacement])\n    }\n\n    /// Builds a copy of the expression wrapped with the `substr` function.\n    ///\n    ///     let title = Expression<String?>(\"title\")\n    ///     title.substr(-100)\n    ///     // substr(\"title\", -100)\n    ///     title.substr(0, length: 100)\n    ///     // substr(\"title\", 0, 100)\n    ///\n    /// - Parameters:\n    ///\n    ///   - location: The substring’s start index.\n    ///\n    ///   - length: An optional substring length.\n    ///\n    /// - Returns: A copy of the expression wrapped with the `substr` function.\n    public func substring(_ location: Int, length: Int? = nil) -> Expression<UnderlyingType> {\n        guard let length else {\n            return Function.substr.wrap([self, location])\n        }\n        return Function.substr.wrap([self, location, length])\n    }\n\n    /// Builds a copy of the expression wrapped with the `substr` function.\n    ///\n    ///     let title = Expression<String?>(\"title\")\n    ///     title[0..<100]\n    ///     // substr(\"title\", 0, 100)\n    ///\n    /// - Parameter range: The character index range of the substring.\n    ///\n    /// - Returns: A copy of the expression wrapped with the `substr` function.\n    public subscript(range: Range<Int>) -> Expression<UnderlyingType> {\n        substring(range.lowerBound, length: range.upperBound - range.lowerBound)\n    }\n\n}\n\nextension Collection where Iterator.Element: Value {\n\n    /// Builds a copy of the expression prepended with an `IN` check against the\n    /// collection.\n    ///\n    ///     let name = Expression<String>(\"name\")\n    ///     [\"alice\", \"betty\"].contains(name)\n    ///     // \"name\" IN ('alice', 'betty')\n    ///\n    /// - Parameter pattern: A pattern to match.\n    ///\n    /// - Returns: A copy of the expression prepended with an `IN` check against\n    ///   the collection.\n    public func contains(_ expression: Expression<Iterator.Element>) -> Expression<Bool> {\n        let templates = [String](repeating: \"?\", count: count).joined(separator: \", \")\n        return Function.in.infix(expression, Expression<Void>(\"(\\(templates))\", map { $0.datatypeValue }))\n    }\n\n    /// Builds a copy of the expression prepended with an `IN` check against the\n    /// collection.\n    ///\n    ///     let name = Expression<String?>(\"name\")\n    ///     [\"alice\", \"betty\"].contains(name)\n    ///     // \"name\" IN ('alice', 'betty')\n    ///\n    /// - Parameter pattern: A pattern to match.\n    ///\n    /// - Returns: A copy of the expression prepended with an `IN` check against\n    ///   the collection.\n    public func contains(_ expression: Expression<Iterator.Element?>) -> Expression<Bool?> {\n        let templates = [String](repeating: \"?\", count: count).joined(separator: \", \")\n        return Function.in.infix(expression, Expression<Void>(\"(\\(templates))\", map { $0.datatypeValue }))\n    }\n\n}\n\nextension String {\n\n    /// Builds a copy of the expression appended with a `LIKE` query against the\n    /// given pattern.\n    ///\n    ///     let email = \"some@thing.com\"\n    ///     let pattern = Expression<String>(\"pattern\")\n    ///     email.like(pattern)\n    ///     // 'some@thing.com' LIKE \"pattern\"\n    ///\n    /// - Parameters:\n    ///\n    ///   - pattern: A pattern to match.\n    ///\n    ///   - escape: An (optional) character designated for escaping\n    ///     pattern-matching characters (*i.e.*, the `%` and `_` characters).\n    ///\n    /// - Returns: A copy of the expression appended with a `LIKE` query against\n    ///   the given pattern.\n    public func like(_ pattern: Expression<String>, escape character: Character? = nil) -> Expression<Bool> {\n        guard let character else {\n            return Function.like.infix(self, pattern)\n        }\n        let like: Expression<Bool> = Function.like.infix(self, pattern, wrap: false)\n        return Expression(\"(\\(like.template) ESCAPE ?)\", like.bindings + [String(character)])\n    }\n\n}\n\n/// Builds a copy of the given expressions wrapped with the `ifnull` function.\n///\n///     let name = Expression<String?>(\"name\")\n///     name ?? \"An Anonymous Coward\"\n///     // ifnull(\"name\", 'An Anonymous Coward')\n///\n/// - Parameters:\n///\n///   - optional: An optional expression.\n///\n///   - defaultValue: A fallback value for when the optional expression is\n///     `nil`.\n///\n/// - Returns: A copy of the given expressions wrapped with the `ifnull`\n///   function.\npublic func ??<V: Value>(optional: Expression<V?>, defaultValue: V) -> Expression<V> {\n    Function.ifnull.wrap([optional, defaultValue])\n}\n\n/// Builds a copy of the given expressions wrapped with the `ifnull` function.\n///\n///     let nick = Expression<String?>(\"nick\")\n///     let name = Expression<String>(\"name\")\n///     nick ?? name\n///     // ifnull(\"nick\", \"name\")\n///\n/// - Parameters:\n///\n///   - optional: An optional expression.\n///\n///   - defaultValue: A fallback expression for when the optional expression is\n///     `nil`.\n///\n/// - Returns: A copy of the given expressions wrapped with the `ifnull`\n///   function.\npublic func ??<V: Value>(optional: Expression<V?>, defaultValue: Expression<V>) -> Expression<V> {\n    Function.ifnull.wrap([optional, defaultValue])\n}\n\n/// Builds a copy of the given expressions wrapped with the `ifnull` function.\n///\n///     let nick = Expression<String?>(\"nick\")\n///     let name = Expression<String?>(\"name\")\n///     nick ?? name\n///     // ifnull(\"nick\", \"name\")\n///\n/// - Parameters:\n///\n///   - optional: An optional expression.\n///\n///   - defaultValue: A fallback expression for when the optional expression is\n///     `nil`.\n///\n/// - Returns: A copy of the given expressions wrapped with the `ifnull`\n///   function.\npublic func ??<V: Value>(optional: Expression<V?>, defaultValue: Expression<V?>) -> Expression<V> {\n    Function.ifnull.wrap([optional, defaultValue])\n}\n"
  },
  {
    "path": "Sources/SQLite/Typed/CustomFunctions.swift",
    "content": "//\n// SQLite.swift\n// https://github.com/stephencelis/SQLite.swift\n// Copyright © 2014-2015 Stephen Celis.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\npublic extension Connection {\n\n    /// Creates or redefines a custom SQL function.\n    ///\n    /// - Parameters:\n    ///\n    ///   - function: The name of the function to create or redefine.\n    ///\n    ///   - deterministic: Whether or not the function is deterministic (_i.e._\n    ///     the function always returns the same result for a given input).\n    ///\n    ///     Default: `false`\n    ///\n    ///   - block: A block of code to run when the function is called.\n    ///     The assigned types must be explicit.\n    ///\n    /// - Returns: A closure returning an SQL expression to call the function.\n    func createFunction<Z: Value>(_ function: String, deterministic: Bool = false, _ block: @escaping () -> Z) throws\n                    -> () -> Expression<Z> {\n        let fn = try createFunction(function, 0, deterministic) { _ in block() }\n        return { fn([]) }\n    }\n\n    func createFunction<Z: Value>(_ function: String, deterministic: Bool = false, _ block: @escaping () -> Z?) throws\n                    -> () -> Expression<Z?> {\n        let fn = try createFunction(function, 0, deterministic) { _ in block() }\n        return { fn([]) }\n    }\n\n    // MARK: -\n\n    func createFunction<Z: Value, A: Value>(_ function: String, deterministic: Bool = false, _ block: @escaping (A) -> Z) throws\n                    -> (Expression<A>) -> Expression<Z> {\n        let fn = try createFunction(function, 1, deterministic) { args in block(value(args[0])) }\n        return { arg in fn([arg]) }\n    }\n\n    func createFunction<Z: Value, A: Value>(_ function: String, deterministic: Bool = false, _ block: @escaping (A?) -> Z) throws\n                    -> (Expression<A?>) -> Expression<Z> {\n        let fn = try createFunction(function, 1, deterministic) { args in block(args[0].map(value)) }\n        return { arg in fn([arg]) }\n    }\n\n    func createFunction<Z: Value, A: Value>(_ function: String, deterministic: Bool = false, _ block: @escaping (A) -> Z?) throws\n                    -> (Expression<A>) -> Expression<Z?> {\n        let fn = try createFunction(function, 1, deterministic) { args in block(value(args[0])) }\n        return { arg in fn([arg]) }\n    }\n\n    func createFunction<Z: Value, A: Value>(_ function: String, deterministic: Bool = false, _ block: @escaping (A?) -> Z?) throws\n                    -> (Expression<A?>) -> Expression<Z?> {\n        let fn = try createFunction(function, 1, deterministic) { args in block(args[0].map(value)) }\n        return { arg in fn([arg]) }\n    }\n\n    // MARK: -\n\n    func createFunction<Z: Value, A: Value, B: Value>(_ function: String, deterministic: Bool = false,\n                                                      _ block: @escaping (A, B) -> Z) throws -> (Expression<A>, Expression<B>)\n    -> Expression<Z> {\n        let fn = try createFunction(function, 2, deterministic) { args in block(value(args[0]), value(args[1])) }\n        return { a, b in fn([a, b]) }\n    }\n\n    func createFunction<Z: Value, A: Value, B: Value>(_ function: String, deterministic: Bool = false,\n                                                      _ block: @escaping (A?, B) -> Z) throws\n                    -> (Expression<A?>, Expression<B>) -> Expression<Z> {\n        let fn = try createFunction(function, 2, deterministic) { args in block(args[0].map(value), value(args[1])) }\n        return { a, b in fn([a, b]) }\n    }\n\n    func createFunction<Z: Value, A: Value, B: Value>(_ function: String, deterministic: Bool = false,\n                                                      _ block: @escaping (A, B?) -> Z) throws ->\n            (Expression<A>, Expression<B?>) -> Expression<Z> {\n        let fn = try createFunction(function, 2, deterministic) { args in block(value(args[0]), args[1].map(value)) }\n        return { a, b in fn([a, b]) }\n    }\n\n    func createFunction<Z: Value, A: Value, B: Value>(_ function: String, deterministic: Bool = false,\n                                                      _ block: @escaping (A, B) -> Z?) throws\n                    -> (Expression<A>, Expression<B>) -> Expression<Z?> {\n        let fn = try createFunction(function, 2, deterministic) { args in block(value(args[0]), value(args[1])) }\n        return { a, b in fn([a, b]) }\n    }\n\n    func createFunction<Z: Value, A: Value, B: Value>(_ function: String, deterministic: Bool = false,\n                                                      _ block: @escaping (A?, B?) -> Z) throws\n                    -> (Expression<A?>, Expression<B?>) -> Expression<Z> {\n        let fn = try createFunction(function, 2, deterministic) { args in block(args[0].map(value), args[1].map(value)) }\n        return { a, b in fn([a, b]) }\n    }\n\n    func createFunction<Z: Value, A: Value, B: Value>(_ function: String, deterministic: Bool = false,\n                                                      _ block: @escaping (A?, B) -> Z?) throws\n                    -> (Expression<A?>, Expression<B>) -> Expression<Z?> {\n        let fn = try createFunction(function, 2, deterministic) { args in block(args[0].map(value), value(args[1])) }\n        return { a, b in fn([a, b]) }\n    }\n\n    func createFunction<Z: Value, A: Value, B: Value>(_ function: String, deterministic: Bool = false,\n                                                      _ block: @escaping (A, B?) -> Z?) throws\n                    -> (Expression<A>, Expression<B?>) -> Expression<Z?> {\n        let fn = try createFunction(function, 2, deterministic) { args in block(value(args[0]), args[1].map(value)) }\n        return { a, b in fn([a, b]) }\n    }\n\n    func createFunction<Z: Value, A: Value, B: Value>(_ function: String, deterministic: Bool = false,\n                                                      _ block: @escaping (A?, B?) -> Z?) throws\n                    -> (Expression<A?>, Expression<B?>) -> Expression<Z?> {\n        let fn = try createFunction(function, 2, deterministic) { args in block(args[0].map(value), args[1].map(value)) }\n        return { a, b in fn([a, b]) }\n    }\n\n    // MARK: -\n\n    fileprivate func createFunction<Z: Value>(_ function: String, _ argumentCount: UInt, _ deterministic: Bool,\n                                              _ block: @escaping ([Binding?]) -> Z) throws\n                    -> ([Expressible]) -> Expression<Z> {\n        createFunction(function, argumentCount: argumentCount, deterministic: deterministic) { arguments in\n            block(arguments).datatypeValue\n        }\n        return { arguments in\n            function.quote().wrap(\", \".join(arguments))\n        }\n    }\n\n    fileprivate func createFunction<Z: Value>(_ function: String, _ argumentCount: UInt, _ deterministic: Bool,\n                                              _ block: @escaping ([Binding?]) -> Z?) throws\n                    -> ([Expressible]) -> Expression<Z?> {\n        createFunction(function, argumentCount: argumentCount, deterministic: deterministic) { arguments in\n            block(arguments)?.datatypeValue\n        }\n        return { arguments in\n            function.quote().wrap(\", \".join(arguments))\n        }\n    }\n\n}\n"
  },
  {
    "path": "Sources/SQLite/Typed/DateAndTimeFunctions.swift",
    "content": "//\n// SQLite.swift\n// https://github.com/stephencelis/SQLite.swift\n// Copyright © 2014-2015 Stephen Celis.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport Foundation\n\n/// All five date and time functions take a time string as an argument.\n/// The time string is followed by zero or more modifiers.\n/// The strftime() function also takes a format string as its first argument.\n///\n/// https://www.sqlite.org/lang_datefunc.html\npublic final class DateFunctions: Sendable {\n    /// The date() function returns the date in this format: YYYY-MM-DD.\n    public static func date(_ timestring: String, _ modifiers: String...) -> Expression<Date?> {\n        timefunction(\"date\", timestring: timestring, modifiers: modifiers)\n    }\n\n    /// The time() function returns the time as HH:MM:SS.\n    public static func time(_ timestring: String, _ modifiers: String...) -> Expression<Date?> {\n        timefunction(\"time\", timestring: timestring, modifiers: modifiers)\n    }\n\n    /// The datetime() function returns \"YYYY-MM-DD HH:MM:SS\".\n    public static func datetime(_ timestring: String, _ modifiers: String...) -> Expression<Date?> {\n        timefunction(\"datetime\", timestring: timestring, modifiers: modifiers)\n    }\n\n    /// The julianday() function returns the Julian day -\n    /// the number of days since noon in Greenwich on November 24, 4714 B.C.\n    public static func julianday(_ timestring: String, _ modifiers: String...) -> Expression<Date?> {\n        timefunction(\"julianday\", timestring: timestring, modifiers: modifiers)\n    }\n\n    ///  The strftime() routine returns the date formatted according to the format string specified as the first argument.\n    public static func strftime(_ format: String, _ timestring: String, _ modifiers: String...) -> Expression<Date?> {\n        if !modifiers.isEmpty {\n            let templates = [String](repeating: \"?\", count: modifiers.count).joined(separator: \", \")\n            return Expression(\"strftime(?, ?, \\(templates))\", [format, timestring] + modifiers)\n        }\n        return Expression(\"strftime(?, ?)\", [format, timestring])\n    }\n\n    private static func timefunction(_ name: String, timestring: String, modifiers: [String]) -> Expression<Date?> {\n        if !modifiers.isEmpty {\n            let templates = [String](repeating: \"?\", count: modifiers.count).joined(separator: \", \")\n            return Expression(\"\\(name)(?, \\(templates))\", [timestring] + modifiers)\n        }\n        return Expression(\"\\(name)(?)\", [timestring])\n    }\n}\n\nextension Date {\n    public var date: Expression<Date?> {\n        DateFunctions.date(dateFormatter.string(from: self))\n    }\n\n    public var time: Expression<Date?> {\n        DateFunctions.time(dateFormatter.string(from: self))\n    }\n\n    public var datetime: Expression<Date?> {\n        DateFunctions.datetime(dateFormatter.string(from: self))\n    }\n\n    public var julianday: Expression<Date?> {\n        DateFunctions.julianday(dateFormatter.string(from: self))\n    }\n}\n\nextension Expression where UnderlyingType == Date {\n    public var date: Expression<Date> {\n        Expression<Date>(\"date(\\(template))\", bindings)\n    }\n\n    public var time: Expression<Date> {\n        Expression<Date>(\"time(\\(template))\", bindings)\n    }\n\n    public var datetime: Expression<Date> {\n        Expression<Date>(\"datetime(\\(template))\", bindings)\n    }\n\n    public var julianday: Expression<Date> {\n        Expression<Date>(\"julianday(\\(template))\", bindings)\n    }\n}\n"
  },
  {
    "path": "Sources/SQLite/Typed/Expression.swift",
    "content": "//\n// SQLite.swift\n// https://github.com/stephencelis/SQLite.swift\n// Copyright © 2014-2015 Stephen Celis.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\npublic protocol ExpressionType: Expressible, CustomStringConvertible, Sendable { // extensions cannot have inheritance clauses\n\n    associatedtype UnderlyingType = Void\n\n    var template: String { get }\n    var bindings: [Binding?] { get }\n\n    init(_ template: String, _ bindings: [Binding?])\n\n}\n\nextension ExpressionType {\n\n    public init(literal: String) {\n        self.init(literal, [])\n    }\n\n    public init(_ identifier: String) {\n        self.init(literal: identifier.quote())\n    }\n\n    public init<U: ExpressionType>(_ expression: U) {\n        self.init(expression.template, expression.bindings)\n    }\n\n    public var description: String {\n        asSQL()\n    }\n}\n\n/// An `Expression` represents a raw SQL fragment and any associated bindings.\npublic struct Expression<Datatype>: ExpressionType {\n\n    public typealias UnderlyingType = Datatype\n\n    public var template: String\n    public var bindings: [Binding?]\n\n    public init(_ template: String, _ bindings: [Binding?]) {\n        self.template = template\n        self.bindings = bindings\n    }\n\n}\n\npublic protocol Expressible: Sendable {\n\n    var expression: Expression<Void> { get }\n\n}\n\nextension Expressible {\n\n    // naïve compiler for statements that can’t be bound, e.g., CREATE TABLE\n    func asSQL() -> String {\n        let expressed = expression\n        return expressed.template.reduce((\"\", 0)) { memo, character in\n            let (template, index) = memo\n\n            if character == \"?\" {\n                precondition(index < expressed.bindings.count, \"not enough bindings for expression\")\n                return (template + transcode(expressed.bindings[index]), index + 1)\n            } else {\n                return (template + String(character), index)\n            }\n        }.0\n    }\n}\n\nextension ExpressionType {\n\n    public var expression: Expression<Void> {\n        Expression(template, bindings)\n    }\n\n    public var asc: Expressible {\n        \" \".join([self, Expression<Void>(literal: \"ASC\")])\n    }\n\n    public var desc: Expressible {\n        \" \".join([self, Expression<Void>(literal: \"DESC\")])\n    }\n\n}\n\nextension ExpressionType where UnderlyingType: Value {\n\n    public init(value: UnderlyingType) {\n        self.init(\"?\", [value.datatypeValue])\n    }\n\n}\n\nextension ExpressionType where UnderlyingType: _OptionalType, UnderlyingType.WrappedType: Value {\n\n    public static var null: Self {\n        self.init(value: nil)\n    }\n\n    public init(value: UnderlyingType.WrappedType?) {\n        self.init(\"?\", [value?.datatypeValue])\n    }\n\n}\n\nextension Value {\n\n    public var expression: Expression<Void> {\n        Expression(value: self).expression\n    }\n\n}\n\npublic let rowid = Expression<Int64>(\"ROWID\")\n\npublic func cast<T: Value, U: Value>(_ expression: Expression<T>) -> Expression<U> {\n    Expression(\"CAST (\\(expression.template) AS \\(U.declaredDatatype))\", expression.bindings)\n}\n\npublic func cast<T: Value, U: Value>(_ expression: Expression<T?>) -> Expression<U?> {\n    Expression(\"CAST (\\(expression.template) AS \\(U.declaredDatatype))\", expression.bindings)\n}\n"
  },
  {
    "path": "Sources/SQLite/Typed/Operators.swift",
    "content": "//\n// SQLite.swift\n// https://github.com/stephencelis/SQLite.swift\n// Copyright © 2014-2015 Stephen Celis.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n// swiftlint:disable file_length\nprivate enum Operator: String, Sendable {\n    case plus = \"+\"\n    case minus = \"-\"\n    case or = \"OR\"\n    case and = \"AND\"\n    case not = \"NOT \"\n    case mul = \"*\"\n    case div = \"/\"\n    case mod = \"%\"\n    case bitwiseLeft = \"<<\"\n    case bitwiseRight = \">>\"\n    case bitwiseAnd = \"&\"\n    case bitwiseOr = \"|\"\n    case bitwiseXor = \"~\"\n    case eq = \"=\"\n    case neq = \"!=\"\n    case gt = \">\"\n    case lt = \"<\"\n    case gte = \">=\"\n    case lte = \"<=\"\n    case concatenate = \"||\"\n\n    func infix<T>(_ lhs: Expressible, _ rhs: Expressible, wrap: Bool = true) -> Expression<T> {\n        self.rawValue.infix(lhs, rhs, wrap: wrap)\n    }\n\n    func wrap<T>(_ expression: Expressible) -> Expression<T> {\n        self.rawValue.wrap(expression)\n    }\n}\n\npublic func +(lhs: Expression<String>, rhs: Expression<String>) -> Expression<String> {\n    Operator.concatenate.infix(lhs, rhs)\n}\n\npublic func +(lhs: Expression<String>, rhs: Expression<String?>) -> Expression<String?> {\n    Operator.concatenate.infix(lhs, rhs)\n}\npublic func +(lhs: Expression<String?>, rhs: Expression<String>) -> Expression<String?> {\n    Operator.concatenate.infix(lhs, rhs)\n}\npublic func +(lhs: Expression<String?>, rhs: Expression<String?>) -> Expression<String?> {\n    Operator.concatenate.infix(lhs, rhs)\n}\npublic func +(lhs: Expression<String>, rhs: String) -> Expression<String> {\n    Operator.concatenate.infix(lhs, rhs)\n}\npublic func +(lhs: Expression<String?>, rhs: String) -> Expression<String?> {\n    Operator.concatenate.infix(lhs, rhs)\n}\npublic func +(lhs: String, rhs: Expression<String>) -> Expression<String> {\n    Operator.concatenate.infix(lhs, rhs)\n}\npublic func +(lhs: String, rhs: Expression<String?>) -> Expression<String?> {\n    Operator.concatenate.infix(lhs, rhs)\n}\n\n// MARK: -\n\npublic func +<V: Value>(lhs: Expression<V>, rhs: Expression<V>) -> Expression<V> where V.Datatype: Number {\n    Operator.plus.infix(lhs, rhs)\n}\npublic func +<V: Value>(lhs: Expression<V>, rhs: Expression<V?>) -> Expression<V?> where V.Datatype: Number {\n    Operator.plus.infix(lhs, rhs)\n}\npublic func +<V: Value>(lhs: Expression<V?>, rhs: Expression<V>) -> Expression<V?> where V.Datatype: Number {\n    Operator.plus.infix(lhs, rhs)\n}\npublic func +<V: Value>(lhs: Expression<V?>, rhs: Expression<V?>) -> Expression<V?> where V.Datatype: Number {\n    Operator.plus.infix(lhs, rhs)\n}\npublic func +<V: Value>(lhs: Expression<V>, rhs: V) -> Expression<V> where V.Datatype: Number {\n    Operator.plus.infix(lhs, rhs)\n}\npublic func +<V: Value>(lhs: Expression<V?>, rhs: V) -> Expression<V?> where V.Datatype: Number {\n    Operator.plus.infix(lhs, rhs)\n}\npublic func +<V: Value>(lhs: V, rhs: Expression<V>) -> Expression<V> where V.Datatype: Number {\n    Operator.plus.infix(lhs, rhs)\n}\npublic func +<V: Value>(lhs: V, rhs: Expression<V?>) -> Expression<V?> where V.Datatype: Number {\n    Operator.plus.infix(lhs, rhs)\n}\n\npublic func -<V: Value>(lhs: Expression<V>, rhs: Expression<V>) -> Expression<V> where V.Datatype: Number {\n    Operator.minus.infix(lhs, rhs)\n}\npublic func -<V: Value>(lhs: Expression<V>, rhs: Expression<V?>) -> Expression<V?> where V.Datatype: Number {\n    Operator.minus.infix(lhs, rhs)\n}\npublic func -<V: Value>(lhs: Expression<V?>, rhs: Expression<V>) -> Expression<V?> where V.Datatype: Number {\n    Operator.minus.infix(lhs, rhs)\n}\npublic func -<V: Value>(lhs: Expression<V?>, rhs: Expression<V?>) -> Expression<V?> where V.Datatype: Number {\n    Operator.minus.infix(lhs, rhs)\n}\npublic func -<V: Value>(lhs: Expression<V>, rhs: V) -> Expression<V> where V.Datatype: Number {\n    Operator.minus.infix(lhs, rhs)\n}\npublic func -<V: Value>(lhs: Expression<V?>, rhs: V) -> Expression<V?> where V.Datatype: Number {\n    Operator.minus.infix(lhs, rhs)\n}\npublic func -<V: Value>(lhs: V, rhs: Expression<V>) -> Expression<V> where V.Datatype: Number {\n    Operator.minus.infix(lhs, rhs)\n}\npublic func -<V: Value>(lhs: V, rhs: Expression<V?>) -> Expression<V?> where V.Datatype: Number {\n    Operator.minus.infix(lhs, rhs)\n}\n\npublic func *<V: Value>(lhs: Expression<V>, rhs: Expression<V>) -> Expression<V> where V.Datatype: Number {\n    Operator.mul.infix(lhs, rhs)\n}\npublic func *<V: Value>(lhs: Expression<V>, rhs: Expression<V?>) -> Expression<V?> where V.Datatype: Number {\n    Operator.mul.infix(lhs, rhs)\n}\npublic func *<V: Value>(lhs: Expression<V?>, rhs: Expression<V>) -> Expression<V?> where V.Datatype: Number {\n    Operator.mul.infix(lhs, rhs)\n}\npublic func *<V: Value>(lhs: Expression<V?>, rhs: Expression<V?>) -> Expression<V?> where V.Datatype: Number {\n    Operator.mul.infix(lhs, rhs)\n}\npublic func *<V: Value>(lhs: Expression<V>, rhs: V) -> Expression<V> where V.Datatype: Number {\n    Operator.mul.infix(lhs, rhs)\n}\npublic func *<V: Value>(lhs: Expression<V?>, rhs: V) -> Expression<V?> where V.Datatype: Number {\n    Operator.mul.infix(lhs, rhs)\n}\npublic func *<V: Value>(lhs: V, rhs: Expression<V>) -> Expression<V> where V.Datatype: Number {\n    Operator.mul.infix(lhs, rhs)\n}\npublic func *<V: Value>(lhs: V, rhs: Expression<V?>) -> Expression<V?> where V.Datatype: Number {\n    Operator.mul.infix(lhs, rhs)\n}\n\npublic func /<V: Value>(lhs: Expression<V>, rhs: Expression<V>) -> Expression<V> where V.Datatype: Number {\n    Operator.div.infix(lhs, rhs)\n}\npublic func /<V: Value>(lhs: Expression<V>, rhs: Expression<V?>) -> Expression<V?> where V.Datatype: Number {\n    Operator.div.infix(lhs, rhs)\n}\npublic func /<V: Value>(lhs: Expression<V?>, rhs: Expression<V>) -> Expression<V?> where V.Datatype: Number {\n    Operator.div.infix(lhs, rhs)\n}\npublic func /<V: Value>(lhs: Expression<V?>, rhs: Expression<V?>) -> Expression<V?> where V.Datatype: Number {\n    Operator.div.infix(lhs, rhs)\n}\npublic func /<V: Value>(lhs: Expression<V>, rhs: V) -> Expression<V> where V.Datatype: Number {\n    Operator.div.infix(lhs, rhs)\n}\npublic func /<V: Value>(lhs: Expression<V?>, rhs: V) -> Expression<V?> where V.Datatype: Number {\n    Operator.div.infix(lhs, rhs)\n}\npublic func /<V: Value>(lhs: V, rhs: Expression<V>) -> Expression<V> where V.Datatype: Number {\n    Operator.div.infix(lhs, rhs)\n}\npublic func /<V: Value>(lhs: V, rhs: Expression<V?>) -> Expression<V?> where V.Datatype: Number {\n    Operator.div.infix(lhs, rhs)\n}\n\npublic prefix func -<V: Value>(rhs: Expression<V>) -> Expression<V> where V.Datatype: Number {\n    Operator.minus.wrap(rhs)\n}\npublic prefix func -<V: Value>(rhs: Expression<V?>) -> Expression<V?> where V.Datatype: Number {\n    Operator.minus.wrap(rhs)\n}\n\n// MARK: -\n\npublic func %<V: Value>(lhs: Expression<V>, rhs: Expression<V>) -> Expression<V> where V.Datatype == Int64 {\n    Operator.mod.infix(lhs, rhs)\n}\npublic func %<V: Value>(lhs: Expression<V>, rhs: Expression<V?>) -> Expression<V?> where V.Datatype == Int64 {\n    Operator.mod.infix(lhs, rhs)\n}\npublic func %<V: Value>(lhs: Expression<V?>, rhs: Expression<V>) -> Expression<V?> where V.Datatype == Int64 {\n    Operator.mod.infix(lhs, rhs)\n}\npublic func %<V: Value>(lhs: Expression<V?>, rhs: Expression<V?>) -> Expression<V?> where V.Datatype == Int64 {\n    Operator.mod.infix(lhs, rhs)\n}\npublic func %<V: Value>(lhs: Expression<V>, rhs: V) -> Expression<V> where V.Datatype == Int64 {\n    Operator.mod.infix(lhs, rhs)\n}\npublic func %<V: Value>(lhs: Expression<V?>, rhs: V) -> Expression<V?> where V.Datatype == Int64 {\n    Operator.mod.infix(lhs, rhs)\n}\npublic func %<V: Value>(lhs: V, rhs: Expression<V>) -> Expression<V> where V.Datatype == Int64 {\n    Operator.mod.infix(lhs, rhs)\n}\npublic func %<V: Value>(lhs: V, rhs: Expression<V?>) -> Expression<V?> where V.Datatype == Int64 {\n    Operator.mod.infix(lhs, rhs)\n}\n\npublic func <<<V: Value>(lhs: Expression<V>, rhs: Expression<V>) -> Expression<V> where V.Datatype == Int64 {\n    Operator.bitwiseLeft.infix(lhs, rhs)\n}\npublic func <<<V: Value>(lhs: Expression<V>, rhs: Expression<V?>) -> Expression<V?> where V.Datatype == Int64 {\n    Operator.bitwiseLeft.infix(lhs, rhs)\n}\npublic func <<<V: Value>(lhs: Expression<V?>, rhs: Expression<V>) -> Expression<V?> where V.Datatype == Int64 {\n    Operator.bitwiseLeft.infix(lhs, rhs)\n}\npublic func <<<V: Value>(lhs: Expression<V?>, rhs: Expression<V?>) -> Expression<V?> where V.Datatype == Int64 {\n    Operator.bitwiseLeft.infix(lhs, rhs)\n}\npublic func <<<V: Value>(lhs: Expression<V>, rhs: V) -> Expression<V> where V.Datatype == Int64 {\n    Operator.bitwiseLeft.infix(lhs, rhs)\n}\npublic func <<<V: Value>(lhs: Expression<V?>, rhs: V) -> Expression<V?> where V.Datatype == Int64 {\n    Operator.bitwiseLeft.infix(lhs, rhs)\n}\npublic func <<<V: Value>(lhs: V, rhs: Expression<V>) -> Expression<V> where V.Datatype == Int64 {\n    Operator.bitwiseLeft.infix(lhs, rhs)\n}\npublic func <<<V: Value>(lhs: V, rhs: Expression<V?>) -> Expression<V?> where V.Datatype == Int64 {\n    Operator.bitwiseLeft.infix(lhs, rhs)\n}\n\npublic func >><V: Value>(lhs: Expression<V>, rhs: Expression<V>) -> Expression<V> where V.Datatype == Int64 {\n    Operator.bitwiseRight.infix(lhs, rhs)\n}\npublic func >><V: Value>(lhs: Expression<V>, rhs: Expression<V?>) -> Expression<V?> where V.Datatype == Int64 {\n    Operator.bitwiseRight.infix(lhs, rhs)\n}\npublic func >><V: Value>(lhs: Expression<V?>, rhs: Expression<V>) -> Expression<V?> where V.Datatype == Int64 {\n    Operator.bitwiseRight.infix(lhs, rhs)\n}\npublic func >><V: Value>(lhs: Expression<V?>, rhs: Expression<V?>) -> Expression<V?> where V.Datatype == Int64 {\n    Operator.bitwiseRight.infix(lhs, rhs)\n}\npublic func >><V: Value>(lhs: Expression<V>, rhs: V) -> Expression<V> where V.Datatype == Int64 {\n    Operator.bitwiseRight.infix(lhs, rhs)\n}\npublic func >><V: Value>(lhs: Expression<V?>, rhs: V) -> Expression<V?> where V.Datatype == Int64 {\n    Operator.bitwiseRight.infix(lhs, rhs)\n}\npublic func >><V: Value>(lhs: V, rhs: Expression<V>) -> Expression<V> where V.Datatype == Int64 {\n    Operator.bitwiseRight.infix(lhs, rhs)\n}\npublic func >><V: Value>(lhs: V, rhs: Expression<V?>) -> Expression<V?> where V.Datatype == Int64 {\n    Operator.bitwiseRight.infix(lhs, rhs)\n}\n\npublic func &<V: Value>(lhs: Expression<V>, rhs: Expression<V>) -> Expression<V> where V.Datatype == Int64 {\n    Operator.bitwiseAnd.infix(lhs, rhs)\n}\npublic func &<V: Value>(lhs: Expression<V>, rhs: Expression<V?>) -> Expression<V?> where V.Datatype == Int64 {\n    Operator.bitwiseAnd.infix(lhs, rhs)\n}\npublic func &<V: Value>(lhs: Expression<V?>, rhs: Expression<V>) -> Expression<V?> where V.Datatype == Int64 {\n    Operator.bitwiseAnd.infix(lhs, rhs)\n}\npublic func &<V: Value>(lhs: Expression<V?>, rhs: Expression<V?>) -> Expression<V?> where V.Datatype == Int64 {\n    Operator.bitwiseAnd.infix(lhs, rhs)\n}\npublic func &<V: Value>(lhs: Expression<V>, rhs: V) -> Expression<V> where V.Datatype == Int64 {\n    Operator.bitwiseAnd.infix(lhs, rhs)\n}\npublic func &<V: Value>(lhs: Expression<V?>, rhs: V) -> Expression<V?> where V.Datatype == Int64 {\n    Operator.bitwiseAnd.infix(lhs, rhs)\n}\npublic func &<V: Value>(lhs: V, rhs: Expression<V>) -> Expression<V> where V.Datatype == Int64 {\n    Operator.bitwiseAnd.infix(lhs, rhs)\n}\npublic func &<V: Value>(lhs: V, rhs: Expression<V?>) -> Expression<V?> where V.Datatype == Int64 {\n    Operator.bitwiseAnd.infix(lhs, rhs)\n}\n\npublic func |<V: Value>(lhs: Expression<V>, rhs: Expression<V>) -> Expression<V> where V.Datatype == Int64 {\n    Operator.bitwiseOr.infix(lhs, rhs)\n}\npublic func |<V: Value>(lhs: Expression<V>, rhs: Expression<V?>) -> Expression<V?> where V.Datatype == Int64 {\n    Operator.bitwiseOr.infix(lhs, rhs)\n}\npublic func |<V: Value>(lhs: Expression<V?>, rhs: Expression<V>) -> Expression<V?> where V.Datatype == Int64 {\n    Operator.bitwiseOr.infix(lhs, rhs)\n}\npublic func |<V: Value>(lhs: Expression<V?>, rhs: Expression<V?>) -> Expression<V?> where V.Datatype == Int64 {\n    Operator.bitwiseOr.infix(lhs, rhs)\n}\npublic func |<V: Value>(lhs: Expression<V>, rhs: V) -> Expression<V> where V.Datatype == Int64 {\n    Operator.bitwiseOr.infix(lhs, rhs)\n}\npublic func |<V: Value>(lhs: Expression<V?>, rhs: V) -> Expression<V?> where V.Datatype == Int64 {\n    Operator.bitwiseOr.infix(lhs, rhs)\n}\npublic func |<V: Value>(lhs: V, rhs: Expression<V>) -> Expression<V> where V.Datatype == Int64 {\n    Operator.bitwiseOr.infix(lhs, rhs)\n}\npublic func |<V: Value>(lhs: V, rhs: Expression<V?>) -> Expression<V?> where V.Datatype == Int64 {\n    Operator.bitwiseOr.infix(lhs, rhs)\n}\n\npublic func ^<V: Value>(lhs: Expression<V>, rhs: Expression<V>) -> Expression<V> where V.Datatype == Int64 {\n    (~(lhs & rhs)) & (lhs | rhs)\n}\npublic func ^<V: Value>(lhs: Expression<V>, rhs: Expression<V?>) -> Expression<V?> where V.Datatype == Int64 {\n    (~(lhs & rhs)) & (lhs | rhs)\n}\npublic func ^<V: Value>(lhs: Expression<V?>, rhs: Expression<V>) -> Expression<V?> where V.Datatype == Int64 {\n    (~(lhs & rhs)) & (lhs | rhs)\n}\npublic func ^<V: Value>(lhs: Expression<V?>, rhs: Expression<V?>) -> Expression<V?> where V.Datatype == Int64 {\n    (~(lhs & rhs)) & (lhs | rhs)\n}\npublic func ^<V: Value>(lhs: Expression<V>, rhs: V) -> Expression<V> where V.Datatype == Int64 {\n    (~(lhs & rhs)) & (lhs | rhs)\n}\npublic func ^<V: Value>(lhs: Expression<V?>, rhs: V) -> Expression<V?> where V.Datatype == Int64 {\n    (~(lhs & rhs)) & (lhs | rhs)\n}\npublic func ^<V: Value>(lhs: V, rhs: Expression<V>) -> Expression<V> where V.Datatype == Int64 {\n    (~(lhs & rhs)) & (lhs | rhs)\n}\npublic func ^<V: Value>(lhs: V, rhs: Expression<V?>) -> Expression<V?> where V.Datatype == Int64 {\n    (~(lhs & rhs)) & (lhs | rhs)\n}\n\npublic prefix func ~<V: Value>(rhs: Expression<V>) -> Expression<V> where V.Datatype == Int64 {\n    Operator.bitwiseXor.wrap(rhs)\n}\npublic prefix func ~<V: Value>(rhs: Expression<V?>) -> Expression<V?> where V.Datatype == Int64 {\n    Operator.bitwiseXor.wrap(rhs)\n}\n\n// MARK: -\n\npublic func ==<V: Value>(lhs: Expression<V>, rhs: Expression<V>) -> Expression<Bool> where V.Datatype: Equatable {\n    Operator.eq.infix(lhs, rhs)\n}\npublic func ==<V: Value>(lhs: Expression<V>, rhs: Expression<V?>) -> Expression<Bool?> where V.Datatype: Equatable {\n    Operator.eq.infix(lhs, rhs)\n}\npublic func ==<V: Value>(lhs: Expression<V?>, rhs: Expression<V>) -> Expression<Bool?> where V.Datatype: Equatable {\n    Operator.eq.infix(lhs, rhs)\n}\npublic func ==<V: Value>(lhs: Expression<V?>, rhs: Expression<V?>) -> Expression<Bool?> where V.Datatype: Equatable {\n    Operator.eq.infix(lhs, rhs)\n}\npublic func ==<V: Value>(lhs: Expression<V>, rhs: V) -> Expression<Bool> where V.Datatype: Equatable {\n    Operator.eq.infix(lhs, rhs)\n}\npublic func ==<V: Value>(lhs: Expression<V?>, rhs: V?) -> Expression<Bool?> where V.Datatype: Equatable {\n    guard let rhs else { return \"IS\".infix(lhs, Expression<V?>(value: nil)) }\n    return Operator.eq.infix(lhs, rhs)\n}\npublic func ==<V: Value>(lhs: V, rhs: Expression<V>) -> Expression<Bool> where V.Datatype: Equatable {\n    Operator.eq.infix(lhs, rhs)\n}\npublic func ==<V: Value>(lhs: V?, rhs: Expression<V?>) -> Expression<Bool?> where V.Datatype: Equatable {\n    guard let lhs else { return \"IS\".infix(Expression<V?>(value: nil), rhs) }\n    return Operator.eq.infix(lhs, rhs)\n}\n\npublic func ===<V: Value>(lhs: Expression<V>, rhs: Expression<V>) -> Expression<Bool> where V.Datatype: Equatable {\n    \"IS\".infix(lhs, rhs)\n}\npublic func ===<V: Value>(lhs: Expression<V>, rhs: Expression<V?>) -> Expression<Bool?> where V.Datatype: Equatable {\n    \"IS\".infix(lhs, rhs)\n}\npublic func ===<V: Value>(lhs: Expression<V?>, rhs: Expression<V>) -> Expression<Bool?> where V.Datatype: Equatable {\n    \"IS\".infix(lhs, rhs)\n}\npublic func ===<V: Value>(lhs: Expression<V?>, rhs: Expression<V?>) -> Expression<Bool?> where V.Datatype: Equatable {\n    \"IS\".infix(lhs, rhs)\n}\npublic func ===<V: Value>(lhs: Expression<V>, rhs: V) -> Expression<Bool> where V.Datatype: Equatable {\n    \"IS\".infix(lhs, rhs)\n}\npublic func ===<V: Value>(lhs: Expression<V?>, rhs: V?) -> Expression<Bool?> where V.Datatype: Equatable {\n    guard let rhs else { return \"IS\".infix(lhs, Expression<V?>(value: nil)) }\n    return \"IS\".infix(lhs, rhs)\n}\npublic func ===<V: Value>(lhs: V, rhs: Expression<V>) -> Expression<Bool> where V.Datatype: Equatable {\n    \"IS\".infix(lhs, rhs)\n}\npublic func ===<V: Value>(lhs: V?, rhs: Expression<V?>) -> Expression<Bool?> where V.Datatype: Equatable {\n    guard let lhs else { return \"IS\".infix(Expression<V?>(value: nil), rhs) }\n    return \"IS\".infix(lhs, rhs)\n}\n\npublic func !=<V: Value>(lhs: Expression<V>, rhs: Expression<V>) -> Expression<Bool> where V.Datatype: Equatable {\n    Operator.neq.infix(lhs, rhs)\n}\npublic func !=<V: Value>(lhs: Expression<V>, rhs: Expression<V?>) -> Expression<Bool?> where V.Datatype: Equatable {\n    Operator.neq.infix(lhs, rhs)\n}\npublic func !=<V: Value>(lhs: Expression<V?>, rhs: Expression<V>) -> Expression<Bool?> where V.Datatype: Equatable {\n    Operator.neq.infix(lhs, rhs)\n}\npublic func !=<V: Value>(lhs: Expression<V?>, rhs: Expression<V?>) -> Expression<Bool?> where V.Datatype: Equatable {\n    Operator.neq.infix(lhs, rhs)\n}\npublic func !=<V: Value>(lhs: Expression<V>, rhs: V) -> Expression<Bool> where V.Datatype: Equatable {\n    Operator.neq.infix(lhs, rhs)\n}\npublic func !=<V: Value>(lhs: Expression<V?>, rhs: V?) -> Expression<Bool?> where V.Datatype: Equatable {\n    guard let rhs else { return \"IS NOT\".infix(lhs, Expression<V?>(value: nil)) }\n    return Operator.neq.infix(lhs, rhs)\n}\npublic func !=<V: Value>(lhs: V, rhs: Expression<V>) -> Expression<Bool> where V.Datatype: Equatable {\n    Operator.neq.infix(lhs, rhs)\n}\npublic func !=<V: Value>(lhs: V?, rhs: Expression<V?>) -> Expression<Bool?> where V.Datatype: Equatable {\n    guard let lhs else { return \"IS NOT\".infix(Expression<V?>(value: nil), rhs) }\n    return Operator.neq.infix(lhs, rhs)\n}\n\npublic func !==<V: Value>(lhs: Expression<V>, rhs: Expression<V>) -> Expression<Bool> where V.Datatype: Equatable {\n    \"IS NOT\".infix(lhs, rhs)\n}\npublic func !==<V: Value>(lhs: Expression<V>, rhs: Expression<V?>) -> Expression<Bool?> where V.Datatype: Equatable {\n    \"IS NOT\".infix(lhs, rhs)\n}\npublic func !==<V: Value>(lhs: Expression<V?>, rhs: Expression<V>) -> Expression<Bool?> where V.Datatype: Equatable {\n    \"IS NOT\".infix(lhs, rhs)\n}\npublic func !==<V: Value>(lhs: Expression<V?>, rhs: Expression<V?>) -> Expression<Bool?> where V.Datatype: Equatable {\n    \"IS NOT\".infix(lhs, rhs)\n}\npublic func !==<V: Value>(lhs: Expression<V>, rhs: V) -> Expression<Bool> where V.Datatype: Equatable {\n    \"IS NOT\".infix(lhs, rhs)\n}\npublic func !==<V: Value>(lhs: Expression<V?>, rhs: V?) -> Expression<Bool?> where V.Datatype: Equatable {\n    guard let rhs else { return \"IS NOT\".infix(lhs, Expression<V?>(value: nil)) }\n    return \"IS NOT\".infix(lhs, rhs)\n}\npublic func !==<V: Value>(lhs: V, rhs: Expression<V>) -> Expression<Bool> where V.Datatype: Equatable {\n    \"IS NOT\".infix(lhs, rhs)\n}\npublic func !==<V: Value>(lhs: V?, rhs: Expression<V?>) -> Expression<Bool?> where V.Datatype: Equatable {\n    guard let lhs else { return \"IS NOT\".infix(Expression<V?>(value: nil), rhs) }\n    return \"IS NOT\".infix(lhs, rhs)\n}\n\npublic func ><V: Value>(lhs: Expression<V>, rhs: Expression<V>) -> Expression<Bool> where V.Datatype: Comparable {\n    Operator.gt.infix(lhs, rhs)\n}\npublic func ><V: Value>(lhs: Expression<V>, rhs: Expression<V?>) -> Expression<Bool?> where V.Datatype: Comparable {\n    Operator.gt.infix(lhs, rhs)\n}\npublic func ><V: Value>(lhs: Expression<V?>, rhs: Expression<V>) -> Expression<Bool?> where V.Datatype: Comparable {\n    Operator.gt.infix(lhs, rhs)\n}\npublic func ><V: Value>(lhs: Expression<V?>, rhs: Expression<V?>) -> Expression<Bool?> where V.Datatype: Comparable {\n    Operator.gt.infix(lhs, rhs)\n}\npublic func ><V: Value>(lhs: Expression<V>, rhs: V) -> Expression<Bool> where V.Datatype: Comparable {\n    Operator.gt.infix(lhs, rhs)\n}\npublic func ><V: Value>(lhs: Expression<V?>, rhs: V) -> Expression<Bool?> where V.Datatype: Comparable {\n    Operator.gt.infix(lhs, rhs)\n}\npublic func ><V: Value>(lhs: V, rhs: Expression<V>) -> Expression<Bool> where V.Datatype: Comparable {\n    Operator.gt.infix(lhs, rhs)\n}\npublic func ><V: Value>(lhs: V, rhs: Expression<V?>) -> Expression<Bool?> where V.Datatype: Comparable {\n    Operator.gt.infix(lhs, rhs)\n}\n\npublic func >=<V: Value>(lhs: Expression<V>, rhs: Expression<V>) -> Expression<Bool> where V.Datatype: Comparable {\n    Operator.gte.infix(lhs, rhs)\n}\npublic func >=<V: Value>(lhs: Expression<V>, rhs: Expression<V?>) -> Expression<Bool?> where V.Datatype: Comparable {\n    Operator.gte.infix(lhs, rhs)\n}\npublic func >=<V: Value>(lhs: Expression<V?>, rhs: Expression<V>) -> Expression<Bool?> where V.Datatype: Comparable {\n    Operator.gte.infix(lhs, rhs)\n}\npublic func >=<V: Value>(lhs: Expression<V?>, rhs: Expression<V?>) -> Expression<Bool?> where V.Datatype: Comparable {\n    Operator.gte.infix(lhs, rhs)\n}\npublic func >=<V: Value>(lhs: Expression<V>, rhs: V) -> Expression<Bool> where V.Datatype: Comparable {\n    Operator.gte.infix(lhs, rhs)\n}\npublic func >=<V: Value>(lhs: Expression<V?>, rhs: V) -> Expression<Bool?> where V.Datatype: Comparable {\n    Operator.gte.infix(lhs, rhs)\n}\npublic func >=<V: Value>(lhs: V, rhs: Expression<V>) -> Expression<Bool> where V.Datatype: Comparable {\n    Operator.gte.infix(lhs, rhs)\n}\npublic func >=<V: Value>(lhs: V, rhs: Expression<V?>) -> Expression<Bool?> where V.Datatype: Comparable {\n    Operator.gte.infix(lhs, rhs)\n}\n\npublic func <<V: Value>(lhs: Expression<V>, rhs: Expression<V>) -> Expression<Bool> where V.Datatype: Comparable {\n    Operator.lt.infix(lhs, rhs)\n}\npublic func <<V: Value>(lhs: Expression<V>, rhs: Expression<V?>) -> Expression<Bool?> where V.Datatype: Comparable {\n    Operator.lt.infix(lhs, rhs)\n}\npublic func <<V: Value>(lhs: Expression<V?>, rhs: Expression<V>) -> Expression<Bool?> where V.Datatype: Comparable {\n    Operator.lt.infix(lhs, rhs)\n}\npublic func <<V: Value>(lhs: Expression<V?>, rhs: Expression<V?>) -> Expression<Bool?> where V.Datatype: Comparable {\n    Operator.lt.infix(lhs, rhs)\n}\npublic func <<V: Value>(lhs: Expression<V>, rhs: V) -> Expression<Bool> where V.Datatype: Comparable {\n    Operator.lt.infix(lhs, rhs)\n}\npublic func <<V: Value>(lhs: Expression<V?>, rhs: V) -> Expression<Bool?> where V.Datatype: Comparable {\n    Operator.lt.infix(lhs, rhs)\n}\npublic func <<V: Value>(lhs: V, rhs: Expression<V>) -> Expression<Bool> where V.Datatype: Comparable {\n    Operator.lt.infix(lhs, rhs)\n}\npublic func <<V: Value>(lhs: V, rhs: Expression<V?>) -> Expression<Bool?> where V.Datatype: Comparable {\n    Operator.lt.infix(lhs, rhs)\n}\n\npublic func <=<V: Value>(lhs: Expression<V>, rhs: Expression<V>) -> Expression<Bool> where V.Datatype: Comparable {\n    Operator.lte.infix(lhs, rhs)\n}\npublic func <=<V: Value>(lhs: Expression<V>, rhs: Expression<V?>) -> Expression<Bool?> where V.Datatype: Comparable {\n    Operator.lte.infix(lhs, rhs)\n}\npublic func <=<V: Value>(lhs: Expression<V?>, rhs: Expression<V>) -> Expression<Bool?> where V.Datatype: Comparable {\n    Operator.lte.infix(lhs, rhs)\n}\npublic func <=<V: Value>(lhs: Expression<V?>, rhs: Expression<V?>) -> Expression<Bool?> where V.Datatype: Comparable {\n    Operator.lte.infix(lhs, rhs)\n}\npublic func <=<V: Value>(lhs: Expression<V>, rhs: V) -> Expression<Bool> where V.Datatype: Comparable {\n    Operator.lte.infix(lhs, rhs)\n}\npublic func <=<V: Value>(lhs: Expression<V?>, rhs: V) -> Expression<Bool?> where V.Datatype: Comparable {\n    Operator.lte.infix(lhs, rhs)\n}\npublic func <=<V: Value>(lhs: V, rhs: Expression<V>) -> Expression<Bool> where V.Datatype: Comparable {\n    Operator.lte.infix(lhs, rhs)\n}\npublic func <=<V: Value>(lhs: V, rhs: Expression<V?>) -> Expression<Bool?> where V.Datatype: Comparable {\n    Operator.lte.infix(lhs, rhs)\n}\n\npublic func ~=<V: Value>(lhs: ClosedRange<V>, rhs: Expression<V>) -> Expression<Bool> where V.Datatype: Comparable & Value {\n    Expression(\"\\(rhs.template) BETWEEN ? AND ?\", rhs.bindings + [lhs.lowerBound.datatypeValue, lhs.upperBound.datatypeValue])\n}\n\npublic func ~=<V: Value>(lhs: ClosedRange<V>, rhs: Expression<V?>) -> Expression<Bool?> where V.Datatype: Comparable & Value {\n    Expression(\"\\(rhs.template) BETWEEN ? AND ?\", rhs.bindings + [lhs.lowerBound.datatypeValue, lhs.upperBound.datatypeValue])\n}\n\npublic func ~=<V: Value>(lhs: Range<V>, rhs: Expression<V>) -> Expression<Bool> where V.Datatype: Comparable & Value {\n    Expression(\"\\(rhs.template) >= ? AND \\(rhs.template) < ?\",\n               rhs.bindings + [lhs.lowerBound.datatypeValue] + rhs.bindings + [lhs.upperBound.datatypeValue])\n}\n\npublic func ~=<V: Value>(lhs: Range<V>, rhs: Expression<V?>) -> Expression<Bool?> where V.Datatype: Comparable & Value {\n    Expression(\"\\(rhs.template) >= ? AND \\(rhs.template) < ?\",\n               rhs.bindings + [lhs.lowerBound.datatypeValue] + rhs.bindings + [lhs.upperBound.datatypeValue])\n}\n\npublic func ~=<V: Value>(lhs: PartialRangeThrough<V>, rhs: Expression<V>) -> Expression<Bool> where V.Datatype: Comparable & Value {\n    Expression(\"\\(rhs.template) <= ?\", rhs.bindings + [lhs.upperBound.datatypeValue])\n}\n\npublic func ~=<V: Value>(lhs: PartialRangeThrough<V>, rhs: Expression<V?>) -> Expression<Bool?> where V.Datatype: Comparable & Value {\n    Expression(\"\\(rhs.template) <= ?\", rhs.bindings + [lhs.upperBound.datatypeValue])\n}\n\npublic func ~=<V: Value>(lhs: PartialRangeUpTo<V>, rhs: Expression<V>) -> Expression<Bool> where V.Datatype: Comparable & Value {\n    Expression(\"\\(rhs.template) < ?\", rhs.bindings + [lhs.upperBound.datatypeValue])\n}\n\npublic func ~=<V: Value>(lhs: PartialRangeUpTo<V>, rhs: Expression<V?>) -> Expression<Bool?> where V.Datatype: Comparable & Value {\n    Expression(\"\\(rhs.template) < ?\", rhs.bindings + [lhs.upperBound.datatypeValue])\n}\n\npublic func ~=<V: Value>(lhs: PartialRangeFrom<V>, rhs: Expression<V>) -> Expression<Bool> where V.Datatype: Comparable & Value {\n    Expression(\"\\(rhs.template) >= ?\", rhs.bindings + [lhs.lowerBound.datatypeValue])\n}\n\npublic func ~=<V: Value>(lhs: PartialRangeFrom<V>, rhs: Expression<V?>) -> Expression<Bool?> where V.Datatype: Comparable & Value {\n    Expression(\"\\(rhs.template) >= ?\", rhs.bindings + [lhs.lowerBound.datatypeValue])\n}\n\n// MARK: -\n\npublic func and(_ terms: Expression<Bool>...) -> Expression<Bool> {\n    \"AND\".infix(terms)\n}\npublic func and(_ terms: [Expression<Bool>]) -> Expression<Bool> {\n    \"AND\".infix(terms)\n}\npublic func &&(lhs: Expression<Bool>, rhs: Expression<Bool>) -> Expression<Bool> {\n    Operator.and.infix(lhs, rhs)\n}\npublic func &&(lhs: Expression<Bool>, rhs: Expression<Bool?>) -> Expression<Bool?> {\n    Operator.and.infix(lhs, rhs)\n}\npublic func &&(lhs: Expression<Bool?>, rhs: Expression<Bool>) -> Expression<Bool?> {\n    Operator.and.infix(lhs, rhs)\n}\npublic func &&(lhs: Expression<Bool?>, rhs: Expression<Bool?>) -> Expression<Bool?> {\n    Operator.and.infix(lhs, rhs)\n}\npublic func &&(lhs: Expression<Bool>, rhs: Bool) -> Expression<Bool> {\n    Operator.and.infix(lhs, rhs)\n}\npublic func &&(lhs: Expression<Bool?>, rhs: Bool) -> Expression<Bool?> {\n    Operator.and.infix(lhs, rhs)\n}\npublic func &&(lhs: Bool, rhs: Expression<Bool>) -> Expression<Bool> {\n    Operator.and.infix(lhs, rhs)\n}\npublic func &&(lhs: Bool, rhs: Expression<Bool?>) -> Expression<Bool?> {\n    Operator.and.infix(lhs, rhs)\n}\n\npublic func or(_ terms: Expression<Bool>...) -> Expression<Bool> {\n    \"OR\".infix(terms)\n}\npublic func or(_ terms: [Expression<Bool>]) -> Expression<Bool> {\n    \"OR\".infix(terms)\n}\npublic func ||(lhs: Expression<Bool>, rhs: Expression<Bool>) -> Expression<Bool> {\n    Operator.or.infix(lhs, rhs)\n}\npublic func ||(lhs: Expression<Bool>, rhs: Expression<Bool?>) -> Expression<Bool?> {\n    Operator.or.infix(lhs, rhs)\n}\npublic func ||(lhs: Expression<Bool?>, rhs: Expression<Bool>) -> Expression<Bool?> {\n    Operator.or.infix(lhs, rhs)\n}\npublic func ||(lhs: Expression<Bool?>, rhs: Expression<Bool?>) -> Expression<Bool?> {\n    Operator.or.infix(lhs, rhs)\n}\npublic func ||(lhs: Expression<Bool>, rhs: Bool) -> Expression<Bool> {\n    Operator.or.infix(lhs, rhs)\n}\npublic func ||(lhs: Expression<Bool?>, rhs: Bool) -> Expression<Bool?> {\n    Operator.or.infix(lhs, rhs)\n}\npublic func ||(lhs: Bool, rhs: Expression<Bool>) -> Expression<Bool> {\n    Operator.or.infix(lhs, rhs)\n}\npublic func ||(lhs: Bool, rhs: Expression<Bool?>) -> Expression<Bool?> {\n    Operator.or.infix(lhs, rhs)\n}\n\npublic prefix func !(rhs: Expression<Bool>) -> Expression<Bool> {\n    Operator.not.wrap(rhs)\n}\n\npublic prefix func !(rhs: Expression<Bool?>) -> Expression<Bool?> {\n    Operator.not.wrap(rhs)\n}\n"
  },
  {
    "path": "Sources/SQLite/Typed/Query+with.swift",
    "content": "//\n// SQLite.swift\n// https://github.com/stephencelis/SQLite.swift\n// Copyright © 2014-2015 Stephen Celis.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\nimport Foundation\n\nextension QueryType {\n\n    /// Sets a `WITH` clause on the query.\n    ///\n    ///     let users = Table(\"users\")\n    ///     let id = Expression<String>(\"email\")\n    ///     let name = Expression<String?>(\"name\")\n    ///\n    ///     let userNames = Table(\"user_names\")\n    ///     userCategories.with(userNames, as: users.select(name))\n    ///     // WITH \"user_names\" as (SELECT \"name\" FROM \"users\") SELECT * FROM \"user_names\"\n    ///\n    /// - Parameters:\n    ///\n    ///   -  alias: A name to assign to the table expression.\n    ///\n    ///   -  recursive: Whether to evaluate the expression recursively.\n    ///\n    ///   -  hint: Provides a hint to the query planner for how the expression should be implemented.\n    ///\n    ///   -  subquery: A query that generates the rows for the table expression.\n    ///\n    /// - Returns: A query with the given `ORDER BY` clause applied.\n    public func with(_ alias: Table, columns: [Expressible]? = nil, recursive: Bool = false,\n                     hint: MaterializationHint? = nil, as subquery: QueryType) -> Self {\n        var query = self\n        let clause = WithClauses.Clause(alias: alias, columns: columns, hint: hint, query: subquery)\n        query.clauses.with.recursive = query.clauses.with.recursive || recursive\n        query.clauses.with.clauses.append(clause)\n        return query\n    }\n\n    /// self.clauses.with transformed to an Expressible\n    var withClause: Expressible? {\n        guard !clauses.with.clauses.isEmpty else {\n            return nil\n        }\n\n        let innerClauses = \", \".join(clauses.with.clauses.map { (clause) in\n            let hintExpr: Expression<Void>?\n            if let hint = clause.hint {\n                hintExpr = Expression<Void>(literal: hint.rawValue)\n            } else {\n                hintExpr = nil\n            }\n\n            let columnExpr: Expression<Void>?\n            if let columns = clause.columns {\n                columnExpr = \"\".wrap(\", \".join(columns))\n            } else {\n                columnExpr = nil\n            }\n\n            let expressions: [Expressible?] = [\n                clause.alias.tableName(),\n                columnExpr,\n                Expression<Void>(literal: \"AS\"),\n                hintExpr,\n                \"\".wrap(clause.query) as Expression<Void>\n            ]\n\n            return \" \".join(expressions.compactMap { $0 })\n        })\n\n        return \" \".join([\n            Expression<Void>(literal: clauses.with.recursive ? \"WITH RECURSIVE\" : \"WITH\"),\n            innerClauses\n        ])\n    }\n}\n\n/// Materialization hints for `WITH` clause\npublic enum MaterializationHint: String, Sendable {\n\n    case materialized = \"MATERIALIZED\"\n\n    case notMaterialized = \"NOT MATERIALIZED\"\n}\n\nstruct WithClauses: Sendable {\n    struct Clause: Sendable {\n        var alias: Table\n        var columns: [Expressible]?\n        var hint: MaterializationHint?\n        var query: QueryType\n    }\n    /// The `RECURSIVE` flag is applied to the entire `WITH` clause\n    var recursive: Bool = false\n\n    /// Each `WITH` clause may have multiple subclauses\n    var clauses: [Clause] = []\n}\n"
  },
  {
    "path": "Sources/SQLite/Typed/Query.swift",
    "content": "//\n// SQLite.swift\n// https://github.com/stephencelis/SQLite.swift\n// Copyright © 2014-2015 Stephen Celis.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n// swiftlint:disable file_length\nimport Foundation\n\npublic protocol QueryType: Expressible {\n\n    var clauses: QueryClauses { get set }\n\n    init(_ name: String, database: String?)\n\n}\n\npublic protocol SchemaType: QueryType {\n\n    static var identifier: String { get }\n\n}\n\nextension SchemaType {\n\n    /// Builds a copy of the query with the `SELECT` clause applied.\n    ///\n    ///     let users = Table(\"users\")\n    ///     let id = Expression<Int64>(\"id\")\n    ///     let email = Expression<String>(\"email\")\n    ///\n    ///     users.select(id, email)\n    ///     // SELECT \"id\", \"email\" FROM \"users\"\n    ///\n    /// - Parameter all: A list of expressions to select.\n    ///\n    /// - Returns: A query with the given `SELECT` clause applied.\n    public func select(_ column1: Expressible, _ more: Expressible...) -> Self {\n        select(false, [column1] + more)\n    }\n\n    /// Builds a copy of the query with the `SELECT DISTINCT` clause applied.\n    ///\n    ///     let users = Table(\"users\")\n    ///     let email = Expression<String>(\"email\")\n    ///\n    ///     users.select(distinct: email)\n    ///     // SELECT DISTINCT \"email\" FROM \"users\"\n    ///\n    /// - Parameter columns: A list of expressions to select.\n    ///\n    /// - Returns: A query with the given `SELECT DISTINCT` clause applied.\n    public func select(distinct column1: Expressible, _ more: Expressible...) -> Self {\n        select(true, [column1] + more)\n    }\n\n    /// Builds a copy of the query with the `SELECT` clause applied.\n    ///\n    ///     let users = Table(\"users\")\n    ///     let id = Expression<Int64>(\"id\")\n    ///     let email = Expression<String>(\"email\")\n    ///\n    ///     users.select([id, email])\n    ///     // SELECT \"id\", \"email\" FROM \"users\"\n    ///\n    /// - Parameter all: A list of expressions to select.\n    ///\n    /// - Returns: A query with the given `SELECT` clause applied.\n    public func select(_ all: [Expressible]) -> Self {\n        select(false, all)\n    }\n\n    /// Builds a copy of the query with the `SELECT DISTINCT` clause applied.\n    ///\n    ///     let users = Table(\"users\")\n    ///     let email = Expression<String>(\"email\")\n    ///\n    ///     users.select(distinct: [email])\n    ///     // SELECT DISTINCT \"email\" FROM \"users\"\n    ///\n    /// - Parameter columns: A list of expressions to select.\n    ///\n    /// - Returns: A query with the given `SELECT DISTINCT` clause applied.\n    public func select(distinct columns: [Expressible]) -> Self {\n        select(true, columns)\n    }\n\n    /// Builds a copy of the query with the `SELECT *` clause applied.\n    ///\n    ///     let users = Table(\"users\")\n    ///\n    ///     users.select(*)\n    ///     // SELECT * FROM \"users\"\n    ///\n    /// - Parameter star: A star literal.\n    ///\n    /// - Returns: A query with the given `SELECT *` clause applied.\n    public func select(_ star: Star) -> Self {\n        select([star(nil, nil)])\n    }\n\n    /// Builds a copy of the query with the `SELECT DISTINCT *` clause applied.\n    ///\n    ///     let users = Table(\"users\")\n    ///\n    ///     users.select(distinct: *)\n    ///     // SELECT DISTINCT * FROM \"users\"\n    ///\n    /// - Parameter star: A star literal.\n    ///\n    /// - Returns: A query with the given `SELECT DISTINCT *` clause applied.\n    public func select(distinct star: Star) -> Self {\n        select(distinct: [star(nil, nil)])\n    }\n\n    /// Builds a scalar copy of the query with the `SELECT` clause applied.\n    ///\n    ///     let users = Table(\"users\")\n    ///     let id = Expression<Int64>(\"id\")\n    ///\n    ///     users.select(id)\n    ///     // SELECT \"id\" FROM \"users\"\n    ///\n    /// - Parameter all: A list of expressions to select.\n    ///\n    /// - Returns: A query with the given `SELECT` clause applied.\n    public func select<V: Value>(_ column: Expression<V>) -> ScalarQuery<V> {\n        select(false, [column])\n    }\n    public func select<V: Value>(_ column: Expression<V?>) -> ScalarQuery<V?> {\n        select(false, [column])\n    }\n\n    /// Builds a scalar copy of the query with the `SELECT DISTINCT` clause\n    /// applied.\n    ///\n    ///     let users = Table(\"users\")\n    ///     let email = Expression<String>(\"email\")\n    ///\n    ///     users.select(distinct: email)\n    ///     // SELECT DISTINCT \"email\" FROM \"users\"\n    ///\n    /// - Parameter column: A list of expressions to select.\n    ///\n    /// - Returns: A query with the given `SELECT DISTINCT` clause applied.\n    public func select<V: Value>(distinct column: Expression<V>) -> ScalarQuery<V> {\n        select(true, [column])\n    }\n    public func select<V: Value>(distinct column: Expression<V?>) -> ScalarQuery<V?> {\n        select(true, [column])\n    }\n\n    public var count: ScalarQuery<Int> {\n        select(Expression.count(*))\n    }\n\n}\n\nextension QueryType {\n\n    fileprivate func select<Q: QueryType>(_ distinct: Bool, _ columns: [Expressible]) -> Q {\n        var query = Q.init(clauses.from.name, database: clauses.from.database)\n        query.clauses = clauses\n        query.clauses.select = (distinct, columns)\n        return query\n    }\n\n    // MARK: UNION\n\n    /// Adds a `UNION` clause to the query.\n    ///\n    ///     let users = Table(\"users\")\n    ///     let email = Expression<String>(\"email\")\n    ///\n    ///     users.filter(email == \"alice@example.com\").union(users.filter(email == \"sally@example.com\"))\n    ///     // SELECT * FROM \"users\" WHERE email = 'alice@example.com' UNION SELECT * FROM \"users\" WHERE email = 'sally@example.com'\n    ///\n    /// - Parameters:\n    ///\n    ///   - all: If false, duplicate rows are removed from the result.\n    ///\n    ///   - table: A query representing the other table.\n    ///\n    /// - Returns: A query with the given `UNION` clause applied.\n    public func union(all: Bool = false, _ table: QueryType) -> Self {\n        var query = self\n        query.clauses.union.append((all, table))\n        return query\n    }\n\n    // MARK: JOIN\n\n    /// Adds a `JOIN` clause to the query.\n    ///\n    ///     let users = Table(\"users\")\n    ///     let id = Expression<Int64>(\"id\")\n    ///     let posts = Table(\"posts\")\n    ///     let userId = Expression<Int64>(\"user_id\")\n    ///\n    ///     users.join(posts, on: posts[userId] == users[id])\n    ///     // SELECT * FROM \"users\" INNER JOIN \"posts\" ON (\"posts\".\"user_id\" = \"users\".\"id\")\n    ///\n    /// - Parameters:\n    ///\n    ///   - table: A query representing the other table.\n    ///\n    ///   - condition: A boolean expression describing the join condition.\n    ///\n    /// - Returns: A query with the given `JOIN` clause applied.\n    public func join(_ table: QueryType, on condition: Expression<Bool>) -> Self {\n        join(table, on: Expression<Bool?>(condition))\n    }\n\n    /// Adds a `JOIN` clause to the query.\n    ///\n    ///     let users = Table(\"users\")\n    ///     let id = Expression<Int64>(\"id\")\n    ///     let posts = Table(\"posts\")\n    ///     let userId = Expression<Int64?>(\"user_id\")\n    ///\n    ///     users.join(posts, on: posts[userId] == users[id])\n    ///     // SELECT * FROM \"users\" INNER JOIN \"posts\" ON (\"posts\".\"user_id\" = \"users\".\"id\")\n    ///\n    /// - Parameters:\n    ///\n    ///   - table: A query representing the other table.\n    ///\n    ///   - condition: A boolean expression describing the join condition.\n    ///\n    /// - Returns: A query with the given `JOIN` clause applied.\n    public func join(_ table: QueryType, on condition: Expression<Bool?>) -> Self {\n        join(.inner, table, on: condition)\n    }\n\n    /// Adds a `JOIN` clause to the query.\n    ///\n    ///     let users = Table(\"users\")\n    ///     let id = Expression<Int64>(\"id\")\n    ///     let posts = Table(\"posts\")\n    ///     let userId = Expression<Int64>(\"user_id\")\n    ///\n    ///     users.join(.LeftOuter, posts, on: posts[userId] == users[id])\n    ///     // SELECT * FROM \"users\" LEFT OUTER JOIN \"posts\" ON (\"posts\".\"user_id\" = \"users\".\"id\")\n    ///\n    /// - Parameters:\n    ///\n    ///   - type: The `JOIN` operator.\n    ///\n    ///   - table: A query representing the other table.\n    ///\n    ///   - condition: A boolean expression describing the join condition.\n    ///\n    /// - Returns: A query with the given `JOIN` clause applied.\n    public func join(_ type: JoinType, _ table: QueryType, on condition: Expression<Bool>) -> Self {\n        join(type, table, on: Expression<Bool?>(condition))\n    }\n\n    /// Adds a `JOIN` clause to the query.\n    ///\n    ///     let users = Table(\"users\")\n    ///     let id = Expression<Int64>(\"id\")\n    ///     let posts = Table(\"posts\")\n    ///     let userId = Expression<Int64?>(\"user_id\")\n    ///\n    ///     users.join(.LeftOuter, posts, on: posts[userId] == users[id])\n    ///     // SELECT * FROM \"users\" LEFT OUTER JOIN \"posts\" ON (\"posts\".\"user_id\" = \"users\".\"id\")\n    ///\n    /// - Parameters:\n    ///\n    ///   - type: The `JOIN` operator.\n    ///\n    ///   - table: A query representing the other table.\n    ///\n    ///   - condition: A boolean expression describing the join condition.\n    ///\n    /// - Returns: A query with the given `JOIN` clause applied.\n    public func join(_ type: JoinType, _ table: QueryType, on condition: Expression<Bool?>) -> Self {\n        var query = self\n        query.clauses.join.append((type: type, query: table,\n                                          condition: table.clauses.filters.map { condition && $0 } ?? condition as Expressible))\n        return query\n    }\n\n    // MARK: WHERE\n\n    /// Adds a condition to the query’s `WHERE` clause.\n    ///\n    ///     let users = Table(\"users\")\n    ///     let id = Expression<Int64>(\"id\")\n    ///\n    ///     users.filter(id == 1)\n    ///     // SELECT * FROM \"users\" WHERE (\"id\" = 1)\n    ///\n    /// - Parameter condition: A boolean expression to filter on.\n    ///\n    /// - Returns: A query with the given `WHERE` clause applied.\n    public func filter(_ predicate: Expression<Bool>) -> Self {\n        filter(Expression<Bool?>(predicate))\n    }\n\n    /// Adds a condition to the query’s `WHERE` clause.\n    ///\n    ///     let users = Table(\"users\")\n    ///     let age = Expression<Int?>(\"age\")\n    ///\n    ///     users.filter(age >= 35)\n    ///     // SELECT * FROM \"users\" WHERE (\"age\" >= 35)\n    ///\n    /// - Parameter condition: A boolean expression to filter on.\n    ///\n    /// - Returns: A query with the given `WHERE` clause applied.\n    public func filter(_ predicate: Expression<Bool?>) -> Self {\n        var query = self\n        query.clauses.filters = query.clauses.filters.map { $0 && predicate } ?? predicate\n        return query\n    }\n\n    /// Adds a condition to the query’s `WHERE` clause.\n    /// This is an alias for `filter(predicate)`\n    public func `where`(_ predicate: Expression<Bool>) -> Self {\n        `where`(Expression<Bool?>(predicate))\n    }\n\n    /// Adds a condition to the query’s `WHERE` clause.\n    /// This is an alias for `filter(predicate)`\n    public func `where`(_ predicate: Expression<Bool?>) -> Self {\n        filter(predicate)\n    }\n\n    // MARK: GROUP BY\n\n    /// Sets a `GROUP BY` clause on the query.\n    ///\n    /// - Parameter by: A list of columns to group by.\n    ///\n    /// - Returns: A query with the given `GROUP BY` clause applied.\n    public func group(_ by: Expressible...) -> Self {\n        group(by)\n    }\n\n    /// Sets a `GROUP BY` clause on the query.\n    ///\n    /// - Parameter by: A list of columns to group by.\n    ///\n    /// - Returns: A query with the given `GROUP BY` clause applied.\n    public func group(_ by: [Expressible]) -> Self {\n        group(by, nil)\n    }\n\n    /// Sets a `GROUP BY`-`HAVING` clause on the query.\n    ///\n    /// - Parameters:\n    ///\n    ///   - by: A column to group by.\n    ///\n    ///   - having: A condition determining which groups are returned.\n    ///\n    /// - Returns: A query with the given `GROUP BY`–`HAVING` clause applied.\n    public func group(_ by: Expressible, having: Expression<Bool>) -> Self {\n        group([by], having: having)\n    }\n\n    /// Sets a `GROUP BY`-`HAVING` clause on the query.\n    ///\n    /// - Parameters:\n    ///\n    ///   - by: A column to group by.\n    ///\n    ///   - having: A condition determining which groups are returned.\n    ///\n    /// - Returns: A query with the given `GROUP BY`–`HAVING` clause applied.\n    public func group(_ by: Expressible, having: Expression<Bool?>) -> Self {\n        group([by], having: having)\n    }\n\n    /// Sets a `GROUP BY`-`HAVING` clause on the query.\n    ///\n    /// - Parameters:\n    ///\n    ///   - by: A list of columns to group by.\n    ///\n    ///   - having: A condition determining which groups are returned.\n    ///\n    /// - Returns: A query with the given `GROUP BY`–`HAVING` clause applied.\n    public func group(_ by: [Expressible], having: Expression<Bool>) -> Self {\n        group(by, Expression<Bool?>(having))\n    }\n\n    /// Sets a `GROUP BY`-`HAVING` clause on the query.\n    ///\n    /// - Parameters:\n    ///\n    ///   - by: A list of columns to group by.\n    ///\n    ///   - having: A condition determining which groups are returned.\n    ///\n    /// - Returns: A query with the given `GROUP BY`–`HAVING` clause applied.\n    public func group(_ by: [Expressible], having: Expression<Bool?>) -> Self {\n        group(by, having)\n    }\n\n    fileprivate func group(_ by: [Expressible], _ having: Expression<Bool?>?) -> Self {\n        var query = self\n        query.clauses.group = (by, having)\n        return query\n    }\n\n    // MARK: ORDER BY\n\n    /// Sets an `ORDER BY` clause on the query.\n    ///\n    ///     let users = Table(\"users\")\n    ///     let email = Expression<String>(\"email\")\n    ///     let name = Expression<String?>(\"name\")\n    ///\n    ///     users.order(email.desc, name.asc)\n    ///     // SELECT * FROM \"users\" ORDER BY \"email\" DESC, \"name\" ASC\n    ///\n    /// - Parameter by: An ordered list of columns and directions to sort by.\n    ///\n    /// - Returns: A query with the given `ORDER BY` clause applied.\n    public func order(_ by: Expressible...) -> Self {\n        order(by)\n    }\n\n    /// Sets an `ORDER BY` clause on the query.\n    ///\n    ///     let users = Table(\"users\")\n    ///     let email = Expression<String>(\"email\")\n    ///     let name = Expression<String?>(\"name\")\n    ///\n    ///     users.order([email.desc, name.asc])\n    ///     // SELECT * FROM \"users\" ORDER BY \"email\" DESC, \"name\" ASC\n    ///\n    /// - Parameter by: An ordered list of columns and directions to sort by.\n    ///\n    /// - Returns: A query with the given `ORDER BY` clause applied.\n    public func order(_ by: [Expressible]) -> Self {\n        var query = self\n        query.clauses.order = by\n        return query\n    }\n\n    // MARK: LIMIT/OFFSET\n\n    /// Sets the LIMIT clause (and resets any OFFSET clause) on the query.\n    ///\n    ///     let users = Table(\"users\")\n    ///\n    ///     users.limit(20)\n    ///     // SELECT * FROM \"users\" LIMIT 20\n    ///\n    /// - Parameter length: The maximum number of rows to return (or `nil` to\n    ///   return unlimited rows).\n    ///\n    /// - Returns: A query with the given LIMIT clause applied.\n    public func limit(_ length: Int?) -> Self {\n        limit(length, nil)\n    }\n\n    /// Sets LIMIT and OFFSET clauses on the query.\n    ///\n    ///     let users = Table(\"users\")\n    ///\n    ///     users.limit(20, offset: 20)\n    ///     // SELECT * FROM \"users\" LIMIT 20 OFFSET 20\n    ///\n    /// - Parameters:\n    ///\n    ///   - length: The maximum number of rows to return.\n    ///\n    ///   - offset: The number of rows to skip.\n    ///\n    /// - Returns: A query with the given LIMIT and OFFSET clauses applied.\n    public func limit(_ length: Int, offset: Int) -> Self {\n        limit(length, offset)\n    }\n\n    // prevents limit(nil, offset: 5)\n    fileprivate func limit(_ length: Int?, _ offset: Int?) -> Self {\n        var query = self\n        query.clauses.limit = length.map { ($0, offset) }\n        return query\n    }\n\n    // MARK: - Clauses\n    //\n    // MARK: SELECT\n\n    // MARK: -\n\n    fileprivate var selectClause: Expressible {\n        \" \".join([\n           Expression<Void>(literal:\n                            clauses.select.distinct ? \"SELECT DISTINCT\" : \"SELECT\"),\n           \", \".join(clauses.select.columns),\n           Expression<Void>(literal: \"FROM\"),\n           tableName(alias: true)\n       ])\n    }\n\n    fileprivate var joinClause: Expressible? {\n        guard !clauses.join.isEmpty else {\n            return nil\n        }\n\n        return \" \".join(clauses.join.map { arg in\n            let (type, query, condition) = arg\n            return \" \".join([\n                Expression<Void>(literal: \"\\(type.rawValue) JOIN\"),\n                query.tableName(alias: true),\n                Expression<Void>(literal: \"ON\"),\n                condition\n            ])\n        })\n    }\n\n    fileprivate var whereClause: Expressible? {\n        guard let filters = clauses.filters else {\n            return nil\n        }\n\n        return \" \".join([\n            Expression<Void>(literal: \"WHERE\"),\n            filters\n        ])\n    }\n\n    fileprivate var groupByClause: Expressible? {\n        guard let group = clauses.group else {\n            return nil\n        }\n\n        let groupByClause = \" \".join([\n            Expression<Void>(literal: \"GROUP BY\"),\n            \", \".join(group.by)\n        ])\n\n        guard let having = group.having else {\n            return groupByClause\n        }\n\n        return \" \".join([\n            groupByClause,\n            \" \".join([\n                Expression<Void>(literal: \"HAVING\"),\n                having\n            ])\n        ])\n    }\n\n    fileprivate var orderClause: Expressible? {\n        guard !clauses.order.isEmpty else {\n            return nil\n        }\n\n        return \" \".join([\n            Expression<Void>(literal: \"ORDER BY\"),\n            \", \".join(clauses.order)\n        ])\n    }\n\n    fileprivate var limitOffsetClause: Expressible? {\n        guard let limit = clauses.limit else {\n            return nil\n        }\n\n        let limitClause = Expression<Void>(literal: \"LIMIT \\(limit.length)\")\n\n        guard let offset = limit.offset else {\n            return limitClause\n        }\n\n        return \" \".join([\n            limitClause,\n            Expression<Void>(literal: \"OFFSET \\(offset)\")\n        ])\n    }\n\n    fileprivate var unionClause: Expressible? {\n        guard !clauses.union.isEmpty else {\n            return nil\n        }\n\n        return \" \".join(clauses.union.map { (all, query) in\n            \" \".join([\n                Expression<Void>(literal: all ? \"UNION ALL\" : \"UNION\"),\n                query\n            ])\n        })\n    }\n\n    // MARK: -\n\n    public func alias(_ aliasName: String) -> Self {\n        var query = self\n        query.clauses.from = (clauses.from.name, aliasName, clauses.from.database)\n        return query\n    }\n\n    // MARK: - Operations\n    //\n    // MARK: INSERT\n\n    public func insert(_ value: Setter, _ more: Setter...) -> Insert {\n        insert([value] + more)\n    }\n\n    public func insert(_ values: [Setter]) -> Insert {\n        insert(nil, values)\n    }\n\n    public func insert(or onConflict: OnConflict, _ values: Setter...) -> Insert {\n        insert(or: onConflict, values)\n    }\n\n    public func insert(or onConflict: OnConflict, _ values: [Setter]) -> Insert {\n        insert(onConflict, values)\n    }\n\n    public func insertMany( _ values: [[Setter]]) -> Insert {\n        insertMany(nil, values)\n    }\n\n    public func insertMany(or onConflict: OnConflict, _ values: [[Setter]]) -> Insert {\n        insertMany(onConflict, values)\n    }\n\n    public func insertMany(or onConflict: OnConflict, _ values: [Setter]...) -> Insert {\n        insertMany(onConflict, values)\n    }\n\n    fileprivate func insert(_ or: OnConflict?, _ values: [Setter]) -> Insert {\n        let insert = values.reduce((columns: [Expressible](), values: [Expressible]())) { insert, setter in\n            (insert.columns + [setter.column], insert.values + [setter.value])\n        }\n\n        let clauses: [Expressible?] = [\n            Expression<Void>(literal: \"INSERT\"),\n            or.map { Expression<Void>(literal: \"OR \\($0.rawValue)\") },\n            Expression<Void>(literal: \"INTO\"),\n            tableName(),\n            \"\".wrap(insert.columns) as Expression<Void>,\n            Expression<Void>(literal: \"VALUES\"),\n            \"\".wrap(insert.values) as Expression<Void>,\n            whereClause\n        ]\n\n        return Insert(\" \".join(clauses.compactMap { $0 }).expression)\n    }\n\n    fileprivate func insertMany(_ or: OnConflict?, _ values: [[Setter]]) -> Insert {\n        guard let firstInsert = values.first else {\n            // must be at least 1 object or else we don't know columns. Default to default inserts.\n            return insert()\n        }\n        let columns = firstInsert.map { $0.column }\n        let insertValues = values.map { rowValues in\n            rowValues.reduce([Expressible]()) { insert, setter in\n                insert + [setter.value]\n            }\n        }\n\n        let clauses: [Expressible?] = [\n            Expression<Void>(literal: \"INSERT\"),\n            or.map { Expression<Void>(literal: \"OR \\($0.rawValue)\") },\n            Expression<Void>(literal: \"INTO\"),\n            tableName(),\n            \"\".wrap(columns) as Expression<Void>,\n            Expression<Void>(literal: \"VALUES\"),\n            \", \".join(insertValues.map({ \"\".wrap($0) as Expression<Void> })),\n            whereClause\n        ]\n        return Insert(\" \".join(clauses.compactMap { $0 }).expression)\n    }\n\n    /// Runs an `INSERT` statement against the query with `DEFAULT VALUES`.\n    public func insert() -> Insert {\n        Insert(\" \".join([\n            Expression<Void>(literal: \"INSERT INTO\"),\n            tableName(),\n            Expression<Void>(literal: \"DEFAULT VALUES\")\n        ]).expression)\n    }\n\n    /// Runs an `INSERT` statement against the query with the results of another\n    /// query.\n    ///\n    /// - Parameter query: A query to `SELECT` results from.\n    ///\n    /// - Returns: The number of updated rows and statement.\n    public func insert(_ query: QueryType) -> Update {\n        Update(\" \".join([\n            Expression<Void>(literal: \"INSERT INTO\"),\n            tableName(),\n            query.expression\n       ]).expression)\n    }\n\n    // MARK: UPSERT\n\n    public func upsert(_ insertValues: Setter..., onConflictOf conflicting: Expressible) -> Insert {\n        upsert(insertValues, onConflictOf: conflicting)\n    }\n\n    public func upsert(_ insertValues: [Setter], onConflictOf conflicting: Expressible) -> Insert {\n        let setValues = insertValues.filter { $0.column.asSQL() != conflicting.asSQL() }\n            .map { Setter(excluded: $0.column) }\n        return upsert(insertValues, onConflictOf: conflicting, set: setValues)\n    }\n\n    public func upsert(_ insertValues: Setter..., onConflictOf conflicting: Expressible, set setValues: [Setter]) -> Insert {\n        upsert(insertValues, onConflictOf: conflicting, set: setValues)\n    }\n\n    public func upsert(_ insertValues: [Setter], onConflictOf conflicting: Expressible, set setValues: [Setter]) -> Insert {\n        let insert = insertValues.reduce((columns: [Expressible](), values: [Expressible]())) { insert, setter in\n            (insert.columns + [setter.column], insert.values + [setter.value])\n        }\n\n        let clauses: [Expressible?] = [\n            Expression<Void>(literal: \"INSERT\"),\n            Expression<Void>(literal: \"INTO\"),\n            tableName(),\n            \"\".wrap(insert.columns) as Expression<Void>,\n            Expression<Void>(literal: \"VALUES\"),\n            \"\".wrap(insert.values) as Expression<Void>,\n            whereClause,\n            Expression<Void>(literal: \"ON CONFLICT\"),\n            \"\".wrap(conflicting) as Expression<Void>,\n            Expression<Void>(literal: \"DO UPDATE SET\"),\n            \", \".join(setValues.map { $0.expression })\n        ]\n\n        return Insert(\" \".join(clauses.compactMap { $0 }).expression)\n    }\n\n    // MARK: UPDATE\n\n    public func update(_ values: Setter...) -> Update {\n        update(values)\n    }\n\n    public func update(_ values: [Setter]) -> Update {\n        let clauses: [Expressible?] = [\n            Expression<Void>(literal: \"UPDATE\"),\n            tableName(),\n            Expression<Void>(literal: \"SET\"),\n            \", \".join(values.map { \" = \".join([$0.column, $0.value]) }),\n            whereClause,\n            orderClause,\n            limitOffsetClause\n        ]\n\n        return Update(\" \".join(clauses.compactMap { $0 }).expression)\n    }\n\n    // MARK: DELETE\n\n    public func delete() -> Delete {\n        let clauses: [Expressible?] = [\n            Expression<Void>(literal: \"DELETE FROM\"),\n            tableName(),\n            whereClause,\n            orderClause,\n            limitOffsetClause\n        ]\n\n        return Delete(\" \".join(clauses.compactMap { $0 }).expression)\n    }\n\n    // MARK: EXISTS\n\n    public var exists: Select<Bool> {\n        Select(\" \".join([\n            Expression<Void>(literal: \"SELECT EXISTS\"),\n            \"\".wrap(expression) as Expression<Void>\n        ]).expression)\n    }\n\n    // MARK: -\n\n    /// Prefixes a column expression with the query’s table name or alias.\n    ///\n    /// - Parameter column: A column expression.\n    ///\n    /// - Returns: A column expression namespaced with the query’s table name or\n    ///   alias.\n    public func namespace<V>(_ column: Expression<V>) -> Expression<V> {\n        Expression(\".\".join([tableName(), column]).expression)\n    }\n\n    public subscript<T>(column: Expression<T>) -> Expression<T> {\n        namespace(column)\n    }\n\n    public subscript<T>(column: Expression<T?>) -> Expression<T?> {\n        namespace(column)\n    }\n\n    /// Prefixes a star with the query’s table name or alias.\n    ///\n    /// - Parameter star: A literal `*`.\n    ///\n    /// - Returns: A `*` expression namespaced with the query’s table name or\n    ///   alias.\n    public subscript(star: Star) -> Expression<Void> {\n        namespace(star(nil, nil))\n    }\n\n    // MARK: -\n\n    // TODO: alias support\n    func tableName(alias aliased: Bool = false) -> Expressible {\n        guard let alias = clauses.from.alias, aliased else {\n            return database(namespace: clauses.from.alias ?? clauses.from.name)\n        }\n\n        return \" \".join([\n            database(namespace: clauses.from.name),\n            Expression<Void>(literal: \"AS\"),\n            Expression<Void>(alias)\n        ])\n    }\n\n    func tableName(qualified: Bool) -> Expressible {\n        if qualified {\n            return tableName()\n        }\n        return Expression<Void>(clauses.from.alias ?? clauses.from.name)\n    }\n\n    func database(namespace name: String) -> Expressible {\n        let name = Expression<Void>(name)\n\n        guard let database = clauses.from.database else {\n            return name\n        }\n\n        return \".\".join([Expression<Void>(database), name])\n    }\n\n    public var expression: Expression<Void> {\n        let clauses: [Expressible?] = [\n            withClause,\n            selectClause,\n            joinClause,\n            whereClause,\n            groupByClause,\n            unionClause,\n            orderClause,\n            limitOffsetClause\n        ]\n\n        return \" \".join(clauses.compactMap { $0 }).expression\n    }\n\n}\n\n// TODO: decide: simplify the below with a boxed type instead\n\n/// Queries a collection of chainable helper functions and expressions to build\n/// executable SQL statements.\npublic struct Table: SchemaType {\n\n    public static let identifier = \"TABLE\"\n\n    public var clauses: QueryClauses\n\n    public init(_ name: String, database: String? = nil) {\n        clauses = QueryClauses(name, alias: nil, database: database)\n    }\n\n}\n\npublic struct View: SchemaType {\n\n    public static let identifier = \"VIEW\"\n\n    public var clauses: QueryClauses\n\n    public init(_ name: String, database: String? = nil) {\n        clauses = QueryClauses(name, alias: nil, database: database)\n    }\n\n}\n\npublic struct VirtualTable: SchemaType {\n\n    public static let identifier = \"VIRTUAL TABLE\"\n\n    public var clauses: QueryClauses\n\n    public init(_ name: String, database: String? = nil) {\n        clauses = QueryClauses(name, alias: nil, database: database)\n    }\n\n}\n\n// TODO: make `ScalarQuery` work in `QueryType.select()`, `.filter()`, etc.\n\npublic struct ScalarQuery<V>: QueryType {\n\n    public var clauses: QueryClauses\n\n    public init(_ name: String, database: String? = nil) {\n        clauses = QueryClauses(name, alias: nil, database: database)\n    }\n\n}\n\n// TODO: decide: simplify the below with a boxed type instead\n\npublic struct Select<T>: ExpressionType {\n\n    public var template: String\n    public var bindings: [Binding?]\n\n    public init(_ template: String, _ bindings: [Binding?]) {\n        self.template = template\n        self.bindings = bindings\n    }\n\n}\n\npublic struct Insert: ExpressionType {\n\n    public var template: String\n    public var bindings: [Binding?]\n\n    public init(_ template: String, _ bindings: [Binding?]) {\n        self.template = template\n        self.bindings = bindings\n    }\n\n}\n\npublic struct Update: ExpressionType {\n\n    public var template: String\n    public var bindings: [Binding?]\n\n    public init(_ template: String, _ bindings: [Binding?]) {\n        self.template = template\n        self.bindings = bindings\n    }\n\n}\n\npublic struct Delete: ExpressionType {\n\n    public var template: String\n    public var bindings: [Binding?]\n\n    public init(_ template: String, _ bindings: [Binding?]) {\n        self.template = template\n        self.bindings = bindings\n    }\n\n}\n\npublic struct RowIterator: FailableIterator {\n    public typealias Element = Row\n    let statement: Statement\n    let columnNames: [String: Int]\n\n    public func failableNext() throws -> Row? {\n        try statement.failableNext().flatMap { Row(columnNames, $0) }\n    }\n\n    public func map<T>(_ transform: (Element) throws -> T) throws -> [T] {\n        var elements = [T]()\n        while let row = try failableNext() {\n            elements.append(try transform(row))\n        }\n        return elements\n    }\n\n    public func compactMap<T>(_ transform: (Element) throws -> T?) throws -> [T] {\n        var elements = [T]()\n        while let row = try failableNext() {\n            guard let element = try transform(row) else { continue }\n            elements.append(element)\n        }\n        return elements\n    }\n}\n\nextension Connection {\n\n    public func prepare(_ query: QueryType) throws -> AnySequence<Row> {\n        let expression = query.expression\n        let statement = try prepare(expression.template, expression.bindings)\n\n        let columnNames = try columnNamesForQuery(query)\n\n        return AnySequence {\n            AnyIterator { statement.next().map { Row(columnNames, $0) } }\n        }\n    }\n\n    public func prepareRowIterator(_ query: QueryType) throws -> RowIterator {\n        let expression = query.expression\n        let statement = try prepare(expression.template, expression.bindings)\n        return RowIterator(statement: statement, columnNames: try columnNamesForQuery(query))\n    }\n\n    public func prepareRowIterator(_ statement: String, bindings: Binding?...) throws -> RowIterator {\n        try prepare(statement, bindings).prepareRowIterator()\n    }\n\n    public func prepareRowIterator(_ statement: String, bindings: [Binding?]) throws -> RowIterator {\n        try prepare(statement, bindings).prepareRowIterator()\n    }\n\n    private func columnNamesForQuery(_ query: QueryType) throws -> [String: Int] {\n        var (columnNames, idx) = ([String: Int](), 0)\n        column: for each in query.clauses.select.columns {\n            var names = each.expression.template.split { $0 == \".\" }.map(String.init)\n            let column = names.removeLast()\n            let namespace = names.joined(separator: \".\")\n\n            // Return a copy of the input \"with\" clause stripping all subclauses besides \"select\", \"join\", and \"with\".\n            func strip(_ with: WithClauses) -> WithClauses {\n                var stripped = WithClauses()\n                stripped.recursive = with.recursive\n                for subclause in with.clauses {\n                    let query = subclause.query\n                    var strippedQuery = type(of: query).init(query.clauses.from.name, database: query.clauses.from.database)\n                    strippedQuery.clauses.select = query.clauses.select\n                    strippedQuery.clauses.join = query.clauses.join\n                    strippedQuery.clauses.with = strip(query.clauses.with)\n\n                    var strippedSubclause = WithClauses.Clause(alias: subclause.alias, query: strippedQuery)\n                    strippedSubclause.columns = subclause.columns\n                    stripped.clauses.append(strippedSubclause)\n                }\n                return stripped\n            }\n\n            func expandGlob(_ namespace: Bool) -> (QueryType) throws -> Void {\n                { (queryType: QueryType) throws in\n                    var query = type(of: queryType).init(queryType.clauses.from.name, database: queryType.clauses.from.database)\n                    query.clauses.select = queryType.clauses.select\n                    query.clauses.with = strip(queryType.clauses.with)\n                    let expression = query.expression\n                    var names = try self.prepare(expression.template, expression.bindings).columnNames.map { $0.quote() }\n                    if namespace { names = names.map { \"\\(queryType.tableName().expression.template).\\($0)\" } }\n                    for name in names { columnNames[name] = idx; idx += 1 }\n                }\n            }\n\n            if column == \"*\" {\n                var select = query\n                select.clauses.select = (false, [Expression<Void>(literal: \"*\") as Expressible])\n                let queries = [select] + query.clauses.join.map { $0.query }\n                if !namespace.isEmpty {\n                    for q in queries where q.tableName().expression.template == namespace {\n                        try expandGlob(true)(q)\n                        continue column\n                    }\n                    throw QueryError.noSuchTable(name: namespace)\n                }\n                for q in queries {\n                    try expandGlob(query.clauses.join.count > 0)(q)\n                }\n                continue\n            }\n\n            columnNames[each.expression.template] = idx\n            idx += 1\n        }\n        return columnNames\n    }\n\n    public func scalar<V: Value>(_ query: ScalarQuery<V>) throws -> V {\n        let expression = query.expression\n        return value(try scalar(expression.template, expression.bindings))\n    }\n\n    public func scalar<V: Value>(_ query: ScalarQuery<V?>) throws -> V.ValueType? {\n        let expression = query.expression\n        guard let value = try scalar(expression.template, expression.bindings) as? V.Datatype else { return nil }\n        return try V.fromDatatypeValue(value)\n    }\n\n    public func scalar<V: Value>(_ query: Select<V>) throws -> V {\n        let expression = query.expression\n        return value(try scalar(expression.template, expression.bindings))\n    }\n\n    public func scalar<V: Value>(_ query: Select<V?>) throws -> V.ValueType? {\n        let expression = query.expression\n        guard let value = try scalar(expression.template, expression.bindings) as? V.Datatype else { return nil }\n        return try V.fromDatatypeValue(value)\n    }\n\n    public func pluck(_ query: QueryType) throws -> Row? {\n        try prepareRowIterator(query.limit(1, query.clauses.limit?.offset)).failableNext()\n    }\n\n    /// Runs an `Insert` query.\n    ///\n    /// - SeeAlso: `QueryType.insert(value:_:)`\n    /// - SeeAlso: `QueryType.insert(values:)`\n    /// - SeeAlso: `QueryType.insert(or:_:)`\n    /// - SeeAlso: `QueryType.insertMany(values:)`\n    /// - SeeAlso: `QueryType.insertMany(or:_:)`\n    /// - SeeAlso: `QueryType.insert()`\n    ///\n    /// - Parameter query: An insert query.\n    ///\n    /// - Returns: The insert’s rowid.\n    @discardableResult public func run(_ query: Insert) throws -> Int64 {\n        let expression = query.expression\n        return try sync {\n            try self.run(expression.template, expression.bindings)\n            return lastInsertRowid\n        }\n    }\n\n    /// Runs an `Update` query.\n    ///\n    /// - SeeAlso: `QueryType.insert(query:)`\n    /// - SeeAlso: `QueryType.update(values:)`\n    ///\n    /// - Parameter query: An update query.\n    ///\n    /// - Returns: The number of updated rows.\n    @discardableResult public func run(_ query: Update) throws -> Int {\n        let expression = query.expression\n        return try sync {\n            try self.run(expression.template, expression.bindings)\n            return changes\n        }\n    }\n\n    /// Runs a `Delete` query.\n    ///\n    /// - SeeAlso: `QueryType.delete()`\n    ///\n    /// - Parameter query: A delete query.\n    ///\n    /// - Returns: The number of deleted rows.\n    @discardableResult public func run(_ query: Delete) throws -> Int {\n        let expression = query.expression\n        return try sync {\n            try self.run(expression.template, expression.bindings)\n            return changes\n        }\n    }\n\n}\n\npublic struct Row: Sendable {\n\n    let columnNames: [String: Int]\n\n    fileprivate let values: [Binding?]\n\n    internal init(_ columnNames: [String: Int], _ values: [Binding?]) {\n        self.columnNames = columnNames\n        self.values = values\n    }\n\n    func hasValue(for column: String) -> Bool {\n        guard let idx = columnNames[column.quote()] else {\n            return false\n        }\n        return values[idx] != nil\n    }\n\n    /// Returns a row’s value for the given column.\n    ///\n    /// - Parameter column: An expression representing a column selected in a Query.\n    ///\n    /// - Returns: The value for the given column.\n    public func get<V: Value>(_ column: Expression<V>) throws -> V {\n        if let value = try get(Expression<V?>(column)) {\n            return value\n        } else {\n            throw QueryError.unexpectedNullValue(name: column.template)\n        }\n    }\n\n    public func get<V: Value>(_ column: Expression<V?>) throws -> V? {\n        func valueAtIndex(_ idx: Int) throws -> V? {\n            guard let value = values[idx] as? V.Datatype else { return nil }\n            return try V.fromDatatypeValue(value) as? V\n        }\n\n        guard let idx = columnNames[column.template] else {\n            func similar(_ name: String) -> Bool {\n                return name.hasSuffix(\".\\(column.template)\")\n            }\n\n            guard let firstIndex = columnNames.firstIndex(where: { similar($0.key) }) else {\n                throw QueryError.noSuchColumn(name: column.template, columns: columnNames.keys.sorted())\n            }\n\n            let secondIndex = columnNames\n                .suffix(from: columnNames.index(after: firstIndex))\n                .firstIndex(where: { similar($0.key) })\n\n            guard secondIndex == nil else {\n                throw QueryError.ambiguousColumn(\n                    name: column.template,\n                    similar: columnNames.keys.filter(similar).sorted()\n                )\n            }\n            return try valueAtIndex(columnNames[firstIndex].value)\n        }\n\n        return try valueAtIndex(idx)\n    }\n\n    public subscript<T: Value>(column: Expression<T>) -> T {\n        // swiftlint:disable:next force_try\n        try! get(column)\n    }\n\n    public subscript<T: Value>(column: Expression<T?>) -> T? {\n        // swiftlint:disable:next force_try\n        try! get(column)\n    }\n}\n\n/// Determines the join operator for a query’s `JOIN` clause.\npublic enum JoinType: String, Sendable {\n\n    /// A `CROSS` join.\n    case cross = \"CROSS\"\n\n    /// An `INNER` join.\n    case inner = \"INNER\"\n\n    /// A `LEFT OUTER` join.\n    case leftOuter = \"LEFT OUTER\"\n\n}\n\n/// ON CONFLICT resolutions.\npublic enum OnConflict: String, Sendable {\n\n    case replace = \"REPLACE\"\n\n    case rollback = \"ROLLBACK\"\n\n    case abort = \"ABORT\"\n\n    case fail = \"FAIL\"\n\n    case ignore = \"IGNORE\"\n\n}\n\n// MARK: - Private\n\npublic struct QueryClauses: Sendable {\n\n    var select = (distinct: false, columns: [Expression<Void>(literal: \"*\") as Expressible])\n\n    var from: (name: String, alias: String?, database: String?)\n\n    var join = [(type: JoinType, query: QueryType, condition: Expressible)]()\n\n    var filters: Expression<Bool?>?\n\n    var group: (by: [Expressible], having: Expression<Bool?>?)?\n\n    var order = [Expressible]()\n\n    var limit: (length: Int, offset: Int?)?\n\n    var union = [(all: Bool, table: QueryType)]()\n\n    var with = WithClauses()\n\n    fileprivate init(_ name: String, alias: String?, database: String?) {\n        from = (name, alias, database)\n    }\n\n}\n"
  },
  {
    "path": "Sources/SQLite/Typed/Schema.swift",
    "content": "//\n// SQLite.swift\n// https://github.com/stephencelis/SQLite.swift\n// Copyright © 2014-2015 Stephen Celis.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nextension SchemaType {\n\n    // MARK: - DROP TABLE / VIEW / VIRTUAL TABLE\n\n    public func drop(ifExists: Bool = false) -> String {\n        drop(\"TABLE\", tableName(), ifExists)\n    }\n\n}\n\nextension Table {\n\n    // MARK: - CREATE TABLE\n\n    public func create(temporary: Bool = false, ifNotExists: Bool = false, withoutRowid: Bool = false,\n                       block: (TableBuilder) -> Void) -> String {\n        let builder = TableBuilder()\n\n        block(builder)\n\n        let clauses: [Expressible?] = [\n            create(Table.identifier, tableName(), temporary ? .temporary : nil, ifNotExists),\n            \"\".wrap(builder.definitions) as Expression<Void>,\n            withoutRowid ? Expression<Void>(literal: \"WITHOUT ROWID\") : nil\n        ]\n\n        return \" \".join(clauses.compactMap { $0 }).asSQL()\n    }\n\n    public func create(_ query: QueryType, temporary: Bool = false, ifNotExists: Bool = false) -> String {\n        let clauses: [Expressible?] = [\n            create(Table.identifier, tableName(), temporary ? .temporary : nil, ifNotExists),\n            Expression<Void>(literal: \"AS\"),\n            query\n        ]\n\n        return \" \".join(clauses.compactMap { $0 }).asSQL()\n    }\n\n    // MARK: - ALTER TABLE … ADD COLUMN\n\n    public func addColumn<V: Value>(_ name: Expression<V>, check: Expression<Bool>? = nil, defaultValue: V) -> String {\n        addColumn(definition(name, V.declaredDatatype, nil, false, false, check, defaultValue, nil, nil))\n    }\n\n    public func addColumn<V: Value>(_ name: Expression<V>, check: Expression<Bool?>, defaultValue: V) -> String {\n        addColumn(definition(name, V.declaredDatatype, nil, false, false, check, defaultValue, nil, nil))\n    }\n\n    public func addColumn<V: Value>(_ name: Expression<V?>, check: Expression<Bool>? = nil, defaultValue: V? = nil) -> String {\n        addColumn(definition(name, V.declaredDatatype, nil, true, false, check, defaultValue, nil, nil))\n    }\n\n    public func addColumn<V: Value>(_ name: Expression<V?>, check: Expression<Bool?>, defaultValue: V? = nil) -> String {\n        addColumn(definition(name, V.declaredDatatype, nil, true, false, check, defaultValue, nil, nil))\n    }\n\n    public func addColumn<V: Value>(_ name: Expression<V>, unique: Bool = false, check: Expression<Bool>? = nil,\n                                    references table: QueryType, _ other: Expression<V>) -> String where V.Datatype == Int64 {\n        addColumn(definition(name, V.declaredDatatype, nil, false, unique, check, nil, (table, other), nil))\n    }\n\n    public func addColumn<V: Value>(_ name: Expression<V>, unique: Bool = false, check: Expression<Bool?>,\n                                    references table: QueryType, _ other: Expression<V>) -> String where V.Datatype == Int64 {\n        addColumn(definition(name, V.declaredDatatype, nil, false, unique, check, nil, (table, other), nil))\n    }\n\n    public func addColumn<V: Value>(_ name: Expression<V?>, unique: Bool = false, check: Expression<Bool>? = nil,\n                                    references table: QueryType, _ other: Expression<V>) -> String where V.Datatype == Int64 {\n        addColumn(definition(name, V.declaredDatatype, nil, true, unique, check, nil, (table, other), nil))\n    }\n\n    public func addColumn<V: Value>(_ name: Expression<V?>, unique: Bool = false, check: Expression<Bool?>,\n                                    references table: QueryType, _ other: Expression<V>) -> String where V.Datatype == Int64 {\n        addColumn(definition(name, V.declaredDatatype, nil, true, unique, check, nil, (table, other), nil))\n    }\n\n    public func addColumn<V: Value>(_ name: Expression<V>, check: Expression<Bool>? = nil, defaultValue: V,\n                                    collate: Collation) -> String where V.Datatype == String {\n        addColumn(definition(name, V.declaredDatatype, nil, false, false, check, defaultValue, nil, collate))\n    }\n\n    public func addColumn<V: Value>(_ name: Expression<V>, check: Expression<Bool?>, defaultValue: V,\n                                    collate: Collation) -> String where V.Datatype == String {\n        addColumn(definition(name, V.declaredDatatype, nil, false, false, check, defaultValue, nil, collate))\n    }\n\n    public func addColumn<V: Value>(_ name: Expression<V?>, check: Expression<Bool>? = nil, defaultValue: V? = nil,\n                                    collate: Collation) -> String where V.Datatype == String {\n        addColumn(definition(name, V.declaredDatatype, nil, true, false, check, defaultValue, nil, collate))\n    }\n\n    public func addColumn<V: Value>(_ name: Expression<V?>, check: Expression<Bool?>, defaultValue: V? = nil,\n                                    collate: Collation) -> String where V.Datatype == String {\n        addColumn(definition(name, V.declaredDatatype, nil, true, false, check, defaultValue, nil, collate))\n    }\n\n    fileprivate func addColumn(_ expression: Expressible) -> String {\n        \" \".join([\n            Expression<Void>(literal: \"ALTER TABLE\"),\n            tableName(),\n            Expression<Void>(literal: \"ADD COLUMN\"),\n            expression\n        ]).asSQL()\n    }\n\n    // MARK: - ALTER TABLE … RENAME TO\n\n    public func rename(_ to: Table) -> String {\n        rename(to: to)\n    }\n\n    // MARK: - CREATE INDEX\n\n    public func createIndex(_ columns: [Expressible], unique: Bool = false, ifNotExists: Bool = false) -> String {\n        let clauses: [Expressible?] = [\n            create(\"INDEX\", indexName(columns), unique ? .unique : nil, ifNotExists),\n            Expression<Void>(literal: \"ON\"),\n            tableName(qualified: false),\n            \"\".wrap(columns) as Expression<Void>\n        ]\n\n        return \" \".join(clauses.compactMap { $0 }).asSQL()\n    }\n\n    public func createIndex(_ columns: Expressible..., unique: Bool = false, ifNotExists: Bool = false) -> String {\n        return createIndex(Array(columns), unique: unique, ifNotExists: ifNotExists)\n    }\n\n    // MARK: - DROP INDEX\n\n    public func dropIndex(_ columns: [Expressible], ifExists: Bool = false) -> String {\n        drop(\"INDEX\", indexName(columns), ifExists)\n    }\n\n    public func dropIndex(_ columns: Expressible..., ifExists: Bool = false) -> String {\n        dropIndex(Array(columns), ifExists: ifExists)\n    }\n\n    fileprivate func indexName(_ columns: [Expressible]) -> Expressible {\n        let string = ([\"index\", clauses.from.name, \"on\"] + columns.map { $0.expression.template }).joined(separator: \" \").lowercased()\n\n        let index = string.reduce(\"\") { underscored, character in\n            guard character != \"\\\"\" else {\n                return underscored\n            }\n            guard \"a\"...\"z\" ~= character || \"0\"...\"9\" ~= character else {\n                return underscored + \"_\"\n            }\n            return underscored + String(character)\n        }\n\n        return database(namespace: index)\n    }\n\n}\n\nextension View {\n\n    // MARK: - CREATE VIEW\n\n    public func create(_ query: QueryType, temporary: Bool = false, ifNotExists: Bool = false) -> String {\n        let clauses: [Expressible?] = [\n            create(View.identifier, tableName(), temporary ? .temporary : nil, ifNotExists),\n            Expression<Void>(literal: \"AS\"),\n            query\n        ]\n\n        return \" \".join(clauses.compactMap { $0 }).asSQL()\n    }\n\n    // MARK: - DROP VIEW\n\n    public func drop(ifExists: Bool = false) -> String {\n        drop(\"VIEW\", tableName(), ifExists)\n    }\n\n}\n\nextension VirtualTable {\n\n    // MARK: - CREATE VIRTUAL TABLE\n\n    public func create(_ using: Module, ifNotExists: Bool = false) -> String {\n        let clauses: [Expressible?] = [\n            create(VirtualTable.identifier, tableName(), nil, ifNotExists),\n            Expression<Void>(literal: \"USING\"),\n            using\n        ]\n\n        return \" \".join(clauses.compactMap { $0 }).asSQL()\n    }\n\n    // MARK: - ALTER TABLE … RENAME TO\n\n    public func rename(_ to: VirtualTable) -> String {\n        rename(to: to)\n    }\n\n}\n\npublic final class TableBuilder {\n\n    fileprivate var definitions = [Expressible]()\n\n    public func column<V: Value>(_ name: Expression<V>, unique: Bool = false, check: Expression<Bool>? = nil,\n                                 defaultValue: Expression<V>? = nil) {\n        column(name, V.declaredDatatype, nil, false, unique, check, defaultValue, nil, nil)\n    }\n\n    public func column<V: Value>(_ name: Expression<V>, unique: Bool = false, check: Expression<Bool>? = nil,\n                                 defaultValue: V) {\n        column(name, V.declaredDatatype, nil, false, unique, check, defaultValue, nil, nil)\n    }\n\n    public func column<V: Value>(_ name: Expression<V>, unique: Bool = false, check: Expression<Bool?>,\n                                 defaultValue: Expression<V>? = nil) {\n        column(name, V.declaredDatatype, nil, false, unique, check, defaultValue, nil, nil)\n    }\n\n    public func column<V: Value>(_ name: Expression<V>, unique: Bool = false, check: Expression<Bool?>,\n                                 defaultValue: V) {\n        column(name, V.declaredDatatype, nil, false, unique, check, defaultValue, nil, nil)\n    }\n\n    public func column<V: Value>(_ name: Expression<V?>, unique: Bool = false, check: Expression<Bool>? = nil,\n                                 defaultValue: Expression<V>? = nil) {\n        column(name, V.declaredDatatype, nil, true, unique, check, defaultValue, nil, nil)\n    }\n\n    public func column<V: Value>(_ name: Expression<V?>, unique: Bool = false, check: Expression<Bool>? = nil,\n                                 defaultValue: Expression<V?>) {\n        column(name, V.declaredDatatype, nil, true, unique, check, defaultValue, nil, nil)\n    }\n\n    public func column<V: Value>(_ name: Expression<V?>, unique: Bool = false, check: Expression<Bool>? = nil,\n                                 defaultValue: V) {\n        column(name, V.declaredDatatype, nil, true, unique, check, defaultValue, nil, nil)\n    }\n\n    public func column<V: Value>(_ name: Expression<V?>, unique: Bool = false, check: Expression<Bool?>,\n                                 defaultValue: Expression<V>? = nil) {\n        column(name, V.declaredDatatype, nil, true, unique, check, defaultValue, nil, nil)\n    }\n\n    public func column<V: Value>(_ name: Expression<V?>, unique: Bool = false, check: Expression<Bool?>,\n                                 defaultValue: Expression<V?>) {\n        column(name, V.declaredDatatype, nil, true, unique, check, defaultValue, nil, nil)\n    }\n\n    public func column<V: Value>(_ name: Expression<V?>, unique: Bool = false, check: Expression<Bool?>,\n                                 defaultValue: V) {\n        column(name, V.declaredDatatype, nil, true, unique, check, defaultValue, nil, nil)\n    }\n\n    public func column<V: Value>(_ name: Expression<V>, primaryKey: Bool, check: Expression<Bool>? = nil,\n                                 defaultValue: Expression<V>? = nil) {\n        column(name, V.declaredDatatype, primaryKey ? .default : nil, false, false, check, defaultValue, nil, nil)\n    }\n\n    public func column<V: Value>(_ name: Expression<V>, primaryKey: Bool, check: Expression<Bool?>,\n                                 defaultValue: Expression<V>? = nil) {\n        column(name, V.declaredDatatype, primaryKey ? .default : nil, false, false, check, defaultValue, nil, nil)\n    }\n\n    public func column<V: Value>(_ name: Expression<V>, primaryKey: PrimaryKey,\n                                 check: Expression<Bool>? = nil) where V.Datatype == Int64 {\n        column(name, V.declaredDatatype, primaryKey, false, false, check, nil, nil, nil)\n    }\n\n    public func column<V: Value>(_ name: Expression<V>, primaryKey: PrimaryKey,\n                                 check: Expression<Bool?>) where V.Datatype == Int64 {\n        column(name, V.declaredDatatype, primaryKey, false, false, check, nil, nil, nil)\n    }\n\n    public func column<V: Value>(_ name: Expression<V>, unique: Bool = false, check: Expression<Bool>? = nil,\n                                 references table: QueryType, _ other: Expression<V>) where V.Datatype == Int64 {\n        column(name, V.declaredDatatype, nil, false, unique, check, nil, (table, other), nil)\n    }\n\n    public func column<V: Value>(_ name: Expression<V>, unique: Bool = false, check: Expression<Bool?>,\n                                 references table: QueryType, _ other: Expression<V>) where V.Datatype == Int64 {\n        column(name, V.declaredDatatype, nil, false, unique, check, nil, (table, other), nil)\n    }\n\n    public func column<V: Value>(_ name: Expression<V?>, unique: Bool = false, check: Expression<Bool>? = nil,\n                                 references table: QueryType, _ other: Expression<V>) where V.Datatype == Int64 {\n        column(name, V.declaredDatatype, nil, true, unique, check, nil, (table, other), nil)\n    }\n\n    public func column<V: Value>(_ name: Expression<V?>, unique: Bool = false, check: Expression<Bool?>,\n                                 references table: QueryType, _ other: Expression<V>) where V.Datatype == Int64 {\n        column(name, V.declaredDatatype, nil, true, unique, check, nil, (table, other), nil)\n    }\n\n    public func column<V: Value>(_ name: Expression<V>, primaryKey: Bool, check: Expression<Bool>? = nil,\n                                 references table: QueryType, _ other: Expression<V>) where V.Datatype == Int64 {\n        column(name, V.declaredDatatype, primaryKey ? .default : nil, false, false, check, nil, (table, other), nil)\n    }\n\n    public func column<V: Value>(_ name: Expression<V>, primaryKey: Bool, check: Expression<Bool?>,\n                                 references table: QueryType, _ other: Expression<V>) where V.Datatype == Int64 {\n        column(name, V.declaredDatatype, primaryKey ? .default : nil, false, false, check, nil, (table, other), nil)\n    }\n\n    public func column<V: Value>(_ name: Expression<V?>, primaryKey: Bool, check: Expression<Bool>? = nil,\n                                 references table: QueryType, _ other: Expression<V>) where V.Datatype == Int64 {\n        column(name, V.declaredDatatype, primaryKey ? .default : nil, true, false, check, nil, (table, other), nil)\n    }\n\n    public func column<V: Value>(_ name: Expression<V?>, primaryKey: Bool, check: Expression<Bool?>,\n                                 references table: QueryType, _ other: Expression<V>) where V.Datatype == Int64 {\n        column(name, V.declaredDatatype, primaryKey ? .default : nil, true, false, check, nil, (table, other), nil)\n    }\n\n    public func column<V: Value>(_ name: Expression<V>, unique: Bool = false, check: Expression<Bool>? = nil,\n                                 defaultValue: Expression<V>? = nil, collate: Collation) where V.Datatype == String {\n        column(name, V.declaredDatatype, nil, false, unique, check, defaultValue, nil, collate)\n    }\n\n    public func column<V: Value>(_ name: Expression<V>, unique: Bool = false, check: Expression<Bool>? = nil,\n                                 defaultValue: V, collate: Collation) where V.Datatype == String {\n        column(name, V.declaredDatatype, nil, false, unique, check, defaultValue, nil, collate)\n    }\n\n    public func column<V: Value>(_ name: Expression<V>, unique: Bool = false, check: Expression<Bool?>,\n                                 defaultValue: Expression<V>? = nil, collate: Collation) where V.Datatype == String {\n        column(name, V.declaredDatatype, nil, false, unique, check, defaultValue, nil, collate)\n    }\n\n    public func column<V: Value>(_ name: Expression<V>, unique: Bool = false, check: Expression<Bool?>,\n                                 defaultValue: V, collate: Collation) where V.Datatype == String {\n        column(name, V.declaredDatatype, nil, false, unique, check, defaultValue, nil, collate)\n    }\n\n    public func column<V: Value>(_ name: Expression<V?>, unique: Bool = false, check: Expression<Bool>? = nil,\n                                 defaultValue: Expression<V>? = nil, collate: Collation) where V.Datatype == String {\n        column(name, V.declaredDatatype, nil, true, unique, check, defaultValue, nil, collate)\n    }\n\n    public func column<V: Value>(_ name: Expression<V?>, unique: Bool = false, check: Expression<Bool>? = nil,\n                                 defaultValue: Expression<V?>, collate: Collation) where V.Datatype == String {\n        column(name, V.declaredDatatype, nil, true, unique, check, defaultValue, nil, collate)\n    }\n\n    public func column<V: Value>(_ name: Expression<V?>, unique: Bool = false, check: Expression<Bool>? = nil,\n                                 defaultValue: V, collate: Collation) where V.Datatype == String {\n        column(name, V.declaredDatatype, nil, true, unique, check, defaultValue, nil, collate)\n    }\n\n    public func column<V: Value>(_ name: Expression<V?>, unique: Bool = false, check: Expression<Bool?>,\n                                 defaultValue: Expression<V>? = nil, collate: Collation) where V.Datatype == String {\n        column(name, V.declaredDatatype, nil, true, unique, check, defaultValue, nil, collate)\n    }\n\n    public func column<V: Value>(_ name: Expression<V?>, unique: Bool = false, check: Expression<Bool?>,\n                                 defaultValue: Expression<V?>, collate: Collation) where V.Datatype == String {\n        column(name, V.declaredDatatype, nil, true, unique, check, defaultValue, nil, collate)\n    }\n\n    public func column<V: Value>(_ name: Expression<V?>, unique: Bool = false, check: Expression<Bool?>,\n                                 defaultValue: V, collate: Collation) where V.Datatype == String {\n        column(name, V.declaredDatatype, nil, true, unique, check, defaultValue, nil, collate)\n    }\n\n    // swiftlint:disable:next function_parameter_count\n    fileprivate func column(_ name: Expressible, _ datatype: String, _ primaryKey: PrimaryKey?, _ null: Bool,\n                            _ unique: Bool, _ check: Expressible?, _ defaultValue: Expressible?,\n                            _ references: (QueryType, Expressible)?, _ collate: Collation?) {\n        definitions.append(definition(name, datatype, primaryKey, null, unique, check, defaultValue, references, collate))\n    }\n\n    // MARK: -\n\n    public func primaryKey<T: Value>(_ column: Expression<T>) {\n        primaryKey([column])\n    }\n\n    public func primaryKey<T: Value, U: Value>(_ compositeA: Expression<T>,\n                                               _ expr: Expression<U>) {\n        primaryKey([compositeA, expr])\n    }\n\n    public func primaryKey<T: Value, U: Value, V: Value>(_ compositeA: Expression<T>,\n                                                         _ expr1: Expression<U>,\n                                                         _ expr2: Expression<V>) {\n        primaryKey([compositeA, expr1, expr2])\n    }\n\n    public func primaryKey<T: Value, U: Value, V: Value, W: Value>(_ compositeA: Expression<T>,\n                                                                   _ expr1: Expression<U>,\n                                                                   _ expr2: Expression<V>,\n                                                                   _ expr3: Expression<W>) {\n        primaryKey([compositeA, expr1, expr2, expr3])\n    }\n\n    fileprivate func primaryKey(_ composite: [Expressible]) {\n        definitions.append(\"PRIMARY KEY\".prefix(composite))\n    }\n\n    public func unique(_ columns: Expressible...) {\n        unique(columns)\n    }\n\n    public func unique(_ columns: [Expressible]) {\n        definitions.append(\"UNIQUE\".prefix(columns))\n    }\n\n    public func check(_ condition: Expression<Bool>) {\n        check(Expression<Bool?>(condition))\n    }\n\n    public func check(_ condition: Expression<Bool?>) {\n        definitions.append(\"CHECK\".prefix(condition))\n    }\n\n    public enum Dependency: String {\n\n        case noAction = \"NO ACTION\"\n\n        case restrict = \"RESTRICT\"\n\n        case setNull = \"SET NULL\"\n\n        case setDefault = \"SET DEFAULT\"\n\n        case cascade = \"CASCADE\"\n\n    }\n\n    public func foreignKey<T: Value>(_ column: Expression<T>, references table: QueryType, _ other: Expression<T>,\n                                     update: Dependency? = nil, delete: Dependency? = nil) {\n        foreignKey(column, (table, other), update, delete)\n    }\n\n    public func foreignKey<T: Value>(_ column: Expression<T?>, references table: QueryType, _ other: Expression<T>,\n                                     update: Dependency? = nil, delete: Dependency? = nil) {\n        foreignKey(column, (table, other), update, delete)\n    }\n\n    public func foreignKey<T: Value, U: Value>(_ composite: (Expression<T>, Expression<U>),\n                                               references table: QueryType, _ other: (Expression<T>, Expression<U>),\n                                               update: Dependency? = nil, delete: Dependency? = nil) {\n        let composite = \", \".join([composite.0, composite.1])\n        let references = (table, \", \".join([other.0, other.1]))\n\n        foreignKey(composite, references, update, delete)\n    }\n\n    public func foreignKey<T: Value, U: Value, V: Value>(_ composite: (Expression<T>, Expression<U>, Expression<V>),\n                                                         references table: QueryType,\n                                                         _ other: (Expression<T>, Expression<U>, Expression<V>),\n                                                         update: Dependency? = nil, delete: Dependency? = nil) {\n        let composite = \", \".join([composite.0, composite.1, composite.2])\n        let references = (table, \", \".join([other.0, other.1, other.2]))\n\n        foreignKey(composite, references, update, delete)\n    }\n\n    fileprivate func foreignKey(_ column: Expressible, _ references: (QueryType, Expressible),\n                                _ update: Dependency?, _ delete: Dependency?) {\n        let clauses: [Expressible?] = [\n            \"FOREIGN KEY\".prefix(column),\n            reference(references),\n            update.map { Expression<Void>(literal: \"ON UPDATE \\($0.rawValue)\") },\n            delete.map { Expression<Void>(literal: \"ON DELETE \\($0.rawValue)\") }\n        ]\n\n        definitions.append(\" \".join(clauses.compactMap { $0 }))\n    }\n\n}\n\npublic enum PrimaryKey: Sendable {\n\n    case `default`\n\n    case autoincrement\n\n}\n\npublic struct Module: Sendable {\n\n    fileprivate let name: String\n\n    fileprivate let arguments: [Expressible]\n\n    public init(_ name: String, _ arguments: [Expressible]) {\n        self.init(name: name.quote(), arguments: arguments)\n    }\n\n    init(name: String, arguments: [Expressible]) {\n        self.name = name\n        self.arguments = arguments\n    }\n\n}\n\nextension Module: Expressible {\n\n    public var expression: Expression<Void> {\n        name.wrap(arguments)\n    }\n\n}\n\n// MARK: - Private\n\nprivate extension QueryType {\n\n    func create(_ identifier: String, _ name: Expressible, _ modifier: Modifier?, _ ifNotExists: Bool) -> Expressible {\n        let clauses: [Expressible?] = [\n            Expression<Void>(literal: \"CREATE\"),\n            modifier.map { Expression<Void>(literal: $0.rawValue) },\n            Expression<Void>(literal: identifier),\n            ifNotExists ? Expression<Void>(literal: \"IF NOT EXISTS\") : nil,\n            name\n        ]\n\n        return \" \".join(clauses.compactMap { $0 })\n    }\n\n    func rename(to: Self) -> String {\n        \" \".join([\n            Expression<Void>(literal: \"ALTER TABLE\"),\n            tableName(),\n            Expression<Void>(literal: \"RENAME TO\"),\n            Expression<Void>(to.clauses.from.name)\n        ]).asSQL()\n    }\n\n    func drop(_ identifier: String, _ name: Expressible, _ ifExists: Bool) -> String {\n        let clauses: [Expressible?] = [\n            Expression<Void>(literal: \"DROP \\(identifier)\"),\n            ifExists ? Expression<Void>(literal: \"IF EXISTS\") : nil,\n            name\n        ]\n\n        return \" \".join(clauses.compactMap { $0 }).asSQL()\n    }\n\n}\n\n// swiftlint:disable:next function_parameter_count\nprivate func definition(_ column: Expressible, _ datatype: String, _ primaryKey: PrimaryKey?, _ null: Bool,\n                        _ unique: Bool, _ check: Expressible?, _ defaultValue: Expressible?,\n                        _ references: (QueryType, Expressible)?, _ collate: Collation?) -> Expressible {\n    let clauses: [Expressible?] = [\n        column,\n        Expression<Void>(literal: datatype),\n        primaryKey.map { Expression<Void>(literal: $0 == .autoincrement ? \"PRIMARY KEY AUTOINCREMENT\" : \"PRIMARY KEY\") },\n        null ? nil : Expression<Void>(literal: \"NOT NULL\"),\n        unique ? Expression<Void>(literal: \"UNIQUE\") : nil,\n        check.map { \" \".join([Expression<Void>(literal: \"CHECK\"), $0]) },\n        defaultValue.map { \"DEFAULT\".prefix($0) },\n        references.map(reference),\n        collate.map { \" \".join([Expression<Void>(literal: \"COLLATE\"), $0]) }\n    ]\n\n    return \" \".join(clauses.compactMap { $0 })\n}\n\nprivate func reference(_ primary: (QueryType, Expressible)) -> Expressible {\n    \" \".join([\n        Expression<Void>(literal: \"REFERENCES\"),\n        primary.0.tableName(qualified: false),\n        \"\".wrap(primary.1) as Expression<Void>\n    ])\n}\n\nprivate enum Modifier: String, Sendable {\n\n    case unique = \"UNIQUE\"\n\n    case temporary = \"TEMPORARY\"\n\n}\n"
  },
  {
    "path": "Sources/SQLite/Typed/Setter.swift",
    "content": "//\n// SQLite.swift\n// https://github.com/stephencelis/SQLite.swift\n// Copyright © 2014-2015 Stephen Celis.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nprecedencegroup ColumnAssignment {\n    associativity: left\n    assignment: true\n    lowerThan: AssignmentPrecedence\n}\n\ninfix operator <- : ColumnAssignment\n\npublic struct Setter: Sendable {\n\n    let column: Expressible\n    let value: Expressible\n\n    fileprivate init<V: Value>(column: Expression<V>, value: Expression<V>) {\n        self.column = column\n        self.value = value\n    }\n\n    fileprivate init<V: Value>(column: Expression<V>, value: V) {\n        self.column = column\n        self.value = value\n    }\n\n    fileprivate init<V: Value>(column: Expression<V?>, value: Expression<V>) {\n        self.column = column\n        self.value = value\n    }\n\n    fileprivate init<V: Value>(column: Expression<V?>, value: Expression<V?>) {\n        self.column = column\n        self.value = value\n    }\n\n    fileprivate init<V: Value>(column: Expression<V?>, value: V?) {\n        self.column = column\n        self.value = Expression<V?>(value: value)\n    }\n\n    init(excluded column: Expressible) {\n        let excluded = Expression<Void>(\"excluded\")\n        self.column = column\n        value = \".\".join([excluded, column.expression])\n    }\n}\n\nextension Setter: Expressible {\n\n    public var expression: Expression<Void> {\n        \"=\".infix(column, value, wrap: false)\n    }\n\n}\n\nextension Setter: CustomStringConvertible {\n    public var description: String {\n        asSQL()\n    }\n}\n\npublic func <-<V: Value>(column: Expression<V>, value: Expression<V>) -> Setter {\n    Setter(column: column, value: value)\n}\npublic func <-<V: Value>(column: Expression<V>, value: V) -> Setter {\n    Setter(column: column, value: value)\n}\npublic func <-<V: Value>(column: Expression<V?>, value: Expression<V>) -> Setter {\n    Setter(column: column, value: value)\n}\npublic func <-<V: Value>(column: Expression<V?>, value: Expression<V?>) -> Setter {\n    Setter(column: column, value: value)\n}\npublic func <-<V: Value>(column: Expression<V?>, value: V?) -> Setter {\n    Setter(column: column, value: value)\n}\n\npublic func +=(column: Expression<String>, value: Expression<String>) -> Setter {\n    column <- column + value\n}\npublic func +=(column: Expression<String>, value: String) -> Setter {\n    column <- column + value\n}\npublic func +=(column: Expression<String?>, value: Expression<String>) -> Setter {\n    column <- column + value\n}\npublic func +=(column: Expression<String?>, value: Expression<String?>) -> Setter {\n    column <- column + value\n}\npublic func +=(column: Expression<String?>, value: String) -> Setter {\n    column <- column + value\n}\n\npublic func +=<V: Value>(column: Expression<V>, value: Expression<V>) -> Setter where V.Datatype: Number {\n    column <- column + value\n}\npublic func +=<V: Value>(column: Expression<V>, value: V) -> Setter where V.Datatype: Number {\n    column <- column + value\n}\npublic func +=<V: Value>(column: Expression<V?>, value: Expression<V>) -> Setter where V.Datatype: Number {\n    column <- column + value\n}\npublic func +=<V: Value>(column: Expression<V?>, value: Expression<V?>) -> Setter where V.Datatype: Number {\n    column <- column + value\n}\npublic func +=<V: Value>(column: Expression<V?>, value: V) -> Setter where V.Datatype: Number {\n    column <- column + value\n}\n\npublic func -=<V: Value>(column: Expression<V>, value: Expression<V>) -> Setter where V.Datatype: Number {\n    column <- column - value\n}\npublic func -=<V: Value>(column: Expression<V>, value: V) -> Setter where V.Datatype: Number {\n    column <- column - value\n}\npublic func -=<V: Value>(column: Expression<V?>, value: Expression<V>) -> Setter where V.Datatype: Number {\n    column <- column - value\n}\npublic func -=<V: Value>(column: Expression<V?>, value: Expression<V?>) -> Setter where V.Datatype: Number {\n    column <- column - value\n}\npublic func -=<V: Value>(column: Expression<V?>, value: V) -> Setter where V.Datatype: Number {\n    column <- column - value\n}\n\npublic func *=<V: Value>(column: Expression<V>, value: Expression<V>) -> Setter where V.Datatype: Number {\n    column <- column * value\n}\npublic func *=<V: Value>(column: Expression<V>, value: V) -> Setter where V.Datatype: Number {\n    column <- column * value\n}\npublic func *=<V: Value>(column: Expression<V?>, value: Expression<V>) -> Setter where V.Datatype: Number {\n    column <- column * value\n}\npublic func *=<V: Value>(column: Expression<V?>, value: Expression<V?>) -> Setter where V.Datatype: Number {\n    column <- column * value\n}\npublic func *=<V: Value>(column: Expression<V?>, value: V) -> Setter where V.Datatype: Number {\n    column <- column * value\n}\n\npublic func /=<V: Value>(column: Expression<V>, value: Expression<V>) -> Setter where V.Datatype: Number {\n    column <- column / value\n}\npublic func /=<V: Value>(column: Expression<V>, value: V) -> Setter where V.Datatype: Number {\n    column <- column / value\n}\npublic func /=<V: Value>(column: Expression<V?>, value: Expression<V>) -> Setter where V.Datatype: Number {\n    column <- column / value\n}\npublic func /=<V: Value>(column: Expression<V?>, value: Expression<V?>) -> Setter where V.Datatype: Number {\n    column <- column / value\n}\npublic func /=<V: Value>(column: Expression<V?>, value: V) -> Setter where V.Datatype: Number {\n    column <- column / value\n}\n\npublic func %=<V: Value>(column: Expression<V>, value: Expression<V>) -> Setter where V.Datatype == Int64 {\n    column <- column % value\n}\npublic func %=<V: Value>(column: Expression<V>, value: V) -> Setter where V.Datatype == Int64 {\n    column <- column % value\n}\npublic func %=<V: Value>(column: Expression<V?>, value: Expression<V>) -> Setter where V.Datatype == Int64 {\n    column <- column % value\n}\npublic func %=<V: Value>(column: Expression<V?>, value: Expression<V?>) -> Setter where V.Datatype == Int64 {\n    column <- column % value\n}\npublic func %=<V: Value>(column: Expression<V?>, value: V) -> Setter where V.Datatype == Int64 {\n    column <- column % value\n}\n\npublic func <<=<V: Value>(column: Expression<V>, value: Expression<V>) -> Setter where V.Datatype == Int64 {\n    column <- column << value\n}\npublic func <<=<V: Value>(column: Expression<V>, value: V) -> Setter where V.Datatype == Int64 {\n    column <- column << value\n}\npublic func <<=<V: Value>(column: Expression<V?>, value: Expression<V>) -> Setter where V.Datatype == Int64 {\n    column <- column << value\n}\npublic func <<=<V: Value>(column: Expression<V?>, value: Expression<V?>) -> Setter where V.Datatype == Int64 {\n    column <- column << value\n}\npublic func <<=<V: Value>(column: Expression<V?>, value: V) -> Setter where V.Datatype == Int64 {\n    column <- column << value\n}\n\npublic func >>=<V: Value>(column: Expression<V>, value: Expression<V>) -> Setter where V.Datatype == Int64 {\n    column <- column >> value\n}\npublic func >>=<V: Value>(column: Expression<V>, value: V) -> Setter where V.Datatype == Int64 {\n    column <- column >> value\n}\npublic func >>=<V: Value>(column: Expression<V?>, value: Expression<V>) -> Setter where V.Datatype == Int64 {\n    column <- column >> value\n}\npublic func >>=<V: Value>(column: Expression<V?>, value: Expression<V?>) -> Setter where V.Datatype == Int64 {\n    column <- column >> value\n}\npublic func >>=<V: Value>(column: Expression<V?>, value: V) -> Setter where V.Datatype == Int64 {\n    column <- column >> value\n}\n\npublic func &=<V: Value>(column: Expression<V>, value: Expression<V>) -> Setter where V.Datatype == Int64 {\n    column <- column & value\n}\npublic func &=<V: Value>(column: Expression<V>, value: V) -> Setter where V.Datatype == Int64 {\n    column <- column & value\n}\npublic func &=<V: Value>(column: Expression<V?>, value: Expression<V>) -> Setter where V.Datatype == Int64 {\n    column <- column & value\n}\npublic func &=<V: Value>(column: Expression<V?>, value: Expression<V?>) -> Setter where V.Datatype == Int64 {\n    column <- column & value\n}\npublic func &=<V: Value>(column: Expression<V?>, value: V) -> Setter where V.Datatype == Int64 {\n    column <- column & value\n}\n\npublic func |=<V: Value>(column: Expression<V>, value: Expression<V>) -> Setter where V.Datatype == Int64 {\n    column <- column | value\n}\npublic func |=<V: Value>(column: Expression<V>, value: V) -> Setter where V.Datatype == Int64 {\n    column <- column | value\n}\npublic func |=<V: Value>(column: Expression<V?>, value: Expression<V>) -> Setter where V.Datatype == Int64 {\n    column <- column | value\n}\npublic func |=<V: Value>(column: Expression<V?>, value: Expression<V?>) -> Setter where V.Datatype == Int64 {\n    column <- column | value\n}\npublic func |=<V: Value>(column: Expression<V?>, value: V) -> Setter where V.Datatype == Int64 {\n    column <- column | value\n}\n\npublic func ^=<V: Value>(column: Expression<V>, value: Expression<V>) -> Setter where V.Datatype == Int64 {\n    column <- column ^ value\n}\npublic func ^=<V: Value>(column: Expression<V>, value: V) -> Setter where V.Datatype == Int64 {\n    column <- column ^ value\n}\npublic func ^=<V: Value>(column: Expression<V?>, value: Expression<V>) -> Setter where V.Datatype == Int64 {\n    column <- column ^ value\n}\npublic func ^=<V: Value>(column: Expression<V?>, value: Expression<V?>) -> Setter where V.Datatype == Int64 {\n    column <- column ^ value\n}\npublic func ^=<V: Value>(column: Expression<V?>, value: V) -> Setter where V.Datatype == Int64 {\n    column <- column ^ value\n}\n\npublic postfix func ++<V: Value>(column: Expression<V>) -> Setter where V.Datatype == Int64 {\n    Expression<Int>(column) += 1\n}\npublic postfix func ++<V: Value>(column: Expression<V?>) -> Setter where V.Datatype == Int64 {\n    Expression<Int>(column) += 1\n}\n\npublic postfix func --<V: Value>(column: Expression<V>) -> Setter where V.Datatype == Int64 {\n    Expression<Int>(column) -= 1\n}\npublic postfix func --<V: Value>(column: Expression<V?>) -> Setter where V.Datatype == Int64 {\n    Expression<Int>(column) -= 1\n}\n"
  },
  {
    "path": "Sources/SQLite/Typed/WindowFunctions.swift",
    "content": "import Foundation\n\n// see https://www.sqlite.org/windowfunctions.html#builtins\nprivate enum WindowFunction: String, Sendable {\n    // swiftlint:disable identifier_name\n    case ntile\n    case row_number\n    case rank\n    case dense_rank\n    case percent_rank\n    case cume_dist\n    case lag\n    case lead\n    case first_value\n    case last_value\n    case nth_value\n    // swiftlint:enable identifier_name\n\n    func wrap<T>(_ value: Int? = nil) -> Expression<T> {\n        if let value {\n            return self.rawValue.wrap(Expression(value: value))\n        }\n        return Expression(literal: \"\\(rawValue)()\")\n    }\n\n    func over<T>(value: Int? = nil, _ orderBy: Expressible) -> Expression<T> {\n        return Expression<T>(\" \".join([\n            self.wrap(value),\n            Expression<T>(\"OVER (ORDER BY \\(orderBy.expression.template))\", orderBy.expression.bindings)\n        ]).expression)\n    }\n\n    func over<T>(valueExpr: Expressible, _ orderBy: Expressible) -> Expression<T> {\n        return Expression<T>(\" \".join([\n            self.rawValue.wrap(valueExpr),\n            Expression<T>(\"OVER (ORDER BY \\(orderBy.expression.template))\", orderBy.expression.bindings)\n        ]).expression)\n    }\n}\n\nextension ExpressionType where UnderlyingType: Value {\n    /// Builds a copy of the expression with `lag(self, offset, default) OVER (ORDER BY {orderBy})` window function\n    ///\n    /// - Parameter orderBy: Expression to evaluate window order\n    /// - Returns: An expression returning `lag(self, offset, default) OVER (ORDER BY {orderBy})` window function\n    public func lag(offset: Int = 0, default: Expressible? = nil, _ orderBy: Expressible) -> Expression<UnderlyingType> {\n        if let defaultExpression = `default` {\n            return Expression(\n                \"lag(\\(template), \\(offset), \\(defaultExpression.asSQL())) OVER (ORDER BY \\(orderBy.expression.template))\",\n                bindings + orderBy.expression.bindings\n            )\n\n        }\n        return Expression(\"lag(\\(template), \\(offset)) OVER (ORDER BY \\(orderBy.expression.template))\", bindings + orderBy.expression.bindings)\n    }\n\n    /// Builds a copy of the expression with `lead(self, offset, default) OVER (ORDER BY {orderBy})` window function\n    ///\n    /// - Parameter orderBy: Expression to evaluate window order\n    /// - Returns: An expression returning `lead(self, offset, default) OVER (ORDER BY {orderBy})` window function\n    public func lead(offset: Int = 0, default: Expressible? = nil, _ orderBy: Expressible) -> Expression<UnderlyingType> {\n        if let defaultExpression = `default` {\n            return Expression(\n                \"lead(\\(template), \\(offset), \\(defaultExpression.asSQL())) OVER (ORDER BY \\(orderBy.expression.template))\",\n                bindings + orderBy.expression.bindings)\n\n        }\n        return Expression(\"lead(\\(template), \\(offset)) OVER (ORDER BY \\(orderBy.expression.template))\", bindings + orderBy.expression.bindings)\n    }\n\n    /// Builds a copy of the expression with `first_value(self) OVER (ORDER BY {orderBy})` window function\n    ///\n    /// - Parameter orderBy: Expression to evaluate window order\n    /// - Returns: An expression returning `first_value(self) OVER (ORDER BY {orderBy})` window function\n    public func firstValue(_ orderBy: Expressible) -> Expression<UnderlyingType> {\n        WindowFunction.first_value.over(valueExpr: self, orderBy)\n    }\n\n    /// Builds a copy of the expression with `last_value(self) OVER (ORDER BY {orderBy})` window function\n    ///\n    /// - Parameter orderBy: Expression to evaluate window order\n    /// - Returns: An expression returning `last_value(self) OVER (ORDER BY {orderBy})` window function\n    public func lastValue(_ orderBy: Expressible) -> Expression<UnderlyingType> {\n        WindowFunction.last_value.over(valueExpr: self, orderBy)\n    }\n\n    /// Builds a copy of the expression with `nth_value(self) OVER (ORDER BY {orderBy})` window function\n    ///\n    /// - Parameter index: Row N of the window frame to return\n    /// - Parameter orderBy: Expression to evaluate window order\n    /// - Returns: An expression returning `nth_value(self) OVER (ORDER BY {orderBy})` window function\n    public func value(_ index: Int, _ orderBy: Expressible) -> Expression<UnderlyingType> {\n        Expression(\"nth_value(\\(template), \\(index)) OVER (ORDER BY \\(orderBy.expression.template))\", bindings + orderBy.expression.bindings)\n    }\n}\n\n/// Builds an expression representing `ntile(size) OVER (ORDER BY {orderBy})`\n///\n/// - Parameter orderBy: Expression to evaluate window order\n/// - Returns: An expression returning  `ntile(size) OVER (ORDER BY {orderBy})`\npublic func ntile(_ size: Int, _ orderBy: Expressible) -> Expression<Int> {\n//    Expression.ntile(size, orderBy)\n\n        WindowFunction.ntile.over(value: size, orderBy)\n}\n\n/// Builds an expression representing `row_count() OVER (ORDER BY {orderBy})`\n///\n/// - Parameter orderBy: Expression to evaluate window order\n/// - Returns: An expression returning `row_count() OVER (ORDER BY {orderBy})`\npublic func rowNumber(_ orderBy: Expressible) -> Expression<Int> {\n    WindowFunction.row_number.over(orderBy)\n}\n\n/// Builds an expression representing `rank() OVER (ORDER BY {orderBy})`\n///\n/// - Parameter orderBy: Expression to evaluate window order\n/// - Returns: An expression returning `rank() OVER (ORDER BY {orderBy})`\npublic func rank(_ orderBy: Expressible) -> Expression<Int> {\n    WindowFunction.rank.over(orderBy)\n}\n\n/// Builds an expression representing `dense_rank() OVER (ORDER BY {orderBy})`\n///\n/// - Parameter orderBy: Expression to evaluate window order\n/// - Returns: An expression returning `dense_rank() OVER ('over')`\npublic func denseRank(_ orderBy: Expressible) -> Expression<Int> {\n    WindowFunction.dense_rank.over(orderBy)\n}\n\n/// Builds an expression representing `percent_rank() OVER (ORDER BY {orderBy})`\n///\n/// - Parameter orderBy: Expression to evaluate window order\n/// - Returns: An expression returning `percent_rank() OVER (ORDER BY {orderBy})`\npublic func percentRank(_ orderBy: Expressible) -> Expression<Double> {\n    WindowFunction.percent_rank.over(orderBy)\n}\n\n/// Builds an expression representing `cume_dist() OVER (ORDER BY {orderBy})`\n///\n/// - Parameter orderBy: Expression to evaluate window order\n/// - Returns: An expression returning `cume_dist() OVER (ORDER BY {orderBy})`\npublic func cumeDist(_ orderBy: Expressible) -> Expression<Double> {\n    WindowFunction.cume_dist.over(orderBy)\n}\n"
  },
  {
    "path": "Tests/.swiftlint.yml",
    "content": "disabled_rules:\n  - force_cast\n  - force_try\n  - identifier_name\n\ntype_body_length:\n  warning: 1000\n  error: 1000\n\nfunction_body_length:\n  warning: 200\n  error: 200\n\nfile_length:\n  warning: 1000\n  error: 1000\n\n\n"
  },
  {
    "path": "Tests/SPM/.gitignore",
    "content": ".DS_Store\n/.build\n/Packages\n/*.xcodeproj\nxcuserdata/\nDerivedData/\n.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata\n"
  },
  {
    "path": "Tests/SPM/Package.swift",
    "content": "// swift-tools-version:6.1\n// The swift-tools-version declares the minimum version of Swift required to build this package.\n\nimport PackageDescription\n\nlet package = Package(\n    name: \"test\",\n    platforms: [\n        .iOS(.v12),\n        .macOS(.v10_13),\n        .watchOS(.v4),\n        .tvOS(.v12)\n    ],\n    dependencies: [\n        // for testing from same repository\n        .package(path: \"../..\")\n        // normally this would be:\n        // .package(url: \"https://github.com/stephencelis/SQLite.swift.git\", from: \"0.16.0\")\n    ],\n    targets: [\n        .executableTarget(name: \"test\", dependencies: [.product(name: \"SQLite\", package: \"SQLite.swift\")])\n    ]\n)\n"
  },
  {
    "path": "Tests/SPM/Sources/test/main.swift",
    "content": "import SQLite\n\nlet table = Table(\"test\")\nlet name = Expression<String>(\"name\")\n\nlet db = try Connection(\"db.sqlite\", readonly: true)\n\nfor row in try db.prepare(table) {\n    print(row[name])\n}\n"
  },
  {
    "path": "Tests/SQLite visionOS.xctestplan",
    "content": "{\n  \"configurations\" : [\n    {\n      \"id\" : \"72B91FD4-441C-4C06-9E92-CAEDCB7325AB\",\n      \"name\" : \"Configuration 1\",\n      \"options\" : {\n\n      }\n    }\n  ],\n  \"defaultOptions\" : {\n\n  },\n  \"testTargets\" : [\n    {\n      \"target\" : {\n        \"containerPath\" : \"container:SQLite.xcodeproj\",\n        \"identifier\" : \"DEB306E72B61CF9500F9D46B\",\n        \"name\" : \"SQLiteTests visionOS\"\n      }\n    }\n  ],\n  \"version\" : 1\n}\n"
  },
  {
    "path": "Tests/SQLiteTests/Core/BlobTests.swift",
    "content": "import XCTest\nimport SQLite\n\nclass BlobTests: XCTestCase {\n\n    func test_toHex() {\n        let blob = Blob(bytes: [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 150, 250, 255])\n        XCTAssertEqual(blob.toHex(), \"000a141e28323c46505a6496faff\")\n    }\n\n    func test_toHex_empty() {\n        let blob = Blob(bytes: [])\n        XCTAssertEqual(blob.toHex(), \"\")\n    }\n\n    func test_description() {\n        let blob = Blob(bytes: [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 150, 250, 255])\n        XCTAssertEqual(blob.description, \"x'000a141e28323c46505a6496faff'\")\n    }\n\n    func test_description_empty() {\n        let blob = Blob(bytes: [])\n        XCTAssertEqual(blob.description, \"x''\")\n    }\n\n    func test_init_array() {\n        let blob = Blob(bytes: [42, 43, 44])\n        XCTAssertEqual(blob.bytes, [42, 43, 44])\n    }\n\n    func test_init_unsafeRawPointer() {\n        let pointer = UnsafeMutablePointer<UInt8>.allocate(capacity: 3)\n        pointer.initialize(repeating: 42, count: 3)\n        let blob = Blob(bytes: pointer, length: 3)\n        XCTAssertEqual(blob.bytes, [42, 42, 42])\n    }\n\n    func test_equality() {\n        let blob1 = Blob(bytes: [42, 42, 42])\n        let blob2 = Blob(bytes: [42, 42, 42])\n        let blob3 = Blob(bytes: [42, 42, 43])\n\n        XCTAssertEqual(Blob(bytes: []), Blob(bytes: []))\n        XCTAssertEqual(blob1, blob2)\n        XCTAssertNotEqual(blob1, blob3)\n    }\n}\n"
  },
  {
    "path": "Tests/SQLiteTests/Core/Connection+AttachTests.swift",
    "content": "import XCTest\nimport Foundation\n@testable import SQLite\n\n#if StandaloneSQLite\nimport sqlite3\n#elseif SQLCipher\nimport SQLCipher\n#elseif SQLiteSwiftCSQLite\nimport SQLiteSwiftCSQLite\n#else\nimport SQLite3 // SystemSQLite\n#endif\n\nclass ConnectionAttachTests: SQLiteTestCase {\n    func test_attach_detach_memory_database() throws {\n        let schemaName = \"test\"\n\n        try db.attach(.inMemory, as: schemaName)\n\n        let table = Table(\"attached_users\", database: schemaName)\n        let name = SQLite.Expression<String>(\"string\")\n\n        // create a table, insert some data\n        try db.run(table.create { builder in\n            builder.column(name)\n        })\n        _ = try db.run(table.insert(name <- \"test\"))\n\n        // query data\n        let rows = try db.prepare(table.select(name)).map { $0[name] }\n        XCTAssertEqual([\"test\"], rows)\n\n        try db.detach(schemaName)\n    }\n\n    func test_attach_detach_file_database() throws {\n        let schemaName = \"test\"\n        let testDb = fixture(\"test\", withExtension: \"sqlite\")\n\n        try db.attach(.uri(testDb, parameters: [.mode(.readOnly)]), as: schemaName)\n\n        let table = Table(\"tests\", database: schemaName)\n        let email = SQLite.Expression<String>(\"email\")\n\n        let rows = try db.prepare(table.select(email)).map { $0[email] }\n        XCTAssertEqual([\"foo@bar.com\"], rows)\n\n        try db.detach(schemaName)\n    }\n\n    func test_detach_invalid_schema_name_errors_with_no_such_database() throws {\n        XCTAssertThrowsError(try db.detach(\"no-exist\")) { error in\n            if case let Result.error(message, code, _) = error {\n                XCTAssertEqual(code, SQLITE_ERROR)\n                XCTAssertEqual(\"no such database: no-exist\", message)\n            } else {\n                XCTFail(\"unexpected error: \\(error)\")\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "Tests/SQLiteTests/Core/Connection+PragmaTests.swift",
    "content": "import XCTest\nimport Foundation\n@testable import SQLite\n\nclass ConnectionPragmaTests: SQLiteTestCase {\n    func test_userVersion() {\n        db.userVersion = 2\n        XCTAssertEqual(2, db.userVersion!)\n    }\n\n    func test_sqlite_version() {\n        XCTAssertTrue(db.sqliteVersion >= .init(major: 3, minor: 0))\n    }\n\n    func test_foreignKeys_defaults_to_false() {\n        XCTAssertFalse(db.foreignKeys)\n    }\n\n    func test_foreignKeys_sets_value() {\n        db.foreignKeys = true\n        XCTAssertTrue(db.foreignKeys)\n    }\n\n    func test_defer_foreignKeys_defaults_to_false() {\n        XCTAssertFalse(db.deferForeignKeys)\n    }\n\n    func test_defer_foreignKeys_sets_value() {\n        db.deferForeignKeys = true\n        XCTAssertTrue(db.deferForeignKeys)\n    }\n}\n"
  },
  {
    "path": "Tests/SQLiteTests/Core/ConnectionTests.swift",
    "content": "import XCTest\nimport Foundation\nimport Dispatch\n@testable import SQLite\n\n#if StandaloneSQLite\nimport sqlite3\n#elseif SQLCipher\nimport SQLCipher\n#elseif SQLiteSwiftCSQLite\nimport SQLiteSwiftCSQLite\n#else\nimport SQLite3 // SystemSQLite\n#endif\n\nclass ConnectionTests: SQLiteTestCase {\n\n    override func setUpWithError() throws {\n        try super.setUpWithError()\n        try createUsersTable()\n    }\n\n    func test_init_withInMemory_returnsInMemoryConnection() throws {\n        let db = try Connection(.inMemory)\n        XCTAssertEqual(\"\", db.description)\n    }\n\n    func test_init_returnsInMemoryByDefault() throws {\n        let db = try Connection()\n        XCTAssertEqual(\"\", db.description)\n    }\n\n    func test_init_withTemporary_returnsTemporaryConnection() throws {\n        let db = try Connection(.temporary)\n        XCTAssertEqual(\"\", db.description)\n    }\n\n    func test_init_withURI_returnsURIConnection() throws {\n        let db = try Connection(.uri(\"\\(NSTemporaryDirectory())/SQLite.swift Tests.sqlite3\"))\n        let url = URL(fileURLWithPath: db.description)\n        XCTAssertEqual(url.lastPathComponent, \"SQLite.swift Tests.sqlite3\")\n    }\n\n    func test_init_withString_returnsURIConnection() throws {\n        let db = try Connection(\"\\(NSTemporaryDirectory())/SQLite.swift Tests.sqlite3\")\n        let url = URL(fileURLWithPath: db.description)\n        XCTAssertEqual(url.lastPathComponent, \"SQLite.swift Tests.sqlite3\")\n    }\n\n    func test_init_with_Uri_and_Parameters() throws {\n        let testDb = fixture(\"test\", withExtension: \"sqlite\")\n        _ = try Connection(.uri(testDb, parameters: [.cache(.shared)]))\n    }\n\n    func test_location_without_Uri_parameters() {\n        let location: Connection.Location = .uri(\"foo\")\n        XCTAssertEqual(location.description, \"foo\")\n    }\n\n    func test_location_with_Uri_parameters() {\n        let location: Connection.Location = .uri(\"foo\", parameters: [.mode(.readOnly), .cache(.private)])\n        XCTAssertEqual(location.description, \"file:foo?mode=ro&cache=private\")\n    }\n\n    func test_readonly_returnsFalseOnReadWriteConnections() {\n        XCTAssertFalse(db.readonly)\n    }\n\n    func test_readonly_returnsTrueOnReadOnlyConnections() throws {\n        let db = try Connection(readonly: true)\n        XCTAssertTrue(db.readonly)\n    }\n\n    func test_changes_returnsZeroOnNewConnections() {\n        XCTAssertEqual(0, db.changes)\n    }\n\n    func test_lastInsertRowid_returnsLastIdAfterInserts() throws {\n        try insertUser(\"alice\")\n        XCTAssertEqual(1, db.lastInsertRowid)\n    }\n\n    func test_lastInsertRowid_doesNotResetAfterError() throws {\n        XCTAssert(db.lastInsertRowid == 0)\n        try insertUser(\"alice\")\n        XCTAssertEqual(1, db.lastInsertRowid)\n        XCTAssertThrowsError(\n            try db.run(\"INSERT INTO \\\"users\\\" (email, age, admin) values ('invalid@example.com', 12, 'invalid')\")\n        ) { error in\n            if case SQLite.Result.error(_, let code, _) = error {\n                XCTAssertEqual(SQLITE_CONSTRAINT, code)\n            } else {\n                XCTFail(\"expected error\")\n            }\n        }\n        XCTAssertEqual(1, db.lastInsertRowid)\n    }\n\n    func test_changes_returnsNumberOfChanges() throws {\n        try insertUser(\"alice\")\n        XCTAssertEqual(1, db.changes)\n        try insertUser(\"betsy\")\n        XCTAssertEqual(1, db.changes)\n    }\n\n    func test_totalChanges_returnsTotalNumberOfChanges() throws {\n        XCTAssertEqual(0, db.totalChanges)\n        try insertUser(\"alice\")\n        XCTAssertEqual(1, db.totalChanges)\n        try insertUser(\"betsy\")\n        XCTAssertEqual(2, db.totalChanges)\n    }\n\n    func test_useExtendedErrorCodes_returnsFalseDefault() throws {\n        XCTAssertFalse(db.usesExtendedErrorCodes)\n    }\n\n    func test_prepare_preparesAndReturnsStatements() throws {\n        _ = try db.prepare(\"SELECT * FROM users WHERE admin = 0\")\n        _ = try db.prepare(\"SELECT * FROM users WHERE admin = ?\", 0)\n        _ = try db.prepare(\"SELECT * FROM users WHERE admin = ?\", [0])\n        _ = try db.prepare(\"SELECT * FROM users WHERE admin = $admin\", [\"$admin\": 0])\n    }\n\n    func test_run_preparesRunsAndReturnsStatements() throws {\n        try db.run(\"SELECT * FROM users WHERE admin = 0\")\n        try db.run(\"SELECT * FROM users WHERE admin = ?\", 0)\n        try db.run(\"SELECT * FROM users WHERE admin = ?\", [0])\n        try db.run(\"SELECT * FROM users WHERE admin = $admin\", [\"$admin\": 0])\n        assertSQL(\"SELECT * FROM users WHERE admin = 0\", 4)\n    }\n\n    func test_vacuum() throws {\n        try db.vacuum()\n    }\n\n    func test_scalar_preparesRunsAndReturnsScalarValues() throws {\n        XCTAssertEqual(0, try db.scalar(\"SELECT count(*) FROM users WHERE admin = 0\") as? Int64)\n        XCTAssertEqual(0, try db.scalar(\"SELECT count(*) FROM users WHERE admin = ?\", 0) as? Int64)\n        XCTAssertEqual(0, try db.scalar(\"SELECT count(*) FROM users WHERE admin = ?\", [0]) as? Int64)\n        XCTAssertEqual(0, try db.scalar(\"SELECT count(*) FROM users WHERE admin = $admin\", [\"$admin\": 0]) as? Int64)\n        assertSQL(\"SELECT count(*) FROM users WHERE admin = 0\", 4)\n    }\n\n    func test_execute_comment() throws {\n        try db.run(\"-- this is a comment\\nSELECT 1\")\n        assertSQL(\"-- this is a comment\", 0)\n        assertSQL(\"SELECT 1\", 0)\n    }\n\n    func test_transaction_executesBeginDeferred() throws {\n        try db.transaction(.deferred) {}\n\n        assertSQL(\"BEGIN DEFERRED TRANSACTION\")\n    }\n\n    func test_transaction_executesBeginImmediate() throws {\n        try db.transaction(.immediate) {}\n\n        assertSQL(\"BEGIN IMMEDIATE TRANSACTION\")\n    }\n\n    func test_transaction_executesBeginExclusive() throws {\n        try db.transaction(.exclusive) {}\n\n        assertSQL(\"BEGIN EXCLUSIVE TRANSACTION\")\n    }\n\n    func test_backup_copiesDatabase() throws {\n        let target = try Connection()\n\n        try insertUsers(\"alice\", \"betsy\")\n\n        let backup = try db.backup(usingConnection: target)\n        try backup.step()\n\n        let users = try target.prepare(\"SELECT email FROM users ORDER BY email\")\n        XCTAssertEqual(users.map { $0[0] as? String }, [\"alice@example.com\", \"betsy@example.com\"])\n    }\n\n    func test_transaction_beginsAndCommitsTransactions() throws {\n        let stmt = try db.prepare(\"INSERT INTO users (email) VALUES (?)\", \"alice@example.com\")\n\n        try db.transaction {\n            try stmt.run()\n        }\n\n        assertSQL(\"BEGIN DEFERRED TRANSACTION\")\n        assertSQL(\"INSERT INTO users (email) VALUES ('alice@example.com')\")\n        assertSQL(\"COMMIT TRANSACTION\")\n        assertSQL(\"ROLLBACK TRANSACTION\", 0)\n    }\n\n    func test_transaction_rollsBackTransactionsIfCommitsFail() throws {\n        let sqliteVersion = String(describing: try db.scalar(\"SELECT sqlite_version()\")!)\n            .split(separator: \".\").compactMap { Int($0) }\n        // PRAGMA defer_foreign_keys only supported in SQLite >= 3.8.0\n        guard sqliteVersion[0] == 3 && sqliteVersion[1] >= 8 else {\n            NSLog(\"skipping test for SQLite version \\(sqliteVersion)\")\n            return\n        }\n        // This test case needs to emulate an environment where the individual statements succeed, but committing the\n        // transaction fails. Using deferred foreign keys is one option to achieve this.\n        try db.execute(\"PRAGMA foreign_keys = ON;\")\n        try db.execute(\"PRAGMA defer_foreign_keys = ON;\")\n        let stmt = try db.prepare(\"INSERT INTO users (email, manager_id) VALUES (?, ?)\", \"alice@example.com\", 100)\n\n        do {\n            try db.transaction {\n                try stmt.run()\n            }\n            XCTFail(\"expected error\")\n        } catch let Result.error(_, code, _) {\n            XCTAssertEqual(SQLITE_CONSTRAINT, code)\n        } catch let error {\n            XCTFail(\"unexpected error: \\(error)\")\n        }\n\n        assertSQL(\"BEGIN DEFERRED TRANSACTION\")\n        assertSQL(\"INSERT INTO users (email, manager_id) VALUES ('alice@example.com', 100)\")\n        assertSQL(\"COMMIT TRANSACTION\")\n        assertSQL(\"ROLLBACK TRANSACTION\")\n\n        // Run another transaction to ensure that a subsequent transaction does not fail with an \"cannot start a\n        // transaction within a transaction\" error.\n        let stmt2 = try db.prepare(\"INSERT INTO users (email) VALUES (?)\", \"alice@example.com\")\n        try db.transaction {\n            try stmt2.run()\n        }\n    }\n\n    func test_transaction_beginsAndRollsTransactionsBack() throws {\n        let stmt = try db.prepare(\"INSERT INTO users (email) VALUES (?)\", \"alice@example.com\")\n\n        do {\n            try db.transaction {\n                try stmt.run()\n                try stmt.run()\n            }\n        } catch {\n        }\n\n        assertSQL(\"BEGIN DEFERRED TRANSACTION\")\n        assertSQL(\"INSERT INTO users (email) VALUES ('alice@example.com')\", 2)\n        assertSQL(\"ROLLBACK TRANSACTION\")\n        assertSQL(\"COMMIT TRANSACTION\", 0)\n    }\n\n    func test_savepoint_beginsAndCommitsSavepoints() throws {\n        try db.savepoint(\"1\") {\n            try db.savepoint(\"2\") {\n                try db.run(\"INSERT INTO users (email) VALUES (?)\", \"alice@example.com\")\n            }\n        }\n\n        assertSQL(\"SAVEPOINT '1'\")\n        assertSQL(\"SAVEPOINT '2'\")\n        assertSQL(\"INSERT INTO users (email) VALUES ('alice@example.com')\")\n        assertSQL(\"RELEASE SAVEPOINT '2'\")\n        assertSQL(\"RELEASE SAVEPOINT '1'\")\n        assertSQL(\"ROLLBACK TO SAVEPOINT '2'\", 0)\n        assertSQL(\"ROLLBACK TO SAVEPOINT '1'\", 0)\n    }\n\n    func test_savepoint_beginsAndRollsSavepointsBack() throws {\n        let stmt = try db.prepare(\"INSERT INTO users (email) VALUES (?)\", \"alice@example.com\")\n\n        do {\n            try db.savepoint(\"1\") {\n                try db.savepoint(\"2\") {\n                    try stmt.run()\n                    try stmt.run()\n                    try stmt.run()\n                }\n                try db.savepoint(\"2\") {\n                    try stmt.run()\n                    try stmt.run()\n                    try stmt.run()\n                }\n            }\n        } catch {\n        }\n\n        assertSQL(\"SAVEPOINT '1'\")\n        assertSQL(\"SAVEPOINT '2'\")\n        assertSQL(\"INSERT INTO users (email) VALUES ('alice@example.com')\", 2)\n        assertSQL(\"ROLLBACK TO SAVEPOINT '2'\")\n        assertSQL(\"ROLLBACK TO SAVEPOINT '1'\")\n        assertSQL(\"RELEASE SAVEPOINT '2'\", 0)\n        assertSQL(\"RELEASE SAVEPOINT '1'\", 0)\n    }\n\n    func test_updateHook_setsUpdateHook_withInsert() throws {\n        try async { done in\n            db.updateHook { operation, db, table, rowid in\n                XCTAssertEqual(Connection.Operation.insert, operation)\n                XCTAssertEqual(\"main\", db)\n                XCTAssertEqual(\"users\", table)\n                XCTAssertEqual(1, rowid)\n                done()\n            }\n            try insertUser(\"alice\")\n        }\n    }\n\n    func test_updateHook_setsUpdateHook_withUpdate() throws {\n        try insertUser(\"alice\")\n        try async { done in\n            db.updateHook { operation, db, table, rowid in\n                XCTAssertEqual(Connection.Operation.update, operation)\n                XCTAssertEqual(\"main\", db)\n                XCTAssertEqual(\"users\", table)\n                XCTAssertEqual(1, rowid)\n                done()\n            }\n            try db.run(\"UPDATE users SET email = 'alice@example.com'\")\n        }\n    }\n\n    func test_updateHook_setsUpdateHook_withDelete() throws {\n        try insertUser(\"alice\")\n        try async { done in\n            db.updateHook { operation, db, table, rowid in\n                XCTAssertEqual(Connection.Operation.delete, operation)\n                XCTAssertEqual(\"main\", db)\n                XCTAssertEqual(\"users\", table)\n                XCTAssertEqual(1, rowid)\n                done()\n            }\n            try db.run(\"DELETE FROM users WHERE id = 1\")\n        }\n    }\n\n    func test_commitHook_setsCommitHook() throws {\n        try async { done in\n            db.commitHook {\n                done()\n            }\n            try db.transaction {\n                try insertUser(\"alice\")\n            }\n            XCTAssertEqual(1, try db.scalar(\"SELECT count(*) FROM users\") as? Int64)\n        }\n    }\n\n    func test_rollbackHook_setsRollbackHook() throws {\n        try async { done in\n            db.rollbackHook(done)\n            do {\n                try db.transaction {\n                    try insertUser(\"alice\")\n                    try insertUser(\"alice\") // throw\n                }\n            } catch {\n            }\n            XCTAssertEqual(0, try db.scalar(\"SELECT count(*) FROM users\") as? Int64)\n        }\n    }\n\n    func test_commitHook_withRollback_rollsBack() throws {\n        try async { done in\n            db.commitHook {\n                throw NSError(domain: \"com.stephencelis.SQLiteTests\", code: 1, userInfo: nil)\n            }\n            db.rollbackHook(done)\n            do {\n                try db.transaction {\n                    try insertUser(\"alice\")\n                }\n            } catch {\n            }\n            XCTAssertEqual(0, try db.scalar(\"SELECT count(*) FROM users\") as? Int64)\n        }\n    }\n\n    // https://github.com/stephencelis/SQLite.swift/issues/1071\n    #if !(os(Linux) || os(Android))\n    func test_createFunction_withArrayArguments() throws {\n        db.createFunction(\"hello\") { $0[0].map { \"Hello, \\($0)!\" } }\n\n        XCTAssertEqual(\"Hello, world!\", try db.scalar(\"SELECT hello('world')\") as? String)\n        XCTAssert(try db.scalar(\"SELECT hello(NULL)\") == nil)\n    }\n\n    func test_createFunction_createsQuotableFunction() throws {\n        db.createFunction(\"hello world\") { $0[0].map { \"Hello, \\($0)!\" } }\n\n        XCTAssertEqual(\"Hello, world!\", try db.scalar(\"SELECT \\\"hello world\\\"('world')\") as? String)\n        XCTAssert(try db.scalar(\"SELECT \\\"hello world\\\"(NULL)\") == nil)\n    }\n\n    func test_createCollation_createsCollation() throws {\n        try db.createCollation(\"NODIACRITIC\") { lhs, rhs in\n            lhs.compare(rhs, options: .diacriticInsensitive)\n        }\n        XCTAssertEqual(1, try db.scalar(\"SELECT ? = ? COLLATE NODIACRITIC\", \"cafe\", \"café\") as? Int64)\n    }\n\n    func test_createCollation_createsQuotableCollation() throws {\n        try db.createCollation(\"NO DIACRITIC\") { lhs, rhs in\n            lhs.compare(rhs, options: .diacriticInsensitive)\n        }\n        XCTAssertEqual(1, try db.scalar(\"SELECT ? = ? COLLATE \\\"NO DIACRITIC\\\"\", \"cafe\", \"café\") as? Int64)\n    }\n\n    func XXX_test_interrupt_interruptsLongRunningQuery() throws {\n        let semaphore = DispatchSemaphore(value: 0)\n        db.createFunction(\"sleep\") { _ in\n            DispatchQueue.global(qos: .background).async {\n                self.db.interrupt()\n                semaphore.signal()\n            }\n            semaphore.wait()\n            return nil\n        }\n        let stmt = try db.prepare(\"SELECT sleep()\")\n        XCTAssertThrowsError(try stmt.run()) { error in\n            if case Result.error(_, let code, _) = error {\n                XCTAssertEqual(code, SQLITE_INTERRUPT)\n            } else {\n                XCTFail(\"unexpected error: \\(error)\")\n            }\n        }\n    }\n    #endif\n\n    func test_concurrent_access_single_connection() throws {\n        // test can fail on iOS/tvOS 9.x: SQLite compile-time differences?\n        guard #available(iOS 10.0, OSX 10.10, tvOS 10.0, watchOS 2.2, *) else { return }\n\n        let conn = try Connection(\"\\(NSTemporaryDirectory())/\\(UUID().uuidString)\")\n        try conn.execute(\"DROP TABLE IF EXISTS test; CREATE TABLE test(value);\")\n        try conn.run(\"INSERT INTO test(value) VALUES(?)\", 0)\n        let queue = DispatchQueue(label: \"Readers\", attributes: [.concurrent])\n\n        let nReaders = 5\n        let semaphores =  Array(repeating: DispatchSemaphore(value: 100), count: nReaders)\n        for index in 0..<nReaders {\n            queue.async {\n                while semaphores[index].signal() == 0 {\n                    _ = try! conn.scalar(\"SELECT value FROM test\")\n                }\n            }\n        }\n        semaphores.forEach { $0.wait() }\n    }\n\n    func test_compiled_sqlite_version() throws {\n        let conn = try Connection(.inMemory)\n        let version = conn.sqliteVersion\n\n        #if SystemSQLite\n        XCTAssertGreaterThanOrEqual(version, .init(major: 3, minor: 43, point: 2))\n        #elseif SQLiteSwiftCSQLite\n        XCTAssertGreaterThanOrEqual(version, .init(major: 3, minor: 50, point: 4))\n        #elseif SQLCipher\n        // 4.12.0 uses SQLite 3.51.1\n        // 4.10.0 uses SQLite 3.50.4 (last available pod)\n        // ???    uses SQLite 3.39.4\n        XCTAssertGreaterThanOrEqual(version, .init(major: 3, minor: 39, point: 4))\n        #elseif StandaloneSQLite\n        // when building standalone (= pod), we should have a more recent version\n        // https://github.com/clemensg/sqlite3pod\n        XCTAssertGreaterThanOrEqual(version, .init(major: 3, minor: 51, point: 1))\n        #endif\n    }\n}\n"
  },
  {
    "path": "Tests/SQLiteTests/Core/CoreFunctionsTests.swift",
    "content": "import XCTest\n@testable import SQLite\n\nclass CoreFunctionsTests: XCTestCase {\n\n    func test_round_wrapsDoubleExpressionsWithRoundFunction() {\n        assertSQL(\"round(\\\"double\\\")\", double.round())\n        assertSQL(\"round(\\\"doubleOptional\\\")\", doubleOptional.round())\n\n        assertSQL(\"round(\\\"double\\\", 1)\", double.round(1))\n        assertSQL(\"round(\\\"doubleOptional\\\", 2)\", doubleOptional.round(2))\n    }\n\n    func test_random_generatesExpressionWithRandomFunction() {\n        assertSQL(\"random()\", SQLite.Expression<Int64>.random())\n        assertSQL(\"random()\", SQLite.Expression<Int>.random())\n    }\n\n    func test_length_wrapsStringExpressionWithLengthFunction() {\n        assertSQL(\"length(\\\"string\\\")\", string.length)\n        assertSQL(\"length(\\\"stringOptional\\\")\", stringOptional.length)\n    }\n\n    func test_lowercaseString_wrapsStringExpressionWithLowerFunction() {\n        assertSQL(\"lower(\\\"string\\\")\", string.lowercaseString)\n        assertSQL(\"lower(\\\"stringOptional\\\")\", stringOptional.lowercaseString)\n    }\n\n    func test_uppercaseString_wrapsStringExpressionWithUpperFunction() {\n        assertSQL(\"upper(\\\"string\\\")\", string.uppercaseString)\n        assertSQL(\"upper(\\\"stringOptional\\\")\", stringOptional.uppercaseString)\n    }\n\n    func test_like_buildsExpressionWithLikeOperator() {\n        assertSQL(\"(\\\"string\\\" LIKE 'a%')\", string.like(\"a%\"))\n        assertSQL(\"(\\\"stringOptional\\\" LIKE 'b%')\", stringOptional.like(\"b%\"))\n\n        assertSQL(\"(\\\"string\\\" LIKE '%\\\\%' ESCAPE '\\\\')\", string.like(\"%\\\\%\", escape: \"\\\\\"))\n        assertSQL(\"(\\\"stringOptional\\\" LIKE '_\\\\_' ESCAPE '\\\\')\", stringOptional.like(\"_\\\\_\", escape: \"\\\\\"))\n\n        assertSQL(\"(\\\"string\\\" LIKE \\\"a\\\")\", string.like(SQLite.Expression<String>(\"a\")))\n        assertSQL(\"(\\\"stringOptional\\\" LIKE \\\"a\\\")\", stringOptional.like(SQLite.Expression<String>(\"a\")))\n\n        assertSQL(\"(\\\"string\\\" LIKE \\\"a\\\" ESCAPE '\\\\')\", string.like(SQLite.Expression<String>(\"a\"), escape: \"\\\\\"))\n        assertSQL(\"(\\\"stringOptional\\\" LIKE \\\"a\\\" ESCAPE '\\\\')\", stringOptional.like(SQLite.Expression<String>(\"a\"), escape: \"\\\\\"))\n\n        assertSQL(\"('string' LIKE \\\"a\\\")\", \"string\".like(SQLite.Expression<String>(\"a\")))\n        assertSQL(\"('string' LIKE \\\"a\\\" ESCAPE '\\\\')\", \"string\".like(SQLite.Expression<String>(\"a\"), escape: \"\\\\\"))\n    }\n\n    func test_glob_buildsExpressionWithGlobOperator() {\n        assertSQL(\"(\\\"string\\\" GLOB 'a*')\", string.glob(\"a*\"))\n        assertSQL(\"(\\\"stringOptional\\\" GLOB 'b*')\", stringOptional.glob(\"b*\"))\n    }\n\n    func test_match_buildsExpressionWithMatchOperator() {\n        assertSQL(\"(\\\"string\\\" MATCH 'a*')\", string.match(\"a*\"))\n        assertSQL(\"(\\\"stringOptional\\\" MATCH 'b*')\", stringOptional.match(\"b*\"))\n    }\n\n    func test_regexp_buildsExpressionWithRegexpOperator() {\n        assertSQL(\"(\\\"string\\\" REGEXP '^.+@.+\\\\.com$')\", string.regexp(\"^.+@.+\\\\.com$\"))\n        assertSQL(\"(\\\"stringOptional\\\" REGEXP '^.+@.+\\\\.net$')\", stringOptional.regexp(\"^.+@.+\\\\.net$\"))\n    }\n\n    func test_collate_buildsExpressionWithCollateOperator() {\n        assertSQL(\"(\\\"string\\\" COLLATE BINARY)\", string.collate(.binary))\n        assertSQL(\"(\\\"string\\\" COLLATE NOCASE)\", string.collate(.nocase))\n        assertSQL(\"(\\\"string\\\" COLLATE RTRIM)\", string.collate(.rtrim))\n        assertSQL(\"(\\\"string\\\" COLLATE \\\"CUSTOM\\\")\", string.collate(.custom(\"CUSTOM\")))\n\n        assertSQL(\"(\\\"stringOptional\\\" COLLATE BINARY)\", stringOptional.collate(.binary))\n        assertSQL(\"(\\\"stringOptional\\\" COLLATE NOCASE)\", stringOptional.collate(.nocase))\n        assertSQL(\"(\\\"stringOptional\\\" COLLATE RTRIM)\", stringOptional.collate(.rtrim))\n        assertSQL(\"(\\\"stringOptional\\\" COLLATE \\\"CUSTOM\\\")\", stringOptional.collate(.custom(\"CUSTOM\")))\n    }\n\n    func test_ltrim_wrapsStringWithLtrimFunction() {\n        assertSQL(\"ltrim(\\\"string\\\")\", string.ltrim())\n        assertSQL(\"ltrim(\\\"stringOptional\\\")\", stringOptional.ltrim())\n\n        assertSQL(\"ltrim(\\\"string\\\", ' ')\", string.ltrim([\" \"]))\n        assertSQL(\"ltrim(\\\"stringOptional\\\", ' ')\", stringOptional.ltrim([\" \"]))\n    }\n\n    func test_ltrim_wrapsStringWithRtrimFunction() {\n        assertSQL(\"rtrim(\\\"string\\\")\", string.rtrim())\n        assertSQL(\"rtrim(\\\"stringOptional\\\")\", stringOptional.rtrim())\n\n        assertSQL(\"rtrim(\\\"string\\\", ' ')\", string.rtrim([\" \"]))\n        assertSQL(\"rtrim(\\\"stringOptional\\\", ' ')\", stringOptional.rtrim([\" \"]))\n    }\n\n    func test_ltrim_wrapsStringWithTrimFunction() {\n        assertSQL(\"trim(\\\"string\\\")\", string.trim())\n        assertSQL(\"trim(\\\"stringOptional\\\")\", stringOptional.trim())\n\n        assertSQL(\"trim(\\\"string\\\", ' ')\", string.trim([\" \"]))\n        assertSQL(\"trim(\\\"stringOptional\\\", ' ')\", stringOptional.trim([\" \"]))\n    }\n\n    func test_replace_wrapsStringWithReplaceFunction() {\n        assertSQL(\"replace(\\\"string\\\", '@example.com', '@example.net')\", string.replace(\"@example.com\", with: \"@example.net\"))\n        assertSQL(\"replace(\\\"stringOptional\\\", '@example.net', '@example.com')\", stringOptional.replace(\"@example.net\", with: \"@example.com\"))\n    }\n\n    func test_substring_wrapsStringWithSubstrFunction() {\n        assertSQL(\"substr(\\\"string\\\", 1, 2)\", string.substring(1, length: 2))\n        assertSQL(\"substr(\\\"stringOptional\\\", 2, 1)\", stringOptional.substring(2, length: 1))\n    }\n\n    func test_subscriptWithRange_wrapsStringWithSubstrFunction() {\n        assertSQL(\"substr(\\\"string\\\", 1, 2)\", string[1..<3])\n        assertSQL(\"substr(\\\"stringOptional\\\", 2, 1)\", stringOptional[2..<3])\n    }\n\n    func test_nilCoalescingOperator_wrapsOptionalsWithIfnullFunction() {\n        assertSQL(\"ifnull(\\\"intOptional\\\", 1)\", intOptional ?? 1)\n        // AssertSQL(\"ifnull(\\\"doubleOptional\\\", 1.0)\", doubleOptional ?? 1) // rdar://problem/21677256\n        XCTAssertEqual(\"ifnull(\\\"doubleOptional\\\", 1.0)\", (doubleOptional ?? 1).asSQL())\n        assertSQL(\"ifnull(\\\"stringOptional\\\", 'literal')\", stringOptional ?? \"literal\")\n\n        assertSQL(\"ifnull(\\\"intOptional\\\", \\\"int\\\")\", intOptional ?? int)\n        assertSQL(\"ifnull(\\\"doubleOptional\\\", \\\"double\\\")\", doubleOptional ?? double)\n        assertSQL(\"ifnull(\\\"stringOptional\\\", \\\"string\\\")\", stringOptional ?? string)\n\n        assertSQL(\"ifnull(\\\"intOptional\\\", \\\"intOptional\\\")\", intOptional ?? intOptional)\n        assertSQL(\"ifnull(\\\"doubleOptional\\\", \\\"doubleOptional\\\")\", doubleOptional ?? doubleOptional)\n        assertSQL(\"ifnull(\\\"stringOptional\\\", \\\"stringOptional\\\")\", stringOptional ?? stringOptional)\n    }\n\n    func test_absoluteValue_wrapsNumberWithAbsFucntion() {\n        assertSQL(\"abs(\\\"int\\\")\", int.absoluteValue)\n        assertSQL(\"abs(\\\"intOptional\\\")\", intOptional.absoluteValue)\n\n        assertSQL(\"abs(\\\"double\\\")\", double.absoluteValue)\n        assertSQL(\"abs(\\\"doubleOptional\\\")\", doubleOptional.absoluteValue)\n    }\n\n    func test_contains_buildsExpressionWithInOperator() {\n        assertSQL(\"(\\\"string\\\" IN ('hello', 'world'))\", [\"hello\", \"world\"].contains(string))\n        assertSQL(\"(\\\"stringOptional\\\" IN ('hello', 'world'))\", [\"hello\", \"world\"].contains(stringOptional))\n    }\n\n}\n"
  },
  {
    "path": "Tests/SQLiteTests/Core/ResultTests.swift",
    "content": "import XCTest\nimport Foundation\n@testable import SQLite\n\n#if StandaloneSQLite\nimport sqlite3\n#elseif SQLCipher\nimport SQLCipher\n#elseif SQLiteSwiftCSQLite\nimport SQLiteSwiftCSQLite\n#else\nimport SQLite3 // SystemSQLite\n#endif\n\nclass ResultTests: XCTestCase {\n    var connection: Connection!\n\n    override func setUpWithError() throws {\n        connection = try Connection(.inMemory)\n    }\n\n    func test_init_with_ok_code_returns_nil() {\n        XCTAssertNil(Result(errorCode: SQLITE_OK, connection: connection, statement: nil) as Result?)\n    }\n\n    func test_init_with_row_code_returns_nil() {\n        XCTAssertNil(Result(errorCode: SQLITE_ROW, connection: connection, statement: nil) as Result?)\n    }\n\n    func test_init_with_done_code_returns_nil() {\n        XCTAssertNil(Result(errorCode: SQLITE_DONE, connection: connection, statement: nil) as Result?)\n    }\n\n    func test_init_with_other_code_returns_error() {\n        if case .some(.error(let message, let code, let statement)) =\n            Result(errorCode: SQLITE_MISUSE, connection: connection, statement: nil) {\n            XCTAssertEqual(\"not an error\", message)\n            XCTAssertEqual(SQLITE_MISUSE, code)\n            XCTAssertNil(statement)\n            XCTAssert(connection === connection)\n        } else {\n            XCTFail(\"no error\")\n        }\n    }\n\n    func test_description_contains_error_code() {\n        XCTAssertEqual(\"not an error (code: 21)\",\n            Result(errorCode: SQLITE_MISUSE, connection: connection, statement: nil)?.description)\n    }\n\n    func test_description_contains_statement_and_error_code() throws {\n        let statement = try Statement(connection, \"SELECT 1\")\n        XCTAssertEqual(\"not an error (SELECT 1) (code: 21)\",\n            Result(errorCode: SQLITE_MISUSE, connection: connection, statement: statement)?.description)\n    }\n\n    func test_init_extended_with_other_code_returns_error() {\n        connection.usesExtendedErrorCodes = true\n        if case .some(.extendedError(let message, let extendedCode, let statement)) =\n            Result(errorCode: SQLITE_MISUSE, connection: connection, statement: nil) {\n            XCTAssertEqual(\"not an error\", message)\n            XCTAssertEqual(extendedCode, 0)\n            XCTAssertNil(statement)\n            XCTAssert(connection === connection)\n        } else {\n            XCTFail(\"no error\")\n        }\n    }\n}\n"
  },
  {
    "path": "Tests/SQLiteTests/Core/StatementTests.swift",
    "content": "import XCTest\n@testable import SQLite\n\n#if StandaloneSQLite\nimport sqlite3\n#elseif SQLCipher\nimport SQLCipher\n#elseif SQLiteSwiftCSQLite\nimport SQLiteSwiftCSQLite\n#else\nimport SQLite3 // SystemSQLite\n#endif\n\nclass StatementTests: SQLiteTestCase {\n    override func setUpWithError() throws {\n        try super.setUpWithError()\n        try createUsersTable()\n    }\n\n    func test_cursor_to_blob() throws {\n        try insertUsers(\"alice\")\n        let statement = try db.prepare(\"SELECT email FROM users\")\n        XCTAssert(try statement.step())\n        let blob = statement.row[0] as Blob\n        XCTAssertEqual(\"alice@example.com\", String(bytes: blob.bytes, encoding: .utf8)!)\n    }\n\n    func test_zero_sized_blob_returns_null() throws {\n        let blobs = Table(\"blobs\")\n        let blobColumn = SQLite.Expression<Blob>(\"blob_column\")\n        try db.run(blobs.create { $0.column(blobColumn) })\n        try db.run(blobs.insert(blobColumn <- Blob(bytes: [])))\n        let blobValue = try db.scalar(blobs.select(blobColumn).limit(1, offset: 0))\n        XCTAssertEqual([], blobValue.bytes)\n    }\n\n    func test_prepareRowIterator() throws {\n        let names = [\"a\", \"b\", \"c\"]\n        try insertUsers(names)\n\n        let emailColumn = SQLite.Expression<String>(\"email\")\n        let statement = try db.prepare(\"SELECT email FROM users\")\n        let emails = try statement.prepareRowIterator().map { $0[emailColumn] }\n\n        XCTAssertEqual(names.map({ \"\\($0)@example.com\" }), emails.sorted())\n    }\n\n    /// Check that a statement reset will close the implicit transaction, allowing wal file to checkpoint\n    func test_reset_statement() throws {\n        // insert single row\n        try insertUsers(\"bob\")\n\n        // prepare a statement and read a single row. This will increment the cursor which\n        // prevents the implicit transaction from closing.\n        // https://www.sqlite.org/lang_transaction.html#implicit_versus_explicit_transactions\n        let statement = try db.prepare(\"SELECT email FROM users\")\n        _ = try statement.step()\n\n        // verify implicit transaction is not closed, and the users table is still locked\n        XCTAssertThrowsError(try db.run(\"DROP TABLE users\")) { error in\n            if case let Result.error(_, code, _) = error {\n                XCTAssertEqual(code, SQLITE_LOCKED)\n            } else {\n                XCTFail(\"unexpected error\")\n            }\n        }\n\n        // reset the prepared statement, unlocking the table and allowing the implicit transaction to close\n        statement.reset()\n\n        // truncate succeeds\n        try db.run(\"DROP TABLE users\")\n    }\n}\n"
  },
  {
    "path": "Tests/SQLiteTests/Core/ValueTests.swift",
    "content": "import XCTest\nimport SQLite\n\nclass ValueTests: XCTestCase {\n\n}\n"
  },
  {
    "path": "Tests/SQLiteTests/Extensions/CipherTests.swift",
    "content": "#if SQLCipher\nimport XCTest\nimport SQLite\nimport SQLCipher\n\nclass CipherTests: XCTestCase {\n    var db1: Connection!\n    var db2: Connection!\n\n    override func setUpWithError() throws {\n        db1 = try Connection()\n        db2 = try Connection()\n        // db1\n\n        try db1.key(\"hello\")\n\n        try db1.run(\"CREATE TABLE foo (bar TEXT)\")\n        try db1.run(\"INSERT INTO foo (bar) VALUES ('world')\")\n\n        // db2\n        let key2 = keyData()\n        try db2.key(Blob(bytes: key2.bytes, length: key2.length))\n\n        try db2.run(\"CREATE TABLE foo (bar TEXT)\")\n        try db2.run(\"INSERT INTO foo (bar) VALUES ('world')\")\n\n        try super.setUpWithError()\n    }\n\n    func test_key() throws {\n        XCTAssertEqual(1, try db1.scalar(\"SELECT count(*) FROM foo\") as? Int64)\n    }\n\n    func test_key_blob_literal() throws {\n        let db = try Connection()\n        try db.key(\"x'2DD29CA851E7B56E4697B0E1F08507293D761A05CE4D1B628663F411A8086D99'\")\n    }\n\n    func test_rekey() throws {\n        try db1.rekey(\"goodbye\")\n        XCTAssertEqual(1, try db1.scalar(\"SELECT count(*) FROM foo\") as? Int64)\n    }\n\n    func test_data_key() throws {\n        XCTAssertEqual(1, try db2.scalar(\"SELECT count(*) FROM foo\") as? Int64)\n    }\n\n    func test_data_rekey() throws {\n        let newKey = keyData()\n        try db2.rekey(Blob(bytes: newKey.bytes, length: newKey.length))\n        XCTAssertEqual(1, try db2.scalar(\"SELECT count(*) FROM foo\") as? Int64)\n    }\n\n    func test_keyFailure() throws {\n        let path = \"\\(NSTemporaryDirectory())/db.sqlite3\"\n        _ = try? FileManager.default.removeItem(atPath: path)\n\n        let connA = try Connection(path)\n        defer { try? FileManager.default.removeItem(atPath: path) }\n\n        try connA.key(\"hello\")\n        try connA.run(\"CREATE TABLE foo (bar TEXT)\")\n\n        let connB = try Connection(path, readonly: true)\n\n        do {\n            try connB.key(\"world\")\n            XCTFail(\"expected exception\")\n        } catch Result.error(_, let code, _) {\n            XCTAssertEqual(SQLITE_NOTADB, code)\n        } catch {\n            XCTFail(\"unexpected error: \\(error)\")\n        }\n    }\n\n    func test_open_db_encrypted_with_sqlcipher() throws {\n        // $ sqlcipher Tests/SQLiteTests/fixtures/encrypted-[version].x.sqlite\n        // sqlite> pragma key = 'sqlcipher-test';\n        // sqlite> CREATE TABLE foo (bar TEXT);\n        // sqlite> INSERT INTO foo (bar) VALUES ('world');\n        guard let cipherVersion: String = db1.cipherVersion,\n            cipherVersion.starts(with: \"3.\") || cipherVersion.starts(with: \"4.\") else { return }\n\n        let encryptedFile = cipherVersion.starts(with: \"3.\") ?\n                fixture(\"encrypted-3.x\", withExtension: \"sqlite\") :\n                fixture(\"encrypted-4.x\", withExtension: \"sqlite\")\n\n        try FileManager.default.setAttributes([FileAttributeKey.immutable: 1], ofItemAtPath: encryptedFile)\n        XCTAssertFalse(FileManager.default.isWritableFile(atPath: encryptedFile))\n\n        defer {\n            // ensure file can be cleaned up afterwards\n            try? FileManager.default.setAttributes([FileAttributeKey.immutable: 0], ofItemAtPath: encryptedFile)\n        }\n\n        let conn = try Connection(encryptedFile)\n        try conn.key(\"sqlcipher-test\")\n        XCTAssertEqual(1, try conn.scalar(\"SELECT count(*) FROM foo\") as? Int64)\n    }\n\n    func test_export() throws {\n        let tmp = temporaryFile()\n        try db1.sqlcipher_export(.uri(tmp), key: \"mykey\")\n\n        let conn = try Connection(tmp)\n        try conn.key(\"mykey\")\n        XCTAssertEqual(1, try conn.scalar(\"SELECT count(*) FROM foo\") as? Int64)\n    }\n\n    func test_cipher_provider() throws {\n        XCTAssertEqual(\"commoncrypto\", db1.cipherProvider)\n    }\n\n    func test_cipher_provider_version() throws {\n        XCTAssertNotNil(db1.cipherProviderVersion)\n    }\n\n    func test_cipher_fips_status() throws {\n        let fipsStatusString = db1.cipherFipsStatus\n        XCTAssertNotNil(fipsStatusString)\n        XCTAssertEqual(0, Int(fipsStatusString!))\n    }\n\n    private func keyData(length: Int = 64) -> NSData {\n        var bytes = [Int8](repeating: 0, count: length)\n        let result  = SecRandomCopyBytes(kSecRandomDefault, length, &bytes)\n        XCTAssertEqual(errSecSuccess, result)\n        return NSData(bytes: bytes, length: length)\n    }\n}\n#endif\n"
  },
  {
    "path": "Tests/SQLiteTests/Extensions/FTS4Tests.swift",
    "content": "import XCTest\nimport SQLite\n\nclass FTS4Tests: XCTestCase {\n\n    func test_create_onVirtualTable_withFTS4_compilesCreateVirtualTableExpression() {\n        XCTAssertEqual(\n            \"CREATE VIRTUAL TABLE \\\"virtual_table\\\" USING fts4()\",\n            virtualTable.create(.FTS4())\n        )\n        XCTAssertEqual(\n            \"CREATE VIRTUAL TABLE \\\"virtual_table\\\" USING fts4(\\\"string\\\")\",\n            virtualTable.create(.FTS4(string))\n        )\n        XCTAssertEqual(\n            \"CREATE VIRTUAL TABLE \\\"virtual_table\\\" USING fts4(tokenize=simple)\",\n            virtualTable.create(.FTS4(tokenize: .Simple))\n        )\n        XCTAssertEqual(\n            \"CREATE VIRTUAL TABLE \\\"virtual_table\\\" USING fts4(\\\"string\\\", tokenize=porter)\",\n            virtualTable.create(.FTS4([string], tokenize: .Porter))\n        )\n        XCTAssertEqual(\n            \"CREATE VIRTUAL TABLE \\\"virtual_table\\\" USING fts4(tokenize=\\\"unicode61 remove_diacritics=0\\\")\",\n            virtualTable.create(.FTS4(tokenize: .Unicode61(removeDiacritics: false)))\n        )\n        XCTAssertEqual(\n            \"\"\"\n            CREATE VIRTUAL TABLE \\\"virtual_table\\\" USING fts4(tokenize=\\\"unicode61 remove_diacritics=1\n             tokenchars=. separators=X\\\")\n            \"\"\".replacingOccurrences(of: \"\\n\", with: \"\"),\n            virtualTable.create(.FTS4(tokenize: .Unicode61(removeDiacritics: true,\n                                                           tokenchars: [\".\"], separators: [\"X\"])))\n        )\n    }\n\n    func test_match_onVirtualTableAsExpression_compilesMatchExpression() {\n        assertSQL(\"(\\\"virtual_table\\\" MATCH 'string')\", virtualTable.match(\"string\") as SQLite.Expression<Bool>)\n        assertSQL(\"(\\\"virtual_table\\\" MATCH \\\"string\\\")\", virtualTable.match(string) as SQLite.Expression<Bool>)\n        assertSQL(\"(\\\"virtual_table\\\" MATCH \\\"stringOptional\\\")\", virtualTable.match(stringOptional) as SQLite.Expression<Bool?>)\n    }\n\n    func test_match_onVirtualTableAsQueryType_compilesMatchExpression() {\n        assertSQL(\"SELECT * FROM \\\"virtual_table\\\" WHERE (\\\"virtual_table\\\" MATCH 'string')\",\n                  virtualTable.match(\"string\") as QueryType)\n        assertSQL(\"SELECT * FROM \\\"virtual_table\\\" WHERE (\\\"virtual_table\\\" MATCH \\\"string\\\")\",\n                  virtualTable.match(string) as QueryType)\n        assertSQL(\"SELECT * FROM \\\"virtual_table\\\" WHERE (\\\"virtual_table\\\" MATCH \\\"stringOptional\\\")\",\n                  virtualTable.match(stringOptional) as QueryType)\n    }\n\n}\n\nclass FTS4ConfigTests: XCTestCase {\n    var config: FTS4Config!\n\n    override func setUp() {\n        super.setUp()\n        config = FTS4Config()\n    }\n\n    func test_empty_config() {\n        XCTAssertEqual(\n            \"CREATE VIRTUAL TABLE \\\"virtual_table\\\" USING fts4()\",\n            sql(config))\n    }\n\n    func test_config_column() {\n        XCTAssertEqual(\n            \"CREATE VIRTUAL TABLE \\\"virtual_table\\\" USING fts4(\\\"string\\\")\",\n            sql(config.column(string)))\n    }\n\n    func test_config_columns() {\n        XCTAssertEqual(\n            \"CREATE VIRTUAL TABLE \\\"virtual_table\\\" USING fts4(\\\"string\\\", \\\"int\\\")\",\n            sql(config.columns([string, int])))\n    }\n\n    func test_config_unindexed_column() {\n        XCTAssertEqual(\n            \"CREATE VIRTUAL TABLE \\\"virtual_table\\\" USING fts4(\\\"string\\\", notindexed=\\\"string\\\")\",\n            sql(config.column(string, [.unindexed])))\n    }\n\n    func test_external_content_view() {\n        XCTAssertEqual(\n            \"CREATE VIRTUAL TABLE \\\"virtual_table\\\" USING fts4(content=\\\"view\\\")\",\n            sql(config.externalContent(_view )))\n    }\n\n    func test_external_content_virtual_table() {\n        XCTAssertEqual(\n            \"CREATE VIRTUAL TABLE \\\"virtual_table\\\" USING fts4(content=\\\"virtual_table\\\")\",\n            sql(config.externalContent(virtualTable)))\n    }\n\n    func test_tokenizer_simple() {\n        XCTAssertEqual(\n            \"CREATE VIRTUAL TABLE \\\"virtual_table\\\" USING fts4(tokenize=simple)\",\n            sql(config.tokenizer(.Simple)))\n    }\n\n    func test_tokenizer_porter() {\n        XCTAssertEqual(\n            \"CREATE VIRTUAL TABLE \\\"virtual_table\\\" USING fts4(tokenize=porter)\",\n            sql(config.tokenizer(.Porter)))\n    }\n\n    func test_tokenizer_unicode61() {\n        XCTAssertEqual(\n            \"CREATE VIRTUAL TABLE \\\"virtual_table\\\" USING fts4(tokenize=unicode61)\",\n            sql(config.tokenizer(.Unicode61())))\n    }\n\n    func test_tokenizer_unicode61_with_options() {\n        XCTAssertEqual(\n            \"\"\"\n            CREATE VIRTUAL TABLE \\\"virtual_table\\\" USING fts4(tokenize=\\\"unicode61 remove_diacritics=1\n             tokenchars=. separators=X\\\")\n            \"\"\".replacingOccurrences(of: \"\\n\", with: \"\"),\n            sql(config.tokenizer(.Unicode61(removeDiacritics: true, tokenchars: [\".\"], separators: [\"X\"]))))\n    }\n\n    func test_content_less() {\n        XCTAssertEqual(\n            \"CREATE VIRTUAL TABLE \\\"virtual_table\\\" USING fts4(content=\\\"\\\")\",\n            sql(config.contentless()))\n    }\n\n    func test_config_matchinfo() {\n        XCTAssertEqual(\n            \"CREATE VIRTUAL TABLE \\\"virtual_table\\\" USING fts4(matchinfo=\\\"fts3\\\")\",\n            sql(config.matchInfo(.fts3)))\n    }\n\n    func test_config_order_asc() {\n        XCTAssertEqual(\n            \"CREATE VIRTUAL TABLE \\\"virtual_table\\\" USING fts4(order=\\\"asc\\\")\",\n            sql(config.order(.asc)))\n    }\n\n    func test_config_order_desc() {\n        XCTAssertEqual(\n            \"CREATE VIRTUAL TABLE \\\"virtual_table\\\" USING fts4(order=\\\"desc\\\")\",\n            sql(config.order(.desc)))\n    }\n\n    func test_config_compress() {\n        XCTAssertEqual(\n            \"CREATE VIRTUAL TABLE \\\"virtual_table\\\" USING fts4(compress=\\\"compress_foo\\\")\",\n            sql(config.compress(\"compress_foo\")))\n    }\n\n    func test_config_uncompress() {\n        XCTAssertEqual(\n           \"CREATE VIRTUAL TABLE \\\"virtual_table\\\" USING fts4(uncompress=\\\"uncompress_foo\\\")\",\n            sql(config.uncompress(\"uncompress_foo\")))\n    }\n\n    func test_config_languageId() {\n        XCTAssertEqual(\n            \"CREATE VIRTUAL TABLE \\\"virtual_table\\\" USING fts4(languageid=\\\"lid\\\")\",\n            sql(config.languageId(\"lid\")))\n    }\n\n    func test_config_all() {\n        XCTAssertEqual(\n            \"\"\"\n            CREATE VIRTUAL TABLE \\\"virtual_table\\\" USING fts4(\\\"int\\\", \\\"string\\\", \\\"date\\\",\n             tokenize=porter, prefix=\\\"2,4\\\", content=\\\"table\\\", notindexed=\\\"string\\\", notindexed=\\\"date\\\",\n             languageid=\\\"lid\\\", matchinfo=\\\"fts3\\\", order=\\\"desc\\\")\n            \"\"\".replacingOccurrences(of: \"\\n\", with: \"\"),\n            sql(config\n                .tokenizer(.Porter)\n                .column(int)\n                .column(string, [.unindexed])\n                .column(date, [.unindexed])\n                .externalContent(table)\n                .matchInfo(.fts3)\n                .languageId(\"lid\")\n                .order(.desc)\n                .prefix([2, 4]))\n        )\n    }\n\n    func sql(_ config: FTS4Config) -> String {\n        virtualTable.create(.FTS4(config))\n    }\n}\n"
  },
  {
    "path": "Tests/SQLiteTests/Extensions/FTS5IntegrationTests.swift",
    "content": "import XCTest\n@testable import SQLite\n\n// Note: these tests are only run when the FTS5 trait has been enabled.\nclass FTS5IntegrationTests: SQLiteTestCase {\n    let email = SQLite.Expression<String>(\"email\")\n    let index = VirtualTable(\"index\")\n\n    private func createIndex() throws {\n        try createOrSkip { db in\n            try db.run(index.create(.FTS5(\n                FTS5Config()\n                    .column(email)\n                    .tokenizer(.Unicode61()))\n            ))\n        }\n\n        for user in try db.prepare(users) {\n            try db.run(index.insert(email <- user[email]))\n        }\n    }\n\n    private func createTrigramIndex() throws {\n        try createOrSkip { db in\n            try db.run(index.create(.FTS5(\n                FTS5Config()\n                  .column(email)\n                  .tokenizer(.Trigram(caseSensitive: false)))\n            ))\n        }\n\n        for user in try db.prepare(users) {\n            try db.run(index.insert(email <- user[email]))\n        }\n    }\n\n    override func setUpWithError() throws {\n        try super.setUpWithError()\n        try createUsersTable()\n        try insertUsers(\"John\", \"Paul\", \"George\", \"Ringo\")\n    }\n\n    func testMatch() throws {\n        try createIndex()\n        let matches = Array(try db.prepare(index.match(\"Paul\")))\n        XCTAssertEqual(matches.map { $0[email ]}, [\"Paul@example.com\"])\n    }\n\n    func testMatchPartial() throws {\n        try insertUsers(\"Paula\")\n        try createIndex()\n        let matches = Array(try db.prepare(index.match(\"Pa*\")))\n        XCTAssertEqual(matches.map { $0[email ]}, [\"Paul@example.com\", \"Paula@example.com\"])\n    }\n\n    func testTrigramIndex() throws {\n        try createTrigramIndex()\n        let matches = Array(try db.prepare(index.match(\"Paul\")))\n        XCTAssertEqual(1, matches.count)\n    }\n\n    private func createOrSkip(_ createIndex: (Connection) throws -> Void) throws {\n        #if FTS5\n        try createIndex(db)\n        #else\n        throw XCTSkip(\"FTS5 is not enabled\")\n        #endif\n    }\n}\n"
  },
  {
    "path": "Tests/SQLiteTests/Extensions/FTS5Tests.swift",
    "content": "import XCTest\nimport SQLite\n\nclass FTS5Tests: XCTestCase {\n    var config: FTS5Config!\n\n    override func setUp() {\n        super.setUp()\n        config = FTS5Config()\n    }\n\n    func test_empty_config() {\n        XCTAssertEqual(\n            \"CREATE VIRTUAL TABLE \\\"virtual_table\\\" USING fts5()\",\n            sql(config))\n    }\n\n    func test_config_column() {\n        XCTAssertEqual(\n            \"CREATE VIRTUAL TABLE \\\"virtual_table\\\" USING fts5(\\\"string\\\")\",\n            sql(config.column(string)))\n    }\n\n    func test_config_columns() {\n        XCTAssertEqual(\n            \"CREATE VIRTUAL TABLE \\\"virtual_table\\\" USING fts5(\\\"string\\\", \\\"int\\\")\",\n            sql(config.columns([string, int])))\n    }\n\n    func test_config_unindexed_column() {\n        XCTAssertEqual(\n            \"CREATE VIRTUAL TABLE \\\"virtual_table\\\" USING fts5(\\\"string\\\" UNINDEXED)\",\n            sql(config.column(string, [.unindexed])))\n    }\n\n    func test_external_content_table() {\n        XCTAssertEqual(\n            \"CREATE VIRTUAL TABLE \\\"virtual_table\\\" USING fts5(content=\\\"table\\\")\",\n            sql(config.externalContent(table)))\n    }\n\n    func test_external_content_view() {\n        XCTAssertEqual(\n            \"CREATE VIRTUAL TABLE \\\"virtual_table\\\" USING fts5(content=\\\"view\\\")\",\n            sql(config.externalContent(_view)))\n    }\n\n    func test_external_content_virtual_table() {\n        XCTAssertEqual(\n            \"CREATE VIRTUAL TABLE \\\"virtual_table\\\" USING fts5(content=\\\"virtual_table\\\")\",\n            sql(config.externalContent(virtualTable)))\n    }\n\n    func test_content_less() {\n        XCTAssertEqual(\n            \"CREATE VIRTUAL TABLE \\\"virtual_table\\\" USING fts5(content=\\\"\\\")\",\n            sql(config.contentless()))\n    }\n\n    func test_content_rowid() {\n        XCTAssertEqual(\n            \"CREATE VIRTUAL TABLE \\\"virtual_table\\\" USING fts5(content_rowid=\\\"string\\\")\",\n            sql(config.contentRowId(string)))\n    }\n\n    func test_tokenizer_porter() {\n        XCTAssertEqual(\n            \"CREATE VIRTUAL TABLE \\\"virtual_table\\\" USING fts5(tokenize=porter)\",\n            sql(config.tokenizer(.Porter)))\n    }\n\n    func test_tokenizer_unicode61() {\n        XCTAssertEqual(\n            \"CREATE VIRTUAL TABLE \\\"virtual_table\\\" USING fts5(tokenize=unicode61)\",\n            sql(config.tokenizer(.Unicode61())))\n    }\n\n    func test_tokenizer_unicode61_with_options() {\n        XCTAssertEqual(\n            \"CREATE VIRTUAL TABLE \\\"virtual_table\\\" USING fts5(tokenize=\\\"unicode61 remove_diacritics=1 tokenchars=. separators=X\\\")\",\n            sql(config.tokenizer(.Unicode61(removeDiacritics: true, tokenchars: [\".\"], separators: [\"X\"]))))\n    }\n\n    func test_tokenizer_trigram() {\n        XCTAssertEqual(\n                \"CREATE VIRTUAL TABLE \\\"virtual_table\\\" USING fts5(tokenize=\\\"trigram case_sensitive 0\\\")\",\n                sql(config.tokenizer(.Trigram())))\n\n        XCTAssertEqual(\n                \"CREATE VIRTUAL TABLE \\\"virtual_table\\\" USING fts5(tokenize=\\\"trigram case_sensitive 1\\\")\",\n                sql(config.tokenizer(.Trigram(caseSensitive: true))))\n    }\n\n    func test_column_size() {\n        XCTAssertEqual(\n            \"CREATE VIRTUAL TABLE \\\"virtual_table\\\" USING fts5(columnsize=1)\",\n            sql(config.columnSize(1)))\n    }\n\n    func test_detail_full() {\n        XCTAssertEqual(\n            \"CREATE VIRTUAL TABLE \\\"virtual_table\\\" USING fts5(detail=\\\"full\\\")\",\n            sql(config.detail(.full)))\n    }\n\n    func test_detail_column() {\n        XCTAssertEqual(\n            \"CREATE VIRTUAL TABLE \\\"virtual_table\\\" USING fts5(detail=\\\"column\\\")\",\n            sql(config.detail(.column)))\n    }\n\n    func test_detail_none() {\n        XCTAssertEqual(\n            \"CREATE VIRTUAL TABLE \\\"virtual_table\\\" USING fts5(detail=\\\"none\\\")\",\n            sql(config.detail(.none)))\n    }\n\n    func test_fts5_config_all() {\n        XCTAssertEqual(\n            \"\"\"\n            CREATE VIRTUAL TABLE \\\"virtual_table\\\" USING fts5(\\\"int\\\", \\\"string\\\" UNINDEXED, \\\"date\\\" UNINDEXED,\n             tokenize=porter, prefix=\\\"2,4\\\", content=\\\"table\\\")\n            \"\"\".replacingOccurrences(of: \"\\n\", with: \"\"),\n            sql(config\n                .tokenizer(.Porter)\n                .column(int)\n                .column(string, [.unindexed])\n                .column(date, [.unindexed])\n                .externalContent(table)\n                .prefix([2, 4]))\n        )\n    }\n\n    func sql(_ config: FTS5Config) -> String {\n        virtualTable.create(.FTS5(config))\n    }\n}\n"
  },
  {
    "path": "Tests/SQLiteTests/Extensions/RTreeTests.swift",
    "content": "import XCTest\nimport SQLite\n\nclass RTreeTests: XCTestCase {\n\n    func test_create_onVirtualTable_withRTree_createVirtualTableExpression() {\n        XCTAssertEqual(\n            \"CREATE VIRTUAL TABLE \\\"virtual_table\\\" USING rtree(\\\"int64\\\", \\\"double\\\", \\\"double\\\")\",\n            virtualTable.create(.RTree(int64, (double, double)))\n        )\n        XCTAssertEqual(\n            \"CREATE VIRTUAL TABLE \\\"virtual_table\\\" USING rtree(\\\"int64\\\", \\\"double\\\", \\\"double\\\", \\\"double\\\", \\\"double\\\")\",\n            virtualTable.create(.RTree(int64, (double, double), (double, double)))\n        )\n    }\n\n}\n"
  },
  {
    "path": "Tests/SQLiteTests/Fixtures.swift",
    "content": "import Foundation\n\nfunc fixture(_ name: String, withExtension: String?) -> String {\n    #if SWIFT_PACKAGE\n    let testBundle = Bundle.module\n    #else\n    let testBundle = Bundle(for: SQLiteTestCase.self)\n    #endif\n\n    for resource in [name, \"Resources/\\(name)\"] {\n        if let url = testBundle.url(\n            forResource: resource,\n            withExtension: withExtension) {\n            return url.path\n        }\n    }\n    fatalError(\"Cannot find \\(name).\\(withExtension ?? \"\")\")\n}\n\nfunc temporaryFile() -> String {\n    URL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent(UUID().uuidString).path\n}\n"
  },
  {
    "path": "Tests/SQLiteTests/FoundationTests.swift",
    "content": "import XCTest\nimport SQLite\n\nclass FoundationTests: XCTestCase {\n    func testDataFromBlob() {\n        let data = Data([1, 2, 3])\n        let blob = data.datatypeValue\n        XCTAssertEqual([1, 2, 3], blob.bytes)\n    }\n\n    func testBlobToData() {\n        let blob = Blob(bytes: [1, 2, 3])\n        let data = Data.fromDatatypeValue(blob)\n        XCTAssertEqual(Data([1, 2, 3]), data)\n    }\n\n    func testStringFromUUID() {\n        let uuid = UUID(uuidString: \"4ABE10C9-FF12-4CD4-90C1-4B429001BAD3\")!\n        let string = uuid.datatypeValue\n        XCTAssertEqual(\"4ABE10C9-FF12-4CD4-90C1-4B429001BAD3\", string)\n    }\n\n    func testUUIDFromString() {\n        let string = \"4ABE10C9-FF12-4CD4-90C1-4B429001BAD3\"\n        let uuid = UUID.fromDatatypeValue(string)\n        XCTAssertEqual(UUID(uuidString: \"4ABE10C9-FF12-4CD4-90C1-4B429001BAD3\"), uuid)\n    }\n\n    func testURLFromString() {\n        let string = \"http://foo.com\"\n        let url = URL.fromDatatypeValue(string)\n        XCTAssertEqual(URL(string: string), url)\n    }\n\n    func testStringFromURL() {\n        let url = URL(string: \"http://foo.com\")!\n        let string = url.datatypeValue\n        XCTAssertEqual(\"http://foo.com\", string)\n    }\n}\n"
  },
  {
    "path": "Tests/SQLiteTests/Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>CFBundleDevelopmentRegion</key>\n\t<string>en</string>\n\t<key>CFBundleExecutable</key>\n\t<string>$(EXECUTABLE_NAME)</string>\n\t<key>CFBundleIdentifier</key>\n\t<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>\n\t<key>CFBundleInfoDictionaryVersion</key>\n\t<string>6.0</string>\n\t<key>CFBundleName</key>\n\t<string>$(PRODUCT_NAME)</string>\n\t<key>CFBundlePackageType</key>\n\t<string>BNDL</string>\n\t<key>CFBundleShortVersionString</key>\n\t<string>1.0</string>\n\t<key>CFBundleSignature</key>\n\t<string>????</string>\n\t<key>CFBundleVersion</key>\n\t<string>1</string>\n</dict>\n</plist>\n"
  },
  {
    "path": "Tests/SQLiteTests/Schema/Connection+SchemaTests.swift",
    "content": "import XCTest\n@testable import SQLite\n\nclass ConnectionSchemaTests: SQLiteTestCase {\n\n    override func setUpWithError() throws {\n        try super.setUpWithError()\n        try createUsersTable()\n    }\n\n    func test_foreignKeyCheck() throws {\n        let errors = try db.foreignKeyCheck()\n        XCTAssert(errors.isEmpty)\n    }\n\n    func test_foreignKeyCheck_with_table() throws {\n        let errors = try db.foreignKeyCheck(table: \"users\")\n        XCTAssert(errors.isEmpty)\n    }\n\n    func test_foreignKeyCheck_table_not_found() throws {\n        XCTAssertThrowsError(try db.foreignKeyCheck(table: \"xxx\")) { error in\n            guard case Result.error(let message, _, _) = error else {\n                assertionFailure(\"invalid error type\")\n                return\n            }\n            XCTAssertEqual(message, \"no such table: xxx\")\n        }\n    }\n\n    func test_integrityCheck_global() throws {\n        let results = try db.integrityCheck()\n        XCTAssert(results.isEmpty)\n    }\n\n    func test_partial_integrityCheck_table() throws {\n        guard db.supports(.partialIntegrityCheck) else { return }\n        let results = try db.integrityCheck(table: \"users\")\n        XCTAssert(results.isEmpty)\n    }\n\n    func test_integrityCheck_table_not_found() throws {\n        guard db.supports(.partialIntegrityCheck) else { return }\n        XCTAssertThrowsError(try db.integrityCheck(table: \"xxx\")) { error in\n            guard case Result.error(let message, _, _) = error else {\n                assertionFailure(\"invalid error type\")\n                return\n            }\n            XCTAssertEqual(message, \"no such table: xxx\")\n        }\n    }\n}\n"
  },
  {
    "path": "Tests/SQLiteTests/Schema/SchemaChangerTests.swift",
    "content": "import XCTest\n@testable import SQLite\n\nclass SchemaChangerTests: SQLiteTestCase {\n    var schemaChanger: SchemaChanger!\n    var schema: SchemaReader!\n\n    override func setUpWithError() throws {\n        try super.setUpWithError()\n        try createUsersTable()\n\n        try insertUsers(\"bob\")\n\n        schema = SchemaReader(connection: db)\n        schemaChanger = SchemaChanger(connection: db)\n    }\n\n    func test_empty_migration_does_not_change_column_definitions() throws {\n        let previous = try schema.columnDefinitions(table: \"users\")\n        try schemaChanger.alter(table: \"users\") { _ in\n        }\n        let current = try schema.columnDefinitions(table: \"users\")\n\n        XCTAssertEqual(previous, current)\n    }\n\n    func test_empty_migration_does_not_change_index_definitions() throws {\n        let previous = try schema.indexDefinitions(table: \"users\")\n        try schemaChanger.alter(table: \"users\") { _ in\n        }\n        let current = try schema.indexDefinitions(table: \"users\")\n\n        XCTAssertEqual(previous, current)\n    }\n\n    func test_empty_migration_does_not_change_foreign_key_definitions() throws {\n        let previous = try schema.foreignKeys(table: \"users\")\n        try schemaChanger.alter(table: \"users\") { _ in\n        }\n        let current = try schema.foreignKeys(table: \"users\")\n\n        XCTAssertEqual(previous, current)\n    }\n\n    func test_empty_migration_does_not_change_the_row_count() throws {\n        let previous = try db.scalar(users.count)\n        try schemaChanger.alter(table: \"users\") { _ in\n        }\n        let current = try db.scalar(users.count)\n\n        XCTAssertEqual(previous, current)\n    }\n\n    func test_drop_column() throws {\n        try schemaChanger.alter(table: \"users\") { table in\n            table.drop(column: \"age\")\n        }\n        let columns = try schema.columnDefinitions(table: \"users\").map(\\.name)\n        XCTAssertFalse(columns.contains(\"age\"))\n    }\n\n    func test_drop_column_legacy() throws {\n        schemaChanger = .init(connection: db, version: .init(major: 3, minor: 24)) // DROP COLUMN introduced in 3.35.0\n\n        try schemaChanger.alter(table: \"users\") { table in\n            table.drop(column: \"age\")\n        }\n        let columns = try schema.columnDefinitions(table: \"users\").map(\\.name)\n        XCTAssertFalse(columns.contains(\"age\"))\n    }\n\n    func test_rename_column() throws {\n        try schemaChanger.alter(table: \"users\") { table in\n            table.rename(column: \"age\", to: \"age2\")\n        }\n\n        let columns = try schema.columnDefinitions(table: \"users\").map(\\.name)\n        XCTAssertFalse(columns.contains(\"age\"))\n        XCTAssertTrue(columns.contains(\"age2\"))\n    }\n\n    func test_rename_column_legacy() throws {\n        schemaChanger = .init(connection: db, version: .init(major: 3, minor: 24)) // RENAME COLUMN introduced in 3.25.0\n\n        try schemaChanger.alter(table: \"users\") { table in\n            table.rename(column: \"age\", to: \"age2\")\n        }\n\n        let columns = try schema.columnDefinitions(table: \"users\").map(\\.name)\n        XCTAssertFalse(columns.contains(\"age\"))\n        XCTAssertTrue(columns.contains(\"age2\"))\n    }\n\n    func test_add_column() throws {\n        let column = SQLite.Expression<String>(\"new_column\")\n        let newColumn = ColumnDefinition(name: \"new_column\",\n                                         type: .TEXT,\n                                         nullable: true,\n                                         defaultValue: .stringLiteral(\"foo\"))\n\n        try schemaChanger.alter(table: \"users\") { table in\n            table.add(column: newColumn)\n        }\n\n        let columns = try schema.columnDefinitions(table: \"users\")\n        XCTAssertTrue(columns.contains(newColumn))\n\n        XCTAssertEqual(try db.pluck(users.select(column))?[column], \"foo\")\n    }\n\n    func test_add_column_primary_key_fails() throws {\n        let newColumn = ColumnDefinition(name: \"new_column\",\n                                         primaryKey: .init(autoIncrement: false, onConflict: nil),\n                                         type: .TEXT)\n\n        XCTAssertThrowsError(try schemaChanger.alter(table: \"users\") { table in\n            table.add(column: newColumn)\n        }) { error in\n            if case SchemaChanger.Error.invalidColumnDefinition(_) = error {\n                XCTAssertEqual(\"Invalid column definition: can not add primary key column\", error.localizedDescription)\n            } else {\n                XCTFail(\"invalid error: \\(error)\")\n            }\n        }\n    }\n\n    func test_add_index() throws {\n        try schemaChanger.alter(table: \"users\") { table in\n            table.add(index: .init(table: table.name, name: \"age_index\", unique: false, columns: [\"age\"], indexSQL: nil))\n        }\n\n        let indexes = try schema.indexDefinitions(table: \"users\").filter { !$0.isInternal }\n        XCTAssertEqual([\n            IndexDefinition(table: \"users\",\n                            name: \"age_index\",\n                            unique: false,\n                            columns: [\"age\"],\n                            where: nil,\n                            orders: nil,\n                            origin: .createIndex)\n        ], indexes)\n    }\n\n    func test_add_index_if_not_exists() throws {\n        let index = IndexDefinition(table: \"users\", name: \"age_index\", unique: false, columns: [\"age\"], indexSQL: nil)\n        try schemaChanger.alter(table: \"users\") { table in\n            table.add(index: index)\n        }\n\n        try schemaChanger.alter(table: \"users\") { table in\n            table.add(index: index, ifNotExists: true)\n        }\n\n        XCTAssertThrowsError(\n            try schemaChanger.alter(table: \"users\") { table in\n                table.add(index: index, ifNotExists: false)\n            }\n        )\n    }\n\n    func test_drop_index() throws {\n        try db.execute(\"\"\"\n            CREATE INDEX age_index ON users(age)\n        \"\"\")\n\n        try schemaChanger.alter(table: \"users\") { table in\n            table.drop(index: \"age_index\")\n        }\n        let indexes = try schema.indexDefinitions(table: \"users\").filter { !$0.isInternal }\n        XCTAssertEqual(0, indexes.count)\n    }\n\n    func test_drop_index_if_exists() throws {\n        try db.execute(\"\"\"\n            CREATE INDEX age_index ON users(age)\n        \"\"\")\n\n        try schemaChanger.alter(table: \"users\") { table in\n            table.drop(index: \"age_index\")\n        }\n\n        try schemaChanger.alter(table: \"users\") { table in\n            table.drop(index: \"age_index\", ifExists: true)\n        }\n\n        XCTAssertThrowsError(\n            try schemaChanger.alter(table: \"users\") { table in\n                table.drop(index: \"age_index\", ifExists: false)\n            }\n        ) { error in\n            if case Result.error(let message, _, _) =  error {\n                XCTAssertEqual(message, \"no such index: age_index\")\n            } else {\n                XCTFail(\"unexpected error \\(error)\")\n            }\n        }\n    }\n\n    func test_drop_table() throws {\n        try schemaChanger.drop(table: \"users\")\n        XCTAssertThrowsError(try db.scalar(users.count)) { error in\n            if case Result.error(let message, _, _) =  error {\n                XCTAssertEqual(message, \"no such table: users\")\n            } else {\n                XCTFail(\"unexpected error \\(error)\")\n            }\n        }\n    }\n\n    func test_drop_table_if_exists_true() throws {\n        try schemaChanger.drop(table: \"xxx\", ifExists: true)\n    }\n\n    func test_drop_table_if_exists_false() throws {\n        XCTAssertThrowsError(try schemaChanger.drop(table: \"xxx\", ifExists: false)) { error in\n            if case Result.error(let message, _, _) =  error {\n                XCTAssertEqual(message, \"no such table: xxx\")\n            } else {\n                XCTFail(\"unexpected error \\(error)\")\n            }\n        }\n    }\n\n    func test_rename_table() throws {\n        try schemaChanger.rename(table: \"users\", to: \"users_new\")\n        let users_new = Table(\"users_new\")\n        XCTAssertEqual((try db.scalar(users_new.count)) as Int, 1)\n    }\n\n    func test_create_table() throws {\n        try schemaChanger.create(table: \"foo\") { table in\n            table.add(column: .init(name: \"id\", primaryKey: .init(autoIncrement: true), type: .INTEGER))\n            table.add(column: .init(name: \"name\", type: .TEXT, nullable: false, unique: true))\n            table.add(column: .init(name: \"age\", type: .INTEGER))\n\n            table.add(index: .init(table: table.name,\n                                   name: \"nameIndex\",\n                                   unique: true,\n                                   columns: [\"name\"],\n                                   where: nil,\n                                   orders: nil))\n        }\n\n        // make sure new table can be queried\n        let foo = Table(\"foo\")\n        XCTAssertEqual((try db.scalar(foo.count)) as Int, 0)\n\n        let columns = try schema.columnDefinitions(table: \"foo\")\n        XCTAssertEqual(columns, [\n            ColumnDefinition(name: \"id\",\n                             primaryKey: .init(autoIncrement: true, onConflict: nil),\n                             type: .INTEGER,\n                             nullable: true,\n                             unique: false,\n                             defaultValue: .NULL,\n                             references: nil),\n            ColumnDefinition(name: \"name\",\n                             primaryKey: nil,\n                             type: .TEXT,\n                             nullable: false,\n                             unique: true,\n                             defaultValue: .NULL,\n                             references: nil),\n            ColumnDefinition(name: \"age\",\n                             primaryKey: nil,\n                             type: .INTEGER,\n                             nullable: true,\n                             unique: false,\n                             defaultValue: .NULL,\n                             references: nil)\n        ])\n\n        let indexes = try schema.indexDefinitions(table: \"foo\").filter { !$0.isInternal }\n        XCTAssertEqual(indexes, [\n            IndexDefinition(table: \"foo\", name: \"nameIndex\", unique: true, columns: [\"name\"], where: nil, orders: nil, origin: .createIndex)\n        ])\n    }\n\n    func test_create_table_add_column_expression() throws {\n        try schemaChanger.create(table: \"foo\") { table in\n            table.add(expression: SQLite.Expression<String>(\"name\"))\n            table.add(expression: SQLite.Expression<Int>(\"age\"))\n            table.add(expression: SQLite.Expression<Double?>(\"salary\"))\n        }\n\n        let columns = try schema.columnDefinitions(table: \"foo\")\n        XCTAssertEqual(columns, [\n            ColumnDefinition(name: \"name\",\n                             primaryKey: nil,\n                             type: .TEXT,\n                             nullable: false,\n                             defaultValue: .NULL,\n                             references: nil),\n            ColumnDefinition(name: \"age\",\n                             primaryKey: nil,\n                             type: .INTEGER,\n                             nullable: false,\n                             defaultValue: .NULL,\n                             references: nil),\n            ColumnDefinition(name: \"salary\",\n                             primaryKey: nil,\n                             type: .REAL,\n                             nullable: true,\n                             defaultValue: .NULL,\n                             references: nil)\n            ])\n    }\n\n    func test_create_table_if_not_exists() throws {\n        try schemaChanger.create(table: \"foo\") { table in\n            table.add(column: .init(name: \"id\", primaryKey: .init(autoIncrement: true), type: .INTEGER))\n        }\n\n        try schemaChanger.create(table: \"foo\", ifNotExists: true) { table in\n            table.add(column: .init(name: \"id\", primaryKey: .init(autoIncrement: true), type: .INTEGER))\n        }\n\n        XCTAssertThrowsError(\n            try schemaChanger.create(table: \"foo\", ifNotExists: false) { table in\n                table.add(column: .init(name: \"id\", primaryKey: .init(autoIncrement: true), type: .INTEGER))\n            }\n        ) { error in\n            if case Result.error(_, let code, _) = error {\n                XCTAssertEqual(code, 1)\n            } else {\n                XCTFail(\"unexpected error: \\(error)\")\n            }\n        }\n    }\n\n    func test_create_table_if_not_exists_with_index() throws {\n        try schemaChanger.create(table: \"foo\") { table in\n            table.add(column: .init(name: \"id\", primaryKey: .init(autoIncrement: true), type: .INTEGER))\n            table.add(column: .init(name: \"name\", type: .TEXT))\n            table.add(index: .init(table: \"foo\", name: \"name_index\", unique: true, columns: [\"name\"], indexSQL: nil))\n        }\n\n        // ifNotExists needs to apply to index creation as well\n        try schemaChanger.create(table: \"foo\", ifNotExists: true) { table in\n            table.add(column: .init(name: \"id\", primaryKey: .init(autoIncrement: true), type: .INTEGER))\n            table.add(index: .init(table: \"foo\", name: \"name_index\", unique: true, columns: [\"name\"], indexSQL: nil))\n        }\n    }\n\n    func test_create_table_with_foreign_key_reference() throws {\n        try schemaChanger.create(table: \"foo\") { table in\n            table.add(column: .init(name: \"id\", primaryKey: .init(autoIncrement: true), type: .INTEGER))\n        }\n\n        try schemaChanger.create(table: \"bars\") { table in\n            table.add(column: .init(name: \"id\", primaryKey: .init(autoIncrement: true), type: .INTEGER))\n            table.add(column: .init(name: \"foo_id\",\n                                    type: .INTEGER,\n                                    nullable: false,\n                                    references: .init(toTable: \"foo\", toColumn: \"id\")))\n        }\n\n        let barColumns = try schema.columnDefinitions(table: \"bars\")\n\n        XCTAssertEqual([\n            ColumnDefinition(name: \"id\",\n                             primaryKey: .init(autoIncrement: true, onConflict: nil),\n                             type: .INTEGER,\n                             nullable: true,\n                             unique: false,\n                             defaultValue: .NULL,\n                             references: nil),\n\n            ColumnDefinition(name: \"foo_id\",\n                             primaryKey: nil,\n                             type: .INTEGER,\n                             nullable: false,\n                             unique: false,\n                             defaultValue: .NULL,\n                             references: .init(fromColumn: \"foo_id\", toTable: \"foo\", toColumn: \"id\", onUpdate: nil, onDelete: nil))\n        ], barColumns)\n    }\n\n    func test_run_arbitrary_sql() throws {\n        try schemaChanger.run(\"DROP TABLE users\")\n        XCTAssertEqual(0, try schema.objectDefinitions(name: \"users\", type: .table).count)\n    }\n}\n"
  },
  {
    "path": "Tests/SQLiteTests/Schema/SchemaDefinitionsTests.swift",
    "content": "import XCTest\n@testable import SQLite\n\nclass ColumnDefinitionTests: XCTestCase {\n    var definition: ColumnDefinition!\n    var expected: String!\n\n    static let definitions: [(String, ColumnDefinition)] = [\n        (\"\\\"id\\\" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL\",\n        ColumnDefinition(name: \"id\", primaryKey: .init(), type: .INTEGER, nullable: false, defaultValue: .NULL, references: nil)),\n\n        (\"\\\"other_id\\\" INTEGER NOT NULL REFERENCES \\\"other_table\\\" (\\\"some_id\\\")\",\n        ColumnDefinition(name: \"other_id\", primaryKey: nil, type: .INTEGER, nullable: false, defaultValue: .NULL,\n                         references: .init(fromColumn: \"\", toTable: \"other_table\", toColumn: \"some_id\", onUpdate: nil, onDelete: nil))),\n\n        (\"\\\"text\\\" TEXT\",\n        ColumnDefinition(name: \"text\", primaryKey: nil, type: .TEXT, nullable: true, defaultValue: .NULL, references: nil)),\n\n        (\"\\\"text\\\" TEXT NOT NULL\",\n        ColumnDefinition(name: \"text\", primaryKey: nil, type: .TEXT, nullable: false, defaultValue: .NULL, references: nil)),\n\n        (\"\\\"text_column\\\" TEXT DEFAULT 'fo\\\"o'\",\n        ColumnDefinition(name: \"text_column\", primaryKey: nil, type: .TEXT, nullable: true,\n        defaultValue: .stringLiteral(\"fo\\\"o\"), references: nil)),\n\n        (\"\\\"integer_column\\\" INTEGER DEFAULT 123\",\n        ColumnDefinition(name: \"integer_column\", primaryKey: nil, type: .INTEGER, nullable: true,\n                          defaultValue: .numericLiteral(\"123\"), references: nil)),\n\n        (\"\\\"real_column\\\" REAL DEFAULT 123.123\",\n        ColumnDefinition(name: \"real_column\", primaryKey: nil, type: .REAL, nullable: true,\n                          defaultValue: .numericLiteral(\"123.123\"), references: nil))\n    ]\n\n    #if !(os(Linux) || os(Android))\n    override class var defaultTestSuite: XCTestSuite {\n        let suite = XCTestSuite(forTestCaseClass: ColumnDefinitionTests.self)\n\n        for (expected, column) in ColumnDefinitionTests.definitions {\n            let test = ColumnDefinitionTests(selector: #selector(verify))\n            test.definition = column\n            test.expected = expected\n            suite.addTest(test)\n        }\n        return suite\n    }\n\n    @objc func verify() {\n        XCTAssertEqual(definition.toSQL(), expected)\n    }\n    #endif\n\n    func testNullableByDefault() {\n        let test = ColumnDefinition(name: \"test\", type: .REAL)\n        XCTAssertEqual(test.name, \"test\")\n        XCTAssertTrue(test.nullable)\n        XCTAssertEqual(test.defaultValue, .NULL)\n        XCTAssertEqual(test.type, .REAL)\n        XCTAssertNil(test.references)\n        XCTAssertNil(test.primaryKey)\n    }\n}\n\nclass AffinityTests: XCTestCase {\n    func test_init() {\n        XCTAssertEqual(ColumnDefinition.Affinity(\"TEXT\"), .TEXT)\n        XCTAssertEqual(ColumnDefinition.Affinity(\"text\"), .TEXT)\n        XCTAssertEqual(ColumnDefinition.Affinity(\"INTEGER\"), .INTEGER)\n        XCTAssertEqual(ColumnDefinition.Affinity(\"BLOB\"), .BLOB)\n        XCTAssertEqual(ColumnDefinition.Affinity(\"REAL\"), .REAL)\n        XCTAssertEqual(ColumnDefinition.Affinity(\"NUMERIC\"), .NUMERIC)\n    }\n\n    // [Determination Of Column Affinity](https://sqlite.org/datatype3.html#determination_of_column_affinity)\n    // Rule 1\n    func testIntegerAffinity() {\n        let declared = [\n            \"INT\",\n            \"INTEGER\",\n            \"TINYINT\",\n            \"SMALLINT\",\n            \"MEDIUMINT\",\n            \"BIGINT\",\n            \"UNSIGNED BIG INT\",\n            \"INT2\",\n            \"INT8\"\n        ]\n        XCTAssertTrue(declared.allSatisfy({ColumnDefinition.Affinity($0) == .INTEGER}))\n    }\n\n    // Rule 2\n    func testTextAffinity() {\n        let declared = [\n            \"CHARACTER(20)\",\n            \"VARCHAR(255)\",\n            \"VARYING CHARACTER(255)\",\n            \"NCHAR(55)\",\n            \"NATIVE CHARACTER(70)\",\n            \"NVARCHAR(100)\",\n            \"TEXT\",\n            \"CLOB\"\n        ]\n        XCTAssertTrue(declared.allSatisfy({ColumnDefinition.Affinity($0) == .TEXT}))\n    }\n\n    // Rule 3\n    func testBlobAffinity() {\n        XCTAssertEqual(ColumnDefinition.Affinity(\"BLOB\"), .BLOB)\n    }\n\n    // Rule 4\n    func testRealAffinity() {\n        let declared = [\n            \"REAL\",\n            \"DOUBLE\",\n            \"DOUBLE PRECISION\",\n            \"FLOAT\"\n        ]\n        XCTAssertTrue(declared.allSatisfy({ColumnDefinition.Affinity($0) == .REAL}))\n    }\n\n    // Rule 5\n    func testNumericAffinity() {\n        let declared = [\n            \"NUMERIC\",\n            \"DECIMAL(10,5)\",\n            \"BOOLEAN\",\n            \"DATE\",\n            \"DATETIME\"\n        ]\n        XCTAssertTrue(declared.allSatisfy({ColumnDefinition.Affinity($0) == .NUMERIC}))\n    }\n\n    func test_returns_NUMERIC_for_unknown_type() {\n        XCTAssertEqual(ColumnDefinition.Affinity(\"baz\"), .NUMERIC)\n    }\n}\n\nclass IndexDefinitionTests: XCTestCase {\n    var definition: IndexDefinition!\n    var expected: String!\n    var ifNotExists: Bool!\n\n    static let definitions: [(IndexDefinition, Bool, String)] = [\n        (IndexDefinition(table: \"tests\", name: \"index_tests\",\n                         unique: false,\n                         columns: [\"test_column\"],\n                         where: nil,\n                         orders: nil),\n        false,\n        \"CREATE INDEX \\\"index_tests\\\" ON \\\"tests\\\" (\\\"test_column\\\")\"),\n\n        (IndexDefinition(table: \"tests\", name: \"index_tests\",\n                         unique: true,\n                         columns: [\"test_column\"],\n                         where: nil,\n                         orders: nil),\n        false,\n        \"CREATE UNIQUE INDEX \\\"index_tests\\\" ON \\\"tests\\\" (\\\"test_column\\\")\"),\n\n        (IndexDefinition(table: \"tests\", name: \"index_tests\",\n                         unique: true,\n                         columns: [\"test_column\", \"bar_column\"],\n                         where: \"test_column IS NOT NULL\",\n                         orders: nil),\n        false,\n        \"CREATE UNIQUE INDEX \\\"index_tests\\\" ON \\\"tests\\\" (\\\"test_column\\\", \\\"bar_column\\\") WHERE test_column IS NOT NULL\"),\n\n        (IndexDefinition(table: \"tests\", name: \"index_tests\",\n                         unique: true,\n                         columns: [\"test_column\", \"bar_column\"],\n                         where: nil,\n                         orders: [\"test_column\": .DESC]),\n        false,\n        \"CREATE UNIQUE INDEX \\\"index_tests\\\" ON \\\"tests\\\" (\\\"test_column\\\" DESC, \\\"bar_column\\\")\"),\n\n        (IndexDefinition(table: \"tests\", name: \"index_tests\",\n                         unique: false,\n                         columns: [\"test_column\"],\n                         where: nil,\n                         orders: nil),\n        true,\n        \"CREATE INDEX IF NOT EXISTS \\\"index_tests\\\" ON \\\"tests\\\" (\\\"test_column\\\")\")\n    ]\n\n    #if !(os(Linux) || os(Android))\n    override class var defaultTestSuite: XCTestSuite {\n        let suite = XCTestSuite(forTestCaseClass: IndexDefinitionTests.self)\n\n        for (column, ifNotExists, expected) in IndexDefinitionTests.definitions {\n            let test = IndexDefinitionTests(selector: #selector(verify))\n            test.definition = column\n            test.expected = expected\n            test.ifNotExists = ifNotExists\n            suite.addTest(test)\n        }\n        return suite\n    }\n\n    @objc func verify() {\n        XCTAssertEqual(definition.toSQL(ifNotExists: ifNotExists), expected)\n    }\n    #endif\n\n    func test_validate() {\n\n        let longIndex = IndexDefinition(\n                table: \"tests\",\n                name: String(repeating: \"x\", count: 65),\n                unique: false,\n                columns: [\"test_column\"],\n                where: nil,\n                orders: nil)\n\n        XCTAssertThrowsError(try longIndex.validate()) { error in\n            XCTAssertEqual(error.localizedDescription,\n                           \"Index name 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' \" +\n                           \"on table 'tests' is too long; the limit is 64 characters\")\n        }\n    }\n\n    func test_rename() {\n        let index = IndexDefinition(table: \"tests\", name: \"index_tests_something\",\n                                    unique: true,\n                                    columns: [\"test_column\"],\n                                    where: \"test_column IS NOT NULL\",\n                                    orders: nil)\n\n        let renamedIndex = index.renameTable(to: \"foo\")\n\n        XCTAssertEqual(renamedIndex,\n           IndexDefinition(\n                table: \"foo\",\n                name: \"index_tests_something\",\n                unique: true,\n                columns: [\"test_column\"],\n                where: \"test_column IS NOT NULL\",\n                orders: nil\n           )\n        )\n    }\n}\n\nclass ForeignKeyDefinitionTests: XCTestCase {\n    func test_toSQL() {\n        XCTAssertEqual(\n            ColumnDefinition.ForeignKey(\n                fromColumn: \"bar\",\n                toTable: \"foo\",\n                toColumn: \"bar_id\",\n                onUpdate: nil,\n                onDelete: \"SET NULL\"\n            ).toSQL(), \"\"\"\n               REFERENCES \"foo\" (\"bar_id\") ON DELETE SET NULL\n               \"\"\"\n        )\n    }\n}\n\nclass TableDefinitionTests: XCTestCase {\n    func test_quoted_columnList() {\n        let definition = TableDefinition(name: \"foo\", columns: [\n            ColumnDefinition(name: \"id\", primaryKey: .init(), type: .INTEGER, nullable: false, defaultValue: .NULL, references: nil),\n            ColumnDefinition(name: \"baz\", primaryKey: nil, type: .INTEGER, nullable: false, defaultValue: .NULL, references: nil)\n        ], indexes: [])\n\n        XCTAssertEqual(definition.quotedColumnList, \"\"\"\n                                                    \"id\", \"baz\"\n                                                    \"\"\")\n    }\n\n    func test_toSQL() {\n        let definition = TableDefinition(name: \"foo\", columns: [\n            ColumnDefinition(name: \"id\", primaryKey: .init(), type: .INTEGER, nullable: false, defaultValue: .NULL, references: nil)\n        ], indexes: [])\n\n        XCTAssertEqual(definition.toSQL(), \"\"\"\n                                           CREATE TABLE foo ( \\\"id\\\" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL )\n                                           \"\"\")\n    }\n\n    func test_toSQL_temp_table() {\n        let definition = TableDefinition(name: \"foo\", columns: [\n            ColumnDefinition(name: \"id\", primaryKey: .init(), type: .INTEGER, nullable: false, defaultValue: .NULL, references: nil)\n        ], indexes: [])\n\n        XCTAssertEqual(definition.toSQL(temporary: true), \"\"\"\n                                                          CREATE TEMPORARY TABLE foo ( \\\"id\\\" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL )\n                                                          \"\"\")\n    }\n\n    func test_copySQL() {\n        let from = TableDefinition(name: \"from_table\", columns: [\n            ColumnDefinition(name: \"id\", primaryKey: .init(), type: .INTEGER, nullable: false, defaultValue: .NULL, references: nil)\n        ], indexes: [])\n\n        let to = TableDefinition(name: \"to_table\", columns: [\n            ColumnDefinition(name: \"id\", primaryKey: .init(), type: .INTEGER, nullable: false, defaultValue: .NULL, references: nil)\n        ], indexes: [])\n\n        XCTAssertEqual(from.copySQL(to: to), \"\"\"\n                                             INSERT INTO \"to_table\" (\"id\") SELECT \"id\" FROM \"from_table\"\n                                             \"\"\")\n    }\n}\n\nclass PrimaryKeyTests: XCTestCase {\n    func test_toSQL() {\n        XCTAssertEqual(\n            ColumnDefinition.PrimaryKey(autoIncrement: false).toSQL(),\n            \"PRIMARY KEY\"\n        )\n    }\n\n    func test_toSQL_autoincrement() {\n        XCTAssertEqual(\n            ColumnDefinition.PrimaryKey(autoIncrement: true).toSQL(),\n            \"PRIMARY KEY AUTOINCREMENT\"\n        )\n    }\n\n    func test_toSQL_on_conflict() {\n        XCTAssertEqual(\n            ColumnDefinition.PrimaryKey(autoIncrement: false, onConflict: .ROLLBACK).toSQL(),\n            \"PRIMARY KEY ON CONFLICT ROLLBACK\"\n        )\n    }\n\n    func test_fromSQL() {\n        XCTAssertEqual(\n            ColumnDefinition.PrimaryKey(sql: \"PRIMARY KEY\"),\n            ColumnDefinition.PrimaryKey(autoIncrement: false)\n        )\n    }\n\n    func test_fromSQL_invalid_sql_is_nil() {\n        XCTAssertNil(ColumnDefinition.PrimaryKey(sql: \"FOO\"))\n    }\n\n    func test_fromSQL_autoincrement() {\n        XCTAssertEqual(\n            ColumnDefinition.PrimaryKey(sql: \"PRIMARY KEY AUTOINCREMENT\"),\n            ColumnDefinition.PrimaryKey(autoIncrement: true)\n        )\n    }\n\n    func test_fromSQL_on_conflict() {\n        XCTAssertEqual(\n            ColumnDefinition.PrimaryKey(sql: \"PRIMARY KEY ON CONFLICT ROLLBACK\"),\n            ColumnDefinition.PrimaryKey(autoIncrement: false, onConflict: .ROLLBACK)\n        )\n    }\n}\n\nclass LiteralValueTests: XCTestCase {\n    func test_recognizes_TRUE() {\n        XCTAssertEqual(LiteralValue(\"TRUE\"), .TRUE)\n    }\n\n    func test_recognizes_FALSE() {\n        XCTAssertEqual(LiteralValue(\"FALSE\"), .FALSE)\n    }\n\n    func test_recognizes_NULL() {\n        XCTAssertEqual(LiteralValue(\"NULL\"), .NULL)\n    }\n\n    func test_recognizes_nil() {\n        XCTAssertEqual(LiteralValue(nil), .NULL)\n    }\n\n    func test_recognizes_CURRENT_TIME() {\n        XCTAssertEqual(LiteralValue(\"CURRENT_TIME\"), .CURRENT_TIME)\n    }\n\n    func test_recognizes_CURRENT_TIMESTAMP() {\n        XCTAssertEqual(LiteralValue(\"CURRENT_TIMESTAMP\"), .CURRENT_TIMESTAMP)\n    }\n\n    func test_recognizes_CURRENT_DATE() {\n        XCTAssertEqual(LiteralValue(\"CURRENT_DATE\"), .CURRENT_DATE)\n    }\n\n    func test_recognizes_double_quote_string_literals() {\n        XCTAssertEqual(LiteralValue(\"\\\"foo\\\"\"), .stringLiteral(\"foo\"))\n    }\n\n    func test_recognizes_single_quote_string_literals() {\n        XCTAssertEqual(LiteralValue(\"\\'foo\\'\"), .stringLiteral(\"foo\"))\n    }\n\n    func test_unquotes_double_quote_string_literals() {\n        XCTAssertEqual(LiteralValue(\"\\\"fo\\\"\\\"o\\\"\"), .stringLiteral(\"fo\\\"o\"))\n    }\n\n    func test_unquotes_single_quote_string_literals() {\n        XCTAssertEqual(LiteralValue(\"'fo''o'\"), .stringLiteral(\"fo'o\"))\n    }\n\n    func test_recognizes_numeric_literals() {\n        XCTAssertEqual(LiteralValue(\"1.2\"), .numericLiteral(\"1.2\"))\n        XCTAssertEqual(LiteralValue(\"0xdeadbeef\"), .numericLiteral(\"0xdeadbeef\"))\n    }\n\n    func test_recognizes_blob_literals() {\n        XCTAssertEqual(LiteralValue(\"X'deadbeef'\"), .blobLiteral(\"deadbeef\"))\n        XCTAssertEqual(LiteralValue(\"x'deadbeef'\"), .blobLiteral(\"deadbeef\"))\n    }\n\n    func test_description_TRUE() {\n        XCTAssertEqual(LiteralValue.TRUE.description, \"TRUE\")\n    }\n\n    func test_description_FALSE() {\n        XCTAssertEqual(LiteralValue.FALSE.description, \"FALSE\")\n    }\n\n    func test_description_NULL() {\n        XCTAssertEqual(LiteralValue.NULL.description, \"NULL\")\n    }\n\n    func test_description_CURRENT_TIME() {\n        XCTAssertEqual(LiteralValue.CURRENT_TIME.description, \"CURRENT_TIME\")\n    }\n\n    func test_description_CURRENT_TIMESTAMP() {\n        XCTAssertEqual(LiteralValue.CURRENT_TIMESTAMP.description, \"CURRENT_TIMESTAMP\")\n    }\n\n    func test_description_CURRENT_DATE() {\n        XCTAssertEqual(LiteralValue.CURRENT_DATE.description, \"CURRENT_DATE\")\n    }\n\n    func test_description_string_literal() {\n        XCTAssertEqual(LiteralValue.stringLiteral(\"foo\").description, \"'foo'\")\n    }\n\n    func test_description_numeric_literal() {\n        XCTAssertEqual(LiteralValue.numericLiteral(\"1.2\").description, \"1.2\")\n        XCTAssertEqual(LiteralValue.numericLiteral(\"0xdeadbeef\").description, \"0xdeadbeef\")\n    }\n\n    func test_description_blob_literal() {\n        XCTAssertEqual(LiteralValue.blobLiteral(\"deadbeef\").description, \"X'deadbeef'\")\n    }\n}\n"
  },
  {
    "path": "Tests/SQLiteTests/Schema/SchemaReaderTests.swift",
    "content": "import XCTest\n@testable import SQLite\n\nclass SchemaReaderTests: SQLiteTestCase {\n    private var schemaReader: SchemaReader!\n\n    override func setUpWithError() throws {\n        try super.setUpWithError()\n        try createUsersTable()\n\n        schemaReader = db.schema\n    }\n\n    func test_columnDefinitions() throws {\n        let columns = try schemaReader.columnDefinitions(table: \"users\")\n        XCTAssertEqual(columns, [\n            ColumnDefinition(name: \"id\",\n                             primaryKey: .init(autoIncrement: false, onConflict: nil),\n                             type: .INTEGER,\n                             nullable: true,\n                             unique: false,\n                             defaultValue: .NULL,\n                             references: nil),\n            ColumnDefinition(name: \"email\",\n                             primaryKey: nil,\n                             type: .TEXT,\n                             nullable: false,\n                             unique: true,\n                             defaultValue: .NULL,\n                             references: nil),\n            ColumnDefinition(name: \"age\",\n                             primaryKey: nil,\n                             type: .INTEGER,\n                             nullable: true,\n                             unique: false,\n                             defaultValue: .NULL,\n                             references: nil),\n            ColumnDefinition(name: \"salary\",\n                             primaryKey: nil,\n                             type: .REAL,\n                             nullable: true,\n                             unique: false,\n                             defaultValue: .NULL,\n                             references: nil),\n            ColumnDefinition(name: \"admin\",\n                             primaryKey: nil,\n                             type: .NUMERIC,\n                             nullable: false,\n                             unique: false,\n                             defaultValue: .numericLiteral(\"0\"),\n                             references: nil),\n            ColumnDefinition(name: \"manager_id\",\n                             primaryKey: nil, type: .INTEGER,\n                             nullable: true,\n                             unique: false,\n                             defaultValue: .NULL,\n                             references: .init(fromColumn: \"manager_id\", toTable: \"users\", toColumn: \"id\", onUpdate: nil, onDelete: nil)),\n            ColumnDefinition(name: \"created_at\",\n                             primaryKey: nil,\n                             type: .NUMERIC,\n                             nullable: true,\n                             unique: false,\n                             defaultValue: .NULL,\n                             references: nil)\n        ])\n    }\n\n    func test_columnDefinitions_parses_conflict_modifier() throws {\n        try db.run(\"CREATE TABLE t (\\\"id\\\" INTEGER PRIMARY KEY ON CONFLICT IGNORE AUTOINCREMENT)\")\n\n        XCTAssertEqual(\n            try schemaReader.columnDefinitions(table: \"t\"), [\n            ColumnDefinition(\n                name: \"id\",\n                primaryKey: .init(autoIncrement: true, onConflict: .IGNORE),\n                type: .INTEGER,\n                nullable: true,\n                unique: false,\n                defaultValue: .NULL,\n                references: nil)\n            ]\n        )\n    }\n\n    func test_columnDefinitions_parses_unique() throws {\n        try db.run(\"CREATE TABLE t (name TEXT UNIQUE)\")\n\n        let columns = try schemaReader.columnDefinitions(table: \"t\")\n        XCTAssertEqual(columns, [\n            ColumnDefinition(\n                name: \"name\",\n                primaryKey: nil,\n                type: .TEXT,\n                nullable: true,\n                unique: true,\n                defaultValue: .NULL,\n                references: nil)\n            ]\n        )\n    }\n\n    func test_columnDefinitions_detects_missing_autoincrement() throws {\n        try db.run(\"CREATE TABLE t (\\\"id\\\" INTEGER PRIMARY KEY)\")\n\n        XCTAssertEqual(\n            try schemaReader.columnDefinitions(table: \"t\"), [\n            ColumnDefinition(\n                    name: \"id\",\n                    primaryKey: .init(autoIncrement: false),\n                    type: .INTEGER,\n                    nullable: true,\n                    defaultValue: .NULL,\n                    references: nil)\n            ]\n        )\n    }\n\n    func test_columnDefinitions_composite_primary_keys() throws {\n        try db.run(\"\"\"\n        CREATE TABLE t (\n          col1 INTEGER,\n          col2 INTEGER,\n          col3 INTEGER,\n          PRIMARY KEY (col1, col2)\n        );\n        \"\"\")\n\n        XCTAssertEqual(\n            try schemaReader.columnDefinitions(table: \"t\"), [\n            ColumnDefinition(\n                    name: \"col1\",\n                    primaryKey: .init(autoIncrement: false),\n                    type: .INTEGER,\n                    nullable: true,\n                    defaultValue: .NULL,\n                    references: nil),\n            ColumnDefinition(\n                    name: \"col2\",\n                    primaryKey: .init(autoIncrement: false),\n                    type: .INTEGER,\n                    nullable: true,\n                    defaultValue: .NULL,\n                    references: nil),\n            ColumnDefinition(\n                    name: \"col3\",\n                    primaryKey: nil,\n                    type: .INTEGER,\n                    nullable: true,\n                    defaultValue: .NULL,\n                    references: nil)\n            ]\n        )\n    }\n\n    func test_indexDefinitions_no_index() throws {\n        let indexes = try schemaReader.indexDefinitions(table: \"users\").filter { !$0.isInternal }\n        XCTAssertTrue(indexes.isEmpty)\n    }\n\n    func test_indexDefinitions_with_index() throws {\n        try db.run(\"CREATE UNIQUE INDEX index_users ON users (age DESC) WHERE age IS NOT NULL\")\n        let indexes = try schemaReader.indexDefinitions(table: \"users\").filter { !$0.isInternal }\n\n        XCTAssertEqual(indexes, [\n            IndexDefinition(\n                table: \"users\",\n                name: \"index_users\",\n                unique: true,\n                columns: [\"age\"],\n                where: \"age IS NOT NULL\",\n                orders: [\"age\": .DESC],\n                origin: .createIndex\n            )\n        ])\n    }\n\n    func test_foreignKeys_info_empty() throws {\n        try db.run(\"CREATE TABLE t (\\\"id\\\" INTEGER PRIMARY KEY)\")\n\n        let foreignKeys = try schemaReader.foreignKeys(table: \"t\")\n        XCTAssertTrue(foreignKeys.isEmpty)\n    }\n\n    func test_foreignKeys() throws {\n        let linkTable = Table(\"test_links\")\n\n        let idColumn = SQLite.Expression<Int64>(\"id\")\n        let testIdColumn = SQLite.Expression<Int64>(\"test_id\")\n\n        try db.run(linkTable.create(block: { definition in\n            definition.column(idColumn, primaryKey: .autoincrement)\n            definition.column(testIdColumn, unique: false, check: nil, references: users, SQLite.Expression<Int64>(\"id\"))\n        }))\n\n        let foreignKeys = try schemaReader.foreignKeys(table: \"test_links\")\n        XCTAssertEqual(foreignKeys, [\n            .init(fromColumn: \"test_id\", toTable: \"users\", toColumn: \"id\", onUpdate: nil, onDelete: nil)\n        ])\n    }\n\n    func test_foreignKeys_references_column() throws {\n        let sql = \"\"\"\n          CREATE TABLE artist(\n            artistid    INTEGER PRIMARY KEY,\n            artistname  TEXT\n          );\n          CREATE TABLE track(\n            trackid     INTEGER,\n            trackname   TEXT,\n            trackartist INTEGER REFERENCES artist(artistid)\n          );\n          \"\"\"\n        try db.execute(sql)\n        let trackColumns = try db.schema.foreignKeys(table: \"track\")\n        XCTAssertEqual(trackColumns.map { $0.toSQL() }.joined(separator: \"\\n\"), \"\"\"\n            REFERENCES \"artist\" (\"artistid\")\n            \"\"\")\n    }\n\n    func test_foreignKeys_references_null_column() throws {\n        let sql = \"\"\"\n          CREATE TABLE artist(\n            artistid    INTEGER PRIMARY KEY,\n            artistname  TEXT\n          );\n          CREATE TABLE track(\n            trackid     INTEGER,\n            trackname   TEXT,\n            trackartist INTEGER REFERENCES artist\n          );\n          \"\"\"\n        try db.execute(sql)\n        let trackColumns = try db.schema.foreignKeys(table: \"track\")\n        XCTAssertEqual(trackColumns.map { $0.toSQL() }.joined(separator: \"\\n\"), \"\"\"\n            REFERENCES \"artist\"\n            \"\"\")\n    }\n\n    func test_tableDefinitions() throws {\n        let tables = try schemaReader.tableDefinitions()\n        XCTAssertEqual(tables.count, 1)\n        XCTAssertEqual(tables.first?.name, \"users\")\n    }\n\n    func test_objectDefinitions() throws {\n        let tables = try schemaReader.objectDefinitions()\n\n        XCTAssertEqual(tables.map { table in [table.name, table.tableName, table.type.rawValue]}, [\n            [\"users\", \"users\", \"table\"],\n            [\"sqlite_autoindex_users_1\", \"users\", \"index\"]\n        ])\n    }\n\n    func test_objectDefinitions_temporary() throws {\n        let tables = try schemaReader.objectDefinitions(temp: true)\n        XCTAssert(tables.isEmpty)\n\n        try db.run(\"CREATE TEMPORARY TABLE foo (bar TEXT)\")\n\n        let tables2 = try schemaReader.objectDefinitions(temp: true)\n        XCTAssertEqual(tables2.map { table in [table.name, table.tableName, table.type.rawValue]}, [\n            [\"foo\", \"foo\", \"table\"]\n        ])\n    }\n\n    func test_objectDefinitions_indexes() throws {\n        let emailIndex = users.createIndex(SQLite.Expression<String>(\"email\"), unique: false, ifNotExists: true)\n        try db.run(emailIndex)\n\n        let indexes = try schemaReader.objectDefinitions(type: .index)\n            .filter { !$0.isInternal }\n\n        XCTAssertEqual(indexes.map { index in [index.name, index.tableName, index.type.rawValue, index.sql]}, [\n            [\"index_users_on_email\",\n             \"users\",\n             \"index\",\n             \"CREATE INDEX \\\"index_users_on_email\\\" ON \\\"users\\\" (\\\"email\\\")\"]\n        ])\n    }\n\n    func test_objectDefinitions_triggers() throws {\n        let trigger = \"\"\"\n        CREATE TRIGGER test_trigger\n            AFTER INSERT ON users BEGIN\n                UPDATE USERS SET name = \"update\" WHERE id = NEW.rowid;\n            END;\n        \"\"\"\n\n        try db.run(trigger)\n\n        let triggers = try schemaReader.objectDefinitions(type: .trigger)\n\n        XCTAssertEqual(triggers.map { trigger in [trigger.name, trigger.tableName, trigger.type.rawValue]}, [\n            [\"test_trigger\", \"users\", \"trigger\"]\n        ])\n    }\n\n    func test_objectDefinitionsFilterByType() throws {\n        let tables = try schemaReader.objectDefinitions(type: .table)\n\n        XCTAssertEqual(tables.map { table in [table.name, table.tableName, table.type.rawValue]}, [\n            [\"users\", \"users\", \"table\"]\n        ])\n        XCTAssertTrue((try schemaReader.objectDefinitions(type: .trigger)).isEmpty)\n    }\n\n    func test_objectDefinitionsFilterByName() throws {\n        let tables = try schemaReader.objectDefinitions(name: \"users\")\n\n        XCTAssertEqual(tables.map { table in [table.name, table.tableName, table.type.rawValue]}, [\n            [\"users\", \"users\", \"table\"]\n        ])\n        XCTAssertTrue((try schemaReader.objectDefinitions(name: \"xxx\")).isEmpty)\n    }\n}\n"
  },
  {
    "path": "Tests/SQLiteTests/Schema/SchemaTests.swift",
    "content": "import XCTest\nimport SQLite\n\nclass SchemaTests: XCTestCase {\n\n    func test_drop_compilesDropTableExpression() {\n        XCTAssertEqual(\"DROP TABLE \\\"table\\\"\", table.drop())\n        XCTAssertEqual(\"DROP TABLE IF EXISTS \\\"table\\\"\", table.drop(ifExists: true))\n    }\n\n    func test_drop_compilesDropVirtualTableExpression() {\n        XCTAssertEqual(\"DROP TABLE \\\"virtual_table\\\"\", virtualTable.drop())\n        XCTAssertEqual(\"DROP TABLE IF EXISTS \\\"virtual_table\\\"\", virtualTable.drop(ifExists: true))\n    }\n\n    func test_drop_compilesDropViewExpression() {\n        XCTAssertEqual(\"DROP VIEW \\\"view\\\"\", _view.drop())\n        XCTAssertEqual(\"DROP VIEW IF EXISTS \\\"view\\\"\", _view.drop(ifExists: true))\n    }\n\n    func test_create_withBuilder_compilesCreateTableExpression() {\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\" +\n                \"\\\"blob\\\" BLOB NOT NULL, \" +\n                \"\\\"blobOptional\\\" BLOB, \" +\n                \"\\\"double\\\" REAL NOT NULL, \" +\n                \"\\\"doubleOptional\\\" REAL, \" +\n                \"\\\"int64\\\" INTEGER NOT NULL, \" +\n                \"\\\"int64Optional\\\" INTEGER, \" +\n                \"\\\"string\\\" TEXT NOT NULL, \" +\n                \"\\\"stringOptional\\\" TEXT\" +\n            \")\",\n            table.create { t in\n                t.column(data)\n                t.column(dataOptional)\n                t.column(double)\n                t.column(doubleOptional)\n                t.column(int64)\n                t.column(int64Optional)\n                t.column(string)\n                t.column(stringOptional)\n            }\n        )\n        XCTAssertEqual(\n            \"CREATE TEMPORARY TABLE \\\"table\\\" (\\\"int64\\\" INTEGER NOT NULL)\",\n            table.create(temporary: true) { $0.column(int64) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE IF NOT EXISTS \\\"table\\\" (\\\"int64\\\" INTEGER NOT NULL)\",\n            table.create(ifNotExists: true) { $0.column(int64) }\n        )\n        XCTAssertEqual(\n            \"CREATE TEMPORARY TABLE IF NOT EXISTS \\\"table\\\" (\\\"int64\\\" INTEGER NOT NULL)\",\n            table.create(temporary: true, ifNotExists: true) { $0.column(int64) }\n        )\n\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64\\\" INTEGER NOT NULL) WITHOUT ROWID\",\n            table.create(withoutRowid: true) { $0.column(int64) }\n        )\n        XCTAssertEqual(\n            \"CREATE TEMPORARY TABLE IF NOT EXISTS \\\"table\\\" (\\\"int64\\\" INTEGER NOT NULL) WITHOUT ROWID\",\n            table.create(temporary: true, ifNotExists: true, withoutRowid: true) { $0.column(int64) }\n        )\n    }\n\n    func test_create_withQuery_compilesCreateTableExpression() {\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" AS SELECT \\\"int64\\\" FROM \\\"view\\\"\",\n            table.create(_view.select(int64))\n        )\n    }\n\n    // thoroughness test for ambiguity\n    // swiftlint:disable:next function_body_length\n    func test_column_compilesColumnDefinitionExpression() {\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64\\\" INTEGER NOT NULL)\",\n            table.create { t in t.column(int64) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64\\\" INTEGER NOT NULL UNIQUE)\",\n            table.create { t in t.column(int64, unique: true) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64\\\" INTEGER NOT NULL CHECK (\\\"int64\\\" > 0))\",\n            table.create { t in t.column(int64, check: int64 > 0) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64\\\" INTEGER NOT NULL CHECK (\\\"int64Optional\\\" > 0))\",\n            table.create { t in t.column(int64, check: int64Optional > 0) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64\\\" INTEGER NOT NULL DEFAULT (\\\"int64\\\"))\",\n            table.create { t in t.column(int64, defaultValue: int64) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64\\\" INTEGER NOT NULL DEFAULT (0))\",\n            table.create { t in t.column(int64, defaultValue: 0) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64\\\" INTEGER NOT NULL UNIQUE CHECK (\\\"int64\\\" > 0))\",\n            table.create { t in t.column(int64, unique: true, check: int64 > 0) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64\\\" INTEGER NOT NULL UNIQUE CHECK (\\\"int64Optional\\\" > 0))\",\n            table.create { t in t.column(int64, unique: true, check: int64Optional > 0) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64\\\" INTEGER NOT NULL UNIQUE DEFAULT (\\\"int64\\\"))\",\n            table.create { t in t.column(int64, unique: true, defaultValue: int64) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64\\\" INTEGER NOT NULL UNIQUE DEFAULT (0))\",\n            table.create { t in t.column(int64, unique: true, defaultValue: 0) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64\\\" INTEGER NOT NULL UNIQUE CHECK (\\\"int64\\\" > 0))\",\n            table.create { t in t.column(int64, unique: true, check: int64 > 0) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64\\\" INTEGER NOT NULL UNIQUE CHECK (\\\"int64Optional\\\" > 0))\",\n            table.create { t in t.column(int64, unique: true, check: int64Optional > 0) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64\\\" INTEGER NOT NULL UNIQUE CHECK (\\\"int64\\\" > 0) DEFAULT (\\\"int64\\\"))\",\n            table.create { t in t.column(int64, unique: true, check: int64 > 0, defaultValue: int64) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64\\\" INTEGER NOT NULL UNIQUE CHECK (\\\"int64Optional\\\" > 0) DEFAULT (\\\"int64\\\"))\",\n            table.create { t in t.column(int64, unique: true, check: int64Optional > 0, defaultValue: int64) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64\\\" INTEGER NOT NULL UNIQUE CHECK (\\\"int64\\\" > 0) DEFAULT (0))\",\n            table.create { t in t.column(int64, unique: true, check: int64 > 0, defaultValue: 0) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64\\\" INTEGER NOT NULL UNIQUE CHECK (\\\"int64Optional\\\" > 0) DEFAULT (0))\",\n            table.create { t in t.column(int64, unique: true, check: int64Optional > 0, defaultValue: 0) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64\\\" INTEGER NOT NULL CHECK (\\\"int64\\\" > 0) DEFAULT (\\\"int64\\\"))\",\n            table.create { t in t.column(int64, check: int64 > 0, defaultValue: int64) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64\\\" INTEGER NOT NULL CHECK (\\\"int64Optional\\\" > 0) DEFAULT (\\\"int64\\\"))\",\n            table.create { t in t.column(int64, check: int64Optional > 0, defaultValue: int64) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64\\\" INTEGER NOT NULL CHECK (\\\"int64\\\" > 0) DEFAULT (0))\",\n            table.create { t in t.column(int64, check: int64 > 0, defaultValue: 0) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64\\\" INTEGER NOT NULL CHECK (\\\"int64Optional\\\" > 0) DEFAULT (0))\",\n            table.create { t in t.column(int64, check: int64Optional > 0, defaultValue: 0) }\n        )\n\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64\\\" INTEGER PRIMARY KEY NOT NULL CHECK (\\\"int64\\\" > 0))\",\n            table.create { t in t.column(int64, primaryKey: true, check: int64 > 0) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64\\\" INTEGER PRIMARY KEY NOT NULL CHECK (\\\"int64Optional\\\" > 0))\",\n            table.create { t in t.column(int64, primaryKey: true, check: int64Optional > 0) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64\\\" INTEGER PRIMARY KEY NOT NULL DEFAULT (\\\"int64\\\"))\",\n            table.create { t in t.column(int64, primaryKey: true, defaultValue: int64) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64\\\" INTEGER PRIMARY KEY NOT NULL CHECK (\\\"int64\\\" > 0))\",\n            table.create { t in t.column(int64, primaryKey: true, check: int64 > 0) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64\\\" INTEGER PRIMARY KEY NOT NULL CHECK (\\\"int64Optional\\\" > 0))\",\n            table.create { t in t.column(int64, primaryKey: true, check: int64Optional > 0) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64\\\" INTEGER PRIMARY KEY NOT NULL CHECK (\\\"int64\\\" > 0) DEFAULT (\\\"int64\\\"))\",\n            table.create { t in t.column(int64, primaryKey: true, check: int64 > 0, defaultValue: int64) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64\\\" INTEGER PRIMARY KEY NOT NULL CHECK (\\\"int64Optional\\\" > 0) DEFAULT (\\\"int64\\\"))\",\n            table.create { t in t.column(int64, primaryKey: true, check: int64Optional > 0, defaultValue: int64) }\n        )\n\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64Optional\\\" INTEGER)\",\n            table.create { t in t.column(int64Optional) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64Optional\\\" INTEGER UNIQUE)\",\n            table.create { t in t.column(int64Optional, unique: true) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64Optional\\\" INTEGER CHECK (\\\"int64\\\" > 0))\",\n            table.create { t in t.column(int64Optional, check: int64 > 0) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64Optional\\\" INTEGER CHECK (\\\"int64Optional\\\" > 0))\",\n            table.create { t in t.column(int64Optional, check: int64Optional > 0) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64Optional\\\" INTEGER DEFAULT (\\\"int64\\\"))\",\n            table.create { t in t.column(int64Optional, defaultValue: int64) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64Optional\\\" INTEGER DEFAULT (\\\"int64Optional\\\"))\",\n            table.create { t in t.column(int64Optional, defaultValue: int64Optional) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64Optional\\\" INTEGER DEFAULT (0))\",\n            table.create { t in t.column(int64Optional, defaultValue: 0) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64Optional\\\" INTEGER UNIQUE CHECK (\\\"int64\\\" > 0))\",\n            table.create { t in t.column(int64Optional, unique: true, check: int64 > 0) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64Optional\\\" INTEGER UNIQUE CHECK (\\\"int64Optional\\\" > 0))\",\n            table.create { t in t.column(int64Optional, unique: true, check: int64Optional > 0) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64Optional\\\" INTEGER UNIQUE DEFAULT (\\\"int64\\\"))\",\n            table.create { t in t.column(int64Optional, unique: true, defaultValue: int64) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64Optional\\\" INTEGER UNIQUE DEFAULT (\\\"int64Optional\\\"))\",\n            table.create { t in t.column(int64Optional, unique: true, defaultValue: int64Optional) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64Optional\\\" INTEGER UNIQUE DEFAULT (0))\",\n            table.create { t in t.column(int64Optional, unique: true, defaultValue: 0) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64Optional\\\" INTEGER UNIQUE CHECK (\\\"int64\\\" > 0))\",\n            table.create { t in t.column(int64Optional, unique: true, check: int64 > 0) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64Optional\\\" INTEGER UNIQUE CHECK (\\\"int64Optional\\\" > 0))\",\n            table.create { t in t.column(int64Optional, unique: true, check: int64Optional > 0) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64Optional\\\" INTEGER UNIQUE CHECK (\\\"int64\\\" > 0) DEFAULT (\\\"int64\\\"))\",\n            table.create { t in t.column(int64Optional, unique: true, check: int64 > 0, defaultValue: int64) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64Optional\\\" INTEGER UNIQUE CHECK (\\\"int64\\\" > 0) DEFAULT (\\\"int64Optional\\\"))\",\n            table.create { t in t.column(int64Optional, unique: true, check: int64 > 0, defaultValue: int64Optional) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64Optional\\\" INTEGER UNIQUE CHECK (\\\"int64Optional\\\" > 0) DEFAULT (\\\"int64\\\"))\",\n            table.create { t in t.column(int64Optional, unique: true, check: int64Optional > 0, defaultValue: int64) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64Optional\\\" INTEGER UNIQUE CHECK (\\\"int64Optional\\\" > 0) DEFAULT (\\\"int64Optional\\\"))\",\n            table.create { t in t.column(int64Optional, unique: true, check: int64Optional > 0, defaultValue: int64Optional) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64Optional\\\" INTEGER UNIQUE CHECK (\\\"int64\\\" > 0) DEFAULT (0))\",\n            table.create { t in t.column(int64Optional, unique: true, check: int64 > 0, defaultValue: 0) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64Optional\\\" INTEGER UNIQUE CHECK (\\\"int64Optional\\\" > 0) DEFAULT (0))\",\n            table.create { t in t.column(int64Optional, unique: true, check: int64Optional > 0, defaultValue: 0) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64Optional\\\" INTEGER CHECK (\\\"int64\\\" > 0) DEFAULT (\\\"int64\\\"))\",\n            table.create { t in t.column(int64Optional, check: int64 > 0, defaultValue: int64) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64Optional\\\" INTEGER CHECK (\\\"int64Optional\\\" > 0) DEFAULT (\\\"int64\\\"))\",\n            table.create { t in t.column(int64Optional, check: int64Optional > 0, defaultValue: int64) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64Optional\\\" INTEGER CHECK (\\\"int64\\\" > 0) DEFAULT (\\\"int64Optional\\\"))\",\n            table.create { t in t.column(int64Optional, check: int64 > 0, defaultValue: int64Optional) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64Optional\\\" INTEGER CHECK (\\\"int64Optional\\\" > 0) DEFAULT (\\\"int64Optional\\\"))\",\n            table.create { t in t.column(int64Optional, check: int64Optional > 0, defaultValue: int64Optional) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64Optional\\\" INTEGER CHECK (\\\"int64\\\" > 0) DEFAULT (0))\",\n            table.create { t in t.column(int64Optional, check: int64 > 0, defaultValue: 0) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64Optional\\\" INTEGER CHECK (\\\"int64Optional\\\" > 0) DEFAULT (0))\",\n            table.create { t in t.column(int64Optional, check: int64Optional > 0, defaultValue: 0) }\n        )\n    }\n\n    func test_column_withIntegerExpression_compilesPrimaryKeyAutoincrementColumnDefinitionExpression() {\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64\\\" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL)\",\n            table.create { t in t.column(int64, primaryKey: .autoincrement) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64\\\" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL CHECK (\\\"int64\\\" > 0))\",\n            table.create { t in t.column(int64, primaryKey: .autoincrement, check: int64 > 0) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64\\\" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL CHECK (\\\"int64Optional\\\" > 0))\",\n            table.create { t in t.column(int64, primaryKey: .autoincrement, check: int64Optional > 0) }\n        )\n    }\n\n    func test_column_withIntegerExpression_compilesReferentialColumnDefinitionExpression() {\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64\\\" INTEGER NOT NULL REFERENCES \\\"table\\\" (\\\"int64\\\"))\",\n            table.create { t in t.column(int64, references: table, int64) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64\\\" INTEGER NOT NULL REFERENCES \\\"table\\\" (\\\"int64\\\"))\",\n            table.create { t in t.column(int64, references: qualifiedTable, int64) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64\\\" INTEGER NOT NULL UNIQUE REFERENCES \\\"table\\\" (\\\"int64\\\"))\",\n            table.create { t in t.column(int64, unique: true, references: table, int64) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64\\\" INTEGER PRIMARY KEY NOT NULL REFERENCES \\\"table\\\" (\\\"int64\\\"))\",\n            table.create { t in t.column(int64, primaryKey: true, references: table, int64) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64\\\" INTEGER NOT NULL CHECK (\\\"int64\\\" > 0) REFERENCES \\\"table\\\" (\\\"int64\\\"))\",\n            table.create { t in t.column(int64, check: int64 > 0, references: table, int64) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64\\\" INTEGER NOT NULL CHECK (\\\"int64Optional\\\" > 0) REFERENCES \\\"table\\\" (\\\"int64\\\"))\",\n            table.create { t in t.column(int64, check: int64Optional > 0, references: table, int64) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64\\\" INTEGER NOT NULL UNIQUE CHECK (\\\"int64\\\" > 0) REFERENCES \\\"table\\\" (\\\"int64\\\"))\",\n            table.create { t in t.column(int64, unique: true, check: int64 > 0, references: table, int64) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64\\\" INTEGER PRIMARY KEY NOT NULL CHECK (\\\"int64\\\" > 0) REFERENCES \\\"table\\\" (\\\"int64\\\"))\",\n            table.create { t in t.column(int64, primaryKey: true, check: int64 > 0, references: table, int64) }\n        )\n        XCTAssertEqual(\n            \"\"\"\n            CREATE TABLE \\\"table\\\" (\\\"int64\\\" INTEGER NOT NULL UNIQUE CHECK (\\\"int64Optional\\\" > 0) REFERENCES\n             \\\"table\\\" (\\\"int64\\\"))\n            \"\"\".replacingOccurrences(of: \"\\n\", with: \"\"),\n            table.create { t in t.column(int64, unique: true, check: int64Optional > 0, references: table, int64) }\n        )\n        XCTAssertEqual(\n            \"\"\"\n            CREATE TABLE \\\"table\\\" (\\\"int64\\\" INTEGER PRIMARY KEY NOT NULL CHECK (\\\"int64Optional\\\" > 0) REFERENCES\n             \\\"table\\\" (\\\"int64\\\"))\n            \"\"\".replacingOccurrences(of: \"\\n\", with: \"\"),\n            table.create { t in t.column(int64, primaryKey: true, check: int64Optional > 0, references: table, int64) }\n        )\n\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64Optional\\\" INTEGER REFERENCES \\\"table\\\" (\\\"int64\\\"))\",\n            table.create { t in t.column(int64Optional, references: table, int64) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64Optional\\\" INTEGER UNIQUE REFERENCES \\\"table\\\" (\\\"int64\\\"))\",\n            table.create { t in t.column(int64Optional, unique: true, references: table, int64) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64Optional\\\" INTEGER PRIMARY KEY REFERENCES \\\"table\\\" (\\\"int64\\\"))\",\n            table.create { t in t.column(int64Optional, primaryKey: true, references: table, int64) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64Optional\\\" INTEGER CHECK (\\\"int64\\\" > 0) REFERENCES \\\"table\\\" (\\\"int64\\\"))\",\n            table.create { t in t.column(int64Optional, check: int64 > 0, references: table, int64) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64Optional\\\" INTEGER CHECK (\\\"int64Optional\\\" > 0) REFERENCES \\\"table\\\" (\\\"int64\\\"))\",\n            table.create { t in t.column(int64Optional, check: int64Optional > 0, references: table, int64) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64Optional\\\" INTEGER UNIQUE CHECK (\\\"int64\\\" > 0) REFERENCES \\\"table\\\" (\\\"int64\\\"))\",\n            table.create { t in t.column(int64Optional, unique: true, check: int64 > 0, references: table, int64) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64Optional\\\" INTEGER PRIMARY KEY CHECK (\\\"int64\\\" > 0) REFERENCES \\\"table\\\" (\\\"int64\\\"))\",\n            table.create { t in t.column(int64Optional, primaryKey: true, check: int64 > 0, references: table, int64) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64Optional\\\" INTEGER UNIQUE CHECK (\\\"int64Optional\\\" > 0) REFERENCES \\\"table\\\" (\\\"int64\\\"))\",\n            table.create { t in t.column(int64Optional, unique: true, check: int64Optional > 0, references: table, int64) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"int64Optional\\\" INTEGER PRIMARY KEY CHECK (\\\"int64Optional\\\" > 0) REFERENCES \\\"table\\\" (\\\"int64\\\"))\",\n            table.create { t in t.column(int64Optional, primaryKey: true, check: int64Optional > 0, references: table, int64) }\n        )\n    }\n\n    // swiftlint:disable:next function_body_length\n    func test_column_withStringExpression_compilesCollatedColumnDefinitionExpression() {\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"string\\\" TEXT NOT NULL COLLATE RTRIM)\",\n            table.create { t in t.column(string, collate: .rtrim) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"string\\\" TEXT NOT NULL UNIQUE COLLATE RTRIM)\",\n            table.create { t in t.column(string, unique: true, collate: .rtrim) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"string\\\" TEXT NOT NULL CHECK (\\\"string\\\" != '') COLLATE RTRIM)\",\n            table.create { t in t.column(string, check: string != \"\", collate: .rtrim) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"string\\\" TEXT NOT NULL CHECK (\\\"stringOptional\\\" != '') COLLATE RTRIM)\",\n            table.create { t in t.column(string, check: stringOptional != \"\", collate: .rtrim) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"string\\\" TEXT NOT NULL DEFAULT (\\\"string\\\") COLLATE RTRIM)\",\n            table.create { t in t.column(string, defaultValue: string, collate: .rtrim) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"string\\\" TEXT NOT NULL DEFAULT ('string') COLLATE RTRIM)\",\n            table.create { t in t.column(string, defaultValue: \"string\", collate: .rtrim) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"string\\\" TEXT NOT NULL UNIQUE CHECK (\\\"string\\\" != '') COLLATE RTRIM)\",\n            table.create { t in t.column(string, unique: true, check: string != \"\", collate: .rtrim) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"string\\\" TEXT NOT NULL UNIQUE CHECK (\\\"stringOptional\\\" != '') COLLATE RTRIM)\",\n            table.create { t in t.column(string, unique: true, check: stringOptional != \"\", collate: .rtrim) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"string\\\" TEXT NOT NULL UNIQUE DEFAULT (\\\"string\\\") COLLATE RTRIM)\",\n            table.create { t in t.column(string, unique: true, defaultValue: string, collate: .rtrim) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"string\\\" TEXT NOT NULL UNIQUE DEFAULT ('string') COLLATE RTRIM)\",\n            table.create { t in t.column(string, unique: true, defaultValue: \"string\", collate: .rtrim) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"string\\\" TEXT NOT NULL UNIQUE CHECK (\\\"string\\\" != '') DEFAULT (\\\"string\\\") COLLATE RTRIM)\",\n            table.create { t in t.column(string, unique: true, check: string != \"\", defaultValue: string, collate: .rtrim) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"string\\\" TEXT NOT NULL UNIQUE CHECK (\\\"stringOptional\\\" != '') DEFAULT (\\\"string\\\") COLLATE RTRIM)\",\n            table.create { t in t.column(string, unique: true, check: stringOptional != \"\", defaultValue: string, collate: .rtrim) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"string\\\" TEXT NOT NULL UNIQUE CHECK (\\\"string\\\" != '') DEFAULT ('string') COLLATE RTRIM)\",\n            table.create { t in t.column(string, unique: true, check: string != \"\", defaultValue: \"string\", collate: .rtrim) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"string\\\" TEXT NOT NULL UNIQUE CHECK (\\\"stringOptional\\\" != '') DEFAULT ('string') COLLATE RTRIM)\",\n            table.create { t in t.column(string, unique: true, check: stringOptional != \"\", defaultValue: \"string\", collate: .rtrim) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"string\\\" TEXT NOT NULL CHECK (\\\"string\\\" != '') DEFAULT (\\\"string\\\") COLLATE RTRIM)\",\n            table.create { t in t.column(string, check: string != \"\", defaultValue: string, collate: .rtrim) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"string\\\" TEXT NOT NULL CHECK (\\\"stringOptional\\\" != '') DEFAULT (\\\"string\\\") COLLATE RTRIM)\",\n            table.create { t in t.column(string, check: stringOptional != \"\", defaultValue: string, collate: .rtrim) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"string\\\" TEXT NOT NULL CHECK (\\\"string\\\" != '') DEFAULT ('string') COLLATE RTRIM)\",\n            table.create { t in t.column(string, check: string != \"\", defaultValue: \"string\", collate: .rtrim) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"string\\\" TEXT NOT NULL CHECK (\\\"stringOptional\\\" != '') DEFAULT ('string') COLLATE RTRIM)\",\n            table.create { t in t.column(string, check: stringOptional != \"\", defaultValue: \"string\", collate: .rtrim) }\n        )\n\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"stringOptional\\\" TEXT COLLATE RTRIM)\",\n            table.create { t in t.column(stringOptional, collate: .rtrim) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"stringOptional\\\" TEXT UNIQUE COLLATE RTRIM)\",\n            table.create { t in t.column(stringOptional, unique: true, collate: .rtrim) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"stringOptional\\\" TEXT CHECK (\\\"string\\\" != '') COLLATE RTRIM)\",\n            table.create { t in t.column(stringOptional, check: string != \"\", collate: .rtrim) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"stringOptional\\\" TEXT CHECK (\\\"stringOptional\\\" != '') COLLATE RTRIM)\",\n            table.create { t in t.column(stringOptional, check: stringOptional != \"\", collate: .rtrim) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"stringOptional\\\" TEXT DEFAULT (\\\"string\\\") COLLATE RTRIM)\",\n            table.create { t in t.column(stringOptional, defaultValue: string, collate: .rtrim) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"stringOptional\\\" TEXT DEFAULT (\\\"stringOptional\\\") COLLATE RTRIM)\",\n            table.create { t in t.column(stringOptional, defaultValue: stringOptional, collate: .rtrim) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"stringOptional\\\" TEXT DEFAULT ('string') COLLATE RTRIM)\",\n            table.create { t in t.column(stringOptional, defaultValue: \"string\", collate: .rtrim) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"stringOptional\\\" TEXT UNIQUE CHECK (\\\"string\\\" != '') COLLATE RTRIM)\",\n            table.create { t in t.column(stringOptional, unique: true, check: string != \"\", collate: .rtrim) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"stringOptional\\\" TEXT UNIQUE CHECK (\\\"stringOptional\\\" != '') COLLATE RTRIM)\",\n            table.create { t in t.column(stringOptional, unique: true, check: stringOptional != \"\", collate: .rtrim) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"stringOptional\\\" TEXT UNIQUE DEFAULT (\\\"string\\\") COLLATE RTRIM)\",\n            table.create { t in t.column(stringOptional, unique: true, defaultValue: string, collate: .rtrim) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"stringOptional\\\" TEXT UNIQUE DEFAULT (\\\"stringOptional\\\") COLLATE RTRIM)\",\n            table.create { t in t.column(stringOptional, unique: true, defaultValue: stringOptional, collate: .rtrim) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"stringOptional\\\" TEXT UNIQUE DEFAULT ('string') COLLATE RTRIM)\",\n            table.create { t in t.column(stringOptional, unique: true, defaultValue: \"string\", collate: .rtrim) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (\\\"stringOptional\\\" TEXT UNIQUE CHECK (\\\"string\\\" != '') DEFAULT (\\\"string\\\") COLLATE RTRIM)\",\n            table.create { t in t.column(stringOptional, unique: true, check: string != \"\", defaultValue: string, collate: .rtrim) }\n        )\n        XCTAssertEqual(\n            \"\"\"\n            CREATE TABLE \\\"table\\\" (\\\"stringOptional\\\" TEXT UNIQUE CHECK (\\\"string\\\" != '')\n             DEFAULT (\\\"stringOptional\\\") COLLATE RTRIM)\n            \"\"\".replacingOccurrences(of: \"\\n\", with: \"\"),\n            table.create { t in t.column(stringOptional,\n                                         unique: true,\n                                         check: string != \"\",\n                                         defaultValue: stringOptional,\n                                         collate: .rtrim) }\n        )\n        XCTAssertEqual(\n            \"\"\"\n            CREATE TABLE \\\"table\\\" (\\\"stringOptional\\\" TEXT UNIQUE CHECK (\\\"stringOptional\\\" != '')\n             DEFAULT (\\\"string\\\") COLLATE RTRIM)\n            \"\"\".replacingOccurrences(of: \"\\n\", with: \"\"),\n            table.create { t in t.column(stringOptional, unique: true, check: stringOptional != \"\",\n                                         defaultValue: string, collate: .rtrim) }\n        )\n        XCTAssertEqual(\n            \"\"\"\n            CREATE TABLE \\\"table\\\" (\\\"stringOptional\\\" TEXT UNIQUE CHECK (\\\"stringOptional\\\" != '')\n             DEFAULT (\\\"stringOptional\\\") COLLATE RTRIM)\n            \"\"\".replacingOccurrences(of: \"\\n\", with: \"\"),\n            table.create { t in t.column(stringOptional, unique: true, check: stringOptional != \"\",\n                                         defaultValue: stringOptional, collate: .rtrim) }\n        )\n        XCTAssertEqual(\n            \"\"\"\n            CREATE TABLE \\\"table\\\" (\\\"stringOptional\\\" TEXT UNIQUE CHECK (\\\"string\\\" != '')\n             DEFAULT ('string') COLLATE RTRIM)\n            \"\"\".replacingOccurrences(of: \"\\n\", with: \"\"),\n            table.create { t in t.column(stringOptional, unique: true, check: string != \"\",\n                                         defaultValue: \"string\", collate: .rtrim) }\n        )\n        XCTAssertEqual(\n            \"\"\"\n            CREATE TABLE \\\"table\\\" (\\\"stringOptional\\\" TEXT UNIQUE CHECK (\\\"stringOptional\\\" != '')\n             DEFAULT ('string') COLLATE RTRIM)\n            \"\"\".replacingOccurrences(of: \"\\n\", with: \"\"),\n            table.create { t in t.column(stringOptional, unique: true, check: stringOptional != \"\",\n                                         defaultValue: \"string\", collate: .rtrim) }\n        )\n        XCTAssertEqual(\n            \"\"\"\n            CREATE TABLE \\\"table\\\" (\\\"stringOptional\\\" TEXT CHECK (\\\"string\\\" != '')\n             DEFAULT (\\\"string\\\") COLLATE RTRIM)\n            \"\"\".replacingOccurrences(of: \"\\n\", with: \"\"),\n            table.create { t in t.column(stringOptional, check: string != \"\",\n                                         defaultValue: string, collate: .rtrim) }\n        )\n        XCTAssertEqual(\n            \"\"\"\n            CREATE TABLE \\\"table\\\" (\\\"stringOptional\\\" TEXT CHECK (\\\"stringOptional\\\" != '')\n             DEFAULT (\\\"string\\\") COLLATE RTRIM)\n            \"\"\".replacingOccurrences(of: \"\\n\", with: \"\"),\n            table.create { t in t.column(stringOptional, check: stringOptional != \"\",\n                                         defaultValue: string, collate: .rtrim) }\n        )\n        XCTAssertEqual(\n            \"\"\"\n            CREATE TABLE \\\"table\\\" (\\\"stringOptional\\\" TEXT CHECK (\\\"string\\\" != '')\n             DEFAULT (\\\"stringOptional\\\") COLLATE RTRIM)\n            \"\"\".replacingOccurrences(of: \"\\n\", with: \"\"),\n            table.create { t in t.column(stringOptional, check: string != \"\",\n                                         defaultValue: stringOptional, collate: .rtrim) }\n        )\n        XCTAssertEqual(\n            \"\"\"\n            CREATE TABLE \\\"table\\\" (\\\"stringOptional\\\" TEXT CHECK (\\\"stringOptional\\\" != '')\n             DEFAULT (\\\"stringOptional\\\") COLLATE RTRIM)\n            \"\"\".replacingOccurrences(of: \"\\n\", with: \"\"),\n            table.create { t in t.column(stringOptional, check: stringOptional != \"\",\n                                         defaultValue: stringOptional, collate: .rtrim) }\n        )\n        XCTAssertEqual(\n            \"\"\"\n            CREATE TABLE \\\"table\\\" (\\\"stringOptional\\\" TEXT CHECK (\\\"string\\\" != '')\n             DEFAULT ('string') COLLATE RTRIM)\n            \"\"\".replacingOccurrences(of: \"\\n\", with: \"\"),\n            table.create { t in t.column(stringOptional, check: string != \"\",\n                                         defaultValue: \"string\", collate: .rtrim) }\n        )\n        XCTAssertEqual(\n            \"\"\"\n            CREATE TABLE \\\"table\\\" (\\\"stringOptional\\\" TEXT CHECK (\\\"stringOptional\\\" != '')\n             DEFAULT ('string') COLLATE RTRIM)\n            \"\"\".replacingOccurrences(of: \"\\n\", with: \"\"),\n            table.create { t in t.column(stringOptional, check: stringOptional != \"\",\n                                         defaultValue: \"string\", collate: .rtrim) }\n        )\n    }\n\n    func test_primaryKey_compilesPrimaryKeyExpression() {\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (PRIMARY KEY (\\\"int64\\\"))\",\n            table.create { t in t.primaryKey(int64) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (PRIMARY KEY (\\\"int64\\\", \\\"string\\\"))\",\n            table.create { t in t.primaryKey(int64, string) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (PRIMARY KEY (\\\"int64\\\", \\\"string\\\", \\\"double\\\"))\",\n            table.create { t in t.primaryKey(int64, string, double) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (PRIMARY KEY (\\\"int64\\\", \\\"string\\\", \\\"double\\\", \\\"date\\\"))\",\n            table.create { t in t.primaryKey(int64, string, double, date) }\n        )\n    }\n\n    func test_unique_compilesUniqueExpression() {\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (UNIQUE (\\\"int64\\\"))\",\n            table.create { t in t.unique(int64) }\n        )\n    }\n\n    func test_check_compilesCheckExpression() {\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (CHECK ((\\\"int64\\\" > 0)))\",\n            table.create { t in t.check(int64 > 0) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (CHECK ((\\\"int64Optional\\\" > 0)))\",\n            table.create { t in t.check(int64Optional > 0) }\n        )\n    }\n\n    func test_foreignKey_compilesForeignKeyExpression() {\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (FOREIGN KEY (\\\"string\\\") REFERENCES \\\"table\\\" (\\\"string\\\"))\",\n            table.create { t in t.foreignKey(string, references: table, string) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (FOREIGN KEY (\\\"stringOptional\\\") REFERENCES \\\"table\\\" (\\\"string\\\"))\",\n            table.create { t in t.foreignKey(stringOptional, references: table, string) }\n        )\n\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (FOREIGN KEY (\\\"string\\\") REFERENCES \\\"table\\\" (\\\"string\\\") ON UPDATE CASCADE ON DELETE SET NULL)\",\n            table.create { t in t.foreignKey(string, references: table, string, update: .cascade, delete: .setNull) }\n        )\n\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (FOREIGN KEY (\\\"string\\\", \\\"string\\\") REFERENCES \\\"table\\\" (\\\"string\\\", \\\"string\\\"))\",\n            table.create { t in t.foreignKey((string, string), references: table, (string, string)) }\n        )\n        XCTAssertEqual(\n            \"CREATE TABLE \\\"table\\\" (FOREIGN KEY (\\\"string\\\", \\\"string\\\", \\\"string\\\") REFERENCES \\\"table\\\" (\\\"string\\\", \\\"string\\\", \\\"string\\\"))\",\n            table.create { t in t.foreignKey((string, string, string), references: table, (string, string, string)) }\n        )\n    }\n\n    func test_addColumn_compilesAlterTableExpression() {\n        XCTAssertEqual(\n            \"ALTER TABLE \\\"table\\\" ADD COLUMN \\\"int64\\\" INTEGER NOT NULL DEFAULT (1)\",\n            table.addColumn(int64, defaultValue: 1)\n        )\n        XCTAssertEqual(\n            \"ALTER TABLE \\\"table\\\" ADD COLUMN \\\"int64\\\" INTEGER NOT NULL CHECK (\\\"int64\\\" > 0) DEFAULT (1)\",\n            table.addColumn(int64, check: int64 > 0, defaultValue: 1)\n        )\n        XCTAssertEqual(\n            \"ALTER TABLE \\\"table\\\" ADD COLUMN \\\"int64\\\" INTEGER NOT NULL CHECK (\\\"int64Optional\\\" > 0) DEFAULT (1)\",\n            table.addColumn(int64, check: int64Optional > 0, defaultValue: 1)\n        )\n\n        XCTAssertEqual(\n            \"ALTER TABLE \\\"table\\\" ADD COLUMN \\\"int64Optional\\\" INTEGER\",\n            table.addColumn(int64Optional)\n        )\n        XCTAssertEqual(\n            \"ALTER TABLE \\\"table\\\" ADD COLUMN \\\"int64Optional\\\" INTEGER CHECK (\\\"int64\\\" > 0)\",\n            table.addColumn(int64Optional, check: int64 > 0)\n        )\n        XCTAssertEqual(\n            \"ALTER TABLE \\\"table\\\" ADD COLUMN \\\"int64Optional\\\" INTEGER CHECK (\\\"int64Optional\\\" > 0)\",\n            table.addColumn(int64Optional, check: int64Optional > 0)\n        )\n        XCTAssertEqual(\n            \"ALTER TABLE \\\"table\\\" ADD COLUMN \\\"int64Optional\\\" INTEGER DEFAULT (1)\",\n            table.addColumn(int64Optional, defaultValue: 1)\n        )\n        XCTAssertEqual(\n            \"ALTER TABLE \\\"table\\\" ADD COLUMN \\\"int64Optional\\\" INTEGER CHECK (\\\"int64\\\" > 0) DEFAULT (1)\",\n            table.addColumn(int64Optional, check: int64 > 0, defaultValue: 1)\n        )\n        XCTAssertEqual(\n            \"ALTER TABLE \\\"table\\\" ADD COLUMN \\\"int64Optional\\\" INTEGER CHECK (\\\"int64Optional\\\" > 0) DEFAULT (1)\",\n            table.addColumn(int64Optional, check: int64Optional > 0, defaultValue: 1)\n        )\n    }\n\n    func test_addColumn_withIntegerExpression_compilesReferentialAlterTableExpression() {\n        XCTAssertEqual(\n            \"ALTER TABLE \\\"table\\\" ADD COLUMN \\\"int64\\\" INTEGER NOT NULL REFERENCES \\\"table\\\" (\\\"int64\\\")\",\n            table.addColumn(int64, references: table, int64)\n        )\n        XCTAssertEqual(\n            \"ALTER TABLE \\\"table\\\" ADD COLUMN \\\"int64\\\" INTEGER NOT NULL UNIQUE REFERENCES \\\"table\\\" (\\\"int64\\\")\",\n            table.addColumn(int64, unique: true, references: table, int64)\n        )\n        XCTAssertEqual(\n            \"ALTER TABLE \\\"table\\\" ADD COLUMN \\\"int64\\\" INTEGER NOT NULL CHECK (\\\"int64\\\" > 0) REFERENCES \\\"table\\\" (\\\"int64\\\")\",\n            table.addColumn(int64, check: int64 > 0, references: table, int64)\n        )\n        XCTAssertEqual(\n            \"ALTER TABLE \\\"table\\\" ADD COLUMN \\\"int64\\\" INTEGER NOT NULL CHECK (\\\"int64Optional\\\" > 0) REFERENCES \\\"table\\\" (\\\"int64\\\")\",\n            table.addColumn(int64, check: int64Optional > 0, references: table, int64)\n        )\n        XCTAssertEqual(\n            \"ALTER TABLE \\\"table\\\" ADD COLUMN \\\"int64\\\" INTEGER NOT NULL UNIQUE CHECK (\\\"int64\\\" > 0) REFERENCES \\\"table\\\" (\\\"int64\\\")\",\n            table.addColumn(int64, unique: true, check: int64 > 0, references: table, int64)\n        )\n        XCTAssertEqual(\n            \"ALTER TABLE \\\"table\\\" ADD COLUMN \\\"int64\\\" INTEGER NOT NULL UNIQUE CHECK (\\\"int64Optional\\\" > 0) REFERENCES \\\"table\\\" (\\\"int64\\\")\",\n            table.addColumn(int64, unique: true, check: int64Optional > 0, references: table, int64)\n        )\n\n        XCTAssertEqual(\n            \"ALTER TABLE \\\"table\\\" ADD COLUMN \\\"int64Optional\\\" INTEGER REFERENCES \\\"table\\\" (\\\"int64\\\")\",\n            table.addColumn(int64Optional, references: table, int64)\n        )\n        XCTAssertEqual(\n            \"ALTER TABLE \\\"table\\\" ADD COLUMN \\\"int64Optional\\\" INTEGER UNIQUE REFERENCES \\\"table\\\" (\\\"int64\\\")\",\n            table.addColumn(int64Optional, unique: true, references: table, int64)\n        )\n        XCTAssertEqual(\n            \"ALTER TABLE \\\"table\\\" ADD COLUMN \\\"int64Optional\\\" INTEGER CHECK (\\\"int64\\\" > 0) REFERENCES \\\"table\\\" (\\\"int64\\\")\",\n            table.addColumn(int64Optional, check: int64 > 0, references: table, int64)\n        )\n        XCTAssertEqual(\n            \"ALTER TABLE \\\"table\\\" ADD COLUMN \\\"int64Optional\\\" INTEGER CHECK (\\\"int64Optional\\\" > 0) REFERENCES \\\"table\\\" (\\\"int64\\\")\",\n            table.addColumn(int64Optional, check: int64Optional > 0, references: table, int64)\n        )\n        XCTAssertEqual(\n            \"ALTER TABLE \\\"table\\\" ADD COLUMN \\\"int64Optional\\\" INTEGER UNIQUE CHECK (\\\"int64\\\" > 0) REFERENCES \\\"table\\\" (\\\"int64\\\")\",\n            table.addColumn(int64Optional, unique: true, check: int64 > 0, references: table, int64)\n        )\n        XCTAssertEqual(\n            \"ALTER TABLE \\\"table\\\" ADD COLUMN \\\"int64Optional\\\" INTEGER UNIQUE CHECK (\\\"int64Optional\\\" > 0) REFERENCES \\\"table\\\" (\\\"int64\\\")\",\n            table.addColumn(int64Optional, unique: true, check: int64Optional > 0, references: table, int64)\n        )\n    }\n\n    func test_addColumn_withStringExpression_compilesCollatedAlterTableExpression() {\n        XCTAssertEqual(\n            \"ALTER TABLE \\\"table\\\" ADD COLUMN \\\"string\\\" TEXT NOT NULL DEFAULT ('string') COLLATE RTRIM\",\n            table.addColumn(string, defaultValue: \"string\", collate: .rtrim)\n        )\n        XCTAssertEqual(\n            \"ALTER TABLE \\\"table\\\" ADD COLUMN \\\"string\\\" TEXT NOT NULL CHECK (\\\"string\\\" != '') DEFAULT ('string') COLLATE RTRIM\",\n            table.addColumn(string, check: string != \"\", defaultValue: \"string\", collate: .rtrim)\n        )\n        XCTAssertEqual(\n            \"ALTER TABLE \\\"table\\\" ADD COLUMN \\\"string\\\" TEXT NOT NULL CHECK (\\\"stringOptional\\\" != '') DEFAULT ('string') COLLATE RTRIM\",\n            table.addColumn(string, check: stringOptional != \"\", defaultValue: \"string\", collate: .rtrim)\n        )\n\n        XCTAssertEqual(\n            \"ALTER TABLE \\\"table\\\" ADD COLUMN \\\"stringOptional\\\" TEXT COLLATE RTRIM\",\n            table.addColumn(stringOptional, collate: .rtrim)\n        )\n        XCTAssertEqual(\n            \"ALTER TABLE \\\"table\\\" ADD COLUMN \\\"stringOptional\\\" TEXT CHECK (\\\"string\\\" != '') COLLATE RTRIM\",\n            table.addColumn(stringOptional, check: string != \"\", collate: .rtrim)\n        )\n        XCTAssertEqual(\n            \"ALTER TABLE \\\"table\\\" ADD COLUMN \\\"stringOptional\\\" TEXT CHECK (\\\"stringOptional\\\" != '') COLLATE RTRIM\",\n            table.addColumn(stringOptional, check: stringOptional != \"\", collate: .rtrim)\n        )\n        XCTAssertEqual(\n            \"ALTER TABLE \\\"table\\\" ADD COLUMN \\\"stringOptional\\\" TEXT CHECK (\\\"string\\\" != '') DEFAULT ('string') COLLATE RTRIM\",\n            table.addColumn(stringOptional, check: string != \"\", defaultValue: \"string\", collate: .rtrim)\n        )\n        XCTAssertEqual(\n            \"ALTER TABLE \\\"table\\\" ADD COLUMN \\\"stringOptional\\\" TEXT CHECK (\\\"stringOptional\\\" != '') DEFAULT ('string') COLLATE RTRIM\",\n            table.addColumn(stringOptional, check: stringOptional != \"\", defaultValue: \"string\", collate: .rtrim)\n        )\n    }\n\n    func test_rename_compilesAlterTableRenameToExpression() {\n        XCTAssertEqual(\"ALTER TABLE \\\"old\\\" RENAME TO \\\"table\\\"\", Table(\"old\").rename(table))\n    }\n\n    func test_createIndex_compilesCreateIndexExpression() {\n        XCTAssertEqual(\"CREATE INDEX \\\"index_table_on_int64\\\" ON \\\"table\\\" (\\\"int64\\\")\", table.createIndex(int64))\n\n        XCTAssertEqual(\n            \"CREATE UNIQUE INDEX \\\"index_table_on_int64\\\" ON \\\"table\\\" (\\\"int64\\\")\",\n            table.createIndex(int64, unique: true)\n        )\n        XCTAssertEqual(\n            \"CREATE INDEX IF NOT EXISTS \\\"index_table_on_int64\\\" ON \\\"table\\\" (\\\"int64\\\")\",\n            table.createIndex(int64, ifNotExists: true)\n        )\n        XCTAssertEqual(\n            \"CREATE UNIQUE INDEX IF NOT EXISTS \\\"index_table_on_int64\\\" ON \\\"table\\\" (\\\"int64\\\")\",\n            table.createIndex(int64, unique: true, ifNotExists: true)\n        )\n        XCTAssertEqual(\n            \"CREATE UNIQUE INDEX IF NOT EXISTS \\\"main\\\".\\\"index_table_on_int64\\\" ON \\\"table\\\" (\\\"int64\\\")\",\n            qualifiedTable.createIndex(int64, unique: true, ifNotExists: true)\n        )\n    }\n\n    func test_dropIndex_compilesCreateIndexExpression() {\n        XCTAssertEqual(\"DROP INDEX \\\"index_table_on_int64\\\"\", table.dropIndex(int64))\n        XCTAssertEqual(\"DROP INDEX IF EXISTS \\\"index_table_on_int64\\\"\", table.dropIndex(int64, ifExists: true))\n    }\n\n    func test_create_onView_compilesCreateViewExpression() {\n        XCTAssertEqual(\n            \"CREATE VIEW \\\"view\\\" AS SELECT \\\"int64\\\" FROM \\\"table\\\"\",\n            _view.create(table.select(int64))\n        )\n        XCTAssertEqual(\n            \"CREATE TEMPORARY VIEW \\\"view\\\" AS SELECT \\\"int64\\\" FROM \\\"table\\\"\",\n            _view.create(table.select(int64), temporary: true)\n        )\n        XCTAssertEqual(\n            \"CREATE VIEW IF NOT EXISTS \\\"view\\\" AS SELECT \\\"int64\\\" FROM \\\"table\\\"\",\n            _view.create(table.select(int64), ifNotExists: true)\n        )\n        XCTAssertEqual(\n            \"CREATE TEMPORARY VIEW IF NOT EXISTS \\\"view\\\" AS SELECT \\\"int64\\\" FROM \\\"table\\\"\",\n            _view.create(table.select(int64), temporary: true, ifNotExists: true)\n        )\n    }\n\n    func test_create_onVirtualTable_compilesCreateVirtualTableExpression() {\n        XCTAssertEqual(\n            \"CREATE VIRTUAL TABLE \\\"virtual_table\\\" USING \\\"custom\\\"('foo', 'bar')\",\n            virtualTable.create(Module(\"custom\", [\"foo\", \"bar\"]))\n        )\n    }\n\n    func test_rename_onVirtualTable_compilesAlterTableRenameToExpression() {\n        XCTAssertEqual(\n            \"ALTER TABLE \\\"old\\\" RENAME TO \\\"virtual_table\\\"\",\n            VirtualTable(\"old\").rename(virtualTable)\n        )\n    }\n\n}\n"
  },
  {
    "path": "Tests/SQLiteTests/TestHelpers.swift",
    "content": "import XCTest\n@testable import SQLite\n\nclass SQLiteTestCase: XCTestCase {\n    private var trace: [String: Int]!\n    var db: Connection!\n    let users = Table(\"users\")\n\n    override func setUpWithError() throws {\n        try super.setUpWithError()\n        db = try Connection()\n        trace = [String: Int]()\n\n        db.trace { SQL in\n            // print(\"SQL: \\(SQL)\")\n            self.trace[SQL, default: 0] += 1\n        }\n    }\n\n    func createUsersTable() throws {\n        try db.execute(\"\"\"\n            CREATE TABLE users (\n                id INTEGER PRIMARY KEY,\n                email TEXT NOT NULL UNIQUE,\n                age INTEGER,\n                salary REAL,\n                admin BOOLEAN NOT NULL DEFAULT 0 CHECK (admin IN (0, 1)),\n                manager_id INTEGER,\n                created_at DATETIME,\n                FOREIGN KEY(manager_id) REFERENCES users(id)\n            )\n            \"\"\"\n        )\n    }\n\n    func insertUsers(_ names: String...) throws {\n        try insertUsers(names)\n    }\n\n    func insertUsers(_ names: [String]) throws {\n        for name in names { try insertUser(name) }\n    }\n\n    @discardableResult func insertUser(_ name: String, age: Int? = nil, admin: Bool = false) throws -> Statement {\n        try db.run(\"INSERT INTO \\\"users\\\" (email, age, admin) values (?, ?, ?)\",\n                   \"\\(name)@example.com\", age?.datatypeValue, admin.datatypeValue)\n    }\n\n    func assertSQL(_ SQL: String, _ executions: Int = 1, _ message: String? = nil, file: StaticString = #file, line: UInt = #line) {\n        XCTAssertEqual(\n            executions, trace[SQL] ?? 0,\n            message ?? SQL,\n            file: file, line: line\n        )\n    }\n\n    func assertSQL(_ SQL: String, _ statement: Statement, _ message: String? = nil, file: StaticString = #file, line: UInt = #line) throws {\n        try statement.run()\n        assertSQL(SQL, 1, message, file: file, line: line)\n        if let count = trace[SQL] { trace[SQL] = count - 1 }\n    }\n\n//    func AssertSQL(SQL: String, _ query: Query, _ message: String? = nil, file: String = __FILE__, line: UInt = __LINE__) {\n//        for _ in query {}\n//        AssertSQL(SQL, 1, message, file: file, line: line)\n//        if let count = trace[SQL] { trace[SQL] = count - 1 }\n//    }\n\n    func async(expect description: String = \"async\", timeout: Double = 5, block: (@escaping () -> Void) throws -> Void) throws {\n        let expectation = self.expectation(description: description)\n        try block({ expectation.fulfill() })\n        waitForExpectations(timeout: timeout, handler: nil)\n    }\n\n}\n\nlet bool = SQLite.Expression<Bool>(\"bool\")\nlet boolOptional = SQLite.Expression<Bool?>(\"boolOptional\")\n\nlet data = SQLite.Expression<Blob>(\"blob\")\nlet dataOptional = SQLite.Expression<Blob?>(\"blobOptional\")\n\nlet date = SQLite.Expression<Date>(\"date\")\nlet dateOptional = SQLite.Expression<Date?>(\"dateOptional\")\n\nlet double = SQLite.Expression<Double>(\"double\")\nlet doubleOptional = SQLite.Expression<Double?>(\"doubleOptional\")\n\nlet int = SQLite.Expression<Int>(\"int\")\nlet intOptional = SQLite.Expression<Int?>(\"intOptional\")\n\nlet int64 = SQLite.Expression<Int64>(\"int64\")\nlet int64Optional = SQLite.Expression<Int64?>(\"int64Optional\")\n\nlet string = SQLite.Expression<String>(\"string\")\nlet stringOptional = SQLite.Expression<String?>(\"stringOptional\")\n\nlet uuid = SQLite.Expression<UUID>(\"uuid\")\nlet uuidOptional = SQLite.Expression<UUID?>(\"uuidOptional\")\n\nlet testUUIDValue = UUID(uuidString: \"E621E1F8-C36C-495A-93FC-0C247A3E6E5F\")!\n\nfunc assertSQL(_ expression1: @autoclosure () -> String, _ expression2: @autoclosure () -> Expressible,\n               file: StaticString = #file, line: UInt = #line) {\n    XCTAssertEqual(expression1(), expression2().asSQL(), file: file, line: line)\n}\n\nfunc extractAndReplace(_ value: String, regex: String, with replacement: String) -> (String, String) {\n    // We cannot use `Regex` because it is not available before iOS 16 :(\n    let regex = try! NSRegularExpression(pattern: regex)\n    let valueRange = NSRange(location: 0, length: value.utf16.count)\n    let match = regex.firstMatch(in: value, options: [], range: valueRange)!.range\n    let range = Range(match, in: value)!\n    let extractedValue = String(value[range])\n    return (value.replacingCharacters(in: range, with: replacement), extractedValue)\n}\n\nlet table = Table(\"table\")\nlet qualifiedTable = Table(\"table\", database: \"main\")\nlet virtualTable = VirtualTable(\"virtual_table\")\nlet _view = View(\"view\") // avoid Mac XCTestCase collision\n\nclass TestCodable: Codable, Equatable {\n    let int: Int\n    let string: String\n    let bool: Bool\n    let float: Float\n    let double: Double\n    let date: Date\n    let uuid: UUID\n    let optional: String?\n    let sub: TestCodable?\n\n    init(int: Int, string: String, bool: Bool, float: Float, double: Double, date: Date, uuid: UUID, optional: String?, sub: TestCodable?) {\n        self.int = int\n        self.string = string\n        self.bool = bool\n        self.float = float\n        self.double = double\n        self.date = date\n        self.uuid = uuid\n        self.optional = optional\n        self.sub = sub\n    }\n\n    static func == (lhs: TestCodable, rhs: TestCodable) -> Bool {\n        lhs.int == rhs.int &&\n        lhs.string == rhs.string &&\n        lhs.bool == rhs.bool &&\n        lhs.float == rhs.float &&\n        lhs.double == rhs.double &&\n        lhs.date == rhs.date &&\n        lhs.uuid == lhs.uuid &&\n        lhs.optional == rhs.optional &&\n        lhs.sub == rhs.sub\n    }\n}\n\nstruct TestOptionalCodable: Codable, Equatable {\n    let int: Int?\n    let string: String?\n    let bool: Bool?\n    let float: Float?\n    let double: Double?\n    let date: Date?\n    let uuid: UUID?\n}\n"
  },
  {
    "path": "Tests/SQLiteTests/Typed/AggregateFunctionsTests.swift",
    "content": "import XCTest\nimport SQLite\n\nclass AggregateFunctionsTests: XCTestCase {\n\n    func test_distinct_prependsExpressionsWithDistinctKeyword() {\n        assertSQL(\"DISTINCT \\\"int\\\"\", int.distinct)\n        assertSQL(\"DISTINCT \\\"intOptional\\\"\", intOptional.distinct)\n        assertSQL(\"DISTINCT \\\"double\\\"\", double.distinct)\n        assertSQL(\"DISTINCT \\\"doubleOptional\\\"\", doubleOptional.distinct)\n        assertSQL(\"DISTINCT \\\"string\\\"\", string.distinct)\n        assertSQL(\"DISTINCT \\\"stringOptional\\\"\", stringOptional.distinct)\n    }\n\n    func test_count_wrapsOptionalExpressionsWithCountFunction() {\n        assertSQL(\"count(\\\"intOptional\\\")\", intOptional.count)\n        assertSQL(\"count(\\\"doubleOptional\\\")\", doubleOptional.count)\n        assertSQL(\"count(\\\"stringOptional\\\")\", stringOptional.count)\n    }\n\n    func test_max_wrapsComparableExpressionsWithMaxFunction() {\n        assertSQL(\"max(\\\"int\\\")\", int.max)\n        assertSQL(\"max(\\\"intOptional\\\")\", intOptional.max)\n        assertSQL(\"max(\\\"double\\\")\", double.max)\n        assertSQL(\"max(\\\"doubleOptional\\\")\", doubleOptional.max)\n        assertSQL(\"max(\\\"string\\\")\", string.max)\n        assertSQL(\"max(\\\"stringOptional\\\")\", stringOptional.max)\n        assertSQL(\"max(\\\"date\\\")\", date.max)\n        assertSQL(\"max(\\\"dateOptional\\\")\", dateOptional.max)\n    }\n\n    func test_min_wrapsComparableExpressionsWithMinFunction() {\n        assertSQL(\"min(\\\"int\\\")\", int.min)\n        assertSQL(\"min(\\\"intOptional\\\")\", intOptional.min)\n        assertSQL(\"min(\\\"double\\\")\", double.min)\n        assertSQL(\"min(\\\"doubleOptional\\\")\", doubleOptional.min)\n        assertSQL(\"min(\\\"string\\\")\", string.min)\n        assertSQL(\"min(\\\"stringOptional\\\")\", stringOptional.min)\n        assertSQL(\"min(\\\"date\\\")\", date.min)\n        assertSQL(\"min(\\\"dateOptional\\\")\", dateOptional.min)\n    }\n\n    func test_average_wrapsNumericExpressionsWithAvgFunction() {\n        assertSQL(\"avg(\\\"int\\\")\", int.average)\n        assertSQL(\"avg(\\\"intOptional\\\")\", intOptional.average)\n        assertSQL(\"avg(\\\"double\\\")\", double.average)\n        assertSQL(\"avg(\\\"doubleOptional\\\")\", doubleOptional.average)\n    }\n\n    func test_sum_wrapsNumericExpressionsWithSumFunction() {\n        assertSQL(\"sum(\\\"int\\\")\", int.sum)\n        assertSQL(\"sum(\\\"intOptional\\\")\", intOptional.sum)\n        assertSQL(\"sum(\\\"double\\\")\", double.sum)\n        assertSQL(\"sum(\\\"doubleOptional\\\")\", doubleOptional.sum)\n    }\n\n    func test_total_wrapsNumericExpressionsWithTotalFunction() {\n        assertSQL(\"total(\\\"int\\\")\", int.total)\n        assertSQL(\"total(\\\"intOptional\\\")\", intOptional.total)\n        assertSQL(\"total(\\\"double\\\")\", double.total)\n        assertSQL(\"total(\\\"doubleOptional\\\")\", doubleOptional.total)\n    }\n\n    func test_count_withStar_wrapsStarWithCountFunction() {\n        assertSQL(\"count(*)\", count(*))\n    }\n\n}\n"
  },
  {
    "path": "Tests/SQLiteTests/Typed/CustomAggregationTests.swift",
    "content": "import XCTest\nimport Foundation\nimport Dispatch\n@testable import SQLite\n\n// https://github.com/stephencelis/SQLite.swift/issues/1071\n#if !(os(Linux) || os(Android))\n\nclass CustomAggregationTests: SQLiteTestCase {\n    override func setUpWithError() throws {\n        try super.setUpWithError()\n        try createUsersTable()\n        try insertUser(\"Alice\", age: 30, admin: true)\n        try insertUser(\"Bob\", age: 25, admin: true)\n        try insertUser(\"Eve\", age: 28, admin: false)\n    }\n\n    func testUnsafeCustomSum() throws {\n        let step = { (bindings: [Binding?], state: UnsafeMutablePointer<Int64>) in\n            if let v = bindings[0] as? Int64 {\n                state.pointee += v\n            }\n        }\n\n        let final = { (state: UnsafeMutablePointer<Int64>) -> Binding? in\n            let v = state.pointee\n            let p = UnsafeMutableBufferPointer(start: state, count: 1)\n            p.deallocate()\n            return v\n        }\n        db.createAggregation(\"mySUM1\", step: step, final: final) {\n            let v = UnsafeMutableBufferPointer<Int64>.allocate(capacity: 1)\n            v[0] = 0\n            return v.baseAddress!\n        }\n        let result = try db.prepare(\"SELECT mySUM1(age) AS s FROM users\")\n        let i = result.columnNames.firstIndex(of: \"s\")!\n        for row in result {\n            let value = row[i] as? Int64\n            XCTAssertEqual(83, value)\n        }\n    }\n\n    func testUnsafeCustomSumGrouping() throws {\n        let step = { (bindings: [Binding?], state: UnsafeMutablePointer<Int64>) in\n            if let v = bindings[0] as? Int64 {\n                state.pointee += v\n            }\n        }\n        let final = { (state: UnsafeMutablePointer<Int64>) -> Binding? in\n            let v = state.pointee\n            let p = UnsafeMutableBufferPointer(start: state, count: 1)\n            p.deallocate()\n            return v\n        }\n        db.createAggregation(\"mySUM2\", step: step, final: final) {\n            let v = UnsafeMutableBufferPointer<Int64>.allocate(capacity: 1)\n            v[0] = 0\n            return v.baseAddress!\n        }\n        let result = try db.prepare(\"SELECT mySUM2(age) AS s FROM users GROUP BY admin ORDER BY s\")\n        let i = result.columnNames.firstIndex(of: \"s\")!\n        let values = result.compactMap { $0[i] as? Int64 }\n        XCTAssertTrue(values.elementsEqual([28, 55]))\n    }\n\n    func testCustomSum() throws {\n        let reduce: (Int64, [Binding?]) -> Int64 = { (last, bindings) in\n            let v = (bindings[0] as? Int64) ?? 0\n            return last + v\n        }\n        db.createAggregation(\"myReduceSUM1\", initialValue: Int64(2000), reduce: reduce, result: { $0 })\n        let result = try db.prepare(\"SELECT myReduceSUM1(age) AS s FROM users\")\n        let i = result.columnNames.firstIndex(of: \"s\")!\n        for row in result {\n            let value = row[i] as? Int64\n            XCTAssertEqual(2083, value)\n        }\n    }\n\n    func testCustomSumGrouping() throws {\n        let reduce: (Int64, [Binding?]) -> Int64 = { (last, bindings) in\n            let v = (bindings[0] as? Int64) ?? 0\n            return last + v\n        }\n        db.createAggregation(\"myReduceSUM2\", initialValue: Int64(3000), reduce: reduce, result: { $0 })\n        let result = try db.prepare(\"SELECT myReduceSUM2(age) AS s FROM users GROUP BY admin ORDER BY s\")\n        let i = result.columnNames.firstIndex(of: \"s\")!\n        let values = result.compactMap { $0[i] as? Int64 }\n        XCTAssertTrue(values.elementsEqual([3028, 3055]))\n    }\n\n    func testCustomStringAgg() throws {\n        let initial = String(repeating: \" \", count: 64)\n        let reduce: (String, [Binding?]) -> String = { (last, bindings) in\n            let v = (bindings[0] as? String) ?? \"\"\n            return last + v\n        }\n        db.createAggregation(\"myReduceSUM3\", initialValue: initial, reduce: reduce, result: { $0 })\n        let result = try db.prepare(\"SELECT myReduceSUM3(email) AS s FROM users\")\n\n        let i = result.columnNames.firstIndex(of: \"s\")!\n        for row in result {\n            let value = row[i] as? String\n            XCTAssertEqual(\"\\(initial)Alice@example.comBob@example.comEve@example.com\", value)\n        }\n    }\n\n    func testCustomObjectSum() throws {\n        {\n            let initial = TestObject(value: 1000)\n            let reduce: (TestObject, [Binding?]) -> TestObject = { (last, bindings) in\n                let v = (bindings[0] as? Int64) ?? 0\n                return TestObject(value: last.value + v)\n            }\n            db.createAggregation(\"myReduceSUMX\", initialValue: initial, reduce: reduce, result: { $0.value })\n            // end this scope to ensure that the initial value is retained\n            // by the createAggregation call.\n            // swiftlint:disable:next trailing_semicolon\n        }();\n\n        {\n            XCTAssertEqual(TestObject.inits, 1)\n            let result = try! db.prepare(\"SELECT myReduceSUMX(age) AS s FROM users\")\n            let i = result.columnNames.firstIndex(of: \"s\")!\n            for row in result {\n                let value = row[i] as? Int64\n                XCTAssertEqual(1083, value)\n            }\n        }()\n        XCTAssertEqual(TestObject.inits, 4)\n        XCTAssertEqual(TestObject.deinits, 3) // the initial value is still retained by the aggregate's state block, so deinits is one less than inits\n    }\n}\n#endif\n\n/// This class is used to test that aggregation state variables\n/// can be reference types and are properly memory managed when\n/// crossing the Swift<->C boundary multiple times.\nclass TestObject {\n    static var inits = 0\n    static var deinits = 0\n\n    var value: Int64\n    init(value: Int64) {\n        self.value = value\n        TestObject.inits += 1\n    }\n    deinit {\n        TestObject.deinits += 1\n    }\n}\n"
  },
  {
    "path": "Tests/SQLiteTests/Typed/CustomFunctionsTests.swift",
    "content": "import XCTest\nimport SQLite\n\n// https://github.com/stephencelis/SQLite.swift/issues/1071\n#if !(os(Linux) || os(Android))\n\nclass CustomFunctionNoArgsTests: SQLiteTestCase {\n    typealias FunctionNoOptional              = () -> SQLite.Expression<String>\n    typealias FunctionResultOptional          = () -> SQLite.Expression<String?>\n\n    func testFunctionNoOptional() throws {\n        let _: FunctionNoOptional = try db.createFunction(\"test\", deterministic: true) {\n            \"a\"\n        }\n        let result = try db.prepare(\"SELECT test()\").scalar() as! String\n        XCTAssertEqual(\"a\", result)\n    }\n\n    func testFunctionResultOptional() throws {\n        let _: FunctionResultOptional = try db.createFunction(\"test\", deterministic: true) {\n            \"a\"\n        }\n        let result = try db.prepare(\"SELECT test()\").scalar() as! String?\n        XCTAssertEqual(\"a\", result)\n    }\n}\n\nclass CustomFunctionWithOneArgTests: SQLiteTestCase {\n    typealias FunctionNoOptional              = (SQLite.Expression<String>) -> SQLite.Expression<String>\n    typealias FunctionLeftOptional            = (SQLite.Expression<String?>) -> SQLite.Expression<String>\n    typealias FunctionResultOptional          = (SQLite.Expression<String>) -> SQLite.Expression<String?>\n    typealias FunctionLeftResultOptional      = (SQLite.Expression<String?>) -> SQLite.Expression<String?>\n\n    func testFunctionNoOptional() throws {\n        let _: FunctionNoOptional = try db.createFunction(\"test\", deterministic: true) { a in\n            \"b\" + a\n        }\n        let result = try db.prepare(\"SELECT test(?)\").scalar(\"a\") as! String\n        XCTAssertEqual(\"ba\", result)\n    }\n\n    func testFunctionLeftOptional() throws {\n        let _: FunctionLeftOptional = try db.createFunction(\"test\", deterministic: true) { a in\n            \"b\" + a!\n        }\n        let result = try db.prepare(\"SELECT test(?)\").scalar(\"a\") as! String\n        XCTAssertEqual(\"ba\", result)\n    }\n\n    func testFunctionResultOptional() throws {\n        let _: FunctionResultOptional = try db.createFunction(\"test\", deterministic: true) { a in\n            \"b\" + a\n        }\n        let result = try db.prepare(\"SELECT test(?)\").scalar(\"a\") as! String\n        XCTAssertEqual(\"ba\", result)\n    }\n\n    func testFunctionLeftResultOptional() throws {\n        let _: FunctionLeftResultOptional = try db.createFunction(\"test\", deterministic: true) { (a: String?) -> String? in\n            \"b\" + a!\n        }\n        let result = try db.prepare(\"SELECT test(?)\").scalar(\"a\") as! String\n        XCTAssertEqual(\"ba\", result)\n    }\n}\n\nclass CustomFunctionWithTwoArgsTests: SQLiteTestCase {\n    typealias FunctionNoOptional              = (SQLite.Expression<String>, SQLite.Expression<String>) -> SQLite.Expression<String>\n    typealias FunctionLeftOptional            = (SQLite.Expression<String?>, SQLite.Expression<String>) -> SQLite.Expression<String>\n    typealias FunctionRightOptional           = (SQLite.Expression<String>, SQLite.Expression<String?>) -> SQLite.Expression<String>\n    typealias FunctionResultOptional          = (SQLite.Expression<String>, SQLite.Expression<String>) -> SQLite.Expression<String?>\n    typealias FunctionLeftRightOptional       = (SQLite.Expression<String?>, SQLite.Expression<String?>) -> SQLite.Expression<String>\n    typealias FunctionLeftResultOptional      = (SQLite.Expression<String?>, SQLite.Expression<String>) -> SQLite.Expression<String?>\n    typealias FunctionRightResultOptional     = (SQLite.Expression<String>, SQLite.Expression<String?>) -> SQLite.Expression<String?>\n    typealias FunctionLeftRightResultOptional = (SQLite.Expression<String?>, SQLite.Expression<String?>) -> SQLite.Expression<String?>\n\n    func testNoOptional() throws {\n        let _: FunctionNoOptional = try db.createFunction(\"test\", deterministic: true) { a, b in\n            a + b\n        }\n        let result = try db.prepare(\"SELECT test(?, ?)\").scalar(\"a\", \"b\") as! String\n        XCTAssertEqual(\"ab\", result)\n    }\n\n    func testLeftOptional() throws {\n        let _: FunctionLeftOptional = try db.createFunction(\"test\", deterministic: true) { a, b in\n            a! + b\n        }\n        let result = try db.prepare(\"SELECT test(?, ?)\").scalar(\"a\", \"b\") as! String\n        XCTAssertEqual(\"ab\", result)\n    }\n\n    func testRightOptional() throws {\n        let _: FunctionRightOptional = try db.createFunction(\"test\", deterministic: true) { a, b in\n            a + b!\n        }\n        let result = try db.prepare(\"SELECT test(?, ?)\").scalar(\"a\", \"b\") as! String\n        XCTAssertEqual(\"ab\", result)\n    }\n\n    func testResultOptional() throws {\n        let _: FunctionResultOptional = try db.createFunction(\"test\", deterministic: true) { a, b in\n            a + b\n        }\n        let result = try db.prepare(\"SELECT test(?, ?)\").scalar(\"a\", \"b\") as! String?\n        XCTAssertEqual(\"ab\", result)\n    }\n\n    func testFunctionLeftRightOptional() throws {\n        let _: FunctionLeftRightOptional = try db.createFunction(\"test\", deterministic: true) { a, b in\n            a! + b!\n        }\n        let result = try db.prepare(\"SELECT test(?, ?)\").scalar(\"a\", \"b\") as! String\n        XCTAssertEqual(\"ab\", result)\n    }\n\n    func testFunctionLeftResultOptional() throws {\n        let _: FunctionLeftResultOptional = try db.createFunction(\"test\", deterministic: true) { a, b in\n            a! + b\n        }\n        let result = try db.prepare(\"SELECT test(?, ?)\").scalar(\"a\", \"b\") as! String?\n        XCTAssertEqual(\"ab\", result)\n    }\n\n    func testFunctionRightResultOptional() throws {\n        let _: FunctionRightResultOptional = try db.createFunction(\"test\", deterministic: true) { a, b in\n            a + b!\n        }\n        let result = try db.prepare(\"SELECT test(?, ?)\").scalar(\"a\", \"b\") as! String?\n        XCTAssertEqual(\"ab\", result)\n    }\n\n    func testFunctionLeftRightResultOptional() throws {\n        let _: FunctionLeftRightResultOptional = try db.createFunction(\"test\", deterministic: true) { a, b in\n            a! + b!\n        }\n        let result = try db.prepare(\"SELECT test(?, ?)\").scalar(\"a\", \"b\") as! String?\n        XCTAssertEqual(\"ab\", result)\n    }\n}\n\nclass CustomFunctionTruncation: SQLiteTestCase {\n    // https://github.com/stephencelis/SQLite.swift/issues/468\n    func testStringTruncation() throws {\n        _ = try db.createFunction(\"customLower\") { (value: String) in value.lowercased() }\n        let result = try db.prepare(\"SELECT customLower(?)\").scalar(\"TÖL-AA 12\") as? String\n        XCTAssertEqual(\"töl-aa 12\", result)\n    }\n}\n\n#endif\n"
  },
  {
    "path": "Tests/SQLiteTests/Typed/DateAndTimeFunctionTests.swift",
    "content": "import XCTest\n@testable import SQLite\n\nclass DateAndTimeFunctionsTests: XCTestCase {\n\n    func test_date() {\n        assertSQL(\"date('now')\", DateFunctions.date(\"now\"))\n        assertSQL(\"date('now', 'localtime')\", DateFunctions.date(\"now\", \"localtime\"))\n    }\n\n    func test_time() {\n        assertSQL(\"time('now')\", DateFunctions.time(\"now\"))\n        assertSQL(\"time('now', 'localtime')\", DateFunctions.time(\"now\", \"localtime\"))\n    }\n\n    func test_datetime() {\n        assertSQL(\"datetime('now')\", DateFunctions.datetime(\"now\"))\n        assertSQL(\"datetime('now', 'localtime')\", DateFunctions.datetime(\"now\", \"localtime\"))\n    }\n\n    func test_julianday() {\n        assertSQL(\"julianday('now')\", DateFunctions.julianday(\"now\"))\n        assertSQL(\"julianday('now', 'localtime')\", DateFunctions.julianday(\"now\", \"localtime\"))\n    }\n\n    func test_strftime() {\n        assertSQL(\"strftime('%Y-%m-%d', 'now')\", DateFunctions.strftime(\"%Y-%m-%d\", \"now\"))\n        assertSQL(\"strftime('%Y-%m-%d', 'now', 'localtime')\", DateFunctions.strftime(\"%Y-%m-%d\", \"now\", \"localtime\"))\n    }\n}\n\nclass DateExtensionTests: XCTestCase {\n    func test_time() {\n        assertSQL(\"time('1970-01-01T00:00:00.000')\", Date(timeIntervalSince1970: 0).time)\n    }\n\n    func test_date() {\n        assertSQL(\"date('1970-01-01T00:00:00.000')\", Date(timeIntervalSince1970: 0).date)\n    }\n\n    func test_datetime() {\n        assertSQL(\"datetime('1970-01-01T00:00:00.000')\", Date(timeIntervalSince1970: 0).datetime)\n    }\n\n    func test_julianday() {\n        assertSQL(\"julianday('1970-01-01T00:00:00.000')\", Date(timeIntervalSince1970: 0).julianday)\n    }\n}\n\nclass DateExpressionTests: XCTestCase {\n    func test_date() {\n        assertSQL(\"date(\\\"date\\\")\", date.date)\n    }\n\n    func test_time() {\n        assertSQL(\"time(\\\"date\\\")\", date.time)\n    }\n\n    func test_datetime() {\n        assertSQL(\"datetime(\\\"date\\\")\", date.datetime)\n    }\n\n    func test_julianday() {\n        assertSQL(\"julianday(\\\"date\\\")\", date.julianday)\n    }\n}\n"
  },
  {
    "path": "Tests/SQLiteTests/Typed/ExpressionTests.swift",
    "content": "import XCTest\n@testable import SQLite\n\nclass ExpressionTests: XCTestCase {\n\n    func test_asSQL_expression_bindings() {\n        let expression = SQLite.Expression<String>(\"foo ? bar\", [\"baz\"])\n        XCTAssertEqual(expression.asSQL(), \"foo 'baz' bar\")\n    }\n\n    func test_asSQL_expression_bindings_quoting() {\n        let expression = SQLite.Expression<String>(\"foo ? bar\", [\"'baz'\"])\n        XCTAssertEqual(expression.asSQL(), \"foo '''baz''' bar\")\n    }\n\n    func test_expression_custom_string_convertible() {\n        let expression = SQLite.Expression<String>(\"foo ? bar\", [\"baz\"])\n        XCTAssertEqual(expression.asSQL(), expression.description)\n    }\n\n    func test_builtin_unambiguously_custom_string_convertible() {\n        let integer: Int = 45\n        XCTAssertEqual(integer.description, \"45\")\n    }\n\n    func test_init_literal() {\n        let expression = SQLite.Expression<String>(literal: \"literal\")\n        XCTAssertEqual(expression.template, \"literal\")\n    }\n\n    func test_init_identifier() {\n        let expression = SQLite.Expression<String>(\"identifier\")\n        XCTAssertEqual(expression.template, \"\\\"identifier\\\"\")\n    }\n}\n"
  },
  {
    "path": "Tests/SQLiteTests/Typed/OperatorsTests.swift",
    "content": "import XCTest\nimport SQLite\n\nclass OperatorsTests: XCTestCase {\n\n    func test_stringExpressionPlusStringExpression_buildsConcatenatingStringExpression() {\n        assertSQL(\"(\\\"string\\\" || \\\"string\\\")\", string + string)\n        assertSQL(\"(\\\"string\\\" || \\\"stringOptional\\\")\", string + stringOptional)\n        assertSQL(\"(\\\"stringOptional\\\" || \\\"string\\\")\", stringOptional + string)\n        assertSQL(\"(\\\"stringOptional\\\" || \\\"stringOptional\\\")\", stringOptional + stringOptional)\n        assertSQL(\"(\\\"string\\\" || 'literal')\", string + \"literal\")\n        assertSQL(\"(\\\"stringOptional\\\" || 'literal')\", stringOptional + \"literal\")\n        assertSQL(\"('literal' || \\\"string\\\")\", \"literal\" + string)\n        assertSQL(\"('literal' || \\\"stringOptional\\\")\", \"literal\" + stringOptional)\n    }\n\n    func test_numberExpression_plusNumberExpression_buildsAdditiveNumberExpression() {\n        assertSQL(\"(\\\"int\\\" + \\\"int\\\")\", int + int)\n        assertSQL(\"(\\\"int\\\" + \\\"intOptional\\\")\", int + intOptional)\n        assertSQL(\"(\\\"intOptional\\\" + \\\"int\\\")\", intOptional + int)\n        assertSQL(\"(\\\"intOptional\\\" + \\\"intOptional\\\")\", intOptional + intOptional)\n        assertSQL(\"(\\\"int\\\" + 1)\", int + 1)\n        assertSQL(\"(\\\"intOptional\\\" + 1)\", intOptional + 1)\n        assertSQL(\"(1 + \\\"int\\\")\", 1 + int)\n        assertSQL(\"(1 + \\\"intOptional\\\")\", 1 + intOptional)\n\n        assertSQL(\"(\\\"double\\\" + \\\"double\\\")\", double + double)\n        assertSQL(\"(\\\"double\\\" + \\\"doubleOptional\\\")\", double + doubleOptional)\n        assertSQL(\"(\\\"doubleOptional\\\" + \\\"double\\\")\", doubleOptional + double)\n        assertSQL(\"(\\\"doubleOptional\\\" + \\\"doubleOptional\\\")\", doubleOptional + doubleOptional)\n        assertSQL(\"(\\\"double\\\" + 1.0)\", double + 1)\n        assertSQL(\"(\\\"doubleOptional\\\" + 1.0)\", doubleOptional + 1)\n        assertSQL(\"(1.0 + \\\"double\\\")\", 1 + double)\n        assertSQL(\"(1.0 + \\\"doubleOptional\\\")\", 1 + doubleOptional)\n    }\n\n    func test_numberExpression_minusNumberExpression_buildsSubtractiveNumberExpression() {\n        assertSQL(\"(\\\"int\\\" - \\\"int\\\")\", int - int)\n        assertSQL(\"(\\\"int\\\" - \\\"intOptional\\\")\", int - intOptional)\n        assertSQL(\"(\\\"intOptional\\\" - \\\"int\\\")\", intOptional - int)\n        assertSQL(\"(\\\"intOptional\\\" - \\\"intOptional\\\")\", intOptional - intOptional)\n        assertSQL(\"(\\\"int\\\" - 1)\", int - 1)\n        assertSQL(\"(\\\"intOptional\\\" - 1)\", intOptional - 1)\n        assertSQL(\"(1 - \\\"int\\\")\", 1 - int)\n        assertSQL(\"(1 - \\\"intOptional\\\")\", 1 - intOptional)\n\n        assertSQL(\"(\\\"double\\\" - \\\"double\\\")\", double - double)\n        assertSQL(\"(\\\"double\\\" - \\\"doubleOptional\\\")\", double - doubleOptional)\n        assertSQL(\"(\\\"doubleOptional\\\" - \\\"double\\\")\", doubleOptional - double)\n        assertSQL(\"(\\\"doubleOptional\\\" - \\\"doubleOptional\\\")\", doubleOptional - doubleOptional)\n        assertSQL(\"(\\\"double\\\" - 1.0)\", double - 1)\n        assertSQL(\"(\\\"doubleOptional\\\" - 1.0)\", doubleOptional - 1)\n        assertSQL(\"(1.0 - \\\"double\\\")\", 1 - double)\n        assertSQL(\"(1.0 - \\\"doubleOptional\\\")\", 1 - doubleOptional)\n    }\n\n    func test_numberExpression_timesNumberExpression_buildsMultiplicativeNumberExpression() {\n        assertSQL(\"(\\\"int\\\" * \\\"int\\\")\", int * int)\n        assertSQL(\"(\\\"int\\\" * \\\"intOptional\\\")\", int * intOptional)\n        assertSQL(\"(\\\"intOptional\\\" * \\\"int\\\")\", intOptional * int)\n        assertSQL(\"(\\\"intOptional\\\" * \\\"intOptional\\\")\", intOptional * intOptional)\n        assertSQL(\"(\\\"int\\\" * 1)\", int * 1)\n        assertSQL(\"(\\\"intOptional\\\" * 1)\", intOptional * 1)\n        assertSQL(\"(1 * \\\"int\\\")\", 1 * int)\n        assertSQL(\"(1 * \\\"intOptional\\\")\", 1 * intOptional)\n\n        assertSQL(\"(\\\"double\\\" * \\\"double\\\")\", double * double)\n        assertSQL(\"(\\\"double\\\" * \\\"doubleOptional\\\")\", double * doubleOptional)\n        assertSQL(\"(\\\"doubleOptional\\\" * \\\"double\\\")\", doubleOptional * double)\n        assertSQL(\"(\\\"doubleOptional\\\" * \\\"doubleOptional\\\")\", doubleOptional * doubleOptional)\n        assertSQL(\"(\\\"double\\\" * 1.0)\", double * 1)\n        assertSQL(\"(\\\"doubleOptional\\\" * 1.0)\", doubleOptional * 1)\n        assertSQL(\"(1.0 * \\\"double\\\")\", 1 * double)\n        assertSQL(\"(1.0 * \\\"doubleOptional\\\")\", 1 * doubleOptional)\n    }\n\n    func test_numberExpression_dividedByNumberExpression_buildsDivisiveNumberExpression() {\n        assertSQL(\"(\\\"int\\\" / \\\"int\\\")\", int / int)\n        assertSQL(\"(\\\"int\\\" / \\\"intOptional\\\")\", int / intOptional)\n        assertSQL(\"(\\\"intOptional\\\" / \\\"int\\\")\", intOptional / int)\n        assertSQL(\"(\\\"intOptional\\\" / \\\"intOptional\\\")\", intOptional / intOptional)\n        assertSQL(\"(\\\"int\\\" / 1)\", int / 1)\n        assertSQL(\"(\\\"intOptional\\\" / 1)\", intOptional / 1)\n        assertSQL(\"(1 / \\\"int\\\")\", 1 / int)\n        assertSQL(\"(1 / \\\"intOptional\\\")\", 1 / intOptional)\n\n        assertSQL(\"(\\\"double\\\" / \\\"double\\\")\", double / double)\n        assertSQL(\"(\\\"double\\\" / \\\"doubleOptional\\\")\", double / doubleOptional)\n        assertSQL(\"(\\\"doubleOptional\\\" / \\\"double\\\")\", doubleOptional / double)\n        assertSQL(\"(\\\"doubleOptional\\\" / \\\"doubleOptional\\\")\", doubleOptional / doubleOptional)\n        assertSQL(\"(\\\"double\\\" / 1.0)\", double / 1)\n        assertSQL(\"(\\\"doubleOptional\\\" / 1.0)\", doubleOptional / 1)\n        assertSQL(\"(1.0 / \\\"double\\\")\", 1 / double)\n        assertSQL(\"(1.0 / \\\"doubleOptional\\\")\", 1 / doubleOptional)\n    }\n\n    func test_numberExpression_prefixedWithMinus_buildsInvertedNumberExpression() {\n        assertSQL(\"-(\\\"int\\\")\", -int)\n        assertSQL(\"-(\\\"intOptional\\\")\", -intOptional)\n\n        assertSQL(\"-(\\\"double\\\")\", -double)\n        assertSQL(\"-(\\\"doubleOptional\\\")\", -doubleOptional)\n    }\n\n    func test_integerExpression_moduloIntegerExpression_buildsModuloIntegerExpression() {\n        assertSQL(\"(\\\"int\\\" % \\\"int\\\")\", int % int)\n        assertSQL(\"(\\\"int\\\" % \\\"intOptional\\\")\", int % intOptional)\n        assertSQL(\"(\\\"intOptional\\\" % \\\"int\\\")\", intOptional % int)\n        assertSQL(\"(\\\"intOptional\\\" % \\\"intOptional\\\")\", intOptional % intOptional)\n        assertSQL(\"(\\\"int\\\" % 1)\", int % 1)\n        assertSQL(\"(\\\"intOptional\\\" % 1)\", intOptional % 1)\n        assertSQL(\"(1 % \\\"int\\\")\", 1 % int)\n        assertSQL(\"(1 % \\\"intOptional\\\")\", 1 % intOptional)\n    }\n\n    func test_integerExpression_bitShiftLeftIntegerExpression_buildsLeftShiftedIntegerExpression() {\n        assertSQL(\"(\\\"int\\\" << \\\"int\\\")\", int << int)\n        assertSQL(\"(\\\"int\\\" << \\\"intOptional\\\")\", int << intOptional)\n        assertSQL(\"(\\\"intOptional\\\" << \\\"int\\\")\", intOptional << int)\n        assertSQL(\"(\\\"intOptional\\\" << \\\"intOptional\\\")\", intOptional << intOptional)\n        assertSQL(\"(\\\"int\\\" << 1)\", int << 1)\n        assertSQL(\"(\\\"intOptional\\\" << 1)\", intOptional << 1)\n        assertSQL(\"(1 << \\\"int\\\")\", 1 << int)\n        assertSQL(\"(1 << \\\"intOptional\\\")\", 1 << intOptional)\n    }\n\n    func test_integerExpression_bitShiftRightIntegerExpression_buildsRightShiftedIntegerExpression() {\n        assertSQL(\"(\\\"int\\\" >> \\\"int\\\")\", int >> int)\n        assertSQL(\"(\\\"int\\\" >> \\\"intOptional\\\")\", int >> intOptional)\n        assertSQL(\"(\\\"intOptional\\\" >> \\\"int\\\")\", intOptional >> int)\n        assertSQL(\"(\\\"intOptional\\\" >> \\\"intOptional\\\")\", intOptional >> intOptional)\n        assertSQL(\"(\\\"int\\\" >> 1)\", int >> 1)\n        assertSQL(\"(\\\"intOptional\\\" >> 1)\", intOptional >> 1)\n        assertSQL(\"(1 >> \\\"int\\\")\", 1 >> int)\n        assertSQL(\"(1 >> \\\"intOptional\\\")\", 1 >> intOptional)\n    }\n\n    func test_integerExpression_bitwiseAndIntegerExpression_buildsAndedIntegerExpression() {\n        assertSQL(\"(\\\"int\\\" & \\\"int\\\")\", int & int)\n        assertSQL(\"(\\\"int\\\" & \\\"intOptional\\\")\", int & intOptional)\n        assertSQL(\"(\\\"intOptional\\\" & \\\"int\\\")\", intOptional & int)\n        assertSQL(\"(\\\"intOptional\\\" & \\\"intOptional\\\")\", intOptional & intOptional)\n        assertSQL(\"(\\\"int\\\" & 1)\", int & 1)\n        assertSQL(\"(\\\"intOptional\\\" & 1)\", intOptional & 1)\n        assertSQL(\"(1 & \\\"int\\\")\", 1 & int)\n        assertSQL(\"(1 & \\\"intOptional\\\")\", 1 & intOptional)\n    }\n\n    func test_integerExpression_bitwiseOrIntegerExpression_buildsOredIntegerExpression() {\n        assertSQL(\"(\\\"int\\\" | \\\"int\\\")\", int | int)\n        assertSQL(\"(\\\"int\\\" | \\\"intOptional\\\")\", int | intOptional)\n        assertSQL(\"(\\\"intOptional\\\" | \\\"int\\\")\", intOptional | int)\n        assertSQL(\"(\\\"intOptional\\\" | \\\"intOptional\\\")\", intOptional | intOptional)\n        assertSQL(\"(\\\"int\\\" | 1)\", int | 1)\n        assertSQL(\"(\\\"intOptional\\\" | 1)\", intOptional | 1)\n        assertSQL(\"(1 | \\\"int\\\")\", 1 | int)\n        assertSQL(\"(1 | \\\"intOptional\\\")\", 1 | intOptional)\n    }\n\n    func test_integerExpression_bitwiseExclusiveOrIntegerExpression_buildsOredIntegerExpression() {\n        assertSQL(\"(~((\\\"int\\\" & \\\"int\\\")) & (\\\"int\\\" | \\\"int\\\"))\", int ^ int)\n        assertSQL(\"(~((\\\"int\\\" & \\\"intOptional\\\")) & (\\\"int\\\" | \\\"intOptional\\\"))\", int ^ intOptional)\n        assertSQL(\"(~((\\\"intOptional\\\" & \\\"int\\\")) & (\\\"intOptional\\\" | \\\"int\\\"))\", intOptional ^ int)\n        assertSQL(\"(~((\\\"intOptional\\\" & \\\"intOptional\\\")) & (\\\"intOptional\\\" | \\\"intOptional\\\"))\", intOptional ^ intOptional)\n        assertSQL(\"(~((\\\"int\\\" & 1)) & (\\\"int\\\" | 1))\", int ^ 1)\n        assertSQL(\"(~((\\\"intOptional\\\" & 1)) & (\\\"intOptional\\\" | 1))\", intOptional ^ 1)\n        assertSQL(\"(~((1 & \\\"int\\\")) & (1 | \\\"int\\\"))\", 1 ^ int)\n        assertSQL(\"(~((1 & \\\"intOptional\\\")) & (1 | \\\"intOptional\\\"))\", 1 ^ intOptional)\n    }\n\n    func test_bitwiseNot_integerExpression_buildsComplementIntegerExpression() {\n        assertSQL(\"~(\\\"int\\\")\", ~int)\n        assertSQL(\"~(\\\"intOptional\\\")\", ~intOptional)\n    }\n\n    func test_equalityOperator_withEquatableExpressions_buildsBooleanExpression() {\n        assertSQL(\"(\\\"bool\\\" = \\\"bool\\\")\", bool == bool)\n        assertSQL(\"(\\\"bool\\\" = \\\"boolOptional\\\")\", bool == boolOptional)\n        assertSQL(\"(\\\"boolOptional\\\" = \\\"bool\\\")\", boolOptional == bool)\n        assertSQL(\"(\\\"boolOptional\\\" = \\\"boolOptional\\\")\", boolOptional == boolOptional)\n        assertSQL(\"(\\\"bool\\\" = 1)\", bool == true)\n        assertSQL(\"(\\\"boolOptional\\\" = 1)\", boolOptional == true)\n        assertSQL(\"(1 = \\\"bool\\\")\", true == bool)\n        assertSQL(\"(1 = \\\"boolOptional\\\")\", true == boolOptional)\n\n        assertSQL(\"(\\\"boolOptional\\\" IS NULL)\", boolOptional == nil)\n        assertSQL(\"(NULL IS \\\"boolOptional\\\")\", nil == boolOptional)\n    }\n\n    func test_isOperator_withEquatableExpressions_buildsBooleanExpression() {\n       assertSQL(\"(\\\"bool\\\" IS \\\"bool\\\")\", bool === bool)\n       assertSQL(\"(\\\"bool\\\" IS \\\"boolOptional\\\")\", bool === boolOptional)\n       assertSQL(\"(\\\"boolOptional\\\" IS \\\"bool\\\")\", boolOptional === bool)\n       assertSQL(\"(\\\"boolOptional\\\" IS \\\"boolOptional\\\")\", boolOptional === boolOptional)\n       assertSQL(\"(\\\"bool\\\" IS 1)\", bool === true)\n       assertSQL(\"(\\\"boolOptional\\\" IS 1)\", boolOptional === true)\n       assertSQL(\"(1 IS \\\"bool\\\")\", true === bool)\n       assertSQL(\"(1 IS \\\"boolOptional\\\")\", true === boolOptional)\n\n       assertSQL(\"(\\\"boolOptional\\\" IS NULL)\", boolOptional === nil)\n       assertSQL(\"(NULL IS \\\"boolOptional\\\")\", nil === boolOptional)\n    }\n\n    func test_isNotOperator_withEquatableExpressions_buildsBooleanExpression() {\n        assertSQL(\"(\\\"bool\\\" IS NOT \\\"bool\\\")\", bool !== bool)\n        assertSQL(\"(\\\"bool\\\" IS NOT \\\"boolOptional\\\")\", bool !== boolOptional)\n        assertSQL(\"(\\\"boolOptional\\\" IS NOT \\\"bool\\\")\", boolOptional !== bool)\n        assertSQL(\"(\\\"boolOptional\\\" IS NOT \\\"boolOptional\\\")\", boolOptional !== boolOptional)\n        assertSQL(\"(\\\"bool\\\" IS NOT 1)\", bool !== true)\n        assertSQL(\"(\\\"boolOptional\\\" IS NOT 1)\", boolOptional !== true)\n        assertSQL(\"(1 IS NOT \\\"bool\\\")\", true !== bool)\n        assertSQL(\"(1 IS NOT \\\"boolOptional\\\")\", true !== boolOptional)\n\n        assertSQL(\"(\\\"boolOptional\\\" IS NOT NULL)\", boolOptional !== nil)\n        assertSQL(\"(NULL IS NOT \\\"boolOptional\\\")\", nil !== boolOptional)\n     }\n\n    func test_inequalityOperator_withEquatableExpressions_buildsBooleanExpression() {\n        assertSQL(\"(\\\"bool\\\" != \\\"bool\\\")\", bool != bool)\n        assertSQL(\"(\\\"bool\\\" != \\\"boolOptional\\\")\", bool != boolOptional)\n        assertSQL(\"(\\\"boolOptional\\\" != \\\"bool\\\")\", boolOptional != bool)\n        assertSQL(\"(\\\"boolOptional\\\" != \\\"boolOptional\\\")\", boolOptional != boolOptional)\n        assertSQL(\"(\\\"bool\\\" != 1)\", bool != true)\n        assertSQL(\"(\\\"boolOptional\\\" != 1)\", boolOptional != true)\n        assertSQL(\"(1 != \\\"bool\\\")\", true != bool)\n        assertSQL(\"(1 != \\\"boolOptional\\\")\", true != boolOptional)\n\n        assertSQL(\"(\\\"boolOptional\\\" IS NOT NULL)\", boolOptional != nil)\n        assertSQL(\"(NULL IS NOT \\\"boolOptional\\\")\", nil != boolOptional)\n    }\n\n    func test_greaterThanOperator_withComparableExpressions_buildsBooleanExpression() {\n        assertSQL(\"(\\\"bool\\\" > \\\"bool\\\")\", bool > bool)\n        assertSQL(\"(\\\"bool\\\" > \\\"boolOptional\\\")\", bool > boolOptional)\n        assertSQL(\"(\\\"boolOptional\\\" > \\\"bool\\\")\", boolOptional > bool)\n        assertSQL(\"(\\\"boolOptional\\\" > \\\"boolOptional\\\")\", boolOptional > boolOptional)\n        assertSQL(\"(\\\"bool\\\" > 1)\", bool > true)\n        assertSQL(\"(\\\"boolOptional\\\" > 1)\", boolOptional > true)\n        assertSQL(\"(1 > \\\"bool\\\")\", true > bool)\n        assertSQL(\"(1 > \\\"boolOptional\\\")\", true > boolOptional)\n    }\n\n    func test_greaterThanOrEqualToOperator_withComparableExpressions_buildsBooleanExpression() {\n        assertSQL(\"(\\\"bool\\\" >= \\\"bool\\\")\", bool >= bool)\n        assertSQL(\"(\\\"bool\\\" >= \\\"boolOptional\\\")\", bool >= boolOptional)\n        assertSQL(\"(\\\"boolOptional\\\" >= \\\"bool\\\")\", boolOptional >= bool)\n        assertSQL(\"(\\\"boolOptional\\\" >= \\\"boolOptional\\\")\", boolOptional >= boolOptional)\n        assertSQL(\"(\\\"bool\\\" >= 1)\", bool >= true)\n        assertSQL(\"(\\\"boolOptional\\\" >= 1)\", boolOptional >= true)\n        assertSQL(\"(1 >= \\\"bool\\\")\", true >= bool)\n        assertSQL(\"(1 >= \\\"boolOptional\\\")\", true >= boolOptional)\n    }\n\n    func test_lessThanOperator_withComparableExpressions_buildsBooleanExpression() {\n        assertSQL(\"(\\\"bool\\\" < \\\"bool\\\")\", bool < bool)\n        assertSQL(\"(\\\"bool\\\" < \\\"boolOptional\\\")\", bool < boolOptional)\n        assertSQL(\"(\\\"boolOptional\\\" < \\\"bool\\\")\", boolOptional < bool)\n        assertSQL(\"(\\\"boolOptional\\\" < \\\"boolOptional\\\")\", boolOptional < boolOptional)\n        assertSQL(\"(\\\"bool\\\" < 1)\", bool < true)\n        assertSQL(\"(\\\"boolOptional\\\" < 1)\", boolOptional < true)\n        assertSQL(\"(1 < \\\"bool\\\")\", true < bool)\n        assertSQL(\"(1 < \\\"boolOptional\\\")\", true < boolOptional)\n    }\n\n    func test_lessThanOrEqualToOperator_withComparableExpressions_buildsBooleanExpression() {\n        assertSQL(\"(\\\"bool\\\" <= \\\"bool\\\")\", bool <= bool)\n        assertSQL(\"(\\\"bool\\\" <= \\\"boolOptional\\\")\", bool <= boolOptional)\n        assertSQL(\"(\\\"boolOptional\\\" <= \\\"bool\\\")\", boolOptional <= bool)\n        assertSQL(\"(\\\"boolOptional\\\" <= \\\"boolOptional\\\")\", boolOptional <= boolOptional)\n        assertSQL(\"(\\\"bool\\\" <= 1)\", bool <= true)\n        assertSQL(\"(\\\"boolOptional\\\" <= 1)\", boolOptional <= true)\n        assertSQL(\"(1 <= \\\"bool\\\")\", true <= bool)\n        assertSQL(\"(1 <= \\\"boolOptional\\\")\", true <= boolOptional)\n    }\n\n    func test_patternMatchingOperator_withComparableCountableClosedRange_buildsBetweenBooleanExpression() {\n        assertSQL(\"\\\"int\\\" BETWEEN 0 AND 5\", 0...5 ~= int)\n        assertSQL(\"\\\"intOptional\\\" BETWEEN 0 AND 5\", 0...5 ~= intOptional)\n    }\n\n    func test_patternMatchingOperator_withComparableClosedRange_buildsBetweenBooleanExpression() {\n        assertSQL(\"\\\"double\\\" BETWEEN 1.2 AND 4.5\", 1.2...4.5 ~= double)\n        assertSQL(\"\\\"doubleOptional\\\" BETWEEN 1.2 AND 4.5\", 1.2...4.5 ~= doubleOptional)\n    }\n\n    func test_patternMatchingOperator_withComparableRange_buildsBooleanExpression() {\n        assertSQL(\"\\\"double\\\" >= 1.2 AND \\\"double\\\" < 4.5\", 1.2..<4.5 ~= double)\n        assertSQL(\"\\\"doubleOptional\\\" >= 1.2 AND \\\"doubleOptional\\\" < 4.5\", 1.2..<4.5 ~= doubleOptional)\n    }\n\n    func test_patternMatchingOperator_withComparablePartialRangeThrough_buildsBooleanExpression() {\n        assertSQL(\"\\\"double\\\" <= 4.5\", ...4.5 ~= double)\n        assertSQL(\"\\\"doubleOptional\\\" <= 4.5\", ...4.5 ~= doubleOptional)\n    }\n\n    func test_patternMatchingOperator_withComparablePartialRangeUpTo_buildsBooleanExpression() {\n        assertSQL(\"\\\"double\\\" < 4.5\", ..<4.5 ~= double)\n        assertSQL(\"\\\"doubleOptional\\\" < 4.5\", ..<4.5 ~= doubleOptional)\n    }\n\n    func test_patternMatchingOperator_withComparablePartialRangeFrom_buildsBooleanExpression() {\n        assertSQL(\"\\\"double\\\" >= 4.5\", 4.5... ~= double)\n        assertSQL(\"\\\"doubleOptional\\\" >= 4.5\", 4.5... ~= doubleOptional)\n    }\n\n    func test_patternMatchingOperator_withComparableClosedRangeString_buildsBetweenBooleanExpression() {\n        assertSQL(\"\\\"string\\\" BETWEEN 'a' AND 'b'\", \"a\"...\"b\" ~= string)\n        assertSQL(\"\\\"stringOptional\\\" BETWEEN 'a' AND 'b'\", \"a\"...\"b\" ~= stringOptional)\n    }\n\n    func test_doubleAndOperator_withBooleanExpressions_buildsCompoundExpression() {\n        assertSQL(\"(\\\"bool\\\" AND \\\"bool\\\")\", bool && bool)\n        assertSQL(\"(\\\"bool\\\" AND \\\"boolOptional\\\")\", bool && boolOptional)\n        assertSQL(\"(\\\"boolOptional\\\" AND \\\"bool\\\")\", boolOptional && bool)\n        assertSQL(\"(\\\"boolOptional\\\" AND \\\"boolOptional\\\")\", boolOptional && boolOptional)\n        assertSQL(\"(\\\"bool\\\" AND 1)\", bool && true)\n        assertSQL(\"(\\\"boolOptional\\\" AND 1)\", boolOptional && true)\n        assertSQL(\"(1 AND \\\"bool\\\")\", true && bool)\n        assertSQL(\"(1 AND \\\"boolOptional\\\")\", true && boolOptional)\n    }\n\n    func test_andFunction_withBooleanExpressions_buildsCompoundExpression() {\n        assertSQL(\"(\\\"bool\\\" AND \\\"bool\\\" AND \\\"bool\\\")\", and([bool, bool, bool]))\n        assertSQL(\"(\\\"bool\\\" AND \\\"bool\\\")\", and([bool, bool]))\n        assertSQL(\"(\\\"bool\\\")\", and([bool]))\n\n        assertSQL(\"(\\\"bool\\\" AND \\\"bool\\\" AND \\\"bool\\\")\", and(bool, bool, bool))\n        assertSQL(\"(\\\"bool\\\" AND \\\"bool\\\")\", and(bool, bool))\n        assertSQL(\"(\\\"bool\\\")\", and(bool))\n    }\n\n    func test_doubleOrOperator_withBooleanExpressions_buildsCompoundExpression() {\n        assertSQL(\"(\\\"bool\\\" OR \\\"bool\\\")\", bool || bool)\n        assertSQL(\"(\\\"bool\\\" OR \\\"boolOptional\\\")\", bool || boolOptional)\n        assertSQL(\"(\\\"boolOptional\\\" OR \\\"bool\\\")\", boolOptional || bool)\n        assertSQL(\"(\\\"boolOptional\\\" OR \\\"boolOptional\\\")\", boolOptional || boolOptional)\n        assertSQL(\"(\\\"bool\\\" OR 1)\", bool || true)\n        assertSQL(\"(\\\"boolOptional\\\" OR 1)\", boolOptional || true)\n        assertSQL(\"(1 OR \\\"bool\\\")\", true || bool)\n        assertSQL(\"(1 OR \\\"boolOptional\\\")\", true || boolOptional)\n    }\n\n    func test_orFunction_withBooleanExpressions_buildsCompoundExpression() {\n        assertSQL(\"(\\\"bool\\\" OR \\\"bool\\\" OR \\\"bool\\\")\", or([bool, bool, bool]))\n        assertSQL(\"(\\\"bool\\\" OR \\\"bool\\\")\", or([bool, bool]))\n        assertSQL(\"(\\\"bool\\\")\", or([bool]))\n\n        assertSQL(\"(\\\"bool\\\" OR \\\"bool\\\" OR \\\"bool\\\")\", or(bool, bool, bool))\n        assertSQL(\"(\\\"bool\\\" OR \\\"bool\\\")\", or(bool, bool))\n        assertSQL(\"(\\\"bool\\\")\", or(bool))\n    }\n\n    func test_unaryNotOperator_withBooleanExpressions_buildsNotExpression() {\n        assertSQL(\"NOT (\\\"bool\\\")\", !bool)\n        assertSQL(\"NOT (\\\"boolOptional\\\")\", !boolOptional)\n    }\n\n    func test_precedencePreserved() {\n        let n = SQLite.Expression<Int>(value: 1)\n        assertSQL(\"(((1 = 1) AND (1 = 1)) OR (1 = 1))\", (n == n && n == n) || n == n)\n        assertSQL(\"((1 = 1) AND ((1 = 1) OR (1 = 1)))\", n == n && (n == n || n == n))\n    }\n\n    func test_dateExpressionLessGreater() {\n        let begin = Date(timeIntervalSince1970: 0)\n        assertSQL(\"(\\\"date\\\" < '1970-01-01T00:00:00.000')\", date < begin)\n        assertSQL(\"(\\\"date\\\" > '1970-01-01T00:00:00.000')\", date > begin)\n        assertSQL(\"(\\\"date\\\" >= '1970-01-01T00:00:00.000')\", date >= begin)\n        assertSQL(\"(\\\"date\\\" <= '1970-01-01T00:00:00.000')\", date <= begin)\n    }\n\n    func test_dateExpressionRange() {\n        let begin = Date(timeIntervalSince1970: 0)\n        let end = Date(timeIntervalSince1970: 5000)\n        assertSQL(\n            \"\\\"date\\\" >= '1970-01-01T00:00:00.000' AND \\\"date\\\" < '1970-01-01T01:23:20.000'\",\n            (begin..<end) ~= date\n        )\n    }\n\n    func test_dateExpressionClosedRange() {\n        let begin = Date(timeIntervalSince1970: 0)\n        let end = Date(timeIntervalSince1970: 5000)\n        assertSQL(\n            \"\\\"date\\\" BETWEEN '1970-01-01T00:00:00.000' AND '1970-01-01T01:23:20.000'\",\n            (begin...end) ~= date\n        )\n    }\n\n}\n"
  },
  {
    "path": "Tests/SQLiteTests/Typed/QueryIntegrationTests.swift",
    "content": "import XCTest\n#if StandaloneSQLite\nimport sqlite3\n#elseif SQLCipher\nimport SQLCipher\n#elseif SQLiteSwiftCSQLite\nimport SQLiteSwiftCSQLite\n#else\nimport SQLite3 // SystemSQLite\n#endif\n@testable import SQLite\n\nclass QueryIntegrationTests: SQLiteTestCase {\n\n    let id = SQLite.Expression<Int64>(\"id\")\n    let email = SQLite.Expression<String>(\"email\")\n    let age = SQLite.Expression<Int>(\"age\")\n\n    override func setUpWithError() throws {\n        try super.setUpWithError()\n        try createUsersTable()\n    }\n\n    // MARK: -\n\n    func test_select() throws {\n        let managerId = SQLite.Expression<Int64>(\"manager_id\")\n        let managers = users.alias(\"managers\")\n\n        let alice = try db.run(users.insert(email <- \"alice@example.com\"))\n        _ = try db.run(users.insert(email <- \"betsy@example.com\", managerId <- alice))\n\n        for user in try db.prepare(users.join(managers, on: managers[id] == users[managerId])) {\n            _ = user[users[managerId]]\n        }\n    }\n\n    func test_prepareRowIterator() throws {\n        let names = [\"a\", \"b\", \"c\"]\n        try insertUsers(names)\n\n        let emailColumn = SQLite.Expression<String>(\"email\")\n        let emails = try db.prepareRowIterator(users).map { $0[emailColumn] }\n\n        XCTAssertEqual(names.map({ \"\\($0)@example.com\" }), emails.sorted())\n    }\n\n    func test_ambiguousMap() throws {\n        let names = [\"a\", \"b\", \"c\"]\n        try insertUsers(names)\n\n        let emails = try db.prepare(\"select email from users\", []).map { $0[0] as! String  }\n\n        XCTAssertEqual(names.map({ \"\\($0)@example.com\" }), emails.sorted())\n    }\n\n    func test_select_optional() throws {\n        let managerId = SQLite.Expression<Int64?>(\"manager_id\")\n        let managers = users.alias(\"managers\")\n\n        let alice = try db.run(users.insert(email <- \"alice@example.com\"))\n        _ = try db.run(users.insert(email <- \"betsy@example.com\", managerId <- alice))\n\n        for user in try db.prepare(users.join(managers, on: managers[id] == users[managerId])) {\n            _ = user[users[managerId]]\n        }\n    }\n\n    func test_select_codable() throws {\n        let table = Table(\"codable\")\n        try db.run(table.create { builder in\n            builder.column(SQLite.Expression<Int>(\"int\"))\n            builder.column(SQLite.Expression<String>(\"string\"))\n            builder.column(SQLite.Expression<Bool>(\"bool\"))\n            builder.column(SQLite.Expression<Double>(\"float\"))\n            builder.column(SQLite.Expression<Double>(\"double\"))\n            builder.column(SQLite.Expression<Date>(\"date\"))\n            builder.column(SQLite.Expression<UUID>(\"uuid\"))\n            builder.column(SQLite.Expression<String?>(\"optional\"))\n            builder.column(SQLite.Expression<Data>(\"sub\"))\n        })\n\n        let value1 = TestCodable(int: 1, string: \"2\", bool: true, float: 3, double: 4,\n                                 date: Date(timeIntervalSince1970: 0), uuid: testUUIDValue, optional: nil, sub: nil)\n        let value = TestCodable(int: 5, string: \"6\", bool: true, float: 7, double: 8,\n                                date: Date(timeIntervalSince1970: 5000), uuid: testUUIDValue, optional: \"optional\", sub: value1)\n        try db.run(table.insert(value))\n\n        let rows = try db.prepare(table)\n        let values: [TestCodable] = try rows.map({ try $0.decode() })\n        XCTAssertEqual(values.count, 1)\n        XCTAssertEqual(values[0].int, 5)\n        XCTAssertEqual(values[0].string, \"6\")\n        XCTAssertEqual(values[0].bool, true)\n        XCTAssertEqual(values[0].float, 7)\n        XCTAssertEqual(values[0].double, 8)\n        XCTAssertEqual(values[0].date, Date(timeIntervalSince1970: 5000))\n        XCTAssertEqual(values[0].uuid, testUUIDValue)\n        XCTAssertEqual(values[0].optional, \"optional\")\n        XCTAssertEqual(values[0].sub?.int, 1)\n        XCTAssertEqual(values[0].sub?.string, \"2\")\n        XCTAssertEqual(values[0].sub?.bool, true)\n        XCTAssertEqual(values[0].sub?.float, 3)\n        XCTAssertEqual(values[0].sub?.double, 4)\n        XCTAssertEqual(values[0].sub?.date, Date(timeIntervalSince1970: 0))\n        XCTAssertNil(values[0].sub?.optional)\n        XCTAssertNil(values[0].sub?.sub)\n    }\n\n    func test_scalar() throws {\n        XCTAssertEqual(0, try db.scalar(users.count))\n        XCTAssertEqual(false, try db.scalar(users.exists))\n\n        try insertUsers(\"alice\")\n        XCTAssertEqual(1, try db.scalar(users.select(id.average)))\n    }\n\n    func test_pluck() throws {\n        let rowid = try db.run(users.insert(email <- \"alice@example.com\"))\n        XCTAssertEqual(rowid, try db.pluck(users)![id])\n    }\n\n    func test_insert() throws {\n        let id = try db.run(users.insert(email <- \"alice@example.com\"))\n        XCTAssertEqual(1, id)\n    }\n\n    func test_insert_many() throws {\n        let id = try db.run(users.insertMany([[email <- \"alice@example.com\"], [email <- \"geoff@example.com\"]]))\n        XCTAssertEqual(2, id)\n    }\n\n    func test_insert_many_encodables() throws {\n        let table = Table(\"codable\")\n        try db.run(table.create { builder in\n            builder.column(SQLite.Expression<Int?>(\"int\"))\n            builder.column(SQLite.Expression<String?>(\"string\"))\n            builder.column(SQLite.Expression<Bool?>(\"bool\"))\n            builder.column(SQLite.Expression<Double?>(\"float\"))\n            builder.column(SQLite.Expression<Double?>(\"double\"))\n            builder.column(SQLite.Expression<Date?>(\"date\"))\n            builder.column(SQLite.Expression<UUID?>(\"uuid\"))\n        })\n\n        let value1 = TestOptionalCodable(int: 5, string: \"6\", bool: true, float: 7, double: 8,\n                                         date: Date(timeIntervalSince1970: 5000), uuid: testUUIDValue)\n        let valueWithNils = TestOptionalCodable(int: nil, string: nil, bool: nil, float: nil, double: nil, date: nil, uuid: nil)\n        try db.run(table.insertMany([value1, valueWithNils]))\n\n         let rows = try db.prepare(table)\n         let values: [TestOptionalCodable] = try rows.map({ try $0.decode() })\n         XCTAssertEqual(values.count, 2)\n    }\n\n    func test_insert_custom_encodable_type() throws {\n        struct TestTypeWithOptionalArray: Codable {\n            var myInt: Int\n            var myString: String\n            var myOptionalArray: [Int]?\n        }\n\n        let table = Table(\"custom_codable\")\n        try db.run(table.create { builder in\n            builder.column(SQLite.Expression<Int?>(\"myInt\"))\n            builder.column(SQLite.Expression<String?>(\"myString\"))\n            builder.column(SQLite.Expression<String?>(\"myOptionalArray\"))\n        })\n\n        let customType = TestTypeWithOptionalArray(myInt: 13, myString: \"foo\", myOptionalArray: [1, 2, 3])\n        try db.run(table.insert(customType))\n        let rows = try db.prepare(table)\n        let values: [TestTypeWithOptionalArray] = try rows.map({ try $0.decode() })\n        XCTAssertEqual(values.count, 1, \"return one optional custom type\")\n\n        let customTypeWithNil = TestTypeWithOptionalArray(myInt: 123, myString: \"String\", myOptionalArray: nil)\n        try db.run(table.insert(customTypeWithNil))\n        let rowsNil = try db.prepare(table)\n        let valuesNil: [TestTypeWithOptionalArray] = try rowsNil.map({ try $0.decode() })\n        XCTAssertEqual(valuesNil.count, 2, \"return two custom objects, including one that contains a nil optional\")\n    }\n\n    func test_upsert() throws {\n        try XCTSkipUnless(db.satisfiesMinimumVersion(minor: 24))\n        let fetchAge = { () throws -> Int? in\n            try self.db.pluck(self.users.filter(self.email == \"alice@example.com\")).flatMap { $0[self.age] }\n        }\n\n        let id = try db.run(users.upsert(email <- \"alice@example.com\", age <- 30, onConflictOf: email))\n        XCTAssertEqual(1, id)\n        XCTAssertEqual(30, try fetchAge())\n\n        let nextId = try db.run(users.upsert(email <- \"alice@example.com\", age <- 42, onConflictOf: email))\n        XCTAssertEqual(1, nextId)\n        XCTAssertEqual(42, try fetchAge())\n    }\n\n    func test_update() throws {\n        let changes = try db.run(users.update(email <- \"alice@example.com\"))\n        XCTAssertEqual(0, changes)\n    }\n\n    func test_delete() throws {\n        let changes = try db.run(users.delete())\n        XCTAssertEqual(0, changes)\n    }\n\n    func test_union() throws {\n        let expectedIDs = [\n            try db.run(users.insert(email <- \"alice@example.com\")),\n            try db.run(users.insert(email <- \"sally@example.com\"))\n        ]\n\n        let query1 = users.filter(email == \"alice@example.com\")\n        let query2 = users.filter(email == \"sally@example.com\")\n\n        let actualIDs = try db.prepare(query1.union(query2)).map { $0[id] }\n        XCTAssertEqual(expectedIDs, actualIDs)\n\n        let query3 = users.select(users[*], SQLite.Expression<Int>(literal: \"1 AS weight\")).filter(email == \"sally@example.com\")\n        let query4 = users.select(users[*], SQLite.Expression<Int>(literal: \"2 AS weight\")).filter(email == \"alice@example.com\")\n\n        let sql = query3.union(query4).order(SQLite.Expression<Int>(literal: \"weight\")).asSQL()\n        XCTAssertEqual(sql,\n        \"\"\"\n        SELECT \"users\".*, 1 AS weight FROM \"users\" WHERE (\"email\" = 'sally@example.com') UNION \\\n        SELECT \"users\".*, 2 AS weight FROM \"users\" WHERE (\"email\" = 'alice@example.com') ORDER BY weight\n        \"\"\")\n\n        let orderedIDs = try db.prepare(query3.union(query4).order(SQLite.Expression<Int>(literal: \"weight\"), email)).map { $0[id] }\n        XCTAssertEqual(Array(expectedIDs.reversed()), orderedIDs)\n    }\n\n    func test_no_such_column() throws {\n        let doesNotExist = SQLite.Expression<String>(\"doesNotExist\")\n        try insertUser(\"alice\")\n        let row = try db.pluck(users.filter(email == \"alice@example.com\"))!\n\n        XCTAssertThrowsError(try row.get(doesNotExist)) { error in\n            if case QueryError.noSuchColumn(let name, _) = error {\n                XCTAssertEqual(\"\\\"doesNotExist\\\"\", name)\n            } else {\n                XCTFail(\"unexpected error: \\(error)\")\n            }\n        }\n    }\n\n    func test_catchConstraintError() throws {\n        try db.run(users.insert(email <- \"alice@example.com\"))\n        do {\n            try db.run(users.insert(email <- \"alice@example.com\"))\n            XCTFail(\"expected error\")\n        } catch let Result.error(_, code, _) where code == SQLITE_CONSTRAINT {\n            // expected\n        } catch let error {\n            XCTFail(\"unexpected error: \\(error)\")\n        }\n    }\n\n    func test_extendedErrorCodes_catchConstraintError() throws {\n        db.usesExtendedErrorCodes = true\n        try db.run(users.insert(email <- \"alice@example.com\"))\n        do {\n            try db.run(users.insert(email <- \"alice@example.com\"))\n            XCTFail(\"expected error\")\n        } catch let Result.extendedError(_, extendedCode, _) where extendedCode == 2_067 {\n            // SQLITE_CONSTRAINT_UNIQUE expected\n        } catch let error {\n            XCTFail(\"unexpected error: \\(error)\")\n        }\n    }\n\n    // https://github.com/stephencelis/SQLite.swift/issues/285\n    func test_order_by_random() throws {\n        try insertUsers([\"a\", \"b\", \"c'\"])\n        let result = Array(try db.prepare(users.select(email).order(SQLite.Expression<Int>.random()).limit(1)))\n        XCTAssertEqual(1, result.count)\n    }\n\n    func test_with_recursive() throws {\n        let nodes = Table(\"nodes\")\n        let id = SQLite.Expression<Int64>(\"id\")\n        let parent = SQLite.Expression<Int64?>(\"parent\")\n        let value = SQLite.Expression<Int64>(\"value\")\n\n        try db.run(nodes.create { builder in\n            builder.column(id)\n            builder.column(parent)\n            builder.column(value)\n        })\n\n        try db.run(nodes.insertMany([\n            [id <- 0, parent <- nil, value <- 2],\n            [id <- 1, parent <- 0, value <- 4],\n            [id <- 2, parent <- 0, value <- 9],\n            [id <- 3, parent <- 2, value <- 8],\n            [id <- 4, parent <- 2, value <- 7],\n            [id <- 5, parent <- 4, value <- 3]\n        ]))\n\n        // Compute the sum of the values of node 5 and its ancestors\n        let ancestors = Table(\"ancestors\")\n        let sum = try db.scalar(\n            ancestors\n                .select(value.sum)\n                .with(ancestors,\n                      columns: [id, parent, value],\n                      recursive: true,\n                      as: nodes\n                        .where(id == 5)\n                        .union(all: true,\n                               nodes.join(ancestors, on: nodes[id] == ancestors[parent])\n                                    .select(nodes[id], nodes[parent], nodes[value])\n                              )\n                     )\n        )\n\n        XCTAssertEqual(21, sum)\n    }\n\n    /// Verify that `*` is properly expanded in a SELECT statement following a WITH clause.\n    func test_with_glob_expansion() throws {\n        let names = Table(\"names\")\n        let name = SQLite.Expression<String>(\"name\")\n        try db.run(names.create { builder in\n            builder.column(email)\n            builder.column(name)\n        })\n\n        try db.run(users.insert(email <- \"alice@example.com\"))\n        try db.run(names.insert(email <- \"alice@example.com\", name <- \"Alice\"))\n\n        // WITH intermediate AS ( SELECT ... ) SELECT * FROM intermediate\n        let intermediate = Table(\"intermediate\")\n        let rows = try db.prepare(\n            intermediate\n                .with(intermediate,\n                      as: users\n                        .select([id, users[email], name])\n                        .join(names, on: names[email] == users[email])\n                        .where(users[email] == \"alice@example.com\")\n                     ))\n\n        // There should be at least one row in the result.\n        let row = try XCTUnwrap(rows.makeIterator().next())\n\n        // Verify the column names\n        XCTAssertEqual(row.columnNames.count, 3)\n        XCTAssertNotNil(row[id])\n        XCTAssertNotNil(row[name])\n        XCTAssertNotNil(row[email])\n    }\n\n    func test_select_ntile_function() throws {\n        let users = Table(\"users\")\n\n        try insertUser(\"Joey\")\n        try insertUser(\"Timmy\")\n        try insertUser(\"Jimmy\")\n        try insertUser(\"Billy\")\n\n        let bucket = ntile(1, id.asc)\n        try db.prepare(users.select(id, bucket)).forEach {\n            XCTAssertEqual($0[bucket], 1) // only 1 window\n        }\n    }\n\n    func test_select_cume_dist_function() throws {\n        let users = Table(\"users\")\n\n        try insertUser(\"Joey\")\n        try insertUser(\"Timmy\")\n        try insertUser(\"Jimmy\")\n        try insertUser(\"Billy\")\n\n        let cumeDist = cumeDist(email)\n        let results = try db.prepare(users.select(id, cumeDist)).map {\n            $0[cumeDist]\n        }\n        XCTAssertEqual([0.25, 0.5, 0.75, 1], results)\n    }\n\n    func test_select_window_row_number() throws {\n        let users = Table(\"users\")\n\n        try insertUser(\"Billy\")\n        try insertUser(\"Jimmy\")\n        try insertUser(\"Joey\")\n        try insertUser(\"Timmy\")\n\n        let rowNumber = rowNumber(email.asc)\n        var expectedRowNum = 1\n        try db.prepare(users.select(id, rowNumber)).forEach {\n            // should retrieve row numbers in order of INSERT above\n            XCTAssertEqual($0[rowNumber], expectedRowNum)\n            expectedRowNum += 1\n        }\n    }\n\n    func test_select_window_ranking() throws {\n        let users = Table(\"users\")\n\n        try insertUser(\"Billy\")\n        try insertUser(\"Jimmy\")\n        try insertUser(\"Joey\")\n        try insertUser(\"Timmy\")\n\n        let percentRank = percentRank(email)\n        let actualPercentRank: [Int] = try db.prepare(users.select(id, percentRank)).map {\n            Int($0[percentRank] * 100)\n        }\n        XCTAssertEqual([0, 33, 66, 100], actualPercentRank)\n\n        let rank = rank(email)\n        let actualRank: [Int] = try db.prepare(users.select(id, rank)).map {\n            $0[rank]\n        }\n        XCTAssertEqual([1, 2, 3, 4], actualRank)\n\n        let denseRank = denseRank(email)\n        let actualDenseRank: [Int] = try db.prepare(users.select(id, denseRank)).map {\n            $0[denseRank]\n        }\n        XCTAssertEqual([1, 2, 3, 4], actualDenseRank)\n    }\n\n    func test_select_window_values() throws {\n        let users = Table(\"users\")\n\n        try insertUser(\"Billy\")\n        try insertUser(\"Jimmy\")\n        try insertUser(\"Joey\")\n        try insertUser(\"Timmy\")\n\n        let firstValue = email.firstValue(email.desc)\n        try db.prepare(users.select(id, firstValue)).forEach {\n            XCTAssertEqual($0[firstValue], \"Timmy@example.com\") // should grab last email alphabetically\n        }\n\n        let lastValue = email.lastValue(email.asc)\n        var row = try db.pluck(users.select(id, lastValue))!\n        XCTAssertEqual(row[lastValue], \"Billy@example.com\")\n\n        let nthValue = email.value(1, email.asc)\n        row = try db.pluck(users.select(id, nthValue))!\n        XCTAssertEqual(row[nthValue], \"Billy@example.com\")\n    }\n}\n\nextension Connection {\n    func satisfiesMinimumVersion(minor: Int, patch: Int = 0) -> Bool {\n        guard let version = try? scalar(\"SELECT sqlite_version()\") as? String else { return false }\n        let components = version.split(separator: \".\", maxSplits: 3).compactMap { Int($0) }\n        guard components.count == 3 else { return false }\n\n        return components[1] >= minor && components[2] >= patch\n    }\n}\n"
  },
  {
    "path": "Tests/SQLiteTests/Typed/QueryTests.swift",
    "content": "import XCTest\n@testable import SQLite\n\nclass QueryTests: XCTestCase {\n\n    let users = Table(\"users\")\n    let id = SQLite.Expression<Int64>(\"id\")\n    let email = SQLite.Expression<String>(\"email\")\n    let age = SQLite.Expression<Int?>(\"age\")\n    let admin = SQLite.Expression<Bool>(\"admin\")\n    let optionalAdmin = SQLite.Expression<Bool?>(\"admin\")\n\n    let posts = Table(\"posts\")\n    let userId = SQLite.Expression<Int64>(\"user_id\")\n    let categoryId = SQLite.Expression<Int64>(\"category_id\")\n    let published = SQLite.Expression<Bool>(\"published\")\n\n    let categories = Table(\"categories\")\n    let tag = SQLite.Expression<String>(\"tag\")\n\n    func test_select_withExpression_compilesSelectClause() {\n        assertSQL(\"SELECT \\\"email\\\" FROM \\\"users\\\"\", users.select(email))\n    }\n\n    func test_select_withStarExpression_compilesSelectClause() {\n        assertSQL(\"SELECT * FROM \\\"users\\\"\", users.select(*))\n    }\n\n    func test_select_withNamespacedStarExpression_compilesSelectClause() {\n        assertSQL(\"SELECT \\\"users\\\".* FROM \\\"users\\\"\", users.select(users[*]))\n    }\n\n    func test_select_withVariadicExpressions_compilesSelectClause() {\n        assertSQL(\"SELECT \\\"email\\\", count(*) FROM \\\"users\\\"\", users.select(email, count(*)))\n    }\n\n    func test_select_withExpressions_compilesSelectClause() {\n        assertSQL(\"SELECT \\\"email\\\", count(*) FROM \\\"users\\\"\", users.select([email, count(*)]))\n    }\n\n    func test_selectDistinct_withExpression_compilesSelectClause() {\n        assertSQL(\"SELECT DISTINCT \\\"age\\\" FROM \\\"users\\\"\", users.select(distinct: age))\n    }\n\n    func test_selectDistinct_withExpressions_compilesSelectClause() {\n        assertSQL(\"SELECT DISTINCT \\\"age\\\", \\\"admin\\\" FROM \\\"users\\\"\", users.select(distinct: [age, admin]))\n    }\n\n    func test_selectDistinct_withStar_compilesSelectClause() {\n        assertSQL(\"SELECT DISTINCT * FROM \\\"users\\\"\", users.select(distinct: *))\n    }\n\n    func test_union_compilesUnionClause() {\n        assertSQL(\"SELECT * FROM \\\"users\\\" UNION SELECT * FROM \\\"posts\\\"\", users.union(posts))\n    }\n\n    func test_union_compilesUnionAllClause() {\n        assertSQL(\"SELECT * FROM \\\"users\\\" UNION ALL SELECT * FROM \\\"posts\\\"\", users.union(all: true, posts))\n    }\n\n    func test_join_compilesJoinClause() {\n        assertSQL(\n            \"SELECT * FROM \\\"users\\\" INNER JOIN \\\"posts\\\" ON (\\\"posts\\\".\\\"user_id\\\" = \\\"users\\\".\\\"id\\\")\",\n            users.join(posts, on: posts[userId] == users[id])\n        )\n    }\n\n    func test_join_withExplicitType_compilesJoinClauseWithType() {\n        assertSQL(\n            \"SELECT * FROM \\\"users\\\" LEFT OUTER JOIN \\\"posts\\\" ON (\\\"posts\\\".\\\"user_id\\\" = \\\"users\\\".\\\"id\\\")\",\n            users.join(.leftOuter, posts, on: posts[userId] == users[id])\n        )\n\n        assertSQL(\n            \"SELECT * FROM \\\"users\\\" CROSS JOIN \\\"posts\\\" ON (\\\"posts\\\".\\\"user_id\\\" = \\\"users\\\".\\\"id\\\")\",\n            users.join(.cross, posts, on: posts[userId] == users[id])\n        )\n    }\n\n    func test_join_withTableCondition_compilesJoinClauseWithTableCondition() {\n        assertSQL(\n            \"SELECT * FROM \\\"users\\\" INNER JOIN \\\"posts\\\" ON ((\\\"posts\\\".\\\"user_id\\\" = \\\"users\\\".\\\"id\\\") AND \\\"published\\\")\",\n            users.join(posts.filter(published), on: posts[userId] == users[id])\n        )\n    }\n\n    func test_join_whenChained_compilesAggregateJoinClause() {\n        assertSQL(\n            \"SELECT * FROM \\\"users\\\" \" +\n            \"INNER JOIN \\\"posts\\\" ON (\\\"posts\\\".\\\"user_id\\\" = \\\"users\\\".\\\"id\\\") \" +\n            \"INNER JOIN \\\"categories\\\" ON (\\\"categories\\\".\\\"id\\\" = \\\"posts\\\".\\\"category_id\\\")\",\n            users.join(posts, on: posts[userId] == users[id]).join(categories, on: categories[id] == posts[categoryId])\n        )\n    }\n\n    func test_filter_compilesWhereClause() {\n        assertSQL(\"SELECT * FROM \\\"users\\\" WHERE (\\\"admin\\\" = 1)\", users.filter(admin == true))\n    }\n\n    func test_filter_compilesWhereClause_false() {\n        assertSQL(\"SELECT * FROM \\\"users\\\" WHERE (\\\"admin\\\" = 0)\", users.filter(admin == false))\n    }\n\n    func test_filter_compilesWhereClause_optional() {\n        assertSQL(\"SELECT * FROM \\\"users\\\" WHERE (\\\"admin\\\" = 1)\", users.filter(optionalAdmin == true))\n    }\n\n    func test_filter_compilesWhereClause_optional_false() {\n        assertSQL(\"SELECT * FROM \\\"users\\\" WHERE (\\\"admin\\\" = 0)\", users.filter(optionalAdmin == false))\n    }\n\n    func test_where_compilesWhereClause() {\n        assertSQL(\"SELECT * FROM \\\"users\\\" WHERE (\\\"admin\\\" = 1)\", users.where(admin == true))\n    }\n\n    func test_where_compilesWhereClause_false() {\n        assertSQL(\"SELECT * FROM \\\"users\\\" WHERE (\\\"admin\\\" = 0)\", users.where(admin == false))\n    }\n\n    func test_where_compilesWhereClause_optional() {\n        assertSQL(\"SELECT * FROM \\\"users\\\" WHERE (\\\"admin\\\" = 1)\", users.where(optionalAdmin == true))\n    }\n\n    func test_where_compilesWhereClause_optional_false() {\n        assertSQL(\"SELECT * FROM \\\"users\\\" WHERE (\\\"admin\\\" = 0)\", users.where(optionalAdmin == false))\n    }\n\n    func test_filter_whenChained_compilesAggregateWhereClause() {\n        assertSQL(\n            \"SELECT * FROM \\\"users\\\" WHERE ((\\\"age\\\" >= 35) AND \\\"admin\\\")\",\n            users.filter(age >= 35).filter(admin)\n        )\n    }\n\n    func test_group_withSingleExpressionName_compilesGroupClause() {\n        assertSQL(\"SELECT * FROM \\\"users\\\" GROUP BY \\\"age\\\"\",\n            users.group(age))\n    }\n\n    func test_group_withVariadicExpressionNames_compilesGroupClause() {\n        assertSQL(\"SELECT * FROM \\\"users\\\" GROUP BY \\\"age\\\", \\\"admin\\\"\", users.group(age, admin))\n    }\n\n    func test_group_withExpressionNameAndHavingBindings_compilesGroupClause() {\n        assertSQL(\"SELECT * FROM \\\"users\\\" GROUP BY \\\"age\\\" HAVING \\\"admin\\\"\", users.group(age, having: admin))\n        assertSQL(\"SELECT * FROM \\\"users\\\" GROUP BY \\\"age\\\" HAVING (\\\"age\\\" >= 30)\", users.group(age, having: age >= 30))\n    }\n\n    func test_group_withExpressionNamesAndHavingBindings_compilesGroupClause() {\n        assertSQL(\n            \"SELECT * FROM \\\"users\\\" GROUP BY \\\"age\\\", \\\"admin\\\" HAVING \\\"admin\\\"\",\n            users.group([age, admin], having: admin)\n        )\n        assertSQL(\n            \"SELECT * FROM \\\"users\\\" GROUP BY \\\"age\\\", \\\"admin\\\" HAVING (\\\"age\\\" >= 30)\",\n            users.group([age, admin], having: age >= 30)\n        )\n    }\n\n    func test_order_withSingleExpressionName_compilesOrderClause() {\n        assertSQL(\"SELECT * FROM \\\"users\\\" ORDER BY \\\"age\\\"\", users.order(age))\n    }\n\n    func test_order_withVariadicExpressionNames_compilesOrderClause() {\n        assertSQL(\"SELECT * FROM \\\"users\\\" ORDER BY \\\"age\\\", \\\"email\\\"\", users.order(age, email))\n    }\n\n    func test_order_withArrayExpressionNames_compilesOrderClause() {\n        assertSQL(\"SELECT * FROM \\\"users\\\" ORDER BY \\\"age\\\", \\\"email\\\"\", users.order([age, email]))\n    }\n\n    func test_order_withExpressionAndSortDirection_compilesOrderClause() {\n//        AssertSQL(\"SELECT * FROM \\\"users\\\" ORDER BY \\\"age\\\" DESC, \\\"email\\\" ASC\", users.order(age.desc, email.asc))\n    }\n\n    func test_order_whenChained_resetsOrderClause() {\n        assertSQL(\"SELECT * FROM \\\"users\\\" ORDER BY \\\"age\\\"\", users.order(email).order(age))\n    }\n\n    func test_reverse_withoutOrder_ordersByRowIdDescending() {\n//        AssertSQL(\"SELECT * FROM \\\"users\\\" ORDER BY \\\"ROWID\\\" DESC\", users.reverse())\n    }\n\n    func test_reverse_withOrder_reversesOrder() {\n//        AssertSQL(\"SELECT * FROM \\\"users\\\" ORDER BY \\\"age\\\" DESC, \\\"email\\\" ASC\", users.order(age, email.desc).reverse())\n    }\n\n    func test_limit_compilesLimitClause() {\n        assertSQL(\"SELECT * FROM \\\"users\\\" LIMIT 5\", users.limit(5))\n    }\n\n    func test_limit_withOffset_compilesOffsetClause() {\n        assertSQL(\"SELECT * FROM \\\"users\\\" LIMIT 5 OFFSET 5\", users.limit(5, offset: 5))\n    }\n\n    func test_limit_whenChained_overridesLimit() {\n        let query = users.limit(5)\n\n        assertSQL(\"SELECT * FROM \\\"users\\\" LIMIT 10\", query.limit(10))\n        assertSQL(\"SELECT * FROM \\\"users\\\"\", query.limit(nil))\n    }\n\n    func test_limit_whenChained_withOffset_overridesOffset() {\n        let query = users.limit(5, offset: 5)\n\n        assertSQL(\"SELECT * FROM \\\"users\\\" LIMIT 10 OFFSET 20\", query.limit(10, offset: 20))\n        assertSQL(\"SELECT * FROM \\\"users\\\"\", query.limit(nil))\n    }\n\n    func test_alias_aliasesTable() {\n        let managerId = SQLite.Expression<Int64>(\"manager_id\")\n\n        let managers = users.alias(\"managers\")\n\n        assertSQL(\n            \"SELECT * FROM \\\"users\\\" \" +\n            \"INNER JOIN \\\"users\\\" AS \\\"managers\\\" ON (\\\"managers\\\".\\\"id\\\" = \\\"users\\\".\\\"manager_id\\\")\",\n            users.join(managers, on: managers[id] == users[managerId])\n        )\n    }\n\n    func test_with_compilesWithClause() {\n        let temp = Table(\"temp\")\n\n        assertSQL(\"WITH \\\"temp\\\" AS (SELECT * FROM \\\"users\\\") SELECT * FROM \\\"temp\\\"\",\n                  temp.with(temp, as: users))\n    }\n\n    func test_with_compilesWithRecursiveClause() {\n        let temp = Table(\"temp\")\n\n        assertSQL(\"WITH RECURSIVE \\\"temp\\\" AS (SELECT * FROM \\\"users\\\") SELECT * FROM \\\"temp\\\"\",\n                  temp.with(temp, recursive: true, as: users))\n    }\n\n    func test_with_compilesWithMaterializedClause() {\n        let temp = Table(\"temp\")\n\n        assertSQL(\"WITH \\\"temp\\\" AS MATERIALIZED (SELECT * FROM \\\"users\\\") SELECT * FROM \\\"temp\\\"\",\n                  temp.with(temp, hint: .materialized, as: users))\n    }\n\n    func test_with_compilesWithNotMaterializedClause() {\n        let temp = Table(\"temp\")\n\n        assertSQL(\"WITH \\\"temp\\\" AS NOT MATERIALIZED (SELECT * FROM \\\"users\\\") SELECT * FROM \\\"temp\\\"\",\n                  temp.with(temp, hint: .notMaterialized, as: users))\n    }\n\n    func test_with_columns_compilesWithClause() {\n        let temp = Table(\"temp\")\n\n        assertSQL(\"WITH \\\"temp\\\" (\\\"id\\\", \\\"email\\\") AS (SELECT * FROM \\\"users\\\") SELECT * FROM \\\"temp\\\"\",\n                  temp.with(temp, columns: [id, email], recursive: false, hint: nil, as: users))\n    }\n\n    func test_with_multiple_compilesWithClause() {\n        let temp = Table(\"temp\")\n        let second = Table(\"second\")\n        let third = Table(\"third\")\n\n        let query = temp\n            .with(temp, recursive: true, as: users)\n            .with(second, recursive: true, as: posts)\n            .with(third, hint: .materialized, as: categories)\n\n        assertSQL(\n            \"\"\"\n            WITH RECURSIVE \\\"temp\\\" AS (SELECT * FROM \\\"users\\\"),\n             \\\"second\\\" AS (SELECT * FROM \\\"posts\\\"),\n             \\\"third\\\" AS MATERIALIZED (SELECT * FROM \\\"categories\\\")\n             SELECT * FROM \\\"temp\\\"\n            \"\"\".replacingOccurrences(of: \"\\n\", with: \"\"),\n            query\n        )\n    }\n\n    func test_insert_compilesInsertExpression() {\n        assertSQL(\n            \"INSERT INTO \\\"users\\\" (\\\"email\\\", \\\"age\\\") VALUES ('alice@example.com', 30)\",\n            users.insert(email <- \"alice@example.com\", age <- 30)\n        )\n    }\n\n    func test_insert_withOnConflict_compilesInsertOrOnConflictExpression() {\n        assertSQL(\n            \"INSERT OR REPLACE INTO \\\"users\\\" (\\\"email\\\", \\\"age\\\") VALUES ('alice@example.com', 30)\",\n            users.insert(or: .replace, email <- \"alice@example.com\", age <- 30)\n        )\n    }\n\n    func test_insert_compilesInsertExpressionWithDefaultValues() {\n        assertSQL(\"INSERT INTO \\\"users\\\" DEFAULT VALUES\", users.insert())\n    }\n\n    func test_insert_withQuery_compilesInsertExpressionWithSelectStatement() {\n        let emails = Table(\"emails\")\n\n        assertSQL(\n            \"INSERT INTO \\\"emails\\\" SELECT \\\"email\\\" FROM \\\"users\\\" WHERE \\\"admin\\\"\",\n            emails.insert(users.select(email).filter(admin))\n        )\n    }\n\n    func test_insert_many_compilesInsertManyExpression() {\n        assertSQL(\n            \"\"\"\n            INSERT INTO \\\"users\\\" (\\\"email\\\", \\\"age\\\") VALUES ('alice@example.com', 30), ('geoff@example.com', 32),\n             ('alex@example.com', 83)\n            \"\"\".replacingOccurrences(of: \"\\n\", with: \"\"),\n            users.insertMany([[email <- \"alice@example.com\", age <- 30],\n                              [email <- \"geoff@example.com\", age <- 32], [email <- \"alex@example.com\", age <- 83]])\n        )\n    }\n    func test_insert_many_compilesInsertManyNoneExpression() {\n        assertSQL(\n            \"INSERT INTO \\\"users\\\" DEFAULT VALUES\",\n            users.insertMany([])\n        )\n    }\n\n    func test_insert_many_withOnConflict_compilesInsertManyOrOnConflictExpression() {\n        assertSQL(\n            \"\"\"\n            INSERT OR REPLACE INTO \\\"users\\\" (\\\"email\\\", \\\"age\\\") VALUES ('alice@example.com', 30),\n             ('geoff@example.com', 32), ('alex@example.com', 83)\n            \"\"\".replacingOccurrences(of: \"\\n\", with: \"\"),\n            users.insertMany(or: .replace, [[email <- \"alice@example.com\", age <- 30],\n                                            [email <- \"geoff@example.com\", age <- 32],\n                                            [email <- \"alex@example.com\", age <- 83]])\n        )\n    }\n\n    func test_insert_encodable() throws {\n        let emails = Table(\"emails\")\n        let value = TestCodable(int: 1, string: \"2\", bool: true, float: 3, double: 4,\n                                date: Date(timeIntervalSince1970: 0), uuid: testUUIDValue, optional: nil, sub: nil)\n        let insert = try emails.insert(value)\n        assertSQL(\n            \"\"\"\n            INSERT INTO \\\"emails\\\" (\\\"int\\\", \\\"string\\\", \\\"bool\\\", \\\"float\\\", \\\"double\\\", \\\"date\\\", \\\"uuid\\\")\n             VALUES (1, '2', 1, 3.0, 4.0, '1970-01-01T00:00:00.000', 'E621E1F8-C36C-495A-93FC-0C247A3E6E5F')\n            \"\"\".replacingOccurrences(of: \"\\n\", with: \"\"),\n            insert\n        )\n    }\n\n    #if !os(Linux) // depends on exact JSON serialization\n    func test_insert_encodable_with_nested_encodable() throws {\n        let emails = Table(\"emails\")\n        let value1 = TestCodable(int: 1, string: \"2\", bool: true, float: 3, double: 4,\n                                 date: Date(timeIntervalSince1970: 0), uuid: testUUIDValue, optional: nil, sub: nil)\n        let value = TestCodable(int: 1, string: \"2\", bool: true, float: 3, double: 4,\n                                date: Date(timeIntervalSince1970: 0), uuid: testUUIDValue, optional: \"optional\", sub: value1)\n        let insert = try emails.insert(value)\n        let encodedJSON = try JSONEncoder().encode(value1)\n        let encodedJSONString = String(data: encodedJSON, encoding: .utf8)!\n\n        let expectedSQL =\n            \"\"\"\n            INSERT INTO \\\"emails\\\" (\\\"int\\\", \\\"string\\\", \\\"bool\\\", \\\"float\\\", \\\"double\\\", \\\"date\\\", \\\"uuid\\\", \\\"optional\\\",\n             \\\"sub\\\") VALUES (1, '2', 1, 3.0, 4.0, '1970-01-01T00:00:00.000', 'E621E1F8-C36C-495A-93FC-0C247A3E6E5F',\n             'optional', '\\(encodedJSONString)')\n            \"\"\".replacingOccurrences(of: \"\\n\", with: \"\")\n\n        // As JSON serialization gives a different result each time, we extract JSON and compare it by deserializing it\n        // and keep comparing the query but with the json replaced by the `JSON` string\n        let (expectedQuery, expectedJSON) = extractAndReplace(expectedSQL, regex: \"\\\\{.*\\\\}\", with: \"JSON\")\n        let (actualQuery, actualJSON) = extractAndReplace(insert.asSQL(), regex: \"\\\\{.*\\\\}\", with: \"JSON\")\n        XCTAssertEqual(expectedQuery, actualQuery)\n        XCTAssertEqual(\n            try JSONDecoder().decode(TestCodable.self, from: expectedJSON.data(using: .utf8)!),\n            try JSONDecoder().decode(TestCodable.self, from: actualJSON.data(using: .utf8)!)\n        )\n    }\n    #endif\n\n    func test_insert_and_search_for_UUID() throws {\n        struct Test: Codable {\n            var uuid: UUID\n            var string: String\n        }\n        let testUUID = UUID()\n        let testValue = Test(uuid: testUUID, string: \"value\")\n        let db = try Connection(.temporary)\n        try db.run(table.create { t in\n            t.column(uuid)\n            t.column(string)\n        }\n        )\n\n        let iQuery = try table.insert(testValue)\n        try db.run(iQuery)\n\n        let fQuery = table.filter(uuid == testUUID)\n        if let result = try db.pluck(fQuery) {\n            let testValueReturned = Test(uuid: result[uuid], string: result[string])\n            XCTAssertEqual(testUUID, testValueReturned.uuid)\n        } else {\n            XCTFail(\"Search for uuid failed\")\n        }\n    }\n\n    func test_upsert_withOnConflict_compilesInsertOrOnConflictExpression() {\n        assertSQL(\n            \"\"\"\n            INSERT INTO \\\"users\\\" (\\\"email\\\", \\\"age\\\") VALUES ('alice@example.com', 30) ON CONFLICT (\\\"email\\\")\n             DO UPDATE SET \\\"age\\\" = \\\"excluded\\\".\\\"age\\\"\n            \"\"\".replacingOccurrences(of: \"\\n\", with: \"\"),\n            users.upsert(email <- \"alice@example.com\", age <- 30, onConflictOf: email)\n        )\n    }\n\n    func test_upsert_encodable() throws {\n        let emails = Table(\"emails\")\n        let string = SQLite.Expression<String>(\"string\")\n        let value = TestCodable(int: 1, string: \"2\", bool: true, float: 3, double: 4,\n                                date: Date(timeIntervalSince1970: 0), uuid: testUUIDValue, optional: nil, sub: nil)\n        let insert = try emails.upsert(value, onConflictOf: string)\n        assertSQL(\n            \"\"\"\n            INSERT INTO \\\"emails\\\" (\\\"int\\\", \\\"string\\\", \\\"bool\\\", \\\"float\\\", \\\"double\\\", \\\"date\\\", \\\"uuid\\\")\n             VALUES (1, '2', 1, 3.0, 4.0, '1970-01-01T00:00:00.000', 'E621E1F8-C36C-495A-93FC-0C247A3E6E5F') ON CONFLICT (\\\"string\\\")\n             DO UPDATE SET \\\"int\\\" = \\\"excluded\\\".\\\"int\\\", \\\"bool\\\" = \\\"excluded\\\".\\\"bool\\\",\n             \\\"float\\\" = \\\"excluded\\\".\\\"float\\\", \\\"double\\\" = \\\"excluded\\\".\\\"double\\\", \\\"date\\\" = \\\"excluded\\\".\\\"date\\\",\n             \\\"uuid\\\" = \\\"excluded\\\".\\\"uuid\\\"\n            \"\"\".replacingOccurrences(of: \"\\n\", with: \"\"),\n            insert\n        )\n    }\n\n    func test_insert_many_encodables() throws {\n        let emails = Table(\"emails\")\n        let value1 = TestCodable(int: 1, string: \"2\", bool: true, float: 3, double: 4,\n                                 date: Date(timeIntervalSince1970: 0), uuid: testUUIDValue, optional: nil, sub: nil)\n        let value2 = TestCodable(int: 2, string: \"3\", bool: true, float: 3, double: 5,\n                                 date: Date(timeIntervalSince1970: 0), uuid: testUUIDValue, optional: \"optional\", sub: nil)\n        let value3 = TestCodable(int: 3, string: \"4\", bool: true, float: 3, double: 6,\n                                 date: Date(timeIntervalSince1970: 0), uuid: testUUIDValue, optional: nil, sub: nil)\n        let insert = try emails.insertMany([value1, value2, value3])\n        assertSQL(\n            \"\"\"\n            INSERT INTO \\\"emails\\\" (\\\"int\\\", \\\"string\\\", \\\"bool\\\", \\\"float\\\", \\\"double\\\", \\\"date\\\", \\\"uuid\\\", \\\"optional\\\", \\\"sub\\\")\n             VALUES (1, '2', 1, 3.0, 4.0, '1970-01-01T00:00:00.000', 'E621E1F8-C36C-495A-93FC-0C247A3E6E5F', NULL, NULL),\n             (2, '3', 1, 3.0, 5.0, '1970-01-01T00:00:00.000', 'E621E1F8-C36C-495A-93FC-0C247A3E6E5F', 'optional', NULL),\n             (3, '4', 1, 3.0, 6.0, '1970-01-01T00:00:00.000', 'E621E1F8-C36C-495A-93FC-0C247A3E6E5F', NULL, NULL)\n            \"\"\".replacingOccurrences(of: \"\\n\", with: \"\"),\n            insert\n        )\n    }\n\n    func test_update_compilesUpdateExpression() {\n        assertSQL(\n            \"UPDATE \\\"users\\\" SET \\\"age\\\" = 30, \\\"admin\\\" = 1 WHERE (\\\"id\\\" = 1)\",\n            users.filter(id == 1).update(age <- 30, admin <- true)\n        )\n    }\n\n    func test_update_compilesUpdateLimitOrderExpression() {\n        assertSQL(\n            \"UPDATE \\\"users\\\" SET \\\"age\\\" = 30 ORDER BY \\\"id\\\" LIMIT 1\",\n            users.order(id).limit(1).update(age <- 30)\n        )\n    }\n\n    func test_update_encodable() throws {\n        let emails = Table(\"emails\")\n        let value = TestCodable(int: 1, string: \"2\", bool: true, float: 3, double: 4,\n                                date: Date(timeIntervalSince1970: 0), uuid: testUUIDValue, optional: nil, sub: nil)\n        let update = try emails.update(value)\n        assertSQL(\n            \"\"\"\n            UPDATE \\\"emails\\\" SET \\\"int\\\" = 1, \\\"string\\\" = '2', \\\"bool\\\" = 1, \\\"float\\\" = 3.0, \\\"double\\\" = 4.0,\n             \\\"date\\\" = '1970-01-01T00:00:00.000', \\\"uuid\\\" = 'E621E1F8-C36C-495A-93FC-0C247A3E6E5F'\n            \"\"\".replacingOccurrences(of: \"\\n\", with: \"\"),\n            update\n        )\n    }\n\n    func test_update_encodable_with_nested_encodable() throws {\n        let emails = Table(\"emails\")\n        let value1 = TestCodable(int: 1, string: \"2\", bool: true, float: 3, double: 4,\n                                 date: Date(timeIntervalSince1970: 0), uuid: testUUIDValue, optional: nil, sub: nil)\n        let value = TestCodable(int: 1, string: \"2\", bool: true, float: 3, double: 4,\n                                date: Date(timeIntervalSince1970: 0), uuid: testUUIDValue, optional: nil, sub: value1)\n        let update = try emails.update(value)\n\n        // NOTE: As Linux JSON decoding doesn't order keys the same way, we need to check prefix, suffix,\n        // and extract JSON to decode it and check the decoded object.\n\n        let expectedPrefix =\n            \"\"\"\n            UPDATE \\\"emails\\\" SET \\\"int\\\" = 1, \\\"string\\\" = '2', \\\"bool\\\" = 1, \\\"float\\\" = 3.0, \\\"double\\\" = 4.0,\n             \\\"date\\\" = '1970-01-01T00:00:00.000', \\\"uuid\\\" = 'E621E1F8-C36C-495A-93FC-0C247A3E6E5F', \\\"sub\\\" = '\n            \"\"\".replacingOccurrences(of: \"\\n\", with: \"\")\n        let expectedSuffix = \"'\"\n\n        let sql = update.asSQL()\n        XCTAssert(sql.hasPrefix(expectedPrefix))\n        XCTAssert(sql.hasSuffix(expectedSuffix))\n\n        let extractedJSON = String(sql[\n            sql.index(sql.startIndex, offsetBy: expectedPrefix.count) ..<\n            sql.index(sql.endIndex, offsetBy: -expectedSuffix.count)\n        ])\n        let decodedJSON = try JSONDecoder().decode(TestCodable.self, from: extractedJSON.data(using: .utf8)!)\n        XCTAssertEqual(decodedJSON, value1)\n    }\n\n    func test_delete_compilesDeleteExpression() {\n        assertSQL(\n            \"DELETE FROM \\\"users\\\" WHERE (\\\"id\\\" = 1)\",\n            users.filter(id == 1).delete()\n        )\n    }\n\n    func test_delete_compilesDeleteLimitOrderExpression() {\n        assertSQL(\n            \"DELETE FROM \\\"users\\\" ORDER BY \\\"id\\\" LIMIT 1\",\n            users.order(id).limit(1).delete()\n        )\n    }\n\n    func test_delete_compilesExistsExpression() {\n        assertSQL(\n            \"SELECT EXISTS (SELECT * FROM \\\"users\\\")\",\n            users.exists\n        )\n    }\n\n    func test_count_returnsCountExpression() {\n        assertSQL(\"SELECT count(*) FROM \\\"users\\\"\", users.count)\n    }\n\n    func test_scalar_returnsScalarExpression() {\n        assertSQL(\"SELECT \\\"int\\\" FROM \\\"table\\\"\", table.select(int) as ScalarQuery<Int>)\n        assertSQL(\"SELECT \\\"intOptional\\\" FROM \\\"table\\\"\", table.select(intOptional) as ScalarQuery<Int?>)\n        assertSQL(\"SELECT DISTINCT \\\"int\\\" FROM \\\"table\\\"\", table.select(distinct: int) as ScalarQuery<Int>)\n        assertSQL(\"SELECT DISTINCT \\\"intOptional\\\" FROM \\\"table\\\"\", table.select(distinct: intOptional) as ScalarQuery<Int?>)\n    }\n\n    func test_subscript_withExpression_returnsNamespacedExpression() {\n        let query = Table(\"query\")\n\n        assertSQL(\"\\\"query\\\".\\\"blob\\\"\", query[data])\n        assertSQL(\"\\\"query\\\".\\\"blobOptional\\\"\", query[dataOptional])\n\n        assertSQL(\"\\\"query\\\".\\\"bool\\\"\", query[bool])\n        assertSQL(\"\\\"query\\\".\\\"boolOptional\\\"\", query[boolOptional])\n\n        assertSQL(\"\\\"query\\\".\\\"date\\\"\", query[date])\n        assertSQL(\"\\\"query\\\".\\\"dateOptional\\\"\", query[dateOptional])\n\n        assertSQL(\"\\\"query\\\".\\\"double\\\"\", query[double])\n        assertSQL(\"\\\"query\\\".\\\"doubleOptional\\\"\", query[doubleOptional])\n\n        assertSQL(\"\\\"query\\\".\\\"int\\\"\", query[int])\n        assertSQL(\"\\\"query\\\".\\\"intOptional\\\"\", query[intOptional])\n\n        assertSQL(\"\\\"query\\\".\\\"int64\\\"\", query[int64])\n        assertSQL(\"\\\"query\\\".\\\"int64Optional\\\"\", query[int64Optional])\n\n        assertSQL(\"\\\"query\\\".\\\"string\\\"\", query[string])\n        assertSQL(\"\\\"query\\\".\\\"stringOptional\\\"\", query[stringOptional])\n\n        assertSQL(\"\\\"query\\\".*\", query[*])\n    }\n\n    func test_tableNamespacedByDatabase() {\n        let table = Table(\"table\", database: \"attached\")\n\n        assertSQL(\"SELECT * FROM \\\"attached\\\".\\\"table\\\"\", table)\n    }\n\n}\n"
  },
  {
    "path": "Tests/SQLiteTests/Typed/RowTests.swift",
    "content": "import XCTest\n@testable import SQLite\n\nclass RowTests: XCTestCase {\n\n    public func test_get_value() throws {\n        let row = Row([\"\\\"foo\\\"\": 0], [\"value\"])\n        let result = try row.get(SQLite.Expression<String>(\"foo\"))\n\n        XCTAssertEqual(\"value\", result)\n    }\n\n    public func test_get_value_subscript() {\n        let row = Row([\"\\\"foo\\\"\": 0], [\"value\"])\n        let result = row[SQLite.Expression<String>(\"foo\")]\n\n        XCTAssertEqual(\"value\", result)\n    }\n\n    public func test_get_value_optional() throws {\n        let row = Row([\"\\\"foo\\\"\": 0], [\"value\"])\n        let result = try row.get(SQLite.Expression<String?>(\"foo\"))\n\n        XCTAssertEqual(\"value\", result)\n    }\n\n    public func test_get_value_optional_subscript() {\n        let row = Row([\"\\\"foo\\\"\": 0], [\"value\"])\n        let result = row[SQLite.Expression<String?>(\"foo\")]\n\n        XCTAssertEqual(\"value\", result)\n    }\n\n    public func test_get_value_optional_nil() throws {\n        let row = Row([\"\\\"foo\\\"\": 0], [nil])\n        let result = try row.get(SQLite.Expression<String?>(\"foo\"))\n\n        XCTAssertNil(result)\n    }\n\n    public func test_get_value_optional_nil_subscript() {\n        let row = Row([\"\\\"foo\\\"\": 0], [nil])\n        let result = row[SQLite.Expression<String?>(\"foo\")]\n\n        XCTAssertNil(result)\n    }\n\n    public func test_get_type_mismatch_throws_unexpected_null_value() {\n        let row = Row([\"\\\"foo\\\"\": 0], [\"value\"])\n        XCTAssertThrowsError(try row.get(SQLite.Expression<Int>(\"foo\"))) { error in\n            if case QueryError.unexpectedNullValue(let name) = error {\n                XCTAssertEqual(\"\\\"foo\\\"\", name)\n            } else {\n                XCTFail(\"unexpected error: \\(error)\")\n            }\n        }\n    }\n\n    public func test_get_type_mismatch_optional_returns_nil() throws {\n        let row = Row([\"\\\"foo\\\"\": 0], [\"value\"])\n        let result = try row.get(SQLite.Expression<Int?>(\"foo\"))\n        XCTAssertNil(result)\n    }\n\n    public func test_get_non_existent_column_throws_no_such_column() {\n        let row = Row([\"\\\"foo\\\"\": 0], [\"value\"])\n        XCTAssertThrowsError(try row.get(SQLite.Expression<Int>(\"bar\"))) { error in\n            if case QueryError.noSuchColumn(let name, let columns) = error {\n                XCTAssertEqual(\"\\\"bar\\\"\", name)\n                XCTAssertEqual([\"\\\"foo\\\"\"], columns)\n            } else {\n                XCTFail(\"unexpected error: \\(error)\")\n            }\n        }\n    }\n\n    public func test_get_ambiguous_column_throws() {\n        let row = Row([\"table1.\\\"foo\\\"\": 0, \"table2.\\\"foo\\\"\": 1], [\"value\"])\n        XCTAssertThrowsError(try row.get(SQLite.Expression<Int>(\"foo\"))) { error in\n            if case QueryError.ambiguousColumn(let name, let columns) = error {\n                XCTAssertEqual(\"\\\"foo\\\"\", name)\n                XCTAssertEqual([\"table1.\\\"foo\\\"\", \"table2.\\\"foo\\\"\"], columns.sorted())\n            } else {\n                XCTFail(\"unexpected error: \\(error)\")\n            }\n        }\n    }\n\n    public func test_get_datatype_throws() {\n        // swiftlint:disable nesting\n        struct MyType: Value {\n            enum MyError: Error {\n                case failed\n            }\n\n            public static var declaredDatatype: String {\n                Blob.declaredDatatype\n            }\n\n            public static func fromDatatypeValue(_ dataValue: Blob) throws -> Data {\n                throw MyError.failed\n            }\n\n            public var datatypeValue: Blob {\n                return Blob(bytes: [])\n            }\n        }\n\n        let row = Row([\"\\\"foo\\\"\": 0], [Blob(bytes: [])])\n        XCTAssertThrowsError(try row.get(SQLite.Expression<MyType>(\"foo\"))) { error in\n            if case MyType.MyError.failed = error {\n                XCTAssertTrue(true)\n            } else {\n                XCTFail(\"unexpected error: \\(error)\")\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "Tests/SQLiteTests/Typed/SelectTests.swift",
    "content": "import XCTest\n@testable import SQLite\n\nclass SelectTests: SQLiteTestCase {\n\n    override func setUpWithError() throws {\n        try super.setUpWithError()\n        try createUsersTable()\n        try createUsersDataTable()\n    }\n\n    func createUsersDataTable() throws {\n        try db.execute(\"\"\"\n            CREATE TABLE users_name (\n                id INTEGER,\n                user_id INTEGER REFERENCES users(id),\n                name TEXT\n            )\n            \"\"\"\n        )\n    }\n\n    func test_select_columns_from_multiple_tables() throws {\n        let usersData = Table(\"users_name\")\n        let users = Table(\"users\")\n\n        let name = SQLite.Expression<String>(\"name\")\n        let id = SQLite.Expression<Int64>(\"id\")\n        let userID = SQLite.Expression<Int64>(\"user_id\")\n        let email = SQLite.Expression<String>(\"email\")\n\n        try insertUser(\"Joey\")\n        try db.run(usersData.insert(\n            id <- 1,\n            userID <- 1,\n            name <- \"Joey\"\n        ))\n\n        try db.prepare(users.select(name, email).join(usersData, on: userID == users[id])).forEach {\n            XCTAssertEqual($0[name], \"Joey\")\n            XCTAssertEqual($0[email], \"Joey@example.com\")\n        }\n    }\n}\n"
  },
  {
    "path": "Tests/SQLiteTests/Typed/SetterTests.swift",
    "content": "import XCTest\nimport SQLite\n\nclass SetterTests: XCTestCase {\n\n    func test_setterAssignmentOperator_buildsSetter() {\n        assertSQL(\"\\\"int\\\" = \\\"int\\\"\", int <- int)\n        assertSQL(\"\\\"int\\\" = 1\", int <- 1)\n        assertSQL(\"\\\"intOptional\\\" = \\\"int\\\"\", intOptional <- int)\n        assertSQL(\"\\\"intOptional\\\" = \\\"intOptional\\\"\", intOptional <- intOptional)\n        assertSQL(\"\\\"intOptional\\\" = 1\", intOptional <- 1)\n        assertSQL(\"\\\"intOptional\\\" = NULL\", intOptional <- nil)\n    }\n\n    func test_plusEquals_withStringExpression_buildsSetter() {\n        assertSQL(\"\\\"string\\\" = (\\\"string\\\" || \\\"string\\\")\", string += string)\n        assertSQL(\"\\\"string\\\" = (\\\"string\\\" || 'literal')\", string += \"literal\")\n        assertSQL(\"\\\"stringOptional\\\" = (\\\"stringOptional\\\" || \\\"string\\\")\", stringOptional += string)\n        assertSQL(\"\\\"stringOptional\\\" = (\\\"stringOptional\\\" || \\\"stringOptional\\\")\", stringOptional += stringOptional)\n        assertSQL(\"\\\"stringOptional\\\" = (\\\"stringOptional\\\" || 'literal')\", stringOptional += \"literal\")\n    }\n\n    func test_plusEquals_withNumberExpression_buildsSetter() {\n        assertSQL(\"\\\"int\\\" = (\\\"int\\\" + \\\"int\\\")\", int += int)\n        assertSQL(\"\\\"int\\\" = (\\\"int\\\" + 1)\", int += 1)\n        assertSQL(\"\\\"intOptional\\\" = (\\\"intOptional\\\" + \\\"int\\\")\", intOptional += int)\n        assertSQL(\"\\\"intOptional\\\" = (\\\"intOptional\\\" + \\\"intOptional\\\")\", intOptional += intOptional)\n        assertSQL(\"\\\"intOptional\\\" = (\\\"intOptional\\\" + 1)\", intOptional += 1)\n\n        assertSQL(\"\\\"double\\\" = (\\\"double\\\" + \\\"double\\\")\", double += double)\n        assertSQL(\"\\\"double\\\" = (\\\"double\\\" + 1.0)\", double += 1)\n        assertSQL(\"\\\"doubleOptional\\\" = (\\\"doubleOptional\\\" + \\\"double\\\")\", doubleOptional += double)\n        assertSQL(\"\\\"doubleOptional\\\" = (\\\"doubleOptional\\\" + \\\"doubleOptional\\\")\", doubleOptional += doubleOptional)\n        assertSQL(\"\\\"doubleOptional\\\" = (\\\"doubleOptional\\\" + 1.0)\", doubleOptional += 1)\n    }\n\n    func test_minusEquals_withNumberExpression_buildsSetter() {\n        assertSQL(\"\\\"int\\\" = (\\\"int\\\" - \\\"int\\\")\", int -= int)\n        assertSQL(\"\\\"int\\\" = (\\\"int\\\" - 1)\", int -= 1)\n        assertSQL(\"\\\"intOptional\\\" = (\\\"intOptional\\\" - \\\"int\\\")\", intOptional -= int)\n        assertSQL(\"\\\"intOptional\\\" = (\\\"intOptional\\\" - \\\"intOptional\\\")\", intOptional -= intOptional)\n        assertSQL(\"\\\"intOptional\\\" = (\\\"intOptional\\\" - 1)\", intOptional -= 1)\n\n        assertSQL(\"\\\"double\\\" = (\\\"double\\\" - \\\"double\\\")\", double -= double)\n        assertSQL(\"\\\"double\\\" = (\\\"double\\\" - 1.0)\", double -= 1)\n        assertSQL(\"\\\"doubleOptional\\\" = (\\\"doubleOptional\\\" - \\\"double\\\")\", doubleOptional -= double)\n        assertSQL(\"\\\"doubleOptional\\\" = (\\\"doubleOptional\\\" - \\\"doubleOptional\\\")\", doubleOptional -= doubleOptional)\n        assertSQL(\"\\\"doubleOptional\\\" = (\\\"doubleOptional\\\" - 1.0)\", doubleOptional -= 1)\n    }\n\n    func test_timesEquals_withNumberExpression_buildsSetter() {\n        assertSQL(\"\\\"int\\\" = (\\\"int\\\" * \\\"int\\\")\", int *= int)\n        assertSQL(\"\\\"int\\\" = (\\\"int\\\" * 1)\", int *= 1)\n        assertSQL(\"\\\"intOptional\\\" = (\\\"intOptional\\\" * \\\"int\\\")\", intOptional *= int)\n        assertSQL(\"\\\"intOptional\\\" = (\\\"intOptional\\\" * \\\"intOptional\\\")\", intOptional *= intOptional)\n        assertSQL(\"\\\"intOptional\\\" = (\\\"intOptional\\\" * 1)\", intOptional *= 1)\n\n        assertSQL(\"\\\"double\\\" = (\\\"double\\\" * \\\"double\\\")\", double *= double)\n        assertSQL(\"\\\"double\\\" = (\\\"double\\\" * 1.0)\", double *= 1)\n        assertSQL(\"\\\"doubleOptional\\\" = (\\\"doubleOptional\\\" * \\\"double\\\")\", doubleOptional *= double)\n        assertSQL(\"\\\"doubleOptional\\\" = (\\\"doubleOptional\\\" * \\\"doubleOptional\\\")\", doubleOptional *= doubleOptional)\n        assertSQL(\"\\\"doubleOptional\\\" = (\\\"doubleOptional\\\" * 1.0)\", doubleOptional *= 1)\n    }\n\n    func test_dividedByEquals_withNumberExpression_buildsSetter() {\n        assertSQL(\"\\\"int\\\" = (\\\"int\\\" / \\\"int\\\")\", int /= int)\n        assertSQL(\"\\\"int\\\" = (\\\"int\\\" / 1)\", int /= 1)\n        assertSQL(\"\\\"intOptional\\\" = (\\\"intOptional\\\" / \\\"int\\\")\", intOptional /= int)\n        assertSQL(\"\\\"intOptional\\\" = (\\\"intOptional\\\" / \\\"intOptional\\\")\", intOptional /= intOptional)\n        assertSQL(\"\\\"intOptional\\\" = (\\\"intOptional\\\" / 1)\", intOptional /= 1)\n\n        assertSQL(\"\\\"double\\\" = (\\\"double\\\" / \\\"double\\\")\", double /= double)\n        assertSQL(\"\\\"double\\\" = (\\\"double\\\" / 1.0)\", double /= 1)\n        assertSQL(\"\\\"doubleOptional\\\" = (\\\"doubleOptional\\\" / \\\"double\\\")\", doubleOptional /= double)\n        assertSQL(\"\\\"doubleOptional\\\" = (\\\"doubleOptional\\\" / \\\"doubleOptional\\\")\", doubleOptional /= doubleOptional)\n        assertSQL(\"\\\"doubleOptional\\\" = (\\\"doubleOptional\\\" / 1.0)\", doubleOptional /= 1)\n    }\n\n    func test_moduloEquals_withIntegerExpression_buildsSetter() {\n        assertSQL(\"\\\"int\\\" = (\\\"int\\\" % \\\"int\\\")\", int %= int)\n        assertSQL(\"\\\"int\\\" = (\\\"int\\\" % 1)\", int %= 1)\n        assertSQL(\"\\\"intOptional\\\" = (\\\"intOptional\\\" % \\\"int\\\")\", intOptional %= int)\n        assertSQL(\"\\\"intOptional\\\" = (\\\"intOptional\\\" % \\\"intOptional\\\")\", intOptional %= intOptional)\n        assertSQL(\"\\\"intOptional\\\" = (\\\"intOptional\\\" % 1)\", intOptional %= 1)\n    }\n\n    func test_leftShiftEquals_withIntegerExpression_buildsSetter() {\n        assertSQL(\"\\\"int\\\" = (\\\"int\\\" << \\\"int\\\")\", int <<= int)\n        assertSQL(\"\\\"int\\\" = (\\\"int\\\" << 1)\", int <<= 1)\n        assertSQL(\"\\\"intOptional\\\" = (\\\"intOptional\\\" << \\\"int\\\")\", intOptional <<= int)\n        assertSQL(\"\\\"intOptional\\\" = (\\\"intOptional\\\" << \\\"intOptional\\\")\", intOptional <<= intOptional)\n        assertSQL(\"\\\"intOptional\\\" = (\\\"intOptional\\\" << 1)\", intOptional <<= 1)\n    }\n\n    func test_rightShiftEquals_withIntegerExpression_buildsSetter() {\n        assertSQL(\"\\\"int\\\" = (\\\"int\\\" >> \\\"int\\\")\", int >>= int)\n        assertSQL(\"\\\"int\\\" = (\\\"int\\\" >> 1)\", int >>= 1)\n        assertSQL(\"\\\"intOptional\\\" = (\\\"intOptional\\\" >> \\\"int\\\")\", intOptional >>= int)\n        assertSQL(\"\\\"intOptional\\\" = (\\\"intOptional\\\" >> \\\"intOptional\\\")\", intOptional >>= intOptional)\n        assertSQL(\"\\\"intOptional\\\" = (\\\"intOptional\\\" >> 1)\", intOptional >>= 1)\n    }\n\n    func test_bitwiseAndEquals_withIntegerExpression_buildsSetter() {\n        assertSQL(\"\\\"int\\\" = (\\\"int\\\" & \\\"int\\\")\", int &= int)\n        assertSQL(\"\\\"int\\\" = (\\\"int\\\" & 1)\", int &= 1)\n        assertSQL(\"\\\"intOptional\\\" = (\\\"intOptional\\\" & \\\"int\\\")\", intOptional &= int)\n        assertSQL(\"\\\"intOptional\\\" = (\\\"intOptional\\\" & \\\"intOptional\\\")\", intOptional &= intOptional)\n        assertSQL(\"\\\"intOptional\\\" = (\\\"intOptional\\\" & 1)\", intOptional &= 1)\n    }\n\n    func test_bitwiseOrEquals_withIntegerExpression_buildsSetter() {\n        assertSQL(\"\\\"int\\\" = (\\\"int\\\" | \\\"int\\\")\", int |= int)\n        assertSQL(\"\\\"int\\\" = (\\\"int\\\" | 1)\", int |= 1)\n        assertSQL(\"\\\"intOptional\\\" = (\\\"intOptional\\\" | \\\"int\\\")\", intOptional |= int)\n        assertSQL(\"\\\"intOptional\\\" = (\\\"intOptional\\\" | \\\"intOptional\\\")\", intOptional |= intOptional)\n        assertSQL(\"\\\"intOptional\\\" = (\\\"intOptional\\\" | 1)\", intOptional |= 1)\n    }\n\n    func test_bitwiseExclusiveOrEquals_withIntegerExpression_buildsSetter() {\n        assertSQL(\"\\\"int\\\" = (~((\\\"int\\\" & \\\"int\\\")) & (\\\"int\\\" | \\\"int\\\"))\", int ^= int)\n        assertSQL(\"\\\"int\\\" = (~((\\\"int\\\" & 1)) & (\\\"int\\\" | 1))\", int ^= 1)\n        assertSQL(\"\\\"intOptional\\\" = (~((\\\"intOptional\\\" & \\\"int\\\")) & (\\\"intOptional\\\" | \\\"int\\\"))\", intOptional ^= int)\n        assertSQL(\"\\\"intOptional\\\" = (~((\\\"intOptional\\\" & \\\"intOptional\\\")) & (\\\"intOptional\\\" | \\\"intOptional\\\"))\", intOptional ^= intOptional)\n        assertSQL(\"\\\"intOptional\\\" = (~((\\\"intOptional\\\" & 1)) & (\\\"intOptional\\\" | 1))\", intOptional ^= 1)\n    }\n\n    func test_postfixPlus_withIntegerValue_buildsSetter() {\n        assertSQL(\"\\\"int\\\" = (\\\"int\\\" + 1)\", int++)\n        assertSQL(\"\\\"intOptional\\\" = (\\\"intOptional\\\" + 1)\", intOptional++)\n    }\n\n    func test_postfixMinus_withIntegerValue_buildsSetter() {\n        assertSQL(\"\\\"int\\\" = (\\\"int\\\" - 1)\", int--)\n        assertSQL(\"\\\"intOptional\\\" = (\\\"intOptional\\\" - 1)\", intOptional--)\n    }\n\n    func test_setter_custom_string_convertible() {\n        XCTAssertEqual(\"\\\"int\\\" = \\\"int\\\"\", (int <- int).description)\n    }\n}\n"
  },
  {
    "path": "Tests/SQLiteTests/Typed/WindowFunctionsTests.swift",
    "content": "import XCTest\nimport SQLite\n\nclass WindowFunctionsTests: XCTestCase {\n\n    func test_ntile_wrapsExpressionWithOverClause() {\n        assertSQL(\"ntile(1) OVER (ORDER BY \\\"int\\\" DESC)\", ntile(1, int.desc))\n        assertSQL(\"ntile(20) OVER (ORDER BY \\\"intOptional\\\" ASC)\", ntile(20, intOptional.asc))\n        assertSQL(\"ntile(20) OVER (ORDER BY \\\"double\\\" ASC)\", ntile(20, double.asc))\n        assertSQL(\"ntile(1) OVER (ORDER BY \\\"doubleOptional\\\" ASC)\", ntile(1, doubleOptional.asc))\n        assertSQL(\"ntile(1) OVER (ORDER BY \\\"int\\\" DESC)\", ntile(1, int.desc))\n    }\n\n    func test_row_number_wrapsExpressionWithOverClause() {\n        assertSQL(\"row_number() OVER (ORDER BY \\\"int\\\" DESC)\", rowNumber(int.desc))\n    }\n\n    func test_rank_wrapsExpressionWithOverClause() {\n        assertSQL(\"rank() OVER (ORDER BY \\\"int\\\" DESC)\", rank(int.desc))\n    }\n\n    func test_dense_rank_wrapsExpressionWithOverClause() {\n        assertSQL(\"dense_rank() OVER (ORDER BY \\\"int\\\" DESC)\", denseRank(int.desc))\n    }\n\n    func test_percent_rank_wrapsExpressionWithOverClause() {\n        assertSQL(\"percent_rank() OVER (ORDER BY \\\"int\\\" DESC)\", percentRank(int.desc))\n    }\n\n    func test_cume_dist_wrapsExpressionWithOverClause() {\n        assertSQL(\"cume_dist() OVER (ORDER BY \\\"int\\\" DESC)\", cumeDist(int.desc))\n    }\n\n    func test_lag_wrapsExpressionWithOverClause() {\n        assertSQL(\"lag(\\\"int\\\", 0) OVER (ORDER BY \\\"int\\\" DESC)\", int.lag(int.desc))\n        assertSQL(\"lag(\\\"int\\\", 7) OVER (ORDER BY \\\"int\\\" DESC)\", int.lag(offset: 7, int.desc))\n        assertSQL(\"lag(\\\"int\\\", 1, 3) OVER (ORDER BY \\\"int\\\" DESC)\", int.lag(offset: 1, default: SQLite.Expression<Int>(value: 3), int.desc))\n    }\n\n    func test_lead_wrapsExpressionWithOverClause() {\n        assertSQL(\"lead(\\\"int\\\", 0) OVER (ORDER BY \\\"int\\\" DESC)\", int.lead(int.desc))\n        assertSQL(\"lead(\\\"int\\\", 7) OVER (ORDER BY \\\"int\\\" DESC)\", int.lead(offset: 7, int.desc))\n        assertSQL(\"lead(\\\"int\\\", 1, 3) OVER (ORDER BY \\\"int\\\" DESC)\", int.lead(offset: 1, default: SQLite.Expression<Int>(value: 3), int.desc))\n    }\n\n    func test_firstValue_wrapsExpressionWithOverClause() {\n        assertSQL(\"first_value(\\\"int\\\") OVER (ORDER BY \\\"int\\\" DESC)\", int.firstValue(int.desc))\n        assertSQL(\"first_value(\\\"double\\\") OVER (ORDER BY \\\"int\\\" DESC)\", double.firstValue(int.desc))\n    }\n\n    func test_lastValue_wrapsExpressionWithOverClause() {\n        assertSQL(\"last_value(\\\"int\\\") OVER (ORDER BY \\\"int\\\" DESC)\", int.lastValue(int.desc))\n    }\n\n    func test_nth_value_wrapsExpressionWithOverClause() {\n        assertSQL(\"nth_value(\\\"int\\\", 3) OVER (ORDER BY \\\"int\\\" DESC)\", int.value(3, int.desc))\n    }\n}\n"
  },
  {
    "path": "Tests/Tuist/SQLite-Test/.gitignore",
    "content": "### macOS ###\n# General\n.DS_Store\n.AppleDouble\n.LSOverride\n\n# Icon must end with two\nIcon\n\n# Thumbnails\n._*\n\n# Files that might appear in the root of a volume\n.DocumentRevisions-V100\n.fseventsd\n.Spotlight-V100\n.TemporaryItems\n.Trashes\n.VolumeIcon.icns\n.com.apple.timemachine.donotpresent\n\n# Directories potentially created on remote AFP share\n.AppleDB\n.AppleDesktop\nNetwork Trash Folder\nTemporary Items\n.apdisk\n\n### Xcode ###\n# Xcode\n#\n# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore\n\n## User settings\nxcuserdata/\n\n## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9)\n*.xcscmblueprint\n*.xccheckout\n\n## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4)\nbuild/\nDerivedData/\n*.moved-aside\n*.pbxuser\n!default.pbxuser\n*.mode1v3\n!default.mode1v3\n*.mode2v3\n!default.mode2v3\n*.perspectivev3\n!default.perspectivev3\n\n### Xcode Patch ###\n*.xcodeproj/*\n!*.xcodeproj/project.pbxproj\n!*.xcodeproj/xcshareddata/\n!*.xcworkspace/contents.xcworkspacedata\n/*.gcno\n\n### Projects ###\n*.xcodeproj\n*.xcworkspace\n\n### Tuist derived files ###\ngraph.dot\nDerived/\n\n### Tuist managed dependencies ###\nTuist/.build"
  },
  {
    "path": "Tests/Tuist/SQLite-Test/Project.swift",
    "content": "import ProjectDescription\n\nlet project = Project(\n    name: \"SQLite-Test\",\n    targets: [\n        .target(\n            name: \"SQLite-Test\",\n            destinations: .iOS,\n            product: .app,\n            bundleId: \"dev.tuist.SQLite-Test\",\n            infoPlist: .extendingDefault(\n                with: [\n                    \"UILaunchScreen\": [\n                        \"UIColorName\": \"\",\n                        \"UIImageName\": \"\"\n                    ]\n                ]\n            ),\n            buildableFolders: [\n                \"SQLite-Test/Sources\"\n            ],\n            dependencies: [.external(name: \"SQLite\")]\n        ),\n        .target(\n            name: \"SQLite-TestTests\",\n            destinations: .iOS,\n            product: .unitTests,\n            bundleId: \"dev.tuist.SQLite-TestTests\",\n            infoPlist: .default,\n            buildableFolders: [\n                \"SQLite-Test/Tests\"\n            ],\n            dependencies: [.target(name: \"SQLite-Test\")]\n        )\n    ]\n)\n"
  },
  {
    "path": "Tests/Tuist/SQLite-Test/SQLite-Test/Sources/SQLiteTestApp.swift",
    "content": "import SwiftUI\nimport SQLite\n\nlet connection = try! SQLite.Connection(.inMemory)\n\n@main\nstruct SQLiteTestApp: App {\n    var body: some Scene {\n        WindowGroup {\n            Text(\"version: \\(connection.sqliteVersion.description)\").padding()\n        }\n    }\n}\n"
  },
  {
    "path": "Tests/Tuist/SQLite-Test/SQLite-Test/Tests/SQLiteTestTests.swift",
    "content": "import Testing\nimport SQLite\n\nstruct SQLiteTestTests {\n\n    @Test func test_connection() async throws {\n        let connection = try SQLite.Connection(.inMemory)\n        let version = connection.sqliteVersion\n\n        #expect(version.major == 3)\n\n    }\n}\n"
  },
  {
    "path": "Tests/Tuist/SQLite-Test/Tuist/Package.swift",
    "content": "// swift-tools-version: 6.0\nimport PackageDescription\n\n#if TUIST\n    import struct ProjectDescription.PackageSettings\n\n    let packageSettings = PackageSettings(\n        // Customize the product types for specific package product\n        // Default is .staticFramework\n        // productTypes: [\"Alamofire\": .framework,]\n        productTypes: [:]\n    )\n#endif\n\nlet package = Package(\n    name: \"SQLite-Test\",\n    dependencies: [\n        // Add your own dependencies here:\n        .package(path: \"../../../..\")\n        // You can read more about dependencies here: https://docs.tuist.io/documentation/tuist/dependencies\n    ]\n)\n"
  },
  {
    "path": "Tests/Tuist/SQLite-Test/Tuist.swift",
    "content": "import ProjectDescription\n\nlet tuist = Tuist(project: .tuist())\n"
  },
  {
    "path": "run-tests.sh",
    "content": "#!/bin/bash\nset -ev\nif [ -n \"$BUILD_SCHEME\" ]; then\n    if [ -n \"$IOS_SIMULATOR\" ]; then\n        make test BUILD_SCHEME=\"$BUILD_SCHEME\" IOS_SIMULATOR=\"$IOS_SIMULATOR\" IOS_VERSION=\"$IOS_VERSION\"\n    else\n        make test BUILD_SCHEME=\"$BUILD_SCHEME\"\n    fi\nelif [ -n \"$VALIDATOR_SUBSPEC\" ]; then\n    bundle install\n    case \"$VALIDATOR_SUBSPEC\" in\n      none)\n        bundle exec pod lib lint --no-subspecs --fail-fast\n        ;;\n      *)\n        bundle exec pod lib lint --subspec=\"${VALIDATOR_SUBSPEC}\" --fail-fast\n        ;;\n      esac\nelif [ -n \"$CARTHAGE_PLATFORM\" ]; then\n    cd Tests/Carthage && make test CARTHAGE_PLATFORM=\"$CARTHAGE_PLATFORM\"\nelif [ -n \"$SPM\" ]; then\n    cd Tests/SPM && swift \"${SPM}\"\nelif [ -n \"${PACKAGE_MANAGER_COMMAND}\" ]; then\n    swift ${PACKAGE_MANAGER_COMMAND}\nfi\n"
  }
]