3

i need to create a function for sqlite, because the sin and cos mysql-function doesn't exist, and i need to make a query like:

    String q = "SELECT * FROM shops WHERE _id > 0 AND distance(lat, lng, latitudine, longitudine) < 20 AND cancellato=0 ORDER BY _id";
    Cursor c = myDataBase.rawQuery(q, null);
    return c; 

so, i need a function for distance.

and i can't do it via code because it's a list of +8000 shops!

how can i? i didn't found anything on the web.

thanks!

Zak
  • 591
  • 2
  • 15
  • 37

1 Answers1

-2

distance(lat, lng, latitudine, longitudine)

I think you have to calculate distance pragmatically from your javacode then you can compare

http://www.sqlite.org/lang_aggfunc.html

http://oreilly.com/catalog/sqlnut/chapter/ch04.html
Mohammod Hossain
  • 4,134
  • 2
  • 26
  • 37
  • 1
    this is exactly what he wrote ... `because the sin and cos mysql-function doesn't exist` and he is asking what he can use instead – Selvin Sep 03 '12 at 10:27
  • right, and i can't make a query of 8000 record, and after this parse it. it's a query veeeery long – Zak Sep 03 '12 at 10:36