dbcli / mssql-cli

A command-line client for SQL Server with auto-completion and syntax highlighting
BSD 3-Clause "New" or "Revised" License
1.36k stars 190 forks source link

Non-interactive query mode #309

Closed ellbosch closed 5 years ago

ellbosch commented 5 years ago

This PR would close #242. Unit tests have not been covered yet. Thoughts on the implementation @pensivebrian?

ellbosch commented 5 years ago

Considering possible test cases for -Q:

Any others @pensivebrian? #Closed

ellbosch commented 5 years ago

Latest changes introduced a fix for a bug that caused crashes on exiting VIM mode and more tests. As a disclaimer—I've noticed that calling mssql-cli -Q "" with empty strings will launch the default interactive mode. We should have further discussions about expected functionality for empty quotes. #Closed

pensivebrian commented 5 years ago

things like this don't make sense in non-interactive mode. #Closed


Refers to: mssqlcli/mssql_cli.py:184 in 3700608. [](commit_id = 370060894b4248e957d3045062a47c04d4a98eb4, deletion_comment = False)

pensivebrian commented 5 years ago

Skip in non-interactive mode?


Refers to: mssqlcli/mssql_cli.py:188 in fba47c5. [](commit_id = fba47c52b361544dd32efed4edf292d40b405912, deletion_comment = False)

ellbosch commented 5 years ago

Skip in non-interactive mode?

Refers to: mssqlcli/mssql_cli.py:188 in fba47c5. [](commit_id = fba47c5, deletion_comment = False)

GitHub is having problems showing what line you're referring to—I went to the commit and line # but wasn't able to determine what you're talking about. #Closed

ellbosch commented 5 years ago

Some minor comments. The only product issue, it in the MssqlCli constructor, we shouldn't be spinning up the completion refreshers or anything that doesn't make sense in non-interactive mode.

Ok, will give this a shot.

ellbosch commented 5 years ago

@pensivebrian very curious about your thoughts with this commit, which will only set various properties in MssqlCli class if interactive mode is set. Tests have passed with these changes but I want to be sure that there aren't any unintended consequences.

pensivebrian commented 5 years ago

Looks good. I’d still take the tool for a good test spin manually, querying and changing database to make sure it works.

ellbosch commented 5 years ago

My latest changes fix all known python 2 issues. So far all tests have passed, I've also successfully created builds remotely on Azure. I'm running one more just to be sure.