Android。是否可以在C / C ++上编写自定义函数并在SQL查询中使用它? [英] Android. Is it posible to write custom function on C/C++ and use it in SQL query?

查看:106
本文介绍了Android。是否可以在C / C ++上编写自定义函数并在SQL查询中使用它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

SQLite3不支持存储过程。是否可以在C / C ++上编写自定义函数并在SQL查询中使用它?

SQLite3 doesn't support stored procedures. Is it posible to write custom function on C/C++ and use it in SQL query?

类似的东西

SELECT * FROM table WHERE CUST_FUNCTION(name1, name2) = 1

SELECT CUST_FUNCTION(name1, name2) FROM table

也许你有一个很好的例子。

Maybe you have some good example how to do that.

推荐答案

我在看这样的东西是为了计算距离内的距离。

I was looking at something like this for calculating distance from within a sqlite query - it was sometimes mentioned as a method for doing this.

sqlite支持类似这样的东西,所以文档和其他引用将建议这是可能的。 然而,在查看各种来源后,我得出结论,虽然你可以在几个使用sqlite的地方(如我相信的iPhone),你不能这样做Android的sqlite (至少我没有找到任何人能够在Android中这样做)。

sqlite does support something like this, so documentation and other references will suggest that this is possible. However, after looking at various sources, I came to the conclusion that, while you can do it in several places that use sqlite (like iPhone I believe), you can't do it in Android's sqlite (at least I didn't find anyone able to do this way in Android).

这里有几个链接,我发现建议这是不可能在Android和不幸的是,我找不到任何反例。但我很想发现我错了这个...

Here are a couple of links that I had found suggesting it wasn't possible in Android and unfortunately I couldn't find any counterexamples. But I'd love to find I'm wrong about this ...

Android sqlite按计算列(坐标距离)排序



Android sqlite sort on calculated column (co-ordinates distance)



  • 您描述的技术似乎不适用于Android,而不能使用sqlite3_create_function()。 - CommonsWare 1月9日10点19:00






在Android上的Sqlite:如何创建一个sqlite dist db函数 - 用于应用程序使用lat,long的距离计算


  • org.sqlite不是Android API,因此不相关。评论时间70年01月01日原作者:hackbod
    1

  • 你是正确的,org.sqlite不是一个Android API。但是,您可以使用它来实现一个内容提供者,他做他所问。评论时间70年01月01日原作者:Joshua Smith

  • 实际上,我对你链接到的内容提供者回答中概述的方法持怀疑态度。 org.sqlite不在Android中,并且不清楚是否存在一个将与Android的SQLite环境协同工作的org.sqlite实现。评论时间70年01月01日原作者:Pentium10

这篇关于Android。是否可以在C / C ++上编写自定义函数并在SQL查询中使用它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆