You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
1.1 KiB
29 lines
1.1 KiB
package com.example.activity.dbsql;
|
|
|
|
import android.content.Context;
|
|
import android.database.sqlite.SQLiteDatabase;
|
|
import android.database.sqlite.SQLiteOpenHelper;
|
|
|
|
import androidx.annotation.Nullable;
|
|
|
|
public class DBOpenHelper extends SQLiteOpenHelper {
|
|
public DBOpenHelper(@Nullable Context context, @Nullable String name, @Nullable SQLiteDatabase.CursorFactory factory, int version) {
|
|
super(context, name, factory, version);
|
|
}
|
|
|
|
@Override
|
|
public void onCreate(SQLiteDatabase db) {
|
|
//创建数据库sql语句并执行
|
|
String sql="create table question(q_type varchar(10),q_id int ,answer varchar(200)," +
|
|
" questions varchar(500),OptionA varchar(500),OptionB varchar(500),OptionC varchar(500),OptionD varchar(500))";
|
|
db.execSQL(sql);
|
|
/*q_type varchar(10),q_id int ,answer varchar(200),questions varchar(500),OptionA varchar(500),OptionB varchar(500),OptionC varchar(500),OptionD varchar(500) */
|
|
}
|
|
|
|
@Override
|
|
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
|
|
|
|
}
|
|
}
|
|
|