难道onUpgrade方法曾经叫什么名字? [英] Is the onUpgrade method ever called?

查看:148
本文介绍了难道onUpgrade方法曾经叫什么名字?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是<一个href="http://developer.android.com/reference/android/database/sqlite/SQLiteOpenHelper.html#onUpgrade%28android.database.sqlite.SQLiteDatabase,%20int,%20int%29"><$c$c>onUpgrade方法<一href="http://developer.android.com/reference/android/database/sqlite/SQLiteOpenHelper.html"><$c$c>SQLiteOpenHelper曾经叫什么名字?如果是这样,当它被称为和是什么?或者,如果它不叫开发商,那么为什么会出现?我应该在的方法来完成我所看到的例子,它丢弃所有的表,但后来评论说,丢弃所有的表是你应该做的。

推荐答案

这是当你构建一个SQLiteOpenHelper版本比打开数据库的版本较新的调用。做什么取决于所旧版本和新版本之间所做的改变在数据库中。当你不降一改表的唯一情况是,当变化是指出了一个多添加的列。然后你可以使用ALTER TABLE语句来新列添加到表中签名。

It is called when you construct a SQLiteOpenHelper with version newer than the version of the opened database. What to do depends on the changes in the database that are made between the old and new versions. The only case when you don't drop a changed table is when the change is noting more than an added column. Then you can use ALTER TABLE statement to add the new column to the table signature.

这篇关于难道onUpgrade方法曾经叫什么名字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆