Android Open Source - SipgateInfo Database Helper






From Project

Back to project page SipgateInfo.

License

The source code is released under:

GNU General Public License

If you think the Android project SipgateInfo listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package net.skweez.sipgate.db;
/*from www  . ja v a  2 s  .c o m*/
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

public class DatabaseHelper extends SQLiteOpenHelper {

  public static final String TABLE_CALLS = "calls";

  public static final String COLUMN_ID = "_id";

  public static final String COLUMN_TIMESTAMP = "timestamp";

  public static final String COLUMN_REMOTE_URI = "number";

  public static final String COLUMN_CALL_STATUS = "status";

  public static final String TABLE_ACCOUNTS = "accounts";

  public static final String COLUMN_FIRSTNAME = "name1";

  public static final String COLUMN_LASTNAME = "name2";

  public static final String COLUMN_SIPURI = "sipuri";

  public static final String COLUMN_PHONE_NR = "phone_nr";

  public static final String COLUMN_BALANCE = "balance";

  public static final String COLUMN_CURRENCY = "currency";

  private static final String DATABASE_NAME = "sipgate.db";

  private static final int DATABASE_VERSION = 8;

  // Database creation SQL statement
  private static final String TABLE_CALLS_CREATE = "create table "
      + TABLE_CALLS + "( " + COLUMN_ID
      + " integer primary key autoincrement, " + COLUMN_TIMESTAMP
      + " text not null, " + COLUMN_REMOTE_URI + " text, "
      + COLUMN_CALL_STATUS + " text);";
  private static final String TABLE_ACCOUNTS_CREATE = "create table "
      + TABLE_ACCOUNTS + "( " + COLUMN_ID
      + " integer primary key autoincrement, " + COLUMN_FIRSTNAME
      + " text, " + COLUMN_LASTNAME + " text, " + COLUMN_PHONE_NR
      + " text, " + COLUMN_SIPURI + " text, " + COLUMN_BALANCE
      + " real, " + COLUMN_CURRENCY + " text" + ");";

  public DatabaseHelper(Context context) {
    super(context, DATABASE_NAME, null, DATABASE_VERSION);
  }

  @Override
  public void onCreate(SQLiteDatabase database) {
    database.execSQL(TABLE_CALLS_CREATE);
    database.execSQL(TABLE_ACCOUNTS_CREATE);
  }

  @Override
  public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
    Log.w(DatabaseHelper.class.getName(),
        "Upgrading database from version " + oldVersion + " to "
            + newVersion + ", which will destroy all old data");
    db.execSQL("DROP TABLE IF EXISTS " + TABLE_CALLS);
    db.execSQL("DROP TABLE IF EXISTS " + TABLE_ACCOUNTS);
    onCreate(db);
  }

}




Java Source Code List

net.skweez.sipgate.CallUtils.java
net.skweez.sipgate.PreferencesAuthenticator.java
net.skweez.sipgate.SipgateApplication.java
net.skweez.sipgate.activity.AccountInfoAdapter.java
net.skweez.sipgate.activity.CallListAdapter.java
net.skweez.sipgate.activity.MainActivity.java
net.skweez.sipgate.activity.SetupActivity.java
net.skweez.sipgate.api.AuthenticationException.java
net.skweez.sipgate.api.Call.java
net.skweez.sipgate.api.ECallStatus.java
net.skweez.sipgate.api.ISipgateAPI.java
net.skweez.sipgate.api.Price.java
net.skweez.sipgate.api.SipgateException.java
net.skweez.sipgate.api.UserName.java
net.skweez.sipgate.api.UserUri.java
net.skweez.sipgate.api.xmlrpc.SipgateUriHelper.java
net.skweez.sipgate.api.xmlrpc.SipgateXmlRpcImpl.java
net.skweez.sipgate.db.DataSource.java
net.skweez.sipgate.db.DatabaseHelper.java
net.skweez.sipgate.model.AccountInfo.java
net.skweez.sipgate.service.QueryResultReceiver.java
net.skweez.sipgate.service.QueryService.java