Changeset: e3d40de6fc88 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/e3d40de6fc88
Branch: label
Log Message:

merged with default


diffs (truncated from 1386 to 300 lines):

diff --git a/clients/odbc/ChangeLog b/clients/odbc/ChangeLog
--- a/clients/odbc/ChangeLog
+++ b/clients/odbc/ChangeLog
@@ -1,3 +1,24 @@
 # ChangeLog file for odbc
 # This file is updated with Maddlog
 
+* Fri May 24 2024 Joeri van Ruth <joeri.van.r...@monetdbsolutions.com>
+- ODBC now supports TLS. It can be configured through the following
+  DSN- or Connection String attributes (canonical name / user friendly name):
+    TLS / Encrypt = ON/OFF
+    CERT / Server Certificate = PATH
+    CERTHASH / Server Certificate Hash = sha256:HEXDIGITS
+    CLIENTKEY / Client Key = PATH
+    CLIENTCERT / Client Certificate = PATH
+    AUTOCOMMIT / Autocommit = ON/OFF
+- Several more connection properties have been made configurable:
+    SCHEMA / Schema = NAME
+    TIMEZONE / Time Zone = Minutes East Of UTC
+    REPLYSIZE / Reply Size = NUMBER
+    LOGFILE / Log File = PATH
+    LOGINTIMEOUT / Login Timeout = MILLISECONDS
+    CONNECTIONTIMEOUT / Connection Timeout = MILLISECONDS
+    SOCK / Unix Socket = PATH (unix only)
+- SQLBrowseConnect adds On/Off suggestions to boolean settings
+  and prioritizes the DATABASE attribute if it notices monetdbd
+  requires one. Apart from that only UID/User and PWD/Password
+  are required, all others have sensible defaults.
diff --git a/clients/odbc/ChangeLog.odbc-tls b/clients/odbc/ChangeLog.odbc-tls
deleted file mode 100644
--- a/clients/odbc/ChangeLog.odbc-tls
+++ /dev/null
@@ -1,24 +0,0 @@
-# ChangeLog file for odbc
-# This file is updated with Maddlog
-
-* Fri May 24 2024 Joeri van Ruth <joeri.van.r...@monetdbsolutions.com>
-- ODBC now supports TLS. It can be configured through the following
-  DSN- or Connection String attributes (canonical name / user friendly name):
-    TLS / Encrypt = ON/OFF
-    CERT / Server Certificate = PATH
-    CERTHASH / Server Certificate Hash = sha256:HEXDIGITS
-    CLIENTKEY / Client Key = PATH
-    CLIENTCERT / Client Certificate = PATH
-    AUTOCOMMIT / Autocommit = ON/OFF
-- Several more connection properties have been made configurable:
-    SCHEMA / Schema = NAME
-    TIMEZONE / Time Zone = Minutes East Of UTC
-    REPLYSIZE / Reply Size = NUMBER
-    LOGFILE / Log File = PATH
-    LOGINTIMEOUT / Login Timeout = MILLISECONDS
-    CONNECTIONTIMEOUT / Connection Timeout = MILLISECONDS
-    SOCK / Unix Socket = PATH (unix only)
-- SQLBrowseConnect adds On/Off suggestions to boolean settings
-  and prioritizes the DATABASE attribute if it notices monetdbd
-  requires one. Apart from that only UID/User and PWD/Password
-  are required, all others have sensible defaults.
diff --git a/clients/odbc/driver/CMakeLists.txt 
b/clients/odbc/driver/CMakeLists.txt
--- a/clients/odbc/driver/CMakeLists.txt
+++ b/clients/odbc/driver/CMakeLists.txt
@@ -133,6 +133,7 @@ target_link_libraries(MonetODBC
   monetdb_config_header
   mutils
   mapi
+  mutf8
   ${ODBCINST_LIBRARIES})
 
 install(TARGETS
diff --git a/clients/odbc/driver/ODBCUtil.c b/clients/odbc/driver/ODBCUtil.c
--- a/clients/odbc/driver/ODBCUtil.c
+++ b/clients/odbc/driver/ODBCUtil.c
@@ -35,6 +35,7 @@
 #include "ODBCUtil.h"
 #include "ODBCDbc.h"
 #include <float.h>
+#include "mutf8.h"
 
 
 #ifdef WIN32
@@ -199,7 +200,6 @@ ODBCutf82wchar(const SQLCHAR *src,
 {
        SQLLEN i = 0;
        SQLINTEGER j = 0;
-       uint32_t c;
 
        if (buf == NULL)
                buflen = 0;
@@ -220,51 +220,25 @@ ODBCutf82wchar(const SQLCHAR *src,
        else if (length < 0)
                return "Invalid length parameter";
 
+       uint32_t state = 0, codepoint = 0;
        while (j < length && i + 1 < buflen && src[j]) {
-               if ((src[j+0] & 0x80) == 0) {
-                       buf[i++] = src[j+0];
-                       j += 1;
-               } else if (j + 1 < length
-                          && (src[j+0] & 0xE0) == 0xC0
-                          && (src[j+1] & 0xC0) == 0x80
-                          && (src[j+0] & 0x1E) != 0) {
-                       buf[i++] = (src[j+0] & 0x1F) << 6
-                               | (src[j+1] & 0x3F);
-                       j += 2;
-               } else if (j + 2 < length
-                          && (src[j+0] & 0xF0) == 0xE0
-                          && (src[j+1] & 0xC0) == 0x80
-                          && (src[j+2] & 0xC0) == 0x80
-                          && ((src[j+0] & 0x0F) != 0
-                              || (src[j+1] & 0x20) != 0)) {
-                       buf[i++] = (src[j+0] & 0x0F) << 12
-                               | (src[j+1] & 0x3F) << 6
-                               | (src[j+2] & 0x3F);
-                       j += 3;
-               } else if (j + 3 < length
-                          && (src[j+0] & 0xF8) == 0xF0
-                          && (src[j+1] & 0xC0) == 0x80
-                          && (src[j+2] & 0xC0) == 0x80
-                          && (src[j+3] & 0xC0) == 0x80
-                          && ((src[j+0] & 0x07) != 0
-                              || (src[j+1] & 0x30) != 0)) {
-                       c = (src[j+0] & 0x07) << 18
-                               | (src[j+1] & 0x3F) << 12
-                               | (src[j+2] & 0x3F) << 6
-                               | (src[j+3] & 0x3F);
-                       if (c > 0x10FFFF || (c & 0x1FF800) == 0x00D800)
-                               return "Illegal code point";
+               switch (decode(&state, &codepoint, (uint8_t) src[j++])) {
+               case UTF8_ACCEPT:
 #if SIZEOF_SQLWCHAR == 2
-                       if (i + 2 >= buflen)
-                               break;
-                       buf[i++] = 0xD7C0 + (c >> 10);
-                       buf[i++] = 0xDC00 + (c & 0x03FF);
+                       if (codepoint <= 0xFFFF) {
+                               buf[i++] = (SQLWCHAR) codepoint;
+                       } else {
+                               buf[i++] = (SQLWCHAR) (0xD7C0 + (codepoint >> 
10));
+                               buf[i++] = (SQLWCHAR) (0xDC00 + (codepoint & 
0x3FF));
+                       }
 #else
-                       buf[i++] = c;
+                       buf[i++] = (SQLWCHAR) codepoint;
 #endif
-                       j += 4;
-               } else {
+                       break;
+               case UTF8_REJECT:
                        return "Illegal code point";
+               default:
+                       break;
                }
        }
        if (buflen > 0)
@@ -272,40 +246,22 @@ ODBCutf82wchar(const SQLCHAR *src,
        if (consumed)
                *consumed = (size_t) j;
        while (j < length && src[j]) {
-               i++;
-               if ((src[j+0] & 0x80) == 0) {
-                       j += 1;
-               } else if (j + 1 < length
-                          && (src[j+0] & 0xE0) == 0xC0
-                          && (src[j+1] & 0xC0) == 0x80
-                          && (src[j+0] & 0x1E) != 0) {
-                       j += 2;
-               } else if (j + 2 < length
-                          && (src[j+0] & 0xF0) == 0xE0
-                          && (src[j+1] & 0xC0) == 0x80
-                          && (src[j+2] & 0xC0) == 0x80
-                          && ((src[j+0] & 0x0F) != 0
-                              || (src[j+1] & 0x20) != 0)) {
-                       j += 3;
-               } else if (j + 3 < length
-                          && (src[j+0] & 0xF8) == 0xF0
-                          && (src[j+1] & 0xC0) == 0x80
-                          && (src[j+2] & 0xC0) == 0x80
-                          && (src[j+3] & 0xC0) == 0x80
-                          && ((src[j+0] & 0x07) != 0
-                              || (src[j+1] & 0x30) != 0)) {
-                       c = (src[j+0] & 0x07) << 18
-                               | (src[j+1] & 0x3F) << 12
-                               | (src[j+2] & 0x3F) << 6
-                               | (src[j+3] & 0x3F);
-                       if (c > 0x10FFFF || (c & 0x1FF800) == 0x00D800)
-                               return "Illegal code point";
+               switch (decode(&state, &codepoint, (uint8_t) src[j++])) {
+               case UTF8_ACCEPT:
 #if SIZEOF_SQLWCHAR == 2
+                       if (codepoint <= 0xFFFF) {
+                               i++;
+                       } else {
+                               i += 2;
+                       }
+#else
                        i++;
 #endif
-                       j += 4;
-               } else {
+                       break;
+               case UTF8_REJECT:
                        return "Illegal code point";
+               default:
+                       break;
                }
        }
        if (buflenout)
diff --git a/clients/odbc/winsetup/install.c b/clients/odbc/winsetup/install.c
--- a/clients/odbc/winsetup/install.c
+++ b/clients/odbc/winsetup/install.c
@@ -166,7 +166,7 @@ static void
 CreateAttributeString(char *attrs, size_t len, const char *dsn)
 {
        snprintf(attrs, len,
-                        
"DSN=%s;Server=localhost;Database=;UID=monetdb;PWD=monetdb;Logfile=;",
+                        
"DSN=%s;Server=localhost;Database=;UID=monetdb;PWD=monetdb;AutoCommit=on;TLS=off;",
                         dsn);
 
        for (; *attrs; attrs++)
@@ -230,9 +230,8 @@ Install(const char *driverpath, const ch
        }
 
        rc = InstallMyDriver(driverpath, drivername);
-
        if (rc) {
-               /* after the driver is installed create the new DSN */
+               /* after the driver is installed create the new System DSN */
                rc = AddMyDSN(dsn, drivername);
        }
 
diff --git a/clients/odbc/winsetup/resource.h b/clients/odbc/winsetup/resource.h
--- a/clients/odbc/winsetup/resource.h
+++ b/clients/odbc/winsetup/resource.h
@@ -40,7 +40,9 @@
 #define IDC_EDIT_CLIENTKEY              2024
 #define IDC_EDIT_CLIENTCERT             2025
 
-#define IDC_BUTTON_CANCEL               2031
+//#define IDC_BUTTON_CANCEL               2031
+#define IDC_BUTTON_TEST                 2031
+#define IDC_BUTTON_HELP                 2032
 
 // Next default values for new objects
 //
diff --git a/clients/odbc/winsetup/setup.c b/clients/odbc/winsetup/setup.c
--- a/clients/odbc/winsetup/setup.c
+++ b/clients/odbc/winsetup/setup.c
@@ -328,44 +328,44 @@ ConfigDSN(HWND parent, WORD request, LPC
                        return FALSE;
                }
                value++;
-               if (strncasecmp("dsn=", attributes, value - attributes) == 0) {
+               if (strncasecmp("DSN=", attributes, value - attributes) == 0) {
                        dsn = value;
                        data.dsn = strdup(value);
-               } else if (strncasecmp("description=", attributes, value - 
attributes) == 0)
+               } else if (strncasecmp("Description=", attributes, value - 
attributes) == 0)
                        data.desc = strdup(value);
-               else if (strncasecmp("uid=", attributes, value - attributes) == 
0)
+               else if (strncasecmp("UID=", attributes, value - attributes) == 
0)
                        data.uid = strdup(value);
-               else if (strncasecmp("pwd=", attributes, value - attributes) == 
0)
+               else if (strncasecmp("PWD=", attributes, value - attributes) == 
0)
                        data.pwd = strdup(value);
-               else if (strncasecmp("host=", attributes, value - attributes) 
== 0)
+               else if (strncasecmp("Host=", attributes, value - attributes) 
== 0)
                        data.host = strdup(value);
-               else if (strncasecmp("port=", attributes, value - attributes) 
== 0)
+               else if (strncasecmp("Port=", attributes, value - attributes) 
== 0)
                        data.port = strdup(value);
-               else if (strncasecmp("database=", attributes, value - 
attributes) == 0)
+               else if (strncasecmp("Database=", attributes, value - 
attributes) == 0)
                        data.database = strdup(value);
-               else if (strncasecmp("schema=", attributes, value - attributes) 
== 0)
+               else if (strncasecmp("Schema=", attributes, value - attributes) 
== 0)
                        data.schema = strdup(value);
-               else if (strncasecmp("logintimeout=", attributes, value - 
attributes) == 0)
+               else if (strncasecmp("LoginTimeout=", attributes, value - 
attributes) == 0)
                        data.logintimeout = strdup(value);
-               else if (strncasecmp("replytimeout=", attributes, value - 
attributes) == 0)
+               else if (strncasecmp("ReplyTimeout=", attributes, value - 
attributes) == 0)
                        data.replytimeout = strdup(value);
-               else if (strncasecmp("replysize=", attributes, value - 
attributes) == 0)
+               else if (strncasecmp("ReplySize=", attributes, value - 
attributes) == 0)
                        data.replysize = strdup(value);
-               else if (strncasecmp("autocommit=", attributes, value - 
attributes) == 0)
+               else if (strncasecmp("AutoCommit=", attributes, value - 
attributes) == 0)
                        data.autocommit = strdup(value);
-               else if (strncasecmp("timezone=", attributes, value - 
attributes) == 0)
+               else if (strncasecmp("TimeZone=", attributes, value - 
attributes) == 0)
                        data.timezone = strdup(value);
-               else if (strncasecmp("logfile=", attributes, value - 
attributes) == 0)
+               else if (strncasecmp("LogFile=", attributes, value - 
attributes) == 0)
                        data.logfile = strdup(value);
-               else if (strncasecmp("tls=", attributes, value - attributes) == 
0)
+               else if (strncasecmp("TLS=", attributes, value - attributes) == 
0)
                        data.use_tls = strdup(value);
-               else if (strncasecmp("cert=", attributes, value - attributes) 
== 0)
+               else if (strncasecmp("Cert=", attributes, value - attributes) 
== 0)
                        data.servercert = strdup(value);
-               else if (strncasecmp("certhash=", attributes, value - 
attributes) == 0)
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to