Statement getCachedStatement ( String keyPrefix , String sql ) { String key = keyPrefix + sql ; Statement candidate = m_previousCatalogStmts . get ( key ) ; if ( candidate == null ) { ++ m_stmtCacheMisses ; return null ; } // check that no underlying tables have been modified since the proc had been compiled String [ ] tablesTouched = candidate . getTablesread ( ) . split ( "," ) ; for ( String tableName : tablesTouched ) { if ( isDirtyTable ( tableName ) ) { ++ m_stmtCacheMisses ; return null ; } } tablesTouched = candidate . getTablesupdated ( ) . split ( "," ) ; for ( String tableName : tablesTouched ) { if ( isDirtyTable ( tableName ) ) { ++ m_stmtCacheMisses ; return null ; } } ++ m_stmtCacheHits ; // easy debugging stmt //printStmtCacheStats(); return candidate ; }
Look for a match from the previous catalog that matches the key + sql