How to prevent Android SQLite from dumping stack trace to logcat?

On Android 2.3.3 I'm doing a bulk import into one of my SQLite tables, using the API method:

SQLiteDatabase.insert(String table, String nullColumnHack, ContentValues values)

It works fine, but if there is a database error with any row (e.g. constraint error) a full stack trace is written to Android Logcat which quickly fills up.

How can I turn off this stack trace?

I already handle any Exception being thrown but the Logcat is being polluted from within the SQLite library code.

I am worried about performance on mobile devices.

  • transactions for import are enabled already
  • preloaded DB is impossible because data might change

Constraints should be enforced and I will handle violation, but 20 line stack traces in Logcat for each violation multiplied by hundreds of violations is what I want to turn off.

Unfortunately I also cannot use advanced conflict handling introduced with Android Froyo because app must also run on older devices.



OK, I just found the solution as follows:

I have to use a different API method (not SQLiteDatabase.insert()):

SQLiteDatabase.insertOrThrow(String table, String nullColumnHack, ContentValues values)

Now, the exception is thrown from the SQLite library, as expected and no stack trace is dumped.

Need Your Help

Dropdown innerHTML not working well in IE?

javascript html

I am populating a drop down with javascript and its working well in every browser except, of course, Internet Explorer (all versions even 8).

Decision matrix in Microsoft Solver Foundation

c# matrix solver ms-solver-foundation msf

I am trying to use the Microsoft Solver Foundation to optimize a problem with a matrix of binary decision variables. Here is the format of my decision matrix:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.