/** * Returns the IQueryTokenizer implementation to use for tokenizing scripts * statements that should be sent to the server. If the tokenizer hasn't * been initialized yet, then a default one will be created. If a cutom * tokenizer has been installed, this will just return that one, in lieu of * the default one. * * @return an implementation of IQueryTokenizer */ public IQueryTokenizer getQueryTokenizer() { if (tokenizer == null || !customTokenizerInstalled) { // No tokenizer has been set by any installed plugin. Go ahead and // give the default tokenizer. It is important to not cache this // object so that session property changes to the current session // are reflected in this default tokenizer. tokenizer = new QueryTokenizer(_props.getSQLStatementSeparator(), _props.getStartOfLineComment(), _props.getRemoveMultiLineComment()); } return tokenizer; }
/** * Returns the IQueryTokenizer implementation to use for tokenizing scripts * statements that should be sent to the server. If the tokenizer hasn't * been initialized yet, then a default one will be created. If a cutom * tokenizer has been installed, this will just return that one, in lieu of * the default one. * * @return an implementation of IQueryTokenizer */ public IQueryTokenizer getQueryTokenizer() { if (tokenizer == null || !customTokenizerInstalled) { // No tokenizer has been set by any installed plugin. Go ahead and // give the default tokenizer. It is important to not cache this // object so that session property changes to the current session // are reflected in this default tokenizer. tokenizer = new QueryTokenizer(_props.getSQLStatementSeparator(), _props.getStartOfLineComment(), _props.getRemoveMultiLineComment()); } return tokenizer; }
private void onRunHQL() { if (false == _runHQL.isEnabled()) { return; } String hql = _hqlEntryPanelManager.getEntryPanel().getSQLToBeExecuted(); if (null == hql || 0 == hql.trim().length()) { return; } final IQueryTokenizer queryTokenizer = _sess.getQueryTokenizer(); final String statementSeparator = queryTokenizer.getSQLStatementSeparator(); final String startOfLineComment = queryTokenizer.getLineCommentBegin(); QueryTokenizer qt = new QueryTokenizer(statementSeparator, startOfLineComment, true); qt.setScriptToTokenize(hql); while (qt.hasQuery()) { String hqlQuery = qt.nextQuery(); _hibernateTabController.displayObjects(_con, hqlQuery); } }