private static final String DB_NAME = "school.db";//数据库的名 public static final int DB_VERSION = 1;//数据库版本号 public MySQLite(Context context) { super(context, DB_NAME, null, DB_VERSION); } @Override public void onCreate(SQLiteDatabase database, ConnectionSource connectionSource) { //创建表 try { TableUtils.createTableIfNotExists(connectionSource, Classes.class); } catch (SQLException e) { e.printStackTrace(); } } @Override public void onUpgrade(SQLiteDatabase database, ConnectionSource connectionSource, int oldVersion, int newVersion) { //升级调用 }
MySQLite数据库运行代码
最新推荐文章于 2024-09-20 17:02:04 发布
本文介绍了一个简单的SQLite数据库管理类的实现,包括数据库的创建、表的创建及版本升级等功能。通过具体代码示例展示了如何使用SQLiteOpenHelper进行数据库操作。
1090

被折叠的 条评论
为什么被折叠?



