@Test public void testUnterminatedEscape() throws Exception { assertEquals("{oj ", Parser.replaceProcessing("{oj ", true, false)); }
public static String replaceProcessing(String sql, boolean replaceProcessingEnabled, boolean standardConformingStrings) throws SQLException { if (replaceProcessingEnabled) { int len = sql.length(); char[] chars = sql.toCharArray(); StringBuilder newsql = new StringBuilder(len); int i = 0; while (i < len) { i = parseSql(chars, i, newsql, false, standardConformingStrings); if (i < len) { newsql.append(chars[i]); i++; } } return newsql.toString(); } else { return sql; } }
Parser { public static String replaceProcessing(String sql, boolean replaceProcessingEnabled, boolean standardConformingStrings) throws SQLException { if (replaceProcessingEnabled) { int len = sql.length(); char[] chars = sql.toCharArray(); StringBuilder newsql = new StringBuilder(len); int i = 0; while (i < len) { i = parseSql(chars, i, newsql, false, standardConformingStrings); if (i < len) { newsql.append(chars[i]); i++; } } return newsql.toString(); } else { return sql; } } }
Parser { public static String replaceProcessing(String sql, boolean replaceProcessingEnabled, boolean standardConformingStrings) throws SQLException { if (replaceProcessingEnabled) { int len = sql.length(); char[] chars = sql.toCharArray(); StringBuilder newsql = new StringBuilder(len); int i = 0; while (i < len) { i = parseSql(chars, i, newsql, false, standardConformingStrings); if (i < len) { newsql.append(chars[i]); i++; } } return newsql.toString(); } else { return sql; } }  }
Parser { public static String replaceProcessing(String sql, boolean replaceProcessingEnabled, boolean standardConformingStrings) throws SQLException { if (replaceProcessingEnabled) { int len = sql.length(); char[] chars = sql.toCharArray(); StringBuilder newsql = new StringBuilder(len); int i = 0; while (i < len) { i = parseSql(chars, i, newsql, false, standardConformingStrings); if (i < len) { newsql.append(chars[i]); i++; } } return newsql.toString(); } else { return sql; } }  static List<NativeQuery> parseJdbcSql(String query, boolean standardConformingStrings,
      boolean withParameters, boolean splitStatements,
      boolean isBatchedReWriteConfigured,
      String... returningColumnNames); static int parseSingleQuotes(final char[] query, int offset,
      boolean standardConformingStrings); static int parseDoubleQuotes(final char[] query, int offset); static int parseDollarQuotes(final char[] query, int offset); static int parseLineComment(final char[] query, int offset); static int parseBlockComment(final char[] query, int offset); static boolean parseDeleteKeyword(final char[] query, int offset); static boolean parseInsertKeyword(final char[] query, int offset); static boolean parseMoveKeyword(final char[] query, int offset); static boolean parseReturningKeyword(final char[] query, int offset); static boolean parseSelectKeyword(final char[] query, int offset); static boolean parseUpdateKeyword(final char[] query, int offset); static boolean parseValuesKeyword(final char[] query, int offset); static long parseLong(String s, int beginIndex, int endIndex); static boolean parseWithKeyword(final char[] query, int offset); static boolean parseAsKeyword(final char[] query, int offset); static boolean isDigitAt(String s, int pos); static int digitAt(String s, int pos); static boolean isSpace(char c); static boolean isOperatorChar(char c); static boolean isIdentifierStartChar(char c); static boolean isIdentifierContChar(char c); static boolean charTerminatesIdentifier(char c); static boolean isDollarQuoteStartChar(char c); static boolean isDollarQuoteContChar(char c); static JdbcCallParseInfo modifyJdbcCall(String jdbcSql, boolean stdStrings,
      int serverVersion, int protocolVersion); static String replaceProcessing(String sql, boolean replaceProcessingEnabled,
      boolean standardConformingStrings); }
Parser { public static String replaceProcessing(String sql, boolean replaceProcessingEnabled, boolean standardConformingStrings) throws SQLException { if (replaceProcessingEnabled) { int len = sql.length(); char[] chars = sql.toCharArray(); StringBuilder newsql = new StringBuilder(len); int i = 0; while (i < len) { i = parseSql(chars, i, newsql, false, standardConformingStrings); if (i < len) { newsql.append(chars[i]); i++; } } return newsql.toString(); } else { return sql; } }  static List<NativeQuery> parseJdbcSql(String query, boolean standardConformingStrings,
      boolean withParameters, boolean splitStatements,
      boolean isBatchedReWriteConfigured,
      String... returningColumnNames); static int parseSingleQuotes(final char[] query, int offset,
      boolean standardConformingStrings); static int parseDoubleQuotes(final char[] query, int offset); static int parseDollarQuotes(final char[] query, int offset); static int parseLineComment(final char[] query, int offset); static int parseBlockComment(final char[] query, int offset); static boolean parseDeleteKeyword(final char[] query, int offset); static boolean parseInsertKeyword(final char[] query, int offset); static boolean parseMoveKeyword(final char[] query, int offset); static boolean parseReturningKeyword(final char[] query, int offset); static boolean parseSelectKeyword(final char[] query, int offset); static boolean parseUpdateKeyword(final char[] query, int offset); static boolean parseValuesKeyword(final char[] query, int offset); static long parseLong(String s, int beginIndex, int endIndex); static boolean parseWithKeyword(final char[] query, int offset); static boolean parseAsKeyword(final char[] query, int offset); static boolean isDigitAt(String s, int pos); static int digitAt(String s, int pos); static boolean isSpace(char c); static boolean isOperatorChar(char c); static boolean isIdentifierStartChar(char c); static boolean isIdentifierContChar(char c); static boolean charTerminatesIdentifier(char c); static boolean isDollarQuoteStartChar(char c); static boolean isDollarQuoteContChar(char c); static JdbcCallParseInfo modifyJdbcCall(String jdbcSql, boolean stdStrings,
      int serverVersion, int protocolVersion); static String replaceProcessing(String sql, boolean replaceProcessingEnabled,
      boolean standardConformingStrings);  }