Lighter-swift / Lighter

Swift APIs for SQLite: Type-safe down to the schema. Very, very, fast. Dependency free.
https://lighter-swift.github.io/documentation/lighter/
MIT License
420 stars 10 forks source link

Some way to get extended error codes #30

Open micampe opened 3 weeks ago

micampe commented 3 weeks ago

Currently LighterError includes errcode, but sometimes it's useful to have access to extended error codes, either as part of LigherError or with an option to enable them with sqlite3_extended_result_codes().

helje5 commented 3 weeks ago

Looks like they should always be enabled on the connection level, e.g. in the SimplePool. The sole reason they seem to exist is backwards compat?

I guess I need to check whether we explicitly use error codes, but I suspect not

https://www.sqlite.org/rescode.html https://www.sqlite.org/c3ref/extended_result_codes.html

micampe commented 3 weeks ago

The sole reason they seem to exist is backwards compat?

My understanding of the documentation is the opposite: they default to off for compatibility.

The extended result codes are disabled by default for historical compatibility.

helje5 commented 3 weeks ago

Yes, that's what I meant. The sole reason for the non-extended codes is backwards compatibility w/ code <2006. I think it would be OK to always enable them in Lighter, specifically.