Merge branch '6.1.x'
This commit is contained in:
@@ -385,7 +385,7 @@ public class CallMetaDataContext {
|
||||
if (meta.isReturnParameter()) {
|
||||
param = declaredParams.get(getFunctionReturnName());
|
||||
if (param == null && !getOutParameterNames().isEmpty()) {
|
||||
param = declaredParams.get(getOutParameterNames().get(0).toLowerCase());
|
||||
param = declaredParams.get(getOutParameterNames().get(0).toLowerCase(Locale.ROOT));
|
||||
}
|
||||
if (param == null) {
|
||||
throw new InvalidDataAccessApiUsageException(
|
||||
@@ -488,7 +488,7 @@ public class CallMetaDataContext {
|
||||
String parameterName = parameter.getName();
|
||||
String parameterNameToMatch = obtainMetaDataProvider().parameterNameToUse(parameterName);
|
||||
if (parameterNameToMatch != null) {
|
||||
callParameterNames.put(parameterNameToMatch.toLowerCase(), parameterName);
|
||||
callParameterNames.put(parameterNameToMatch.toLowerCase(Locale.ROOT), parameterName);
|
||||
}
|
||||
if (parameterName != null) {
|
||||
if (parameterSource.hasValue(parameterName)) {
|
||||
@@ -496,7 +496,7 @@ public class CallMetaDataContext {
|
||||
SqlParameterSourceUtils.getTypedValue(parameterSource, parameterName));
|
||||
}
|
||||
else {
|
||||
String lowerCaseName = parameterName.toLowerCase();
|
||||
String lowerCaseName = parameterName.toLowerCase(Locale.ROOT);
|
||||
if (parameterSource.hasValue(lowerCaseName)) {
|
||||
matchedParameters.put(parameterName,
|
||||
SqlParameterSourceUtils.getTypedValue(parameterSource, lowerCaseName));
|
||||
@@ -556,7 +556,7 @@ public class CallMetaDataContext {
|
||||
String parameterName = parameter.getName();
|
||||
String parameterNameToMatch = provider.parameterNameToUse(parameterName);
|
||||
if (parameterNameToMatch != null) {
|
||||
callParameterNames.put(parameterNameToMatch.toLowerCase(), parameterName);
|
||||
callParameterNames.put(parameterNameToMatch.toLowerCase(Locale.ROOT), parameterName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -681,7 +681,7 @@ public class CallMetaDataContext {
|
||||
}
|
||||
|
||||
private static String lowerCase(@Nullable String paramName) {
|
||||
return (paramName != null ? paramName.toLowerCase() : "");
|
||||
return (paramName != null ? paramName.toLowerCase(Locale.ROOT) : "");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,6 +18,7 @@ package org.springframework.jdbc.core.metadata;
|
||||
|
||||
import java.sql.DatabaseMetaData;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
@@ -73,7 +74,7 @@ public class Db2CallMetaDataProvider extends GenericCallMetaDataProvider {
|
||||
|
||||
// Use current user schema if no schema specified...
|
||||
String userName = getUserName();
|
||||
return (userName != null ? userName.toUpperCase() : null);
|
||||
return (userName != null ? userName.toUpperCase(Locale.ROOT) : null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,6 +18,7 @@ package org.springframework.jdbc.core.metadata;
|
||||
|
||||
import java.sql.DatabaseMetaData;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
@@ -45,7 +46,7 @@ public class DerbyCallMetaDataProvider extends GenericCallMetaDataProvider {
|
||||
|
||||
// Use current user schema if no schema specified...
|
||||
String userName = getUserName();
|
||||
return (userName != null ? userName.toUpperCase() : null);
|
||||
return (userName != null ? userName.toUpperCase(Locale.ROOT) : null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ import java.sql.SQLException;
|
||||
import java.sql.Types;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
@@ -284,10 +285,10 @@ public class GenericCallMetaDataProvider implements CallMetaDataProvider {
|
||||
return null;
|
||||
}
|
||||
else if (isStoresUpperCaseIdentifiers()) {
|
||||
return identifierName.toUpperCase();
|
||||
return identifierName.toUpperCase(Locale.ROOT);
|
||||
}
|
||||
else if (isStoresLowerCaseIdentifiers()) {
|
||||
return identifierName.toLowerCase();
|
||||
return identifierName.toLowerCase(Locale.ROOT);
|
||||
}
|
||||
else {
|
||||
return identifierName;
|
||||
|
||||
@@ -24,6 +24,7 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
@@ -214,10 +215,10 @@ public class GenericTableMetaDataProvider implements TableMetaDataProvider {
|
||||
return null;
|
||||
}
|
||||
else if (isStoresUpperCaseIdentifiers()) {
|
||||
return identifierName.toUpperCase();
|
||||
return identifierName.toUpperCase(Locale.ROOT);
|
||||
}
|
||||
else if (isStoresLowerCaseIdentifiers()) {
|
||||
return identifierName.toLowerCase();
|
||||
return identifierName.toLowerCase(Locale.ROOT);
|
||||
}
|
||||
else {
|
||||
return identifierName;
|
||||
@@ -326,10 +327,10 @@ public class GenericTableMetaDataProvider implements TableMetaDataProvider {
|
||||
TableMetaData tmd = new TableMetaData(tables.getString("TABLE_CAT"),
|
||||
tables.getString("TABLE_SCHEM"), tables.getString("TABLE_NAME"));
|
||||
if (tmd.schemaName() == null) {
|
||||
tableMeta.put(this.userName != null ? this.userName.toUpperCase() : "", tmd);
|
||||
tableMeta.put(this.userName != null ? this.userName.toUpperCase(Locale.ROOT) : "", tmd);
|
||||
}
|
||||
else {
|
||||
tableMeta.put(tmd.schemaName().toUpperCase(), tmd);
|
||||
tableMeta.put(tmd.schemaName().toUpperCase(Locale.ROOT), tmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -356,7 +357,7 @@ public class GenericTableMetaDataProvider implements TableMetaDataProvider {
|
||||
Map<String, TableMetaData> tableMeta) {
|
||||
|
||||
if (schemaName != null) {
|
||||
TableMetaData tmd = tableMeta.get(schemaName.toUpperCase());
|
||||
TableMetaData tmd = tableMeta.get(schemaName.toUpperCase(Locale.ROOT));
|
||||
if (tmd == null) {
|
||||
throw new DataAccessResourceFailureException("Unable to locate table meta-data for '" +
|
||||
tableName + "' in the '" + schemaName + "' schema");
|
||||
@@ -369,7 +370,7 @@ public class GenericTableMetaDataProvider implements TableMetaDataProvider {
|
||||
else {
|
||||
TableMetaData tmd = tableMeta.get(getDefaultSchema());
|
||||
if (tmd == null) {
|
||||
tmd = tableMeta.get(this.userName != null ? this.userName.toUpperCase() : "");
|
||||
tmd = tableMeta.get(this.userName != null ? this.userName.toUpperCase(Locale.ROOT) : "");
|
||||
}
|
||||
if (tmd == null) {
|
||||
tmd = tableMeta.get("PUBLIC");
|
||||
|
||||
@@ -19,6 +19,7 @@ package org.springframework.jdbc.core.metadata;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -216,11 +217,11 @@ public class TableMetaDataContext {
|
||||
}
|
||||
Set<String> keys = CollectionUtils.newLinkedHashSet(generatedKeyNames.length);
|
||||
for (String key : generatedKeyNames) {
|
||||
keys.add(key.toUpperCase());
|
||||
keys.add(key.toUpperCase(Locale.ROOT));
|
||||
}
|
||||
List<String> columns = new ArrayList<>();
|
||||
for (TableParameterMetaData meta : obtainMetaDataProvider().getTableParameterMetaData()) {
|
||||
if (!keys.contains(meta.getParameterName().toUpperCase())) {
|
||||
if (!keys.contains(meta.getParameterName().toUpperCase(Locale.ROOT))) {
|
||||
columns.add(meta.getParameterName());
|
||||
}
|
||||
}
|
||||
@@ -242,7 +243,7 @@ public class TableMetaDataContext {
|
||||
values.add(SqlParameterSourceUtils.getTypedValue(parameterSource, column));
|
||||
}
|
||||
else {
|
||||
String lowerCaseName = column.toLowerCase();
|
||||
String lowerCaseName = column.toLowerCase(Locale.ROOT);
|
||||
if (parameterSource.hasValue(lowerCaseName)) {
|
||||
values.add(SqlParameterSourceUtils.getTypedValue(parameterSource, lowerCaseName));
|
||||
}
|
||||
@@ -275,7 +276,7 @@ public class TableMetaDataContext {
|
||||
for (String column : this.tableColumns) {
|
||||
Object value = inParameters.get(column);
|
||||
if (value == null) {
|
||||
value = inParameters.get(column.toLowerCase());
|
||||
value = inParameters.get(column.toLowerCase(Locale.ROOT));
|
||||
if (value == null) {
|
||||
for (Map.Entry<String, ?> entry : inParameters.entrySet()) {
|
||||
if (column.equalsIgnoreCase(entry.getKey())) {
|
||||
@@ -297,7 +298,7 @@ public class TableMetaDataContext {
|
||||
public String createInsertString(String... generatedKeyNames) {
|
||||
Set<String> keys = CollectionUtils.newLinkedHashSet(generatedKeyNames.length);
|
||||
for (String key : generatedKeyNames) {
|
||||
keys.add(key.toUpperCase());
|
||||
keys.add(key.toUpperCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
String identifierQuoteString = (isQuoteIdentifiers() ?
|
||||
@@ -325,7 +326,7 @@ public class TableMetaDataContext {
|
||||
insertStatement.append(" (");
|
||||
int columnCount = 0;
|
||||
for (String columnName : getTableColumns()) {
|
||||
if (!keys.contains(columnName.toUpperCase())) {
|
||||
if (!keys.contains(columnName.toUpperCase(Locale.ROOT))) {
|
||||
columnCount++;
|
||||
if (columnCount > 1) {
|
||||
insertStatement.append(", ");
|
||||
@@ -365,7 +366,7 @@ public class TableMetaDataContext {
|
||||
List<TableParameterMetaData> parameters = obtainMetaDataProvider().getTableParameterMetaData();
|
||||
Map<String, TableParameterMetaData> parameterMap = CollectionUtils.newLinkedHashMap(parameters.size());
|
||||
for (TableParameterMetaData tpmd : parameters) {
|
||||
parameterMap.put(tpmd.getParameterName().toUpperCase(), tpmd);
|
||||
parameterMap.put(tpmd.getParameterName().toUpperCase(Locale.ROOT), tpmd);
|
||||
}
|
||||
int typeIndx = 0;
|
||||
for (String column : getTableColumns()) {
|
||||
@@ -373,7 +374,7 @@ public class TableMetaDataContext {
|
||||
types[typeIndx] = SqlTypeValue.TYPE_UNKNOWN;
|
||||
}
|
||||
else {
|
||||
TableParameterMetaData tpmd = parameterMap.get(column.toUpperCase());
|
||||
TableParameterMetaData tpmd = parameterMap.get(column.toUpperCase(Locale.ROOT));
|
||||
if (tpmd != null) {
|
||||
types[typeIndx] = tpmd.getSqlType();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
* Copyright 2002-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -19,6 +19,7 @@ package org.springframework.jdbc.core.namedparam;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.jdbc.core.SqlParameterValue;
|
||||
@@ -115,7 +116,7 @@ public abstract class SqlParameterSourceUtils {
|
||||
String[] paramNames = parameterSource.getParameterNames();
|
||||
if (paramNames != null) {
|
||||
for (String name : paramNames) {
|
||||
caseInsensitiveParameterNames.put(name.toLowerCase(), name);
|
||||
caseInsensitiveParameterNames.put(name.toLowerCase(Locale.ROOT), name);
|
||||
}
|
||||
}
|
||||
return caseInsensitiveParameterNames;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
* Copyright 2002-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -26,6 +26,7 @@ import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
@@ -490,7 +491,7 @@ public abstract class AbstractJdbcInsert {
|
||||
// get generated keys feature. HSQL is one, PostgreSQL is another. Postgres uses a RETURNING
|
||||
// clause while HSQL uses a second query that has to be executed with the same connection.
|
||||
|
||||
if (keyQuery.toUpperCase().startsWith("RETURNING")) {
|
||||
if (keyQuery.toUpperCase(Locale.ROOT).startsWith("RETURNING")) {
|
||||
Long key = getJdbcTemplate().queryForObject(
|
||||
getInsertString() + " " + keyQuery, Long.class, values.toArray());
|
||||
Map<String, Object> keys = new HashMap<>(2);
|
||||
|
||||
Reference in New Issue
Block a user