Gets the tables available in the statement. param `scope:` possible values: 'full', 'insert', 'before' If 'insert', only the first table is returned. If 'before', only tables before the cursor are returned. If not 'insert' and the stmt is an insert, the first table i
(self, scope='full')
| 98 | return self.parsed.token_first().value.lower() == 'insert' |
| 99 | |
| 100 | def get_tables(self, scope='full'): |
| 101 | """ Gets the tables available in the statement. |
| 102 | param `scope:` possible values: 'full', 'insert', 'before' |
| 103 | If 'insert', only the first table is returned. |
| 104 | If 'before', only tables before the cursor are returned. |
| 105 | If not 'insert' and the stmt is an insert, the first table is skipped. |
| 106 | """ |
| 107 | tables = extract_tables( |
| 108 | self.full_text if scope == 'full' else self.text_before_cursor) |
| 109 | if scope == 'insert': |
| 110 | tables = tables[:1] |
| 111 | elif self.is_insert(): |
| 112 | tables = tables[1:] |
| 113 | return tables |
| 114 | |
| 115 | def get_previous_token(self, token): |
| 116 | return self.parsed.token_prev(self.parsed.token_index(token))[1] |
no test coverage detected