Я следовал стандартному руководству по созданию базы данных с Android.Я создал класс с именем DbHelper, который расширяет SQLiteOpenHelper.Я переопределил обработчик создания для выполнения строки.
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL(DbDefinitions.DB_CREATE);
}
DbDefinitions.DB_CREATE - созданная мной статическая строка.
public static final String TABLE_MESSAGES = "messages";
public static final String TABLE_FRIENDS = "friends";
public static final String STATE_OK = "STATE_OK";
public static final String DB_CREATE =
"create table " + TABLE_MESSAGES + " (_id integer primary key, user_id integer not null, created_on integer, subject text not null, summary text not null, messagetext text null, read integer not null, status text not null default '" + STATE_OK + "'); " +
"create table " + TABLE_FRIENDS + " (_id integer primary key, user_id integer not null, friend_id integer not null, created_on integer, status text not null default '" + STATE_OK + "');";
Я хотел бы использовать 1 строкувыполнить несколько операторов SQL.Как я могу сделать это, так как SQLiteDatabase.execSQL допускает только 1 оператор?