Changeset: cab4892232eb for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=cab4892232eb
Modified Files:
clients/mapiclient/mhelp.c
Branch: sqlextra
Log Message:
Cleaned Mclient help
diffs (173 lines):
diff --git a/clients/mapiclient/mhelp.c b/clients/mapiclient/mhelp.c
--- a/clients/mapiclient/mhelp.c
+++ b/clients/mapiclient/mhelp.c
@@ -38,6 +38,8 @@ typedef struct {
char *comments;
} SQLhelp;
+#define NUMBER_MAJOR_COMMANDS 73 // The number of major commands to show in
case of no query
+
SQLhelp sqlhelp[] = {
// major commands
{"ALTER TABLE",
@@ -203,8 +205,8 @@ SQLhelp sqlhelp[] = {
NULL},
{"CREATE TRIGGER",
"",
- "CREATE TRIGGER wname { BEFORE | AFTER } {INSERT | DELETE | UPDATE [
OF ident [',' ident]...\n"
- "ON qname [REFERENCING trigger_reference... triggered_action",
+ "CREATE TRIGGER wname { BEFORE | AFTER } { INSERT | DELETE | TRUNCATE
| UPDATE [ OF ident [',' ident]] } ...\n"
+ "ON qname REFERENCING trigger_reference... triggered_action",
"trigger_reference",
NULL},
{"CREATE TYPE",
@@ -214,7 +216,7 @@ SQLhelp sqlhelp[] = {
NULL},
{"CREATE VIEW",
"",
- "CREATE VIEW [ IF NOT EXISTS ] qname [ column_list ] AS {
query_expression | '(' query_expression ') }\n"
+ "CREATE VIEW [ IF NOT EXISTS ] qname [ column_list ] AS {
query_expression | '(' query_expression ')' }\n"
"[ WITH CHECK OPTION ]",
"column_list,query_expression",
NULL},
@@ -393,7 +395,7 @@ SQLhelp sqlhelp[] = {
"SET '=' simple_atom",
"simple_atom",
NULL},
- {"SET LOCALSTART TRANSACTION",
+ {"SET LOCAL TRANSACTION",
"",
"START LOCAL TRANSACTION transactionmode",
"transactionmode,isolevel",
@@ -447,16 +449,20 @@ SQLhelp sqlhelp[] = {
"table_ref [ INNER | LEFT | RIGHT | FULL] JOIN table_ref { ON
search_condition | USING column_list } |\n",
NULL,
"See also
https://www.monetdb.org/Documentation/SQLreference/TableExpressions"},
-
{"TRACE",
"Give execution trace",
"TRACE statement",
NULL,
NULL},
+ {"TRUNCATE",
+ "",
+ "TRUNCATE [ TABLE ] qname [ CONTINUE IDENTITY | RESTART IDENTITY ] [
CASCADE | RESTRICT ]",
+ "",
+ NULL},
{"UPDATE",
"",
"[WITH with_list] UPDATE qname SET assignment_list [FROM from_clause]
[WHERE search_condition]",
- "with_list,assignment_list,from_clause",
+ "with_list,assignment_list,from_clause,search_condition",
NULL},
{"WHILE",
"",
@@ -479,7 +485,7 @@ SQLhelp sqlhelp[] = {
// The subgrammar rules
{"assignment_list",
NULL,
- "colum '=' search_condition | '(' column [','...] ')' '=' subquery",
+ "column '=' DEFAULT | column '=' search_condition | '(' column
[','...] ')' '=' subquery",
"search_condition,column,subquery",
NULL},
{"authid",
@@ -489,7 +495,7 @@ SQLhelp sqlhelp[] = {
NULL},
{"column_def",
NULL,
- "COLUMN [ SERIAL | BIGSERIAL] | COLUMN data_type [ column_option ...]",
+ "COLUMN [ SERIAL | BIGSERIAL ] | COLUMN data_type [ column_option
...]",
"column_option",
NULL},
{"column_list",
@@ -520,7 +526,7 @@ SQLhelp sqlhelp[] = {
NULL},
{"datetime_type",
NULL,
- "DATE | TIME [ time_precision ] tz | TIMESTAMP [ timestamp_precision
] tz",
+ "DATE | TIME [ time_precision ] tz | TIMESTAMP [ timestamp_precision ]
tz",
"time_precision,timestamp_precision,tz",
NULL},
{"data_type",
@@ -542,7 +548,7 @@ SQLhelp sqlhelp[] = {
NULL},
{"end_time",
NULL,
- "SECOND timestamp_precision\n,timestamp_precision",
+ "SECOND timestamp_precision\n,timestamp_precision",
NULL,
NULL},
{"function_return",
@@ -583,7 +589,7 @@ SQLhelp sqlhelp[] = {
NULL},
{"interval",
NULL,
- "INTERVAL [ '+' | '-' ] string start_field TO end_field",
+ "INTERVAL [ '+' | '-' ] string start_field TO end_field",
"start_field,end_time",
NULL},
{"intval",
@@ -613,14 +619,14 @@ SQLhelp sqlhelp[] = {
NULL},
{"privileges",
NULL,
- "{ ALL [PRIVILEGES ] | { INSERT | DELETE | EXECUTE | [ REFERENCES |
SELECT | UPDATE } column_list ON "
- " { [TABLE] qname | routine_designator } | global_privileges",
+ "{ ALL [PRIVILEGES ] | INSERT | DELETE | EXECUTE | REFERENCES | SELECT
| TRUNCATE | UPDATE } column_list ON "
+ " { [TABLE] qname | routine_designator } | global_privileges",
"global_privileges,routine_designator",
NULL},
{"procedure_statement",
NULL,
- "{transaction_statement | update_statement | grant |revoke | declare
|set_statement | control_statement |select_single_row } ';'",
- "transaction_statement | update_statement | grant |revoke | declare
|set_statement | control_statement |select_single_row",
+ "{transaction_statement | update_statement | grant | revoke | declare
| set_statement | control_statement | select_single_row} ';'",
+ "transaction_statement | update_statement | grant | revoke | declare |
set_statement | control_statement | select_single_row",
NULL},
{"query_expression",
NULL,
@@ -714,12 +720,12 @@ SQLhelp sqlhelp[] = {
NULL},
{"update_statement",
NULL,
- "delete_stmt | insert_stmt | update_stmt | copyfrom_stmt",
- "delete_stmt | insert_stmt | update_stmt | copyfrom_stmt",
+ "delete_stmt | truncate_stmt | insert_stmt | update_stmt |
copyfrom_stmt",
+ "delete_stmt | truncate_stmt | insert_stmt | update_stmt |
copyfrom_stmt",
NULL},
{"triggered_action",
NULL,
- "[FOR EACH { ROW | STATEMENT } ] [ WHEN '(' search_condition ')'\n"
+ "[ FOR EACH { ROW | STATEMENT } ] [ WHEN '(' search_condition ')'\n"
"BEGIN ATOMIC trigger_statement ... END ",
NULL,
NULL},
@@ -730,7 +736,7 @@ SQLhelp sqlhelp[] = {
NULL},
{"when_statement",
NULL,
- "WHEN salar_expression THEN procedure_statement ...",
+ "WHEN scalar_expression THEN procedure_statement ...",
NULL,
NULL},
{"with_list",
@@ -864,10 +870,17 @@ sql_help(char *pattern, stream *toConsol
if (ncolumns > 1 && ncolumns * (int) maxlen + ncolumns - 1 > pagewidth)
ncolumns--;
step = total / ncolumns;
+ if(total % ncolumns) {
+ step++;
+ }
for (i = 0; i < step; i++) {
int j;
- for (j = 0; j < ncolumns; j++)
- sql_word(sqlhelp[i + j * step].command, j < ncolumns -
1 ? maxlen : 0, toConsole);
+ for (j = 0; j < ncolumns; j++) {
+ int nextNum = i + j * step;
+ if(nextNum < NUMBER_MAJOR_COMMANDS) {
+ sql_word(sqlhelp[nextNum].command, j < ncolumns
- 1 ? maxlen : 0, toConsole);
+ }
+ }
mnstr_printf(toConsole, "\n");
}
mnstr_printf(toConsole, "Using the conventional grammar constructs:\n");
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list