Used to run a command entered by the user during CLI operation (Puts the E in REPL) returns (results, MetaQuery)
(self, text)
| 524 | return self.interactive_mode and self.row_limit > 0 and len(rows) > self.row_limit |
| 525 | |
| 526 | def _evaluate_command(self, text): |
| 527 | """ |
| 528 | Used to run a command entered by the user during CLI operation |
| 529 | (Puts the E in REPL) |
| 530 | |
| 531 | returns (results, MetaQuery) |
| 532 | """ |
| 533 | # pylint: disable=too-many-locals |
| 534 | |
| 535 | all_success = True |
| 536 | meta_changed = False # CREATE, ALTER, DROP, etc |
| 537 | mutated = False # INSERT, DELETE, etc |
| 538 | db_changed = False |
| 539 | contains_secure_statement = False |
| 540 | path_changed = False |
| 541 | output = [] |
| 542 | total = 0 |
| 543 | |
| 544 | # Run the query. |
| 545 | start = time() |
| 546 | |
| 547 | # mssql-cli |
| 548 | if not self.mssqlcliclient_main.connect_to_database(): |
| 549 | click.secho(u'No connection to server. Exiting.') |
| 550 | sys.exit(1) |
| 551 | |
| 552 | for rows, columns, status, sql, is_error in \ |
| 553 | self.mssqlcliclient_main.execute_query(text): |
| 554 | |
| 555 | total = time() - start |
| 556 | if self._should_show_limit_prompt(status, rows): |
| 557 | click.secho('The result set has more than %s rows.' |
| 558 | % self.row_limit, fg='red') |
| 559 | if not click.confirm('Do you want to continue?'): |
| 560 | click.secho("Aborted!", err=True, fg='red') |
| 561 | break |
| 562 | |
| 563 | contains_secure_statement = security_words_found_in(sql) |
| 564 | |
| 565 | if is_error: |
| 566 | output.append(status) |
| 567 | all_success = False |
| 568 | continue |
| 569 | |
| 570 | if self.interactive_mode and self.auto_expand and self.prompt_session: |
| 571 | max_width = self.prompt_session.output.get_size().columns |
| 572 | else: |
| 573 | max_width = None |
| 574 | |
| 575 | settings = OutputSettings( |
| 576 | table_format=self.table_format, |
| 577 | dcmlfmt=self.decimal_format, |
| 578 | floatfmt=self.float_format, |
| 579 | missingval=self.null_string, |
| 580 | expanded=self.expanded_output, |
| 581 | max_width=max_width, |
| 582 | case_function=( |
| 583 | self.completer.case if self.interactive_mode and |
no test coverage detected