Android Open Source - cnBeta Base D B Helper

From Project

Back to project page cnBeta.


The source code is released under:

Apache License

If you think the Android project cnBeta 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 com.guest.cnbeta.database;
/*w  ww . java  2s  .co m*/
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;

public class BaseDBHelper extends SQLiteOpenHelper {

  public BaseDBHelper(Context context, String name, CursorFactory factory,
      int version) {
    super(context, name, factory, version);

  public void onCreate(SQLiteDatabase db) {
    db.execSQL("CREATE TABLE 'article' ( 'articleid' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, 'fromid' VARCHAR ( 50 ) NOT NULL , 'title' VARCHAR ( 255 ) NOT NULL , 'info' TEXT, 'avatar' VARCHAR ( 255 ) NOT NULL ) ;");
    db.execSQL("CREATE UNIQUE INDEX article_fromid ON 'article'('fromid');");

  public void onUpgrade(SQLiteDatabase arg0, int arg1, int arg2) {
    // TODO Auto-generated method stub

Java Source Code List