package com.tejia.lijin.app.db; import android.content.Context; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; public class SearchHistoryDatabaseHelper extends SQLiteOpenHelper { public static final String CREATE_SEARCH_HISTORY = "CREATE TABLE search_history (" + "id integer PRIMARY KEY Autoincrement ," + "name text )"; private Context mContext; public SearchHistoryDatabaseHelper(Context context, String name, SQLiteDatabase.CursorFactory factory, int verson) { super(context, name, factory, verson); mContext = context; } @Override public void onCreate(SQLiteDatabase db) { //创建数据库的同时创建searchHistory表 db.execSQL(CREATE_SEARCH_HISTORY); // Toast.makeText(mContext, "数据库创建成功", Toast.LENGTH_LONG).show(); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { } }