File tree Expand file tree Collapse file tree
debug-db/src/main/java/com/amitshekhar/server Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -236,13 +236,25 @@ private String executeQueryAndGetResponse(String route) {
236236 }
237237
238238 if (query != null ) {
239- first = query .split (" " )[0 ].toLowerCase ();
240- if (first .equals ("select" ) || first .equals ("pragma" )) {
241- TableDataResponse response = DatabaseHelper .getTableData (mDatabase , query , null );
242- data = mGson .toJson (response );
243- } else {
244- TableDataResponse response = DatabaseHelper .exec (mDatabase , query );
245- data = mGson .toJson (response );
239+ String [] statements = query .split (";" );
240+
241+ for (int i =0 ; i <statements .length ; i ++) {
242+
243+ String aQuery = statements [i ].trim ();
244+ first = aQuery .split (" " )[0 ].toLowerCase ();
245+ if (first .equals ("select" ) || first .equals ("pragma" )) {
246+ TableDataResponse response = DatabaseHelper .getTableData (mDatabase , aQuery , null );
247+ data = mGson .toJson (response );
248+ if (!response .isSuccessful ) {
249+ break ;
250+ }
251+ } else {
252+ TableDataResponse response = DatabaseHelper .exec (mDatabase , aQuery );
253+ data = mGson .toJson (response );
254+ if (!response .isSuccessful ) {
255+ break ;
256+ }
257+ }
246258 }
247259 }
248260 } catch (Exception e ) {
You can’t perform that action at this time.
0 commit comments