android ormlite登录注册的例子(9)
来源:未知 责任编辑:责任编辑 发表时间:2014-01-25 11:34 点击:次
private Dao<UsersEntity, Integer> userDao = null;
public DataHelper(Context context)
{
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
@Override
public void onCreate(SQLiteDatabase db, ConnectionSource connectionSource)
{
try
{
TableUtils.createTable(connectionSource, UsersEntity.class);
} catch (SQLException e)
{
Log.e(DataHelper.class.getName(), "创建数据库失败", e);
e.printStackTrace();
}
}
@Override
public void onUpgrade(SQLiteDatabase db, ConnectionSource connectionSource,
int arg2, int arg3)
{
try
{
TableUtils.dropTable(connectionSource, UsersEntity.class, true);
onCreate(db, connectionSource);
} catch (SQLException e)
{
Log.e(DataHelper.class.getName(), "更新数据库失败", e);
e.printStackTrace();
}
}
@Override
public void close()
{
super.close();
userDao = null;
}
public Dao<UsersEntity, Integer> getUserDataDao() throws SQLException
{
if (userDao == null)
{
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>