SQLite3.Exception: database disk image is malformed

后端 未结 1 433
甜味超标
甜味超标 2020-12-16 09:04

Mates i m getting this error message while using sqlite3 native c library (JNI) through NDK

Please suggest me where i m doing wrong

01-29 11:04:19.53         


        
1条回答
  •  -上瘾入骨i
    2020-12-16 09:10

    @Manish. I have edited your sample code. Please use cursor.getCount() like this. Thankyou

    public ArrayList getDefinations(String query, int column_index) 
    {
        ArrayList words = new ArrayList();
        MatrixCursor mcursor = null;
        try 
        {
            Stmt stmt = getDB2().prepare(query);
            if (stmt.step()) 
            {
              //stmt.get_cursor().moveToFirst();
              mcursor = stmt.get_cursor();
              if(mcursor != null && mcursor.getCount() > 0)
              {
                try 
                {
                    mcursor.moveToFirst();
                    do 
                    {
                      words.add(mcursor.getString(column_index));
                    } 
                    while (mcursor.moveToNext());
                } 
                catch (IndexOutOfBoundsException e) 
                {
                    if (MainActivity.logcat_status) 
                    {
                      Log.e("Error", e + "");
                    }
                }
              }
            }                          
         } 
         catch (Exception e) 
         {
           // TODO Auto-generated catch block
           if (MainActivity.logcat_status) 
           {
             Log.e("Error", e + "");
           }
         }
    }
    

    0 讨论(0)
提交回复
热议问题