stephencelis / SQLite.swift

A type-safe, Swift-language layer over SQLite3.
MIT License
9.59k stars 1.55k forks source link

Get userVersion Crash issue? #1054

Closed KC-218 closed 2 years ago

KC-218 commented 2 years ago

Issues are used to track bugs and feature requests. Need help or have a general question? Ask on Stack Overflow (tag sqlite.swift).

My question: I got crash issue about get userVersion. Have any idea to fix it?

public var userVersion: Int32 {
        get { return Int32(try! scalar("PRAGMA user_version") as! Int64) } //Thread 1: Fatal error: 'try!' expression unexpectedly raised an error: file is not a database (code: 26)
        set { try! run("PRAGMA user_version = \(newValue)" ) }
    }

Build Information

General guidelines

jberkel commented 2 years ago

this looks like a local/db issue