stephencelis / SQLite.swift

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

Support for SQLite 3.35.0 or above #1181

Open androidseb25 opened 1 year ago

androidseb25 commented 1 year ago

Build Information

Is there a way to include the SQLite >3.35.0 version, because I want to use the trigonometric function like sin, cos or acos in a sql query.

At the moment with the latest version of SQLite.swift I get following error:

no such function: acos (code: 1)

A example for the query I use:

SELECT *, ( 6371 * acos ( cos ( radians(LOCATIONLAT) ) * cos( radians( p.p_lat ) ) * cos( radians( p.P_LNG ) - radians(LOCATIONLNG) ) + sin ( radians(LOCATIONLAT) ) * sin( radians( p.p_lat ) ) ) ) AS distance FROM table p where distance < 15.0 ORDER BY distance

it calculates the distance in km between two points.

In my sqlitedatabase browser it works and it use the 3.39.4 version of SQLite.

FYI: the SQLite version of iOS 16.2 is 3.39.5

jberkel commented 1 year ago

If you want a specific version of SQLite you'll need to integrate via CocoaPods at the moment.

See https://github.com/stephencelis/SQLite.swift/blob/master/Documentation/Index.md#requiring-a-specific-version-of-sqlite