package de.eightbitboy.hijacr.data.database;

import android.content.Context;

import de.eightbitboy.hijacr.data.dao.DaoMaster;

public class Database {
	//TODO rename as soon as old database code is removed
	public static String DB_NAME = "comics.db.new";

	private Context context;

	public void init() {
		new DaoMaster.DevOpenHelper(context, DB_NAME, null);
	}
}

@@ -75,56 +75,246 @@
 xt;%0A
-%0Aimport de.eightbitboy.hijacr.data.dao.DaoMaster
+import android.database.sqlite.SQLiteDatabase;%0A%0Aimport de.eightbitboy.hijacr.data.dao.Comic;%0Aimport de.eightbitboy.hijacr.data.dao.ComicDao;%0Aimport de.eightbitboy.hijacr.data.dao.DaoMaster;%0Aimport de.eightbitboy.hijacr.data.dao.DaoSession
 ;%0A%0Ap
@@ -470,21 +470,161 @@
 ext;%0A%0A%09p
-ublic
+rivate SQLiteDatabase db;%0A%0A%09private DaoMaster master;%0A%0A%09public Database(Context context) %7B%0A%09%09this.context = context;%0A%09%09initialize();%0A%09%7D%0A%0A%09private
  void in
@@ -629,15 +629,26 @@
 init
+ialize
 () %7B%0A%09%09
+db = 
 new 
@@ -694,15 +694,216 @@
 E, null)
+.getWritableDatabase();%0A%09%09master = new DaoMaster(db);%0A%09%7D%0A%0A%09public Comic getComicById(long id) %7B%0A%09%09DaoSession session = master.newSession();%0A%09%09ComicDao dao = session.getComicDao();%0A%09%09return dao.load(id)
 ;%0A%09%7D%0A%7D%0A

Improve database