[swift-users] "business applications market" flame

Jeremy Pereira jeremy.j.pereira at googlemail.com
Thu Jan 7 04:46:30 CST 2016

> On 7 Jan 2016, at 01:10, Jens Alfke via swift-users <swift-users at swift.org> wrote:
>> On Jan 6, 2016, at 5:04 PM, Dru Satori <dru at druware.com> wrote:
>> Oh, on OS X, swift works fine with PostgreSQL and ODBC datasources via Obj-C frameworks, that isn’t the challenge.
> It would be interesting to see how far Swift’s syntax can be pushed to create a cleaner syntax for queries. I’m thinking of C#’s LINQ, which is really sweet. Some LINQ stuff can be replicated in Swift, I believe, but there are parts of it that rely on a super-powerful C# feature where a function can receive a parameter in the form of a parse tree of the expression. (Sort of like LISP macros.)

I got part of the way there. I was able to define a set of classes/enums and operator overrides such that I got to the point where I could write

dbConnection.select([“column1", “column2”], from: “table”, where: “column3” == SQL.Integer(1) && “column4” > SQL.Integer(2))

SQL being an enum of the different possible SQL types.

The operators in the where clause did not actually do the and/or/not or comparisons but built up an expression tree that could be serialised into a string version of the where clause for use in a SQL statement.

> —Jens
> _______________________________________________
> swift-users mailing list
> swift-users at swift.org
> https://lists.swift.org/mailman/listinfo/swift-users

More information about the swift-users mailing list