SQLite的使用示例
2016-04-28 15:16
477 查看
public class CoolWeatherOpenHelper extends SQLiteOpenHelper {
/**
* Province表建表语句
*/
public static final String CREATE_PROVINCE="create table Province("
+"id integer primary key autoincrement,"
+"city_name text,"
+"province_id integer)";
//构造方法 四个参数: context, name, factory,version
public CoolWeatherOpenHelper(Context context, String name, CursorFactory factory, int version){
super(context,name,factory,version);
@override
public void onCreate(SQLiteDatebase db){
db.execSQL(CREATE_PROVINCE);//创建Province表
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion,int newVersion){
super(context,name,factory,version);}
}
/**
* Province表建表语句
*/
public static final String CREATE_PROVINCE="create table Province("
+"id integer primary key autoincrement,"
+"city_name text,"
+"province_id integer)";
//构造方法 四个参数: context, name, factory,version
public CoolWeatherOpenHelper(Context context, String name, CursorFactory factory, int version){
super(context,name,factory,version);
@override
public void onCreate(SQLiteDatebase db){
db.execSQL(CREATE_PROVINCE);//创建Province表
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion,int newVersion){
super(context,name,factory,version);}
}
相关文章推荐
- 数据库简单的实际运用 ①
- mysql数据库备份与还原命令
- Oracle游标使用全解
- mysql一些有用的链接
- sqlserver 字符串处理函数解释
- MYSQL启用日志,查看日志,利用mysqlbinlog工具恢复MySQL数据库【转载】
- MySQL各版本的区别
- sqlalchemy多表联合查询(join)
- 不用SQL语句直接修改数据
- SSH+Oracle10G抛Disabling contextual LOB creation as createClob() m
- MyCat源码解析(1)
- Redis事务使用总结
- MySQL数据类型和运算符
- redis windows7 64
- redis 缓存对查询结果的使用技巧
- mysql 服务重启报MySQL server PID file could not be found!*pid...
- MySQL主从复制:半同步、异步
- 数据库中char与varchar类型的区别
- mysql创建用户两次授权
- Oracle rac配置Weblogic数据源(实例名及URL的选择)