fluent-sqlite-driver icon indicating copy to clipboard operation
fluent-sqlite-driver copied to clipboard

Getting a pragma value

Open adamnemecek opened this issue 2 years ago • 1 comments

I'm having a hard time figuring out how to get a pragma value out of SQLite using Fluent. Any pointers?

adamnemecek avatar May 16 '22 00:05 adamnemecek

@adamnemecek was this solved in Discord?

0xTim avatar May 16 '22 11:05 0xTim

try await (req.db as! any SQLDatabase).raw("PRAGMA some_pragma_or_other").first()?.decode(column: "some_pragma_or_other", as: Int.self)

See also https://github.com/vapor/sqlite-kit/blob/main/Tests/SQLiteKitTests/SQLiteKitTests.swift#L92-L93

gwynne avatar Oct 19 '23 14:10 gwynne