SQLITE中的距离
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了SQLITE中的距离相关的知识,希望对你有一定的参考价值。
This is damn crazy! sQlite does not have all the trig functions need to do distances. So here is how you load that into sQlite on the fly.
$db = new PDO('sqlite:db/database.sqlite'); $db->sqliteCreateFunction('distance', function () { foreach( $geo as $k => $v ) { } }, 4); $pp = 25; $offset = 0; } $q = "SELECT oc.content_id, distance( ( SELECT value_text FROM contents INNER JOIN contentvalues ON value_content_id = content_id INNER JOIN typefields ON value_field_id = field_id WHERE field_alias = 'latitude' AND content_id = oc.content_id ) , ( SELECT value_text FROM contents INNER JOIN contentvalues ON value_content_id = content_id INNER JOIN typefields ON value_field_id = field_id WHERE field_alias = 'longitude' AND content_id = oc.content_id ) , $lat , $lng ) AS dis FROM contents AS oc WHERE ".time()." BETWEEN content_publish_start_date AND content_publish_end_date ". "ORDER BY dis ASC LIMIT $offset , $pp";
以上是关于SQLITE中的距离的主要内容,如果未能解决你的问题,请参考以下文章
从 2 个不同片段的 sqlite 中的 2 个表中获取信息
当sqlite android片段中的数据更改或删除时如何刷新recyclerview?