Changeset: 697402c96124 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=697402c96124
Modified Files:
clients/Tests/exports.stable.out
clients/mapiclient/eventparser.c
clients/mapiclient/mnc.c
clients/mapiclient/stethoscope.c
clients/mapiclient/tachograph.c
clients/mapiclient/tomograph.c
clients/mapilib/mapi.c
clients/mapilib/mapi.h
clients/odbc/driver/ODBCConvert.c
clients/odbc/driver/ODBCDesc.c
common/stream/ChangeLog
common/stream/stream.c
common/stream/stream.h
common/stream/stream_socket.h
common/utils/msabaoth.c
common/utils/mutils.c
configure.ag
gdk/gdk_align.c
gdk/gdk_atoms.c
gdk/gdk_bat.c
gdk/gdk_logger.c
gdk/gdk_utils.c
monetdb5/mal/Tests/tst1150.malC
monetdb5/mal/mal_client.c
monetdb5/mal/mal_import.c
monetdb5/mal/mal_instruction.c
monetdb5/mal/mal_session.c
monetdb5/modules/atoms/inet.c
monetdb5/modules/atoms/mtime.c
monetdb5/modules/atoms/streams.c
monetdb5/modules/atoms/url.c
monetdb5/modules/mal/mal_io.c
monetdb5/modules/mal/mal_mapi.c
monetdb5/modules/mal/tablet.c
monetdb5/modules/mal/tokenizer.c
monetdb5/optimizer/opt_pushselect.c
sql/backends/monet5/UDF/capi/capi.c
sql/backends/monet5/sql.c
sql/backends/monet5/sql_gencode.c
sql/backends/monet5/sql_result.c
sql/backends/monet5/sql_scenario.c
sql/backends/monet5/vaults/bam/bam_export.c
sql/backends/monet5/vaults/bam/bam_globals.c
sql/backends/monet5/vaults/bam/bam_globals.h
sql/backends/monet5/vaults/bam/bam_loader.c
sql/backends/monet5/vaults/bam/bam_wrapper.c
sql/backends/monet5/wlr.c
sql/server/rel_optimizer.c
sql/server/rel_sequence.c
sql/server/sql_atom.c
sql/server/sql_partition.c
sql/storage/store.c
sql/test/BugTracker-2012/Tests/update_crash.Bug-2655.sql
sql/test/BugTracker-2012/Tests/update_crash.Bug-2655.stable.out
sql/test/Tests/seq-default.stable.out
sql/test/seq-default.sql
tools/merovingian/daemon/client.c
tools/merovingian/daemon/connections.c
tools/merovingian/daemon/proxy.c
tools/merovingian/utils/control.c
Branch: analytics
Log Message:
Merge with default
diffs (truncated from 4111 to 300 lines):
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
@@ -2727,7 +2727,6 @@ size_t getFileSize(stream *s);
stream *iconv_rstream(stream *restrict ss, const char *restrict charset, const
char *restrict name);
stream *iconv_wstream(stream *restrict ss, const char *restrict charset, const
char *restrict name);
bool isa_block_stream(stream *s);
-int mnstr_byteorder(stream *s);
void mnstr_clearerr(stream *s);
void mnstr_close(stream *s);
void mnstr_destroy(stream *s);
@@ -2738,8 +2737,10 @@ int mnstr_flush(stream *s);
int mnstr_fsetpos(stream *restrict s, fpos_t *restrict p);
int mnstr_fsync(stream *s);
buffer *mnstr_get_buffer(stream *s);
+bool mnstr_get_swapbytes(stream *s);
int mnstr_init(void);
int mnstr_isalive(stream *s);
+bool mnstr_isbinary(stream *s);
char *mnstr_name(stream *s);
int mnstr_printf(stream *restrict s, _In_z_ _Printf_format_string_ const char
*restrict format, ...) __attribute__((__format__(__printf__, 2, 3)));
ssize_t mnstr_read(stream *restrict s, void *restrict buf, size_t elmsize,
size_t cnt);
@@ -2757,9 +2758,8 @@ int mnstr_readShtArray(stream *restrict
int mnstr_readStr(stream *restrict s, char *restrict val);
ssize_t mnstr_read_block(stream *restrict s, void *restrict buf, size_t
elmsize, size_t cnt);
ssize_t mnstr_readline(stream *restrict s, void *restrict buf, size_t maxcnt);
-void mnstr_set_byteorder(stream *s, char bigendian);
+void mnstr_set_bigendian(stream *s, bool bigendian);
void mnstr_settimeout(stream *s, unsigned int ms, bool( *func)(void));
-int mnstr_type(stream *s);
ssize_t mnstr_write(stream *restrict s, const void *restrict buf, size_t
elmsize, size_t cnt);
int mnstr_writeBte(stream *s, int8_t val);
int mnstr_writeBteArray(stream *restrict s, const int8_t *restrict val, size_t
cnt);
@@ -2780,9 +2780,7 @@ stream *open_rstream(const char *filenam
stream *open_urlstream(const char *url);
stream *open_wastream(const char *filename);
stream *open_wstream(const char *filename);
-stream *socket_rastream(SOCKET socket, const char *name);
stream *socket_rstream(SOCKET socket, const char *name);
-stream *socket_wastream(SOCKET socket, const char *name);
stream *socket_wstream(SOCKET socket, const char *name);
stream *stream_blackhole_create(void);
stream *stream_fwf_create(stream *restrict s, size_t num_fields, size_t
*restrict widths, char filler);
diff --git a/clients/mapiclient/eventparser.c b/clients/mapiclient/eventparser.c
--- a/clients/mapiclient/eventparser.c
+++ b/clients/mapiclient/eventparser.c
@@ -114,8 +114,9 @@ resetEventRecord(EventRecord *ev)
if( ev->numa) free(ev->numa);
if(ev->beauty) free(ev->beauty);
if(ev->prereq) free(ev->prereq);
- memset( (char*) ev, 0, sizeof(EventRecord));
- ev->eventnr = -1;
+ *ev = (EventRecord) {
+ .eventnr = -1,
+ };
clearArguments();
}
@@ -353,7 +354,7 @@ lineparser(char *row, EventRecord *ev)
return -3;
/* convert time to epoch in seconds*/
cc =c;
- memset(&stm, 0, sizeof(struct tm));
+ stm = (struct tm) {0};
#ifdef HAVE_STRPTIME
c = strptime(c + 1, "%H:%M:%S", &stm);
ev->clkticks = (((int64_t) stm.tm_hour * 60 + stm.tm_min) * 60 +
stm.tm_sec) * 1000000;
diff --git a/clients/mapiclient/mnc.c b/clients/mapiclient/mnc.c
--- a/clients/mapiclient/mnc.c
+++ b/clients/mapiclient/mnc.c
@@ -155,10 +155,11 @@ main(int argc, char **argv)
snprintf(sport, sizeof(sport), "%d", port & 0xFFFF);
- memset(&hints, 0, sizeof(hints));
- hints.ai_family = AF_UNSPEC;
- hints.ai_socktype = SOCK_STREAM;
- hints.ai_protocol = IPPROTO_TCP;
+ hints = (struct addrinfo) {
+ .ai_family = AF_UNSPEC,
+ .ai_socktype = SOCK_STREAM,
+ .ai_protocol = IPPROTO_TCP,
+ };
ret = getaddrinfo(host, sport, &hints, &res);
if (ret) {
fprintf(stderr, "getaddrinfo failed: %s\n",
gai_strerror(ret));
@@ -194,10 +195,11 @@ main(int argc, char **argv)
fprintf(stderr, "gethostbyname failed: %s\n", errno ?
strerror(errno) : hstrerror(h_errno));
exit(1);
}
- memset(&server, 0, sizeof(server));
+ server = (struct sockaddr_in) {
+ .sin_family = hp->h_addrtype,
+ .sin_port = htons((unsigned short) port),
+ };
memcpy(&server.sin_addr, hp->h_addr_list[0], hp->h_length);
- server.sin_family = hp->h_addrtype;
- server.sin_port = htons((unsigned short) (port & 0xFFFF));
s = socket(server.sin_family, SOCK_STREAM
#ifdef SOCK_CLOEXEC
| SOCK_CLOEXEC
@@ -277,8 +279,8 @@ main(int argc, char **argv)
#endif
}
- out = socket_wastream(s, "ascii write stream");
- in = socket_rastream(s, "ascii read stream");
+ out = socket_wstream(s, "write stream");
+ in = socket_rstream(s, "read stream");
if (block) {
out = block_stream(out);
diff --git a/clients/mapiclient/stethoscope.c b/clients/mapiclient/stethoscope.c
--- a/clients/mapiclient/stethoscope.c
+++ b/clients/mapiclient/stethoscope.c
@@ -186,7 +186,7 @@ convertOldFormat(char *inputfile)
}
fprintf(trace,"[\n{");
len = 0;
- memset(&event, 0, sizeof(event));
+ event = (EventRecord) {0};
while (fgets(buf + len, (int) (bufsize - len), fdin) != NULL) {
while ((e = strchr(buf + len, '\n')) == NULL) {
/* rediculously long line */
diff --git a/clients/mapiclient/tachograph.c b/clients/mapiclient/tachograph.c
--- a/clients/mapiclient/tachograph.c
+++ b/clients/mapiclient/tachograph.c
@@ -319,8 +319,7 @@ update(EventRecord *ev)
if(ev->fcn && strstr(ev->fcn,"querylog.define") ){
// extract a string argument from a known MAL signature
maxevents = malsize;
- events = (Event*) malloc(maxevents * sizeof(Event));
- memset((char*)events, 0, maxevents * sizeof(Event));
+ events = calloc(maxevents, sizeof(Event));
// use the truncated query text, beware that the \ is
already escaped in the call argument.
if(currentquery) {
if( prevquery &&
strcmp(currentquery,prevquery)){
diff --git a/clients/mapiclient/tomograph.c b/clients/mapiclient/tomograph.c
--- a/clients/mapiclient/tomograph.c
+++ b/clients/mapiclient/tomograph.c
@@ -1370,12 +1370,10 @@ update(char *line, EventRecord *ev)
int uid = 0,qid = 0;
if (topbox == maxbox || maxbox < topbox) {
-
if( box == 0){
- box = (Box*) malloc(MAXBOX * sizeof(Box));
- memset((char*) box, 0, sizeof(Box) * MAXBOX);
+ box = calloc(MAXBOX, sizeof(Box));
} else
- box = (Box*) realloc((void*)box, (maxbox + MAXBOX) *
sizeof(Box));
+ box = realloc(box, (maxbox + MAXBOX) * sizeof(Box));
if( box == NULL){
fprintf(stderr, "Out of space for trace, exceeds max
entries %d\n", maxbox);
fprintf(stderr, "Restart with a slower beat might help,
e.g. --beat=5000 or --beat=0\n");
diff --git a/clients/mapilib/mapi.c b/clients/mapilib/mapi.c
--- a/clients/mapilib/mapi.c
+++ b/clients/mapilib/mapi.c
@@ -162,15 +162,15 @@
* #include <stdio.h>
* #include <mapi.h>
* #include <stdlib.h>
- *
+ *
* int
* main(int argc, char** argv) {
* const char *prog = argv[0];
- * const char *host = argv[1]; // where Mserver is started, e.g.
localhost
- * const char *db = argv[2]; // database name e.g. demo
- * int port = atoi(argv[3]); // mapi_port e.g. 50000
- * char *mode = argv[4]; // output format e.g. xml
- * const char *query = argv[5]; // single-line query e.g. '1+1' (use
quotes)
+ * const char *host = argv[1]; // where Mserver is started, e.g. localhost
+ * const char *db = argv[2]; // database name e.g. demo
+ * int port = atoi(argv[3]); // mapi_port e.g. 50000
+ * char *mode = argv[4]; // output format e.g. xml
+ * const char *query = argv[5]; // single-line query e.g. '1+1' (use
quotes)
* FILE *fp = stderr;
* char *line;
*
@@ -178,31 +178,31 @@
* fprintf(fp, "usage: %s <host> <db> <port> <mode> <query>\n",
prog);
* fprintf(fp, " e.g. %s localhost demo 50000 xml '1+1'\n",
prog);
* } else {
- * // CONNECT TO SERVER, default unsecure user/password,
language="sql"
+ * // CONNECT TO SERVER, default unsecure user/password,
language="sql"
* Mapi mid = mapi_connect(host, port, "monetdb", "monetdb",
"sql", db);
* MapiHdl hdl;
* if (mid == NULL) {
* fprintf(fp, "%s: failed to connect.\n", prog);
* } else {
- * hdl = mapi_query(mid, query); // FIRE OFF A QUERY
+ * hdl = mapi_query(mid, query); // FIRE OFF A QUERY
*
- * if (hdl == NULL || mapi_error(mid) != MOK) // CHECK
CONNECTION ERROR
- * fprintf(fp, "%s: connection error: %s\n", prog,
mapi_error_str(mid)); // GET CONNECTION ERROR STRING
+ * if (hdl == NULL || mapi_error(mid) != MOK) // CHECK
CONNECTION ERROR
+ * fprintf(fp, "%s: connection error: %s\n", prog,
mapi_error_str(mid)); // GET CONNECTION ERROR STRING
* if (hdl) {
- * if (mapi_result_error(hdl) != MOK) // CHECK
QUERY ERROR
+ * if (mapi_result_error(hdl) != MOK) // CHECK
QUERY ERROR
* fprintf(fp, "%s: query error\n", prog);
* else
- * fp = stdout; // success:
connection&query went ok
+ * fp = stdout; // success:
connection&query went ok
*
- * // FETCH SERVER QUERY ANSWER LINE-BY-LINE
+ * // FETCH SERVER QUERY ANSWER LINE-BY-LINE
* while((line = mapi_fetch_line(hdl)) != NULL) {
* if (*line == '=') line++; // XML result
lines start with '='
* fprintf(fp, "%s\n", line);
* }
* }
- * mapi_close_handle(hdl); // CLOSE QUERY HANDLE
+ * mapi_close_handle(hdl); // CLOSE QUERY HANDLE
* }
- * mapi_disconnect(mid); // CLOSE CONNECTION
+ * mapi_disconnect(mid); // CLOSE CONNECTION
* }
* return (fp == stdout)? 0 : -1;
* }
@@ -471,7 +471,7 @@
*
* @item int64_t mapi_get_last_id(MapiHdl mid)
*
- * If possible, return the last inserted id of auto_increment (or alike)
column.
+ * If possible, return the last inserted id of auto_increment (or alike)
column.
* A -1 is returned if this information is not available. We restrict this to
* single row inserts and one auto_increment column per table. If the
restrictions
* do not hold, the result is unspecified.
@@ -807,7 +807,7 @@ enum mapi_lang_t {
*/
struct MapiStruct {
char *server; /* server version */
- char *mapiversion; /* mapi version */
+ const char *mapiversion; /* mapi version */
char *hostname;
int port;
char *username;
@@ -838,7 +838,7 @@ struct MapiStruct {
stream *tracelog; /* keep a log for inspection */
stream *from, *to;
- int index; /* to mark the log records */
+ uint32_t index; /* to mark the log records */
};
struct MapiResultSet {
@@ -976,7 +976,7 @@ static bool mapi_initialized = false;
* The server side code works with a common/stream package, a fast
* buffered IO scheme. Nowadays this should be the only protocol used,
* while historical uses were line-based instead.
- *
+ *
*
* Error Handling
* --------------
@@ -1333,18 +1333,19 @@ mapi_log_header(Mapi mid, char *mark)
static int64_t firstcall = 0;
int64_t now;
- if (mid->tracelog == NULL)
- return;
if (firstcall == 0)
firstcall = usec();
now = (usec() - firstcall) / 1000;
- mnstr_printf(mid->tracelog, ":%"PRId64"[%d]:%s\n", now, mid->index,
mark);
+ mnstr_printf(mid->tracelog, ":%" PRId64 "[%" PRIu32 "]:%s\n",
+ now, mid->index, mark);
mnstr_flush(mid->tracelog);
}
static void
mapi_log_record(Mapi mid, const char *msg)
{
+ if (mid->tracelog == NULL)
+ return;
mapi_log_header(mid, "W");
mnstr_printf(mid->tracelog, "%s", msg);
mnstr_flush(mid->tracelog);
@@ -1363,7 +1364,7 @@ mapi_log(Mapi mid, const char *nme)
mid->tracelog = open_wastream(nme);
if (mid->tracelog == NULL || mnstr_errnr(mid->tracelog)) {
if (mid->tracelog)
- mnstr_destroy(mid->tracelog);
+ close_stream(mid->tracelog);
mid->tracelog = NULL;
return mapi_setError(mid, "Could not create log file",
"mapi_log", MERROR);
}
@@ -1408,7 +1409,15 @@ new_result(MapiHdl hdl)
result = malloc(sizeof(*result));
if (result == NULL)
return NULL;
- result->next = NULL;
+ *result = (struct MapiResultSet) {
+ .hdl = hdl,
+ .tableid = -1,
+ .querytype = -1,
+ .last_id = -1,
+ .cache.rowlimit = hdl->mid->cachelimit,
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list