com.mysql.cj.util

## Class EscapeTokenizer

- java.lang.Object
- - com.mysql.cj.util.EscapeTokenizer

    public class EscapeTokenizer
    extends Object

EscapeTokenizer breaks up an SQL statement into SQL and escape code parts.

### Field Summary

Fields
`private int` `bracesLevel`
`private static char` `CHR_BACKSLASH`
`private static char` `CHR_BEGIN_TOKEN`
`private static char` `CHR_CR`
`private static char` `CHR_DASH`
`private static char` `CHR_DBL_QUOTE`
`private static char` `CHR_END_TOKEN`
`private static char` `CHR_HASH`
`private static char` `CHR_LF`
`private static char` `CHR_SGL_QUOTE`
`private static char` `CHR_SLASH`
`private static char` `CHR_SPACE`
`private static char` `CHR_STAR`
`private static char` `CHR_VARIABLE`
`private boolean` `emittingEscapeCode`
`private boolean` `inQuotes`
`private Lock` `lock`
`private int` `pos`
`private char` `quoteChar`
`private boolean` `sawVariableUse`
`private String` `source`
`private int` `sourceLength`

### Constructor Summary

Constructors
`EscapeTokenizer(String source)` Creates a new EscapeTokenizer object.

### Method Summary

All Methods Instance Methods Concrete Methods
`boolean` `hasMoreTokens()` Does this tokenizer have more tokens available?
`String` `nextToken()` Returns the next token
`boolean` `sawVariableUse()` Returns true if a variable reference was found.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### CHR_BACKSLASH

    private static final char CHR_BACKSLASH

See Also:
  Constant Field Values

#### CHR_SLASH

    private static final char CHR_SLASH

See Also:
  Constant Field Values

#### CHR_SGL_QUOTE

    private static final char CHR_SGL_QUOTE

See Also:
  Constant Field Values

#### CHR_DBL_QUOTE

    private static final char CHR_DBL_QUOTE

See Also:
  Constant Field Values

#### CHR_LF

    private static final char CHR_LF

See Also:
  Constant Field Values

#### CHR_CR

    private static final char CHR_CR

See Also:
  Constant Field Values

#### CHR_DASH

    private static final char CHR_DASH

See Also:
  Constant Field Values

#### CHR_HASH

    private static final char CHR_HASH

See Also:
  Constant Field Values

#### CHR_STAR

    private static final char CHR_STAR

See Also:
  Constant Field Values

#### CHR_BEGIN_TOKEN

    private static final char CHR_BEGIN_TOKEN

See Also:
  Constant Field Values

#### CHR_END_TOKEN

    private static final char CHR_END_TOKEN

See Also:
  Constant Field Values

#### CHR_VARIABLE

    private static final char CHR_VARIABLE

See Also:
  Constant Field Values

#### CHR_SPACE

    private static final char CHR_SPACE

See Also:
  Constant Field Values

#### source

    private String source

#### sourceLength

    private int sourceLength

#### pos

    private int pos

#### emittingEscapeCode

    private boolean emittingEscapeCode

#### sawVariableUse

    private boolean sawVariableUse

#### bracesLevel

    private int bracesLevel

#### inQuotes

    private boolean inQuotes

#### quoteChar

    private char quoteChar

#### lock

    private final Lock lock

### Constructor Detail

#### EscapeTokenizer

    public EscapeTokenizer(String source)

Creates a new EscapeTokenizer object.

Parameters:
  `source` - the string to tokenize

### Method Detail

#### hasMoreTokens

    public boolean hasMoreTokens()

Does this tokenizer have more tokens available?

Returns:
  if this tokenizer has more tokens available

#### nextToken

    public String nextToken()

Returns the next token

Returns:
  the next token.

#### sawVariableUse

    public boolean sawVariableUse()

Returns true if a variable reference was found. Note that this information isn't accurate until finishing to process all tokens from source String. It also can't be used as per token basis.

Returns:
  true if a variable reference was found.

Copyright © 2016, 2026, Oracle and/or its affiliates.