dbcli / dbcli/mssql-cli

Semicolons should be required regardless of Multiline

Aperta
#250 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
enhancement triage needed
Lingua principale
Python
Stelle
1.4k
Fork
191
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Inizia riproducendo l’inserimento di una query con Multiline disabilitato e traccia il modo in cui Enter, i punti e virgola e GO attivano l’esecuzione in mssql-cli. Il lavoro è completato quando premere Enter senza un punto e virgola non esegue la query, mentre l’esecuzione con il punto e virgola e il comportamento documentato di Multiline continuano a funzionare correttamente.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python, sql
Ambito
cli, databases
Tipo di issue
Funzionalità
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.