question: public int addJSON ( JSONObject j , Table table ) { if ( ! mDb . belowMemThreshold ( ) ) { Log . e ( LOGTAG , "There is not enough space left on the device to store events, so data was discarded" ) ; return DB_OUT_OF_MEMORY_ERROR ; } final String tableName = table . getName ( ) ; Cursor c = null ; int count = DB_UPDATE_ERROR ; synchronized ( mDb ) { try { final SQLiteDatabase db = mDb . getWritableDatabase ( ) ; final ContentValues cv = new ContentValues ( ) ; cv . put ( KEY_DATA , j . toString ( ) ) ; cv . put ( KEY_CREATED_AT , System . currentTimeMillis ( ) ) ; db . insert ( tableName , null , cv ) ; c = db . rawQuery ( "SELECT COUNT(*) FROM " + tableName , null ) ; c . moveToFirst ( ) ; count = c . getInt ( 0 ) ; } catch ( final SQLiteException e ) { Log . e ( LOGTAG , "Could not add data to table " + tableName + ". Re-initializing database." , e ) ; if ( c != null ) { c . close ( ) ; c = null ; } initDB ( ) ; } catch ( final IllegalStateException e ) { Log . e ( LOGTAG , "Could not add data to table " + tableName + ". Re-initializing database." , e ) ; if ( c != null ) { c . close ( ) ; c = null ; } initDB ( ) ; } finally { if ( c != null ) { c . close ( ) ; } mDb . close ( ) ; } } return count ; }
target:  Adds a JSON string representing an event with properties or a person record to the SQLiteDatabase.