/** * Takes a SQL string representing a Command and returns the object * representation. * @param sql SQL string * instead of string litral * @return SQL object representation * @throws QueryParserException if parsing fails * @throws IllegalArgumentException if sql is null */ public Command parseCommand(String sql) throws QueryParserException { return parseCommand(sql, new ParseInfo()); }
public static ParseInfo createParseInfo(RequestMessage requestMsg, SessionMetadata sessionMetadata) { ParseInfo parseInfo = new ParseInfo(); parseInfo.ansiQuotedIdentifiers = requestMsg.isAnsiQuotedIdentifiers(); Object value = sessionMetadata.getSessionVariables().get("backslashDefaultMatchEscape"); //$NON-NLS-1$ try { if (value != null && Boolean.TRUE.equals(DataTypeManager.transformValue(value, DataTypeManager.DefaultDataClasses.BOOLEAN))) { parseInfo.setBackslashDefaultMatchEscape(true); } } catch (TransformationException e) { } return parseInfo; }
/** * Check if this is a valid string literal * @param id Possible string literal */ boolean isStringLiteral(String str, ParseInfo info) { if (info.useAnsiQuotedIdentifiers() || str.charAt(0) != '"' || str.charAt(str.length() - 1) != '"') { return false; } int index = 1; while (index < str.length() - 1) { index = str.indexOf('"', index); if (index == -1 || index + 1 == str.length()) { return true; } if (str.charAt(index + 1) != '"') { return false; } index += 2; } return true; }
if(esc == null && ((value instanceof Constant && t.image != null && t.image.startsWith("E'")) || info.isBackslashDefaultMatchEscape())) { esc = '\u005c\u005c';
if(esc == null && ((value instanceof Constant && t.image != null && t.image.startsWith("E'")) || info.isBackslashDefaultMatchEscape())) { esc = '\u005c\u005c';
/** * Takes a SQL string representing a Command and returns the object * representation. * @param sql SQL string * instead of string litral * @return SQL object representation * @throws QueryParserException if parsing fails * @throws IllegalArgumentException if sql is null */ public Command parseCommand(String sql) throws QueryParserException { return parseCommand(sql, new ParseInfo()); }
public static ParseInfo createParseInfo(RequestMessage requestMsg, SessionMetadata sessionMetadata) { ParseInfo parseInfo = new ParseInfo(); parseInfo.ansiQuotedIdentifiers = requestMsg.isAnsiQuotedIdentifiers(); Object value = sessionMetadata.getSessionVariables().get("backslashDefaultMatchEscape"); //$NON-NLS-1$ try { if (value != null && Boolean.TRUE.equals(DataTypeManager.transformValue(value, DataTypeManager.DefaultDataClasses.BOOLEAN))) { parseInfo.setBackslashDefaultMatchEscape(true); } } catch (TransformationException e) { } return parseInfo; }
/** * Check if this is a valid string literal * @param id Possible string literal */ boolean isStringLiteral(String str, ParseInfo info) { if (info.useAnsiQuotedIdentifiers() || str.charAt(0) != '"' || str.charAt(str.length() - 1) != '"') { return false; } int index = 1; while (index < str.length() - 1) { index = str.indexOf('"', index); if (index == -1 || index + 1 == str.length()) { return true; } if (str.charAt(index + 1) != '"') { return false; } index += 2; } return true; }
if(esc == null && ((value instanceof Constant && t.image != null && t.image.startsWith("E'")) || info.isBackslashDefaultMatchEscape())) { esc = '\u005c\u005c';
/** * Takes a SQL string representing a Command and returns the object * representation. * @param sql SQL string * instead of string litral * @return SQL object representation * @throws QueryParserException if parsing fails * @throws IllegalArgumentException if sql is null */ public Command parseCommand(String sql) throws QueryParserException { return parseCommand(sql, new ParseInfo()); }
public static ParseInfo createParseInfo(RequestMessage requestMsg, SessionMetadata sessionMetadata) { ParseInfo parseInfo = new ParseInfo(); parseInfo.ansiQuotedIdentifiers = requestMsg.isAnsiQuotedIdentifiers(); Object value = sessionMetadata.getSessionVariables().get("backslashDefaultMatchEscape"); //$NON-NLS-1$ try { if (value != null && Boolean.TRUE.equals(DataTypeManager.transformValue(value, DataTypeManager.DefaultDataClasses.BOOLEAN))) { parseInfo.setBackslashDefaultMatchEscape(true); } } catch (TransformationException e) { } return parseInfo; }
/** * Check if this is a valid string literal * @param id Possible string literal */ boolean isStringLiteral(String str, ParseInfo info) { if (info.useAnsiQuotedIdentifiers() || str.charAt(0) != '"' || str.charAt(str.length() - 1) != '"') { return false; } int index = 1; while (index < str.length() - 1) { index = str.indexOf('"', index); if (index == -1 || index + 1 == str.length()) { return true; } if (str.charAt(index + 1) != '"') { return false; } index += 2; } return true; }
public Command parseDesignerCommand(String sql) throws QueryParserException { return parseCommand(sql, new ParseInfo(), true); }
public Command parseDesignerCommand(String sql) throws QueryParserException { return parseCommand(sql, new ParseInfo(), true); }
public Command parseDesignerCommand(String sql) throws QueryParserException { return parseCommand(sql, new ParseInfo(), true); }
public void putPlan(String key, PreparedPlan plan, Determinism determinismLevel) { if (this.globalState.planCache == null) { return; } CacheID id = new CacheID(new ParseInfo(), key, getVdbName(), getVdbVersion(), getConnectionId(), getUserName()); this.globalState.planCache.put(id, determinismLevel, plan, null); }
public void putPlan(String key, PreparedPlan plan, Determinism determinismLevel) { if (this.globalState.planCache == null) { return; } CacheID id = new CacheID(new ParseInfo(), key, getVdbName(), getVdbVersion(), getConnectionId(), getUserName()); this.globalState.planCache.put(id, determinismLevel, plan, null); }
public void putPlan(String key, PreparedPlan plan, Determinism determinismLevel) { if (this.globalState.planCache == null) { return; } CacheID id = new CacheID(new ParseInfo(), key, getVdbName(), getVdbVersion(), getConnectionId(), getUserName()); this.globalState.planCache.put(id, determinismLevel, plan, null); }
static void helpTest(String sql, String expectedString, Command expectedCommand) { helpTest(sql, expectedString, expectedCommand, new ParseInfo()); } static void helpTest(String sql, String expectedString, Command expectedCommand, ParseInfo info) {
public Expression parseSelectExpression(String sql) throws QueryParserException { if(sql == null) { throw new IllegalArgumentException(QueryPlugin.Util.getString("QueryParser.nullSqlExpr")); //$NON-NLS-1$ } ParseInfo dummyInfo = new ParseInfo(); Expression result = null; try{ result = getSqlParser(sql).selectExpression(dummyInfo); } catch(ParseException pe) { throw convertParserException(pe); } finally { tm.reinit(); } return result; }