相关疑难解决方法(0)

可以在单个execSQL查询中指定的SQL变量的限制是多少

我正在努力提高我的android数据库插入速度.我目前正在做的是生成一个字符串,如:

SELECT ? as title, ? as musician_id, ? as album_id, ? as genre
UNION SELECT ?, ?, ?, ?
UNION SELECT ?, ?, ?, ?
UNION SELECT ?, ?, ?, ?
UNION SELECT ?, ?, ?, ?
UNION SELECT ?, ?, ?, ?
Run Code Online (Sandbox Code Playgroud)

然后执行它

SQLiteDatabase database = //initialized in some way
String insertQuery; // the string of the query above
String [] parameters; // the parameters to use in the insertion.
database.execSQL(insertQuery.toString(), parameters);
Run Code Online (Sandbox Code Playgroud)

当我尝试插入大约2000行时,我收到以下错误:

Caused by: android.database.sqlite.SQLiteException: too many …
Run Code Online (Sandbox Code Playgroud)

sqlite android android-sqlite

21
推荐指数
2
解决办法
8014
查看次数

标签 统计

android ×1

android-sqlite ×1

sqlite ×1