dbcli / dbcli/mssql-cli

Semicolons should be required regardless of Multiline

Open
#250 0 comments 0 reactions 0 assignees View on GitHub
enhancement triage needed
Dominant language
Python
Stars
1.4k
Forks
191
PR merge metrics
No merged PRs in 30d

Description

Hello,

First of all, thank you for all your work on this tool :)

It was not immediately apparent to me moving from `psql` that hitting `return` would immediately execute the query without a semicolon. Given https://github.com/dbcli/mssql-cli/issues/175 , it appears that multi-line mode will end with a `GO` rather than a semicolon. I recommend altering tool behavior to not execute the query unless a semicolon is present.

--- An extended explanation follows ---

The tool behavior as it stands prevents a minor inconvenience (needing to enter a semicolon.) The tool behavior as recommended by this issue prevents potentially destructive accidental usage by novice and expert users alike.

For reference, a simplified example of a recent mistake I made, expecting to be protected by not yet typing a semicolon. When typing the final single quote, the return key was accidentally pressed by the same finger:

```
update comments set comment = ''
(11639 rows affected)
Time: 0.253s
```

The query would have been:

```
update comments set comment = 'something' where id = X;
```

I ended the string in order to write the `WHERE` clause so I wouldn't forget and accidentally update every row in the database. Obviously I was horrified that I ended up still updating every row in the database.

For now I can set Multiline to enabled since I now understand the nuances of it's behavior. Unless this issue is accepted, I'll also be leaving it on after issue 175 is completed, and writing `GO` after each line.

Thanks again!
Josh

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.