Changeset: 5babd737c3a4 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=5babd737c3a4
Modified Files:
clients/Tests/exports.stable.out
clients/mapilib/mapi.c
gdk/gdk.h
gdk/gdk_aggr.c
gdk/gdk_align.c
gdk/gdk_bat.c
gdk/gdk_batop.c
gdk/gdk_calc.c
gdk/gdk_group.c
gdk/gdk_logger.c
gdk/gdk_select.c
monetdb5/mal/mal_authorize.c
monetdb5/mal/mal_debugger.c
monetdb5/mal/mal_function.c
monetdb5/mal/mal_parser.c
monetdb5/mal/mal_profiler.c
monetdb5/mal/mal_resolve.c
monetdb5/modules/kernel/algebra.c
monetdb5/modules/kernel/bat5.c
monetdb5/modules/mal/batcalc.c
monetdb5/modules/mal/inspect.c
monetdb5/modules/mal/mat.c
monetdb5/modules/mal/querylog.c
sql/backends/monet5/sql.c
sql/server/rel_optimizer.c
sql/storage/bat/bat_storage.c
sql/storage/bat/bat_table.c
sql/storage/bat/bat_utils.c
Branch: leftmart
Log Message:
Merge with default branch.
diffs (truncated from 1963 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
@@ -106,7 +106,6 @@ void BATcommit(BAT *b);
BAT *BATconst(BAT *l, int tt, const void *val, int role);
BAT *BATconstant(int tt, const void *val, BUN cnt, int role);
BAT *BATconvert(BAT *b, BAT *s, int tp, int abort_on_error);
-BAT *BATcopy(BAT *b, int ht, int tt, int writeable, int role);
BUN BATcount_no_nil(BAT *b);
gdk_return BATdel(BAT *b, BAT *c, bit force);
BAT *BATdelta(BAT *b);
@@ -211,6 +210,7 @@ BUN BUNdelete(BAT *b, BUN p, bit force);
BUN BUNfnd(BAT *b, const void *right);
gdk_return BUNinplace(BAT *b, BUN p, const void *left, const void *right, bit
force);
gdk_return BUNreplace(BAT *b, const void *left, const void *right, bit force);
+BAT *COLcopy(BAT *b, int tt, int writeable, int role);
size_t GDK_mem_maxsize;
size_t GDK_vm_maxsize;
int GDK_vm_trim;
diff --git a/clients/mapilib/mapi.c b/clients/mapilib/mapi.c
--- a/clients/mapilib/mapi.c
+++ b/clients/mapilib/mapi.c
@@ -1006,18 +1006,13 @@ struct MapiStatement {
mapi_clrError((X)->mid); \
} while (0)
-static Mapi mapi_new(void);
static int mapi_extend_bindings(MapiHdl hdl, int minbindings);
static int mapi_extend_params(MapiHdl hdl, int minparams);
-static MapiMsg mapi_setError(Mapi mid, const char *msg, const char *action,
MapiMsg error);
static void close_connection(Mapi mid);
static MapiMsg read_into_cache(MapiHdl hdl, int lookahead);
static int unquote(const char *msg, char **start, const char **next, int
endchar, size_t *lenp);
static int mapi_slice_row(struct MapiResultSet *result, int cr);
static void mapi_store_bind(struct MapiResultSet *result, int cr);
-static void parse_uri_query(Mapi mid, char *uri);
-static void set_uri(Mapi mid);
-static MapiMsg connect_to_server(Mapi mid);
static int mapi_initialized = 0;
@@ -1872,9 +1867,9 @@ mapi_new(void)
mid->index = index++; /* for distinctions in log records */
mid->auto_commit = 1;
mid->error = MOK;
- mid->hostname = strdup("localhost");
+ mid->hostname = NULL;
mid->server = NULL;
- mid->language = strdup("sql");
+ mid->language = NULL;
mid->languageId = LANG_SQL;
mid->noexplain = NULL;
@@ -1901,380 +1896,9 @@ mapi_new(void)
mid->first = NULL;
- if (mid->hostname == NULL || mid->language == NULL) {
- /* strdup failed, give up */
- mapi_destroy(mid);
- return NULL;
- }
-
return mid;
}
-Mapi
-mapi_mapiuri(const char *url, const char *user, const char *pass, const char
*lang)
-{
- char *uri;
- char *host;
- int port;
- char *dbname;
- char *p;
- Mapi mid;
-
- if (!mapi_initialized) {
- mapi_initialized = 1;
- if (mnstr_init() < 0)
- return NULL;
- }
-
- mid = mapi_new();
- if (mid == NULL)
- return NULL;
-
- if (url == NULL) {
- mapi_setError(mid, "url is null", "mapi_mapiuri", MERROR);
- return mid;
- }
- if (user == NULL) {
- mapi_setError(mid, "user is null", "mapi_mapiuri", MERROR);
- return mid;
- }
- if (pass == NULL) {
- mapi_setError(mid, "pass is null", "mapi_mapiuri", MERROR);
- return mid;
- }
- if (lang == NULL) {
- mapi_setError(mid, "lang is null", "mapi_mapiuri", MERROR);
- return mid;
- }
-
- if (strncmp(url, "mapi:monetdb://", sizeof("mapi:monetdb://") - 1) !=
0) {
- mapi_setError(mid,
- "url has unsupported scheme, "
- "expecting mapi:monetdb://...",
- "mapi_mapiuri", MERROR);
- return mid;
- }
-
- /* copy to a writable working buffer */
- uri = strdup(url + sizeof("mapi:monetdb://") - 1);
-
- if (uri[0] != '/') {
- if ((p = strchr(uri, ':')) == NULL) {
- mapi_setError(mid, "URI must contain a port number
after "
- "the hostname", "mapi_mapiuri", MERROR);
- free(uri);
- return mid;
- }
- *p++ = '\0';
- dbname = p; /* temp misuse */
- host = uri;
- if ((p = strchr(dbname, '/')) == NULL) {
- p = dbname;
- dbname = NULL;
- } else {
- *p++ = '\0';
- if (*p == '\0') {
- p = dbname;
- dbname = NULL;
- } else {
- char *t = dbname;
- dbname = p;
- p = t;
- }
- }
- port = atoi(p);
- if (port <= 0) {
- mapi_setError(mid, "URI contains invalid port",
- "mapi_mapiuri", MERROR);
- free(uri);
- return mid;
- }
- } else {
- host = uri;
- port = 0;
- dbname = NULL;
- }
-
- mid->port = port;
- if (mid->username != NULL)
- free(mid->username);
- mid->username = strdup(user);
- if (mid->password)
- free(mid->password);
- mid->password = strdup(pass);
- free(mid->language);
- mid->language = strdup(lang);
- if (strcmp(lang, "mal") == 0 || strcmp(lang, "msql") == 0)
- mid->languageId = LANG_MAL;
- else if (strstr(lang, "sql") == lang)
- mid->languageId = LANG_SQL;
- else if (strstr(lang, "profiler") == lang)
- mid->languageId = LANG_PROFILER;
- if (mid->database)
- free(mid->database);
- mid->database = NULL;
-
- /* this is in particular important for unix sockets */
- parse_uri_query(mid, uri);
-
- /* doing this here, because parse_uri_query will terminate the
- * string if a ? is in place */
- if (mid->hostname)
- free(mid->hostname);
- mid->hostname = strdup(host);
- if (mid->database == NULL && dbname != NULL)
- mid->database = strdup(dbname);
-
- set_uri(mid);
- free(uri);
-
- return mid;
-}
-
-/* Allocate a new connection handle and fill in the information needed
- to connect to a server, but don't connect yet. */
-Mapi
-mapi_mapi(const char *host, int port, const char *username,
- const char *password, const char *lang, const char *dbname)
-{
- Mapi mid;
-#ifdef HAVE_SYS_UN_H
- char buf[1024];
-#endif
-
- if (!mapi_initialized) {
- mapi_initialized = 1;
- if (mnstr_init() < 0)
- return NULL;
- }
-
- mid = mapi_new();
- if (mid == NULL)
- return NULL;
-
- /* connection searching strategy:
- * 0) if host and port are given, resort to those
- * 1) if no dbname given, make TCP connection (merovingian will
- * complain regardless, so it is more likely an mserver is
- * meant to be directly addressed)
- * a) resort to default (hardwired) port 50000, unless port given,
then
- * b) resort to port given
- * 2) a dbname is given
- * a) if a port is given, open unix socket for that port, resort
- * to TCP connection if not found
- * b) no port given, start looking for a matching merovingian, by
- * searching through socket files, attempting connect to given
- * dbname
- * I) try available sockets that have a matching owner with
- * the current user
- * II) try other sockets
- * III) resort to TCP connection on hardwired port
- * (localhost:50000)
- */
- if (host != NULL && port != 0) {
- /* case 0), just do what the user told us */
-#ifdef HAVE_SYS_UN_H
- if (*host == '/') {
- /* don't stat or anything, the connect_to_server will
return
- * the error if it doesn't exists, falling back to TCP
with
- * a hostname like '/var/sockets' won't work anyway */
- snprintf(buf, sizeof(buf), "%s/.s.monetdb.%d", host,
port);
- host = buf;
- }
-#endif
- } else if (dbname == NULL) {
- /* case 1) */
- if (port == 0)
- port = 50000; /* case 1a), hardwired default */
- if (host == NULL)
- host = "localhost";
- } else {
- /* case 2), dbname is given */
- if (port != 0) {
- /* case 2a), if unix socket found, use it, otherwise
TCP */
-#ifdef HAVE_SYS_UN_H
- struct stat st;
- snprintf(buf, sizeof(buf), "/tmp/.s.monetdb.%d", port);
- if (stat(buf, &st) != -1 && S_ISSOCK(st.st_mode))
- host = buf;
- else
-#endif
- host = "localhost";
- } else if (host != NULL) {
-#ifdef HAVE_SYS_UN_H
- if (*host == '/') {
- /* see comment above for why we don't stat */
- snprintf(buf, sizeof(buf),
"%s/.s.monetdb.50000", host);
- host = buf;
- }
-#endif
- port = 50000;
- } else {
- /* case 2b), no host, no port, but a dbname, search for
meros */
-#ifdef HAVE_SYS_UN_H
- DIR *d;
- struct dirent *e;
- struct stat st;
- char found = 0;
- struct {
- int port;
- uid_t owner;
- } socks[24];
- int i = 0;
- int len;
- uid_t me = getuid();
-
- d = opendir("/tmp");
- if (d != NULL) {
- while ((e = readdir(d)) != NULL) {
- if (strncmp(e->d_name, ".s.monetdb.",
11) != 0)
- continue;
- if (snprintf(buf, sizeof(buf),
"/tmp/%s", e->d_name) >= (int) sizeof(buf))
- continue; /* ignore long name */
- if (stat(buf, &st) != -1 &&
S_ISSOCK(st.st_mode)) {
- socks[i].owner = st.st_uid;
- socks[i++].port =
atoi(e->d_name + 11);
- }
- if (i == sizeof(socks) /
sizeof(socks[0]))
- break;
- }
- closedir(d);
- len = i;
- /* case 2bI) first those with a matching owner
*/
- for (i = 0; found == 0 && i < len; i++) {
- if (socks[i].port != 0 &&
- socks[i].owner == me) {
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list