1
0
mirror of https://github.com/moparisthebest/SSLDroid synced 2024-11-23 09:22:16 -05:00
SSLDroid/src/hu/blint/ssldroid/db/SSLDroidDbHelper.java
Balint Kovacs 8e3cd92b69 Implemented explicit stop feature - stops the service until it is
started manually

Signed-off-by: Balint Kovacs <blint@blint.hu>
2011-10-19 11:44:43 +02:00

42 lines
1.6 KiB
Java

package hu.blint.ssldroid.db;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
public class SSLDroidDbHelper extends SQLiteOpenHelper {
private static final String DATABASE_NAME = "applicationdata";
private static final int DATABASE_VERSION = 2;
// Database creation sql statement
private static final String DATABASE_CREATE = "CREATE TABLE IF NOT EXISTS tunnels (_id integer primary key autoincrement, "
+ "name text not null, localport integer not null, remotehost text not null, "
+ "remoteport integer not null, pkcsfile text not null, pkcspass text );";
private static final String STATUS_CREATE = "CREATE TABLE IF NOT EXISTS status (name text, value text);";
public SSLDroidDbHelper(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
// Method is called during creation of the database
@Override
public void onCreate(SQLiteDatabase database) {
database.execSQL(DATABASE_CREATE);
database.execSQL(STATUS_CREATE);
}
// Method is called during an update of the database, e.g. if you increase
// the database version
@Override
public void onUpgrade(SQLiteDatabase database, int oldVersion,
int newVersion) {
Log.w(SSLDroidDbHelper.class.getName(),
"Upgrading database from version " + oldVersion + " to "
+ newVersion + ", which will add a status table");
database.execSQL("CREATE TABLE IF NOT EXISTS status (name text, value text);");
onCreate(database);
}
}