0

I started using sqlCipher for Android (ver) 2.1.1 and it works like charm on Android 4.0.3. However I found that the SQLiteOpenHelper class does not have the constructor that takes the custom Error handler. This is very much there in the original SQLiteOpenHelper class provided in android.database and it is very useful to handle the errors in an app specific manner. Does anyone know how to incorporate a custom error handler when using sqlCipher?

Constructors available in android.database.sqlite

public SQLiteOpenHelper (Context context, String name, SQLiteDatabase.CursorFactory factory, int version);
public SQLiteOpenHelper (Context context, String name, SQLiteDatabase.CursorFactory factory, int version, DatabaseErrorHandler errorHandler);

Constructors available in net.sqlcipher.database

public SQLiteOpenHelper (Context context, String name, SQLiteDatabase.CursorFactory factory, int version);

In specific, when encountered with certain types of errors the default error handler (when using sqlcipher) is removing the database, albeit after providing a Log.e message. But I need to avoid it. Any help is appreciated.

AndroidLearner
  • 4,500
  • 4
  • 31
  • 62
RgPm2011
  • 63
  • 4

1 Answers1

0

Custom database error handlers are more recent additions to the android.database package. The SQLCipher packages are based on an older API (level 7), and thus don't include this feature. We'll try to take a closer look at this and see if there is something we can do to address the issue without affecting backward compatibility.

Stephen Lombardo
  • 1,503
  • 8
  • 7
  • Thanks Stephen. Any quick solution is appreciated – RgPm2011 Jan 05 '13 at 11:27
  • Cross post from mailing list: We did a bit more research into this over the past week. Unfortunately it doesn't look like this would be a very simple change. We're still committed to supporting API Level 7 and the changes required to implement the new functionality while preserving backwards compatibi lity would be relatively complex. As a result, while we agree that the provider's behavior of deleting corrupt databases is undesirable, we may not have a short-term fix for this. We'll continue to look into it as time permits, but I at least wanted to let you know where things stand today. – Stephen Lombardo Jan 09 '13 at 04:01
  • Thanks again for the prompt response. Is there a package for using cipher on Android 4.0.3 and API-15, if ver2.1.1 is for API-7? – RgPm2011 Jan 14 '13 at 15:32
  • This issue is resolved as per check in by Chris at https://github.com/sqlcipher/android-database-sqlcipher/pull/84. I think it is merged into main stream now. – RgPm2011 Jan 27 '13 at 17:28