stephencelis / SQLite.swift

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

Initial implementation of indexed column access #1134

Closed justinmeiners closed 2 years ago

justinmeiners commented 2 years ago

See #1133. This is just an initial implementation for feedback.

justinmeiners commented 2 years ago

@jberkel Due to time constraints, I may need to contribute this in an internal fork to support my work. I think we would both benefit if that work goes back into this project, rather than diverging. Can you provide any early guidance here to make sure I meet your expectations and stay on track?

I am fine to work out details and naming when you are more available, but does the general idea seem sound to you?

jberkel commented 2 years ago

Is this part of a performance optimization? In general I don't see issues but a user of the library might be confused which method to use when accessing row data. Also, there's a bit of type loss when going from Expression<V> to Int.

justinmeiners commented 2 years ago

@jberkel yes it is about decode performance, but it's also how most SQLite libraries work. I tried to describe it a bit in that ticket. If you have 10-50k rows to decode, going through the column lookup logic for each one is quite a burden.

Type loss

That's true, let me rework that.

justinmeiners commented 2 years ago

@jberkel I figured out how to access what I needed through the lower level statement object.