Changeset: 272c586a7ca4 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/272c586a7ca4
Modified Files:
        sql/server/rel_select.c
        sql/server/sql_parser.y
        sql/storage/store.c
Branch: default
Log Message:

Merge with Aug2024


diffs (truncated from 1397 to 300 lines):

diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c
--- a/clients/mapiclient/mclient.c
+++ b/clients/mapiclient/mclient.c
@@ -3879,6 +3879,8 @@ main(int argc, char **argv)
        }
 
        mapi_destroy(mid);
+       if (toConsole != stdout_stream && toConsole != stderr_stream)
+               close_stream(toConsole);
        mnstr_destroy(stdout_stream);
        mnstr_destroy(stderr_stream);
        if (priv.buf != NULL)
diff --git a/clients/mapiclient/mhelp.c b/clients/mapiclient/mhelp.c
--- a/clients/mapiclient/mhelp.c
+++ b/clients/mapiclient/mhelp.c
@@ -88,7 +88,7 @@ SQLhelp sqlhelp1[] = {
         "ALTER USER ident\n"
         "    [WITH [ENCRYPTED | UNENCRYPTED] PASSWORD string]\n"
         "    [SET SCHEMA ident] [SCHEMA PATH string] [DEFAULT ROLE ident]\n"
-        "    [MAX_MEMORY posbytes | NO MAX_MEMORY] [MAX_WORKERS poscount | NO 
MAX_WORKERS]",
+        "    [MAX_MEMORY posbytes | MAX_MEMORY sizestr | NO MAX_MEMORY] 
[MAX_WORKERS poscount | NO MAX_WORKERS]",
         "ident",
         "See also 
https://www.monetdb.org/documentation/user-guide/sql-manual/data-definition/privileges/"},
        {"ANALYZE",
@@ -252,7 +252,7 @@ SQLhelp sqlhelp1[] = {
        {"CREATE USER",
         "Create a new database user",
         "CREATE USER ident WITH [ENCRYPTED | UNENCRYPTED] PASSWORD string NAME 
string [SCHEMA ident] [SCHEMA PATH string]\n"
-        "[MAX_MEMORY posbytes | NO MAX_MEMORY] [MAX_WORKERS poscount | NO 
MAX_WORKERS]\n"
+        "[MAX_MEMORY posbytes | MAX_MEMORY sizestr | NO MAX_MEMORY] 
[MAX_WORKERS poscount | NO MAX_WORKERS]\n"
         "[OPTIMIZER string] [DEFAULT ROLE ident]",
         "ident",
         "See also 
https://www.monetdb.org/documentation/user-guide/sql-manual/data-definition/privileges/"},
diff --git a/clients/mapilib/Tests/tlssecurity.py 
b/clients/mapilib/Tests/tlssecurity.py
--- a/clients/mapilib/Tests/tlssecurity.py
+++ b/clients/mapilib/Tests/tlssecurity.py
@@ -14,10 +14,8 @@ import os
 import re
 import subprocess
 import sys
-import threading
 
-sys.path.append(os.environ.get('TSTSRCDIR','.'))
-import tlstester
+from MonetDBtesting.tlstester import TLSTesterClient
 
 level = logging.WARNING
 # if sys.platform == 'win32':
@@ -27,45 +25,20 @@ if '-v' in sys.argv:
 #level = logging.DEBUG
 logging.basicConfig(level=level)
 
+# A tmpdir to write certificates to
 tgtdir = os.environ['TSTTRGDIR']
 assert os.path.isdir(tgtdir)
+scratchdir = os.path.join(tgtdir, "scratch")
+logging.debug(f"scratchdir={scratchdir}")
 
-hostnames = ['localhost']
-# Generate certificates and write them to the scratch dir
-# Write them to the scratch dir for inspection by the user.
-certs = tlstester.Certs(hostnames)
-certsdir = os.path.join(tgtdir, "certs")
-try:
-    os.mkdir(certsdir)
-except FileExistsError:
-    pass
-count = 0
-for name, content in certs.all().items():
-    with open(os.path.join(certsdir, name), "wb") as a:
-        a.write(content)
-        count += 1
-logging.debug(f"Wrote {count} files to {certsdir}")
+tlstester = TLSTesterClient(scratchdir)
+
 
 def certpath(name):
-    return os.path.join(certsdir, name)
-def certbytes(name):
-    filename = certpath(name)
-    with open(filename, 'rb') as f:
-        return f.read()
-
-# Start the worker threads
-
-server = tlstester.TLSTester(
-    certs=certs,
-    listen_addr='127.0.0.1',
-    preassigned=dict(),
-    sequential=False,
-    hostnames=hostnames)
-server_thread = threading.Thread(target=server.serve_forever, daemon=True)
-server_thread.start()
+    return tlstester.download(name)
 
 def attempt(experiment: str, portname: str, expected_error_regex: str, 
tls=True, host='localhost', **params):
-    port = server.get_port(portname)
+    port = tlstester.get_port(portname)
     scheme = 'monetdbs' if tls else 'monetdb'
     url = f"{scheme}://{host}:{port}/demo"
     if params:
@@ -197,7 +170,7 @@ attempt('connect_server_name', 'sni', No
 # Connect to port 'server1' over TLS, with certhash set to a prefix of the hash
 # of the server certificate in DER form. Have a succesful MAPI exchange.
 
-server1hash = sha256(certs.get_file('server1.der')).hexdigest()
+server1hash = sha256(tlstester.fetch('server1.der')).hexdigest()
 attempt('connect_right_hash', 'server1', None, certhash='sha256:' + 
server1hash[:6])
 
 # connect_wrong_hash
@@ -218,7 +191,7 @@ attempt('connect_wrong_hash', 'server1',
 # Connect to port 'server1' over TLS, with certhash set to a prefix of the hash
 # of the CA1 certificate in DER form. This should fail.
 
-ca1hash = sha256(certs.get_file('ca1.der')).hexdigest()
+ca1hash = sha256(tlstester.fetch('ca1.der')).hexdigest()
 attempt('connect_ca_hash', 'server1', "does not match certhash", 
certhash='sha256:' + ca1hash[:6])
 
 
diff --git a/clients/odbc/driver/ODBCError.c b/clients/odbc/driver/ODBCError.c
--- a/clients/odbc/driver/ODBCError.c
+++ b/clients/odbc/driver/ODBCError.c
@@ -373,27 +373,6 @@ appendODBCError(ODBCError **head, ODBCEr
 }
 
 
-#if 0                          /* unused */
-/*
- * Prepends a valid ODBCError object 'err' to the front of the list
- * of a valid ODBCError object 'head' and return the new head.
- *
- * Precondition: both head and err must be valid (non NULL)
- * Returns: the new head (which is the same as the prepended 'err').
- */
-void
-prependODBCError(ODBCError **head, ODBCError *err)
-{
-       assert(head);
-       assert(err);
-       assert(err->next == NULL);
-
-       err->next = *head;
-       *head = err;
-}
-#endif
-
-
 /*
  * Frees the ODBCError object including its linked ODBCError objects.
  *
diff --git a/clients/odbc/driver/ODBCError.h b/clients/odbc/driver/ODBCError.h
--- a/clients/odbc/driver/ODBCError.h
+++ b/clients/odbc/driver/ODBCError.h
@@ -110,18 +110,6 @@ int getErrorRecCount(ODBCError *error);
 void appendODBCError(ODBCError **head, ODBCError *err);
 
 
-#if 0                          /* unused */
-/*
- * Prepends a valid ODBCError object 'this' to the front of the list
- * of a valid ODBCError object 'head' and return the new head.
- *
- * Precondition: both head and this must be valid (non NULL)
- * Returns: the new head (which is the same as the prepended 'this').
- */
-void prependODBCError(ODBCError **head, ODBCError *err);
-#endif
-
-
 /*
  * Frees the ODBCError object including its linked ODBCError objects.
  *
diff --git a/clients/odbc/driver/SQLConnect.c b/clients/odbc/driver/SQLConnect.c
--- a/clients/odbc/driver/SQLConnect.c
+++ b/clients/odbc/driver/SQLConnect.c
@@ -487,8 +487,12 @@ MNDBConnectSettings(ODBCDbc *dbc, const 
                mapi_reconnect(mid);
        }
        if (mid == NULL || mapi_error(mid)) {
-               const char *error_state = "08001";
+               const char *error_state;
                const char *error_explanation = mid ? mapi_error_str(mid) : 
NULL;
+               if (error_explanation && strncmp(error_explanation, 
"InvalidCredentialsException:", 28) == 0)
+                       error_state = "28000";
+               else
+                       error_state = "08001";
                addDbcError(dbc, error_state, error_explanation, 0);
                if (mid)
                        mapi_destroy(mid);
diff --git a/clients/odbc/samples/CMakeLists.txt 
b/clients/odbc/samples/CMakeLists.txt
--- a/clients/odbc/samples/CMakeLists.txt
+++ b/clients/odbc/samples/CMakeLists.txt
@@ -26,17 +26,9 @@ target_link_libraries(arraytest
   PRIVATE
   ODBC::ODBC)
 
-add_executable(odbcconnect
-  odbcconnect.c)
-
-target_link_libraries(odbcconnect
-  PRIVATE
-  ODBC::ODBC)
-
 install(TARGETS
   odbcsample1
   arraytest
-  odbcconnect
   RUNTIME
   DESTINATION
   ${CMAKE_INSTALL_BINDIR}
@@ -46,7 +38,6 @@ if(WIN32)
   install(FILES
     $<TARGET_PDB_FILE:odbcsample1>
     $<TARGET_PDB_FILE:arraytest>
-    $<TARGET_PDB_FILE:odbcconnect>
     DESTINATION ${CMAKE_INSTALL_BINDIR}
     OPTIONAL)
 endif()
diff --git a/clients/odbc/tests/CMakeLists.txt 
b/clients/odbc/tests/CMakeLists.txt
--- a/clients/odbc/tests/CMakeLists.txt
+++ b/clients/odbc/tests/CMakeLists.txt
@@ -39,11 +39,19 @@ target_link_libraries(ODBCtester
   PRIVATE
   ODBC::ODBC)
 
+add_executable(odbcconnect
+  odbcconnect.c)
+
+target_link_libraries(odbcconnect
+  PRIVATE
+  ODBC::ODBC)
+
 install(TARGETS
   ODBCgetInfo
   ODBCStmtAttr
   ODBCmetadata
   ODBCtester
+  odbcconnect
   RUNTIME
   DESTINATION
   ${CMAKE_INSTALL_BINDIR}
@@ -55,6 +63,7 @@ if(WIN32)
     $<TARGET_PDB_FILE:ODBCStmtAttr>
     $<TARGET_PDB_FILE:ODBCmetadata>
     $<TARGET_PDB_FILE:ODBCtester>
+    $<TARGET_PDB_FILE:odbcconnect>
     DESTINATION ${CMAKE_INSTALL_BINDIR}
     OPTIONAL)
 endif()
diff --git a/clients/odbc/samples/odbcconnect.c 
b/clients/odbc/tests/odbcconnect.c
rename from clients/odbc/samples/odbcconnect.c
rename to clients/odbc/tests/odbcconnect.c
--- a/clients/odbc/samples/odbcconnect.c
+++ b/clients/odbc/tests/odbcconnect.c
@@ -15,6 +15,8 @@
 
 #include <WTypes.h>
 #endif
+
+#include <assert.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdint.h>
@@ -26,17 +28,24 @@ static const char *USAGE =
        "Usage:\n"
        "        odbcconnect [-d | -c | -b ] [-v] [-u USER] [-p PASSWORD] 
TARGET..\n"
        "Options:\n"
-       "        -d              Target is DSN, call SQLConnect()\n"
-       "        -c              Target is connection string, call 
SQLDriverConnect()\n"
+       "        -d              Target is connection string, call 
SQLDriverConnect()\n"
        "        -b              Target is connection string, call 
SQLBrowseConnect()\n"
+       "        -l              List registered drivers and data sources\n"
        "        -u USER\n"
        "        -p PASSWORD\n"
        "        -v              Be verbose\n"
-       "        TARGET          Connection String or DSN\n";
+       "        TARGET          DSN or with -d and -b, Connection String\n";
+
+typedef int (action_t)(SQLCHAR *);
+
+static int do_actions(action_t action, int ntargets, SQLCHAR **targets);
 
-static int do_sqlconnect(SQLCHAR *target);
-static int do_sqldriverconnect(SQLCHAR *target);
-static int do_sqlbrowseconnect(SQLCHAR *target);
+static action_t do_sqlconnect;
+static action_t do_sqldriverconnect;
+static action_t do_sqlbrowseconnect;
+
+static int do_listdrivers(void);
+static int do_listdsns(const char *prefix, SQLSMALLINT dir);
 
 static void ensure_ok(SQLSMALLINT type, SQLHANDLE handle, const char *message, 
SQLRETURN ret);
 
@@ -49,6 +58,7 @@ SQLHANDLE env = NULL;
 SQLHANDLE conn = NULL;
 
 SQLCHAR outbuf[4096];
+SQLCHAR attrbuf[4096];
 
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to