void handleQuotesInCommands(String line, BitSet quoteBitSet,
      BitSet doubleQuoteBitSet) {
    int doubleQuoteStart = -1;
    int quoteStart = -1;
    for (int pos = 0; pos < line.length(); pos++) {
      char ch = line.charAt(pos);
      if (doubleQuoteStart > -1) {
        doubleQuoteBitSet.set(pos);
        if (ch == '"') {
          doubleQuoteStart = -1;
        }
        continue;
      } else if (quoteStart > -1) {
        quoteBitSet.set(pos);
        if (ch == '\'') {
          quoteStart = -1;
        }
        continue;
      }
      // so far doubleQuoteBitSet MUST BE -1 and quoteStart MUST BE -1
      if (ch == '"') {
        doubleQuoteBitSet.set(pos);
        doubleQuoteStart = pos;
      }

      // so far quoteStart MUST BE -1
      if (doubleQuoteStart == -1 && ch == '\'') {
        quoteBitSet.set(pos);
        quoteStart = pos;
      }
    }
  }
void handleQuotesInCommands ( String line , BitSet quoteBitSet , BitSet doubleQuoteBitSet ) { int doubleQuoteStart = - 1 ; int quoteStart = - 1 ; for ( int pos = 0 ; pos < line . length ( ) ; pos ++ ) { char ch = line . charAt ( pos ) ; if ( doubleQuoteStart > - 1 ) { doubleQuoteBitSet . set ( pos ) ; if ( ch == '"' ) { doubleQuoteStart = - 1 ; } continue ; } else if ( quoteStart > - 1 ) { quoteBitSet . set ( pos ) ; if ( ch == '\'' ) { quoteStart = - 1 ; } continue ; } if ( ch == '"' ) { doubleQuoteBitSet . set ( pos ) ; doubleQuoteStart = pos ; } if ( doubleQuoteStart == - 1 && ch == '\'' ) { quoteBitSet . set ( pos ) ; quoteStart = pos ; } } }
Marks single/double quoted string position
in sqlline command based on input.

<p>Assumes that the input is a sqlline command but not SQL itself.

@param line              line with sqlline command where to handle
single/double quoted string
@param quoteBitSet       BitSet to use for positions of single-quoted lines
@param doubleQuoteBitSet BitSet to use for positions of double-quoted lines

<p>For example,

<blockquote><code>handleQuotesInCommands("!set csvDelimiter '"'",
quoteBitSet, doubleQuoteBitSet);</code></blockquote>

<p>should mark a single-quoted string only. as a double-quote is
inside the quoted line.