code: def gen_items_from_sql_csv(s: str) -> Generator[str, None, None]:
      
      # csv.reader will not both process the quotes and return the quotes;
      # we need them to distinguish e.g. NULL from 'NULL'.
      # log.warning('gen_items_from_sql_csv: s = {0!r}', s)
      if not s:
          return
      n = len(s)
      startpos = 0
      pos = 0
      in_quotes = False
      while pos < n:
          if not in_quotes:
              if s[pos] == COMMA:
                  # end of chunk
                  chunk = s[startpos:pos]  # does not include s[pos]
                  result = chunk.strip()
                  # log.warning('yielding: {0!r}', result)
                  yield result
                  startpos = pos + 1
              elif s[pos] == SQUOTE:
                  # start of quote
                  in_quotes = True
          else:
              if pos < n - 1 and s[pos] == SQUOTE and s[pos + 1] == SQUOTE:
                  # double quote, '', is an escaped quote, not end of quote
                  pos += 1  # skip one more than we otherwise would
              elif s[pos] == SQUOTE:
                  # end of quote
                  in_quotes = False
          pos += 1
      # Last chunk
      result = s[startpos:].strip()
      # log.warning('yielding last: {0!r}', result)
      yield result
docs: Splits a comma-separated list of quoted SQL values, with ``'`` as the quote
      character. Allows escaping of the quote character by doubling it. Returns
      the quotes (and escaped quotes) as part of the result. Allows newlines etc.
      within the string passed.