private Map < String , Object > parseInsertIntoQuery ( String query ) { Map < String , Object > persistDetails = new HashMap < String , Object > ( ) ; String insertReg = "(?i)^insert\\s+into\\s+(\\S+)\\s+(?:as\\s+(\\S+)\\s+)?FROM\\s+\\((.*)\\)$" ; Pattern r = Pattern . compile ( insertReg ) ; Matcher m = r . matcher ( query ) ; if ( m . find ( ) ) { try { parsePersistClause ( m . group ( 1 ) , persistDetails ) ; persistDetails . put ( "format" , m . group ( 2 ) ) ; persistDetails . put ( "fetchQuery" , m . group ( 3 ) ) ; } catch ( Exception e ) { throw new KunderaException ( "Invalid Query" ) ; } } else { throw new KunderaException ( "Invalid Query" ) ; } return persistDetails ; }
Parses the insert into query .