SQLite.swift icon indicating copy to clipboard operation
SQLite.swift copied to clipboard

Support for SQLite 3.35.0 or above

Open androidseb25 opened this issue 3 years ago • 1 comments

Build Information

  • SQLite.swift version: 0.14.1 -> master branch
  • Xcode: 14.2 and OS X: 16.2
  • Installed the lib with Swift Package manager

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

androidseb25 avatar Dec 31 '22 13:12 androidseb25

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

jberkel avatar May 22 '23 07:05 jberkel