尝试使用sqlite3访问sms.db

时间:2012-03-21 16:07:58

标签: iphone sqlite

我通常会删除所有短信,但这次我不小心删除了我需要的对话。我对iphone 4进行了备份(第一次)。然后我使用了IPhone备份提取器从备份中提取sms.db。使用sqlite3,我看到大量的教程,我可以查看我删除的短信。但是,所有表都显示为空。当我在notepad ++中查看sms.db文件时,我确实看到了很久以前和最近都删除过的消息。但是,我没有看到我的所有消息附近的任何地方,我假设他们在某处。如果sqlite产品无法看到它们,我该怎么看?但我知道它就在那里。感谢。

2 个答案:

答案 0 :(得分:0)

你可以在methode上试试这个

public class Database_creat {
    private static final String DATABASE_NAME = "ToDo_List.db";
    public static final String DATABASE_TABLE_CATEGORY = "category";
    public static final String DATABASE_TABLE_TODO_LIST = "todo_list";
    private static final int DATABASE_VERSION = 1;
    public ArrayList<ModelToDO> list;


    private DataBaseHelper mDbhelper;
    private SQLiteDatabase mDb;

    Context mContext;
    private static final String DATABASE_CREATE_CATEGORY = "create table category(id integer primary key autoincrement , "
            + "category text not null);";
    private static final String DATABASE_CREATE_TODO_LIST = "create table todo_list(id integer primary key autoincrement , "
            + "title text not null,description text not null,category text not null, due_date Date not null,alarm_time text ,alarm_set text,priority text,parform Boolean);";

    private static class DataBaseHelper extends SQLiteOpenHelper {

        DataBaseHelper(Context context) {
            super(context, DATABASE_NAME, null, DATABASE_VERSION);
            // TODO Auto-generated constructor stub
        }

        @Override
        public void onCreate(SQLiteDatabase db) {
            // TODO Auto-generated method stub
            db.execSQL(DATABASE_CREATE_CATEGORY);
            db.execSQL(DATABASE_CREATE_TODO_LIST);
        }

        //Delete All todo_list Table info
        public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
            // TODO Auto-generated method stub
            db.execSQL("DROP TABLE IF EXISTS submit");
            onCreate(db);
        }
    }

    public Database_creat(Context context) {
        this.mContext = context;
    }

    public Database_creat Open() throws SQLException {
        mDbhelper = new DataBaseHelper(mContext);
        mDb = mDbhelper.getWritableDatabase();
        return this;

    }

    public void close() {
        mDbhelper.close();
    }

    //Add new Category name
    public long insertinfo(String cate) {
        ContentValues con = new ContentValues();
        con.put("category", cate);
        return mDb.insert(DATABASE_TABLE_CATEGORY, null, con);
    }

    //Get All Category Name
    public Cursor getInfoRecords() {
        return mDb.query(DATABASE_TABLE_CATEGORY, new String[] { "id","category" }, null, null, null, null, null);
    }

    //Get All todo_list Table record 
    public Cursor getInfoRecords_todo() {
        return mDb.query(DATABASE_TABLE_TODO_LIST, new String[] { "id",
                "title", "description", "category", "due_date", "alarm_time",
                "alarm_set", "priority", "parform" }, null, null, null, null,
                null);
    }

    //Delete All todo_list Table info
    public void delall() {
        // TODO Auto-generated method stub
        mDb.delete(DATABASE_TABLE_TODO_LIST, null, null);
        Log.v("delete", DATABASE_CREATE_TODO_LIST + "all table data delete");
    }

    //new Record insert in todo_list table  
    public Long insert_todoinfo(String a, String b, String c, String d,
            String e, String f, String g) {
        // TODO Auto-generated method stub
        ContentValues con = new ContentValues();
        con.put("title", a);
        con.put("description", b);
        con.put("category", e);
        con.put("due_date", c);
        con.put("alarm_time", d);
        con.put("alarm_set", f);
        con.put("priority", g);
        con.put("parform", "false");
        return mDb.insert(DATABASE_TABLE_TODO_LIST, null, con);
    }


    //Delete id vs todo_list Table record 
    public void getdata_delet(int id) {
        // TODO Auto-generated method stub
         mDb.delete(DATABASE_TABLE_TODO_LIST, "id ='"+id +"'", null);

    }


    //Update id vs todo_list Table in CheckBox info 
    public void update_cb(int id, Boolean b) {
        // TODO Auto-generated method stub
        ContentValues con = new ContentValues();
        con.put("parform", b);
        mDb.update(DATABASE_TABLE_TODO_LIST, con, "id ='" + id + "'",null);
    }

    //Delete id vs category Table record 
    public void delete_category(int id) {
        // TODO Auto-generated method stub
        Log.v("id del cage",id+"");
         mDb.delete(DATABASE_TABLE_CATEGORY, "id ='"+id +"'", null);
    }


}

答案 1 :(得分:0)

如果在sqlite3中运行以下命令,您应该会看到所有已删除的消息

SELECT address, text FROM message WHERE flags = 129;