Changeset: 7f1b60991a3a for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=7f1b60991a3a
Modified Files:
        clients/mapiclient/mclient.c
        clients/mapiclient/mhelp.c
        clients/mapiclient/mhelp.h
Branch: Jul2017
Log Message:

Adapt \help to pagewidth; ran through indent; some more cleanup.


diffs (truncated from 1489 to 300 lines):

diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c
--- a/clients/mapiclient/mclient.c
+++ b/clients/mapiclient/mclient.c
@@ -2703,7 +2703,10 @@ doFile(Mapi mid, stream *fp, int useinse
                                                }
                                        } else
 #endif
-                                               sql_help(line, toConsole);
+                                       {
+                                               setWidth();
+                                               sql_help(line, toConsole, 
pagewidth <= 0 ? DEFWIDTH : pagewidth);
+                                       }
                                        continue;
                                }
 /* for later
diff --git a/clients/mapiclient/mhelp.c b/clients/mapiclient/mhelp.c
--- a/clients/mapiclient/mhelp.c
+++ b/clients/mapiclient/mhelp.c
@@ -30,7 +30,7 @@
 #include "stream.h"
 #include "mhelp.h"
 
-typedef struct{
+typedef struct {
        char *command;
        char *synopsis;
        char *syntax;
@@ -38,658 +38,842 @@ typedef struct{
        char *comments;
 } SQLhelp;
 
-SQLhelp sqlhelp[]={
+SQLhelp sqlhelp[] = {
        // major commands
-       { "ALTER TABLE",
-         "",
-         "ALTER TABLE qname ADD [COLUMN] { column_def | table_constraint }\n"
-         "ALTER TABLE qname ALTER [COLUMN] ident SET DEFAULT value\n"
-         "ALTER TABLE qname ALTER [COLUMN] ident SET [NOT] NULL\n"
-         "ALTER TABLE qname ALTER [COLUMN] ident DROP DEFAULT\n"
-         "ALTER TABLE qname ALTER [COLUMN] ident SET STORAGE {string | NULL} 
\n"
-         "ALTER TABLE qname DROP [COLUMN] ident [RESTRICT | CASCADE]\n"
-         "ALTER TABLE qname DROP CONSTRAINT ident [RESTRICT | CASCADE]\n"
-         "ALTER TABLE qname SET { { READ | INSERT } ONLY | READ WRITE }",
-         "column_def,table_constraint",
-         "See also https://www.monetdb.org/Documentation/SQLreference/Alter";
-       },
-       { "ALTER MERGE TABLE",
-         "",
-         "ALTER TABLE qname ADD TABLE qname\n"
-         "ALTER TABLE qname DROP TABLE qname [RESTRICT | CASCADE]\n",
-         "",
-         "See also 
https://www.monetdb.org/Documentation/Cookbooks/SQLrecipes/DataPartitioning";
-       },
-       { "ALTER SEQUENCE",
-         "",
-         "ALTER SEQUENCE ident [ AS datatype] [ RESTART [WITH start]] 
[INCREMENT BY increment]\n"
-         "[MINVALUE minvalue | NO MINVALUE]  [MAXVALUE maxvalue | NOMAXVALUE] 
| [ [ NO] CYCLE]",
-         0,
-         "See also 
https://www.monetdb.org/Documentation/Manuals/SQLreference/SerialTypes";
-       },
-       { "ALTER USER",
-         "",
-     "ALTER USER ident  WITH [ ENCRYPTED | UNENCRYPTED] PASSWORD string\n"
-     "ALTER USER ident  SET SCHEMA ident\n"
-     "ALTER USER ident  WITH [ENCRYPTED | UNENCRYPTED] PASSWORD SET SCHEMA 
ident\n"
-     "ALTER USER RENAME TO ident  \n"
-     "ALTER USER SET [ ENCRYPTED | UNENCRYPTED] PASSWORD string USING OLD 
PASSWORD string",
-         0, "See also https://www.monetdb.org/Documentation/SQLreference/Users";
-       },
-    { "ANALYZE",
-         "Collect statistics for optimizations",
-         "ANALYZE qname [column_list] [SAMPLE size] [MINMAX]",
-         "column_list",
-         "See also 
https://www.monetdb.org/Documentation/Cookbooks/SQLrecipes/statistics";
-       },
-       { "CALL",
-         "",
-         "CALL qname '(' [ [scalar_expression ] [ ',' ...]  ]')' | CALL ident 
'.' ident",
-         0,0
-       },
-       { "CASE",
-         "Case statement for procedures/functions",
-         "CASE  scalar_expression [ when_statement ...]  [ELSE 
procedure_statement ... ] END CASE",
-         0,"See also 
https://www.monetdb.org/Documentation/SQLreference/Flowofcontrol";
-       },
-    { "COMMIT",
-         "Commit the current transaction",
-         "COMMIT [ WORK ] [ AND CHAIN | AND NO CHAIN ]",
-         0,0
-       },
-       { "COPY BINARY",
-         "Append binary representations into a table",
-         "COPY [nrofrecords] BINARY INTO qname [column_list] FROM string 
[','...] [NO CONSTRAINT]",
-         "nrofrecords",
-         "see 
https://www.monetdb.org/Documentation/Cookbooks/SQLrecipes/BinaryBulkLoad";
-       },
-       { "COPY INTO",
-         "Parse a csv-file into a table",
-         "COPY [nrofrecords] INTO qname [column_list] FROM string [','...] 
[headerlist] [ separators]\n"
-         " [NULL [AS] string] [LOCKED] [BEST EFFORT] [NO CONSTRAINT] [FWF '(' 
integer [','...]')'\n"
-         "COPY [nrofrecords] INTO qname [column_list] FROM STDIN [headerlist] 
[ separators]\n"
-         " [NULL [AS] string] [LOCKED] [BEST EFFORT] [NO CONSTRAINT]\n"
-         "COPY query_expression INTO [STDOUT | string] [seps] [NULL [AS] 
string]",
-         "nrofrecords,headerlist,separators",
-         "See also 
https://www.monetdb.org/Documentation/Cookbooks/SQLrecipes/LoadingBulkData";
-       },
-       { "COPY LOADER",
-         "Copy into using a user supplied parsing function",
-         "COPY LOADER INTO qname FROM qname '(' [ scalar_expression ... ] ')'",
-        0,0
-       },
-       { "CREATE AGGREGATE FUNCTION",
-         "",
-         "CREATE AGGREGATE  FUNCTION qname '(' { '*' | [ param [',' ...]] } 
')'\n"
-         "    RETURNS { data_type | TABLE '(' function_return [ ',' ... ] ')' 
}\n"
-         "    EXTERNAL NAME ident ',' ident\n"
-         "CREATE AGGREGATE FUNCTION qname '(' { '*' | [ param [',' ...]] 
}')'\n"
-         "    RETURNS { data_type | TABLE '(' function_return [ ',' ... ] ')' 
}\n"
-         "    LANGUAGE ident external_code",
-         "param,data_type,function_return",
-         0
-       },
-       { "CREATE FILTER FUNCTION",
-         "",
-         "CREATE FILTER  FUNCTION qname '(' { '*' | [ param [',' ...]] } ')'\n"
-         "    RETURNS { data_type | TABLE '(' function_return [ ',' ... ] ')' 
}\n"
-         "    EXTERNAL NAME ident ',' ident",
-         "param,data_type,function_return",
-         0
-       },
-       { "CREATE FUNCTION",
-         "",
-         "CREATE FUNCTION qname '(' { '*' | [ param [',' ...]] } ')'\n"
-         "    RETURNS { data_type | TABLE '(' function_return [ ',' ... ] ')' 
}\n"
-         "    EXTERNAL NAME ident ',' ident\n"
-         "CREATE FUNCTION qname '(' { '*' | [ param [',' ...]] } ')'\n"
-         "    RETURNS { data_type | TABLE '(' function_return [ ',' ... ] ')' 
}\n"
-         "    BEGIN [ ATOMIC ] statement [ ';' ...] END\n"
-         "CREATE FUNCTION qname '(' { '*' | [ param [',' ...]] }')'\n"
-         "    RETURNS { data_type | TABLE '(' function_return [ ',' ... ] ')' 
}\n"
-         "    LANGUAGE ident external_code",
-         "param,data_type,function_return,external_code",
-         0
-       },
-       { "CREATE INDEX",
-         "",
-         "CREATE [ UNIQUE | ORDERED | IMPRINTS ] INDEX ident ON qname '(' 
ident_list ')'",
-         0,0
-       },
-       { "CREATE PROCEDURE",
-         "",
-         "CREATE PROCEDURE qname '(' { '*' | [ param [',' ...]] }')'\n"
-         "    EXTERNAL NAME ident ',' ident\n"
-         "CREATE PROCEDURE qname '(' { '*' | [ param [',' ...]] } ')'\n"
-         "    BEGIN [ ATOMIC ] procedure_statement [ ';' ...] END\n"
-         "CREATE PROCEDURE qname '(' { '*' | [ param [',' ...]] } ')'\n"
-         "    LANGUAGE ident external_code",
-         "param,data_type,external_code",
-         0
-       },
-       { "CREATE LOADER",
-         "",
-         "CREATE LOADER qname '(' [ param [',' ...]] ')'\n"
-         "    LANGUAGE ident external_code",
-         "param,data_type,function_return,external_code",
-         0
-       },
-       { "CREATE MERGE TABLE",
-         "",
-         "CREATE MERGE TABLE qname table_source;",
-         0, "See also 
https://www.monetdb.org/Documentation/Cookbooks/SQLrecipes/DataPartitioning";
-     },
-       { "CREATE REMOTE TABLE",
-         "",
-         "CREATE REMOTE TABLE qname ON string",
-        0,"remote name should match 
mapi:monetdb://host:port/database[/schema[/table]]"
-       },
-       { "CREATE REPLICA TABLE",
-         "",
-         "CREATE REPLICA TABLE qname table_source;",
-         0, 
"https://www.monetdb.org/Documentation/Cookbooks/SQLrecipes/TransactionReplication";
-     },
-    { "CREATE SCHEMA",
-         "",
-         "CREATE SCHEMA schema_name [default_char_set] [path_spec] 
[schema_element]",
-         "schema_name,default_char_set,path_spec,schema_element",
-         0
-       },
-       { "CREATE SEQUENCE",
-         "Define a new sequence generator",
-         "CREATE SEQUENCE ident   [ AS datatype] [ START [WITH start]] 
[INCREMENT BY increment]\n"
-         "[MINVALUE minvalue | NO MINVALUE] [MAXVALUE maxvalue | NOMAXVALUE] | 
[ [ NO] CYCLE]",
-         0, "See also 
https://www.monetdb.org/Documentation/Manuals/SQLreference/SerialTypes";
-       },
-       { "CREATE STREAM TABLE",
+       {"ALTER TABLE",
+        "",
+        "ALTER TABLE qname ADD [COLUMN] { column_def | table_constraint }\n"
+        "ALTER TABLE qname ALTER [COLUMN] ident SET DEFAULT value\n"
+        "ALTER TABLE qname ALTER [COLUMN] ident SET [NOT] NULL\n"
+        "ALTER TABLE qname ALTER [COLUMN] ident DROP DEFAULT\n"
+        "ALTER TABLE qname ALTER [COLUMN] ident SET STORAGE {string | NULL}\n"
+        "ALTER TABLE qname DROP [COLUMN] ident [RESTRICT | CASCADE]\n"
+        "ALTER TABLE qname DROP CONSTRAINT ident [RESTRICT | CASCADE]\n"
+        "ALTER TABLE qname SET { { READ | INSERT } ONLY | READ WRITE }",
+        "column_def,table_constraint",
+        "See also https://www.monetdb.org/Documentation/SQLreference/Alter"},
+       {"ALTER MERGE TABLE",
+        "",
+        "ALTER TABLE qname ADD TABLE qname\n"
+        "ALTER TABLE qname DROP TABLE qname [RESTRICT | CASCADE]\n",
+        "",
+        "See also 
https://www.monetdb.org/Documentation/Cookbooks/SQLrecipes/DataPartitioning"},
+       {"ALTER SEQUENCE",
+        "",
+        "ALTER SEQUENCE ident [ AS datatype] [ RESTART [WITH start]] 
[INCREMENT BY increment]\n"
+        "[MINVALUE minvalue | NO MINVALUE]  [MAXVALUE maxvalue | NOMAXVALUE] | 
[ [ NO] CYCLE]",
+        NULL,
+        "See also 
https://www.monetdb.org/Documentation/Manuals/SQLreference/SerialTypes"},
+       {"ALTER USER",
+        "",
+        "ALTER USER ident  WITH [ ENCRYPTED | UNENCRYPTED] PASSWORD string\n"
+        "ALTER USER ident  SET SCHEMA ident\n"
+        "ALTER USER ident  WITH [ENCRYPTED | UNENCRYPTED] PASSWORD SET SCHEMA 
ident\n"
+        "ALTER USER RENAME TO ident\n"
+        "ALTER USER SET [ ENCRYPTED | UNENCRYPTED] PASSWORD string USING OLD 
PASSWORD string",
+        NULL,
+        "See also https://www.monetdb.org/Documentation/SQLreference/Users"},
+       {"ANALYZE",
+        "Collect statistics for optimizations",
+        "ANALYZE qname [column_list] [SAMPLE size] [MINMAX]",
+        "column_list",
+        "See also 
https://www.monetdb.org/Documentation/Cookbooks/SQLrecipes/statistics"},
+       {"CALL",
+        "",
+        "CALL qname '(' [ [scalar_expression ] [ ',' ...]  ]')' | CALL ident 
'.' ident",
+        NULL,
+        NULL},
+       {"CASE",
+        "Case statement for procedures/functions",
+        "CASE  scalar_expression [ when_statement ...]  [ELSE 
procedure_statement ... ] END CASE",
+        NULL,
+        "See also 
https://www.monetdb.org/Documentation/SQLreference/Flowofcontrol"},
+       {"COMMIT",
+        "Commit the current transaction",
+        "COMMIT [ WORK ] [ AND CHAIN | AND NO CHAIN ]",
+        NULL,
+        NULL},
+       {"COPY BINARY",
+        "Append binary representations into a table",
+        "COPY [nrofrecords] BINARY INTO qname [column_list] FROM string 
[','...] [NO CONSTRAINT]",
+        "nrofrecords",
+        "see 
https://www.monetdb.org/Documentation/Cookbooks/SQLrecipes/BinaryBulkLoad"},
+       {"COPY INTO",
+        "Parse a csv-file into a table",
+        "COPY [nrofrecords] INTO qname [column_list] FROM string [','...] 
[headerlist] [ separators]\n"
+        " [NULL [AS] string] [LOCKED] [BEST EFFORT] [NO CONSTRAINT] [FWF '(' 
integer [','...]')'\n"
+        "COPY [nrofrecords] INTO qname [column_list] FROM STDIN [headerlist] [ 
separators]\n"
+        " [NULL [AS] string] [LOCKED] [BEST EFFORT] [NO CONSTRAINT]\n"
+        "COPY query_expression INTO [STDOUT | string] [seps] [NULL [AS] 
string]",
+        "nrofrecords,headerlist,separators",
+        "See also 
https://www.monetdb.org/Documentation/Cookbooks/SQLrecipes/LoadingBulkData"},
+       {"COPY LOADER",
+        "Copy into using a user supplied parsing function",
+        "COPY LOADER INTO qname FROM qname '(' [ scalar_expression ... ] ')'",
+        NULL,
+        NULL},
+       {"CREATE AGGREGATE FUNCTION",
+        "",
+        "CREATE AGGREGATE  FUNCTION qname '(' { '*' | [ param [',' ...]] } 
')'\n"
+        "    RETURNS { data_type | TABLE '(' function_return [ ',' ... ] ')' 
}\n"
+        "    EXTERNAL NAME ident ',' ident\n"
+        "CREATE AGGREGATE FUNCTION qname '(' { '*' | [ param [',' ...]] }')'\n"
+        "    RETURNS { data_type | TABLE '(' function_return [ ',' ... ] ')' 
}\n"
+        "    LANGUAGE ident external_code",
+        "param,data_type,function_return",
+        NULL},
+       {"CREATE FILTER FUNCTION",
+        "",
+        "CREATE FILTER  FUNCTION qname '(' { '*' | [ param [',' ...]] } ')'\n"
+        "    RETURNS { data_type | TABLE '(' function_return [ ',' ... ] ')' 
}\n"
+        "    EXTERNAL NAME ident ',' ident",
+        "param,data_type,function_return",
+        NULL},
+       {"CREATE FUNCTION",
+        "",
+        "CREATE FUNCTION qname '(' { '*' | [ param [',' ...]] } ')'\n"
+        "    RETURNS { data_type | TABLE '(' function_return [ ',' ... ] ')' 
}\n"
+        "    EXTERNAL NAME ident ',' ident\n"
+        "CREATE FUNCTION qname '(' { '*' | [ param [',' ...]] } ')'\n"
+        "    RETURNS { data_type | TABLE '(' function_return [ ',' ... ] ')' 
}\n"
+        "    BEGIN [ ATOMIC ] statement [ ';' ...] END\n"
+        "CREATE FUNCTION qname '(' { '*' | [ param [',' ...]] }')'\n"
+        "    RETURNS { data_type | TABLE '(' function_return [ ',' ... ] ')' 
}\n"
+
+        "    LANGUAGE ident external_code",
+        "param,data_type,function_return,external_code",
+        NULL},
+       {"CREATE INDEX",
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to