This is an automated email from the ASF dual-hosted git repository.
desruisseaux pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git
The following commit(s) were added to refs/heads/geoapi-4.0 by this push:
new fb564807b5 Do no log a warning when the `TINYINT` type is not defined
at all, because it means that the type is not supported by the database.
fb564807b5 is described below
commit fb564807b5a6c8d8ffab044dacdf489086c03f48
Author: Martin Desruisseaux <[email protected]>
AuthorDate: Fri Aug 4 15:36:28 2023 +0200
Do no log a warning when the `TINYINT` type is not defined at all,
because it means that the type is not supported by the database.
---
.../apache/sis/internal/sql/feature/Database.java | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
diff --git
a/storage/sis-sqlstore/src/main/java/org/apache/sis/internal/sql/feature/Database.java
b/storage/sis-sqlstore/src/main/java/org/apache/sis/internal/sql/feature/Database.java
index b41dcc84f5..84295e2fa5 100644
---
a/storage/sis-sqlstore/src/main/java/org/apache/sis/internal/sql/feature/Database.java
+++
b/storage/sis-sqlstore/src/main/java/org/apache/sis/internal/sql/feature/Database.java
@@ -237,26 +237,27 @@ public class Database<G> extends Syntax {
* Get information about whether byte are unsigned.
* According JDBC specification, the rows shall be ordered by
DATA_TYPE.
* But the PostgreSQL driver 42.2.2 still provides rows in random
order.
- * Also, if we find information about tiny int, but it does not
specify signing information,
- * we continue looping in case the type information is duplicated with
more information later.
+ * Also, if we find a row about `TINYINT` but without sign information,
+ * continue looping in case the type is duplicated with more
information later.
+ * If no row is found for `TINYINT`, do not log any warning because it
simply
+ * means that the database does not support that data type.
*/
- Boolean unsigned = null;
+ boolean unsigned = true;
+ boolean wasNull = false; // Not the same as allowing `unsigned` to
be null.
SQLException cause = null;
try (ResultSet reflect = metadata.getTypeInfo()) {
while (reflect.next()) {
if (reflect.getInt(Reflection.DATA_TYPE) == Types.TINYINT) {
- unsigned =
reflect.getBoolean(Reflection.UNSIGNED_ATTRIBUTE);
- if (reflect.wasNull()) unsigned = null;
- else break;
+ unsigned =
reflect.getBoolean(Reflection.UNSIGNED_ATTRIBUTE);
+ wasNull = reflect.wasNull();
+ unsigned |= wasNull;
+ if (!wasNull) break;
}
}
} catch (SQLFeatureNotSupportedException e) {
- // If metadata cannot be fetched, consider it equivalent to an
empty metadata: assume default interpretation.
- unsigned = null;
cause = e;
}
- if (unsigned == null) {
- unsigned = true;
+ if (cause != null || wasNull) {
listeners.warning(Resources.forLocale(listeners.getLocale())
.getString(Resources.Keys.AssumeUnsigned), cause);
}