question: private JSONObject executeSqlStatementQuery ( SQLiteDatabase mydb , String query , JSONArray paramsAsJson , CallbackContext cbc ) throws Exception { JSONObject rowsResult = new JSONObject ( ) ; Cursor cur ; try { String [ ] params ; params = new String [ paramsAsJson . length ( ) ] ; for ( int j = 0 ; j < paramsAsJson . length ( ) ; j ++ ) { if ( paramsAsJson . isNull ( j ) ) params [ j ] = "" ; else params [ j ] = paramsAsJson . getString ( j ) ; } cur = mydb . rawQuery ( query , params ) ; } catch ( Exception ex ) { ex . printStackTrace ( ) ; String errorMessage = ex . getMessage ( ) ; Log . v ( "executeSqlBatch" , "SQLitePlugin.executeSql[Batch](): Error=" + errorMessage ) ; throw ex ; } if ( cur != null && cur . moveToFirst ( ) ) { JSONArray rowsArrayResult = new SQLiteArray ( cur . getCount ( ) ) ; String key ; int colCount = cur . getColumnCount ( ) ; do { JSONObject row = new SQLiteObject ( colCount ) ; try { for ( int i = 0 ; i < colCount ; ++ i ) { key = cur . getColumnName ( i ) ; if ( android . os . Build . VERSION . SDK_INT >= 11 ) { try { bindPostHoneycomb ( row , key , cur , i ) ; } catch ( Exception ex ) { bindPreHoneycomb ( row , key , cur , i ) ; } } else { bindPreHoneycomb ( row , key , cur , i ) ; } } rowsArrayResult . put ( row ) ; } catch ( JSONException e ) { e . printStackTrace ( ) ; } } while ( cur . moveToNext ( ) ) ; try { rowsResult . put ( "rows" , rowsArrayResult ) ; } catch ( JSONException e ) { e . printStackTrace ( ) ; } } if ( cur != null ) { cur . close ( ) ; } return rowsResult ; }
target:  Execute Sql Statement Query