aboutsummaryrefslogtreecommitdiff
path: root/src/net/cbaines/suma/DatabaseHelper.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/cbaines/suma/DatabaseHelper.java')
-rw-r--r--src/net/cbaines/suma/DatabaseHelper.java37
1 files changed, 13 insertions, 24 deletions
diff --git a/src/net/cbaines/suma/DatabaseHelper.java b/src/net/cbaines/suma/DatabaseHelper.java
index 73f4c79..17ef720 100644
--- a/src/net/cbaines/suma/DatabaseHelper.java
+++ b/src/net/cbaines/suma/DatabaseHelper.java
@@ -55,7 +55,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
private Context context;
public DatabaseHelper(Context context) {
- super(context, DATABASE_NAME, null, DATABASE_VERSION);
+ super(context, DATABASE_NAME, null, DATABASE_VERSION, R.raw.ormlite_config);
Log.i(TAG, "Database Helper created");
this.context = context;
}
@@ -89,8 +89,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
}
/**
- * Returns the Database Access Object (DAO) for our SimpleData class. It
- * will create it or just give the cached value.
+ * Returns the Database Access Object (DAO) for our SimpleData class. It will create it or just give the cached value.
*/
public Dao<Building, String> getBuildingDao() throws SQLException {
if (buildingDao == null) {
@@ -100,8 +99,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
}
/**
- * Returns the Database Access Object (DAO) for our SimpleData class. It
- * will create it or just give the cached value.
+ * Returns the Database Access Object (DAO) for our SimpleData class. It will create it or just give the cached value.
*/
public Dao<BusStop, String> getBusStopDao() throws SQLException {
if (busStopDao == null) {
@@ -111,8 +109,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
}
/**
- * Returns the Database Access Object (DAO) for our SimpleData class. It
- * will create it or just give the cached value.
+ * Returns the Database Access Object (DAO) for our SimpleData class. It will create it or just give the cached value.
*/
public Dao<BusRoute, Integer> getBusRouteDao() throws SQLException {
if (busRouteDao == null) {
@@ -122,8 +119,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
}
/**
- * Returns the Database Access Object (DAO) for our SimpleData class. It
- * will create it or just give the cached value.
+ * Returns the Database Access Object (DAO) for our SimpleData class. It will create it or just give the cached value.
*/
public Dao<RouteStop, Integer> getRouteStopsDao() throws SQLException {
if (routeStopsDao == null) {
@@ -133,8 +129,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
}
/**
- * Returns the Database Access Object (DAO) for our SimpleData class. It
- * will create it or just give the cached value.
+ * Returns the Database Access Object (DAO) for our SimpleData class. It will create it or just give the cached value.
*/
public Dao<Site, String> getSiteDao() throws SQLException {
if (siteDao == null) {
@@ -144,8 +139,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
}
/**
- * Returns the Database Access Object (DAO) for our SimpleData class. It
- * will create it or just give the cached value.
+ * Returns the Database Access Object (DAO) for our SimpleData class. It will create it or just give the cached value.
*/
public Dao<Bus, Integer> getBusDao() throws SQLException {
if (busDao == null) {
@@ -155,8 +149,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
}
/**
- * Check if the database already exist to avoid re-copying the file each
- * time you open the application.
+ * Check if the database already exist to avoid re-copying the file each time you open the application.
*
* @return true if it exists, false if it doesn't
*/
@@ -166,8 +159,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
/*
* SQLiteDatabase checkDB = null;
*
- * try { String myPath = DATABASE_PATH + DATABASE_NAME; checkDB =
- * SQLiteDatabase.openDatabase(myPath, null,
+ * try { String myPath = DATABASE_PATH + DATABASE_NAME; checkDB = SQLiteDatabase.openDatabase(myPath, null,
* SQLiteDatabase.OPEN_READONLY); } catch (SQLiteException e) {
*
* // database does't exist yet.
@@ -180,8 +172,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
*
* }
*
- * Log.i(TAG, "Finished checking database"); return checkDB != null ?
- * true : false;
+ * Log.i(TAG, "Finished checking database"); return checkDB != null ? true : false;
*/
File dbFile = new File(DATABASE_PATH + DATABASE_NAME);
@@ -189,9 +180,8 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
}
/**
- * Copies your database from your local assets-folder to the just created
- * empty database in the system folder, from where it can be accessed and
- * handled. This is done by transfering bytestream.
+ * Copies your database from your local assets-folder to the just created empty database in the system folder, from where it
+ * can be accessed and handled. This is done by transfering bytestream.
* */
public void copyDataBase() throws IOException {
Log.i(TAG, "Begining copy database");
@@ -228,8 +218,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
}
/**
- * Creates a empty database on the system and rewrites it with your own
- * database.
+ * Creates a empty database on the system and rewrites it with your own database.
* */
public void createDataBase() throws IOException {