Changeset: 03ef2f1eac20 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=03ef2f1eac20
Modified Files:
        clients/mapilib/mapi.c
        sql/backends/monet5/sql.c
        sql/backends/monet5/sql_result.c
        sql/storage/bat/bat_storage.c
        sql/storage/store.c
Branch: default
Log Message:

Merged with Oct2020


diffs (truncated from 1057 to 300 lines):

diff --git a/clients/mapilib/.editorconfig b/clients/mapilib/.editorconfig
new file mode 100644
--- /dev/null
+++ b/clients/mapilib/.editorconfig
@@ -0,0 +1,3 @@
+[*.{c,h}]
+tab_width = 8
+max_line_length = 72
diff --git a/clients/mapilib/mapi.c b/clients/mapilib/mapi.c
--- a/clients/mapilib/mapi.c
+++ b/clients/mapilib/mapi.c
@@ -1524,8 +1524,7 @@ close_result(MapiHdl hdl)
                       (hdl->npending_close > 0 && hdl->pending_close != NULL));
                if (mid->active &&
                    (mid->active->active != result ||
-                    result->cache.tuplecount < result->row_count))
-               {
+                    result->cache.tuplecount < result->row_count)) {
                        /* results for which we got all tuples at the initial
                         * response, need not to be closed as the server already
                         * did that immediately */
@@ -1689,9 +1688,9 @@ mapi_next_result(MapiHdl hdl)
                        return MERROR;
                if (hdl->result &&
                    (hdl->result->querytype == -1 ||
-                        /* basically exclude Q_PARSE and Q_BLOCK */
-                        (hdl->result->querytype >= Q_TABLE &&
-                         hdl->result->querytype <= Q_PREPARE) ||
+                    /* basically exclude Q_PARSE and Q_BLOCK */
+                    (hdl->result->querytype >= Q_TABLE &&
+                     hdl->result->querytype <= Q_PREPARE) ||
                     hdl->result->errorstr != NULL))
                        return 1;
        }
@@ -1727,9 +1726,9 @@ mapi_more_results(MapiHdl hdl)
        while (result->next) {
                result = result->next;
                if (result->querytype == -1 ||
-                       /* basically exclude Q_PARSE and Q_BLOCK */
-                       (hdl->result->querytype >= Q_TABLE &&
-                        hdl->result->querytype <= Q_PREPARE) ||
+                   /* basically exclude Q_PARSE and Q_BLOCK */
+                   (hdl->result->querytype >= Q_TABLE &&
+                    hdl->result->querytype <= Q_PREPARE) ||
                    result->errorstr != NULL)
                        return true;
        }
@@ -2286,7 +2285,7 @@ mapi_reconnect(Mapi mid)
                                        /* see comment above for why
                                         * we don't stat */
                                        snprintf(buf, sizeof(buf),
-                                                        "%s/.s.monetdb.%d", 
host, MAPI_PORT);
+                                                "%s/.s.monetdb.%d", host, 
MAPI_PORT);
                                        host = buf;
                                }
 #endif
@@ -2479,12 +2478,12 @@ mapi_reconnect(Mapi mid)
                                closesocket(s);
                        }
                        snprintf(errbuf, sizeof(errbuf),
-                                        "could not connect to %s:%s: %s",
-                                        mid->hostname, port,
+                                "could not connect to %s:%s: %s",
+                                mid->hostname, port,
 #ifdef _MSC_VER
-                                        wsaerror(WSAGetLastError())
+                                wsaerror(WSAGetLastError())
 #else
-                                        strerror(errno)
+                                strerror(errno)
 #endif
                                );
                }
@@ -2510,15 +2509,15 @@ mapi_reconnect(Mapi mid)
                praddrlen = (socklen_t) sizeof(praddr.ss);
                if (getsockname(s, (struct sockaddr *) &myaddr.ss, &myaddrlen) 
== 0 &&
                    getpeername(s, (struct sockaddr *) &praddr.ss, &praddrlen) 
== 0 &&
-                       myaddr.ss.ss_family == praddr.ss.ss_family &&
-                       (myaddr.ss.ss_family == AF_INET
-                        ? myaddr.i4.sin_port == praddr.i4.sin_port
-                        : myaddr.i6.sin6_port == praddr.i6.sin6_port) &&
-                       (myaddr.ss.ss_family == AF_INET
-                        ? myaddr.i4.sin_addr.s_addr == 
praddr.i4.sin_addr.s_addr
-                        : memcmp(myaddr.i6.sin6_addr.s6_addr,
-                                         praddr.i6.sin6_addr.s6_addr,
-                                         sizeof(praddr.i6.sin6_addr.s6_addr)) 
== 0)) {
+                   myaddr.ss.ss_family == praddr.ss.ss_family &&
+                   (myaddr.ss.ss_family == AF_INET
+                    ? myaddr.i4.sin_port == praddr.i4.sin_port
+                    : myaddr.i6.sin6_port == praddr.i6.sin6_port) &&
+                   (myaddr.ss.ss_family == AF_INET
+                    ? myaddr.i4.sin_addr.s_addr == praddr.i4.sin_addr.s_addr
+                    : memcmp(myaddr.i6.sin6_addr.s6_addr,
+                             praddr.i6.sin6_addr.s6_addr,
+                             sizeof(praddr.i6.sin6_addr.s6_addr)) == 0)) {
                        closesocket(s);
                        return mapi_setError(mid, "connected to self",
                                             __func__, MERROR);
@@ -2611,7 +2610,7 @@ mapi_reconnect(Mapi mid)
 
                if (mid->username == NULL || mid->password == NULL) {
                        mapi_setError(mid, "username and password must be set",
-                                       __func__, MERROR);
+                                     __func__, MERROR);
                        close_connection(mid);
                        return mid->error;
                }
@@ -2622,7 +2621,7 @@ mapi_reconnect(Mapi mid)
                if (rest == NULL) {
                        /* protocol violation, not enough fields */
                        mapi_setError(mid, "Not enough fields in challenge 
string",
-                                       __func__, MERROR);
+                                     __func__, MERROR);
                        close_connection(mid);
                        return mid->error;
                }
@@ -2658,43 +2657,43 @@ mapi_reconnect(Mapi mid)
 #ifdef HAVE_RIPEMD160_UPDATE
                        if (strcmp(serverhash, "RIPEMD160") == 0) {
                                pwdhash = mcrypt_RIPEMD160Sum(mid->password,
-                                               strlen(mid->password));
+                                                             
strlen(mid->password));
                        } else
 #endif
 #ifdef HAVE_SHA512_UPDATE
                        if (strcmp(serverhash, "SHA512") == 0) {
                                pwdhash = mcrypt_SHA512Sum(mid->password,
-                                               strlen(mid->password));
+                                                          
strlen(mid->password));
                        } else
 #endif
 #ifdef HAVE_SHA384_UPDATE
                        if (strcmp(serverhash, "SHA384") == 0) {
                                pwdhash = mcrypt_SHA384Sum(mid->password,
-                                               strlen(mid->password));
+                                                          
strlen(mid->password));
                        } else
 #endif
 #ifdef HAVE_SHA256_UPDATE
                        if (strcmp(serverhash, "SHA256") == 0) {
                                pwdhash = mcrypt_SHA256Sum(mid->password,
-                                               strlen(mid->password));
+                                                          
strlen(mid->password));
                        } else
 #endif
 #ifdef HAVE_SHA224_UPDATE
                        if (strcmp(serverhash, "SHA224") == 0) {
                                pwdhash = mcrypt_SHA224Sum(mid->password,
-                                               strlen(mid->password));
+                                                          
strlen(mid->password));
                        } else
 #endif
 #ifdef HAVE_SHA1_UPDATE
                        if (strcmp(serverhash, "SHA1") == 0) {
                                pwdhash = mcrypt_SHA1Sum(mid->password,
-                                               strlen(mid->password));
+                                                        strlen(mid->password));
                        } else
 #endif
                        {
                                (void)pwdhash;
                                snprintf(buf, sizeof(buf), "server requires 
unknown hash '%.100s'",
-                                               serverhash);
+                                        serverhash);
                                close_connection(mid);
                                return mapi_setError(mid, buf, __func__, 
MERROR);
                        }
@@ -2702,7 +2701,7 @@ mapi_reconnect(Mapi mid)
 #if defined(HAVE_RIPEMD160_UPDATE) || defined(HAVE_SHA512_UPDATE) || 
defined(HAVE_SHA384_UPDATE) || defined(HAVE_SHA256_UPDATE) || 
defined(HAVE_SHA224_UPDATE) || defined(HAVE_SHA1_UPDATE)
                        if (pwdhash == NULL) {
                                snprintf(buf, sizeof(buf), "allocation failure 
or unknown hash '%.100s'",
-                                               serverhash);
+                                        serverhash);
                                close_connection(mid);
                                return mapi_setError(mid, buf, __func__, 
MERROR);
                        }
@@ -3196,7 +3195,7 @@ MapiMsg
 mapi_bind_numeric(MapiHdl hdl, int fnr, int scale, int prec, void *ptr)
 {
        if (mapi_bind_var(hdl, fnr, MAPI_NUMERIC, ptr))
-                return hdl->mid->error;
+               return hdl->mid->error;
 
        hdl->bindings[fnr].scale = scale;
        hdl->bindings[fnr].precision = prec;
@@ -3253,7 +3252,7 @@ MapiMsg
 mapi_param_numeric(MapiHdl hdl, int fnr, int scale, int prec, void *ptr)
 {
        if (mapi_param_type(hdl, fnr, MAPI_NUMERIC, MAPI_NUMERIC, ptr))
-                return hdl->mid->error;
+               return hdl->mid->error;
 
        hdl->params[fnr].scale = scale;
        hdl->params[fnr].precision = prec;
@@ -3373,7 +3372,6 @@ mapi_prepare(Mapi mid, const char *cmd)
                                free(q);                        \
                                return;                         \
                        }                                       \
-                       hdl->query = q;                         \
                }                                               \
        } while (0)
 
@@ -3476,30 +3474,30 @@ mapi_param_store(MapiHdl hdl)
                        case MAPI_DATE:
                                checkSpace(50);
                                snprintf(hdl->query + k, lim - k,
-                                       "DATE '%04hd-%02hu-%02hu'",
-                                       ((MapiDate *) src)->year,
-                                       ((MapiDate *) src)->month,
-                                       ((MapiDate *) src)->day);
+                                        "DATE '%04hd-%02hu-%02hu'",
+                                        ((MapiDate *) src)->year,
+                                        ((MapiDate *) src)->month,
+                                        ((MapiDate *) src)->day);
                                break;
                        case MAPI_TIME:
                                checkSpace(60);
                                snprintf(hdl->query + k, lim - k,
-                                       "TIME '%02hu:%02hu:%02hu'",
-                                       ((MapiTime *) src)->hour,
-                                       ((MapiTime *) src)->minute,
-                                       ((MapiTime *) src)->second);
+                                        "TIME '%02hu:%02hu:%02hu'",
+                                        ((MapiTime *) src)->hour,
+                                        ((MapiTime *) src)->minute,
+                                        ((MapiTime *) src)->second);
                                break;
                        case MAPI_DATETIME:
                                checkSpace(110);
                                snprintf(hdl->query + k, lim - k,
-                                       "TIMESTAMP '%04hd-%02hu-%02hu 
%02hu:%02hu:%02hu.%09u'",
-                                       ((MapiDateTime *) src)->year,
-                                       ((MapiDateTime *) src)->month,
-                                       ((MapiDateTime *) src)->day,
-                                       ((MapiDateTime *) src)->hour,
-                                       ((MapiDateTime *) src)->minute,
-                                       ((MapiDateTime *) src)->second,
-                                       ((MapiDateTime *) src)->fraction);
+                                        "TIMESTAMP '%04hd-%02hu-%02hu 
%02hu:%02hu:%02hu.%09u'",
+                                        ((MapiDateTime *) src)->year,
+                                        ((MapiDateTime *) src)->month,
+                                        ((MapiDateTime *) src)->day,
+                                        ((MapiDateTime *) src)->hour,
+                                        ((MapiDateTime *) src)->minute,
+                                        ((MapiDateTime *) src)->second,
+                                        ((MapiDateTime *) src)->fraction);
                                break;
                        case MAPI_CHAR:
                                buf[0] = *(char *) src;
@@ -3835,7 +3833,7 @@ mapi_extend_cache(struct MapiResultSet *
        }
 
        /* extend row cache */
-      retry:;
+  retry:;
        if (oldsize == 0)
                incr = 100;
        else
@@ -3940,10 +3938,10 @@ parse_header_line(MapiHdl hdl, char *lin
                                   &queryid, &result->querytime,
                                   &result->maloptimizertime,
                                   &result->sqloptimizertime) < 8){
-                                       result->querytime = 0;
-                                       result->maloptimizertime = 0;
-                                       result->sqloptimizertime = 0;
-                               }
+                               result->querytime = 0;
+                               result->maloptimizertime = 0;
+                               result->sqloptimizertime = 0;
+                       }
                        (void) queryid; /* ignored for now */
                        break;
                case Q_PREPARE:
@@ -4305,9 +4303,8 @@ read_into_cache(MapiHdl hdl, int lookahe
                           yet (duh!), or if we've already seen
                           normal output for the current one */
                        if (result == NULL ||
-                                       result->cache.writer > 0 ||
-                                       result->querytype > 0)
-                       {
+                           result->cache.writer > 0 ||
+                           result->querytype > 0) {
                                result = new_result(hdl);
                                result->commentonly = false;
                                hdl->active = result;
@@ -4716,13 +4713,13 @@ mapi_fetch_line(MapiHdl hdl)
                if (hdl->mid->tracelog) {
                        mapi_log_header(hdl->mid, "W");
                        mnstr_printf(hdl->mid->tracelog, "X" "export %d %" 
PRId64 "\n",
-                                     result->tableid,
-                                     result->cache.first + 
result->cache.tuplecount);
+                                    result->tableid,
+                                    result->cache.first + 
result->cache.tuplecount);
                        mnstr_flush(hdl->mid->tracelog, MNSTR_FLUSH_DATA);
                }
                if (mnstr_printf(hdl->mid->to, "X" "export %d %" PRId64 "\n",
-                                 result->tableid,
-                                 result->cache.first + 
result->cache.tuplecount) < 0 ||
+                                result->tableid,
+                                result->cache.first + 
result->cache.tuplecount) < 0 ||
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to