From 450a88290c13dccfc4656752d4c5c798a992e1ab Mon Sep 17 00:00:00 2001 From: InduminiAyomi Date: Thu, 28 Sep 2017 13:12:20 +0530 Subject: [PATCH 1/4] Update JDBCDisplayUtil.java Check number of rows in the ResultSet --- java/tools/org/apache/derby/tools/JDBCDisplayUtil.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/java/tools/org/apache/derby/tools/JDBCDisplayUtil.java b/java/tools/org/apache/derby/tools/JDBCDisplayUtil.java index 825d918e61..b5f49447f7 100644 --- a/java/tools/org/apache/derby/tools/JDBCDisplayUtil.java +++ b/java/tools/org/apache/derby/tools/JDBCDisplayUtil.java @@ -958,6 +958,8 @@ static public void DisplayResults(PrintStream out, ResultSet rs, Connection conn ShowWarnings(out, rs); numberOfRowsSelected++; } + // print number of rows in the result set + indentedPrintLine( out, indentLevel, numberOfRowsSelected + " rows in the result set"); } catch (SQLException e) { // REVISIT: might want to check the exception // and for some, not bother with the retry. From 1a7417d2afe89b2287c77c3ded2847e397b83ee3 Mon Sep 17 00:00:00 2001 From: InduminiAyomi Date: Fri, 29 Sep 2017 09:03:02 +0530 Subject: [PATCH 2/4] DERBY - 5849:Text for SQL state XSDG0: remove redundant "page" The printed statement of the PageKey.toString() is changed. --- java/engine/org/apache/derby/iapi/store/raw/PageKey.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/java/engine/org/apache/derby/iapi/store/raw/PageKey.java b/java/engine/org/apache/derby/iapi/store/raw/PageKey.java index 8b0df52c01..128c61aed3 100644 --- a/java/engine/org/apache/derby/iapi/store/raw/PageKey.java +++ b/java/engine/org/apache/derby/iapi/store/raw/PageKey.java @@ -99,7 +99,8 @@ public int hashCode() { } public String toString() { - return "Page(" + pageNumber + "," + container.toString() + ")"; + //return "Page(" + pageNumber + "," + container.toString() + ")"; + return "Could not read page " + pageNumber + " from segment " + container.getSegmentId() + "of container " + container.getContainerId(); } } From 6366d5102dbc35849e1461570650b820e18d50c5 Mon Sep 17 00:00:00 2001 From: InduminiAyomi Date: Fri, 29 Sep 2017 09:12:37 +0530 Subject: [PATCH 3/4] DERBY - 5849:Text for SQL state XSDG0: remove redundant "page" The printed statement of the PageKey.toString() is changed. --- java/engine/org/apache/derby/iapi/store/raw/PageKey.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/java/engine/org/apache/derby/iapi/store/raw/PageKey.java b/java/engine/org/apache/derby/iapi/store/raw/PageKey.java index 128c61aed3..c33ce61cf2 100644 --- a/java/engine/org/apache/derby/iapi/store/raw/PageKey.java +++ b/java/engine/org/apache/derby/iapi/store/raw/PageKey.java @@ -100,7 +100,8 @@ public int hashCode() { public String toString() { //return "Page(" + pageNumber + "," + container.toString() + ")"; - return "Could not read page " + pageNumber + " from segment " + container.getSegmentId() + "of container " + container.getContainerId(); + return "Could not read page " + pageNumber + " from segment " + + container.getSegmentId() + "of container " + container.getContainerId(); } } From b2aca24f8d6d3326571eb2325cca31e999cf87bf Mon Sep 17 00:00:00 2001 From: InduminiAyomi Date: Fri, 29 Sep 2017 09:28:38 +0530 Subject: [PATCH 4/4] DERBY-6928:The ODBCMetadataGenerator_getCastInfoForCol( ) method hard codes some string values org.apache.derby.iapi.types.TypeId.SMALLINT_NAME is used instead of hard coding "SMALLINT" in the above method. --- .../derbyBuild/ODBCMetadataGenerator.java | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/java/build/org/apache/derbyBuild/ODBCMetadataGenerator.java b/java/build/org/apache/derbyBuild/ODBCMetadataGenerator.java index 000c533557..606113e83e 100644 --- a/java/build/org/apache/derbyBuild/ODBCMetadataGenerator.java +++ b/java/build/org/apache/derbyBuild/ODBCMetadataGenerator.java @@ -32,6 +32,7 @@ Licensed to the Apache Software Foundation (ASF) under one or more import java.util.ArrayList; import org.apache.derby.shared.common.sanity.SanityManager; +import org.apache.derby.iapi.types.TypeId; /** * This class is used at COMPILE TIME ONLY. It is responsible for generating @@ -937,6 +938,10 @@ private String extractColName(String colDef) { * if the received column in the received query has * no known target type. */ + + // DERBY - 6928 + // Use org.apache.derby.iapi.types.TypeId.SMALLINT_NAME instead of hardcoding "SMALLINT" + private String getCastInfoForCol(String queryName, String colName) { @@ -950,7 +955,8 @@ private String getCastInfoForCol(String queryName, colName.equals("SQL_DATA_TYPE") || colName.equals("SQL_DATETIME_SUB")) { - return "SMALLINT"; + //return "SMALLINT"; + return TypeId.SMALLINT_NAME; } } else if (queryName.equals("getColumns")) { @@ -961,29 +967,34 @@ else if (queryName.equals("getColumns")) { colName.equals("SQL_DATA_TYPE") || colName.equals("SQL_DATETIME_SUB")) { - return "SMALLINT"; + //return "SMALLINT"; + return TypeId.SMALLINT_NAME; } } else if (queryName.equals("getProcedureColumns")) { if (colName.equals("DATA_TYPE")) { - return "SMALLINT"; + //return "SMALLINT"; + return TypeId.SMALLINT_NAME; } } else if (queryName.equals("getVersionColumns")) { if (colName.equals("DATA_TYPE")) { - return "SMALLINT"; + //return "SMALLINT"; + return TypeId.SMALLINT_NAME; } } else if (queryName.startsWith("getBestRowIdentifier")) { if (colName.equals("DATA_TYPE")) { - return "SMALLINT"; + //return "SMALLINT"; + return TypeId.SMALLINT_NAME; } } else if (queryName.equals("getIndexInfo")) { if (colName.equals("NON_UNIQUE") || colName.equals("TYPE")) { - return "SMALLINT"; + //return "SMALLINT"; + return TypeId.SMALLINT_NAME; } }