Closed fredwaltman closed 9 years ago
SQLite.swift handles raw SQL just fine with its core API. The type-safe layer is merely there to provide an additional layer of compile-time safety.
If you have tests/assurances/confidence that the SQL you have will compile, run, and do what you expect it to, by all means continue to use raw SQL! Doubly so if you're sharing code with Android—I don't think I'd use the expression builder if I was working within that constraint. If you build a new, Swift-only project from scratch, feel free to try the expression layer and see if it's something that benefits you.
I intend to continue to improve SQLite.swift's raw SQL layer in the near future. The type-safe layer got a lot of love up front, but I've been working to decouple things to the point where you should be able to import just the Core API and ignore the expression builder layer entirely if you so choose.
As for your question:
does SQLite.swift do UNIONs?
It does it you use raw SQL :)
The expression layer could and should support UNION, though. I'll add it to the roadmap.
Going to close this out for now, but feel free to ask additional questions if you have any!
Thanks. I have used the type-safe on a new project, so I feel fairly comfortable with it.
My app was originally written for Android and such did "raw" sql: e.g.," SELECT something FROM somewhere INNER JOIN ..., etc" and my first version under iOS did the same using prepare and run.
Now about 80% (by statements, not execution) of my sql is fairly simple stuff, select all rows in a table or a simple filter or two. I've gone back and recoded those to use the Type Safe system with expressions, .filter, .order, and even a few simple .joins
What's left is a bunch of complex sql -- multiple JOINs, aggregation and even a couple of UNIONs in there (does SQLite.swift do UNIONs?)
I am a big proponent of "if it ain't broke, don't fix it" so I wondering what I would lose if I don't convert some of the final complex statements? I control the database so I don't have to worry about somebody else making changes that impact my code. The database in the app is basically read only to the user -- it is a mirror of a master held on a server and updating by periodically downloading some JSON dictionaries.
I am very happy with the product so far -- it does everything I need with a minimum of fuss. This grasshopper just wants to increase his knowledge...