Mercurial > hg > monetdb-java
changeset 852:d9a45743536d monetdbs
Merge 'default' into 'monetdbs'
author | Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com> |
---|---|
date | Fri, 05 Jan 2024 12:45:48 +0100 (15 months ago) |
parents | 157dcb2d6516 (current diff) d7ffef8faf38 (diff) |
children | ca7f27763249 |
files | src/main/java/org/monetdb/client/JdbcClient.java src/main/java/org/monetdb/jdbc/MonetConnection.java src/main/java/org/monetdb/jdbc/MonetDriver.java src/main/java/org/monetdb/mcl/MCLException.java src/main/java/org/monetdb/mcl/io/BufferedMCLReader.java src/main/java/org/monetdb/mcl/net/MapiSocket.java src/main/java/org/monetdb/util/CmdLineOpts.java tests/JDBC_API_Tester.java tests/build.xml |
diffstat | 61 files changed, 687 insertions(+), 140 deletions(-) [+] |
line wrap: on
line diff
--- a/.github/workflows/monetdbversions.yml +++ b/.github/workflows/monetdbversions.yml @@ -16,6 +16,7 @@ jobs: - "monetdb/dev-builds:Jan2022" - "monetdb/dev-builds:Sep2022" - "monetdb/dev-builds:Jun2023" + - "monetdb/dev-builds:Dec2023" - "monetdb/dev-builds:default" services:
--- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,27 @@ # ChangeLog file for monetdb-java # This file is updated with Maddlog +* Thu Dec 28 2023 Martin van Dinther <martin.van.dinther@monetdbsolutions.com> +- In ResultSet.getObject(column, Class<T> type) and + ResultSet.getObject(column, Map<String,Class<?>>) methods added support + to return objects for classes: java.time.LocalDate, java.time.LocalDateTime + and java.time.LocalTime. + +* Wed Dec 20 2023 Martin van Dinther <martin.van.dinther@monetdbsolutions.com> +- Enhanced DatabaseMetaData.getTables() method by adding support for SQL + table type names: 'BASE TABLE', 'GLOBAL TEMPORARY' and 'LOCAL TEMPORARY' + in parameter types[]. These are SQL synonyms of MonetDB table type names: + 'TABLE', 'GLOBAL TEMPORARY TABLE' and 'LOCAL TEMPORARY TABLE'. + +* Thu Dec 14 2023 Martin van Dinther <martin.van.dinther@monetdbsolutions.com> +- In ResultSet.getObject() method added support for retrieving + TIMESTAMP WITH TIME ZONE data as java.time.OffsetDateTime object + and TIME WITH TIME ZONE as java.time.OffsetTime object. + Also methods ResultSetMetaData.getColumnClassName() and + ParameterMetaData.getParameterClassName() now return + java.time.OffsetDateTime.class for columns of type TIMESTAMP WITH TIME ZONE + and java.time.OffsetTime.class for columns of type TIME WITH TIME ZONE. + * Thu Oct 12 2023 Martin van Dinther <martin.van.dinther@monetdbsolutions.com> - Improved DatabaseMetaData.getSystemFunctions(). It now also returns functions: current_sessionid, greatest, ifnull, least, sql_max, sql_min. @@ -34,9 +55,9 @@ * Wed Jul 5 2023 Martin van Dinther <martin.van.dinther@monetdbsolutions.com> - Corrected implementation of Connection methods getClientInfo() and - setClientInfo(). They used to get/set Connection properties instead - of Client Info properties which was a incorrect. MonetDB does not - support Client Info properties. + setClientInfo(). They used to get/set Connection properties instead of + Client Info properties, which was incorrect. MonetDB does not support + Client Info properties. * Thu Jun 22 2023 Martin van Dinther <martin.van.dinther@monetdbsolutions.com> - Corrected DatabaseMetaData method getClientProperties().
--- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -all: src/main/java/org/monetdb/jdbc/MonetVersion.java +all: src/main/java/org/monetdb/jdbc/MonetVersion.java.in ant -f build.xml distjdbc distmerocontrol cd tests; ant -f build.xml jar_jdbctests @@ -7,9 +7,6 @@ jre17jars: src/main/java/org/monetdb/jdb ant -f build_jre17.xml distjdbc rm -rf build -src/main/java/org/monetdb/jdbc/MonetVersion.java: build.properties src/main/java/org/monetdb/jdbc/MonetVersion.java.in - . ./build.properties; sed -e "s/@JDBC_MAJOR@/$$JDBC_MAJOR/g;s/@JDBC_MINOR@/$$JDBC_MINOR/g;s/@JDBC_VER_SUFFIX@/$$JDBC_VER_SUFFIX $$buildno/g" src/main/java/org/monetdb/jdbc/MonetVersion.java.in > src/main/java/org/monetdb/jdbc/MonetVersion.java - testsjar: cd tests; ant -f build.xml jar_jdbctests
--- a/SQLSTATEs +++ b/SQLSTATEs @@ -27,6 +27,11 @@ 22M29 invalid inet format 22M30 invalid URL format 22M31 invalid UUID format 22M32 invalid JSON format +22M33 invalid Date format +22M34 invalid Time format +22M35 invalid Timestamp format +22M36 invalid Time with time zone format +22M37 invalid Timestamp with time zone format 2BM37 dependent objects still exist 2DM30 autocommit mode active
--- a/build.xml +++ b/build.xml @@ -1,11 +1,15 @@ <?xml version="1.0"?><!-- vim:set ts=2 sw=2 expandtab: --> <!-- +SPDX-License-Identifier: MPL-2.0 + 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 - 2023 MonetDB B.V. +Copyright 2024 MonetDB Foundation; +Copyright August 2008 - 2023 MonetDB B.V.; +Copyright 1997 - July 2008 CWI. --> <!-- @@ -49,8 +53,6 @@ Copyright 1997 - July 2008 CWI, August 2 value="${jardir}/jdbcclient.${jre.version}.jar" /> <property name="jmonetdb-jar" value="${jardir}/jmonetdb.${jre.version}.jar" /> - <property name="mcl-jar" - value="${jardir}/monetdb-mcl-${MCL_MAJOR}.${MCL_MINOR}.${jre.version}.jar" /> <property name="mero-control-jar" value="${jardir}/merocontrol.${jre.version}.jar" /> @@ -253,8 +255,6 @@ Copyright 1997 - July 2008 CWI, August 2 <!-- Some defaults --> <filter token="JDBC_MAJOR" value="${JDBC_MAJOR}" /> <filter token="JDBC_MINOR" value="${JDBC_MINOR}" /> - <filter token="MCL_MAJOR" value="${MCL_MAJOR}" /> - <filter token="MCL_MINOR" value="${MCL_MINOR}" /> <filter token="JDBC_VER_SUFFIX" value="${JDBC_VER_SUFFIX} ${TODAY}" /> <fail unless="JDBC_MAJOR" message="'JDBC_MAJOR' undefined. Please follow the directions in build.properties."/>
--- a/build_jre17.xml +++ b/build_jre17.xml @@ -1,11 +1,15 @@ <?xml version="1.0"?><!-- vim:set ts=2 sw=2 expandtab: --> <!-- +SPDX-License-Identifier: MPL-2.0 + 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 - 2023 MonetDB B.V. +Copyright 2024 MonetDB Foundation; +Copyright August 2008 - 2023 MonetDB B.V.; +Copyright 1997 - July 2008 CWI. --> <!-- @@ -41,7 +45,7 @@ Copyright 1997 - July 2008 CWI, August 2 <property name="jvm.version" value="17" /> <property name="jre.version" value="jre17" /> - <property name="javac.flags" value="-source 17" /> + <property name="javac.flags" value="-source 8" /> <property name="javac.flags" value="-target 17" /> <property name="javac.flags" value="-profile compact2" /> <property name="javac.flags" value="-Xlint" /> @@ -52,8 +56,6 @@ Copyright 1997 - July 2008 CWI, August 2 value="${jardir}/jdbcclient.${jre.version}.jar" /> <property name="jmonetdb-jar" value="${jardir}/jmonetdb.${jre.version}.jar" /> - <property name="mcl-jar" - value="${jardir}/monetdb-mcl-${MCL_MAJOR}.${MCL_MINOR}.${jre.version}.jar" /> <property name="mero-control-jar" value="${jardir}/merocontrol.${jre.version}.jar" /> @@ -256,8 +258,6 @@ Copyright 1997 - July 2008 CWI, August 2 <!-- Some defaults --> <filter token="JDBC_MAJOR" value="${JDBC_MAJOR}" /> <filter token="JDBC_MINOR" value="${JDBC_MINOR}" /> - <filter token="MCL_MAJOR" value="${MCL_MAJOR}" /> - <filter token="MCL_MINOR" value="${MCL_MINOR}" /> <filter token="JDBC_VER_SUFFIX" value="${JDBC_VER_SUFFIX} ${TODAY}" /> <fail unless="JDBC_MAJOR" message="'JDBC_MAJOR' undefined. Please follow the directions in build.properties."/>
--- a/example/MJDBCTest.java +++ b/example/MJDBCTest.java @@ -1,9 +1,13 @@ /* + * SPDX-License-Identifier: MPL-2.0 + * * 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 - 2023 MonetDB B.V. + * Copyright 2024 MonetDB Foundation; + * Copyright August 2008 - 2023 MonetDB B.V.; + * Copyright 1997 - July 2008 CWI. */ import java.sql.*;
--- a/example/OnClientExample.java +++ b/example/OnClientExample.java @@ -1,9 +1,13 @@ /* + * SPDX-License-Identifier: MPL-2.0 + * * 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 - 2023 MonetDB B.V. + * Copyright 2024 MonetDB Foundation; + * Copyright August 2008 - 2023 MonetDB B.V.; + * Copyright 1997 - July 2008 CWI. */ import org.monetdb.jdbc.MonetConnection;
--- a/example/PreparedExample.java +++ b/example/PreparedExample.java @@ -1,9 +1,13 @@ /* + * SPDX-License-Identifier: MPL-2.0 + * * 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 - 2023 MonetDB B.V. + * Copyright 2024 MonetDB Foundation; + * Copyright August 2008 - 2023 MonetDB B.V.; + * Copyright 1997 - July 2008 CWI. */ import java.sql.*;
--- a/example/SQLImport.java +++ b/example/SQLImport.java @@ -1,9 +1,13 @@ /* + * SPDX-License-Identifier: MPL-2.0 + * * 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 - 2023 MonetDB B.V. + * Copyright 2024 MonetDB Foundation; + * Copyright August 2008 - 2023 MonetDB B.V.; + * Copyright 1997 - July 2008 CWI. */ import java.sql.*;
--- a/src/main/java/org/monetdb/client/JMonetDB.java +++ b/src/main/java/org/monetdb/client/JMonetDB.java @@ -1,9 +1,13 @@ /* + * SPDX-License-Identifier: MPL-2.0 + * * 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 - 2023 MonetDB B.V. + * Copyright 2024 MonetDB Foundation; + * Copyright August 2008 - 2023 MonetDB B.V.; + * Copyright 1997 - July 2008 CWI. */ package org.monetdb.client;
--- a/src/main/java/org/monetdb/client/JdbcClient.java +++ b/src/main/java/org/monetdb/client/JdbcClient.java @@ -1,9 +1,13 @@ /* + * SPDX-License-Identifier: MPL-2.0 + * * 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 - 2023 MonetDB B.V. + * Copyright 2024 MonetDB Foundation; + * Copyright August 2008 - 2023 MonetDB B.V.; + * Copyright 1997 - July 2008 CWI. */ package org.monetdb.client; @@ -754,7 +758,9 @@ public final class JdbcClient { } else if (command.equals("\\vsgi_noheader")) { // used only for internal automated testing MDBvalidator.validateSqlGeomTablesIntegrity(con, false); } else if (command.startsWith("\\vsi ")) { - String schema_nm = command.substring(5); + String schema_nm = command.substring(5).trim(); + if (schema_nm.endsWith(";")) + schema_nm = schema_nm.substring(0, schema_nm.length() - 1); MDBvalidator.validateSchemaIntegrity(con, schema_nm, true); } else if (command.startsWith("\\vsi_noheader ")) { // used only for internal automated testing String schema_nm = command.substring(14);
--- a/src/main/java/org/monetdb/jdbc/MonetBlob.java +++ b/src/main/java/org/monetdb/jdbc/MonetBlob.java @@ -1,9 +1,13 @@ /* + * SPDX-License-Identifier: MPL-2.0 + * * 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 - 2023 MonetDB B.V. + * Copyright 2024 MonetDB Foundation; + * Copyright August 2008 - 2023 MonetDB B.V.; + * Copyright 1997 - July 2008 CWI. */ package org.monetdb.jdbc;
--- a/src/main/java/org/monetdb/jdbc/MonetCallableStatement.java +++ b/src/main/java/org/monetdb/jdbc/MonetCallableStatement.java @@ -1,9 +1,13 @@ /* + * SPDX-License-Identifier: MPL-2.0 + * * 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 - 2023 MonetDB B.V. + * Copyright 2024 MonetDB Foundation; + * Copyright August 2008 - 2023 MonetDB B.V.; + * Copyright 1997 - July 2008 CWI. */ package org.monetdb.jdbc;
--- a/src/main/java/org/monetdb/jdbc/MonetClob.java +++ b/src/main/java/org/monetdb/jdbc/MonetClob.java @@ -1,9 +1,13 @@ /* + * SPDX-License-Identifier: MPL-2.0 + * * 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 - 2023 MonetDB B.V. + * Copyright 2024 MonetDB Foundation; + * Copyright August 2008 - 2023 MonetDB B.V.; + * Copyright 1997 - July 2008 CWI. */ package org.monetdb.jdbc;
--- a/src/main/java/org/monetdb/jdbc/MonetConnection.java +++ b/src/main/java/org/monetdb/jdbc/MonetConnection.java @@ -1,9 +1,13 @@ /* + * SPDX-License-Identifier: MPL-2.0 + * * 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 - 2023 MonetDB B.V. + * Copyright 2024 MonetDB Foundation; + * Copyright August 2008 - 2023 MonetDB B.V.; + * Copyright 1997 - July 2008 CWI. */ package org.monetdb.jdbc;
--- a/src/main/java/org/monetdb/jdbc/MonetDataSource.java +++ b/src/main/java/org/monetdb/jdbc/MonetDataSource.java @@ -1,9 +1,13 @@ /* + * SPDX-License-Identifier: MPL-2.0 + * * 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 - 2023 MonetDB B.V. + * Copyright 2024 MonetDB Foundation; + * Copyright August 2008 - 2023 MonetDB B.V.; + * Copyright 1997 - July 2008 CWI. */ package org.monetdb.jdbc;
--- a/src/main/java/org/monetdb/jdbc/MonetDatabaseMetaData.java +++ b/src/main/java/org/monetdb/jdbc/MonetDatabaseMetaData.java @@ -1,9 +1,13 @@ /* + * SPDX-License-Identifier: MPL-2.0 + * * 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 - 2023 MonetDB B.V. + * Copyright 2024 MonetDB Foundation; + * Copyright August 2008 - 2023 MonetDB B.V.; + * Copyright 1997 - July 2008 CWI. */ package org.monetdb.jdbc; @@ -181,7 +185,7 @@ public final class MonetDatabaseMetaData */ @Override public String getDriverVersion() { - return MonetDriver.getDriverVersion(); + return MonetVersion.driverVersion; } /** @@ -191,7 +195,7 @@ public final class MonetDatabaseMetaData */ @Override public int getDriverMajorVersion() { - return MonetDriver.getDriverMajorVersion(); + return MonetVersion.majorVersion; } /** @@ -201,7 +205,7 @@ public final class MonetDatabaseMetaData */ @Override public int getDriverMinorVersion() { - return MonetDriver.getDriverMinorVersion(); + return MonetVersion.minorVersion; } /** @@ -1815,7 +1819,7 @@ public final class MonetDatabaseMetaData "cast(null as char(1)) AS \"COLUMN_DEF\", " + "cast(0 as int) AS \"SQL_DATA_TYPE\", " + "cast(0 as int) AS \"SQL_DATETIME_SUB\", " + - "cast(CASE WHEN a.\"type\" IN ('char','varchar','clob') THEN a.\"type_digits\" ELSE NULL END as int) AS \"CHAR_OCTET_LENGTH\", " + + "cast(CASE WHEN a.\"type\" IN ('varchar','clob','char','json','url','xml') THEN 4 * cast(a.\"type_digits\" as bigint) WHEN a.\"type\" = 'blob' THEN a.\"type_digits\" ELSE NULL END as bigint) AS \"CHAR_OCTET_LENGTH\", " + // in MonetDB procedures have no return value by design. The arguments in sys.args are numbered from 0 so we must add 1 to comply with the API specification. "cast(a.\"number\" + 1 as int) AS \"ORDINAL_POSITION\", " + "cast('' as varchar(3)) AS \"IS_NULLABLE\", " + @@ -1930,14 +1934,36 @@ public final class MonetDatabaseMetaData } if (types != null && types.length > 0) { + boolean foundType = false; query.append(needWhere ? "WHERE" : " AND").append(" tt.\"table_type_name\" IN ("); for (int i = 0; i < types.length; i++) { - if (i > 0) { - query.append(','); + String tabletype = types[i]; + if (tabletype != null && !tabletype.isEmpty()) { + /* Some JDBC applications use different table type names. + * Replace some SQL synonyms to valid MonetDB + * table type names as defined in sys.table_types */ + if ("BASE TABLE".equals(tabletype)) { + tabletype = "TABLE"; + } else + if ("GLOBAL TEMPORARY".equals(tabletype)) { + tabletype = "GLOBAL TEMPORARY TABLE"; + } else + if ("LOCAL TEMPORARY".equals(tabletype)) { + tabletype = "LOCAL TEMPORARY TABLE"; + } + if (foundType) { + query.append(','); + } + query.append('\'').append(tabletype).append('\''); + foundType = true; } - query.append('\'').append(types[i]).append('\''); + } + if (!foundType) { + // we need to have at least one literal in the SQL IN-list else we get a syntax error + query.append("''"); } query.append(')'); + // for debug: System.out.println("SQL (len " + query.length() + "): " + query); } query.append(" ORDER BY \"TABLE_TYPE\", \"TABLE_SCHEM\", \"TABLE_NAME\""); @@ -2131,7 +2157,7 @@ public final class MonetDatabaseMetaData "c.\"default\" AS \"COLUMN_DEF\", " + "cast(0 as int) AS \"SQL_DATA_TYPE\", " + "cast(0 as int) AS \"SQL_DATETIME_SUB\", " + - "cast(CASE WHEN c.\"type\" IN ('char','varchar','clob') THEN c.\"type_digits\" ELSE NULL END as int) AS \"CHAR_OCTET_LENGTH\", " + + "cast(CASE WHEN c.\"type\" IN ('varchar','clob','char','json','url','xml') THEN 4 * cast(c.\"type_digits\" as bigint) ELSE NULL END as bigint) AS \"CHAR_OCTET_LENGTH\", " + "cast(c.\"number\" + 1 as int) AS \"ORDINAL_POSITION\", " + "cast(CASE c.\"null\" WHEN true THEN 'YES' WHEN false THEN 'NO' ELSE '' END AS varchar(3)) AS \"IS_NULLABLE\", " + "cast(null AS char(1)) AS \"SCOPE_CATALOG\", " + @@ -3034,7 +3060,9 @@ public final class MonetDatabaseMetaData " WHEN 'sec_interval' THEN 'interval second'" + " ELSE \"sqlname\" END AS \"TYPE_NAME\", " + "cast(").append(MonetDriver.getSQLTypeMap("\"sqlname\"")).append(" AS int) AS \"DATA_TYPE\", " + - "\"digits\" AS \"PRECISION\", " + // note that when radix is 2 the precision shows the number of bits + "cast(CASE WHEN \"sqlname\" IN ('time','timetz','timestamp','timestamptz') THEN \"digits\" -1" + + " WHEN \"sqlname\" IN ('sec_interval','day_interval') THEN 3" + + " WHEN \"sqlname\" = 'month_interval' THEN 0 ELSE \"digits\" END AS int) AS \"PRECISION\", " + // note that when radix is 2 the precision shows the number of bits "cast(CASE WHEN \"sqlname\" IN ('char','varchar','sec_interval','day_interval','month_interval') THEN ''''" + " WHEN \"sqlname\" IN ('clob','inet','json','url','uuid','date','time','timetz','timestamp','timestamptz','blob','sqlblob','xml') THEN \"sqlname\"||' '''" + " ELSE NULL END AS varchar(16)) AS \"LITERAL_PREFIX\", " + @@ -3043,7 +3071,7 @@ public final class MonetDatabaseMetaData " ELSE NULL END AS varchar(2)) AS \"LITERAL_SUFFIX\", " + "CASE WHEN \"sqlname\" IN ('char','varchar') THEN 'max length'" + " WHEN \"sqlname\" = 'decimal' THEN 'precision, scale'" + - " WHEN \"sqlname\" IN ('time','timetz','timestamp','timestamptz','sec_interval') THEN 'precision'" + + " WHEN \"sqlname\" IN ('time','timetz','timestamp','timestamptz') THEN 'precision'" + " ELSE NULL END AS \"CREATE_PARAMS\", " + "cast(CASE WHEN \"systemname\" = 'oid' THEN " + DatabaseMetaData.typeNoNulls + " ELSE " + DatabaseMetaData.typeNullable + " END AS smallint) AS \"NULLABLE\", " + @@ -3057,7 +3085,8 @@ public final class MonetDatabaseMetaData "CASE WHEN \"sqlname\" IN ('sec_interval','day_interval','month_interval') THEN \"sqlname\" ELSE \"systemname\" END AS \"LOCAL_TYPE_NAME\", " + "cast(0 AS smallint) AS \"MINIMUM_SCALE\", " + "cast(CASE WHEN \"sqlname\" = 'decimal' THEN (CASE \"systemname\" WHEN 'int' THEN 9 WHEN 'lng' THEN 18 WHEN 'sht' THEN 4 WHEN 'hge' THEN 38 WHEN 'bte' THEN 2 ELSE 0 END)" + - " WHEN \"sqlname\" IN ('time','timetz','timestamp','timestamptz','sec_interval') THEN 6 ELSE 0 END AS smallint) AS \"MAXIMUM_SCALE\", " + + " WHEN \"sqlname\" IN ('time','timetz','timestamp','timestamptz') THEN 6" + + " WHEN \"sqlname\" IN ('day_interval','sec_interval') THEN 3 ELSE 0 END AS smallint) AS \"MAXIMUM_SCALE\", " + "cast(0 AS int) AS \"SQL_DATA_TYPE\", " + "cast(0 AS int) AS \"SQL_DATETIME_SUB\", " + "cast(CASE WHEN \"sqlname\" IN ('time','timetz','timestamp','timestamptz','sec_interval') THEN 10 ELSE \"radix\" END AS int) AS \"NUM_PREC_RADIX\" " + @@ -4043,7 +4072,7 @@ public final class MonetDatabaseMetaData // mvd: do not remove next append. The String above is same as used by getProcedureColumns, so shared in class file. "cast(").append(DatabaseMetaData.functionNullableUnknown).append(" AS smallint) AS \"NULLABLE\", " + "cast(null as char(1)) AS \"REMARKS\", " + - "cast(CASE WHEN a.\"type\" IN ('char','varchar','clob') THEN a.\"type_digits\" ELSE NULL END as int) AS \"CHAR_OCTET_LENGTH\", " + + "cast(CASE WHEN a.\"type\" IN ('varchar','clob','char','json','url','xml') THEN 4 * cast(a.\"type_digits\" as bigint) WHEN a.\"type\" = 'blob' THEN a.\"type_digits\" ELSE NULL END as bigint) AS \"CHAR_OCTET_LENGTH\", " + "cast(a.\"number\" as int) AS \"ORDINAL_POSITION\", " + "cast('' as varchar(3)) AS \"IS_NULLABLE\", " + // the specific name contains the function id, in order to be able to match the args to the correct overloaded function name
--- a/src/main/java/org/monetdb/jdbc/MonetDriver.java +++ b/src/main/java/org/monetdb/jdbc/MonetDriver.java @@ -1,9 +1,13 @@ /* + * SPDX-License-Identifier: MPL-2.0 + * * 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 - 2023 MonetDB B.V. + * Copyright 2024 MonetDB Foundation; + * Copyright August 2008 - 2023 MonetDB B.V.; + * Copyright 1997 - July 2008 CWI. */ package org.monetdb.jdbc; @@ -111,8 +115,7 @@ public final class MonetDriver implement */ @Override public int getMajorVersion() { - // defer to the static version of this method - return getDriverMajorVersion(); + return MonetVersion.majorVersion; } /** @@ -122,8 +125,7 @@ public final class MonetDriver implement */ @Override public int getMinorVersion() { - // defer to the static version of this method - return getDriverMinorVersion(); + return MonetVersion.minorVersion; } /** @@ -256,26 +258,6 @@ public final class MonetDriver implement /** - * Get MonetDB JDBC Driver major version number - * method called by MonetDatabaseMetaData methods - * @return MonetDB JDBC Driver major version number - */ - static final int getDriverMajorVersion() { - // defer to the generated MonetVersion class - return MonetVersion.majorVersion; - } - - /** - * Get MonetDB JDBC Driver minor version number - * method called by MonetDatabaseMetaData methods - * @return MonetDB JDBC Driver minor version number - */ - static final int getDriverMinorVersion() { - // defer to the generated MonetVersion class - return MonetVersion.minorVersion; - } - - /** * Returns a touched up identifying version string of this driver. * It is made public as it is called from org/monetdb/client/JdbcClient.java * @return the version string @@ -386,11 +368,13 @@ public final class MonetDriver implement case Types.DATE: return java.sql.Date.class; case Types.TIME: + return java.sql.Time.class; case Types.TIME_WITH_TIMEZONE: - return java.sql.Time.class; + return java.time.OffsetTime.class; case Types.TIMESTAMP: + return java.sql.Timestamp.class; case Types.TIMESTAMP_WITH_TIMEZONE: - return java.sql.Timestamp.class; + return java.time.OffsetDateTime.class; case Types.CLOB: return java.sql.Clob.class; case Types.BLOB:
--- a/src/main/java/org/monetdb/jdbc/MonetParameterMetaData.java +++ b/src/main/java/org/monetdb/jdbc/MonetParameterMetaData.java @@ -1,9 +1,13 @@ /* + * SPDX-License-Identifier: MPL-2.0 + * * 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 - 2023 MonetDB B.V. + * Copyright 2024 MonetDB Foundation; + * Copyright August 2008 - 2023 MonetDB B.V.; + * Copyright 1997 - July 2008 CWI. */ package org.monetdb.jdbc;
--- a/src/main/java/org/monetdb/jdbc/MonetPreparedStatement.java +++ b/src/main/java/org/monetdb/jdbc/MonetPreparedStatement.java @@ -1,9 +1,13 @@ /* + * SPDX-License-Identifier: MPL-2.0 + * * 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 - 2023 MonetDB B.V. + * Copyright 2024 MonetDB Foundation; + * Copyright August 2008 - 2023 MonetDB B.V.; + * Copyright 1997 - July 2008 CWI. */ package org.monetdb.jdbc;
--- a/src/main/java/org/monetdb/jdbc/MonetResultSet.java +++ b/src/main/java/org/monetdb/jdbc/MonetResultSet.java @@ -1,9 +1,13 @@ /* + * SPDX-License-Identifier: MPL-2.0 + * * 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 - 2023 MonetDB B.V. + * Copyright 2024 MonetDB Foundation; + * Copyright August 2008 - 2023 MonetDB B.V.; + * Copyright 1997 - July 2008 CWI. */ package org.monetdb.jdbc; @@ -38,6 +42,12 @@ import java.sql.Time; import java.sql.Timestamp; import java.sql.Types; import java.text.SimpleDateFormat; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.time.OffsetDateTime; +import java.time.OffsetTime; +import java.time.format.DateTimeFormatter; import java.util.Calendar; import java.util.Map; import java.util.TimeZone; @@ -1426,11 +1436,13 @@ public class MonetResultSet case Types.DATE: return getDate(columnIndex, null); case Types.TIME: + return getTime(columnIndex, null); case Types.TIME_WITH_TIMEZONE: - return getTime(columnIndex, null); + return getOffsetTime(columnIndex); case Types.TIMESTAMP: + return getTimestamp(columnIndex, null); case Types.TIMESTAMP_WITH_TIMEZONE: - return getTimestamp(columnIndex, null); + return getOffsetDateTime(columnIndex); case Types.BINARY: case Types.VARBINARY: /* case Types.LONGVARBINARY: // MonetDB doesn't use type LONGVARBINARY */ @@ -1511,33 +1523,62 @@ public class MonetResultSet if (type == null || type == String.class) { return val; - } else if (type == BigDecimal.class) { + } + if (type == BigDecimal.class) { return getBigDecimal(columnIndex); - } else if (type == Boolean.class) { + } + if (type == Boolean.class) { return Boolean.valueOf(getBoolean(columnIndex)); - } else if (type == Short.class) { + } + if (type == Integer.class) { + return Integer.valueOf(getInt(columnIndex)); + } + if (type == Long.class) { + return Long.valueOf(getLong(columnIndex)); + } + if (type == Short.class) { return Short.valueOf(getShort(columnIndex)); - } else if (type == Integer.class) { - return Integer.valueOf(getInt(columnIndex)); - } else if (type == Long.class) { - return Long.valueOf(getLong(columnIndex)); - } else if (type == Float.class) { - return Float.valueOf(getFloat(columnIndex)); - } else if (type == Double.class) { + } + if (type == Double.class) { return Double.valueOf(getDouble(columnIndex)); - } else if (type == byte[].class) { - return getBytes(columnIndex); - } else if (type == Date.class) { + } + if (type == Float.class) { + return Float.valueOf(getFloat(columnIndex)); + } + if (type == Date.class) { return getDate(columnIndex, null); - } else if (type == Time.class) { + } + if (type == Time.class) { return getTime(columnIndex, null); - } else if (type == Timestamp.class) { + } + if (type == Timestamp.class) { return getTimestamp(columnIndex, null); - } else if (type == Clob.class) { + } + if (type == LocalDate.class) { + return getLocalDate(columnIndex); + } + if (type == LocalDateTime.class) { + return getLocalDateTime(columnIndex); + } + if (type == LocalTime.class) { + return getLocalTime(columnIndex); + } + if (type == OffsetDateTime.class) { + return getOffsetDateTime(columnIndex); + } + if (type == OffsetTime.class) { + return getOffsetTime(columnIndex); + } + if (type == Clob.class) { return getClob(columnIndex); - } else if (type == Blob.class) { + } + if (type == Blob.class) { return getBlob(columnIndex); - } else if (classImplementsSQLData(type)) { + } + if (type == byte[].class) { + return getBytes(columnIndex); + } + if (classImplementsSQLData(type)) { final SQLData x; try { final java.lang.reflect.Constructor<? extends SQLData> ctor = @@ -1694,9 +1735,8 @@ public class MonetResultSet }; x.readSQL(input, MonetDBtype); return x; - } else { - return val; } + return val; } /** @@ -3254,6 +3294,21 @@ public class MonetResultSet if (type == Timestamp.class) { return type.cast(getTimestamp(columnIndex, null)); } + if (type == LocalDate.class) { + return type.cast(getLocalDate(columnIndex)); + } + if (type == LocalDateTime.class) { + return type.cast(getLocalDateTime(columnIndex)); + } + if (type == LocalTime.class) { + return type.cast(getLocalTime(columnIndex)); + } + if (type == OffsetDateTime.class) { + return type.cast(getOffsetDateTime(columnIndex)); + } + if (type == OffsetTime.class) { + return type.cast(getOffsetTime(columnIndex)); + } if (type == java.util.Date.class) { final Timestamp timestamp = getTimestamp(columnIndex, null); return type.cast(new java.util.Date(timestamp.getTime())); @@ -3362,6 +3417,163 @@ public class MonetResultSet } /** + * Retrieves the value of the designated column in the current row + * of this ResultSet object and will convert to LocalDate. + * If the conversion is not supported a SQLException is thrown. + * + * @param columnIndex the first column is 1, the second is 2, ... + * @return LocalDate object or null + * @throws SQLException if conversion is not supported + */ + private LocalDate getLocalDate(final int columnIndex) throws SQLException { + final String val; + try { + val = tlp.values[columnIndex - 1]; + if (val == null) { + lastReadWasNull = true; + return null; + } + lastReadWasNull = false; + + // Note: ISO_LOCAL_DATE format requires the year to have 4 (or more) digits else parse will fail + // This means years -999 to 999 will fail to parse. They should have been zero padded, so -0999 to 0999. + return LocalDate.parse(val, DateTimeFormatter.ISO_LOCAL_DATE); + } catch (IndexOutOfBoundsException e) { + throw newSQLInvalidColumnIndexException(columnIndex); + } catch (java.time.format.DateTimeParseException e) { + throw new SQLException("Failed to convert to LocalDate: " + e.getMessage(), "22M33"); + } + } + + /** + * Retrieves the value of the designated column in the current row + * of this ResultSet object and will convert to LocalDateTime. + * If the conversion is not supported a SQLException is thrown. + * + * @param columnIndex the first column is 1, the second is 2, ... + * @return LocalDateTime object or null + * @throws SQLException if conversion is not supported + */ + private LocalDateTime getLocalDateTime(final int columnIndex) throws SQLException { + final String val; + try { + val = tlp.values[columnIndex - 1]; + if (val == null) { + lastReadWasNull = true; + return null; + } + lastReadWasNull = false; + + // ISO_LOCAL_DATE_TIME format expects a 'T' instead of a space between date and time parts + // replace the space between date and time parts with 'T' + String val_new = val; + final int space = val.indexOf(' ', 4); + if (space > 4 && space < 16) { + val_new = val.substring(0, space) + "T" + val.substring(space + 1); + // System.out.println("getLocalDateTime() changed " + val + " into " + val_new); + } + + // Note: ISO_LOCAL_DATE_TIME format requires the year to have 4 (or more) digits else parse will fail + // This means years -999 to 999 will fail to parse. They should have been zero padded, so -0999 to 0999. + return LocalDateTime.parse(val_new, DateTimeFormatter.ISO_LOCAL_DATE_TIME); + } catch (IndexOutOfBoundsException e) { + throw newSQLInvalidColumnIndexException(columnIndex); + } catch (java.time.format.DateTimeParseException e) { + throw new SQLException("Failed to convert to LocalDateTime: " + e.getMessage(), "22M35"); + } + } + + /** + * Retrieves the value of the designated column in the current row + * of this ResultSet object and will convert to LocalTime. + * If the conversion is not supported a SQLException is thrown. + * + * @param columnIndex the first column is 1, the second is 2, ... + * @return LocalTime object or null + * @throws SQLException if conversion is not supported + */ + private LocalTime getLocalTime(final int columnIndex) throws SQLException { + final String val; + try { + val = tlp.values[columnIndex - 1]; + if (val == null) { + lastReadWasNull = true; + return null; + } + lastReadWasNull = false; + return LocalTime.parse(val, DateTimeFormatter.ISO_LOCAL_TIME); + } catch (IndexOutOfBoundsException e) { + throw newSQLInvalidColumnIndexException(columnIndex); + } catch (java.time.format.DateTimeParseException e) { + throw new SQLException("Failed to convert to LocalTime: " + e.getMessage(), "22M34"); + } + } + + /** + * Retrieves the value of the designated column in the current row + * of this ResultSet object and will convert to OffsetDateTime. + * If the conversion is not supported a SQLException is thrown. + * + * @param columnIndex the first column is 1, the second is 2, ... + * @return OffsetDateTime object or null + * @throws SQLException if conversion is not supported + */ + private OffsetDateTime getOffsetDateTime(final int columnIndex) throws SQLException { + final String val; + try { + val = tlp.values[columnIndex - 1]; + if (val == null) { + lastReadWasNull = true; + return null; + } + lastReadWasNull = false; + + // ISO_OFFSET_DATE_TIME format expects a 'T' instead of a space between date and time parts + // replace the space between date and time parts with 'T' + String val_new = val; + final int space = val.indexOf(' ', 4); + if (space > 4 && space < 16) { + val_new = val.substring(0, space) + "T" + val.substring(space + 1); + // System.out.println("getOffsetDateTime() changed " + val + " into " + val_new); + } + + // Note: ISO_OFFSET_DATE_TIME format requires the year to have 4 (or more) digits else parse will fail + // This means years -999 to 999 will fail to parse. They should have been zero padded, so -0999 to 0999. + return OffsetDateTime.parse(val_new, DateTimeFormatter.ISO_OFFSET_DATE_TIME); + } catch (IndexOutOfBoundsException e) { + throw newSQLInvalidColumnIndexException(columnIndex); + } catch (java.time.format.DateTimeParseException e) { + throw new SQLException("Failed to convert to OffsetDateTime: " + e.getMessage(), "22M37"); + } + } + + /** + * Retrieves the value of the designated column in the current row + * of this ResultSet object and will convert to OffsetTime. + * If the conversion is not supported a SQLException is thrown. + * + * @param columnIndex the first column is 1, the second is 2, ... + * @return OffsetTime object or null + * @throws SQLException if conversion is not supported + */ + private OffsetTime getOffsetTime(final int columnIndex) throws SQLException { + final String val; + try { + val = tlp.values[columnIndex - 1]; + if (val == null) { + lastReadWasNull = true; + return null; + } + lastReadWasNull = false; + return OffsetTime.parse(val, DateTimeFormatter.ISO_TIME); + } catch (IndexOutOfBoundsException e) { + throw newSQLInvalidColumnIndexException(columnIndex); + } catch (java.time.format.DateTimeParseException e) { + throw new SQLException("Failed to convert to OffsetTime: " + e.getMessage(), "22M36"); + } + } + + /** * Small helper method that formats the "Invalid Column Index number ..." message * and creates a new SQLDataException object whose SQLState is set * to "22010": invalid indicator parameter value.
--- a/src/main/java/org/monetdb/jdbc/MonetResultSetMetaData.java +++ b/src/main/java/org/monetdb/jdbc/MonetResultSetMetaData.java @@ -1,9 +1,13 @@ /* + * SPDX-License-Identifier: MPL-2.0 + * * 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 - 2023 MonetDB B.V. + * Copyright 2024 MonetDB Foundation; + * Copyright August 2008 - 2023 MonetDB B.V.; + * Copyright 1997 - July 2008 CWI. */ package org.monetdb.jdbc;
--- a/src/main/java/org/monetdb/jdbc/MonetSavepoint.java +++ b/src/main/java/org/monetdb/jdbc/MonetSavepoint.java @@ -1,9 +1,13 @@ /* + * SPDX-License-Identifier: MPL-2.0 + * * 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 - 2023 MonetDB B.V. + * Copyright 2024 MonetDB Foundation; + * Copyright August 2008 - 2023 MonetDB B.V.; + * Copyright 1997 - July 2008 CWI. */ package org.monetdb.jdbc;
--- a/src/main/java/org/monetdb/jdbc/MonetStatement.java +++ b/src/main/java/org/monetdb/jdbc/MonetStatement.java @@ -1,9 +1,13 @@ /* + * SPDX-License-Identifier: MPL-2.0 + * * 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 - 2023 MonetDB B.V. + * Copyright 2024 MonetDB Foundation; + * Copyright August 2008 - 2023 MonetDB B.V.; + * Copyright 1997 - July 2008 CWI. */ package org.monetdb.jdbc;
--- a/src/main/java/org/monetdb/jdbc/MonetVersion.java.in +++ b/src/main/java/org/monetdb/jdbc/MonetVersion.java.in @@ -1,6 +1,18 @@ +/* + * SPDX-License-Identifier: MPL-2.0 + * + * 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 2024 MonetDB Foundation; + * Copyright August 2008 - 2023 MonetDB B.V.; + * Copyright 1997 - July 2008 CWI. + */ + package org.monetdb.jdbc; -public final class MonetVersion { +final class MonetVersion { /** * Major version of MonetDB JDBC driver. @@ -17,4 +29,3 @@ public final class MonetVersion { */ public static String driverVersion = "@JDBC_MAJOR@.@JDBC_MINOR@ (@JDBC_VER_SUFFIX@)"; } -
--- a/src/main/java/org/monetdb/jdbc/MonetWrapper.java +++ b/src/main/java/org/monetdb/jdbc/MonetWrapper.java @@ -1,9 +1,13 @@ /* + * SPDX-License-Identifier: MPL-2.0 + * * 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 - 2023 MonetDB B.V. + * Copyright 2024 MonetDB Foundation; + * Copyright August 2008 - 2023 MonetDB B.V.; + * Copyright 1997 - July 2008 CWI. */ package org.monetdb.jdbc;
--- a/src/main/java/org/monetdb/jdbc/types/INET.java +++ b/src/main/java/org/monetdb/jdbc/types/INET.java @@ -1,9 +1,13 @@ /* + * SPDX-License-Identifier: MPL-2.0 + * * 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 - 2023 MonetDB B.V. + * Copyright 2024 MonetDB Foundation; + * Copyright August 2008 - 2023 MonetDB B.V.; + * Copyright 1997 - July 2008 CWI. */ package org.monetdb.jdbc.types;
--- a/src/main/java/org/monetdb/jdbc/types/URL.java +++ b/src/main/java/org/monetdb/jdbc/types/URL.java @@ -1,9 +1,13 @@ /* + * SPDX-License-Identifier: MPL-2.0 + * * 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 - 2023 MonetDB B.V. + * Copyright 2024 MonetDB Foundation; + * Copyright August 2008 - 2023 MonetDB B.V.; + * Copyright 1997 - July 2008 CWI. */ package org.monetdb.jdbc.types;
--- a/src/main/java/org/monetdb/mcl/MCLException.java +++ b/src/main/java/org/monetdb/mcl/MCLException.java @@ -1,9 +1,13 @@ /* + * SPDX-License-Identifier: MPL-2.0 + * * 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 - 2023 MonetDB B.V. + * Copyright 2024 MonetDB Foundation; + * Copyright August 2008 - 2023 MonetDB B.V.; + * Copyright 1997 - July 2008 CWI. */ package org.monetdb.mcl;
--- a/src/main/java/org/monetdb/mcl/io/BufferedMCLReader.java +++ b/src/main/java/org/monetdb/mcl/io/BufferedMCLReader.java @@ -1,9 +1,13 @@ /* + * SPDX-License-Identifier: MPL-2.0 + * * 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 - 2023 MonetDB B.V. + * Copyright 2024 MonetDB Foundation; + * Copyright August 2008 - 2023 MonetDB B.V.; + * Copyright 1997 - July 2008 CWI. */ package org.monetdb.mcl.io;
--- a/src/main/java/org/monetdb/mcl/io/BufferedMCLWriter.java +++ b/src/main/java/org/monetdb/mcl/io/BufferedMCLWriter.java @@ -1,9 +1,13 @@ /* + * SPDX-License-Identifier: MPL-2.0 + * * 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 - 2023 MonetDB B.V. + * Copyright 2024 MonetDB Foundation; + * Copyright August 2008 - 2023 MonetDB B.V.; + * Copyright 1997 - July 2008 CWI. */ package org.monetdb.mcl.io;
--- a/src/main/java/org/monetdb/mcl/io/LineType.java +++ b/src/main/java/org/monetdb/mcl/io/LineType.java @@ -1,9 +1,13 @@ /* + * SPDX-License-Identifier: MPL-2.0 + * * 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 - 2023 MonetDB B.V. + * Copyright 2024 MonetDB Foundation; + * Copyright August 2008 - 2023 MonetDB B.V.; + * Copyright 1997 - July 2008 CWI. */ package org.monetdb.mcl.io;
--- a/src/main/java/org/monetdb/mcl/net/HandshakeOption.java +++ b/src/main/java/org/monetdb/mcl/net/HandshakeOption.java @@ -1,9 +1,13 @@ /* + * SPDX-License-Identifier: MPL-2.0 + * * 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 - 2023 MonetDB B.V. + * Copyright 2024 MonetDB Foundation; + * Copyright August 2008 - 2023 MonetDB B.V.; + * Copyright 1997 - July 2008 CWI. */ package org.monetdb.mcl.net;
--- a/src/main/java/org/monetdb/mcl/net/MapiSocket.java +++ b/src/main/java/org/monetdb/mcl/net/MapiSocket.java @@ -1,9 +1,13 @@ /* + * SPDX-License-Identifier: MPL-2.0 + * * 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 - 2023 MonetDB B.V. + * Copyright 2024 MonetDB Foundation; + * Copyright August 2008 - 2023 MonetDB B.V.; + * Copyright 1997 - July 2008 CWI. */ package org.monetdb.mcl.net;
--- a/src/main/java/org/monetdb/mcl/parser/HeaderLineParser.java +++ b/src/main/java/org/monetdb/mcl/parser/HeaderLineParser.java @@ -1,9 +1,13 @@ /* + * SPDX-License-Identifier: MPL-2.0 + * * 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 - 2023 MonetDB B.V. + * Copyright 2024 MonetDB Foundation; + * Copyright August 2008 - 2023 MonetDB B.V.; + * Copyright 1997 - July 2008 CWI. */ package org.monetdb.mcl.parser;
--- a/src/main/java/org/monetdb/mcl/parser/MCLParseException.java +++ b/src/main/java/org/monetdb/mcl/parser/MCLParseException.java @@ -1,9 +1,13 @@ /* + * SPDX-License-Identifier: MPL-2.0 + * * 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 - 2023 MonetDB B.V. + * Copyright 2024 MonetDB Foundation; + * Copyright August 2008 - 2023 MonetDB B.V.; + * Copyright 1997 - July 2008 CWI. */ package org.monetdb.mcl.parser;
--- a/src/main/java/org/monetdb/mcl/parser/MCLParser.java +++ b/src/main/java/org/monetdb/mcl/parser/MCLParser.java @@ -1,9 +1,13 @@ /* + * SPDX-License-Identifier: MPL-2.0 + * * 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 - 2023 MonetDB B.V. + * Copyright 2024 MonetDB Foundation; + * Copyright August 2008 - 2023 MonetDB B.V.; + * Copyright 1997 - July 2008 CWI. */ package org.monetdb.mcl.parser;
--- a/src/main/java/org/monetdb/mcl/parser/StartOfHeaderParser.java +++ b/src/main/java/org/monetdb/mcl/parser/StartOfHeaderParser.java @@ -1,9 +1,13 @@ /* + * SPDX-License-Identifier: MPL-2.0 + * * 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 - 2023 MonetDB B.V. + * Copyright 2024 MonetDB Foundation; + * Copyright August 2008 - 2023 MonetDB B.V.; + * Copyright 1997 - July 2008 CWI. */ package org.monetdb.mcl.parser;
--- a/src/main/java/org/monetdb/mcl/parser/TupleLineParser.java +++ b/src/main/java/org/monetdb/mcl/parser/TupleLineParser.java @@ -1,9 +1,13 @@ /* + * SPDX-License-Identifier: MPL-2.0 + * * 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 - 2023 MonetDB B.V. + * Copyright 2024 MonetDB Foundation; + * Copyright August 2008 - 2023 MonetDB B.V.; + * Copyright 1997 - July 2008 CWI. */ package org.monetdb.mcl.parser;
--- a/src/main/java/org/monetdb/merovingian/Control.java +++ b/src/main/java/org/monetdb/merovingian/Control.java @@ -1,9 +1,13 @@ /* + * SPDX-License-Identifier: MPL-2.0 + * * 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 - 2023 MonetDB B.V. + * Copyright 2024 MonetDB Foundation; + * Copyright August 2008 - 2023 MonetDB B.V.; + * Copyright 1997 - July 2008 CWI. */ package org.monetdb.merovingian;
--- a/src/main/java/org/monetdb/merovingian/MerovingianException.java +++ b/src/main/java/org/monetdb/merovingian/MerovingianException.java @@ -1,9 +1,13 @@ /* + * SPDX-License-Identifier: MPL-2.0 + * * 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 - 2023 MonetDB B.V. + * Copyright 2024 MonetDB Foundation; + * Copyright August 2008 - 2023 MonetDB B.V.; + * Copyright 1997 - July 2008 CWI. */ package org.monetdb.merovingian;
--- a/src/main/java/org/monetdb/merovingian/SabaothDB.java +++ b/src/main/java/org/monetdb/merovingian/SabaothDB.java @@ -1,9 +1,13 @@ /* + * SPDX-License-Identifier: MPL-2.0 + * * 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 - 2023 MonetDB B.V. + * Copyright 2024 MonetDB Foundation; + * Copyright August 2008 - 2023 MonetDB B.V.; + * Copyright 1997 - July 2008 CWI. */ package org.monetdb.merovingian;
--- a/src/main/java/org/monetdb/util/CmdLineOpts.java +++ b/src/main/java/org/monetdb/util/CmdLineOpts.java @@ -1,9 +1,13 @@ /* + * SPDX-License-Identifier: MPL-2.0 + * * 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 - 2023 MonetDB B.V. + * Copyright 2024 MonetDB Foundation; + * Copyright August 2008 - 2023 MonetDB B.V.; + * Copyright 1997 - July 2008 CWI. */ package org.monetdb.util;
--- a/src/main/java/org/monetdb/util/Exporter.java +++ b/src/main/java/org/monetdb/util/Exporter.java @@ -1,9 +1,13 @@ /* + * SPDX-License-Identifier: MPL-2.0 + * * 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 - 2023 MonetDB B.V. + * Copyright 2024 MonetDB Foundation; + * Copyright August 2008 - 2023 MonetDB B.V.; + * Copyright 1997 - July 2008 CWI. */ package org.monetdb.util;
--- a/src/main/java/org/monetdb/util/Extract.java +++ b/src/main/java/org/monetdb/util/Extract.java @@ -1,9 +1,13 @@ /* + * SPDX-License-Identifier: MPL-2.0 + * * 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 - 2023 MonetDB B.V. + * Copyright 2024 MonetDB Foundation; + * Copyright August 2008 - 2023 MonetDB B.V.; + * Copyright 1997 - July 2008 CWI. */ package org.monetdb.util;
--- a/src/main/java/org/monetdb/util/FileTransferHandler.java +++ b/src/main/java/org/monetdb/util/FileTransferHandler.java @@ -1,9 +1,13 @@ /* + * SPDX-License-Identifier: MPL-2.0 + * * 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 - 2023 MonetDB B.V. + * Copyright 2024 MonetDB Foundation; + * Copyright August 2008 - 2023 MonetDB B.V.; + * Copyright 1997 - July 2008 CWI. */ package org.monetdb.util;
--- a/src/main/java/org/monetdb/util/MDBvalidator.java +++ b/src/main/java/org/monetdb/util/MDBvalidator.java @@ -1,9 +1,13 @@ /* + * SPDX-License-Identifier: MPL-2.0 + * * 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 - 2023 MonetDB B.V. + * Copyright 2024 MonetDB Foundation; + * Copyright August 2008 - 2023 MonetDB B.V.; + * Copyright 1997 - July 2008 CWI. */ package org.monetdb.util;
--- a/src/main/java/org/monetdb/util/OptionsException.java +++ b/src/main/java/org/monetdb/util/OptionsException.java @@ -1,9 +1,13 @@ /* + * SPDX-License-Identifier: MPL-2.0 + * * 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 - 2023 MonetDB B.V. + * Copyright 2024 MonetDB Foundation; + * Copyright August 2008 - 2023 MonetDB B.V.; + * Copyright 1997 - July 2008 CWI. */ package org.monetdb.util;
--- a/src/main/java/org/monetdb/util/SQLExporter.java +++ b/src/main/java/org/monetdb/util/SQLExporter.java @@ -1,9 +1,13 @@ /* + * SPDX-License-Identifier: MPL-2.0 + * * 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 - 2023 MonetDB B.V. + * Copyright 2024 MonetDB Foundation; + * Copyright August 2008 - 2023 MonetDB B.V.; + * Copyright 1997 - July 2008 CWI. */ package org.monetdb.util;
--- a/src/main/java/org/monetdb/util/SQLRestore.java +++ b/src/main/java/org/monetdb/util/SQLRestore.java @@ -1,9 +1,13 @@ /* + * SPDX-License-Identifier: MPL-2.0 + * * 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 - 2023 MonetDB B.V. + * Copyright 2024 MonetDB Foundation; + * Copyright August 2008 - 2023 MonetDB B.V.; + * Copyright 1997 - July 2008 CWI. */ package org.monetdb.util;
--- a/src/main/java/org/monetdb/util/XMLExporter.java +++ b/src/main/java/org/monetdb/util/XMLExporter.java @@ -1,9 +1,13 @@ /* + * SPDX-License-Identifier: MPL-2.0 + * * 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 - 2023 MonetDB B.V. + * Copyright 2024 MonetDB Foundation; + * Copyright August 2008 - 2023 MonetDB B.V.; + * Copyright 1997 - July 2008 CWI. */ package org.monetdb.util;
--- a/tests/ConnectionTests.java +++ b/tests/ConnectionTests.java @@ -1,9 +1,13 @@ /* + * SPDX-License-Identifier: MPL-2.0 + * * 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 - 2023 MonetDB B.V. + * Copyright 2024 MonetDB Foundation; + * Copyright August 2008 - 2023 MonetDB B.V.; + * Copyright 1997 - July 2008 CWI. */ import java.sql.Connection;
--- a/tests/JDBC_API_Tester.java +++ b/tests/JDBC_API_Tester.java @@ -1,9 +1,13 @@ /* + * SPDX-License-Identifier: MPL-2.0 + * * 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 - 2023 MonetDB B.V. + * Copyright 2024 MonetDB Foundation; + * Copyright August 2008 - 2023 MonetDB B.V.; + * Copyright 1997 - July 2008 CWI. */ import java.sql.*; @@ -37,7 +41,7 @@ import org.monetdb.jdbc.types.URL; */ final public class JDBC_API_Tester { StringBuilder sb; // buffer to collect the test output - final static int sbInitLen = 3712; + final static int sbInitLen = 5224; Connection con; // main connection shared by all tests int dbmsMajorVersion; int dbmsMinorVersion; @@ -775,9 +779,9 @@ final public class JDBC_API_Tester { compareResultSet(dbmd.getColumns(null, "sys", "table\\_types", null), "getColumns(null, sys, table\\_types, null)", "Resultset with 24 columns\n" + "TABLE_CAT TABLE_SCHEM TABLE_NAME COLUMN_NAME DATA_TYPE TYPE_NAME COLUMN_SIZE BUFFER_LENGTH DECIMAL_DIGITS NUM_PREC_RADIX NULLABLE REMARKS COLUMN_DEF SQL_DATA_TYPE SQL_DATETIME_SUB CHAR_OCTET_LENGTH ORDINAL_POSITION IS_NULLABLE SCOPE_CATALOG SCOPE_SCHEMA SCOPE_TABLE SOURCE_DATA_TYPE IS_AUTOINCREMENT IS_GENERATEDCOLUMN\n" + - "char(1) varchar(1024) varchar(1024) varchar(1024) int varchar(1024) int int int int int varchar(65000) varchar(2048) int int int int varchar(3) char(1) char(1) char(1) smallint char(3) varchar(3)\n" + + "char(1) varchar(1024) varchar(1024) varchar(1024) int varchar(1024) int int int int int varchar(65000) varchar(2048) int int bigint int varchar(3) char(1) char(1) char(1) smallint char(3) varchar(3)\n" + "null sys table_types table_type_id 5 smallint 16 0 0 2 0 null null 0 0 null 1 NO null null null null NO NO\n" + - "null sys table_types table_type_name 12 varchar 25 0 0 0 0 null null 0 0 25 2 NO null null null null NO NO\n"); + "null sys table_types table_type_name 12 varchar 25 0 0 0 0 null null 0 0 100 2 NO null null null null NO NO\n"); compareResultSet(dbmd.getPrimaryKeys(null, "sys", "table\\_types"), "getPrimaryKeys(null, sys, table\\_types)", "Resultset with 6 columns\n" + @@ -1029,6 +1033,8 @@ final public class JDBC_API_Tester { "CREATE LOCAL TEMP TABLE tmp.tmp_nopk_twoucs (id2 INT NOT NULL UNIQUE, name2 VARCHAR(99) UNIQUE);"); handleExecuteDDL(stmt, action, objtype, "tmp.glbl_nopk_twoucs", "CREATE GLOBAL TEMP TABLE tmp.glbl_nopk_twoucs (id2 INT NOT NULL UNIQUE, name2 VARCHAR(99) UNIQUE);"); + handleExecuteDDL(stmt, action, objtype, "tmp.tlargechar", + "CREATE TEMP TABLE tlargechar (c1 varchar(2147483647), c2 char(2147483646), c3 clob(2147483645), c4 json(2147483644), c5 url(2147483643)) ON COMMIT PRESERVE ROWS;"); /* next 3 tables copied from example in https://docs.microsoft.com/en-us/sql/odbc/reference/syntax/sqlforeignkeys-function?view=sql-server-ver15 */ handleExecuteDDL(stmt, action, objtype, "\"CUSTOMERS\"", "CREATE TABLE \"CUSTOMERS\" (\"CUSTID\" INT PRIMARY KEY, \"NAME\" VARCHAR(60) NOT NULL, \"ADDRESS\" VARCHAR(90), \"PHONE\" VARCHAR(20));"); @@ -1156,6 +1162,19 @@ final public class JDBC_API_Tester { "null jdbctst pk2c TABLE null null null null null null\n" + "null jdbctst pk_uc TABLE jdbctst.pk_uc table comment null null null null null\n"); + String tabletypes[] = {"BASE TABLE", "LOCAL TEMPORARY", "GLOBAL TEMPORARY"}; + compareResultSet(dbmd.getTables(null, "tmp", "tlargechar", tabletypes), "getTables(null, tmp, tlargechar, tabletypes)", + "Resultset with 10 columns\n" + + "TABLE_CAT TABLE_SCHEM TABLE_NAME TABLE_TYPE REMARKS TYPE_CAT TYPE_SCHEM TYPE_NAME SELF_REFERENCING_COL_NAME REF_GENERATION\n" + + "char(1) varchar(1024) varchar(1024) varchar(25) varchar(1048576) char(1) char(1) char(1) char(1) char(1)\n" + + "null tmp tlargechar LOCAL TEMPORARY TABLE null null null null null null\n"); + + String badtabletypes[] = {null, "", null, ""}; + compareResultSet(dbmd.getTables(null, "tmp", "tlargechar", badtabletypes), "getTables(null, tmp, tlargechar, badtabletypes)", + "Resultset with 10 columns\n" + + "TABLE_CAT TABLE_SCHEM TABLE_NAME TABLE_TYPE REMARKS TYPE_CAT TYPE_SCHEM TYPE_NAME SELF_REFERENCING_COL_NAME REF_GENERATION\n" + + "char(1) varchar(1024) varchar(1024) varchar(25) varchar(1048576) char(1) char(1) char(1) char(1) char(1)\n"); + compareResultSet(dbmd.getTables(null, "jdbctst", "schemas", null), "getTables(null, jdbctst, schemas, null)", "Resultset with 10 columns\n" + "TABLE_CAT TABLE_SCHEM TABLE_NAME TABLE_TYPE REMARKS TYPE_CAT TYPE_SCHEM TYPE_NAME SELF_REFERENCING_COL_NAME REF_GENERATION\n" + @@ -1164,9 +1183,19 @@ final public class JDBC_API_Tester { compareResultSet(dbmd.getColumns(null, "jdbctst", "pk\\_uc", null), "getColumns(null, jdbctst, pk\\_uc, null)", "Resultset with 24 columns\n" + "TABLE_CAT TABLE_SCHEM TABLE_NAME COLUMN_NAME DATA_TYPE TYPE_NAME COLUMN_SIZE BUFFER_LENGTH DECIMAL_DIGITS NUM_PREC_RADIX NULLABLE REMARKS COLUMN_DEF SQL_DATA_TYPE SQL_DATETIME_SUB CHAR_OCTET_LENGTH ORDINAL_POSITION IS_NULLABLE SCOPE_CATALOG SCOPE_SCHEMA SCOPE_TABLE SOURCE_DATA_TYPE IS_AUTOINCREMENT IS_GENERATEDCOLUMN\n" + - "char(1) varchar(1024) varchar(1024) varchar(1024) int varchar(1024) int int int int int varchar(65000) varchar(2048) int int int int varchar(3) char(1) char(1) char(1) smallint char(3) varchar(3)\n" + + "char(1) varchar(1024) varchar(1024) varchar(1024) int varchar(1024) int int int int int varchar(65000) varchar(2048) int int bigint int varchar(3) char(1) char(1) char(1) smallint char(3) varchar(3)\n" + "null jdbctst pk_uc id1 4 int 32 0 0 2 0 null null 0 0 null 1 NO null null null null NO NO\n" + - "null jdbctst pk_uc name1 12 varchar 99 0 0 0 1 null null 0 0 99 2 YES null null null null NO NO\n"); + "null jdbctst pk_uc name1 12 varchar 99 0 0 0 1 null null 0 0 396 2 YES null null null null NO NO\n"); + + compareResultSet(dbmd.getColumns(null, "tmp", "tlargechar", null), "getColumns(null, tmp, tlargechar, null)", + "Resultset with 24 columns\n" + + "TABLE_CAT TABLE_SCHEM TABLE_NAME COLUMN_NAME DATA_TYPE TYPE_NAME COLUMN_SIZE BUFFER_LENGTH DECIMAL_DIGITS NUM_PREC_RADIX NULLABLE REMARKS COLUMN_DEF SQL_DATA_TYPE SQL_DATETIME_SUB CHAR_OCTET_LENGTH ORDINAL_POSITION IS_NULLABLE SCOPE_CATALOG SCOPE_SCHEMA SCOPE_TABLE SOURCE_DATA_TYPE IS_AUTOINCREMENT IS_GENERATEDCOLUMN\n" + + "char(1) varchar(1024) varchar(1024) varchar(1024) int varchar(1024) int int int int int varchar(65000) varchar(2048) int int bigint int varchar(3) char(1) char(1) char(1) smallint char(3) varchar(3)\n" + + "null tmp tlargechar c1 12 varchar 2147483647 0 0 0 1 null null 0 0 8589934588 1 YES null null null null NO NO\n" + + "null tmp tlargechar c2 1 char 2147483646 0 0 0 1 null null 0 0 8589934584 2 YES null null null null NO NO\n" + + "null tmp tlargechar c3 2005 clob 2147483645 0 0 0 1 null null 0 0 8589934580 3 YES null null null null NO NO\n" + + "null tmp tlargechar c4 12 json 2147483644 0 0 0 1 null null 0 0 8589934576 4 YES null null null null NO NO\n" + + "null tmp tlargechar c5 12 url 2147483643 0 0 0 1 null null 0 0 8589934572 5 YES null null null null NO NO\n"); compareResultSet(dbmd.getPrimaryKeys(null, "jdbctst", "pk\\_uc"), "getPrimaryKeys(null, jdbctst, pk\\_uc)", "Resultset with 6 columns\n" + @@ -1399,6 +1428,7 @@ final public class JDBC_API_Tester { handleExecuteDDL(stmt, action, objtype, "jdbctst.nopk_twoucs", "DROP TABLE jdbctst.nopk_twoucs;"); handleExecuteDDL(stmt, action, objtype, "tmp.tmp_nopk_twoucs", "DROP TABLE tmp.tmp_nopk_twoucs;"); handleExecuteDDL(stmt, action, objtype, "tmp.glbl_nopk_twoucs", "DROP TABLE tmp.glbl_nopk_twoucs;"); + handleExecuteDDL(stmt, action, objtype, "tmp.tlargechar", "DROP TABLE tmp.tlargechar;"); handleExecuteDDL(stmt, action, objtype, "jdbctst.\"LINES\"", "DROP TABLE jdbctst.\"LINES\";"); handleExecuteDDL(stmt, action, objtype, "jdbctst.\"ORDERS\"", "DROP TABLE jdbctst.\"ORDERS\";"); handleExecuteDDL(stmt, action, objtype, "jdbctst.\"CUSTOMERS\"", "DROP TABLE jdbctst.\"CUSTOMERS\";"); @@ -3028,6 +3058,8 @@ final public class JDBC_API_Tester { .append(rs.getString("t")).append(" | ") // .append(rs.getString("tz")) -- this values changes when summer or wintertime changes so no stable output .append("\n"); + rs.getString("tsz"); + rs.getString("tz"); tsz.setTimeZone(TimeZone.getDefault()); tz.setTimeZone(tsz.getTimeZone()); @@ -3051,6 +3083,15 @@ final public class JDBC_API_Tester { .append(rs.getTime("t", c)).append(" | ") .append(rs.getTime("tz", c)).append("\n"); + sb.append("getObject:\n") + .append(rs.getObject("ts")).append(" | ") + // .append(rs.getObject("tsz")).append(" | ") -- this value changes on different time zones, so no stable output + .append(rs.getObject("t")).append(" | ") + // .append(rs.getObject("tz")) -- this value changes on different time zones, so no stable output + .append("\n"); + rs.getObject("tsz"); + rs.getObject("tz"); + SQLWarning w = rs.getWarnings(); while (w != null) { sb.append(w.getMessage()).append("\n"); @@ -3089,6 +3130,9 @@ final public class JDBC_API_Tester { "1970-01-01 08:00:00.0 | 1970-01-01 00:00:00.0 | 08:00:00 | 00:00:00\n" + "Africa/Windhoek:\n" + "1969-12-31 22:00:00.0 | 1970-01-01 00:00:00.0 | 22:00:00 | 00:00:00\n" + + "getObject:\n" + +// old output "1970-01-01 00:00:00.0 | 1970-01-01T01:00+01:00 | 00:00:00 | 01:00+01:00\n" + + "1970-01-01 00:00:00.0 | 00:00:00 | \n" + "retrieved row (String):\n" + // old output "1970-01-01 00:00:00.000000 | 1970-01-01 01:00:00.000000+01:00 | 00:00:00 | 01:00:00+01:00\n" + "1970-01-01 00:00:00.000000 | 00:00:00 | \n" + @@ -3098,6 +3142,9 @@ final public class JDBC_API_Tester { "1970-01-01 08:00:00.0 | 1970-01-01 00:00:00.0 | 08:00:00 | 00:00:00\n" + "Africa/Windhoek:\n" + "1969-12-31 22:00:00.0 | 1970-01-01 00:00:00.0 | 22:00:00 | 00:00:00\n" + + "getObject:\n" + +// old output "1970-01-01 00:00:00.0 | 1970-01-01T01:00+01:00 | 00:00:00 | 01:00+01:00\n" + + "1970-01-01 00:00:00.0 | 00:00:00 | \n" + "retrieved row (String):\n" + // old output "1969-12-31 16:00:00.000000 | 1970-01-01 01:00:00.000000+01:00 | 16:00:00 | 01:00:00+01:00\n" + "1969-12-31 16:00:00.000000 | 16:00:00 | \n" + @@ -3107,6 +3154,9 @@ final public class JDBC_API_Tester { "1970-01-01 00:00:00.0 | 1970-01-01 00:00:00.0 | 00:00:00 | 00:00:00\n" + "Africa/Windhoek:\n" + "1969-12-31 14:00:00.0 | 1970-01-01 00:00:00.0 | 14:00:00 | 00:00:00\n" + + "getObject:\n" + +// old output "1969-12-31 16:00:00.0 | 1970-01-01T01:00+01:00 | 16:00:00 | 01:00+01:00\n" + + "1969-12-31 16:00:00.0 | 16:00:00 | \n" + "retrieved row (String):\n" + // old output "1970-01-01 00:00:00.000000 | 1970-01-01 01:00:00.000000+01:00 | 00:00:00 | 01:00:00+01:00\n" + "1970-01-01 00:00:00.000000 | 00:00:00 | \n" + @@ -3116,6 +3166,9 @@ final public class JDBC_API_Tester { "1970-01-01 08:00:00.0 | 1970-01-01 00:00:00.0 | 08:00:00 | 00:00:00\n" + "Africa/Windhoek:\n" + "1969-12-31 22:00:00.0 | 1970-01-01 00:00:00.0 | 22:00:00 | 00:00:00\n" + + "getObject:\n" + +// old output "1970-01-01 00:00:00.0 | 1970-01-01T01:00+01:00 | 00:00:00 | 01:00+01:00\n" + + "1970-01-01 00:00:00.0 | 00:00:00 | \n" + "0. true true\n"); } @@ -4261,12 +4314,15 @@ final public class JDBC_API_Tester { "1. ts 2004-04-24 11:43:53.123000 to ts: 2004-04-24 11:43:53.123\n" + "1. ts 2004-04-24 11:43:53.123000 to tm: 11:43:53\n" + "1. ts 2004-04-24 11:43:53.123000 to dt: 2004-04-24\n" + + "1. ts 2004-04-24 11:43:53.123000 to LocalDateTime: 2004-04-24T11:43:53.123\n" + "2. t 11:43:53 to ts: 1970-01-01 11:43:53.0\n" + "2. t 11:43:53 to tm: 11:43:53\n" + "2. t 11:43:53 to dt: 1970-01-01\n" + + "2. t 11:43:53 to LocalTime: 11:43:53\n" + "3. d 2004-04-24 to ts: 2004-04-24 00:00:00.0\n" + "3. d 2004-04-24 to tm: 00:00:00\n" + "3. d 2004-04-24 to dt: 2004-04-24\n" + + "3. d 2004-04-24 to LocalDate: 2004-04-24\n" + "4. vc 2004-04-24 11:43:53.654321 to ts: 2004-04-24 11:43:53.654321\n" + "4. vc 2004-04-24 11:43:53.654321 to tm: rs.getTime(colnm) failed with error: parsing failed at pos 5 found: '-' in '2004-04-24 11:43:53.654321'\n" + "4. vc 2004-04-24 11:43:53.654321 to dt: 2004-04-24\n" + @@ -4279,21 +4335,27 @@ final public class JDBC_API_Tester { "11. ts 904-04-24 11:43:53.567000 to ts: 0904-04-24 11:43:53.567\n" + "11. ts 904-04-24 11:43:53.567000 to tm: 11:43:53\n" + "11. ts 904-04-24 11:43:53.567000 to dt: 0904-04-24\n" + + "11. ts 904-04-24 11:43:53.567000 to LocalDateTime: rs.getObject(colnm, class<T>): Failed to convert to LocalDateTime: Text '904-04-24T11:43:53.567000' could not be parsed at index 0\n" + "12. ts 74-04-24 11:43:53.567000 to ts: 0074-04-24 11:43:53.567\n" + "12. ts 74-04-24 11:43:53.567000 to tm: 11:43:53\n" + "12. ts 74-04-24 11:43:53.567000 to dt: 0074-04-24\n" + + "12. ts 74-04-24 11:43:53.567000 to LocalDateTime: rs.getObject(colnm, class<T>): Failed to convert to LocalDateTime: Text '74-04-24T11:43:53.567000' could not be parsed at index 0\n" + "13. ts 4-04-24 11:43:53.567000 to ts: 0004-04-24 11:43:53.567\n" + "13. ts 4-04-24 11:43:53.567000 to tm: 11:43:53\n" + "13. ts 4-04-24 11:43:53.567000 to dt: 0004-04-24\n" + + "13. ts 4-04-24 11:43:53.567000 to LocalDateTime: rs.getObject(colnm, class<T>): Failed to convert to LocalDateTime: Text '4-04-24T11:43:53.567000' could not be parsed at index 0\n" + "14. d 904-04-24 to ts: 0904-04-24 00:00:00.0\n" + "14. d 904-04-24 to tm: 00:00:00\n" + "14. d 904-04-24 to dt: 0904-04-24\n" + + "14. d 904-04-24 to LocalDate: rs.getObject(colnm, class<T>): Failed to convert to LocalDate: Text '904-04-24' could not be parsed at index 0\n" + "15. d 74-04-24 to ts: 0074-04-24 00:00:00.0\n" + "15. d 74-04-24 to tm: 00:00:00\n" + "15. d 74-04-24 to dt: 0074-04-24\n" + + "15. d 74-04-24 to LocalDate: rs.getObject(colnm, class<T>): Failed to convert to LocalDate: Text '74-04-24' could not be parsed at index 0\n" + "16. d 4-04-24 to ts: 0004-04-24 00:00:00.0\n" + "16. d 4-04-24 to tm: 00:00:00\n" + "16. d 4-04-24 to dt: 0004-04-24\n" + + "16. d 4-04-24 to LocalDate: rs.getObject(colnm, class<T>): Failed to convert to LocalDate: Text '4-04-24' could not be parsed at index 0\n" + "17. vc 904-04-24 11:43:53.567 to ts: 0904-04-24 11:43:53.567\n" + "17. vc 904-04-24 11:43:53.567 to tm: rs.getTime(colnm) failed with error: parsing failed at pos 4 found: '-' in '904-04-24 11:43:53.567'\n" + "17. vc 904-04-24 11:43:53.567 to dt: 0904-04-24\n" + @@ -4306,15 +4368,19 @@ final public class JDBC_API_Tester { "21. ts -4-04-24 11:43:53.567000 to ts: 0004-04-24 11:43:53.567\n" + "21. ts -4-04-24 11:43:53.567000 to tm: 11:43:53\n" + "21. ts -4-04-24 11:43:53.567000 to dt: 0004-04-24\n" + + "21. ts -4-04-24 11:43:53.567000 to LocalDateTime: rs.getObject(colnm, class<T>): Failed to convert to LocalDateTime: Text '-4-04-24T11:43:53.567000' could not be parsed at index 1\n" + "22. ts -2004-04-24 11:43:53.567000 to ts: 2004-04-24 11:43:53.567\n" + "22. ts -2004-04-24 11:43:53.567000 to tm: 11:43:53\n" + "22. ts -2004-04-24 11:43:53.567000 to dt: 2004-04-24\n" + + "22. ts -2004-04-24 11:43:53.567000 to LocalDateTime: -2004-04-24T11:43:53.567\n" + "23. d -4-04-24 to ts: 0004-04-24 00:00:00.0\n" + "23. d -4-04-24 to tm: 00:00:00\n" + "23. d -4-04-24 to dt: 0004-04-24\n" + + "23. d -4-04-24 to LocalDate: rs.getObject(colnm, class<T>): Failed to convert to LocalDate: Text '-4-04-24' could not be parsed at index 1\n" + "24. d -3004-04-24 to ts: 3004-04-24 00:00:00.0\n" + "24. d -3004-04-24 to tm: 00:00:00\n" + "24. d -3004-04-24 to dt: 3004-04-24\n" + + "24. d -3004-04-24 to LocalDate: -3004-04-24\n" + "25. vc -2004-04-24 11:43:53.654321 to ts: 2004-04-24 11:43:53.654321\n" + "25. vc -2004-04-24 11:43:53.654321 to tm: rs.getTime(colnm) failed with error: parsing failed at pos 6 found: '-' in '-2004-04-24 11:43:53.654321'\n" + "25. vc -2004-04-24 11:43:53.654321 to dt: 2004-04-24\n" + @@ -4359,6 +4425,25 @@ final public class JDBC_API_Tester { } readWarnings(rs.getWarnings()); rs.clearWarnings(); + + // getObject(colnm, class<T>) may raise a conversion error + try { + switch(colnm) { + case "d": + sb.append(data).append("LocalDate: ").append(rs.getObject(colnm, java.time.LocalDate.class)).append("\n"); + break; + case "ts": + sb.append(data).append("LocalDateTime: ").append(rs.getObject(colnm, java.time.LocalDateTime.class)).append("\n"); + break; + case "t": + sb.append(data).append("LocalTime: ").append(rs.getObject(colnm, java.time.LocalTime.class)).append("\n"); + break; + } + } catch (SQLException e) { + sb.append("rs.getObject(colnm, class<T>): ").append(e.getMessage()).append("\n"); + } + readWarnings(rs.getWarnings()); + rs.clearWarnings(); } private void Test_Sbatching() {
--- a/tests/OnClientTester.java +++ b/tests/OnClientTester.java @@ -1,9 +1,13 @@ /* + * SPDX-License-Identifier: MPL-2.0 + * * 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 - 2023 MonetDB B.V. + * Copyright 2024 MonetDB Foundation; + * Copyright August 2008 - 2023 MonetDB B.V.; + * Copyright 1997 - July 2008 CWI. */ import org.monetdb.jdbc.MonetConnection;
--- a/tests/SQLcopyinto.java +++ b/tests/SQLcopyinto.java @@ -1,9 +1,13 @@ /* + * SPDX-License-Identifier: MPL-2.0 + * * 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 - 2023 MonetDB B.V. + * Copyright 2024 MonetDB Foundation; + * Copyright August 2008 - 2023 MonetDB B.V.; + * Copyright 1997 - July 2008 CWI. */ import java.sql.*;
--- a/tests/Test_Cforkbomb.java +++ b/tests/Test_Cforkbomb.java @@ -1,9 +1,13 @@ /* + * SPDX-License-Identifier: MPL-2.0 + * * 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 - 2023 MonetDB B.V. + * Copyright 2024 MonetDB Foundation; + * Copyright August 2008 - 2023 MonetDB B.V.; + * Copyright 1997 - July 2008 CWI. */ import java.sql.*;
--- a/tests/Test_Csendthread.java +++ b/tests/Test_Csendthread.java @@ -1,9 +1,13 @@ /* + * SPDX-License-Identifier: MPL-2.0 + * * 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 - 2023 MonetDB B.V. + * Copyright 2024 MonetDB Foundation; + * Copyright August 2008 - 2023 MonetDB B.V.; + * Copyright 1997 - July 2008 CWI. */ import java.sql.*;
--- a/tests/build.xml +++ b/tests/build.xml @@ -1,11 +1,15 @@ <?xml version="1.0"?><!-- vim:set ts=2 sw=2 expandtab: --> <!-- +SPDX-License-Identifier: MPL-2.0 + 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 - 2023 MonetDB B.V. +Copyright 2024 MonetDB Foundation; +Copyright August 2008 - 2023 MonetDB B.V.; +Copyright 1997 - July 2008 CWI. --> <!--
--- a/tests/drop.sql +++ b/tests/drop.sql @@ -1,8 +1,12 @@ +-- SPDX-License-Identifier: MPL-2.0 +-- -- 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 - 2023 MonetDB B.V. +-- Copyright 2024 MonetDB Foundation; +-- Copyright August 2008 - 2023 MonetDB B.V.; +-- Copyright 1997 - July 2008 CWI. drop table "foreign"; drop table allnewtriples;
--- a/version.sh +++ b/version.sh @@ -1,10 +1,14 @@ #!/usr/bin/env bash +# SPDX-License-Identifier: MPL-2.0 +# # 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 - 2023 MonetDB B.V. +# Copyright 2024 MonetDB Foundation; +# Copyright August 2008 - 2023 MonetDB B.V.; +# Copyright 1997 - July 2008 CWI. if [[ -z $1 ]] ; then echo "Usage: $0 [-w] jdbc <(major|minor|suffix)=newversion> [...]"