public SqlStatement parse ( String sql ) { // does a cached parse result exist for this statement? if ( _cachedSqlStatements . containsKey ( sql ) ) { return _cachedSqlStatements . get ( sql ) ; } SqlGrammar _parser = new SqlGrammar ( new StringReader ( sql ) ) ; SqlStatement parsed = null ; try { parsed = _parser . parse ( ) ; } catch ( ParseException e ) { throw new ControlException ( "Error parsing SQL statment." + e . getMessage ( ) , e ) ; } catch ( TokenMgrError tme ) { throw new ControlException ( "Error parsing SQL statment. " + tme . getMessage ( ) , tme ) ; } if ( parsed . isCacheable ( ) ) { _cachedSqlStatements . put ( sql , parsed ) ; } return parsed ; }
Parse the sql and return an SqlStatement .