Adding null check for username being null.

The username is usually not null, but it  could be for some embedded databases.

Always setting generatedKeysColumnNameArraySupported to false when getGeneratedKeysSupported is false, since it can't be supported without having generated keys supported. This change only affects logging messages.

Issue: SPR-9006
This commit is contained in:
Thomas Risberg
2012-02-03 14:56:00 -05:00
parent 21aed042ea
commit 66012b951e

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2011 the original author or authors.
* Copyright 2002-2012 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.
@@ -181,8 +181,13 @@ public class GenericTableMetaDataProvider implements TableMetaDataProvider {
setGeneratedKeysColumnNameArraySupported(false);
}
else {
logger.debug("GeneratedKeysColumnNameArray is supported for " + databaseProductName);
setGeneratedKeysColumnNameArraySupported(true);
if (isGetGeneratedKeysSupported()) {
logger.debug("GeneratedKeysColumnNameArray is supported for " + databaseProductName);
setGeneratedKeysColumnNameArraySupported(true);
}
else {
setGeneratedKeysColumnNameArraySupported(false);
}
}
}
catch (SQLException se) {
@@ -307,7 +312,7 @@ public class GenericTableMetaDataProvider implements TableMetaDataProvider {
tmd.setTableName(tables.getString("TABLE_NAME"));
tmd.setType(tables.getString("TABLE_TYPE"));
if (tmd.getSchemaName() == null) {
tableMeta.put(userName.toUpperCase(), tmd);
tableMeta.put(userName != null ? userName.toUpperCase() : "", tmd);
}
else {
tableMeta.put(tmd.getSchemaName().toUpperCase(), tmd);
@@ -335,7 +340,7 @@ public class GenericTableMetaDataProvider implements TableMetaDataProvider {
if (schemaName == null) {
tmd = tableMeta.get(getDefaultSchema());
if (tmd == null) {
tmd = tableMeta.get(userName.toUpperCase());
tmd = tableMeta.get(userName != null ? userName.toUpperCase() : "");
}
if (tmd == null) {
tmd = tableMeta.get("PUBLIC");