Changeset: 82a96d36534c for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=82a96d36534c
Modified Files:
        clients/Tests/exports.stable.out
        java/src/nl/cwi/monetdb/util/PasswordField.java
        monetdb5/modules/mal/Tests/inspect05.stable.out
        sql/backends/monet5/sql.mx
Branch: gdk-calc
Log Message:

Merge with default branch.


diffs (truncated from 8714 to 300 lines):

diff --git a/clients/NT/Makefile.ag b/clients/NT/Makefile.ag
--- a/clients/NT/Makefile.ag
+++ b/clients/NT/Makefile.ag
@@ -18,5 +18,5 @@
 scripts_bat = {
        EXT = bat
        DIR = prefix
-       SOURCES = mclient.bat msqldump.bat
+       SOURCES = mclient.bat msqldump.bat stethoscope.bat
 }
diff --git a/clients/NT/stethoscope.bat b/clients/NT/stethoscope.bat
new file mode 100755
--- /dev/null
+++ b/clients/NT/stethoscope.bat
@@ -0,0 +1,15 @@
+@echo off
+rem figure out the folder name
+set MONETDB=%~dp0
+
+rem remove the final backslash from the path
+set MONETDB=%MONETDB:~0,-1%
+
+rem extend the search path with our EXE and DLL folders
+rem we depend on pthreadVCE.dll having been copied to the lib folder
+set PATH=%MONETDB%\bin;%MONETDB%\lib;%MONETDB%\lib\bin;%PATH%
+
+rem start the real client
+"%MONETDB%\bin\stethoscope.exe" %1 %2 %3 %4 %5 %6 %7 %8
+
+if ERRORLEVEL 1 pause
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
@@ -3101,7 +3101,7 @@ str ZORDsql_slice_int(int *r, int *xb, i
 void _initTrace(void);
 str activateCounter(str name);
 str addOptimizerPipe(Client cntxt, MalBlkPtr mb, str name);
-str addPipeDefinition(str name, str pipe);
+str addPipeDefinition(Client cntxt, str name, str pipe);
 str addRegWrap(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pc);
 DCYcatalog *addRegist(str sch, str tab, str col, int acc, int part, int f_bun, 
int l_bun);
 void addtoMalBlkHistory(MalBlkPtr mb, str marker);
@@ -3178,6 +3178,7 @@ int color_tostr(char **colorStr, int *le
 str columnBindRef;
 str columnRef;
 str commitRef;
+str compileOptimizer(Client cntxt, str name);
 str compileString(Symbol *fcn, Client c, str s);
 str compressRef;
 str connectRef;
diff --git a/clients/mapiclient/stethoscope.c b/clients/mapiclient/stethoscope.c
--- a/clients/mapiclient/stethoscope.c
+++ b/clients/mapiclient/stethoscope.c
@@ -187,8 +187,9 @@ doProfile(void *d)
        wthread *wthr = (wthread*)d;
        int i;
        size_t a;
+       ssize_t n;
        char *response, *x;
-       char buf[BUFSIZ];
+       char buf[BUFSIZ + 1];
        char *e;
        char *mod, *fcn;
        char *host;
@@ -282,7 +283,8 @@ doProfile(void *d)
        fflush(NULL);
 
        i = 0;
-       while (mnstr_read(wthr->s, buf, 1, BUFSIZ)) {
+       while ((n = mnstr_read(wthr->s, buf, 1, BUFSIZ)) > 0) {
+               buf[n] = 0;
                response = buf;
                while ((e = strchr(response, '\n')) != NULL) {
                        *e = 0;
@@ -477,6 +479,7 @@ main(int argc, char **argv)
                 * the function never terminates... at least on Linux */
 #if !defined(HAVE_PTHREAD_H) && defined(_MSC_VER)
                walk->id = CreateThread(NULL, 0, doProfile, walk, 0, NULL);
+               WaitForSingleObject(walk->id, INFINITE);
                CloseHandle(walk->id);
 #else
                pthread_create(&walk->id, NULL, &doProfile, walk);
@@ -510,6 +513,7 @@ main(int argc, char **argv)
                free(oalts);
                for (walk = thds; walk != NULL; walk = walk->next) {
 #if !defined(HAVE_PTHREAD_H) && defined(_MSC_VER)
+                       WaitForSingleObject(walk->id, INFINITE);
                        CloseHandle(walk->id);
 #else
                        pthread_join(walk->id, NULL);
diff --git a/common/stream/stream.c b/common/stream/stream.c
--- a/common/stream/stream.c
+++ b/common/stream/stream.c
@@ -2400,7 +2400,9 @@ bs_flush(stream *ss)
 #ifdef WORDS_BIGENDIAN
                blksize = short_int_SWAP(blksize);
 #endif
-               if ((!mnstr_writeSht(s->s, blksize) || s->s->write(s->s, 
s->buf, 1, s->nr) != (ssize_t) s->nr)) {
+               if ((!mnstr_writeSht(s->s, blksize) ||
+                    (s->nr > 0 &&
+                     s->s->write(s->s, s->buf, 1, s->nr) != (ssize_t) s->nr))) 
{
                        ss->errnr = MNSTR_WRITE_ERROR;
                        return -1;
                }
diff --git a/java/ChangeLog.Apr2012 b/java/ChangeLog.Apr2012
--- a/java/ChangeLog.Apr2012
+++ b/java/ChangeLog.Apr2012
@@ -1,3 +1,7 @@
 # ChangeLog file for java
 # This file is updated with Maddlog
 
+* Fri Mar  2 2012 Wouter Alink <[email protected]>
+- Password reading by JdbcClient no longer results in strange artifacts
+- JdbcClient now returns exit code 1 in case of failures
+
diff --git a/java/Makefile.ag b/java/Makefile.ag
--- a/java/Makefile.ag
+++ b/java/Makefile.ag
@@ -27,7 +27,7 @@ JAVA_HOME = @JAVA_HOME@
 ant_distjdbc = {
        COND = HAVE_JAVAJDBC
        DIR = datadir/monetdb/lib
-       FILES = monetdb-mcl-1.7.jar monetdb-jdbc-2.2.jar jdbcclient.jar
+       FILES = monetdb-mcl-1.8.jar monetdb-jdbc-2.3.jar jdbcclient.jar
 }
 
 ant_distmerocontrol = {
diff --git a/java/build.properties b/java/build.properties
--- a/java/build.properties
+++ b/java/build.properties
@@ -9,7 +9,7 @@
 # major release number
 MCL_MAJOR=1
 # minor release number
-MCL_MINOR=7
+MCL_MINOR=8
 
 
 ##
@@ -19,7 +19,7 @@ MCL_MINOR=7
 # major release number
 JDBC_MAJOR=2
 # minor release number
-JDBC_MINOR=2
+JDBC_MINOR=3
 # an additional identifying string
 JDBC_VER_SUFFIX=Liberica
 # the default port to connect on, if no port given when using SQL
diff --git a/java/pom.xml b/java/pom.xml
--- a/java/pom.xml
+++ b/java/pom.xml
@@ -6,7 +6,7 @@
        <modelVersion>4.0.0</modelVersion>
        <groupId>monetdb</groupId>
        <artifactId>monetdb-jdbc</artifactId>
-       <version>2.2</version>
+       <version>2.3</version>
        <name>monetdb-jdbc</name>
        <description>MonetDB JDBC driver</description>
        <repositories>
diff --git a/java/release.txt b/java/release.txt
--- a/java/release.txt
+++ b/java/release.txt
@@ -1,8 +1,8 @@
 RELEASE NOTES
-MonetDB JDBC driver version 2.2 (Liberica/MCL-1.7)
+MonetDB JDBC driver version 2.3 (Liberica/MCL-1.8)
 Fabian Groffen <[email protected]>
 
-Release date: 2012-02-28
+Release date: 2012-03-02
 
 
 This JDBC driver is designed for use with MonetDB, a main-memory
diff --git a/java/src/nl/cwi/monetdb/client/JMonetDB.java 
b/java/src/nl/cwi/monetdb/client/JMonetDB.java
--- a/java/src/nl/cwi/monetdb/client/JMonetDB.java
+++ b/java/src/nl/cwi/monetdb/client/JMonetDB.java
@@ -67,7 +67,7 @@ public class JMonetDB {
                        copts.processArgs(args);
                } catch (OptionsException e) {
                        System.err.println("Error: " + e.getMessage());
-                       System.exit(-1);
+                       System.exit(1);
                }
 
                if (copts.getOption("help").isPresent()) {
@@ -92,14 +92,12 @@ copts.produceHelpMessage()
                // we need the password from the user, fetch it with a pseudo
                // password protector
                if (pass == null) {
-                       try {
-                               char[] tmp = 
PasswordField.getPassword(System.in, "passhrase: ");
-                               if (tmp != null) pass = String.valueOf(tmp);
-                       } catch (IOException ioe) {
+                       char[] tmp = System.console().readPassword("passphrase: 
");
+                       if (tmp == null) {
                                System.err.println("Invalid passphrase!");
-                               System.exit(-1);
+                               System.exit(1);
                        }
-                       System.out.println("");
+                       pass = String.valueOf(tmp);
                }
 
                // build the hostname
@@ -118,7 +116,7 @@ copts.produceHelpMessage()
 
                if (!copts.getOption("command").isPresent()) {
                        System.err.println("need a command to execute (-c)");
-                       System.exit(-1);
+                       System.exit(1);
                }
 
                Control ctl = null;
@@ -126,7 +124,7 @@ copts.produceHelpMessage()
                        ctl = new Control(host, port, pass);
                } catch (IllegalArgumentException e) {
                        System.err.println(e.getMessage());
-                       System.exit(-1);
+                       System.exit(1);
                }
                // FIXME: Control needs to respect Xhash
 
diff --git a/java/src/nl/cwi/monetdb/client/JdbcClient.java 
b/java/src/nl/cwi/monetdb/client/JdbcClient.java
--- a/java/src/nl/cwi/monetdb/client/JdbcClient.java
+++ b/java/src/nl/cwi/monetdb/client/JdbcClient.java
@@ -126,7 +126,7 @@ public class JdbcClient {
                                copts.processFile(pref);
                        } catch (OptionsException e) {
                                System.err.println("Error in " + 
pref.getAbsolutePath() + ": " + e.getMessage());
-                               System.exit(-1);
+                               System.exit(1);
                        }
                        user = copts.getOption("user").getArgument();
                        pass = copts.getOption("password").getArgument();
@@ -139,7 +139,7 @@ public class JdbcClient {
                        copts.processArgs(args);
                } catch (OptionsException e) {
                        System.err.println("Error: " + e.getMessage());
-                       System.exit(-1);
+                       System.exit(1);
                }
                // we can actually compare pointers (objects) here
                if (user != copts.getOption("user").getArgument()) pass = null;
@@ -189,14 +189,12 @@ copts.produceHelpMessage()
                // we need the password from the user, fetch it with a pseudo
                // password protector
                if (pass == null) {
-                       try {
-                               char[] tmp = 
PasswordField.getPassword(System.in, "password: ");
-                               if (tmp != null) pass = String.valueOf(tmp);
-                       } catch (IOException ioe) {
+                       char[] tmp = System.console().readPassword("password: 
");
+                       if (tmp == null) {
                                System.err.println("Invalid password!");
-                               System.exit(-1);
+                               System.exit(1);
                        }
-                       System.out.println("");
+                       pass = String.valueOf(tmp);
                }
 
                user = copts.getOption("user").getArgument();
@@ -253,7 +251,7 @@ copts.produceHelpMessage()
                        con.clearWarnings();
                } catch (SQLException e) {
                        System.err.println("Database connect failed: " + 
e.getMessage());
-                       System.exit(-1);
+                       System.exit(1);
                }
                try {
                        dbmd = con.getMetaData();
@@ -281,7 +279,7 @@ copts.produceHelpMessage()
                        // request the tables available in the database
                        tbl = dbmd.getTables(null, null, null, types);
 
-                       LinkedList tables = new LinkedList();
+                       List<Table> tables = new LinkedList<Table>();
                        while (tbl.next()) {
                                tables.add(new Table(
                                        tbl.getString("TABLE_CAT"),
@@ -341,14 +339,14 @@ copts.produceHelpMessage()
                                // search for cycles of type a -> (x ->)+ b 
probably not
                                // the most optimal way, but it works by just 
scanning
                                // every table for loops in a recursive manor
-                               for (int i = 0; i < tables.size(); i++) {
-                                       
Table.checkForLoop((Table)(tables.get(i)), new ArrayList());
+                               for (Table t : tables) {
+                                       Table.checkForLoop(t, new 
ArrayList<Table>());
                                }
 
                                // find the graph, at this point we know there 
are no
                                // cycles, thus a solution exists
                                for (int i = 0; i < tables.size(); i++) {
-                                       List needs = 
((Table)(tables.get(i))).requires(tables.subList(0, i + 1));
+                                       List<Table> needs = 
tables.get(i).requires(tables.subList(0, i + 1));
                                        if (needs.size() > 0) {
                                                tables.removeAll(needs);
                                                tables.addAll(i, needs);
@@ -360,9 +358,8 @@ copts.produceHelpMessage()
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to