DbOpen.java :  » Contact » sync-contacts » com » googlecode » synccontacts » dao » Android Open Source

Android Open Source » Contact » sync contacts 
sync contacts » com » googlecode » synccontacts » dao » DbOpen.java
package com.googlecode.synccontacts.dao;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

/**
 * User: volkovma@inbox.ru
 * Date: 15.02.11
 * Create or update DB
 */
public class DbOpen extends SQLiteOpenHelper {

    private static final int DB_VERSION = 1;
    private static final String DB_NAME = "synccontacts";

    public static final String TABLE_ACCOUNTS = "accounts";
    public static final String SOC_NET = "socnet";
    public static final String LOGIN = "login";
    public static final String PASSW = "passw";
    public static final String [] ACCOUNT_COLUMNS = {SOC_NET,LOGIN,PASSW};

    private static final String CREATE_ACCOUNTS = "create table " + TABLE_ACCOUNTS + " ( _id integer primary key autoincrement, "
            + SOC_NET + " INTEGER, " + LOGIN + " TEXT, " + PASSW + " TEXT)";

    /**
     * 
     *
     * @param context
     */
    public DbOpen(Context context) {
        super(context, DB_NAME, null, DB_VERSION);

    }

    @Override
    public void onCreate(SQLiteDatabase sqLiteDatabase) {
        sqLiteDatabase.execSQL(CREATE_ACCOUNTS);
    }

    @Override
    public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {
    }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.