[android-developers] Re: Please Help me! I have SQLiteDatabaseCorruption Error
nope, I can check which file read in which order by logs. They are in order. if they were not in order, it would not work in any phone. On Thursday, March 22, 2012 8:35:58 PM UTC+2, Nadeem Hasan wrote: > > How are you ensuring that they are being reassembled in the same order? > From the code, it looks like you just get a list of all the files in the > assets directory and concatenate them in the order they were returned by > the API. This order may or may not be the same as the natural order of > these files. This probably explains why it works sometimes but not always. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Please Help me! I have SQLiteDatabaseCorruption Error
so what would you suggest? I checked if all bytes of db copied, and yes it copies all of it. what should I do now? how can I load my prefilled 5MB database? On Tuesday, March 13, 2012 11:30:11 AM UTC+2, Zsolt Vasvari wrote: > > I would very strongly advise you against doing this. There is > no guarantee that the binary database file will be compatible across > Android version and much less across all custom ROMs. > > On Tuesday, March 13, 2012 6:00:16 AM UTC+8, Halil Enver Soylu wrote: >> >> I have a 5MB database. I split it into <1MB chuck files. >> application merges these files and creates its database. >> >> However it works in some Android phones, and does not works in others. I >> tried almost dozen of code example in blogs. everytime I got same result. >> App's platform vers. is 1.5 so it is not about platform vers. >> >> According to logs of phones that application crushs, app creates copies >> db file from Assets to database. then when it attempts to get a query for >> the first time, it crushs and gives that error: >> >> 03-11 01:11:34.111 I/Database( 4516): sqlite returned: error code = 11, msg >> = database corruption at line 46886 of [42537b6056] >> 03-11 01:11:34.111 I/Database( 4516): sqlite returned: error code = 11, msg >> = database disk image is malformed >> 03-11 01:11:34.111 D/AndroidRuntime( 4516): Shutting down VM >> 03-11 01:11:34.111 W/dalvikvm( 4516): threadid=1: thread exiting with >> uncaught exception (group=0x40018560) >> 03-11 01:11:34.111 E/AndroidRuntime( 4516): FATAL EXCEPTION: main >> 03-11 01:11:34.111 E/AndroidRuntime( 4516): >> android.database.sqlite.SQLiteDatabaseCorruptException: database disk >> image is malformed: , while compiling: SELECT Names FROM MYTABLE WHERE >> SayfaNo = 1 >> >> >> and here is my codes that copies asset files into database >> >> >> String[] dbFiles = myContext.getAssets().list(ASSETS_DB_FOLDER); >> OutputStream myOutput = new FileOutputStream(DB_PATH+DB_NAME); >> for(int i =0; i < dbFiles.length; i++) >> { >> Log.i("FFLOG","COPYDB:"+dbFiles[i]); >> InputStream myInput = >> myContext.getAssets().open(ASSETS_DB_FOLDER+"/"+dbFiles[i]); >> byte[] buffer = new byte[1024]; >> int length; >> while ((length = myInput.read(buffer)) > 0) { >> myOutput.write(buffer, 0, length); >> } >> myInput.close(); >> } >> myOutput.flush(); >> myOutput.close(); >> >> please help me >> if there were a problem about database file or query SQL code, it would >> not work in some phones. So, it is not about db file or query. I am looking >> for a solution for 2 weeks please help me >> > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Please Help me! I have SQLiteDatabaseCorruption Error
so what would you suggest? I checked if all bytes of db copied, any yes it copies all of it. what should I do now? how can I load my prefilled 5MB database? On Tuesday, March 13, 2012 11:30:11 AM UTC+2, Zsolt Vasvari wrote: > > I would very strongly advise you against doing this. There is > no guarantee that the binary database file will be compatible across > Android version and much less across all custom ROMs. > > On Tuesday, March 13, 2012 6:00:16 AM UTC+8, Halil Enver Soylu wrote: >> >> I have a 5MB database. I split it into <1MB chuck files. >> application merges these files and creates its database. >> >> However it works in some Android phones, and does not works in others. I >> tried almost dozen of code example in blogs. everytime I got same result. >> App's platform vers. is 1.5 so it is not about platform vers. >> >> According to logs of phones that application crushs, app creates copies >> db file from Assets to database. then when it attempts to get a query for >> the first time, it crushs and gives that error: >> >> 03-11 01:11:34.111 I/Database( 4516): sqlite returned: error code = 11, msg >> = database corruption at line 46886 of [42537b6056] >> 03-11 01:11:34.111 I/Database( 4516): sqlite returned: error code = 11, msg >> = database disk image is malformed >> 03-11 01:11:34.111 D/AndroidRuntime( 4516): Shutting down VM >> 03-11 01:11:34.111 W/dalvikvm( 4516): threadid=1: thread exiting with >> uncaught exception (group=0x40018560) >> 03-11 01:11:34.111 E/AndroidRuntime( 4516): FATAL EXCEPTION: main >> 03-11 01:11:34.111 E/AndroidRuntime( 4516): >> android.database.sqlite.SQLiteDatabaseCorruptException: database disk >> image is malformed: , while compiling: SELECT Names FROM MYTABLE WHERE >> SayfaNo = 1 >> >> >> and here is my codes that copies asset files into database >> >> >> String[] dbFiles = myContext.getAssets().list(ASSETS_DB_FOLDER); >> OutputStream myOutput = new FileOutputStream(DB_PATH+DB_NAME); >> for(int i =0; i < dbFiles.length; i++) >> { >> Log.i("FFLOG","COPYDB:"+dbFiles[i]); >> InputStream myInput = >> myContext.getAssets().open(ASSETS_DB_FOLDER+"/"+dbFiles[i]); >> byte[] buffer = new byte[1024]; >> int length; >> while ((length = myInput.read(buffer)) > 0) { >> myOutput.write(buffer, 0, length); >> } >> myInput.close(); >> } >> myOutput.flush(); >> myOutput.close(); >> >> please help me >> if there were a problem about database file or query SQL code, it would >> not work in some phones. So, it is not about db file or query. I am looking >> for a solution for 2 weeks please help me >> > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Please Help me! I have SQLiteDatabaseCorruption Error
I have a 5MB database. I split it into <1MB chuck files. application merges these files and creates its database. However it works in some Android phones, and does not works in others. I tried almost dozen of code example in blogs. everytime I got same result. App's platform vers. is 1.5 so it is not about platform vers. According to logs of phones that application crushs, app creates copies db file from Assets to database. then when it attempts to get a query for the first time, it crushs and gives that error: 03-11 01:11:34.111 I/Database( 4516): sqlite returned: error code = 11, msg = database corruption at line 46886 of [42537b6056] 03-11 01:11:34.111 I/Database( 4516): sqlite returned: error code = 11, msg = database disk image is malformed 03-11 01:11:34.111 D/AndroidRuntime( 4516): Shutting down VM 03-11 01:11:34.111 W/dalvikvm( 4516): threadid=1: thread exiting with uncaught exception (group=0x40018560) 03-11 01:11:34.111 E/AndroidRuntime( 4516): FATAL EXCEPTION: main 03-11 01:11:34.111 E/AndroidRuntime( 4516): android.database.sqlite.SQLiteDatabaseCorruptException: database disk image is malformed: , while compiling: SELECT Names FROM MYTABLE WHERE SayfaNo = 1 and here is my codes that copies asset files into database String[] dbFiles = myContext.getAssets().list(ASSETS_DB_FOLDER); OutputStream myOutput = new FileOutputStream(DB_PATH+DB_NAME); for(int i =0; i < dbFiles.length; i++) { Log.i("FFLOG","COPYDB:"+dbFiles[i]); InputStream myInput = myContext.getAssets().open(ASSETS_DB_FOLDER+"/"+dbFiles[i]); byte[] buffer = new byte[1024]; int length; while ((length = myInput.read(buffer)) > 0) { myOutput.write(buffer, 0, length); } myInput.close(); } myOutput.flush(); myOutput.close(); please help me if there were a problem about database file or query SQL code, it would not work in some phones. So, it is not about db file or query. I am looking for a solution for 2 weeks please help me -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en