Find a password literal following a BY token (for ALTER USER ... IDENTIFIED BY 'pw').
(tokens: list[sqlglot.tokens.Token])
| 532 | |
| 533 | |
| 534 | def _find_password_after_by(tokens: list[sqlglot.tokens.Token]) -> str | None: |
| 535 | """Find a password literal following a BY token (for ALTER USER ... IDENTIFIED BY 'pw').""" |
| 536 | tt = sqlglot.tokens.TokenType |
| 537 | for i, tok in enumerate(tokens): |
| 538 | if tok.token_type == tt.VAR and tok.text.upper() == 'BY' and i + 1 < len(tokens): |
| 539 | next_tok = tokens[i + 1] |
| 540 | if next_tok.token_type == tt.STRING: |
| 541 | return next_tok.text |
| 542 | return None |
| 543 | |
| 544 | |
| 545 | def _find_password_after_eq(tokens: list[sqlglot.tokens.Token]) -> str | None: |
no outgoing calls
no test coverage detected