Changeset: bf1419bf9890 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=bf1419bf9890
Added Files:
common/utils/mprompt.h
common/utils/prompt.c
sql/test/BugTracker-2015/Tests/apply_merge_distinct.Bug-3760.sql
sql/test/BugTracker-2015/Tests/apply_merge_distinct.Bug-3760.stable.err
sql/test/BugTracker-2015/Tests/apply_merge_distinct.Bug-3760.stable.out
sql/test/BugTracker-2015/Tests/cardinality.Bug-3761.sql
sql/test/BugTracker-2015/Tests/cardinality.Bug-3761.stable.err
sql/test/BugTracker-2015/Tests/cardinality.Bug-3761.stable.out
sql/test/BugTracker-2015/Tests/cast_on_groupby_col_crash.Bug-3769.sql
sql/test/BugTracker-2015/Tests/cast_on_groupby_col_crash.Bug-3769.stable.err
sql/test/BugTracker-2015/Tests/cast_on_groupby_col_crash.Bug-3769.stable.out
sql/test/BugTracker-2015/Tests/sessions_crash.Bug-3759.sql
sql/test/BugTracker-2015/Tests/sessions_crash.Bug-3759.stable.err
sql/test/BugTracker-2015/Tests/sessions_crash.Bug-3759.stable.out
sql/test/BugTracker-2015/Tests/set_default_role.Bug-3364.sql
sql/test/BugTracker-2015/Tests/set_default_role.Bug-3364.stable.err
sql/test/BugTracker-2015/Tests/set_default_role.Bug-3364.stable.out
sql/test/BugTracker-2015/Tests/useless_casts.Bug-3756.sql
sql/test/BugTracker-2015/Tests/useless_casts.Bug-3756.stable.err
sql/test/BugTracker-2015/Tests/useless_casts.Bug-3756.stable.out
Removed Files:
clients/mapiclient/mprompt.h
clients/mapiclient/prompt.c
Modified Files:
clients/mapiclient/Makefile.ag
clients/mapiclient/eventparser.c
clients/mapiclient/eventparser.h
clients/mapiclient/tachograph.c
clients/mapiclient/tomograph.c
clients/python2/monetdb/mapi.py
clients/python3/monetdb/mapi.py
common/utils/Makefile.ag
debian/changelog
gdk/gdk_atoms.c
gdk/gdk_bat.c
gdk/gdk_bbp.c
gdk/gdk_logger.c
gdk/gdk_select.c
monetdb5/mal/mal_interpreter.c
monetdb5/mal/mal_profiler.c
monetdb5/modules/mal/clients.c
monetdb5/modules/mal/mal_io.c
sql/include/sql_relation.h
sql/server/rel_exp.c
sql/server/rel_exp.h
sql/server/rel_optimizer.c
sql/server/rel_schema.c
sql/server/rel_select.c
sql/server/sql_privileges.c
sql/test/BugDay_2005-11-09_2.9.3/Tests/grant_public.SF-1114580.stable.err
sql/test/BugTracker-2009/Tests/count_bug.SF-2604583.stable.out.int128
sql/test/BugTracker-2012/Tests/scalar_subquery_with_alias.Bug-3093.stable.out
sql/test/BugTracker-2013/Tests/All
sql/test/BugTracker-2015/Tests/All
sql/test/BugTracker-2015/Tests/assertHead.Bug-3706.stable.out
sql/test/Users/Tests/test_privs2_p2.stable.err
sql/test/remote/Tests/ssbm.SQL.py
tools/mserver/mserver5.c
Branch: pyapi
Log Message:
Merge with default.
diffs (truncated from 5350 to 300 lines):
diff --git a/clients/mapiclient/Makefile.ag b/clients/mapiclient/Makefile.ag
--- a/clients/mapiclient/Makefile.ag
+++ b/clients/mapiclient/Makefile.ag
@@ -9,21 +9,23 @@ INCLUDES = ../mapilib ../../common/optio
lib_mcutil = {
NOINST
- SOURCES = dump.c prompt.c dotmonetdb.c eventparser.c eventparser.h
+ SOURCES = dump.c dotmonetdb.c dotmonetdb.h eventparser.c eventparser.h
}
bin_mclient = {
SOURCES = mclient.c ReadlineTools.c ReadlineTools.h
LIBS = libmcutil ../mapilib/libmapi \
../../common/stream/libstream \
+ ../../common/utils/libmutils \
$(READLINE_LIBS) \
$(curl_LIBS) $(LTLIBICONV) $(PTHREAD_LIBS) $(MATH_LIBS)
$(SOCKET_LIBS)
}
bin_msqldump = {
- SOURCES = msqldump.c
+ SOURCES = msqldump.c msqldump.h
LIBS = libmcutil ../mapilib/libmapi \
../../common/stream/libstream \
+ ../../common/utils/libmutils \
$(curl_LIBS)
}
@@ -31,6 +33,7 @@ bin_stethoscope = {
SOURCES = stethoscope.c
LIBS = libmcutil ../mapilib/libmapi \
../../common/stream/libstream \
+ ../../common/utils/libmutils \
$(curl_LIBS) $(MALLOC_LIBS) $(PTHREAD_LIBS) $(SOCKET_LIBS)
}
@@ -38,6 +41,7 @@ bin_tachograph = {
SOURCES = tachograph.c
LIBS = libmcutil ../mapilib/libmapi \
../../common/stream/libstream \
+ ../../common/utils/libmutils \
$(curl_LIBS) $(MALLOC_LIBS) $(PTHREAD_LIBS) $(SOCKET_LIBS)
}
@@ -45,6 +49,7 @@ bin_tomograph = {
SOURCES = tomograph.c
LIBS = libmcutil ../mapilib/libmapi \
../../common/stream/libstream \
+ ../../common/utils/libmutils \
$(curl_LIBS) $(MALLOC_LIBS) $(PTHREAD_LIBS) $(SOCKET_LIBS)
}
@@ -59,6 +64,6 @@ bin_tomograph = {
man_MANS = mclient.1 msqldump.1
-EXTRA_DIST = msqldump.h mprompt.h dotmonetdb.h $(man_MANS)
+EXTRA_DIST = $(man_MANS)
EXTRA_DIST_DIR = Tests
diff --git a/clients/mapiclient/eventparser.c b/clients/mapiclient/eventparser.c
--- a/clients/mapiclient/eventparser.c
+++ b/clients/mapiclient/eventparser.c
@@ -50,29 +50,31 @@ clearArguments(void)
}
char *
-stripQuotes(char *currentquery)
-{ char *q, *c, *qry;
- q = qry = (char *) malloc(strlen(currentquery) * 2);
- if( q == NULL){
- fprintf(stderr,"Could not allocate query buffer
of size "SZFMT"\n", strlen(currentquery) * 2);
- exit(-1);
- }
- for (c= currentquery; *c; ){
- if ( strncmp(c,"\\\\t",3) == 0){
- *q++ = '\t';
- c+=3;
- } else
- if ( strncmp(c,"\\\\n",3) == 0){
- *q++ = '\n';
- c+=3;
- } else if ( strncmp(c,"\\\"",2) == 0){
- *q++= '"';
- c+=2;
- } else if ( strncmp(c,"\\\\",2) == 0){
- c+= 2;
- } else *q++ = *c++;
- }
- *q =0;
+stripQuotes(const char *currentquery)
+{
+ const char *c;
+ char *q, *qry;
+ q = qry = (char *) malloc(strlen(currentquery) * 2);
+ if( q == NULL){
+ fprintf(stderr,"Could not allocate query buffer of size
"SZFMT"\n", strlen(currentquery) * 2);
+ exit(-1);
+ }
+ for (c= currentquery; *c; ){
+ if ( strncmp(c,"\\\\t",3) == 0){
+ *q++ = '\t';
+ c+=3;
+ } else
+ if ( strncmp(c,"\\\\n",3) == 0){
+ *q++ = '\n';
+ c+=3;
+ } else if ( strncmp(c,"\\\"",2) == 0){
+ *q++= '"';
+ c+=2;
+ } else if ( strncmp(c,"\\\\",2) == 0){
+ c+= 2;
+ } else *q++ = *c++;
+ }
+ *q =0;
return qry;
}
@@ -210,7 +212,7 @@ parseArguments(char *call, int m)
int
eventparser(char *row, EventRecord *ev)
{
- char *c, *cc, *v =0;
+ char *c, *cc, *v =0,*w;
struct tm stm;
malargc = 0;
@@ -228,7 +230,7 @@ eventparser(char *row, EventRecord *ev)
/* scan event record number */
c = row+1;
- if (c == 0)
+ if (*c == 0)
return -2;
ev->eventnr = atoi(c + 1);
@@ -250,6 +252,8 @@ eventparser(char *row, EventRecord *ev)
ev->clkticks += usec;
}
c = strchr(c + 1, '"');
+ if (c == NULL)
+ return -3;
if (ev->clkticks < 0) {
fprintf(stderr, "parser: read negative value "LLFMT"
from\n'%s'\n", ev->clkticks, cc);
}
@@ -390,13 +394,6 @@ eventparser(char *row, EventRecord *ev)
exit(-1);
}
c= ev->fcn;
- if( ev->state == MDB_SYSTEM){
- monetdb_characteristics = strdup(ev->stmt);
- if( ev->stmt == NULL){
- fprintf(stderr,"Could not allocate
monetdb_characteristics memory\n");
- exit(-1);
- }
- } else
if( *c != '[')
{
v=c;
@@ -429,7 +426,25 @@ eventparser(char *row, EventRecord *ev)
if( v)
parseArguments(v+3,1);
}
- if (ev->stmt && (v=strstr(ev->stmt, ";\",\t")))
- *v = 0;
+ // remove some superflous elements
+ w = strrchr(ev->stmt, (int) ']');
+ if(w && *w == ev->stmt[strlen(ev->stmt)-1])
+ *w = 0;
+ w = strrchr(ev->stmt, (int) '\t');
+ if(w && *w == ev->stmt[strlen(ev->stmt)-1])
+ *w = 0;
+ w = strrchr(ev->stmt, (int) ',');
+ if(w && *w == ev->stmt[strlen(ev->stmt)-1])
+ *w = 0;
+ w = strrchr(ev->stmt, (int) '"');
+ if(w && *w == ev->stmt[strlen(ev->stmt)-1])
+ *w = 0;
+ if( ev->state == MDB_SYSTEM){
+ monetdb_characteristics = strdup(ev->stmt);
+ if( ev->stmt == NULL){
+ fprintf(stderr,"Could not allocate
monetdb_characteristics memory\n");
+ exit(-1);
+ }
+ }
return 0;
}
diff --git a/clients/mapiclient/eventparser.h b/clients/mapiclient/eventparser.h
--- a/clients/mapiclient/eventparser.h
+++ b/clients/mapiclient/eventparser.h
@@ -100,5 +100,5 @@ extern char *monetdb_characteristics;
extern void clearArguments(void);
extern void eventdump(void);
extern int eventparser(char *row, EventRecord *ev);
-extern char *stripQuotes(char *currentquery);
+extern char *stripQuotes(const char *currentquery);
#endif /*_EVENT_PARSER_*/
diff --git a/clients/mapiclient/tachograph.c b/clients/mapiclient/tachograph.c
--- a/clients/mapiclient/tachograph.c
+++ b/clients/mapiclient/tachograph.c
@@ -486,7 +486,7 @@ showBar(int level, lng clk, char *stmt)
} else
if( duration && duration- clk > 0){
rendertime(duration - clk,0);
- printf(" %c%s ETC ", (level == 100? '-':' '),stamp);
+ printf(" %s ETC ", stamp);
stamplen= strlen(stamp)+3;
} else
if( duration && duration- clk < 0){
@@ -539,11 +539,23 @@ initFiles(void)
static void
progressBarInit(char *qry)
{
+ char *s;
fprintf(tachojson,"{ \"tachograph\":0.1,\n");
fprintf(tachojson," \"system\":%s,\n",monetdb_characteristics);
fprintf(tachojson,"
\"qid\":\"%s\",\n",currentfunction?currentfunction:"");
- fprintf(tachojson," \"tag\":\"%d\",\n",currenttag);
- fprintf(tachojson," \"query\":\"%s\",\n",qry);
+ fprintf(tachojson," \"tag\":%d,\n",currenttag);
+
+ fprintf(tachojson," \"query\":\"");
+ for(s = qry; *s; s++)
+ switch(*s){
+ case '\n': fputs("\\n", tachojson); break;
+ case '\r': fputs("\\r", tachojson); break;
+ case '\t': fputs("\\t", tachojson); break;
+ case '\b': fputs("\\b", tachojson); break;
+ default: fputc((int) *s, tachojson);
+ }
+ fprintf(tachojson,"\",\n");
+
fprintf(tachojson," \"started\": "LLFMT",\n",starttime);
fprintf(tachojson," \"duration\":"LLFMT",\n",duration);
fprintf(tachojson," \"instructions\":%d\n",malsize);
@@ -556,7 +568,7 @@ update(EventRecord *ev)
{
int progress=0;
int i,j;
- char *v;
+ char *v, *s;
int uid = 0,qid = 0;
char line[BUFSIZ];
char prereq[BUFSIZ]={0};
@@ -684,8 +696,25 @@ update(EventRecord *ev)
fprintf(tachojson,"\"time\": "LLFMT",\n",ev->clkticks);
fprintf(tachojson,"\"status\": \"start\",\n");
fprintf(tachojson,"\"estimate\": "LLFMT",\n",ev->ticks);
- fprintf(tachojson,"\"stmt\": \"%s\",\n",ev->stmt);
- fprintf(tachojson,"\"beautystmt\": \"%s\",\n",line);
+
+ fprintf(tachojson," \"stmt\":\"");
+ for(s = ev->stmt; *s; s++)
+ switch(*s){
+ case '\\':
+ if( *(s+1) == '\\' ) s++;
+ default: fputc((int) *s, tachojson);
+ }
+ fprintf(tachojson,"\",\n");
+
+ fprintf(tachojson," \"beautystmt\":\"");
+ for(s = line; *s; s++)
+ switch(*s){
+ case '\\':
+ if( *(s+1) == '\\' ) s++;
+ default: fputc((int) *s, tachojson);
+ }
+ fprintf(tachojson,"\",\n");
+
// collect all input producing PCs
fprintf(tachojson,"\"prereq\":[");
for( i=0; i < malvartop; i++){
@@ -726,9 +755,25 @@ update(EventRecord *ev)
fprintf(tachojson,"\"time\": "LLFMT",\n",ev->clkticks);
fprintf(tachojson,"\"status\": \"done\",\n");
fprintf(tachojson,"\"ticks\": "LLFMT",\n",ev->ticks);
- fprintf(tachojson,"\"stmt\": \"%s\",\n",ev->stmt);
+ fprintf(tachojson," \"stmt\":\"");
+ for(s = ev->stmt; *s; s++)
+ switch(*s){
+ case '\\':
+ if( *(s+1) == '\\' ) s++;
+ default: fputc((int) *s, tachojson);
+ }
+ fprintf(tachojson,"\",\n");
+
renderCall(line,BUFSIZ, ev->stmt,1,1);
- fprintf(tachojson,"\"beautystmt\": \"%s\"\n",line);
+ fprintf(tachojson," \"beautystmt\":\"");
+ for(s = line; *s; s++)
+ switch(*s){
+ case '\\':
+ if( *(s+1) == '\\' ) s++;
+ default: fputc((int) *s, tachojson);
+ }
+ fprintf(tachojson,"\",\n");
+
fprintf(tachojson,"},\n");
fflush(tachojson);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list