public static QueryType getQueryType ( String query ) { final String trimmedQuery = removeCommentAndWhiteSpace ( query ) ; if ( trimmedQuery == null || trimmedQuery . length ( ) < 1 ) { return QueryType . OTHER ; } final char firstChar = trimmedQuery . charAt ( 0 ) ; final QueryType type ; switch ( firstChar ) { case ' ' : case ' ' : type = QueryType . SELECT ; break ; case ' ' : case ' ' : type = QueryType . INSERT ; break ; case ' ' : case ' ' : type = QueryType . UPDATE ; break ; case ' ' : case ' ' : type = QueryType . DELETE ; break ; default : type = QueryType . OTHER ; } return type ; }
Returns type of query from given query string .