@Override
  public List<SqlScriptStatement> getSqlScriptStatements( String sqlScript ) {
    List<SqlScriptStatement> statements = new ArrayList<>();
    String all = sqlScript;
    int from = 0;
    int to = 0;
    int length = all.length();

    while ( to < length ) {
      char c = all.charAt( to );

      // Skip comment lines...
      //
      while ( all.startsWith( "--", from ) ) {
        int nextLineIndex = all.indexOf( Const.CR, from );
        from = nextLineIndex + Const.CR.length();
        if ( to >= length ) {
          break;
        }
        c = all.charAt( c );
      }
      if ( to >= length ) {
        break;
      }

      // Skip over double quotes...
      //
      if ( c == '"' ) {
        int nextDQuoteIndex = all.indexOf( '"', to + 1 );
        if ( nextDQuoteIndex >= 0 ) {
          to = nextDQuoteIndex + 1;
        }
      }

      // Skip over back-ticks
      if ( c == '`' ) {
        int nextBacktickIndex = all.indexOf( '`', to + 1 );
        if ( nextBacktickIndex >= 0 ) {
          to = nextBacktickIndex + 1;
        }
      }

      c = all.charAt( to );
      if ( c == '\'' ) {
        boolean skip = true;

        // Don't skip over \' or ''
        //
        if ( to > 0 ) {
          char prevChar = all.charAt( to - 1 );
          if ( prevChar == '\\' || prevChar == '\'' ) {
            skip = false;
          }
        }

        // Jump to the next quote and continue from there.
        //
        while ( skip ) {
          int nextQuoteIndex = all.indexOf( '\'', to + 1 );
          if ( nextQuoteIndex >= 0 ) {
            to = nextQuoteIndex + 1;

            skip = false;

            if ( to < all.length() ) {
              char nextChar = all.charAt( to );
              if ( nextChar == '\'' ) {
                skip = true;
                to++;
              }
            }
            if ( to > 0 ) {
              char prevChar = all.charAt( to - 2 );
              if ( prevChar == '\\' ) {
                skip = true;
                to++;
              }
            }
          }
        }
      }

      c = all.charAt( to );

      // end of statement
      if ( c == ';' || to >= length - 1 ) {
        if ( to >= length - 1 ) {
          to++; // grab last char also!
        }

        String stat = all.substring( from, to );
        if ( !onlySpaces( stat ) ) {
          String s = Const.trim( stat );
          statements.add( new SqlScriptStatement(
            s, from, to, s.toUpperCase().startsWith( "SELECT" ) || s.toLowerCase().startsWith( "show" ) ) );
        }
        to++;
        from = to;
      } else {
        to++;
      }
    }
    return statements;
  }
@Test
  public void testShowIsTreatedAsAResultsQuery() throws Exception {
    List<SqlScriptStatement> sqlScriptStatements =
      new H2DatabaseMeta().getSqlScriptStatements( "show annotations from service" );
    assertTrue( sqlScriptStatements.get( 0 ).isQuery() );
  }