티스토리 뷰
프로그래밍
android.database.sqlite.SQLiteException: bind or column index out of range
앙망 2011. 6. 15. 17:5406-15 08:51:42.292: ERROR/AndroidRuntime(11019): Caused by: android.database.sqlite.SQLiteException: bind or column index out of range: handle 0x249200 06-15 08:51:42.292: ERROR/AndroidRuntime(11019): at android.database.sqlite.SQLiteProgram.native_bind_string(Native Method) 06-15 08:51:42.292: ERROR/AndroidRuntime(11019): at android.database.sqlite.SQLiteProgram.bindString(SQLiteProgram.java:244) 06-15 08:51:42.292: ERROR/AndroidRuntime(11019): at android.database.sqlite.SQLiteQuery.bindString(SQLiteQuery.java:185) 06-15 08:51:42.292: ERROR/AndroidRuntime(11019): at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:48) 06-15 08:51:42.292: ERROR/AndroidRuntime(11019): at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1356) 06-15 08:51:42.292: ERROR/AndroidRuntime(11019): at android.database.sqlite.SQLiteDatabase.rawQuery(SQLiteDatabase.java:1324) 06-15 08:51:42.292: ERROR/AndroidRuntime(11019): at com.angmang.prj01.database.ScheduleDBHelper.getScheduleInfo(ScheduleDBHelper.java:89) 06-15 08:51:42.292: ERROR/AndroidRuntime(11019): at com.angmang.prj01.activity.ScheduleListActivity.onCreate(ScheduleListActivity.java:43) 06-15 08:51:42.292: ERROR/AndroidRuntime(11019): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 06-15 08:51:42.292: ERROR/AndroidRuntime(11019): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
원인은 잘못된 쿼리문... where 절에서 ? 를 '?' 로 표시했었다. public Cursor rawQuery (String sql, String[] selectionArgs) 를 사용할 때 sql 는 반드시 ; 로 끝나야 한다. 그리고 where 절에 사용하는 ? 의 개수와 selectionArgs의 크기가 동일해야 한다.
댓글