我通过示例代码自定义了一个 SQLiteOpenHelper,我想我应该在 db.execSQL(sql) 之后添加 db.close(),对吗?
public class RuleNumber extends SQLiteOpenHelper{
private final static String DBName="smsforwardrulenumber.db";
private final static String TableRuleNumber="rulenumber";
public RuleNumber(Context context) {
super(context, DBName, null, DBPublicPar.DBVersion);
}
@Override
public void onCreate(SQLiteDatabase db) {
// TODO Auto-generated method stub
String sql= "Create table "
+ TableRuleNumber
+" (numberID INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,"
+"ruleID INTEGER NOT NULL,"
+"numberType INTEGER NOT NULL,"
+"number TEXT NOT NULL"
+ ");";
db.execSQL(sql);
}