return parseCommand(sql, new ParseInfo(), true);
}
public Command parseCommand(String sql, ParseInfo parseInfo, boolean designerCommands) throws QueryParserException {
if(sql == null || sql.length() == 0) {
throw new QueryParserException(QueryPlugin.Util.getString("QueryParser.emptysql")); //$NON-NLS-1$
}
Command result = null;
try{
if (designerCommands) {
result = getSqlParser(sql).designerCommand(parseInfo);
} else {
result = getSqlParser(sql).command(parseInfo);
}
result.setCacheHint(SQLParserUtil.getQueryCacheOption(sql));
} catch(ParseException pe) {
if(sql.startsWith(XML_OPEN_BRACKET) || sql.startsWith(XQUERY_DECLARE)) {
throw new QueryParserException(pe, QueryPlugin.Util.getString("QueryParser.xqueryCompilation", sql)); //$NON-NLS-1$
}
throw convertParserException(pe);
} catch(TokenMgrError tme) {
if(sql.startsWith(XML_OPEN_BRACKET) || sql.startsWith(XQUERY_DECLARE)) {
throw new QueryParserException(tme, QueryPlugin.Util.getString("QueryParser.xqueryCompilation", sql)); //$NON-NLS-1$
}
throw handleTokenMgrError(tme);
}
return result;
}