public PreparedStatement getPreparedQuery ( String tableName , Query query ) { synchronized ( m_prepQueryMap ) { Map < Query , PreparedStatement > statementMap = m_prepQueryMap . get ( tableName ) ; if ( statementMap == null ) { statementMap = new HashMap <> ( ) ; m_prepQueryMap . put ( tableName , statementMap ) ; } PreparedStatement prepState = statementMap . get ( query ) ; if ( prepState == null ) { prepState = prepareQuery ( tableName , query ) ; statementMap . put ( query , prepState ) ; } return prepState ; } }
Get the given prepared statement for the given table and query . Upon first invocation for a given combo the query is parsed and cached .