Run the query and highlight the text that matches. Args: sentence (str): Run T-SQL query with relevant information value_to_hight_light (str): Text to hight light
(self, sentence:str, value_to_hight_light:str)
| 191 | AnsiPrint.printResult(result) |
| 192 | |
| 193 | def run_query(self, sentence:str, value_to_hight_light:str): |
| 194 | """Run the query and highlight the text that matches. |
| 195 | |
| 196 | Args: |
| 197 | sentence (str): Run T-SQL query with relevant information |
| 198 | value_to_hight_light (str): Text to hight light |
| 199 | """ |
| 200 | result = self._cursor.execute_query(sentence) |
| 201 | information = Result() |
| 202 | if result is not None and len(result)>0: |
| 203 | |
| 204 | for col in result[0].keys(): |
| 205 | information.headers.append(col) |
| 206 | |
| 207 | for row in result: |
| 208 | columns = [] |
| 209 | formatted_columns = [] |
| 210 | for key in row: |
| 211 | column_value = str(row[key]) |
| 212 | column_formatted,_ = Color.highlight_text(column_value, value_to_hight_light) #self._format_b64_data(column_value, value_to_hight_light, key) |
| 213 | formatted_columns.append(column_formatted) |
| 214 | columns.append(column_value) |
| 215 | |
| 216 | information.formatted_rows.append(formatted_columns) |
| 217 | information.rows.append(columns) |
| 218 | |
| 219 | return information |
| 220 | |
| 221 | def run(self, option:QueryType, value, hash_type:str=None) -> Result: |
| 222 | try: |
no test coverage detected