gpt4 book ai didi

java - 无法在第 27805 行打开文件

转载 作者:太空宇宙 更新时间:2023-11-04 13:28:44 26 4
gpt4 key购买 nike

我有一个很大的问题,我无法解决问题,基本上在从数据库读取大约 130 次后访问我的 android 数据库时,它会将其扔到 logcat 中并且 Activity 结束。到目前为止,数据库一直在完美地读取数据,并且每次都看不到它在这一点上失败的原因。
09-04 16:45:31.754: E/SQLiteLog(4213): (14) cannot open file at line 27805 of [9491ba7d73]
09-04 16:45:31.754: E/SQLiteLog(4213): (14) os_unix.c:27805: (24) open(/data/data/com.boltgames.dev.cricketone/databases) -
09-04 16:45:31.758: E/SQLiteLog(4213): (14) cannot open file at line 30046 of [9491ba7d73]
09-04 16:45:31.758: E/SQLiteLog(4213): (14) os_unix.c:30046: (24) open(/data/data/com.boltgames.dev.cricketone/databases/Student.db-journal) -
09-04 16:45:31.758: E/SQLiteLog(4213): (14) cannot open file at line 30046 of [9491ba7d73]
09-04 16:45:31.758: E/SQLiteLog(4213): (14) os_unix.c:30046: (24) open(/data/data/com.boltgames.dev.cricketone/databases/Student.db-journal) -
09-04 16:45:31.758: E/SQLiteLog(4213): (14) statement aborts at 37: [SELECT DISTINCT _id, NAME, SURNAME, AGE, STAMINA, FITNESS, BOWLINGSKILL, BATTINGSKILL, OVERS, MAIDENS, BWLRUNS, WICKETS, ECONOMY, STRIKERATE, INNS, NOTOUT, BATRUNS, FIFTY, HUNDRED, FOU
09-04 16:45:31.759: E/SQLiteQuery(4213): exception: unable to open database file (code 14); query: SELECT DISTINCT _id, NAME, SURNAME, AGE, STAMINA, FITNESS, BOWLINGSKILL, BATTINGSKILL, OVERS, MAIDENS, BWLRUNS, WICKETS, ECONOMY, STRIKERATE, INNS, NOTOUT, BATRUNS, FIFTY, HUNDRED, FOURS, SIXES, DUCKS, CURBALLS, CURRUNS, CURFOURS, CURSIXES FROM Langley
09-04 16:45:31.759: D/AndroidRuntime(4213): Shutting down VM
09-04 16:45:31.760: E/AndroidRuntime(4213): FATAL EXCEPTION: main
09-04 16:45:31.760: E/AndroidRuntime(4213): Process: com.boltgames.dev.cricketone, PID: 4213
09-04 16:45:31.760: E/AndroidRuntime(4213): android.database.sqlite.SQLiteCantOpenDatabaseException: unable to open database file (code 14)
09-04 16:45:31.760: E/AndroidRuntime(4213): at android.database.sqlite.SQLiteConnection.nativeExecuteForCursorWindow(Native Method)
09-04 16:45:31.760: E/AndroidRuntime(4213): at android.database.sqlite.SQLiteConnection.executeForCursorWindow(SQLiteConnection.java:845)
09-04 16:45:31.760: E/AndroidRuntime(4213): at android.database.sqlite.SQLiteSession.executeForCursorWindow(SQLiteSession.java:836)
09-04 16:45:31.760: E/AndroidRuntime(4213): at android.database.sqlite.SQLiteQuery.fillWindow(SQLiteQuery.java:62)
09-04 16:45:31.760: E/AndroidRuntime(4213): at android.database.sqlite.SQLiteCursor.fillWindow(SQLiteCursor.java:144)
09-04 16:45:31.760: E/AndroidRuntime(4213): at android.database.sqlite.SQLiteCursor.getCount(SQLiteCursor.java:133)
09-04 16:45:31.760: E/AndroidRuntime(4213): at android.database.AbstractCursor.moveToPosition(AbstractCursor.java:197)
09-04 16:45:31.760: E/AndroidRuntime(4213): at android.database.AbstractCursor.moveToFirst(AbstractCursor.java:237)
09-04 16:45:31.760: E/AndroidRuntime(4213): at com.boltgames.dev.cricketlife.DatabaseHelper.getAllRows(DatabaseHelper.java:124)
09-04 16:45:31.760: E/AndroidRuntime(4213): at com.boltgames.dev.cricketlife.Play.SetData(Play.java:149)
09-04 16:45:31.760: E/AndroidRuntime(4213): at com.boltgames.dev.cricketlife.Play.SetPlayers(Play.java:134)
09-04 16:45:31.760: E/AndroidRuntime(4213): at com.boltgames.dev.cricketlife.Play.PlayOneRun(Play.java:277)
09-04 16:45:31.760: E/AndroidRuntime(4213): at com.boltgames.dev.cricketlife.Play$1.onClick(Play.java:249)
09-04 16:45:31.760: E/AndroidRuntime(4213): at android.view.View.performClick(View.java:4780)
09-04 16:45:31.760: E/AndroidRuntime(4213): at android.view.View$PerformClick.run(View.java:19866)
09-04 16:45:31.760: E/AndroidRuntime(4213): at android.os.Handler.handleCallback(Handler.java:739)
09-04 16:45:31.760: E/AndroidRuntime(4213): at android.os.Handler.dispatchMessage(Handler.java:95)
09-04 16:45:31.760: E/AndroidRuntime(4213): at android.os.Looper.loop(Looper.java:135)
09-04 16:45:31.760: E/AndroidRuntime(4213): at android.app.ActivityThread.main(ActivityThread.java:5254)
09-04 16:45:31.760: E/AndroidRuntime(4213): at java.lang.reflect.Method.invoke(Native Method)
09-04 16:45:31.760: E/AndroidRuntime(4213): at java.lang.reflect.Method.invoke(Method.java:372)
09-04 16:45:31.760: E/AndroidRuntime(4213): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
09-04 16:45:31.760: E/AndroidRuntime(4213): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)

这是我对数据库的访问代码

cursor = mydb.getAllRows(gamemanager.hometeam);
cursor.moveToFirst();
startManagingCursor(cursor);
String[] fromfieldnames = new String[]{DatabaseHelper.COL_2, DatabaseHelper.COL_3,
DatabaseHelper.COL_23, DatabaseHelper.COL_24};
int[] toviewids = new int[]{R.id.scorecplayer, R.id.scorecsur, R.id.scorecballs, R.id.scorecruns};
mycursoradaptor = new SimpleCursorAdapter(this, R.layout.scorecardbat,
cursor, fromfieldnames, toviewids);
batting.setAdapter(mycursoradaptor);
totruns.setText(Long.toString(totalruns));
ballComplete = true;
oneballnorun.setVisibility(View.VISIBLE);

请帮忙 :(

M。

编辑: - 添加了数据库脚本的代码
SQLiteDatabase db = this.getWritableDatabase();
// Return all data in database
String where = null;
cursor = db.query(true, teamname, ALL_KEYS, where, null, null, null, null, null);
Log.i("Success2", "Data is accessed");
if (cursor != null){
Log.i("Cursor3", cursor.toString());
cursor.moveToFirst();

}
if(cursor == null){
Log.i("Error!!!", "No Data!");
}
return cursor;

最佳答案

mydb.cursor.close();
Log.i("Success1", "Access Started");
try {
cursor = mydb.getAllRows(gamemanager.hometeam);
}catch (Throwable ex) {
Log.i("Error", "Maybe retrying i dont know");
}
Log.i("Success!4", "Cursor is Active!" );
startManagingCursor(cursor);
Log.i("Success!5", "Cursor is being managed");
String[] fromfieldnames = new String[]{DatabaseHelper.COL_2, DatabaseHelper.COL_3,
DatabaseHelper.COL_23, DatabaseHelper.COL_24};
Log.i("Success6", "Stage1");
int[] toviewids = new int[]{R.id.scorecplayer, R.id.scorecsur, R.id.scorecballs, R.id.scorecruns};
Log.i("Success7", "Stage2");
mycursoradaptor = new SimpleCursorAdapter(this, R.layout.scorecardbat,
cursor, fromfieldnames, toviewids);
Log.i("Success8", "Stage3");
batting.setAdapter(mycursoradaptor);
Log.i("Success9", "Stage4");

关于java - 无法在第 27805 行打开文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32406431/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com