Closed rogersjeffreyl closed 8 years ago
@rogersjeffreyl I added some initial comments but did not look at the workhorse code in the Command.cpp file. I'd say looks like a good start, especially since the line printing methods can be tricky to write correctly. I will be around this afternoon from 2-5 if you want to talk in person then.
@rogersjeffreyl Before diving into the code, I have the following questions.
Do we have \help
, \h
, or similar to show the help messages for all the commands you added?
Are \d
and \dt
two alias to the same commends?
Also, is it possible to print the relations better? For example in the demonstrated result below, the print length of all the relation names should be the same, so is the type. And the bar should align with +
.
quickstep> \d
List of relations
Name | Type |
+--------+--------+
test | table
test1 | table
Thanks!
@rogersjeffreyl Please update the copyright information for all the files you touched.
@zuyu
\d and \dt are not exactly the same commands. They behave the same way when they take no arguments. Following is the output from postgres: postgres=# \d List of relations Schema | Name | Type | Owner --------+-------+-------+------- public | test | table | rl public | test1 | table | rl
postgres=# \dt List of relations Schema | Name | Type | Owner --------+-------+-------+------- public | test | table | rl public | test1 | table | rl
However , when the table name is applied as argument the behavior changes:\
postgres=# \dt test List of relations Schema | Name | Type | Owner --------+------+-------+------- public | test | table | rl
postgres=# \d test Table "public.test" Column | Type | Modifiers --------+---------+----------- a | integer | Indexes: "test_index" btree (a)
@zuyu We donot have support for \h or \help yet. Regarding the output, when i paste the output into github I think it gets formatted. When I ran them on the cli the output is cleaner
@rogersjeffreyl and I talked about whether to make separate command classes versus static methods in a single command class. We came to the conclusion that at this point, using static methods is fine because there is no persistent state.
Also, @zuyu , \help
hasn't been created yet. The original idea was to have \help
describe a SQL command usage, (\help select
would show the user the possible syntax). However, this not implemented because of the large number of grammars that need to be described.
A simple \help
could display a list of available \
commands similar to sqlite's interface. A seperate command could be used for SQL interpretation, something like \usage SQL
.
--my 2p
@pateljm have fixed the alignment issue in the output
@rogersjeffreyl Are we going to add unit tests in this PR?
@cramja unit tests will be a separate pr
@rogersjeffreyl We typically do not merge new code without any unit test coverages. Please add the unit test in the same PR.
Sorry @rogersjeffreyl I accidently closed the PR when I meant to cancel the comment I was writing.
@cramja @zuyu CI failed earlier due to the ref count issue. Have merged with master and started CI again.
@cramja @zuyu The CI has passed now.
@rogersjeffreyl I've done one pass. After addressing all the comments, we should merge this PR. Thanks!
@rogersjeffreyl LGTM. Nice job!
This PR adds the execution support for the following commands to the CLI
\d This command lists all the tables in the database
\d
This command is the equivalent of describe table. The columns and their types are shown.
Additionally index information is also shown
\dt Lists all the tables in the database
\dt< table_name> Lists the table name from the list of tables in the database