Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/215.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android &引用;没有这样的专栏“;在进行SQLite查询时_Android_Sql_Sqlite_Runtimeexception - Fatal编程技术网

Android &引用;没有这样的专栏“;在进行SQLite查询时

Android &引用;没有这样的专栏“;在进行SQLite查询时,android,sql,sqlite,runtimeexception,Android,Sql,Sqlite,Runtimeexception,我似乎找不到我代码中的错误。我尝试删除数据库并更改版本号,因为我后来添加了底部的内容,但它似乎无法识别。。尝试在getDiveList()方法内执行db.query时会指示错误 public类DatabaseHelper扩展了SQLiteOpenHelper{ //---数据库详细信息------------------------------------- 公共静态最终字符串数据库\u NAME=“SpotTheFish.db”; 公共静态最终int数据库_版本=3; //---用户潜水---

我似乎找不到我代码中的错误。我尝试删除数据库并更改版本号,因为我后来添加了底部的内容,但它似乎无法识别。。尝试在getDiveList()方法内执行db.query时会指示错误

public类DatabaseHelper扩展了SQLiteOpenHelper{
//---数据库详细信息-------------------------------------
公共静态最终字符串数据库\u NAME=“SpotTheFish.db”;
公共静态最终int数据库_版本=3;
//---用户潜水------------------------------
公共静态最终字符串潜水\u表\u NAME=“所有潜水”;
公共静态最终字符串DIVE\u ID=“DIVE\u ID”;
公共静态最终字符串KEY\u LOCATION\u NAME=“dive\u LOCATION”;
公共静态最终字符串键\u DATE=“DATE”;
公共静态最终字符串KEY\u TIME\u IN=“TIME\u IN”;
公共静态最终字符串键\u TIME\u OUT=“TIME\u OUT”;
公共静态最终字符串键\u BOTTOM\u TIME=“BOTTOM\u TIME”;
公共静态最终字符串键\u BARS\u START=“BARS\u at\u START”;
公共静态最终字符串键\u BARS\u END=“BARS\u at\u END”;
公共静态最终字符串键\u DEPTH=“DEPTH”;
公共静态最终字符串键\u TEMPERATURE=“TEMPERATURE”;
公共静态最终字符串键\u VISIBILITY=“VISIBILITY”;
public static final String[]DIVE_TABLE_KEYS={DIVE_ID,LINK_STATES_region_ID,KEY_LOCATION_NAME,KEY_DATE,KEY_TIME_IN,KEY_TIME_OUT,KEY_BOTTOM_TIME,KEY_BOTTOM_TIME,KEY_bar_START,KEY_bar_END,KEY_DEPTH,KEY_TEMPERATURE,KEY_VISIBILITY};
公共静态最终int COL\U DIVE\U ID=0;
公共静态最终国际中心潜水链接州地区=1;
公共静态最终整数列位置名称=2;
公共静态最终整数列日期=3;
公共静态最终整数列时间=4;
公共静态最终整数列超时=5;
公共静态最终整数列底部时间=6;
公共静态最终整列条形图开始=7;
公共静态最终内柱钢筋=8;
公共静态最终整数列深度=9;
公共静态最终温度=10;
公共静态最终int COL_可见性=11;
私有静态最终字符串创建潜水表=
“创建表”+潜水表名称+”(“+
DIVE_ID+“整数主键,”+
链接\状态\区域\ ID+“整数,”+
键位置名称+文本+
按键日期+文本+
在+文本中键入时间+
按键\u超时\u超时+“文本”+
按键\底部\时间+“文本,”+
键\u栏\u开始+“文本,”+
键\u栏\u结束+“文本”+
按键深度+文本+
按键温度+“文本,”+
按键可视性+“文本”+
")";
公共数据库助手(上下文){
super(上下文、数据库名称、null、数据库版本);
}
@凌驾
public void onCreate(SQLiteDatabase db){
试试{
execSQL(创建表);
}捕获(SQLE异常){
e、 printStackTrace();
}
}
@凌驾
public void onUpgrade(SQLiteDatabase db,int-oldVersion,int-newVersion){
db.execSQL(“如果存在删除表”+删除表名称);
}
/**
*创建ArrayList并从中添加所有行
*现有数据库表
*
*@return:arraylistofsubjects
*/
公共ArrayList getDiveList(){
ArrayList diveList=新的ArrayList();
SQLiteDatabase db=this.getReadableDatabase();
Cursor Cursor=db.query(俯冲表名称、俯冲表键、,
空,空,空,空,空,空,空);
如果(光标!=null){
cursor.moveToFirst();
而(!cursor.isAfterLast()){
潜水潜水=新潜水(cursor.getLong(DatabaseHelper.COL\u潜水\u ID),
cursor.getLong(COL\u DIVE\u LINK\u STATES\u REGIONS),
cursor.getString(列位置名称),
cursor.getString(COL_DATE),
cursor.getString(COL\u TIME\u IN),
cursor.getString(列超时),
cursor.getString(COL\u BOTTOM\u TIME),
cursor.getString(COL\u bar\u START),
cursor.getString(COL\u bar\u END),
cursor.getString(COL_DEPTH),
cursor.getString(COL_温度),
getString(COL_可见性));
diveList.add(潜水);
cursor.moveToNext();
}
}
cursor.close();
db.close();
返回diveList;
}
}
以下是错误日志:

 --------- beginning of crash
05-18 13:43:19.820 7044-7044/com.id12538676.catchemallfishcollection E/AndroidRuntime: FATAL EXCEPTION: main

                                                                                       Process: com.id12538676.catchemallfishcollection, PID: 7044
                                                                                       java.lang.RuntimeException: Unable to start activity ComponentInfo{com.id12538676.catchemallfishcollection/com.id12538676.catchemallfishcollection.StartActivity}: android.database.sqlite.SQLiteException: no such column: bottom_time (code 1): , while compiling: SELECT dive_id, state_region_link_id, dive_location, date, time_in, time_out, bottom_time, bars_at_start, bars_at_end, depth, temperature, visibility FROM all_dives
                                                                                           at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
                                                                                           at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
                                                                                           at android.app.ActivityThread.-wrap11(ActivityThread.java)
                                                                                           at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
                                                                                           at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                           at android.os.Looper.loop(Looper.java:148)
                                                                                           at android.app.ActivityThread.main(ActivityThread.java:5417)
                                                                                           at java.lang.reflect.Method.invoke(Native Method)
                                                                                           at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                                                           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
                                                                                        Caused by: android.database.sqlite.SQLiteException: no such column: bottom_time (code 1): , while compiling: SELECT dive_id, state_region_link_id, dive_location, date, time_in, time_out, bottom_time, bars_at_start, bars_at_end, depth, temperature, visibility FROM all_dives
                                                                                           at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
                                                                                           at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:887)
                                                                                           at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:498)
                                                                                           at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588)
                                                                                           at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:58)
                                                                                           at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java:37)
                                                                                           at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:44)
                                                                                           at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1316)
                                                                                           at android.database.sqlite.SQLiteDatabase.queryWithFactory(SQLiteDatabase.java:1163)
                                                                                           at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1034)
                                                                                           at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1240)
                                                                                           at com.id12538676.catchemallfishcollection.DatabaseHelper.getDiveList(DatabaseHelper.java:364)
                                                                                           at com.id12538676.catchemallfishcollection.DatabaseManager.<init>(DatabaseManager.java:26)
                                                                                           at com.id12538676.catchemallfishcollection.DatabaseManager.getInstance(DatabaseManager.java:19)
                                                                                           at com.id12538676.catchemallfishcollection.StartActivity.onCreate(StartActivity.java:29)
                                                                                           at android.app.Activity.performCreate(Activity.java:6237)
                                                                                           at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
                                                                                           at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
                                                                                           at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) 
                                                                                           at android.app.ActivityThread.-wrap11(ActivityThread.java) 
                                                                                           at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) 
                                                                                           at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                                           at android.os.Looper.loop(Looper.java:148) 
                                                                                           at android.app.ActivityThread.main(ActivityThread.java:5417) 
                                                                                           at java.lang.reflect.Method.invoke(Native Method) 
                                                                                           at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
                                                                                           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
-----------崩溃开始
05-18 13:43:19.820 7044-7044/com.id12538676.catchemallfishcollection E/AndroidRuntime:致命异常:main
进程:com.id12538676.catchemallfishcollection,PID:7044
java.lang.RuntimeException:无法启动activity ComponentInfo{com.id12538676.catchemallfishcollection/com.id12538676.catchemallfishcollection.StartActivity}:android.database.sqlite.SQLiteException:没有这样的列:bottom_time(代码1):,编译时:选择潜水id、状态\区域\链接\ id、潜水\位置、日期、时间\输入、时间\输出,下潜时间、下潜开始时的高度、下潜结束时的高度、深度、温度、所有下潜动作的能见度
在android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)上
位于android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
 --------- beginning of crash
05-18 13:43:19.820 7044-7044/com.id12538676.catchemallfishcollection E/AndroidRuntime: FATAL EXCEPTION: main

                                                                                       Process: com.id12538676.catchemallfishcollection, PID: 7044
                                                                                       java.lang.RuntimeException: Unable to start activity ComponentInfo{com.id12538676.catchemallfishcollection/com.id12538676.catchemallfishcollection.StartActivity}: android.database.sqlite.SQLiteException: no such column: bottom_time (code 1): , while compiling: SELECT dive_id, state_region_link_id, dive_location, date, time_in, time_out, bottom_time, bars_at_start, bars_at_end, depth, temperature, visibility FROM all_dives
                                                                                           at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
                                                                                           at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
                                                                                           at android.app.ActivityThread.-wrap11(ActivityThread.java)
                                                                                           at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
                                                                                           at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                           at android.os.Looper.loop(Looper.java:148)
                                                                                           at android.app.ActivityThread.main(ActivityThread.java:5417)
                                                                                           at java.lang.reflect.Method.invoke(Native Method)
                                                                                           at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                                                           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
                                                                                        Caused by: android.database.sqlite.SQLiteException: no such column: bottom_time (code 1): , while compiling: SELECT dive_id, state_region_link_id, dive_location, date, time_in, time_out, bottom_time, bars_at_start, bars_at_end, depth, temperature, visibility FROM all_dives
                                                                                           at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
                                                                                           at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:887)
                                                                                           at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:498)
                                                                                           at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588)
                                                                                           at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:58)
                                                                                           at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java:37)
                                                                                           at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:44)
                                                                                           at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1316)
                                                                                           at android.database.sqlite.SQLiteDatabase.queryWithFactory(SQLiteDatabase.java:1163)
                                                                                           at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1034)
                                                                                           at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1240)
                                                                                           at com.id12538676.catchemallfishcollection.DatabaseHelper.getDiveList(DatabaseHelper.java:364)
                                                                                           at com.id12538676.catchemallfishcollection.DatabaseManager.<init>(DatabaseManager.java:26)
                                                                                           at com.id12538676.catchemallfishcollection.DatabaseManager.getInstance(DatabaseManager.java:19)
                                                                                           at com.id12538676.catchemallfishcollection.StartActivity.onCreate(StartActivity.java:29)
                                                                                           at android.app.Activity.performCreate(Activity.java:6237)
                                                                                           at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
                                                                                           at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
                                                                                           at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) 
                                                                                           at android.app.ActivityThread.-wrap11(ActivityThread.java) 
                                                                                           at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) 
                                                                                           at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                                           at android.os.Looper.loop(Looper.java:148) 
                                                                                           at android.app.ActivityThread.main(ActivityThread.java:5417) 
                                                                                           at java.lang.reflect.Method.invoke(Native Method) 
                                                                                           at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
                                                                                           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
KEY_TIME_OUT + " TEXT" +
KEY_BOTTOM_TIME + " TEXT, " +
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

    db.execSQL("DROP TABLE IF EXISTS " + DIVE_TABLE_NAME);
    onCreate(db);
}
private static final String CREATE_DIVE_TABLE =
        "CREATE TABLE " + DIVE_TABLE_NAME + " (" +
                DIVE_ID + " INTEGER PRIMARY KEY, " +
                LINK_STATES_REGIONS_ID + " INTEGER, " +
                KEY_LOCATION_NAME + " TEXT, " +
                KEY_DATE + " TEXT, " +
                KEY_TIME_IN + " TEXT, " +
                KEY_TIME_OUT + " TEXT, " +
                KEY_BOTTOM_TIME + " TEXT, " +
                KEY_BARS_START + " TEXT, " +
                KEY_BARS_END + " TEXT, " +
                KEY_DEPTH + " TEXT, " +
                KEY_TEMPERATURE + " TEXT, " +
                KEY_VISIBILITY + " TEXT" +
                ")";
KEY_TIME_IN + " TEXT, " + KEY_TIME_OUT + " TEXT" + KEY_BOTTOM_TIME + " TEXT, "