排在SQLite表的最大数目?排在、数目、最大、SQLite

2023-09-07 04:45:23 作者:熟醉。

有行的精简版SQL表中的一些限制? 我的应用程序是给一个错误没有这样的表X ...时,该表已超过6000行。 下面以6000行,不给任何错误。

Is there some limit of rows for a sql lite table ? My app is giving a error " no such table x..." when that table have more than 6000 rows. Below the 6000 rows, dont give any error.

感谢你。

这是查询。

    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。所以,我分裂他们,不要有更多的问题。谢谢大家。

SOLVED !!! I just find out why i got this problem. Because the files that i use with Data to create and populate the sql database, can´t have more than 1.2mb. So, i split them, and dont have more problems. Thanks to all.

推荐答案

您可以得到的SQLite的限值标准信息但是这不会是什么导致你的问题,因为限制实际上是非常高的。 (2的64的力量!)

You can get the standard information on the limits of SQLite but that isn't going to be what's causing your issue as the limit is actually very high. (2 to the power of 64!)

以上可能是你的问题,是因为有你的应用程序是如何插入记录和/或插入的记录类型。

More than likely your issue has to do with how your application is inserting the records and/or the types of records being inserted.

您可以张贴一些code应用程序以及它如何处理插入?通过它看完之后我可以修改我的答案。

Can you post some code for the application and how it's handling the insert? I can revise my answer after reading through it.

作为一个额外的小费,确保你已经设置:

As an added tip, make sure you've set:

Cursor myCursor = db.rawQuery("PRAGMA synchronous=OFF", null); 
myCursor.close();

由于这才能真正提高你的大批量插入的效果。