Changeset: 63c43aa12cc8 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=63c43aa12cc8
Branch: octbugs
Log Message:

Merge with Oct2020 branch.


diffs (truncated from 2197 to 300 lines):

diff --git a/NT/mkodbcwxs.py b/NT/mkodbcwxs.py
--- a/NT/mkodbcwxs.py
+++ b/NT/mkodbcwxs.py
@@ -82,6 +82,7 @@ def main():
                r'bin\stream.dll', # r'lib\stream.pdb',
                vcpkg.format(r'bin\libiconv.dll'),
                vcpkg.format(r'bin\bz2.dll'),
+               vcpkg.format(r'bin\libcharset.dll'), # for libiconv.dll
                vcpkg.format(r'bin\libcrypto-1_1{}.dll'.format(libcrypto)),
                vcpkg.format(r'bin\zlib1.dll')])
     print(r'            </Directory>')
diff --git a/NT/mksqlwxs.py b/NT/mksqlwxs.py
--- a/NT/mksqlwxs.py
+++ b/NT/mksqlwxs.py
@@ -147,8 +147,11 @@ def main():
                r'bin\stream.dll',
                vcpkg.format(r'bin\libiconv.dll'),
                vcpkg.format(r'bin\bz2.dll'),
+               vcpkg.format(r'bin\getopt.dll'),
+               vcpkg.format(r'bin\libcharset.dll'), # for libiconv.dll
                vcpkg.format(r'bin\libcrypto-1_1{}.dll'.format(libcrypto)),
                vcpkg.format(r'bin\libxml2.dll'),
+               vcpkg.format(r'bin\lzma.dll'),
                vcpkg.format(r'bin\pcre.dll'),
                vcpkg.format(r'bin\zlib1.dll')])
     # id = comp(debug, id, 14,
diff --git a/buildtools/conf/monetdbd.conf.in b/buildtools/conf/monetdbd.conf.in
--- a/buildtools/conf/monetdbd.conf.in
+++ b/buildtools/conf/monetdbd.conf.in
@@ -1,3 +1,3 @@
 # this file is for systemd
 # monetdbd needs a directory in /run that is owned by monetdb:monetdb
-d @RUNDIR@/monetdb 0775 monetdb monetdb -
+d @RUNDIR@ 0775 monetdb monetdb -
diff --git a/clients/ChangeLog b/clients/ChangeLog
new file mode 100644
--- /dev/null
+++ b/clients/ChangeLog
@@ -0,0 +1,7 @@
+# ChangeLog file for clients
+# This file is updated with Maddlog
+
+* Mon Oct 12 2020 Sjoerd Mullender <sjo...@acm.org>
+- mclient and msqldump now also look in $XDG_CONFIG_HOME for the monetdb
+  configuration file.
+
diff --git a/clients/mapiclient/dotmonetdb.c b/clients/mapiclient/dotmonetdb.c
--- a/clients/mapiclient/dotmonetdb.c
+++ b/clients/mapiclient/dotmonetdb.c
@@ -19,33 +19,37 @@ parse_dotmonetdb(DotMonetdb *dotfile)
 
        if (dotfile == NULL)
                return;
+       /* if environment variable DOTMONETDBFILE is set, use it */
+       /* 1. use $DOTMONETDBFILE (if set but empty do not read config file);
+        * 2. use .monetdb;
+        * 3. use ${XDG_CONFIG_HOME-$HOME/.config}/monetdb;
+        * 4. use $HOME/.monetdb
+        * (3 is standard shell syntax: use XDG_CONFIG_HOME if set, else use
+        * $HOME/.config in its place)
+        */
        if ((cfile = getenv("DOTMONETDBFILE")) == NULL) {
                /* no environment variable: use a default */
-               if ((config = fopen(".monetdb", "r")) == NULL) {
-                       if ((cfile = getenv("HOME")) != NULL) {
-                               int len = snprintf(buf, sizeof(buf), 
"%s%c.monetdb", cfile, DIR_SEP);
-                               if (len == -1 || len >= FILENAME_MAX) {
-                                       cfile = NULL;
-                               } else {
-                                       config = fopen(buf, "r");
-                                       if (config)
-                                               cfile = strdup(buf);
-                                       else
-                                               cfile = NULL;
+               cfile = ".monetdb";
+               if ((config = fopen(cfile, "r")) == NULL) {
+                       const char *xdg = getenv("XDG_CONFIG_HOME");
+                       const char *home = getenv("HOME");
+                       int len = -1;
+                       cfile = buf;
+                       if (xdg != NULL)
+                               len = snprintf(buf, sizeof(buf), "%s%cmonetdb", 
xdg, DIR_SEP);
+                       else if (home != NULL)
+                               len = snprintf(buf, sizeof(buf), 
"%s%c.config%cmonetdb", home, DIR_SEP, DIR_SEP);
+                       if (len == -1 || len >= FILENAME_MAX || (config = 
fopen(buf, "r")) == NULL) {
+                               if (home) {
+                                       len = snprintf(buf, sizeof(buf), 
"%s%c.monetdb", home, DIR_SEP);
+                                       if (len >= 0 && len < FILENAME_MAX)
+                                               config = fopen(buf, "r");
                                }
                        }
-               } else {
-                       cfile = strdup(".monetdb");
                }
-       } else if (*cfile == 0) {
-               /* empty environment variable: skip the file */
-               cfile = NULL;
-       } else if ((config = fopen(cfile, "r")) == NULL) {
+       } else if (*cfile != 0 && (config = fopen(cfile, "r")) == NULL) {
                fprintf(stderr, "failed to open file '%s': %s\n",
                        cfile, strerror(errno));
-               cfile = NULL;
-       } else {
-               cfile = strdup(cfile);
        }
 
        *dotfile = (DotMonetdb) {0};
@@ -115,9 +119,6 @@ parse_dotmonetdb(DotMonetdb *dotfile)
                                fprintf(stderr, "%s:%d: unknown property: %s\n",
                                        cfile, line, buf);
                }
+               fclose(config);
        }
-       if (cfile)
-               free(cfile);
-       if (config)
-               fclose(config);
 }
diff --git a/clients/mapiclient/mclient.1 b/clients/mapiclient/mclient.1
--- a/clients/mapiclient/mclient.1
+++ b/clients/mapiclient/mclient.1
@@ -56,18 +56,25 @@ See the section BACKSLASH COMMANDS below
 .PP
 Before
 .I mclient
-starts parsing command line options, it reads a
-.I .monetdb
-file.
+starts parsing command line options, it reads a configuration file.
 If the environment variable
 .B DOTMONETDBFILE
-is set, it reads the file pointed to by that variable instead.
-When unset,
+is set and not empty, it reads the file pointed to by that variable.
+If set but empty, no configuration file is read.
+If unset,
 .I mclient
-searches for a
+first looks for a file
 .I .monetdb
-file in the current working directory, and if that doesn't exist, in the
-current user's home directory.
+in the current working directory, and if that doesn't exist, it
+looks for a file
+.I monetdb
+in the XDG configuration directory
+.RB ( $XDG_CONFIG_HOME
+which defaults to
+.B $HOME/.config
+if not set), and finally for a file
+.I .monetdb
+in the current user's home directory.
 This file can contain defaults for the flags
 .BR user ,
 .BR password ,
diff --git a/clients/mapiclient/msqldump.1 b/clients/mapiclient/msqldump.1
--- a/clients/mapiclient/msqldump.1
+++ b/clients/mapiclient/msqldump.1
@@ -20,18 +20,25 @@ The dump can be used to populate a new M
 .PP
 Before
 .I msqldump
-starts parsing command line options, it reads a
-.I .monetdb
-file.
+starts parsing command line options, it reads a configuration file.
 If the environment variable
 .B DOTMONETDBFILE
-is set, it reads the file pointed to by that variable instead.
-When unset,
+is set and not empty, it reads the file pointed to by that variable.
+If set but empty, no configuration file is read.
+If unset,
 .I msqldump
-searches for a
+first looks for a file
 .I .monetdb
-file in the current working directory, and if that doesn't exist, in the
-current user's home directory.
+in the current working directory, and if that doesn't exist, it
+looks for a file
+.I monetdb
+in the XDG configuration directory
+.RB ( $XDG_CONFIG_HOME
+which defaults to
+.B $HOME/.config
+if not set), and finally for a file
+.I .monetdb
+in the current user's home directory.
 This file can contain defaults for the flags
 .BR user ,
 .BR password ,
diff --git a/documentation/monetdbe/examples.rst 
b/documentation/monetdbe/examples.rst
--- a/documentation/monetdbe/examples.rst
+++ b/documentation/monetdbe/examples.rst
@@ -2,5 +2,5 @@ Examples
 ========
 
 The following example illustrates the basics of a MonetDBe application.
-See the repositary ... for more starting points of your yourney.
+See the repository ... for more starting points of your journey.
 
diff --git a/documentation/monetdbe/introduction.rst 
b/documentation/monetdbe/introduction.rst
--- a/documentation/monetdbe/introduction.rst
+++ b/documentation/monetdbe/introduction.rst
@@ -9,29 +9,29 @@ functionality.
 
 ``An embedded database system is a database management system (DBMS) which
 is tightly integrated with an application software that requires access to 
stored data,
-such that the database system is "hidden" from the application’s end-user
+such that the database system is "hidden" from the application's end-user
 and requires little or no ongoing maintenance.`` `wikipedia 
<https://en.wikipedia.org/wiki/Embedded_database>`
 
-The embedded database market has for a long time been dominated by traditional 
row-stores, 
-often with limited SQL functionality, scalability or performance. 
-The space lacks a mature open-source column store deemed essential to push 
+The embedded database market has for a long time been dominated by traditional 
row-stores,
+often with limited SQL functionality, scalability or performance.
+The space lacks a mature open-source column store deemed essential to push
 the performance envelope for data analytics applications.
 
 What is our proposed solution?
 ------------------------------
 
-Wouldn’t it be great if a full fledged column-store SQL database server be 
harnessed 
-to the point it can work as an embedded DBMS.  A fully parallel execution 
engine 
-to exploit the common multi-core platforms. This way addressing the needs for 
+Wouldn't it be great if a full fledged column-store SQL database server be 
harnessed
+to the point it can work as an embedded DBMS.  A fully parallel execution 
engine
+to exploit the common multi-core platforms. This way addressing the needs for
 data analytics and machine learning, without relying on expensive interprocess 
communication or ETL.
 A strong embeddedness with the application to easily use the UDFs at close 
range without overhead in data exchanges.
 
 How we solved it
 ----------------
 
-The solution brought to you is illustrated below. On the left we see MonetDB 
in 
-the role of a client/server architecture as it has worked all along. 
-The interaction between the applications and the server is regulated using 
standard API’s, such as JDBC/ODBC, and the MonetDB API.
+The solution brought to you is illustrated below. On the left we see MonetDB in
+the role of a client/server architecture as it has worked all along.
+The interaction between the applications and the server is regulated using 
standard API's, such as JDBC/ODBC, and the MonetDB API.
 In this architecture, the underlying assumptions are:
 . The server is fully isolated from the application code for security, 
stability, reliability.
 . The server serves multiple users concurrently.
@@ -39,9 +39,9 @@ In this architecture, the underlying ass
 . The server can use replication for resilience and load sharing.
 . The server can communicate with its peers to execute queries over 
partitioned tables.
 
-A large part of the server code, however, can be decoupled to reach an 
-embeddable database system, illustrated at the right with a focus 
-on the programming language C. 
+A large part of the server code, however, can be decoupled to reach an
+embeddable database system, illustrated at the right with a focus
+on the programming language C.
 A single library to be linked into the application code directly. With the 
obvious benefits:
 
 . No client-server communication overhead.
@@ -49,35 +49,35 @@ A single library to be linked into the a
 . Full use of the multi-core architectures.
 . Seamless integration with the application.
 . Single user control over the resources.
-. Working with :inmemory: databases with controlled RAM footprint.
+. Working with :memory: databases with controlled RAM footprint.
 . Boosting your data analytics
 
 .. image:: architecture.png
-   
+
 
 How does it work?
 -----------------
 
-MonetDBe encapsulates the full SQL functionality offered by MonetDB. 
-To achieve this, we had to create a single shared library (libmonetdbe) to 
-expose the main sql interfaces using a small api (monetdbe.h). 
+MonetDBe encapsulates the full SQL functionality offered by MonetDB.
+To achieve this, we had to create a single shared library (libmonetdbe) to
+expose the main sql interfaces using a small api (monetdbe.h).
 It is an integral component of the server version nowadays, which avoids 
maintaining multiple code paths.
 
 What to expect?
 ---------------
 
-The MonetDBe library supports three different storage schemes. 
-A light-weight scheme for small databases confined to main memory, i.e. 
connect(‘ :inmemory:’). 
-The maximum footprint can be set explicitly or is derived from the host (VM) 
resource limits. 
-Using a directory on your local machine is the way to go if you need 
persistence, 
-but with exclusive access as it concerns ACID properties. If the application 
works 
-with :inmemory: or a local database then switching to a MonetDB server merely 
+The MonetDBe library supports three different storage schemes.
+A light-weight scheme for small databases confined to main memory, i.e. 
connect(':memory:').
+The maximum footprint can be set explicitly or is derived from the host (VM) 
resource limits.
+Using a directory on your local machine is the way to go if you need 
persistence,
+but with exclusive access as it concerns ACID properties. If the application 
works
+with :memory: or a local database then switching to a MonetDB server merely
 requires the connect call to be provided with the access point information.
 
-The MonetDBe code is available from the development branch of MonetDB as an 
**alpha-release**.. 
-For now, the embedded version can serve a single database at a time, but 
coarse grain locking 
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to