(self)
| 94 | return output |
| 95 | |
| 96 | def sqlShell(self): |
| 97 | infoMsg = "calling %s shell. To quit type " % Backend.getIdentifiedDbms() |
| 98 | infoMsg += "'x' or 'q' and press ENTER" |
| 99 | logger.info(infoMsg) |
| 100 | |
| 101 | autoCompletion(AUTOCOMPLETE_TYPE.SQL) |
| 102 | |
| 103 | while True: |
| 104 | query = None |
| 105 | |
| 106 | try: |
| 107 | query = _input("sql-shell> ") |
| 108 | query = getUnicode(query, encoding=sys.stdin.encoding) |
| 109 | query = query.strip("; ") |
| 110 | except UnicodeDecodeError: |
| 111 | print() |
| 112 | errMsg = "invalid user input" |
| 113 | logger.error(errMsg) |
| 114 | except KeyboardInterrupt: |
| 115 | print() |
| 116 | errMsg = "user aborted" |
| 117 | logger.error(errMsg) |
| 118 | except EOFError: |
| 119 | print() |
| 120 | errMsg = "exit" |
| 121 | logger.error(errMsg) |
| 122 | break |
| 123 | |
| 124 | if not query: |
| 125 | continue |
| 126 | |
| 127 | if query.lower() in ("x", "q", "exit", "quit"): |
| 128 | break |
| 129 | |
| 130 | output = self.sqlQuery(query) |
| 131 | |
| 132 | if output and output != "Quit": |
| 133 | conf.dumper.sqlQuery(query, output) |
| 134 | |
| 135 | elif not output: |
| 136 | pass |
| 137 | |
| 138 | elif output != "Quit": |
| 139 | dataToStdout("No output\n") |
| 140 | |
| 141 | def sqlFile(self): |
| 142 | infoMsg = "executing SQL statements from given file(s)" |
no test coverage detected