Changeset: d7d962444d14 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d7d962444d14
Modified Files:
        NT/monetdb_config.h.in
        configure.ag
        monetdb5/mal/mal_interpreter.c
        monetdb5/modules/kernel/calc.c.mx
        monetdb5/modules/mal/Tests/inspect05.stable.out
        monetdb5/modules/mal/Tests/inspect05.stable.out.Windows
        monetdb5/modules/mal/pqueue.mx
        sql/backends/monet5/Makefile.ag
        sql/backends/monet5/sql.mx
        sql/backends/monet5/sql_gencode.c
        sql/backends/monet5/sql_scenario.c
        sql/benchmarks/tpch/dbgen/BUGS
        sql/benchmarks/tpch/dbgen/CHANGES
        sql/benchmarks/tpch/dbgen/HISTORY
        sql/benchmarks/tpch/dbgen/PORTING.NOTES
        sql/benchmarks/tpch/dbgen/bcd2.c
        sql/benchmarks/tpch/dbgen/bcd2.h
        sql/benchmarks/tpch/dbgen/bm_utils.c
        sql/benchmarks/tpch/dbgen/build.c
        sql/benchmarks/tpch/dbgen/config.h
        sql/benchmarks/tpch/dbgen/dists.dss
        sql/benchmarks/tpch/dbgen/driver.c
        sql/benchmarks/tpch/dbgen/dss.ddl
        sql/benchmarks/tpch/dbgen/dss.h
        sql/benchmarks/tpch/dbgen/dss.ri
        sql/benchmarks/tpch/dbgen/dsstypes.h
        sql/benchmarks/tpch/dbgen/history.html
        sql/benchmarks/tpch/dbgen/load_stub.c
        sql/benchmarks/tpch/dbgen/makefile.suite
        sql/benchmarks/tpch/dbgen/permute.c
        sql/benchmarks/tpch/dbgen/permute.h
        sql/benchmarks/tpch/dbgen/print.c
        sql/benchmarks/tpch/dbgen/qgen.c
        sql/benchmarks/tpch/dbgen/rnd.c
        sql/benchmarks/tpch/dbgen/rnd.h
        sql/benchmarks/tpch/dbgen/shared.h
        sql/benchmarks/tpch/dbgen/speed_seed.c
        sql/benchmarks/tpch/dbgen/text.c
        sql/benchmarks/tpch/dbgen/tpcd.h
        sql/benchmarks/tpch/dbgen/varsub.c
        sql/storage/bat/bat_storage.c
Branch: headless
Log Message:

Merge with default branch.


diffs (truncated from 13446 to 300 lines):

diff --git a/buildtools/Mx/Def.c b/buildtools/Mx/Def.c
--- a/buildtools/Mx/Def.c
+++ b/buildtools/Mx/Def.c
@@ -499,7 +499,7 @@ DefBlk(void)
                }
                if (f + size + 1 > blk + M_BLK)
                        Fatal("Mx:Too long block, use extra 
directives:[%s:%d].\n", mx_file, mx_line);
-               strncat(f, line, size + 1);
+               memcpy(f, line, size + 1);
                f += size;
                line = NextLine();
        }
diff --git a/clients/ChangeLog.Dec2011 b/clients/ChangeLog.Dec2011
--- a/clients/ChangeLog.Dec2011
+++ b/clients/ChangeLog.Dec2011
@@ -1,6 +1,18 @@
 # ChangeLog file for clients
 # This file is updated with Maddlog
 
+* Wed Nov  9 2011 Sjoerd Mullender <[email protected]>
+- mclient: The exact interpretation of the -i (--interactive) option
+  and the - filename argument have changed.  The - filename argument
+  means read from standard input and no longer implies that no \
+  interpretation is done on the input.  Instead, \ interpretation is done
+  if either standard input is a terminal, or if the -i option is given.
+  The -i option no longer causes mclient to read from standard input.
+  It only means to do \ interpretation when reading from standard input.
+  Use the - filename argument to read from standard input.  Note that
+  if no -s option is specified and no filename arguments are present,
+  mclient still reads from standard input.
+
 * Wed Nov  2 2011 Sjoerd Mullender <[email protected]>
 - ODBC: Improved internal query for SQLSpecialColumns.  Before, the query
   returned all columns taking part in a PRIMARY KEY *and* all columns
diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -1978,11 +1978,11 @@ str CALCswitchbit(Client cntxt, MalBlkPt
 str CALCunarybitABS(bit *res, bit *a);
 str CALCunarybitNEG(bit *res, bit *a);
 str CALCunarybitNOT(bit *retval, bit *value);
-str CALCunarybitSIGN(bit *res, bit *a);
+str CALCunarybitSIGN(int *res, bit *a);
 str CALCunarybteABS(bte *res, bte *a);
 str CALCunarybteNEG(bte *res, bte *a);
 str CALCunarybteNOT(bte *res, bte *a);
-str CALCunarybteSIGN(bte *res, bte *a);
+str CALCunarybteSIGN(int *res, bte *a);
 str CALCunarycheckbitINV(bit *res, bit *a);
 str CALCunarycheckbteINV(bte *res, bte *a);
 str CALCunarycheckchrINV(chr *res, chr *a);
@@ -1995,13 +1995,13 @@ str CALCunarycheckwrdINV(wrd *res, wrd *
 str CALCunarychrABS(chr *res, chr *a);
 str CALCunarychrNEG(chr *res, chr *a);
 str CALCunarychrNOT(chr *res, chr *a);
-str CALCunarychrSIGN(chr *res, chr *a);
+str CALCunarychrSIGN(int *res, chr *a);
 str CALCunarydblABS(dbl *res, dbl *a);
 str CALCunarydblNEG(dbl *res, dbl *a);
-str CALCunarydblSIGN(dbl *res, dbl *a);
+str CALCunarydblSIGN(int *res, dbl *a);
 str CALCunaryfltABS(flt *res, flt *a);
 str CALCunaryfltNEG(flt *res, flt *a);
-str CALCunaryfltSIGN(flt *res, flt *a);
+str CALCunaryfltSIGN(int *res, flt *a);
 str CALCunaryintABS(int *res, int *a);
 str CALCunaryintNEG(int *res, int *a);
 str CALCunaryintNOT(int *res, int *a);
@@ -2009,14 +2009,14 @@ str CALCunaryintSIGN(int *res, int *a);
 str CALCunarylngABS(lng *res, lng *a);
 str CALCunarylngNEG(lng *res, lng *a);
 str CALCunarylngNOT(lng *res, lng *a);
-str CALCunarylngSIGN(lng *res, lng *a);
+str CALCunarylngSIGN(int *res, lng *a);
 str CALCunaryshtABS(sht *res, sht *a);
 str CALCunaryshtNEG(sht *res, sht *a);
 str CALCunaryshtNOT(sht *res, sht *a);
-str CALCunaryshtSIGN(sht *res, sht *a);
+str CALCunaryshtSIGN(int *res, sht *a);
 str CALCunarywrdABS(wrd *res, wrd *a);
 str CALCunarywrdNEG(wrd *res, wrd *a);
-str CALCunarywrdSIGN(wrd *res, wrd *a);
+str CALCunarywrdSIGN(int *res, wrd *a);
 str CALCwrd2bit(bit *res, wrd *a);
 str CALCwrd2bte(bte *res, wrd *a);
 str CALCwrd2chr(chr *res, wrd *a);
@@ -4077,6 +4077,7 @@ str DCYbind(int *ret, str *sch, str *tab
 str DCYcopy(int *ret_bat, int *ret_id, str *sch, str *tab, str *col, int 
*kind, int *part, int *fbun, int *lbun);
 str DCYpin(int *ret, int *bid);
 str DCYunpin(int *ret, int *bid);
+int DFLOWadmission(lng argclaim, lng hotclaim);
 str DICTbind(int *idx, int *val, str *nme);
 str DICTcompress(int *idx, str *nme, int *bid);
 str DICTdecompress(int *ret, str *nme);
diff --git a/clients/mapiclient/Tests/mclient--help.stable.err 
b/clients/mapiclient/Tests/mclient--help.stable.err
--- a/clients/mapiclient/Tests/mclient--help.stable.err
+++ b/clients/mapiclient/Tests/mclient--help.stable.err
@@ -21,7 +21,7 @@ Options are:
  -E charset  | --encoding=charset specify encoding (character set) of the 
terminal
  -f kind     | --format=kind      specify output format {csv,tab,raw,sql,xml}
  -H          | --history         load/save cmdline history (default off)
- -i          | --interactive[=tm] read stdin after command line args, use time 
formatting {ms,s,m}
+ -i          | --interactive[=tm] interpret \ commands on stdin, use time 
formatting {ms,s,m}
  -l language | --language=lang    {sql,mal}
  -L logfile  | --log=logfile     save client/server interaction
  -s stmt     | --statement=stmt  run single statement
@@ -36,6 +36,7 @@ SQL specific opions
  -w nr       | --width=nr         for pagination
  -D          | --dump             create an SQL dump
  -N          | --inserts          use INSERT INTO statements when dumping
+The file argument can be - for stdin
 
 # 18:57:57 >  
 # 18:57:57 >  Done.
diff --git a/clients/mapiclient/mclient.1 b/clients/mapiclient/mclient.1
--- a/clients/mapiclient/mclient.1
+++ b/clients/mapiclient/mclient.1
@@ -25,42 +25,34 @@ is the command-line interface to the Mon
 If the
 .BI \-\-statement= query
 .RB ( \-s
-.IR query)
-option is given, the query is executed as if it were given in a file.
+.IR query )
+option is given, the query is executed.
 If any files are listed after the options, queries are read from the
 files and executed.
-In either case,
+The special filename
+.B \-
+refers to standard input.
+Note that if there is both a
+.B \-\-statement
+option and filename arguments, the query given with
+.B \-\-statement
+is executed first.
+If no
+.B \-\-statement
+option is given and no files are specified on the command line,
 .I mclient
-exits after executing the query or queries, unless the
+reads queries from standard input.
+.PP
+When reading from standard input, if standard input is a terminal
+or if the
 .B \-\-interactive
 .RB ( \-i )
-option is given, in which case it continues reading queries from
-standard input.
-The file name
-.B \-
-refers to the standard input.
-If
-.I mclient
-is started without any non-option arguments and without the
-.B \-\-statement
-.RB ( \-s )
-option, it reads queries from standard input.
-.PP
-When reading from standard input because no file arguments and no
-.B \-\-statement
-.RB ( \-s )
-option were passed on the command line, or because the
-.B \-\-interactive
-.RB ( \-i )
-option was given,
+option is given,
 .I mclient
 interprets lines starting with
 .B \e
 (backslash) specially.
 See the section BACKSLASH COMMANDS below.
-Note that this is not done when reading from standard input when the
-.B \-
-file argument is given.
 .PP
 Before
 .I mclient
@@ -102,7 +94,9 @@ and to the argument of the
 .B \-\-statement
 .RB ( \-s )
 option but not to the contents of files specified on the command line
-or files specified using the
+(except for
+.B \-
+which refers to standard input) or files specified using the
 .B \e<
 command (those must be encoded using UTF-8).  The default encoding is
 taken from the locale.
@@ -134,14 +128,19 @@ platforms where these are supported.
 \fB\-\-port=\fP\fIportnr\fP (\fB\-p\fP \fIportnr\fP)
 Specify the portnumber of the server (default: 50000).
 .TP
-\fB\-\-interactive[=\fP\fItimermode\fP\fB]\fP 
(\fB\-i[\fP\fItimermode\fP\fB]\fP)
-After executing the queries from the
-.B \-\-statement
-option (if given) and any file specified on the command
-line, read queries from standard input.  When this option is set, all
-files are read line by line, like if it were entered on mclient's
-console.  The optional \fItimermode\fP argument controls the
-format of the time reported for queries.  The default mode is
+\fB\-\-interactive\fP[\fB=\fP\fItimermode\fP] (\fB\-i\fP[\fItimermode\fP])
+When reading from standard input, interpret lines starting with
+.B \e
+(backslash) specially.
+See the section BACKSLASH COMMANDS below.
+This is the default if standard input is a terminal.
+The optional \fItimermode\fP argument controls the
+format of the time reported for queries.  Note that no space is
+allowed between
+.B \-i
+and
+.IR timermode .
+The default mode is
 \fBhuman\fP which adjusts the time precision to the measured value.  The
 modes \fBms\fP, \fBs\fP and \fBm\fP force millisecond, second and minute
 + second precision respectively.
@@ -172,9 +171,14 @@ to the client),
 is a pretty format which is meant for human consumption, and
 .B xml
 is a valid (in the XML sense) document.
+In addition to plain \fBcsv\fP, two other forms are possible.
+\fBcsv=\fP\fIc\fP uses \fIc\fP as column separator; \fBcsv+\fP\fIc\fP
+uses \fIc\fP as column separator and produces a single header line in
+addition to the data.
 .TP
 \fB\-\-echo\fP (\fB\-e\fP)
 Echo the query.
+Note that using this option slows down processing.
 .TP
 \fB\-\-history\fP (\fB\-H\fP)
 Load and save the command line history (default off).
@@ -184,9 +188,7 @@ Save client/server interaction in the sp
 .TP
 \fB\-\-statement=\fP\fIstmt\fP (\fB\-s\fP \fIstmt\fP)
 Execute the specified query.  The query is run before any queries from
-files specified on the command line are run, and before the
-interactive session is started (if the \fB\-\-interactive\fP option is
-given).
+files specified on the command line are run.
 .TP
 \fB\--timezone\fP (\fB\-z\fP)
 Do not tell the client's timezone to the server.
@@ -288,13 +290,10 @@ Echo the query in SQL formatting mode.
 Use the specified
 .I format
 mode to format the output.
-Possible modes are
-.BR csv ,
-.BR tab ,
-.BR raw ,
-.BR sql ,
-and
-.BR xml .
+Possible modes the same as for the
+.B \-\-format
+.RB ( \-f )
+option.
 .TP
 \fB\ew\fP \fIwidth\fP
 Set the maximum page width for rendering in the
diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c
--- a/clients/mapiclient/mclient.c
+++ b/clients/mapiclient/mclient.c
@@ -111,12 +111,13 @@ enum formatters {
        RAWformatter,
        TABLEformatter,
        CSVformatter,
-       TABformatter,
        XMLformatter,
        TESTformatter
 };
 static enum formatters formatter = NOformatter;
 char *output = NULL;           /* output format as string */
+char *separator = NULL;                /* column separator for CSV/TAB format 
*/
+int csvheader = 0;             /* include header line in CSV format */
 
 #define DEFWIDTH 80
 
@@ -149,7 +150,6 @@ static char *pager = 0;             /* use external
 static int rowsperpage = 0;    /* for SQL pagination */
 static int pagewidth = -1;     /* -1: take whatever is necessary, >0: limit */
 static int pagewidthset = 0;   /* whether the user set the width explicitly */
-static int interactive_stdin = 0;
 static int croppedfields = 0;  /* whatever got cropped/truncated */
 static char firstcrop = 1;     /* first time we see cropping/truncation */
 
@@ -634,9 +634,20 @@ CSVrenderer(MapiHdl hdl)
 {
        int fields;
        char *s;
-       char *sep = formatter == CSVformatter ? "," : "\t";
+       char *sep = separator;
        int i;
 
+       if (csvheader) {
+               fields = mapi_get_field_count(hdl);
+               for (i = 0; i < fields; i++) {
+                       s = mapi_get_name(hdl, i);
+                       if (s == NULL)
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to