geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dschnei...@apache.org
Subject [geode] 01/02: changed default catalog and schema from null to empty string
Date Fri, 21 Dec 2018 18:37:13 GMT
This is an automated email from the ASF dual-hosted git repository.

dschneider pushed a commit to branch feature/GEODE-6225
in repository https://gitbox.apache.org/repos/asf/geode.git

commit d179a99262dba71951769d41b5884b7ac760d07c
Author: Darrel Schneider <dschneider@pivotal.io>
AuthorDate: Fri Dec 21 10:35:22 2018 -0800

    changed default catalog and schema from null to empty string
---
 .../connectors/jdbc/internal/TableMetaDataManager.java     | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/geode-connectors/src/main/java/org/apache/geode/connectors/jdbc/internal/TableMetaDataManager.java
b/geode-connectors/src/main/java/org/apache/geode/connectors/jdbc/internal/TableMetaDataManager.java
index f5f9b16..b8971ef 100644
--- a/geode-connectors/src/main/java/org/apache/geode/connectors/jdbc/internal/TableMetaDataManager.java
+++ b/geode-connectors/src/main/java/org/apache/geode/connectors/jdbc/internal/TableMetaDataManager.java
@@ -34,6 +34,8 @@ import org.apache.geode.connectors.jdbc.JdbcConnectorException;
  * remembered so that it does not need to be recomputed for the same table name.
  */
 public class TableMetaDataManager {
+  private static final String DEFAULT_CATALOG = "";
+  private static final String DEFAULT_SCHEMA = "";
   private final ConcurrentMap<String, TableMetaDataView> tableToMetaDataMap =
       new ConcurrentHashMap<>();
 
@@ -48,7 +50,7 @@ public class TableMetaDataManager {
     TableMetaData result;
     try {
       DatabaseMetaData metaData = connection.getMetaData();
-      try (ResultSet tables = metaData.getTables(null, null, "%", null)) {
+      try (ResultSet tables = metaData.getTables(DEFAULT_CATALOG, DEFAULT_SCHEMA, "%", null))
{
         String realTableName = getTableNameFromMetaData(tableName, tables);
         List<String> keys = getPrimaryKeyColumnNamesFromMetaData(realTableName, metaData,
ids);
         String quoteString = metaData.getIdentifierQuoteString();
@@ -100,7 +102,9 @@ public class TableMetaDataManager {
         checkColumnExistsInTable(tableName, metaData, key);
       }
     } else {
-      try (ResultSet primaryKeys = metaData.getPrimaryKeys(null, null, tableName)) {
+      try (
+          ResultSet primaryKeys =
+              metaData.getPrimaryKeys(DEFAULT_CATALOG, DEFAULT_SCHEMA, tableName)) {
         while (primaryKeys.next()) {
           String key = primaryKeys.getString("COLUMN_NAME");
           keys.add(key);
@@ -116,7 +120,8 @@ public class TableMetaDataManager {
 
   private void getDataTypesFromMetaData(String tableName, DatabaseMetaData metaData,
       TableMetaData result) throws SQLException {
-    try (ResultSet columnData = metaData.getColumns(null, null, tableName, "%")) {
+    try (ResultSet columnData =
+        metaData.getColumns(DEFAULT_CATALOG, DEFAULT_SCHEMA, tableName, "%")) {
       while (columnData.next()) {
         String columnName = columnData.getString("COLUMN_NAME");
         int dataType = columnData.getInt("DATA_TYPE");
@@ -128,7 +133,8 @@ public class TableMetaDataManager {
   private void checkColumnExistsInTable(String tableName, DatabaseMetaData metaData,
       String columnName) throws SQLException {
     int caseInsensitiveMatches = 0;
-    try (ResultSet columnData = metaData.getColumns(null, null, tableName, "%")) {
+    try (ResultSet columnData =
+        metaData.getColumns(DEFAULT_CATALOG, DEFAULT_SCHEMA, tableName, "%")) {
       while (columnData.next()) {
         String realColumnName = columnData.getString("COLUMN_NAME");
         if (columnName.equals(realColumnName)) {


Mime
View raw message