SQLite sin, cos, acos, etc

Problems with WiFi, SQLite ,Bluetooth, WiMax, Proxies, etc...

SQLite sin, cos, acos, etc

Postby radioblaster » Wed Jul 22, 2009 5:55 pm

Hmmm, it appears as though SQLite does not support math functions like sin, cos, tan, etc.
The docs say you can add functions in c, but they only apply to a specific connection to the database, they are not permanently written as new functionality to the database.
So, I'm curious how, in Android, I can query my SQLite db using math functions such as these. Considering how many location aware apps are available for Android there must be a way to do it, since querying for points within a given radius involves using sin, cos, acos, etc.

Any ideas?
radioblaster
Junior Developer
Junior Developer
 
Posts: 12
Joined: Thu Jul 16, 2009 4:29 pm

Top

Postby cadlg » Wed Jul 22, 2009 6:15 pm

Hmmm, why don't you make those calculations in your application, outside of the SQLite query ?
cadlg
Experienced Developer
Experienced Developer
 
Posts: 84
Joined: Wed Feb 20, 2008 12:33 am
Location: Guatemala

Postby radioblaster » Wed Jul 22, 2009 8:30 pm

My thinking is that a lot of efficiency can be gained by filtering the results in the query since the database engine can use indexes to enhance performance. Also, less memory will be consumed. It would be troublesome to pull every latitude and longitude coordinate (possibly millions of them) out of the database and then perform the math on each set one at a time. As it is, I'll likely combine the two methods - use some basic math in the query to do a 'first cut' so to speak, and then do the heavy math on the returned query results.
radioblaster
Junior Developer
Junior Developer
 
Posts: 12
Joined: Thu Jul 16, 2009 4:29 pm

Top

Return to Networking & Database Problems

Who is online

Users browsing this forum: No registered users and 7 guests