public JSONObject getAudioMediaFromPlaceId ( String place_id ) throws Exception { List < SelectedColumn > selectFields = new Vector < SelectedColumn > ( ) ; selectFields . add ( new SelectedColumn ( SelectedColumn . Type . INTEGER , "id" ) ) ; selectFields . add ( new SelectedColumn ( SelectedColumn . Type . INTEGER , "place_id" ) ) ; selectFields . add ( new SelectedColumn ( SelectedColumn . Type . STRING , "filename" ) ) ; selectFields . add ( new SelectedColumn ( SelectedColumn . Type . STRING , "mimetype" ) ) ; selectFields . add ( new SelectedColumn ( SelectedColumn . Type . STRING , "title" ) ) ; PreparedStatement stmt = connection . prepareStatement ( "SELECT id,place_id,filename,mimetype,title " + "FROM contributions " + "WHERE mimetype LIKE 'audio/%' AND place_id = ?;" ) ; stmt . setInt ( 1 , Integer . parseInt ( place_id ) ) ; JSONArray array = executeStatementToJson ( stmt , selectFields ) ; JSONObject result = new JSONObject ( ) ; result . put ( "media" , array ) ; return result ; }
Finds and returns all audio media associated with a place id .