sql lite 表是否有行数限制? 当该表超过 6000 行时,我的应用程序给出错误“没有这样的表 x...”。 6000行以下不要报错。
谢谢。
这是查询。
db = (new DatabaseHelper(this)).getWritableDatabase();
cursor = db.rawQuery("SELECT continentes._id, continentes.ContinenteID, continentes.Continente"
+ " FROM continentes"
+ " WHERE continentes.Continente LIKE ?"
+ " GROUP BY continentes.ContinenteID, continentes.Continente ORDER BY continentes.Continente",
new String[]{"%" + searchText.getText().toString() + "%"});
这是我创建表格的地方
@Override
public void onCreate(SQLiteDatabase db) {
String s;
try {
Toast.makeText(context, "Creating Database", 2000).show();
InputStream in = context.getResources().openRawResource(R.raw.continentes);
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document doc = builder.parse(in, null);
NodeList statements = doc.getElementsByTagName("statement");
for (int i=0; i<statements.getLength(); i++) {
s = statements.item(i).getChildNodes().item(0).getNodeValue();
db.execSQL(s);
}
} catch (Throwable t) {
Toast.makeText(context, t.toString(), 50000).show();
解决了!!!我只是找出为什么我遇到这个问题。因为我使用数据创建和填充 sql 数据库的文件不能超过 1.2mb。所以,我把它们分开了,没有更多的问题。谢谢大家。
最佳答案
您可以在limits of SQLite上获取标准信息但这不会是导致您出现问题的原因,因为限制实际上非常高。 (2 的 64 次方!)
您的问题很可能与应用程序插入记录的方式和/或插入的记录类型有关。
您能否发布一些应用程序代码以及它如何处理插入?我可以在通读后修改我的答案。
作为附加提示,请确保您已设置:
Cursor myCursor = db.rawQuery("PRAGMA synchronous=OFF", null);
myCursor.close();
因为这真的可以improve the performance较大的批量插入。
关于android - sqlite 表中的最大行数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8835983/