Mercurial > hg > monetdb-java
changeset 542:d462000fc410 onclient
Various changes suggested by Martin van Dinther
author | Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com> |
---|---|
date | Thu, 02 Sep 2021 15:13:46 +0200 (2021-09-02) |
parents | 31df6a12fd41 |
children | 70a827c6ced4 |
files | example/OnClientExample.java onclient.txt src/main/java/org/monetdb/jdbc/MonetConnection.java src/main/java/org/monetdb/mcl/io/BufferedMCLReader.java src/main/java/org/monetdb/mcl/io/LineType.java src/main/java/org/monetdb/util/FileTransferHandler.java tests/OnClientTester.java tests/TestRunner.java |
diffstat | 8 files changed, 52 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/example/OnClientExample.java +++ b/example/OnClientExample.java @@ -1,3 +1,11 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * Copyright 1997 - July 2008 CWI, August 2008 - 2021 MonetDB B.V. + */ + import org.monetdb.jdbc.MonetConnection; import org.monetdb.jdbc.MonetConnection.UploadHandler;
--- a/onclient.txt +++ b/onclient.txt @@ -5,9 +5,8 @@ retrievals, see also https://www.monetdb.org/Documentation/ServerAdministration/LoadingBulkData. By default, COPY INTO accesses files on the server but it also has a mode to -access files on the client. This has long been supported by the command line -tool mclient(1) and is now also supported as an extension to the MonetDB JDBC -driver. +access files on the client. This is supported by the command line tool +mclient(1) and now also as an extension to the MonetDB JDBC driver. This is how it works: The JDBC client automatically announces that it is capable of file transfers. If you execute, for example,
--- a/src/main/java/org/monetdb/jdbc/MonetConnection.java +++ b/src/main/java/org/monetdb/jdbc/MonetConnection.java @@ -3274,14 +3274,17 @@ public class MonetConnection public static interface UploadHandler { /** - * Called if the server sends a request to write a file. + * Called if the server sends a request to read file data. * * Use the given handle to receive data or send errors to the server. * * @param handle Handle to communicate with the server - * @param name Name of the file the server would like to read. Make sure to validate this before reading from - * the file system + * @param name Name of the file the server would like to read. Make sure + * to validate this before reading from the file system * @param textMode Whether this is text or binary data. + * @param offset line number of the first line to upload. Both 0 and 1 + * mean 'upload the whole file', 2 means 'skip line 1', + * etc. */ void handleUpload(Upload handle, String name, boolean textMode, int offset) throws IOException; }
--- a/src/main/java/org/monetdb/mcl/io/BufferedMCLReader.java +++ b/src/main/java/org/monetdb/mcl/io/BufferedMCLReader.java @@ -14,7 +14,9 @@ import java.io.InputStream; import java.io.Reader; import java.io.UnsupportedEncodingException; -import static org.monetdb.mcl.io.LineType.*; +import static org.monetdb.mcl.io.LineType.ERROR; +import static org.monetdb.mcl.io.LineType.PROMPT; +import static org.monetdb.mcl.io.LineType.UNKNOWN; /** * Read text from a character-input stream, buffering characters so as
--- a/src/main/java/org/monetdb/mcl/io/LineType.java +++ b/src/main/java/org/monetdb/mcl/io/LineType.java @@ -1,10 +1,18 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * Copyright 1997 - July 2008 CWI, August 2008 - 2021 MonetDB B.V. + */ + package org.monetdb.mcl.io; /** * Enumeration of the various message types used in the MAPI protocol. */ public enum LineType { - /** "there is currently no line", or the the type is unknown is represented by UNKNOWN */ + /** "there is currently no line", or the type is unknown is represented by UNKNOWN */ UNKNOWN(null), /** a line starting with ! indicates ERROR */
--- a/src/main/java/org/monetdb/util/FileTransferHandler.java +++ b/src/main/java/org/monetdb/util/FileTransferHandler.java @@ -1,3 +1,11 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * Copyright 1997 - July 2008 CWI, August 2008 - 2021 MonetDB B.V. + */ + package org.monetdb.util; import org.monetdb.jdbc.MonetConnection;
--- a/tests/OnClientTester.java +++ b/tests/OnClientTester.java @@ -1,3 +1,11 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * Copyright 1997 - July 2008 CWI, August 2008 - 2021 MonetDB B.V. + */ + import org.monetdb.jdbc.MonetConnection; import org.monetdb.jdbc.MonetConnection.UploadHandler; import org.monetdb.jdbc.MonetConnection.DownloadHandler;
--- a/tests/TestRunner.java +++ b/tests/TestRunner.java @@ -1,3 +1,11 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * Copyright 1997 - July 2008 CWI, August 2008 - 2021 MonetDB B.V. + */ + import org.monetdb.jdbc.MonetConnection; import java.io.PrintWriter;