On Fri, Dec 21, 2007 at 11:55:34AM +0100, Peter Boncz wrote:
> Hi Sjoerd,
>
> Thanks for fixing some things I was unaware of (empty lines in other
> languages?)
>
> > The timer is again started when the first line of a query is typed.
> > This is the case for *all* languages.
>
> I cannot image cases where it is useful for mclient to keeps stays on
> someone's
> typing speed, while I can image cases where one would like to have information
> about query performance. Do others agree?
>
> (I maybe unjustly assumed that timing query performance was the intended
> behavior)
The timing was/is meant for overall query performance, ie
sending query + query execution + receiving the result (or part of it)
in non interactive setups.
Niels
>
> Peter
>
>
>
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] On
> > Behalf Of Sjoerd Mullender
> > Sent: Wednesday, December 19, 2007 3:04 PM
> > To: [EMAIL PROTECTED]
> > Subject: [Monetdb-checkins] clients/src/mapiclient
> > MapiClient.mx,Clients_1-20, 1.88.2.4, 1.88.2.5
> >
> >
> > Update of /cvsroot/monetdb/clients/src/mapiclient
> > In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv6918
> >
> > Modified Files:
> > Tag: Clients_1-20
> > MapiClient.mx
> > Log Message:
> > Did Peter's checkin and Niels' fix correctly: In XQuery mode, when
> > typing <> when there is no query yet will result in just asking for
> > more data, and empty lines in other modes will not end the session.
> > Also fixed \f processing in that the new value is now remembered for a
> > subsequent bare \f.
> > The timer is again started when the first line of a query is typed.
> > This is the case for *all* languages.
> >
> >
> > Index: MapiClient.mx
> > ===================================================================
> > RCS file: /cvsroot/monetdb/clients/src/mapiclient/MapiClient.mx,v
> > retrieving revision 1.88.2.4
> > retrieving revision 1.88.2.5
> > diff -u -d -r1.88.2.4 -r1.88.2.5
> > --- MapiClient.mx 19 Dec 2007 08:35:21 -0000 1.88.2.4
> > +++ MapiClient.mx 19 Dec 2007 14:04:09 -0000 1.88.2.5
> > @@ -152,6 +152,7 @@
> > XMLformatter
> > };
> > static enum formatters formatter = NOformatter;
> > +char *output = NULL; /* output format as string */
> >
> > #define DEFWIDTH 80
> >
> > @@ -247,8 +248,6 @@
> > }
> > }
> >
> > -char *output = NULL; /* output format is a global variable */
> > -
> > static void
> > SQLsetSpecial(const char *command)
> > {
> > @@ -796,9 +795,14 @@
> > }
> >
> > static void
> > -setFormatter(char *s)
> > +setFormatter(Mapi mid, char *s)
> > {
> > - if (strcmp(s, "sql") == 0)
> > + if (mode == XQUERY) {
> > + mapi_output(mid, s);
> > + if (output != NULL)
> > + free(output);
> > + output = strdup(s);
> > + } else if (strcmp(s, "sql") == 0)
> > formatter = TABLEformatter;
> > else if (strcmp(s, "csv") == 0)
> > formatter = CSVformatter;
> > @@ -1123,13 +1127,13 @@
> > fprintf(toConsole, "\\a - disable auto commit\n");
> > }
> > if (mode == XQUERY) {
> > - fprintf(toConsole, "\\f - result format:
> > dm or xml[-noheader][-typed|-noroot|-root-FOOBAR] \n");
> > - } else {
> > + fprintf(toConsole, "\\f - result format:
> > dm or xml[-noheader][-typed|-noroot|-root-FOOBAR]\n");
> > + } else {
> > fprintf(toConsole, "\\e - echo the query
> > in sql formatting mode\n");
> > - fprintf(toConsole, "\\f - format using a
> > built-in renderer {csv,tab,raw,sql,xml} \n");
> > + fprintf(toConsole, "\\f - format using a
> > built-in renderer {csv,tab,raw,sql,xml}\n");
> > fprintf(toConsole, "\\w# - set maximal page
> > width (-1=raw,0=no limit, >0 max char)\n");
> > - fprintf(toConsole, "\\r# - set maximum rows
> > per page (-1=raw)\n ");
> > - }
> > + fprintf(toConsole, "\\r# - set maximum rows
> > per page (-1=raw)\n");
> > + }
> > fprintf(toConsole, "\\L file - save client/server
> > interaction\n");
> > fprintf(toConsole, "\\X - trace mclient code\n");
> > fprintf(toConsole, "\\q - terminate session\n");
> > @@ -1140,9 +1144,10 @@
> > {
> > char *line = NULL;
> > char *buf = NULL;
> > - ssize_t length;
> > + size_t length;
> > MapiHdl hdl = mapi_get_active(mid);
> > MapiMsg rc = MOK;
> > + int sent = 0; /* whether we sent any data to
> > the server */
> >
> > #ifdef HAVE_LIBREADLINE
> > if (prompt == NULL)
> > @@ -1185,13 +1190,17 @@
> > line = fgets(buf, BUFSIZ, fp);
> > }
> > if (line == NULL || (mode == XQUERY && line[0]
> > == '<' && line[1] == '>')) {
> > - length = 0;
> > - if (line)
> > - length = -1;
> > - else if (hdl == NULL)
> > - return 0; /* EOF: nothing more to do */
> > + /* end of file */
> > + if (hdl == NULL) {
> > + if (line != NULL)
> > + continue;
> > + /* nothing more to do */
> > + return 0;
> > + }
> > +
> > /* hdl != NULL, we should finish the
> > current query */
> > line = NULL;
> > + length = 0;
> > } else
> > length = strlen(line);
> > if (hdl == NULL && length > 0 && line[length -
> > 1] == '\n') {
> > @@ -1217,7 +1226,7 @@
> > if (mark2)
> > free(mark2);
> > mark2 = strdup(line + 2);
> > - if (mode == XQUERY)
> > + if (mode == XQUERY)
> >
> > mapi_profile(mid, mark != NULL);
> > continue;
> > case 'X':
> > @@ -1378,31 +1387,31 @@
> > if (*line == 0) {
> >
> > fprintf(toConsole, "Current formatter: ");
> > if (mode == XQUERY)
> > -
> > fprintf(toConsole, "%s\n", output);
> > - else switch
> > (formatter) {
> > - case RAWformatter:
> > -
> > fprintf(toConsole, "raw\n");
> > - break;
> > - case TABLEformatter:
> > -
> > fprintf(toConsole, "sql\n");
> > - break;
> > - case CSVformatter:
> > -
> > fprintf(toConsole, "csv\n");
> > - break;
> > - case TABformatter:
> > -
> > fprintf(toConsole, "tab\n");
> > - break;
> > - case XMLformatter:
> > -
> > fprintf(toConsole, "xml\n");
> > - break;
> > - default:
> > -
> > fprintf(toConsole, "none\n");
> > - break;
> > +
> > fprintf(toConsole, "%s\n", output == NULL ? "dm" : output);
> > + else {
> > + switch
> > (formatter) {
> > + case
> > RAWformatter:
> > +
> > fprintf(toConsole, "raw\n");
> > + break;
> > + case
> > TABLEformatter:
> > +
> > fprintf(toConsole, "sql\n");
> > + break;
> > + case
> > CSVformatter:
> > +
> > fprintf(toConsole, "csv\n");
> > + break;
> > + case
> > TABformatter:
> > +
> > fprintf(toConsole, "tab\n");
> > + break;
> > + case
> > XMLformatter:
> > +
> > fprintf(toConsole, "xml\n");
> > + break;
> > + default:
> > +
> > fprintf(toConsole, "none\n");
> > + break;
> > + }
> > }
> > - } else if (mode == XQUERY)
> > - mapi_output(mid, line);
> > - else
> > - setFormatter(line);
> > + } else
> > + setFormatter(mid, line);
> > continue;
> > default:
> > showCommands();
> > @@ -1412,34 +1421,37 @@
> > }
> >
> > if (hdl == NULL) {
> > + timerStart();
> > hdl = mapi_query_prep(mid);
> > CHECK_RESULT(mid, hdl, buf, continue);
> > }
> > assert(hdl != NULL);
> >
> > if (length > 0) {
> > + sent = 1;
> > SQLsetSpecial(line);
> > mapi_query_part(hdl, line, length);
> > CHECK_RESULT(mid, hdl, buf, continue);
> > }
> >
> > - if (mode == XQUERY && line)
> > - continue; /* XQuery always wants more data */
> > -
> > /* If the server wants more but we're at the
> > end of file (line == NULL), notify the
> > server that we don't have anything more.
> > If the server still wants more (shouldn't
> > happen according to the protocol) we break
> > out of the loop (via the continue). The
> > - assertion at the end will then go off.
> > - */
> > - timerStart();
> > - if (mapi_query_done(hdl) == MMORE) {
> > - assert(mode != XQUERY); /* XQuery never
> > sends MMORE */
> > - if (line != NULL) continue; /* get more data */
> > - timerStart();
> > - if (mapi_query_done(hdl) == MMORE) {
> > + assertion at the end will then go off.
> > +
> > + Note that XQuery is weird: we continue
> > + sending more until we reach end-of-file,
> > + and *then* we send the mapi_query_done. To
> > + exit, you need to send an end-of-file
> > + again. */
> > + if (mode == XQUERY || mapi_query_done(hdl) == MMORE) {
> > + if (line != NULL) {
> > + continue; /* get more data */
> > + } else if (mapi_query_done(hdl) == MMORE) {
> > + assert(mode != XQUERY); /*
> > XQuery never sends MMORE */
> > hdl = NULL;
> > continue; /* done */
> > }
> > @@ -1459,7 +1471,7 @@
> >
> > /* for XQuery, only exit when end-of-file and we
> > didn't send any data */
> > - } while (hdl != NULL);
> > + } while (line != NULL || (mode == XQUERY && sent));
> > /* reached on end of file */
> > assert(hdl == NULL);
> > return 0;
> > @@ -1603,7 +1615,6 @@
> > strcmp(optarg, "x") == 0) {
> > language = "xquery";
> > mode = XQUERY;
> > - if (!output) output = "dm";
> > } else {
> > fprintf(stderr, "language
> > option needs to be one of sql, mil, mal, or xquery\n");
> > exit(-1);
> > @@ -1618,7 +1629,7 @@
> > passwd = optarg; /* can be NULL */
> > break;
> > case 'f':
> > - output = optarg; /* output format */
> > + output = strdup(optarg); /* output format */
> > break;
> > case 'I':
> > input = optarg;
> > @@ -1726,13 +1737,8 @@
> >
> > mapi_profile(mid, mark != NULL);
> > mapi_trace(mid, trace);
> > -
> > - if (output) {
> > - if (mode == XQUERY)
> > - mapi_output(mid, output);
> > - else
> > - setFormatter(output);
> > - }
> > + if (output)
> > + setFormatter(mid, output);
> >
> > c = 0;
> >
> >
> >
> > --------------------------------------------------------------
> > -----------
> > SF.Net email is sponsored by:
> > Check out the new SourceForge.net Marketplace.
> > It's the best place to buy or sell services
> > for just about anything Open Source.
> > http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.n
> et/marketplace
> _______________________________________________
> Monetdb-checkins mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/monetdb-checkins
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Monetdb-developers mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/monetdb-developers
--
Niels Nes, Centre for Mathematics and Computer Science (CWI)
Kruislaan 413, 1098 SJ Amsterdam, The Netherlands
room C0.02, phone ++31 20 592-4098, fax ++31 20 592-4312
url: http://www.cwi.nl/~niels e-mail: [EMAIL PROTECTED]
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Monetdb-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-developers