2011-09-08 16:05:00 +00:00
|
|
|
package org.fox.ttrss;
|
|
|
|
import android.content.Context;
|
|
|
|
import android.database.sqlite.SQLiteDatabase;
|
|
|
|
import android.database.sqlite.SQLiteOpenHelper;
|
|
|
|
import android.provider.BaseColumns;
|
|
|
|
import android.util.Log;
|
|
|
|
|
|
|
|
|
|
|
|
public class DatabaseHelper extends SQLiteOpenHelper {
|
|
|
|
|
|
|
|
private final String TAG = this.getClass().getSimpleName();
|
|
|
|
public static final String DATABASE_NAME = "LocalStorage";
|
2011-09-09 06:02:31 +00:00
|
|
|
public static final int DATABASE_VERSION = 4;
|
2011-09-08 16:05:00 +00:00
|
|
|
|
|
|
|
public DatabaseHelper(Context context) {
|
2011-09-09 06:02:31 +00:00
|
|
|
super(context, DATABASE_NAME, null, DATABASE_VERSION);
|
2011-09-08 16:05:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onCreate(SQLiteDatabase db) {
|
2011-09-09 06:02:31 +00:00
|
|
|
db.execSQL("DROP TABLE IF EXISTS feeds;");
|
|
|
|
db.execSQL("DROP TABLE IF EXISTS articles;");
|
2011-09-08 16:05:00 +00:00
|
|
|
|
|
|
|
db.execSQL("CREATE TABLE IF NOT EXISTS feeds (" +
|
|
|
|
BaseColumns._ID + " INTEGER PRIMARY KEY AUTOINCREMENT," +
|
|
|
|
"feed_url TEXT, " +
|
|
|
|
"title TEXT, " +
|
|
|
|
"unread INTEGER, " +
|
|
|
|
"has_icon BOOLEAN, " +
|
|
|
|
"cat_id INTEGER, " +
|
2011-09-09 06:02:31 +00:00
|
|
|
"last_updated INTEGER, " +
|
|
|
|
"count INTEGER" +
|
|
|
|
");");
|
2011-09-08 16:05:00 +00:00
|
|
|
|
2011-09-09 06:02:31 +00:00
|
|
|
db.execSQL("CREATE TABLE IF NOT EXISTS articles (" +
|
|
|
|
BaseColumns._ID + " INTEGER PRIMARY KEY AUTOINCREMENT," +
|
|
|
|
"unread BOOLEAN, " +
|
|
|
|
"marked BOOLEAN, " +
|
|
|
|
"published BOOLEAN, " +
|
|
|
|
"updated INTEGER, " +
|
|
|
|
"is_updated BOOLEAN, " +
|
|
|
|
"title TEXT, " +
|
|
|
|
"link TEXT, " +
|
|
|
|
"feed_id INTEGER, " +
|
|
|
|
"tags TEXT, " +
|
|
|
|
"content TEXT" +
|
|
|
|
");");
|
2011-09-08 16:05:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
|
2011-09-09 06:02:31 +00:00
|
|
|
onCreate(db);
|
2011-09-08 16:05:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|