Java 字符串以在SQLite中创建完整数据库
我编写这个字符串是为了在SQLite中创建一个数据库,但是在创建corso之前,我遇到了一个错误create EXPENDING。这是字符串:Java 字符串以在SQLite中创建完整数据库,java,android,string,sqlite,Java,Android,String,Sqlite,我编写这个字符串是为了在SQLite中创建一个数据库,但是在创建corso之前,我遇到了一个错误create EXPENDING。这是字符串: static final String DATABASE_CREAZIONE = "CREATE TABLE utente (id integer primary key autoincrement, " + "nome text not null, cognome text not null, "
static final String DATABASE_CREAZIONE =
"CREATE TABLE utente (id integer primary key autoincrement, "
+ "nome text not null, cognome text not null, "
+ "email text not null, password text not null);"
+ "CREATE TABLE corso (id integer primary key autoincrement," +
"nome text not null);" +
"CREATE TABLE prenotazione (id_utente integer primary key autoincrement, "
+ "id_docente integer primary key autoincrement, data DATETIME not null);"+
"CREATE TABLE docenza (id integer primary key autoincrement, "
+ "nome_corso text not null, nome_prof text not null); "+
"CREATE TABLE professore (id integer primary key autoincrement, "
+ "nome text not null, cognome text not null); ";
只有Android Studio IDE发出了警告,但有一个合理的理由 通常用于执行类似这样的SQL的Android SQLiteDatabase execSQL一次只执行一条语句。之后的任何事情;将被忽略 您需要将SQL拆分为单独的execSQL调用。这也将消除IDE警告,并执行SQL的其他部分,以便您可以检测运行时问题,如Boken在其回答中报告的问题