Show current database in sql prompt
Hi,
At the moment, the sql prompt looks like that:
root@:26257>
It would be useful if it could also show the current database and be updated when set database is used.
Maybe something like this ?
root@:26257/testdb>
What do you think ?
I think this is a pretty good idea and would improve usability of the CLI. If you're interested in taking this on, I'd be happy to review your contribution.
I really wish I could, unfortunately I have yet to plunge into Golang and my C/C++ is a bit rusty.
@jordanlewis I want to try this.I hope we have to change in sql.go .
I think we need to handle this in :
- preparePrompts during initial cli sql shell start by making a database call using runQuery to get the database name.This will get the name only incase the --url flag has a database name in it.
- After a database transaction("SET DATABASE" statement) ,we need to invoke preparePrompts within doRefreshPrompts to check if database changed.
I will find the sql query for getting database name in cockroach.
Hello everyone! Happy New Year and all the best to you and your families ! @jordanlewis i believe that i have finished with this issue...tonight i am planning to update my local repo on GitHub. The final outcome is a command prompt exactly as described by @tlvenn. After i update my repo can please somebody check the sql.go in cli package in order to make sure that it's according to the team's standards ?
Best regards, Panos.
P.S. Nice meeting all the team members!
Good evening everyone, i have just pushed my local repo on GitHub. Can somebody please have a look at it and let me know ? The change have been done on ./pkg/cli/sql.go inside the function refreshPrompts. The URL for your reference is the following:
https://github.com/pmamatsis/cockroach/tree/master/pkg/cli
Please kindly let me know if it's according to standards so i can do the "Pull Request".
Best regards, Panos.
Hi @pmamatsis - thanks for your contribution! Please go ahead and send a pull request right away - it's much better for us to review your code from a PR than from your tree. Once you send that, we'll send you review comments in the pull request.
Hi @jordanlewis and nice to meet you. In the next 5 minutes max i will do the pull request. Hm...if i may ask...what else needs to be done in order to help the project?
Hi @pmamatsis, did you end up pushing a PR ?
Good morning @tlvenn,
i have already pushing a PR for the #12038 issue but because of a bad git rebase i cleared my repo and re-cloned and started working on it from the very beginning. With @knz and @dt help i have managed to fix this issue but the new number that has been assigned to it is #12408 which is the actual one about the cli. About this one i have done a push and also has been merged but yesterday it seems that this merge has disappeared because i cannot find it in the main cockroachdb repo. These changes are included in my clone and if needs be i can push again.
Please let me know about it. I have already asked @knz on the thread about the #12408 issue if i need to perform the push again.
Best regards, Panos.
Thanks for the update and your work @pmamatsis and looking forward to see your PR land.
Hi @tlvenn, my PR has been updated into the main branch of this project but unfortunately for some reason (i don't know why) my changes have been lost! You can check with @knz about it. Do i need to perform a PR ?
Best regards, Panos.
P.S. I am quite new at this and i am missing some of the concepts...
It seems that your PR had to be reverted because it broke some tests: https://github.com/cockroachdb/cockroach/pull/13277
On Feb 1, 2017 3:17 AM, "pmamatsis" [email protected] wrote:
Hi @tlvenn https://github.com/tlvenn, my PR has been updated into the main branch of this project but unfortunately for some reason (i don't know why) my changes have been lost! You can check with @knz https://github.com/knz about it. Do i need to perform a PR ?
Best regards, Panos.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/cockroachdb/cockroach/issues/12038#issuecomment-276598009, or mute the thread https://github.com/notifications/unsubscribe-auth/AAXBcRxdIimALOgnTzVphVtql-pDv0j1ks5rYD-tgaJpZM4LE66S .
Hi @andreimatei, thank you so much for your reply. I will reply on the issue #13277 thread.
Best regards, Panos.