本文介绍了" sqlite3的:错误:太多的选择:"进入" "在Android应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的Android应用程序,我想使用code的下面一行:
In my android application I am trying to use following line of code:
Process runJob = Runtime.getRuntime().exec("sqlite3 /data/data/com.android.launcher/databases/launcher.db \"INSERT INTO favorites VALUES(100,'someText');\"");
,但它不工作。在STDERR有消息
but it doesn't work. In stderr there is a message
03-12 13:41:44.841: I/some(3084): stderr = sqlite3: Error: too many options: "INTO"
03-12 13:41:44.841: I/some(3084): stderr = Use -help for a list of options.
任何想法如何解决这一问题?
Any ideas how to fix this?
推荐答案
EXEC(字符串)
拆分在空格输入和不履行
引用像贝壳会怎么做。
exec(String)
splits the input on spaces and does not honor the "
quotes like a shell would do.
使用 EXEC(字符串[])
而不是:
...exec(new String[] {
"sqlite3",
"/data/data/com.android.launcher/databases/launcher.db",
"INSERT INTO favorites (column1, column2) VALUES(100,'someText');"
});
(不考虑你正在试图做的实际上是有意义的。)
(Not taking into account that what you're trying to do actually makes sense.)
这篇关于" sqlite3的:错误:太多的选择:"进入" "在Android应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!