id
stringlengths 22
25
| commit_message
stringlengths 137
6.96k
| diffs
listlengths 0
63
|
|---|---|---|
derby-DERBY-680-3b118182
|
DERBY-2228 Fix ij's util class to make correct determination if running on J2SE or JSR 169.
Also set DECIMAL parameter in PreparedStatement using setString and retry using setLong if
a conversion error occurs. This fixes the NullPointerExcecption seen in DERBY-680. Previously
the code was using the ResultSetMetaData which was incorrect, as it has no relationship
to the types of the parameters.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@498842 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/tools/org/apache/derby/impl/tools/ij/util.java",
"hunks": [
{
"added": [
"\tprivate static boolean IS_AT_LEAST_JDBC2;",
"\t\tboolean isAtLeastJDBC2;",
" // Need to test to see if this is",
" // currently JDBC 2 or JSR169.",
" // Checking for BigDecimal doesn't work because",
" // BigDecimal exists in J2ME/CDC/Foundation 1.1",
" Class.forName(\"java.sql.Driver\");",
"\t\t\tisAtLeastJDBC2 = true;",
"\t\t\tisAtLeastJDBC2 = false;",
"\t\tIS_AT_LEAST_JDBC2 = isAtLeastJDBC2;"
],
"header": "@@ -54,17 +54,21 @@ import java.util.Locale;",
"removed": [
"\tprivate static boolean HAVE_BIG_DECIMAL;",
"\t\tboolean haveBigDecimal;",
"\t\t\tClass.forName(\"java.math.BigDecimal\");",
"\t\t\thaveBigDecimal = true;",
"\t\t\thaveBigDecimal = false;",
"\t\tHAVE_BIG_DECIMAL = haveBigDecimal;"
]
},
{
"added": [
"\t\t\t\t\tif (util.IS_AT_LEAST_JDBC2)"
],
"header": "@@ -647,7 +651,7 @@ AppUI.out.println(\"SIZE=\"+l);",
"removed": [
"\t\t\t\t\tif (util.HAVE_BIG_DECIMAL)"
]
},
{
"added": [
"\t\t\t\t\t\t// an integral type. Of course in JSR169 we have",
" // no way to determine the parameter types,",
" // ParameterMetaData is not supported.",
" // So convert as string, and on a conversion error",
" // try as a long.",
" ",
" try {",
" ps.setString(c, rs.getString(c));",
" } catch (SQLException e) {",
" // 22018 - invalid format",
" if (\"22018\".equals(e.getSQLState()))",
" ps.setLong(c, rs.getLong(c));",
" else",
" throw e;",
" }\t\t\t\t\t\t"
],
"header": "@@ -660,21 +664,21 @@ AppUI.out.println(\"SIZE=\"+l);",
"removed": [
"\t\t\t\t\t\t// an integral type.",
"\t\t\t\t\t\tswitch (ps.getMetaData().getColumnType(c))",
"\t\t\t\t\t\t{",
"\t\t\t\t\t\tcase Types.BIGINT:",
"\t\t\t\t\t\t\tps.setLong(c, rs.getLong(c));",
"\t\t\t\t\t\t break;",
"\t\t\t\t\t\tcase Types.INTEGER:",
"\t\t\t\t\t\tcase Types.SMALLINT:",
"\t\t\t\t\t\tcase Types.TINYINT:",
"\t\t\t\t\t\t\tps.setInt(c, rs.getInt(c));",
"\t\t\t\t\t\t\tbreak;",
"\t\t\t\t\t\tdefault:",
"\t\t\t\t\t\t\tps.setString(c,rs.getString(c));",
"\t\t\t\t\t\t break;",
"\t\t\t\t\t\t}\t\t\t\t\t\t\t\t"
]
}
]
}
] |
derby-DERBY-6807-0a1be27f
|
DERBY-6810: Add regression tests for XXE vulnerability.
This patch was contributed by Abhinav Gupta (abhinavgupta2004 at gmail dot com)
This change adds a new regression test suite to hold tests for XXE
vulnerabilities in XML data type processing.
The new test case is in a suite by its own because we want to control the
overall security configuration (e.g., we want to ensure that no security
manager is installed).
Over time, as other types of XXE vulnerabilities are studied, we can add
additional test cases to this test suite.
Note that this test case demonstrates incorrect behavior, we believe. When
DERBY-6807 is fixed, this test case will need to be changed accordingly.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1684807 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-6807-7643f965
|
DERBY-6807: XXE attack possible by using XmlVTI and the XML datatype
This change enhances the DocumentBuilderFactory which is used by the
XmlVTI for parsing XML documents. The XmlVTI now automatically disables
external entity expansion and enables FEATURE_SECURE_PROCESSING.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1690855 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/vti/XmlVTI.java",
"hunks": [
{
"added": [
"import javax.xml.XMLConstants;"
],
"header": "@@ -35,6 +35,7 @@ import java.text.ParseException;",
"removed": []
},
{
"added": [
" * <p>",
" * XML files parsed by this VTI are always processed with external entity",
" * expansion disabled and secure parser processing enabled.",
" * <p>",
" * There are two invocation formats provided by this VTI.",
" * <p>"
],
"header": "@@ -46,6 +47,12 @@ import org.xml.sax.SAXParseException;",
"removed": []
}
]
}
] |
derby-DERBY-681-8443b6fc
|
DERBY-681 (followup): Make the visibleSize() method of ResultColumnList less
restrictive by taking into account all generated columns, not just those added
in GroupByList#bindGroupByColumns. Also, add an example query to subquery.sql
that shows why this change is needed.
Contributed by: Manish Khettry (manish_khettry@yahoo.com)
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@518687 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java",
"hunks": [
{
"added": [
"\tprivate int numGeneratedColumns() ",
"\t{",
"\t\tint numGenerated = 0;",
"\t\tint sz = size();",
"\t\tfor (int i = sz - 1; i >= 0; i--) ",
"\t\t{",
"\t\t\tResultColumn rc = (ResultColumn) elementAt(i);",
"\t\t\tif (rc.isGenerated()) ",
"\t\t\t{",
"\t\t\t\tnumGenerated++;",
"\t\t\t}",
"\t\t}",
"\t\treturn numGenerated;",
"\t}",
"\t\t"
],
"header": "@@ -3999,6 +3999,21 @@ public class ResultColumnList extends QueryTreeNodeVector",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/SubqueryNode.java",
"hunks": [
{
"added": [
"\t\tif (resultColumns.visibleSize() != 1)"
],
"header": "@@ -437,7 +437,7 @@ public class SubqueryNode extends ValueNode",
"removed": [
"\t\tif (resultColumns.size() != 1)"
]
}
]
}
] |
derby-DERBY-681-d5ef9067
|
DERBY-681: Remove the "wrap group by's in a subselect" rewrite in the parser.
This patch preserves the having clause through bind and optimize phases and
then, during the final rewrite for aggregates in the GroupByNode, it transforms
the having clause to a valid restriction. See text file attached to the Jira
for more information.
Contributed by Manish Khettry (manish_khettry@yahoo.com)
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@516454 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/sql/compile/CreateTableNode.java",
"hunks": [
{
"added": [
"\t\t\t\tif (resultColumns.size() != qeRCL.visibleSize())"
],
"header": "@@ -280,7 +280,7 @@ public class CreateTableNode extends DDLStatementNode",
"removed": [
"\t\t\t\tif (resultColumns.size() != qeRCL.size())"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/DeleteNode.java",
"hunks": [
{
"added": [
" null, /* having clause */"
],
"header": "@@ -783,6 +783,7 @@ public class DeleteNode extends DMLModStatementNode",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/FromBaseTable.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.sql.compile.Visitable;",
"import org.apache.derby.iapi.sql.compile.Visitor;"
],
"header": "@@ -52,6 +52,8 @@ import org.apache.derby.iapi.sql.compile.AccessPath;",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/GroupByNode.java",
"hunks": [
{
"added": [
"",
"import org.apache.derby.iapi.sql.compile.C_NodeTypes;",
"",
"import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;",
"import org.apache.derby.iapi.reference.ClassName;",
"import org.apache.derby.iapi.reference.SQLState;",
"",
"import org.apache.derby.iapi.sql.dictionary.DataDictionary;",
""
],
"header": "@@ -41,6 +41,15 @@ import org.apache.derby.iapi.sql.compile.OptimizablePredicateList;",
"removed": []
},
{
"added": [
"",
"import org.apache.derby.impl.sql.compile.MaxMinAggregateDefinition;",
"import java.util.Iterator;",
"import java.util.Vector;",
"",
""
],
"header": "@@ -49,6 +58,12 @@ import org.apache.derby.impl.sql.execute.AggregatorInfo;",
"removed": []
},
{
"added": [
"\tprivate ValueNode havingClause;",
"\t",
"\tprivate SubqueryList havingSubquerys;",
"\t"
],
"header": "@@ -103,6 +118,10 @@ public class GroupByNode extends SingleChildResultSetNode",
"removed": []
},
{
"added": [
"\t * @param havingClause The having clause.",
"\t * @param havingSubquerys subqueries in the having clause.",
"\t * @param nestingLevel nestingLevel of this group by node. This is used for ",
"\t * error checking of group by queries with having clause.",
"\t\t\t\t\t\tObject bottomPR,",
"\t\t\t\t\t\tObject aggregateVector,",
"\t\t\t\t\t\tObject havingClause,",
"\t\t\t\t\t\tObject havingSubquerys,",
"\t\t\t\t\t\tObject tableProperties,",
"\t\t\t\t\t\tObject nestingLevel)",
"\t\tsetLevel(((Integer)nestingLevel).intValue());",
"\t\tthis.havingClause = (ValueNode)havingClause;",
"\t\tthis.havingSubquerys = (SubqueryList)havingSubquerys;",
"//\t\t\tAggregage vector can be null if we have a having clause.",
"// select c1 from t1 group by c1 having c1 > 1;\t\t\t",
"//\t\t\tSanityManager.ASSERT(((Vector) aggregateVector).size() > 0,",
"//\t\t\t\"aggregateVector expected to be non-empty\");"
],
"header": "@@ -112,24 +131,34 @@ public class GroupByNode extends SingleChildResultSetNode",
"removed": [
"\t *",
"\t\t\t\t\t\tObject bottomPR,",
"\t\t\t\t\t\tObject\taggregateVector,",
"\t\t\t\t\t\tObject tableProperties)",
"",
"\t\t\tSanityManager.ASSERT(((Vector) aggregateVector).size() > 0,",
"\t\t\t\t\"aggregateVector expected to be non-empty\");"
]
},
{
"added": [
"\t\tResultColumnList rclNew = (ResultColumnList)getNodeFactory().getNode(",
"\t\t\t\t C_NodeTypes.RESULT_COLUMN_LIST,",
"\t\t\t\t getContextManager());",
"\t\tint sz = resultColumns.size();",
"\t\tfor (int i = 0; i < sz; i++) ",
"\t\t{",
"\t\t\tResultColumn rc = (ResultColumn) resultColumns.elementAt(i);",
"\t\t\tif (!rc.isGenerated()) {",
"\t\t\t\trclNew.addElement(rc);",
"\t\t\t}",
"\t\t}",
"",
"\t\t// if any columns in the source RCL were generated for an order by",
"\t\t// remember it in the new RCL as well. After the sort is done it will",
"\t\t// have to be projected out upstream.",
"\t\trclNew.copyOrderBySelect(resultColumns);",
"\t\t",
"\t\t\t\t\t\t\t\t\t\trclNew,",
"\t\t\t\t\t\t\t\t\t\tnull, //havingClause,",
"\t\t\t\t\t\t\t\t\t\thavingSubquerys,"
],
"header": "@@ -271,14 +300,31 @@ public class GroupByNode extends SingleChildResultSetNode",
"removed": [
"\t\t\t\t\t\t\t\t\t\tresultColumns,\t\t// result column list",
"\t\t\t\t\t\t\t\t\t\tnull,\t\t\t\t// restriction",
"\t\t\t\t\t\t\t\t\t\tnull,\t\t\t\t// restrict subqueries"
]
},
{
"added": [
"\t\t\t",
"\t\t\t// Since we always need a PR node on top of the GB ",
"\t\t\t// node to perform projection we can use it to perform ",
"\t\t\t// the having clause restriction as well. ",
"\t\t\t// To evaluate the having clause correctly, we need to ",
"\t\t\t// convert each aggregate and expression to point ",
"\t\t\t// to the appropriate result column in the group by node. ",
"\t\t\t// This is no different from the transformations we do to ",
"\t\t\t// correctly evaluate aggregates and expressions in the ",
"\t\t\t// projection list. ",
"\t\t\t// ",
"\t\t\t//",
"\t\t\t// For this query:",
"\t\t\t// SELECT c1, SUM(c2), MAX(c3)",
"\t\t\t// FROM t1 ",
"\t\t\t// HAVING c1+max(c3) > 0;",
"",
"\t\t\t// PRSN RCL -> (ptr(gbn:rcl[0]), ptr(gbn:rcl[1]), ptr(gbn:rcl[4]))",
"\t\t\t// Restriction: (> (+ ptr(gbn:rcl[0]) ptr(gbn:rcl[4])) 0)",
"\t\t\t// |",
"\t\t\t// GBN (RCL) -> (C1, SUM(C2), <input>, <aggregator>, MAX(C3), <input>, <aggregator>",
"\t\t\t// |",
"\t\t\t// FBT (C1, C2)",
"\t\t\tif (havingClause != null) {",
"\t\t\t\tSubstituteExpressionVisitor havingSE =",
"\t\t\t\t\tnew SubstituteExpressionVisitor(",
"\t\t\t\t\t\t\tgbc.getColumnExpression(),",
"\t\t\t\t\t\t\tvc, null);",
"\t\t\t\thavingClause.accept(havingSE);",
"\t\t\t}"
],
"header": "@@ -359,8 +405,36 @@ public class GroupByNode extends SingleChildResultSetNode",
"removed": [
"",
"\t\t\t// finally reset gbc to its new position."
]
},
{
"added": [
"\t * 3 columns: the aggregate input expression",
"\t * and the aggregator column and a column where the aggregate ",
"\t * result is stored. The input expression is"
],
"header": "@@ -368,8 +442,9 @@ public class GroupByNode extends SingleChildResultSetNode",
"removed": [
"\t * 2 columns: the aggregate input expression",
"\t * and the aggregator column. The input expression is"
]
},
{
"added": [
"\t *\t\t RC</LI></UL>\t"
],
"header": "@@ -389,7 +464,7 @@ public class GroupByNode extends SingleChildResultSetNode",
"removed": [
"\t *\t\t RC\t"
]
},
{
"added": [
"\t *\t<LI> replace Agg with reference to RC for agg result </LI></UL>.",
"\t * <P>",
"\t * For a query like,",
"\t * <pre>",
"\t select c1, sum(c2), max(c3)",
"\t from t1 ",
"\t group by c1;",
"\t </pre>",
"\t * the query tree ends up looking like this:",
"\t <pre>",
"\t ProjectRestrictNode RCL -> (ptr to GBN(column[0]), ptr to GBN(column[1]), ptr to GBN(column[4]))",
"\t |",
"\t GroupByNode RCL->(C1, SUM(C2), <agg-input>, <aggregator>, MAX(C3), <agg-input>, <aggregator>)",
"\t |",
"\t ProjectRestrict RCL->(C1, C2, C3)",
"\t |",
"\t FromBaseTable",
"\t </pre>",
"\t * ",
"\t * The RCL of the GroupByNode contains all the unagg (or grouping columns)",
"\t * followed by 3 RC's for each aggregate in this order: the final computed",
"\t * aggregate value, the aggregate input and the aggregator function.",
"\t * <p>",
"\t * The Aggregator function puts the results in the first of the 3 RC's ",
"\t * and the PR resultset in turn picks up the value from there.",
"\t * <p>",
"\t * The notation (ptr to GBN(column[0])) basically means that it is",
"\t * a pointer to the 0th RC in the RCL of the GroupByNode. ",
"\t * <p>",
"\t * The addition of these unagg and agg columns to the GroupByNode and ",
"\t * to the PRN is performed in addUnAggColumns and addAggregateColumns. ",
"\t * <p>",
"\t * Note that that addition of the GroupByNode is done after the",
"\t * query is optimized (in SelectNode#modifyAccessPaths) which means a ",
"\t * fair amount of patching up is needed to account for generated group by columns."
],
"header": "@@ -400,8 +475,41 @@ public class GroupByNode extends SingleChildResultSetNode",
"removed": [
"\t *\t<LI> replace Agg with reference to RC for agg result </LI>",
"\t *"
]
},
{
"added": [
"\t\tif (havingClause != null) {",
"\t\t\t// we have replaced group by expressions in the having clause.",
"\t\t\t// there should be no column references in the having clause ",
"\t\t\t// referencing this table. Skip over aggregate nodes.",
"\t\t\t// select a, sum(b) from t group by a having a+c > 1 ",
"\t\t\t// is not valid because of column c.",
"\t\t\t// ",
"\t\t\t// it is allright to have columns from parent or child subqueries;",
"\t\t\t// select * from p where p.p1 in ",
"\t\t\t// (select c.c1 from c group by c.c1 having count(*) = p.p2",
"\t\t\tCollectNodesVisitor collectNodesVisitor = ",
"\t\t\t\tnew CollectNodesVisitor(ColumnReference.class, AggregateNode.class);",
"\t\t\thavingClause.accept(collectNodesVisitor);",
"\t\t\tfor (Iterator it = collectNodesVisitor.getList().iterator();",
"\t\t\t it.hasNext(); ) ",
"\t\t\t{",
"\t\t\t\tColumnReference cr = (ColumnReference)it.next();",
"\t\t\t\t",
"\t\t\t\tif (!cr.getGeneratedToReplaceAggregate() && ",
"\t\t\t\t\t\tcr.getSourceLevel() == level) {",
"\t\t\t\t\tthrow StandardException.newException(",
"\t\t\t\t\t\t\tSQLState.LANG_INVALID_COL_HAVING_CLAUSE, ",
"\t\t\t\t\t\t\tcr.getSQLColumnName());\t\t\t\t\t\t",
"\t\t\t\t}",
"\t\t\t}",
"\t\t}"
],
"header": "@@ -412,6 +520,32 @@ public class GroupByNode extends SingleChildResultSetNode",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/InsertNode.java",
"hunks": [
{
"added": [
"\t\t\tif (resultSet.getResultColumns().visibleSize() > targetColumnList.size())",
"\t\t\tif (resultSet.getResultColumns().visibleSize() > resultColumnList.size())"
],
"header": "@@ -320,14 +320,14 @@ public final class InsertNode extends DMLModStatementNode",
"removed": [
"\t\t\tif (resultSet.getResultColumns().size() > targetColumnList.size())",
"\t\t\tif (resultSet.getResultColumns().size() > resultColumnList.size())"
]
},
{
"added": [
"\t\tint resCols = resultSet.getResultColumns().visibleSize();"
],
"header": "@@ -336,7 +336,7 @@ public final class InsertNode extends DMLModStatementNode",
"removed": [
"\t\tint resCols = resultSet.getResultColumns().size();"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java",
"hunks": [
{
"added": [
"\t * @param cr\t\t\t\t\t The ColumnReference to resolve",
"\t * @param exposedTableName\t\t Exposed table name for FromTable",
"\t * @param considerGeneratedColumns Also consider columns that are generated.",
"\t * One example of this is group by where columns are added to the select list",
"\t * if they are referenced in the group by but are not present in the select",
"\t * list."
],
"header": "@@ -340,9 +340,12 @@ public class ResultColumnList extends QueryTreeNodeVector",
"removed": [
"\t * @param cr\t\t\t\t\tThe ColumnReference to resolve",
"\t * @param exposedTableName\t\tExposed table name for FromTable",
"\t *"
]
},
{
"added": [
"\t\t\t\t\t\t\t\tString exposedTableName,",
"\t\t\t\t\t\t\t\tboolean considerGeneratedColumns)"
],
"header": "@@ -350,7 +353,8 @@ public class ResultColumnList extends QueryTreeNodeVector",
"removed": [
"\t\t\t\t\t\t\t\tString exposedTableName)"
]
},
{
"added": [
"\t\t\tif (columnName.equals( resultColumn.getName()))",
"\t\t\t\tif (resultColumn.isGenerated() && !considerGeneratedColumns) {",
"\t\t\t\t\tcontinue;",
"\t\t\t\t}"
],
"header": "@@ -361,8 +365,11 @@ public class ResultColumnList extends QueryTreeNodeVector",
"removed": [
"\t\t\tif (columnName.equals( resultColumn.getName()) )"
]
},
{
"added": [
"\t\tint size = Math.min(size(), sourceRCL.size());"
],
"header": "@@ -1570,7 +1577,7 @@ public class ResultColumnList extends QueryTreeNodeVector",
"removed": [
"\t\tint size = (size() > sourceRCL.size()) ? size() : sourceRCL.size();"
]
},
{
"added": [
" newList.copyOrderBySelect(this);",
"\t/**",
"\t * Remove any columns that may have been added for an order by clause.",
"\t * In a query like:",
"\t * <pre>select a from t order by b</pre> b is added to the select list",
"\t * However in the final projection, after the sort is complete, b will have",
"\t * to be removed. ",
"\t *",
"\t */",
"\tpublic void removeOrderByColumns() ",
"\t{",
"\t\tint idx = size() - 1;",
"\t\tfor (int i = 0; i < orderBySelect; i++, idx--) {",
"\t\t\tremoveElementAt(idx);",
"\t\t}",
"\t\torderBySelect = 0;",
"\t}",
"\t"
],
"header": "@@ -1747,10 +1754,27 @@ public class ResultColumnList extends QueryTreeNodeVector",
"removed": [
""
]
},
{
"added": [
"\t\t\tif (visibleSize() != derivedRCL.size()) {",
"\t\t\t\tthrow StandardException.newException(SQLState.LANG_DERIVED_COLUMN_LIST_MISMATCH, tableName);",
"\t\t\t}"
],
"header": "@@ -1949,7 +1973,9 @@ public class ResultColumnList extends QueryTreeNodeVector",
"removed": [
"\t\t\tthrow StandardException.newException(SQLState.LANG_DERIVED_COLUMN_LIST_MISMATCH, tableName);"
]
},
{
"added": [
"\t\t\tif (visibleSize() != otherRCL.visibleSize())"
],
"header": "@@ -2131,7 +2157,7 @@ public class ResultColumnList extends QueryTreeNodeVector",
"removed": [
"\t\t\tif (size() != otherRCL.size())"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/ResultSetNode.java",
"hunks": [
{
"added": [
"\t\t\tSanityManager.ASSERT(resultColumns.visibleSize() <= typeColumns.size(),"
],
"header": "@@ -314,7 +314,7 @@ public abstract class ResultSetNode extends QueryTreeNode",
"removed": [
"\t\t\tSanityManager.ASSERT(resultColumns.size() <= typeColumns.size(),"
]
},
{
"added": [],
"header": "@@ -832,7 +832,6 @@ public abstract class ResultSetNode extends QueryTreeNode",
"removed": [
""
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/SelectNode.java",
"hunks": [
{
"added": [
"\tVector havingAggregates;"
],
"header": "@@ -73,7 +73,7 @@ public class SelectNode extends ResultSetNode",
"removed": [
""
]
},
{
"added": [
"\t/** User specified a group by without aggregates and we turned ",
"\t * it into a select distinct ",
"\t */",
"\tprivate boolean wasGroupBy;",
"\t"
],
"header": "@@ -88,6 +88,11 @@ public class SelectNode extends ResultSetNode",
"removed": []
},
{
"added": [
"\t/* SubqueryLists for select where and having clauses */",
"\tSubqueryList havingSubquerys;"
],
"header": "@@ -95,9 +100,10 @@ public class SelectNode extends ResultSetNode",
"removed": [
"\t/* SubqueryLists for select and where clauses */"
]
},
{
"added": [
"\tValueNode havingClause;",
"\t",
"\tprivate int nestingLevel;",
"\t\t\t Object groupByList,",
"\t\t\t Object havingClause)"
],
"header": "@@ -112,24 +118,15 @@ public class SelectNode extends ResultSetNode",
"removed": [
"\t/**",
"\t * Initializer for a SelectNode.",
"\t *",
"\t * @param selectList\tThe result column list for the SELECT statement",
"\t * @param aggregateVector\tThe aggregate vector for this SELECT ",
"\t * @param fromList\tThe FROM list for the SELECT statement",
"\t * @param whereClause\tAn expression representing the WHERE clause.",
"\t *\t\t\tIt must be a boolean expression, but this is",
"\t *\t\t\tnot checked until binding.",
"\t * @param groupByList\tThe GROUP BY list, if any.",
"\t * @exception StandardException\t\tThrown on error",
"\t */",
"",
"\t\t\t Object groupByList)"
]
},
{
"added": [
"\t\tthis.havingClause = (ValueNode)havingClause;"
],
"header": "@@ -142,6 +139,7 @@ public class SelectNode extends ResultSetNode",
"removed": []
},
{
"added": [
"\t\t"
],
"header": "@@ -423,13 +421,8 @@ public class SelectNode extends ResultSetNode",
"removed": [
"\t\tint fromListParamSize = fromListParam.size();",
"\t\tint nestingLevel;",
"\t\tFromList fromListClone = (FromList) getNodeFactory().getNode(",
"\t\t\t\t\t\t\t\t\tC_NodeTypes.FROM_LIST,",
"\t\t\t\t\t\t\t\t\tgetNodeFactory().doJoinOrderOptimization(),",
"\t\t\t\t\t\t\t\t\tgetContextManager());"
]
},
{
"added": [
"\t\tif (havingClause != null) {",
"\t\t\thavingAggregates = new Vector();",
"\t\t\thavingSubquerys = (SubqueryList) getNodeFactory().getNode(",
"\t\t\t\t\tC_NodeTypes.SUBQUERY_LIST,",
"\t\t\t\t\tgetContextManager());",
"\t\t\thavingClause.bindExpression(",
"\t\t\t\t\tfromListParam, havingSubquerys, havingAggregates);",
"\t\t\thavingClause = havingClause.checkIsBoolean();",
"\t\t}",
"\t\t"
],
"header": "@@ -567,6 +560,16 @@ public class SelectNode extends ResultSetNode",
"removed": []
},
{
"added": [
"\t\tif (havingClause != null) {",
"\t\t\thavingClause = havingClause.preprocess(",
"\t\t\t\t\tnumTables, fromList, havingSubquerys, wherePredicates);",
"\t\t}",
"\t\t"
],
"header": "@@ -964,6 +967,11 @@ public class SelectNode extends ResultSetNode",
"removed": []
},
{
"added": [
"\t\t/* A valid group by without any aggregates or a having clause",
"\t\t * is equivalent to a distinct without the group by. We do the transformation",
"\t\t\thavingClause == null &&",
"\t\t\twasGroupBy = true;"
],
"header": "@@ -1008,16 +1016,18 @@ public class SelectNode extends ResultSetNode",
"removed": [
"\t\t/* A valid group by without any aggregates is equivalent to ",
"\t\t * a distinct without the group by. We do the transformation"
]
},
{
"added": [
" \t\t\t\t\torderByList.resetToSourceRCs();",
"\t\t\t\t\tnewTop.getResultColumns().removeOrderByColumns();"
],
"header": "@@ -1087,8 +1097,9 @@ public class SelectNode extends ResultSetNode",
"removed": [
"\t\t\t\t\torderByList.resetToSourceRCs();"
]
},
{
"added": [
"\t\t\tVector aggs = selectAggregates;",
"\t\t\tif (havingAggregates != null && !havingAggregates.isEmpty()) {",
"\t\t\t\thavingAggregates.addAll(selectAggregates);",
"\t\t\t\taggs = havingAggregates;",
"\t\t\t}",
"\t\t\t\t\t\t\t\t\t\t\t\taggs,",
"\t\t\t\t\t\t\t\t\t\t\t\thavingClause,",
"\t\t\t\t\t\t\t\t\t\t\t\thavingSubquerys,",
"\t\t\t\t\t\t\t\t\t\t\t\tnew Integer(nestingLevel),"
],
"header": "@@ -1308,12 +1319,20 @@ public class SelectNode extends ResultSetNode",
"removed": [
"\t\t\t\t\t\t\t\t\t\t\t\tselectAggregates,"
]
},
{
"added": [
"\t\t\t",
"\t\t\t// There may be columns added to the select projection list",
"\t\t\t// a query like:",
"\t\t\t// select a, b from t group by a,b order by a+b",
"\t\t\t// the expr a+b is added to the select list. ",
"\t\t\t\t",
"\t\t\t\tselectRCs.removeOrderByColumns();",
"\t\t\t\tselectRCs.genVirtualColumnNodes(prnRSN, prnRSN.getResultColumns());\t\t\t\t"
],
"header": "@@ -1408,15 +1427,18 @@ public class SelectNode extends ResultSetNode",
"removed": [
"",
"\t\t\t\tint wholeSize = selectRCs.size();",
"\t\t\t\tfor (int i = wholeSize - 1; orderBySelect > 0; i--, orderBySelect--)",
"\t\t\t\t\tselectRCs.removeElementAt(i);",
"\t\t\t\tselectRCs.genVirtualColumnNodes(prnRSN, prnRSN.getResultColumns());"
]
},
{
"added": [
"\t\t",
"\t\tif (wasGroupBy && resultColumns.numGeneratedColumnsForGroupBy() > 0) {",
"\t\t\t// This case takes care of columns generated for group by's which ",
"\t\t\t// will need to be removed from the final projection. Note that the",
"\t\t\t// GroupByNode does remove generated columns but in certain cases",
"\t\t\t// we dispense with a group by and replace it with a distinct instead.",
"\t\t\t// So in a query like:",
"\t\t\t// select c1 from t group by c1, c2",
"\t\t\t// we would have added c2 to the projection list which will have to be ",
"\t\t\t// projected out.",
"\t\t\t",
"\t\t\tResultColumnList newSelectList = prnRSN.getResultColumns().copyListAndObjects(); ",
"\t\t\tnewSelectList.removeGeneratedGroupingColumns();",
"\t\t\tnewSelectList.genVirtualColumnNodes(prnRSN, prnRSN.getResultColumns());",
"\t\t\tprnRSN = (ResultSetNode) getNodeFactory().getNode(",
"\t\t\t\t\t\tC_NodeTypes.PROJECT_RESTRICT_NODE,",
"\t\t\t\t\t\tprnRSN,",
"\t\t\t\t\t\tnewSelectList,",
"\t\t\t\t\t\tnull,",
"\t\t\t\t\t\tnull,",
"\t\t\t\t\t\tnull,",
"\t\t\t\t\t\tnull,",
"\t\t\t\t\t\tnull,",
"\t\t\t\t\t\tgetContextManager());",
"\t\t}",
""
],
"header": "@@ -1430,6 +1452,32 @@ public class SelectNode extends ResultSetNode",
"removed": []
},
{
"added": [
"\t\t",
"\t\tif (havingSubquerys != null && havingSubquerys.size() > 0) {",
"\t\t\thavingSubquerys.optimize(dataDictionary, costEstimate.rowCount());",
"\t\t}"
],
"header": "@@ -1683,6 +1731,10 @@ public class SelectNode extends ResultSetNode",
"removed": []
},
{
"added": [
"\t\t",
"\t\tif (havingSubquerys != null && havingSubquerys.size() > 0) {",
"\t\t\thavingSubquerys.modifyAccessPaths();",
"\t\t}"
],
"header": "@@ -1776,6 +1828,10 @@ public class SelectNode extends ResultSetNode",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/SubqueryNode.java",
"hunks": [
{
"added": [
"\t\t * o There is no group by clause or having clause."
],
"header": "@@ -678,7 +678,7 @@ public class SubqueryNode extends ValueNode",
"removed": [
"\t\t * o There is no group by clause"
]
}
]
}
] |
derby-DERBY-681-dcd2b043
|
DERBY-4450 GROUP BY in an IN-subquery inside HAVING clause whose select list is subset of group by columns, gives NPE
Patch derby-4450b + Knut's simplification of the autocommit call in GrooupByTest#testDerby4450.
This solves the problem seen in this issue, which was a regression
from DERBY-681. The crux of the problem is that a PRN is added in the
result set tree without adjusting a higher level reference so that
wrong code is generated. The solution here is to reuse the result
column list in the inserted PRN, so that reference from above will
point correctly even after the PRN insertion (more details in JIRA).
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@882732 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-6825-4394bdd1
|
DERBY-6825: Add SimpleJsonVTI and helper functions to the simpleJson optional tool; commit derby-6825-02-aa-vti.diff.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1693506 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/optional/org/apache/derby/optional/api/SimpleJsonUtils.java",
"hunks": [
{
"added": [
"import java.io.FileInputStream;",
"import java.io.InputStream;",
"import java.io.InputStreamReader;",
"import java.io.IOException;",
"import java.io.Reader;",
"import java.io.StringReader;",
"import java.io.UnsupportedEncodingException;",
"import java.net.MalformedURLException;",
"import java.net.URL;",
"import java.security.AccessController;",
"import java.security.PrivilegedActionException;",
"import java.security.PrivilegedExceptionAction;"
],
"header": "@@ -21,6 +21,18 @@",
"removed": []
},
{
"added": [
"import org.json.simple.parser.JSONParser;"
],
"header": "@@ -32,6 +44,7 @@ import java.sql.SQLException;",
"removed": []
},
{
"added": [
" /**",
" * Construct a JSONArray from a Reader.",
" */",
" public static JSONArray readArray( Reader reader )",
" throws SQLException",
" {",
" JSONParser parser = new JSONParser();",
" ",
" Object obj = null;",
" try {",
" obj = parser.parse( reader );",
" }",
" catch( Throwable t) { throw wrap( t ); }",
"",
" if ( (obj == null) || !(obj instanceof JSONArray) )",
" {",
" throw new SQLException( \"Document is not a JSON array.\" );",
" }",
"",
" return (JSONArray) obj;",
" }",
"",
" /**",
" * <p>",
" * SQL FUNCTION to convert a JSON document string into a JSONArray.",
" * This function is registered by the simpleJson optional tool.",
" * </p>",
" */",
" public static JSONArray readArrayFromString( String document )",
" throws SQLException",
" {",
" if ( document == null ) { document = \"\"; }",
"",
" return readArray( new StringReader( document ) );",
" }",
"",
" /**",
" * Read a JSONArray from an InputStream.",
" */",
" public static JSONArray readArrayFromStream",
" ( InputStream inputStream, String characterSetName )",
" throws SQLException",
" {",
" try {",
" return readArray( new InputStreamReader( inputStream, characterSetName ) );",
" }",
" catch (UnsupportedEncodingException uee) { throw wrap( uee ); }",
" }",
"",
" /**",
" * SQL FUNCTION to read a JSONArray from a File. This function",
" * is registered by the simpleJson optional tool.",
" */",
" public static JSONArray readArrayFromFile",
" ( String fileName, String characterSetName )",
" throws SQLException",
" {",
" FileInputStream fis = null;",
" final String name_of_file = fileName;",
" ",
" try {",
" fis = AccessController.doPrivileged(",
" new PrivilegedExceptionAction<FileInputStream>()",
" {",
" public FileInputStream run() throws IOException",
" {",
" return new FileInputStream( name_of_file );",
" }",
" }",
" );",
" }",
" catch (PrivilegedActionException pae) { throw wrap( pae ); }",
"",
" return readArrayFromStream( fis, characterSetName );",
" }",
"",
" /**",
" * SQL FUNCTION to read a JSONArray from an URL address.",
" * This function is registered by the simpleJson optional tool.",
" */",
" public static JSONArray readArrayFromURL",
" ( String urlString, String characterSetName )",
" throws SQLException",
" {",
" InputStream inputStream = null;",
" final String url_string = urlString;",
" ",
" try {",
" inputStream = AccessController.doPrivileged(",
" new PrivilegedExceptionAction<InputStream>()",
" {",
" public InputStream run() throws IOException, MalformedURLException",
" {",
" URL url = new URL( url_string );",
" return url.openStream();",
" }",
" }",
" );",
" }",
" catch (PrivilegedActionException pae) { throw wrap( pae ); }",
" ",
" return readArrayFromStream( inputStream, characterSetName );",
" }",
"",
""
],
"header": "@@ -117,6 +130,111 @@ public abstract class SimpleJsonUtils",
"removed": []
}
]
},
{
"file": "java/optional/org/apache/derby/optional/json/SimpleJsonTool.java",
"hunks": [
{
"added": [
" * OptionalTool which adds support types and functions for",
" * using the JSON.simple toolkit at https://code.google.com/p/json-simple/.",
" * Creates the following schema objects in the current schema:",
" *",
" * <ul>",
" * <li><b>JSONArray</b> - A UDT bound to the JSON.simple JSONArray class.</li>",
" * <li><b>toJSON</b> - A function for packaging up query results as a",
" * JSONArray. Each cell in the array is a row. Each row",
" * has key/value pairs for all columns returned by the query.</li>",
" * <li><b>readArrayFromString</b> - A function which turns a JSON document",
" * string into a JSONArray.</li>",
" * <li><b>readArrayFromFile</b> - A function which reads a file containing a",
" * JSON document and turns it into a JSONArray.</li>",
" * <li><b>readArrayFromURL</b> - A function which reads a JSON document from an",
" * URL address and turns it into a JSONArray.</li>",
" * </ul>"
],
"header": "@@ -38,12 +38,23 @@ import org.apache.derby.optional.api.SimpleJsonUtils;",
"removed": [
" * OptionalTool which adds a function for turning a query result",
" * into a JSON array. Each cell in the array is a row. Each row",
" * has key/value pairs for all columns returned by the query.",
" * This tool binds a user-defined type to the simple-json JSONArray",
" * class."
]
},
{
"added": [
" private FunctionDescriptor[] _functionDescriptors =",
" {",
" new FunctionDescriptor",
" (",
" \"toJSON\",",
" \"create function toJSON\" +",
" \"\\n(\" +",
" \"\\n\\tqueryString varchar( 32672 ),\" +",
" \"\\n\\tqueryArgs varchar( 32672 ) ...\" +",
" \"\\n)\\nreturns JSONArray\\n\" +",
" \"\\nlanguage java parameter style derby reads sql data\" +",
" \"\\nexternal name 'org.apache.derby.optional.json.SimpleJsonTool.toJSON'\\n\"",
" ),",
"",
" new FunctionDescriptor",
" (",
" \"readArrayFromString\",",
" \"create function readArrayFromString( document varchar( 32672 ) )\\n\" +",
" \"returns JSONArray\\n\" +",
" \"language java parameter style java contains sql\\n\" +",
" \"external name 'org.apache.derby.optional.api.SimpleJsonUtils.readArrayFromString'\\n\"",
" ),",
"",
" new FunctionDescriptor",
" (",
" \"readArrayFromFile\",",
" \"create function readArrayFromFile\\n\" +",
" \"( fileName varchar( 32672 ), characterSetName varchar( 100 ) )\\n\" +",
" \"returns JSONArray\\n\" +",
" \"language java parameter style java contains sql\\n\" +",
" \"external name 'org.apache.derby.optional.api.SimpleJsonUtils.readArrayFromFile'\\n\"",
" ),",
"",
" new FunctionDescriptor",
" (",
" \"readArrayFromURL\",",
" \"create function readArrayFromURL\\n\" +",
" \"( urlString varchar( 32672 ), characterSetName varchar( 100 ) )\\n\" +",
" \"returns JSONArray\\n\" +",
" \"language java parameter style java contains sql\\n\" +",
" \"external name 'org.apache.derby.optional.api.SimpleJsonUtils.readArrayFromURL'\\n\"",
" ),",
" };",
"",
" public static final class FunctionDescriptor",
" {",
" public final String functionName;",
" public final String creationDDL;",
"",
" public FunctionDescriptor( String functionName, String creationDDL )",
" {",
" this.functionName = functionName;",
" this.creationDDL = creationDDL;",
" }",
" }",
""
],
"header": "@@ -53,12 +64,68 @@ public\tclass SimpleJsonTool implements OptionalTool",
"removed": []
},
{
"added": [
" createFunctions( derbyConn );"
],
"header": "@@ -91,7 +158,7 @@ public\tclass SimpleJsonTool implements OptionalTool",
"removed": [
" createFunction( derbyConn );"
]
},
{
"added": [
" dropFunctions( derbyConn );"
],
"header": "@@ -110,7 +177,7 @@ public\tclass SimpleJsonTool implements OptionalTool",
"removed": [
" dropFunction( derbyConn );"
]
}
]
}
] |
derby-DERBY-6825-961b0f44
|
DERBY-6825: Add to the simpleJson tool a function which converts a JSONArray into a Clob; commit derby-6825-05-aa-toClobFunction.diff.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1701885 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/optional/org/apache/derby/optional/api/SimpleJsonUtils.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.types.HarmonySerialClob;"
],
"header": "@@ -46,6 +46,7 @@ import org.json.simple.JSONArray;",
"removed": []
}
]
}
] |
derby-DERBY-683-fb605fe1
|
DERBY-683: Commit _tstpatch3_ by Myrna. Adds derbyTesting.encoding property to
harness. Excludes encodingTests from all JDKs except Sun JDK 1.5. Further
investigation is required to understand why this is necessary. The changes
introduced in this patch (specifically, setting -Dfile.encoding on the command-
line of the spawned JVM) should not cause NoClassDefFoundErrors on JDK 1.4.2,
but they do.
Committed for Deepa Remesh <dremesh@gmail.com> and
Myrna Van Lunteren <m.v.lunteren@gmail.com>
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@379723 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/testing/org/apache/derbyTesting/functionTests/harness/HandleResult.java",
"hunks": [
{
"added": [
"\tpublic static String handleResult(int exitCode, InputStream stdout,",
"\t InputStream stderr, PrintWriter printWriter)",
"\t throws IOException",
"\t{",
"\t\treturn handleResult(exitCode, stdout, stderr, printWriter, null);",
"\t}",
"\t",
" InputStream stderr, PrintWriter printWriter, String encoding)"
],
"header": "@@ -39,8 +39,15 @@ public class HandleResult",
"removed": [
" InputStream stderr, PrintWriter printWriter)"
]
},
{
"added": [
" \tBufferedReader outReader;",
" \tif(encoding != null)",
" \t\toutReader = new BufferedReader(new InputStreamReader(stdout, encoding));",
" \telse",
" \t\toutReader = new BufferedReader(new InputStreamReader(stdout));"
],
"header": "@@ -52,7 +59,11 @@ public class HandleResult",
"removed": [
" \t\tBufferedReader outReader = new BufferedReader(new InputStreamReader(stdout));"
]
}
]
},
{
"file": "java/testing/org/apache/derbyTesting/functionTests/harness/ProcessStreamResult.java",
"hunks": [
{
"added": [
"\tprotected InputStream in; ",
"\tprotected OutputStreamWriter outStream;",
"\t// Encoding to be used to read output of test jvm process",
"\tprotected String encoding;"
],
"header": "@@ -27,8 +27,10 @@ import java.sql.Timestamp;",
"removed": [
"\tprotected InputStream in;",
"\tprotected BufferedOutputStream bos;"
]
},
{
"added": [
"\t\t String timemin) throws IOException, InterruptedException",
"\t{",
"\t\tthis(in, bos, timemin, null);",
"\t}",
"\t",
"\tpublic ProcessStreamResult(InputStream in, BufferedOutputStream bos,",
"\t String timemin, String encoding) throws IOException, InterruptedException",
"\t\tthis.outStream = new OutputStreamWriter(bos);",
"\t\tthis.encoding = encoding;"
],
"header": "@@ -37,10 +39,17 @@ public class ProcessStreamResult implements Runnable",
"removed": [
"\t String timemin) throws IOException, InterruptedException",
" this.bos = bos;"
]
},
{
"added": [
"\t\t\tchar[] ca = new char[1024];",
"\t\t\t",
"\t\t\t// Create an InputStreamReader with encoding, if specified. ",
"\t\t\t// Otherwise, use default.",
"\t\t\tInputStreamReader inStream;",
"\t\t\tif(encoding != null)",
" \t\tinStream = new InputStreamReader(in, encoding);",
" \telse",
" \t\tinStream = new InputStreamReader(in);",
"\t\t\t",
"\t\t\twhile ((valid = inStream.read(ca, 0, ca.length)) != -1)"
],
"header": "@@ -65,10 +74,19 @@ public class ProcessStreamResult implements Runnable",
"removed": [
"\t\t\tbyte[] ba = new byte[1024];",
"\t\t\twhile ((valid = in.read(ba, 0, ba.length)) != -1)"
]
}
]
},
{
"file": "java/testing/org/apache/derbyTesting/functionTests/harness/RunList.java",
"hunks": [
{
"added": [
"\tstatic String testEncoding;\t// Encoding used for child jvm and to read the test output ",
"\t"
],
"header": "@@ -118,7 +118,8 @@ public class RunList",
"removed": [
""
]
},
{
"added": [
" if (testEncoding != null)",
" jvmProps.addElement(\"derbyTesting.encoding=\" + testEncoding);",
""
],
"header": "@@ -414,6 +415,9 @@ public class RunList",
"removed": []
},
{
"added": [
" stdout.getData(), stderr.getData(), pwOut, testEncoding);"
],
"header": "@@ -516,7 +520,7 @@ public class RunList",
"removed": [
" stdout.getData(), stderr.getData(), pwOut);"
]
},
{
"added": [
" testEncoding = parentProps.getProperty(\"derbyTesting.encoding\");"
],
"header": "@@ -611,6 +615,7 @@ public class RunList",
"removed": []
},
{
"added": [
"\t\ttestEncoding = suiteProperties.getProperty(\"derbyTesting.encoding\");"
],
"header": "@@ -739,6 +744,7 @@ public class RunList",
"removed": []
}
]
},
{
"file": "java/testing/org/apache/derbyTesting/functionTests/harness/RunSuite.java",
"hunks": [
{
"added": [
"\tstatic String testEncoding; // setting the encoding."
],
"header": "@@ -72,6 +72,7 @@ public class RunSuite",
"removed": []
},
{
"added": [
" testEncoding = p.getProperty(\"derbyTesting.encoding\");"
],
"header": "@@ -351,6 +352,7 @@ public class RunSuite",
"removed": []
}
]
}
] |
derby-DERBY-6852-d055adb2
|
DERBY-6852: Allow identity columns to cycle
This patch was contributed by Danoja Dias (danojadias at gmail dot com)
This change introduces the new CYCLE keyword to the syntax of a
generated identity column. The CYCLE keyword, if specified, causes Derby
to select the CYCLE option in the sequence object that is created
internally to implement the identity column.
In turn, this means that values can be generated for the identity column
beyond the maximum value for the column's datatype; when that maximum
is reached, the sequence "cycles" and begins over again, (re-)generating
the values all over again.
Note that, as part of this change, when a Derby sequence cycles, it now
cycles to its minimum/maximum value (depending on whether it has a
positive increment or a negative increment) rather than to its start
value; we believe this is improved behavior and is still standards-compliant.
With this change, the basic behavior is operational and there are tests
to demonstrate this. Various syntax checks are made, and the underlying
sequence is created correctly.
There is follow-up work to be done, which will be addressed possibly as
separate projects; we believe the basic feature is certainly usable
as of this change (and once we add documentation for it).
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1756287 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/sql/compile/ColumnDefinitionNode.java",
"hunks": [
{
"added": [
" long autoincrementCycle;"
],
"header": "@@ -66,6 +66,7 @@ public class ColumnDefinitionNode extends TableElementNode",
"removed": []
},
{
"added": [
"\t\t\t\tautoincrementCycle = aii[QueryTreeNode.AUTOINCREMENT_CYCLE];"
],
"header": "@@ -143,6 +144,7 @@ public class ColumnDefinitionNode extends TableElementNode",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/TableElementList.java",
"hunks": [
{
"added": [
"\t\t\t\t\t\t\t\tColumnInfo.DROP, 0, 0, 0, 0);"
],
"header": "@@ -455,7 +455,7 @@ class TableElementList extends QueryTreeNodeVector<TableElementNode>",
"removed": [
"\t\t\t\t\t\t\t\tColumnInfo.DROP, 0, 0, 0);"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/execute/ColumnInfo.java",
"hunks": [
{
"added": [
" long autoincCycle;"
],
"header": "@@ -75,6 +75,7 @@ public class ColumnInfo implements Formatable",
"removed": []
},
{
"added": [
"\t\t\t\t\t long autoincCycle,"
],
"header": "@@ -130,6 +131,7 @@ public class ColumnInfo implements Formatable",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/execute/CreateTableConstantAction.java",
"hunks": [
{
"added": [
"\tboolean cycling=false;",
"",
"\tif(info.autoincCycle==1)",
"\t\tcycling=true;",
"\t"
],
"header": "@@ -418,6 +418,11 @@ class CreateTableConstantAction extends DDLConstantAction",
"removed": []
}
]
}
] |
derby-DERBY-6854-a9431f51
|
DERBY-6854: Fix the tests so that they run on the early access build 100 of Java 9; tests ran cleanly for me on derby-6854-01-aa-fixFor9-ea.diff.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1725139 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-6854-cd362863
|
DERBY-6854: Make it possible to run Derby tests on early access
versions of JDK 9
JDK 9 will move the JDBC classes out of the boot class loader and into
the platform class loader (see JDK-8154189 in the OpenJDK bug
tracker).
Derby has some test and debug code that assumes that the JDBC classes
live in the boot class loader.
1) Some tests create a new class loader in order to make the test load
the Derby classes afresh (SysinfoLocaleTest), or to test against a
different version of Derby (the upgrade tests). To achieve this, they
create a URLClassLoader which contains the Derby jar files they want
to test against, and set the parent of the URLClassLoader to null,
which means that the boot class loader is the parent.
Now that the JDBC classes are not on the boot class loader, this
URLClassLoader is not able to find the JDBC classes, and the tests
fail with NoClassDefFoundErrors when trying to load them.
This is fixed by setting the parent of the created URLClassLoader to
what java.sql.Connection.class.getClassLoader() returns. On JDK 8 and
earlier it returns null, so nothing changes there. On JDK 9 it returns
the platform class loader, which is capable of loading the JDBC
classes.
2) The org.apache.derby.impl.services.bytecode.d_BCValidate class
contains some debug code (only included in the sane jars) which runs
some sanity checks on the generated byte code. To do this, it accesses
the class loader of all the classes in the method signatures.
When getClassLoader() is called on JDBC classes, a RuntimePermission
is needed now. This was not the case before when the JDBC classes were
in the boot class loader, since Class.getClassLoader() does not check
for permissions if the class loader is null. Now this causes an
AccessControlException in tests that run with a security manager. The
tests actually grant the required permission to derby.jar, but the
call is not wrapped in AccessController.doPrivileged(), so it fails
because the permission is not granted to the test code.
The fix is to wrap the call to getClassLoader() in a doPrivileged()
block. Additionally, because RuntimePermission("getClassLoader") is
not a mandatory permission for derby.jar, we need to check if it
raises a security exception. d_BCValidate only needs the class loader
in order to check if it is the same class loader as d_BCValidate's own
class loader. Since Class.getClassLoader() does not require any
permissions if the class has the same class loader as the calling
class, we can conclude that the class loaders are different if a
security exception is raised.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1744989 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/services/bytecode/d_BCValidate.java",
"hunks": [
{
"added": [
"import java.security.AccessController;",
"import java.security.PrivilegedAction;",
"import java.util.Objects;"
],
"header": "@@ -22,11 +22,12 @@",
"removed": [
"import org.apache.derby.iapi.services.loader.*;",
"import org.apache.derby.iapi.services.context.*;"
]
}
]
}
] |
derby-DERBY-6856-44694000
|
DERBY-6856: Eliminate build warnings related to RoundingMode and Class.newInstance() introduced by build 118 of JDK 9: commit derby-6856-05-ag-roundingMode-Class.newInstance.diff.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1745932 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/client/org/apache/derby/client/am/ClientPreparedStatement.java",
"hunks": [
{
"added": [
"import java.math.RoundingMode;"
],
"header": "@@ -25,6 +25,7 @@ import java.io.InputStream;",
"removed": []
}
]
},
{
"file": "java/client/org/apache/derby/jdbc/ClientDriver.java",
"hunks": [
{
"added": [
" Class<?> clazz = Class.forName(factoryName);",
" return (ClientJDBCObjectFactory) clazz.getConstructor().newInstance();",
" } catch (NoSuchMethodException iae) {",
" return createDefaultFactoryImpl();",
" } catch (java.lang.reflect.InvocationTargetException iae) {",
" return createDefaultFactoryImpl();"
],
"header": "@@ -470,14 +470,18 @@ public class ClientDriver implements Driver {",
"removed": [
" return (ClientJDBCObjectFactory)",
" Class.forName(factoryName).newInstance();"
]
}
]
},
{
"file": "java/drda/org/apache/derby/impl/drda/DecryptionManager.java",
"hunks": [
{
"added": [
" {",
" Class<?> clazz = Class.forName(\"IBMJCE\");",
" java.security.Security.addProvider ((java.security.Provider) clazz.getConstructor().newInstance());",
" }"
],
"header": "@@ -103,7 +103,10 @@ class DecryptionManager",
"removed": [
" java.security.Security.addProvider ((java.security.Provider) Class.forName(\"IBMJCE\").newInstance());"
]
}
]
},
{
"file": "java/engine/org/apache/derby/iapi/services/diag/DiagnosticUtil.java",
"hunks": [
{
"added": [
"import java.lang.reflect.Constructor;",
""
],
"header": "@@ -41,6 +41,8 @@ the D_* helper class:",
"removed": []
},
{
"added": [
"\t\t\t\tClass<?> diagClass;"
],
"header": "@@ -80,7 +82,7 @@ public class DiagnosticUtil",
"removed": [
"\t\t\t\tClass diagClass;"
]
}
]
},
{
"file": "java/engine/org/apache/derby/iapi/types/SQLDecimal.java",
"hunks": [
{
"added": [
"import java.math.RoundingMode;"
],
"header": "@@ -34,6 +34,7 @@ import org.apache.derby.iapi.services.cache.ClassSize;",
"removed": []
},
{
"added": [
"\t\t\tvalue = value.setScale(scale, RoundingMode.DOWN);"
],
"header": "@@ -127,8 +128,7 @@ public final class SQLDecimal extends NumberDataType implements VariableSizeData",
"removed": [
"\t\t\tvalue = value.setScale(scale, ",
"\t\t\t\t\t\t\tBigDecimal.ROUND_DOWN);"
]
},
{
"added": [
"\t\tresult.setBigDecimal",
" (",
" dividendBigDecimal.divide",
" (",
" divisorBigDecimal,",
" scale > -1 ?",
" scale :",
" Math.max",
" (",
" (dividendBigDecimal.scale() + SQLDecimal.getWholeDigits(divisorBigDecimal) + 1), ",
" NumberDataValue.MIN_DECIMAL_DIVIDE_SCALE",
" ),",
" RoundingMode.DOWN)",
" );"
],
"header": "@@ -854,14 +854,20 @@ public final class SQLDecimal extends NumberDataType implements VariableSizeData",
"removed": [
"\t\tresult.setBigDecimal(dividendBigDecimal.divide(",
"\t\t\t\t\t\t\t\t\tdivisorBigDecimal,",
"\t\t\t\t\t\t\t\t\tscale > -1 ? scale :",
"\t\t\t\t\t\t\t\t\tMath.max((dividendBigDecimal.scale() + ",
"\t\t\t\t\t\t\t\t\t\t\tSQLDecimal.getWholeDigits(divisorBigDecimal) +",
"\t\t\t\t\t\t\t\t\t\t\t1), ",
"\t\t\t\t\t\t\t\t\t\tNumberDataValue.MIN_DECIMAL_DIVIDE_SCALE),",
"\t\t\t\t\t\t\t\t\tBigDecimal.ROUND_DOWN));"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/jdbc/authentication/SpecificAuthenticationServiceImpl.java",
"hunks": [
{
"added": [
"\t\t\tClass<?> sasClass = Class.forName(specificAuthenticationScheme);",
"\t\t\tUserAuthenticator aScheme = (UserAuthenticator) sasClass.getConstructor().newInstance();"
],
"header": "@@ -116,13 +116,13 @@ public class SpecificAuthenticationServiceImpl",
"removed": [
"\t\t\tClass sasClass = Class.forName(specificAuthenticationScheme);",
"\t\t\tUserAuthenticator aScheme = (UserAuthenticator) sasClass.newInstance();"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/services/jce/JCECipherFactory.java",
"hunks": [
{
"added": [
" Class<?> cryptoClass = Class.forName(cryptoProvider);",
" java.lang.reflect.Constructor<?> constructor = cryptoClass.getConstructor();",
" final Provider provider = (Provider) constructor.newInstance();"
],
"header": "@@ -540,15 +540,15 @@ final class JCECipherFactory implements CipherFactory",
"removed": [
" Class cryptoClass = Class.forName(cryptoProvider);",
" final Provider provider =",
" (Provider) cryptoClass.newInstance();"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/services/monitor/BaseMonitor.java",
"hunks": [
{
"added": [
"import java.lang.reflect.Constructor;"
],
"header": "@@ -28,6 +28,7 @@ import java.io.IOException;",
"removed": []
},
{
"added": [
"\t\t\t\tClass<?> clazz = Class.forName(className);",
" final Constructor<?> constructor = clazz.getDeclaredConstructor();",
" FormatableInstanceGetter tfig = (FormatableInstanceGetter) constructor.newInstance();"
],
"header": "@@ -618,11 +619,12 @@ abstract class BaseMonitor",
"removed": [
"\t\t\t\tClass clazz = Class.forName(className);",
"\t\t\t\t\tFormatableInstanceGetter tfig = (FormatableInstanceGetter) clazz.newInstance();"
]
},
{
"added": [
"\t\t\t} catch (NoSuchMethodException nsme) {",
"\t\t\t\tt = nsme;",
"\t\t\t} catch (InvocationTargetException ite) {",
"\t\t\t\tt = ite;"
],
"header": "@@ -635,6 +637,10 @@ abstract class BaseMonitor",
"removed": []
},
{
"added": [
" \t\tcatch (NoSuchMethodException iae) {",
"\t\t\tt = iae;",
"\t\t}",
" }"
],
"header": "@@ -685,9 +691,12 @@ abstract class BaseMonitor",
"removed": [
"\t\t}"
]
},
{
"added": [
" final Constructor<?> constructor = classObject.getDeclaredConstructor();",
" final Object module = constructor.newInstance();"
],
"header": "@@ -777,7 +786,8 @@ abstract class BaseMonitor",
"removed": [
" final Object module = classObject.newInstance();"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/services/monitor/StorageFactoryService.java",
"hunks": [
{
"added": [
"import java.lang.reflect.InvocationTargetException;"
],
"header": "@@ -54,6 +54,7 @@ import java.io.OutputStream;",
"removed": []
},
{
"added": [
" private final Class<?> storageFactoryClass;"
],
"header": "@@ -78,7 +79,7 @@ final class StorageFactoryService implements PersistentService",
"removed": [
" private final Class storageFactoryClass;"
]
},
{
"added": [
" public StorageFactory run() throws InstantiationException,",
" IllegalAccessException, IOException, NoSuchMethodException, InvocationTargetException"
],
"header": "@@ -185,7 +186,8 @@ final class StorageFactoryService implements PersistentService",
"removed": [
" public StorageFactory run() throws InstantiationException, IllegalAccessException, IOException"
]
},
{
"added": [
" throws InstantiationException,",
" IllegalAccessException,",
" IOException,",
" NoSuchMethodException,",
" InvocationTargetException",
" StorageFactory storageFactory = (StorageFactory) storageFactoryClass.getConstructor().newInstance();"
],
"header": "@@ -203,9 +205,13 @@ final class StorageFactoryService implements PersistentService",
"removed": [
" throws InstantiationException, IllegalAccessException, IOException",
" StorageFactory storageFactory = (StorageFactory) storageFactoryClass.newInstance();"
]
},
{
"added": [
" InstantiationException, IllegalAccessException,",
" NoSuchMethodException, InvocationTargetException"
],
"header": "@@ -270,7 +276,8 @@ final class StorageFactoryService implements PersistentService",
"removed": [
" InstantiationException, IllegalAccessException"
]
},
{
"added": [
" throws IOException, StandardException,",
" InstantiationException, IllegalAccessException,",
" NoSuchMethodException, InvocationTargetException",
" "
],
"header": "@@ -683,7 +690,10 @@ final class StorageFactoryService implements PersistentService",
"removed": [
" throws IOException, StandardException, InstantiationException, IllegalAccessException"
]
},
{
"added": [
" throws IOException, StandardException,",
" InstantiationException, IllegalAccessException,",
" NoSuchMethodException, InvocationTargetException"
],
"header": "@@ -730,7 +740,9 @@ final class StorageFactoryService implements PersistentService",
"removed": [
" throws IOException, StandardException, InstantiationException, IllegalAccessException"
]
},
{
"added": [
" throws StandardException, IOException,",
" InstantiationException, IllegalAccessException,",
" NoSuchMethodException, InvocationTargetException"
],
"header": "@@ -787,7 +799,9 @@ final class StorageFactoryService implements PersistentService",
"removed": [
" throws StandardException, IOException, InstantiationException, IllegalAccessException"
]
},
{
"added": [
" throws StandardException, IOException,",
" InstantiationException, IllegalAccessException,",
" NoSuchMethodException, InvocationTargetException"
],
"header": "@@ -892,7 +906,9 @@ final class StorageFactoryService implements PersistentService",
"removed": [
" throws StandardException, IOException, InstantiationException, IllegalAccessException"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/TypeCompilerFactoryImpl.java",
"hunks": [
{
"added": [
" anInstance = (TypeCompiler)",
" typeCompilerClass.getConstructor().newInstance();"
],
"header": "@@ -247,7 +247,8 @@ public class TypeCompilerFactoryImpl implements TypeCompilerFactory",
"removed": [
" anInstance = (TypeCompiler) typeCompilerClass.newInstance();"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/execute/GenericAggregator.java",
"hunks": [
{
"added": [
"import java.lang.reflect.Constructor;",
""
],
"header": "@@ -21,6 +21,8 @@",
"removed": []
}
]
},
{
"file": "java/testing/org/apache/derbyTesting/functionTests/harness/jvm.java",
"hunks": [
{
"added": [
"import java.lang.reflect.InvocationTargetException;"
],
"header": "@@ -21,6 +21,7 @@",
"removed": []
}
]
},
{
"file": "java/testing/org/apache/derbyTesting/functionTests/testData/serializedDataSources/SerializeDataSources.java",
"hunks": [
{
"added": [
" Class<?> dsClass;"
],
"header": "@@ -114,7 +114,7 @@ public class SerializeDataSources {",
"removed": [
" Class dsClass;"
]
}
]
},
{
"file": "java/testing/org/apache/derbyTesting/functionTests/util/TestUtil.java",
"hunks": [
{
"added": [
" Class<?> clazz = Class.forName(driverName);",
" clazz.getConstructor().newInstance();"
],
"header": "@@ -293,7 +293,8 @@ public class TestUtil {",
"removed": [
" Class.forName(driverName).newInstance();"
]
},
{
"added": [
" Class<?> clazz = Class.forName(classname);",
" ds = clazz.getConstructor().newInstance();"
],
"header": "@@ -400,7 +401,8 @@ public class TestUtil {",
"removed": [
"\t\tds = Class.forName(classname).newInstance();"
]
},
{
"added": [
" Class<?> clazz = Class.forName(driverName);",
" clazz.getConstructor().newInstance();"
],
"header": "@@ -790,7 +792,8 @@ public class TestUtil {",
"removed": [
" Class.forName(driverName).newInstance();"
]
}
]
},
{
"file": "java/testing/org/apache/derbyTesting/junit/DriverManagerConnector.java",
"hunks": [
{
"added": [
" Class<?> clazz = Class.forName(driverClass);",
" clazz.getConstructor().newInstance();"
],
"header": "@@ -237,7 +237,8 @@ public class DriverManagerConnector implements Connector {",
"removed": [
" Class.forName(driverClass).newInstance();"
]
}
]
},
{
"file": "java/testing/org/apache/derbyTesting/junit/JDBCDataSource.java",
"hunks": [
{
"added": [
" Class<?> clazz = Class.forName(classname, true, contextLoader);",
" ds = (javax.sql.DataSource) clazz.getConstructor().newInstance();"
],
"header": "@@ -156,7 +156,8 @@ public class JDBCDataSource {",
"removed": [
" ds = (javax.sql.DataSource) Class.forName(classname, true, contextLoader).newInstance();"
]
}
]
},
{
"file": "java/testing/org/apache/derbyTesting/junit/TestConfiguration.java",
"hunks": [
{
"added": [
" Class<?> clazz = Class.forName(oldConnector.getClass().getName());",
" connector = (Connector) clazz.getConstructor().newInstance();"
],
"header": "@@ -1398,8 +1398,8 @@ public final class TestConfiguration {",
"removed": [
" connector = (Connector) Class.forName(",
" oldConnector.getClass().getName()).newInstance();"
]
}
]
},
{
"file": "java/testing/org/apache/derbyTesting/system/oe/client/Submitter.java",
"hunks": [
{
"added": [
"import java.math.RoundingMode;"
],
"header": "@@ -21,6 +21,7 @@ package org.apache.derbyTesting.system.oe.client;",
"removed": []
}
]
},
{
"file": "java/testing/org/apache/derbyTesting/unitTests/store/T_RawStoreFactory.java",
"hunks": [
{
"added": [
"\t\t\tClass<?> thisClass = this.getClass();",
"\t\t\treturn (T_MultiThreadedIterations)(thisClass.getConstructor().newInstance());"
],
"header": "@@ -208,8 +208,8 @@ public class T_RawStoreFactory extends T_MultiThreadedIterations {",
"removed": [
"\t\t\tClass thisClass = this.getClass();",
"\t\t\treturn (T_MultiThreadedIterations)(thisClass.newInstance());"
]
}
]
},
{
"file": "java/tools/org/apache/derby/impl/tools/ij/ConnectionEnv.java",
"hunks": [
{
"added": [
"import java.lang.reflect.InvocationTargetException;"
],
"header": "@@ -23,6 +23,7 @@ package org.apache.derby.impl.tools.ij;",
"removed": []
}
]
},
{
"file": "java/tools/org/apache/derby/impl/tools/ij/util.java",
"hunks": [
{
"added": [
" ds = (DataSource) dc.getConstructor().newInstance();"
],
"header": "@@ -351,7 +351,7 @@ public final class util implements java.security.PrivilegedAction<String> {",
"removed": [
" ds = (DataSource) dc.newInstance();"
]
},
{
"added": [
" throws SQLException, ClassNotFoundException, InstantiationException, IllegalAccessException,",
" NoSuchMethodException, InvocationTargetException"
],
"header": "@@ -395,7 +395,8 @@ public final class util implements java.security.PrivilegedAction<String> {",
"removed": [
"\tthrows SQLException, ClassNotFoundException, InstantiationException, IllegalAccessException"
]
},
{
"added": [
" static public Connection startJBMS() throws SQLException, ClassNotFoundException, InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException {"
],
"header": "@@ -500,7 +501,7 @@ public final class util implements java.security.PrivilegedAction<String> {",
"removed": [
" static public Connection startJBMS() throws SQLException, ClassNotFoundException, InstantiationException, IllegalAccessException {"
]
},
{
"added": [
" IllegalAccessException, NoSuchMethodException, InvocationTargetException {"
],
"header": "@@ -519,7 +520,7 @@ public final class util implements java.security.PrivilegedAction<String> {",
"removed": [
"\t\t\t\t IllegalAccessException {"
]
},
{
"added": [
"\tpublic static void loadDriverIfKnown(String jdbcProtocol) throws ClassNotFoundException, InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException {"
],
"header": "@@ -736,7 +737,7 @@ AppUI.out.println(\"SIZE=\"+l);",
"removed": [
"\tpublic static void loadDriverIfKnown(String jdbcProtocol) throws ClassNotFoundException, InstantiationException, IllegalAccessException {"
]
}
]
},
{
"file": "java/tools/org/apache/derby/impl/tools/ij/xaHelper.java",
"hunks": [
{
"added": [
" public xaHelper()"
],
"header": "@@ -58,7 +58,7 @@ class xaHelper implements xaAbstractHelper",
"removed": [
" xaHelper()"
]
},
{
"added": [
" Class<?> clazz = Class.forName(\"org.apache.derby.jdbc.EmbeddedDataSource\");",
"\t\t\tcurrentDataSource = (DataSource) (clazz.getConstructor().newInstance());"
],
"header": "@@ -426,7 +426,8 @@ class xaHelper implements xaAbstractHelper",
"removed": [
"\t\t\tcurrentDataSource = (DataSource) (Class.forName(\"org.apache.derby.jdbc.EmbeddedDataSource\").newInstance());"
]
},
{
"added": [
" Class<?> clazz = Class.forName(\"org.apache.derby.jdbc.EmbeddedConnectionPoolDataSource\");",
" currentCPDataSource = (ConnectionPoolDataSource) (clazz.getConstructor().newInstance());"
],
"header": "@@ -459,7 +460,8 @@ class xaHelper implements xaAbstractHelper",
"removed": [
"\t\t\tcurrentCPDataSource = (ConnectionPoolDataSource) (Class.forName(\"org.apache.derby.jdbc.EmbeddedConnectionPoolDataSource\").newInstance());"
]
},
{
"added": [
" Class<?> clazz;",
" {",
" clazz = Class.forName(\"com.ibm.db2.jcc.DB2XADataSource\");",
" return (XADataSource) clazz.getConstructor().newInstance();",
" }",
" clazz = Class.forName(\"org.apache.derby.jdbc.ClientXADataSource40\");",
" return (XADataSource) clazz.getConstructor().newInstance();"
],
"header": "@@ -516,18 +518,19 @@ class xaHelper implements xaAbstractHelper",
"removed": [
"\t\t ",
" return (XADataSource) ",
" (Class.forName(\"com.ibm.db2.jcc.DB2XADataSource\").newInstance());",
" return (XADataSource)(Class.forName(",
" \"org.apache.derby.jdbc.ClientXADataSource40\").",
" newInstance());"
]
},
{
"added": [
" ",
" clazz = Class.forName(\"org.apache.derby.jdbc.ClientXADataSource\");",
" ",
" return (XADataSource) clazz.getConstructor().newInstance();",
" clazz = Class.forName(\"org.apache.derby.jdbc.BasicClientXADataSource40\");",
" return (XADataSource) clazz.getConstructor().newInstance();",
" clazz = Class.forName(\"org.apache.derby.jdbc.EmbeddedXADataSource40\");",
" return (XADataSource) clazz.getConstructor().newInstance();"
],
"header": "@@ -536,22 +539,21 @@ class xaHelper implements xaAbstractHelper",
"removed": [
" return (XADataSource) (Class.forName(",
" \"org.apache.derby.jdbc.ClientXADataSource\"",
" ).newInstance());",
" return (XADataSource)(Class.forName(",
" \"org.apache.derby.jdbc.BasicClientXADataSource40\").",
" newInstance());",
" return (XADataSource)(Class.forName(",
" \"org.apache.derby.jdbc.EmbeddedXADataSource40\").",
" newInstance());"
]
}
]
},
{
"file": "java/tools/org/apache/derby/impl/tools/planexporter/AccessDatabase.java",
"hunks": [
{
"added": [
"import java.lang.reflect.InvocationTargetException;"
],
"header": "@@ -21,6 +21,7 @@",
"removed": []
},
{
"added": [
" ClassNotFoundException, SQLException, NoSuchMethodException, InvocationTargetException"
],
"header": "@@ -79,7 +80,7 @@ public class AccessDatabase {",
"removed": [
" ClassNotFoundException, SQLException"
]
}
]
},
{
"file": "java/tools/org/apache/derby/tools/ij.java",
"hunks": [
{
"added": [
" throws java.sql.SQLException, IllegalAccessException, ClassNotFoundException, InstantiationException,",
" NoSuchMethodException, java.lang.reflect.InvocationTargetException"
],
"header": "@@ -138,7 +138,8 @@ public class ij {",
"removed": [
"\t throws java.sql.SQLException, IllegalAccessException, ClassNotFoundException, InstantiationException"
]
}
]
}
] |
derby-DERBY-6856-4ba78a4b
|
DERBY-6856: Accidentally checked in the ShardingKey changes again; reverting.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1746068 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/client/org/apache/derby/jdbc/BasicClientXADataSource40.java",
"hunks": [
{
"added": [],
"header": "@@ -21,9 +21,7 @@",
"removed": [
"import java.sql.ShardingKeyBuilder;",
"import java.sql.SQLFeatureNotSupportedException;"
]
}
]
},
{
"file": "java/client/org/apache/derby/jdbc/ClientXADataSource.java",
"hunks": [
{
"added": [],
"header": "@@ -21,9 +21,6 @@",
"removed": [
"import java.sql.ShardingKeyBuilder;",
"import java.sql.SQLException;",
"import java.sql.SQLFeatureNotSupportedException;"
]
}
]
},
{
"file": "java/client/org/apache/derby/jdbc/ClientXADataSource40.java",
"hunks": [
{
"added": [],
"header": "@@ -21,9 +21,6 @@",
"removed": [
"import java.sql.ShardingKeyBuilder;",
"import java.sql.SQLException;",
"import java.sql.SQLFeatureNotSupportedException;"
]
}
]
},
{
"file": "java/client/org/apache/derby/jdbc/ClientXADataSourceInterface.java",
"hunks": [
{
"added": [],
"header": "@@ -21,9 +21,6 @@",
"removed": [
"import java.sql.ShardingKeyBuilder;",
"import java.sql.SQLException;",
"import java.sql.SQLFeatureNotSupportedException;"
]
}
]
},
{
"file": "java/engine/org/apache/derby/jdbc/EmbeddedXADataSourceInterface.java",
"hunks": [
{
"added": [
"public interface EmbeddedXADataSourceInterface extends EmbeddedDataSourceInterface, javax.sql.XADataSource {",
" ResourceAdapter getResourceAdapter();"
],
"header": "@@ -21,24 +21,12 @@",
"removed": [
"import java.sql.ShardingKeyBuilder;",
"import java.sql.SQLException;",
"import java.sql.SQLFeatureNotSupportedException;",
"",
"public interface EmbeddedXADataSourceInterface extends EmbeddedDataSourceInterface, javax.sql.XADataSource",
"{",
" public ResourceAdapter getResourceAdapter();",
"",
" /** Added by Java 9 */",
" public default ShardingKeyBuilder createShardingKeyBuilder()",
" throws SQLException",
" {",
" throw new java.sql.SQLFeatureNotSupportedException();",
" }"
]
}
]
}
] |
derby-DERBY-6856-80d39eee
|
DERBY-6856: Revert ShardingKey changes introduced by revision 1742858.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1742861 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/client/org/apache/derby/jdbc/BasicClientXADataSource40.java",
"hunks": [
{
"added": [],
"header": "@@ -21,9 +21,7 @@",
"removed": [
"import java.sql.ShardingKeyBuilder;",
"import java.sql.SQLFeatureNotSupportedException;"
]
}
]
},
{
"file": "java/client/org/apache/derby/jdbc/ClientXADataSource.java",
"hunks": [
{
"added": [],
"header": "@@ -21,9 +21,6 @@",
"removed": [
"import java.sql.ShardingKeyBuilder;",
"import java.sql.SQLException;",
"import java.sql.SQLFeatureNotSupportedException;"
]
}
]
},
{
"file": "java/client/org/apache/derby/jdbc/ClientXADataSource40.java",
"hunks": [
{
"added": [],
"header": "@@ -21,9 +21,6 @@",
"removed": [
"import java.sql.ShardingKeyBuilder;",
"import java.sql.SQLException;",
"import java.sql.SQLFeatureNotSupportedException;"
]
}
]
},
{
"file": "java/client/org/apache/derby/jdbc/ClientXADataSourceInterface.java",
"hunks": [
{
"added": [],
"header": "@@ -21,9 +21,6 @@",
"removed": [
"import java.sql.ShardingKeyBuilder;",
"import java.sql.SQLException;",
"import java.sql.SQLFeatureNotSupportedException;"
]
}
]
},
{
"file": "java/engine/org/apache/derby/jdbc/EmbeddedXADataSourceInterface.java",
"hunks": [
{
"added": [
"public interface EmbeddedXADataSourceInterface extends EmbeddedDataSourceInterface, javax.sql.XADataSource {",
" ResourceAdapter getResourceAdapter();"
],
"header": "@@ -21,24 +21,12 @@",
"removed": [
"import java.sql.ShardingKeyBuilder;",
"import java.sql.SQLException;",
"import java.sql.SQLFeatureNotSupportedException;",
"",
"public interface EmbeddedXADataSourceInterface extends EmbeddedDataSourceInterface, javax.sql.XADataSource",
"{",
" public ResourceAdapter getResourceAdapter();",
"",
" /** Added by Java 9 */",
" public default ShardingKeyBuilder createShardingKeyBuilder()",
" throws SQLException",
" {",
" throw new java.sql.SQLFeatureNotSupportedException();",
" }"
]
}
]
}
] |
derby-DERBY-6856-a12152ae
|
DERBY-6856: Remove deprecation warnings related to Observer/Observable by adding Derby implementations of the observable behavior.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1746066 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/client/org/apache/derby/jdbc/BasicClientXADataSource40.java",
"hunks": [
{
"added": [
"import java.sql.ShardingKeyBuilder;",
"import java.sql.SQLFeatureNotSupportedException;"
],
"header": "@@ -21,7 +21,9 @@",
"removed": []
}
]
},
{
"file": "java/client/org/apache/derby/jdbc/ClientXADataSource.java",
"hunks": [
{
"added": [
"import java.sql.ShardingKeyBuilder;",
"import java.sql.SQLException;",
"import java.sql.SQLFeatureNotSupportedException;"
],
"header": "@@ -21,6 +21,9 @@",
"removed": []
}
]
},
{
"file": "java/client/org/apache/derby/jdbc/ClientXADataSource40.java",
"hunks": [
{
"added": [
"import java.sql.ShardingKeyBuilder;",
"import java.sql.SQLException;",
"import java.sql.SQLFeatureNotSupportedException;"
],
"header": "@@ -21,6 +21,9 @@",
"removed": []
}
]
},
{
"file": "java/client/org/apache/derby/jdbc/ClientXADataSourceInterface.java",
"hunks": [
{
"added": [
"import java.sql.ShardingKeyBuilder;",
"import java.sql.SQLException;",
"import java.sql.SQLFeatureNotSupportedException;"
],
"header": "@@ -21,6 +21,9 @@",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/iapi/store/raw/xact/RawTransaction.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.services.monitor.DerbyObservable;"
],
"header": "@@ -24,6 +24,7 @@ package org.apache.derby.iapi.store.raw.xact;",
"removed": []
},
{
"added": [],
"header": "@@ -39,8 +40,6 @@ import org.apache.derby.iapi.error.StandardException;",
"removed": [
"import java.util.Observable;",
""
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/store/raw/data/BaseContainerHandle.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.services.monitor.DerbyObservable;",
"import org.apache.derby.iapi.services.monitor.DerbyObserver;"
],
"header": "@@ -25,6 +25,8 @@ import org.apache.derby.iapi.reference.SQLState;",
"removed": []
},
{
"added": [
"\tThis class is a DerbyObserver to observe RawTransactions",
"\tand is also a DerbyObservable to"
],
"header": "@@ -45,15 +47,13 @@ import org.apache.derby.iapi.util.ByteArray;",
"removed": [
"import java.util.Observable;",
"import java.util.Observer;",
"\tThis class is an Observer to observe RawTransactions",
"\tand is also a Observable to"
]
},
{
"added": [
"public class BaseContainerHandle extends DerbyObservable ",
" implements RawContainerHandle, DerbyObserver "
],
"header": "@@ -62,8 +62,8 @@ import java.util.Properties;",
"removed": [
"public class BaseContainerHandle extends Observable ",
" implements RawContainerHandle, Observer "
]
},
{
"added": [
"\t**\tMethods of DerbyObserver"
],
"header": "@@ -687,7 +687,7 @@ public class BaseContainerHandle extends Observable",
"removed": [
"\t**\tMethods of Observer"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/store/raw/data/BasePage.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.services.monitor.DerbyObservable;",
"import org.apache.derby.iapi.services.monitor.DerbyObserver;"
],
"header": "@@ -30,6 +30,8 @@ import org.apache.derby.shared.common.sanity.SanityManager;",
"removed": []
},
{
"added": [],
"header": "@@ -51,8 +53,6 @@ import java.io.IOException;",
"removed": [
"import java.util.Observer;",
"import java.util.Observable;"
]
},
{
"added": [
"abstract class BasePage implements Page, DerbyObserver, TypedFormat"
],
"header": "@@ -76,7 +76,7 @@ import java.util.Observable;",
"removed": [
"abstract class BasePage implements Page, Observer, TypedFormat"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/store/raw/data/DropOnCommit.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.services.monitor.DerbyObservable;"
],
"header": "@@ -21,6 +21,7 @@",
"removed": []
},
{
"added": [],
"header": "@@ -41,8 +42,6 @@ import org.apache.derby.iapi.error.StandardException;",
"removed": [
"import java.util.Observable;",
""
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/store/raw/data/StreamFileContainerHandle.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.services.monitor.DerbyObservable;",
"import org.apache.derby.iapi.services.monitor.DerbyObserver;"
],
"header": "@@ -22,6 +22,8 @@",
"removed": []
},
{
"added": [],
"header": "@@ -34,8 +36,6 @@ import org.apache.derby.impl.store.raw.data.DropOnCommit;",
"removed": [
"import java.util.Observable;",
"import java.util.Observer;"
]
},
{
"added": [
" implements StreamContainerHandle, DerbyObserver "
],
"header": "@@ -47,7 +47,7 @@ import java.util.Properties;",
"removed": [
" implements StreamContainerHandle, Observer "
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/store/raw/data/SyncOnCommit.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.services.monitor.DerbyObservable;",
""
],
"header": "@@ -21,6 +21,8 @@",
"removed": []
},
{
"added": [],
"header": "@@ -40,8 +42,6 @@ import org.apache.derby.iapi.error.StandardException;",
"removed": [
"import java.util.Observable;",
""
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/store/raw/data/TruncateOnCommit.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.services.monitor.DerbyObservable;",
""
],
"header": "@@ -21,6 +21,8 @@",
"removed": []
},
{
"added": [],
"header": "@@ -40,8 +42,6 @@ import org.apache.derby.iapi.error.StandardException;",
"removed": [
"import java.util.Observable;",
""
]
}
]
},
{
"file": "java/engine/org/apache/derby/jdbc/EmbeddedXADataSourceInterface.java",
"hunks": [
{
"added": [
"import java.sql.ShardingKeyBuilder;",
"import java.sql.SQLException;",
"import java.sql.SQLFeatureNotSupportedException;",
"",
"public interface EmbeddedXADataSourceInterface extends EmbeddedDataSourceInterface, javax.sql.XADataSource",
"{",
" public ResourceAdapter getResourceAdapter();",
"",
" /** Added by Java 9 */",
" public default ShardingKeyBuilder createShardingKeyBuilder()",
" throws SQLException",
" {",
" throw new java.sql.SQLFeatureNotSupportedException();",
" }"
],
"header": "@@ -21,12 +21,24 @@",
"removed": [
"public interface EmbeddedXADataSourceInterface extends EmbeddedDataSourceInterface, javax.sql.XADataSource {",
" ResourceAdapter getResourceAdapter();"
]
}
]
}
] |
derby-DERBY-6856-ce40a31d
|
DERBY-6856: Fix more deprecation warnings when Derby is compiled with JDK 9 build 116; commit derby-6856-04-ab-autoboxingDeprecationWarnings-part2.diff.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1742858 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/client/org/apache/derby/jdbc/BasicClientXADataSource40.java",
"hunks": [
{
"added": [
"import java.sql.ShardingKeyBuilder;",
"import java.sql.SQLFeatureNotSupportedException;"
],
"header": "@@ -21,7 +21,9 @@",
"removed": []
}
]
},
{
"file": "java/client/org/apache/derby/jdbc/ClientXADataSource.java",
"hunks": [
{
"added": [
"import java.sql.ShardingKeyBuilder;",
"import java.sql.SQLException;",
"import java.sql.SQLFeatureNotSupportedException;"
],
"header": "@@ -21,6 +21,9 @@",
"removed": []
}
]
},
{
"file": "java/client/org/apache/derby/jdbc/ClientXADataSource40.java",
"hunks": [
{
"added": [
"import java.sql.ShardingKeyBuilder;",
"import java.sql.SQLException;",
"import java.sql.SQLFeatureNotSupportedException;"
],
"header": "@@ -21,6 +21,9 @@",
"removed": []
}
]
},
{
"file": "java/client/org/apache/derby/jdbc/ClientXADataSourceInterface.java",
"hunks": [
{
"added": [
"import java.sql.ShardingKeyBuilder;",
"import java.sql.SQLException;",
"import java.sql.SQLFeatureNotSupportedException;"
],
"header": "@@ -21,6 +21,9 @@",
"removed": []
}
]
},
{
"file": "java/drda/org/apache/derby/drda/NetServlet.java",
"hunks": [
{
"added": [
" maxThreads= Integer.parseInt(val);",
" timeSlice= Integer.parseInt(val);"
],
"header": "@@ -428,9 +428,9 @@ public class NetServlet extends HttpServlet {",
"removed": [
" maxThreads= (new Integer(val)).intValue();",
" timeSlice= (new Integer(val)).intValue();"
]
},
{
"added": [
" out.println( \"<h4>\"+langUtil.getTextMessage(\"SRV_MaxThreads\", Integer.toString(maxThreads) +\"</h4>\"));",
" out.println( \"<h4>\"+langUtil.getTextMessage(\"SRV_TimeSlice\", Integer.toString(timeSlice) +\"</h4>\"));"
],
"header": "@@ -458,8 +458,8 @@ public class NetServlet extends HttpServlet {",
"removed": [
" out.println( \"<h4>\"+langUtil.getTextMessage(\"SRV_MaxThreads\", new Integer(maxThreads).toString()) +\"</h4>\");",
" out.println( \"<h4>\"+langUtil.getTextMessage(\"SRV_TimeSlice\", new Integer(timeSlice).toString()) +\"</h4>\");"
]
},
{
"added": [
" Integer.toString(MAX_CONNECT_TRYS)));"
],
"header": "@@ -587,7 +587,7 @@ public class NetServlet extends HttpServlet {",
"removed": [
" new Integer(MAX_CONNECT_TRYS).toString()));"
]
}
]
},
{
"file": "java/engine/org/apache/derby/iapi/types/HarmonySerialBlob.java",
"hunks": [
{
"added": [
" throw makeSQLException( SQLState.BLOB_BAD_POSITION, new Object[] {pos} );",
" throw makeSQLException( SQLState.BLOB_NONPOSITIVE_LENGTH, new Object[] {length} );"
],
"header": "@@ -110,11 +110,11 @@ public class HarmonySerialBlob implements Blob, Serializable, Cloneable {",
"removed": [
" throw makeSQLException( SQLState.BLOB_BAD_POSITION, new Object[] {new Long(pos)} );",
" throw makeSQLException( SQLState.BLOB_NONPOSITIVE_LENGTH, new Object[] {new Integer(length)} );"
]
},
{
"added": [
" throw makeSQLException( SQLState.BLOB_BAD_POSITION, new Object[] {pos} );",
" throw makeSQLException( SQLState.BLOB_INVALID_OFFSET, new Object[] {offset} );"
],
"header": "@@ -215,11 +215,11 @@ public class HarmonySerialBlob implements Blob, Serializable, Cloneable {",
"removed": [
" throw makeSQLException( SQLState.BLOB_BAD_POSITION, new Object[] {new Long(pos)} );",
" throw makeSQLException( SQLState.BLOB_INVALID_OFFSET, new Object[] {new Integer(offset)} );"
]
},
{
"added": [
" throw makeSQLException( SQLState.BLOB_LENGTH_TOO_LONG, new Object[] {len} );"
],
"header": "@@ -228,7 +228,7 @@ public class HarmonySerialBlob implements Blob, Serializable, Cloneable {",
"removed": [
" throw makeSQLException( SQLState.BLOB_LENGTH_TOO_LONG, new Object[] {new Long(len)} );"
]
}
]
},
{
"file": "java/engine/org/apache/derby/iapi/types/HarmonySerialClob.java",
"hunks": [
{
"added": [
" throw HarmonySerialBlob.makeSQLException( SQLState.BLOB_NONPOSITIVE_LENGTH, new Object[] {length} );",
" throw HarmonySerialBlob.makeSQLException( SQLState.BLOB_BAD_POSITION, new Object[] {pos} );"
],
"header": "@@ -104,11 +104,11 @@ public class HarmonySerialClob implements Clob, Serializable, Cloneable {",
"removed": [
" throw HarmonySerialBlob.makeSQLException( SQLState.BLOB_NONPOSITIVE_LENGTH, new Object[] {new Integer(length)} );",
" throw HarmonySerialBlob.makeSQLException( SQLState.BLOB_BAD_POSITION, new Object[] {new Long(pos)} );"
]
},
{
"added": [
" throw HarmonySerialBlob.makeSQLException( SQLState.BLOB_BAD_POSITION, new Object[] {pos} );"
],
"header": "@@ -179,7 +179,7 @@ public class HarmonySerialClob implements Clob, Serializable, Cloneable {",
"removed": [
" throw HarmonySerialBlob.makeSQLException( SQLState.BLOB_BAD_POSITION, new Object[] {new Long(pos)} );"
]
}
]
},
{
"file": "java/engine/org/apache/derby/iapi/types/SQLChar.java",
"hunks": [
{
"added": [
" return Float.parseFloat(getString().trim());"
],
"header": "@@ -466,7 +466,7 @@ public class SQLChar",
"removed": [
" return new Float(getString().trim()).floatValue();"
]
},
{
"added": [
" return Double.parseDouble(getString().trim());"
],
"header": "@@ -492,7 +492,7 @@ public class SQLChar",
"removed": [
" return new Double(getString().trim()).doubleValue();"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/jdbc/EmbedBlob.java",
"hunks": [
{
"added": [
" SQLState.BLOB_POSITION_TOO_LARGE, logicalPos);"
],
"header": "@@ -318,7 +318,7 @@ final class EmbedBlob extends ConnectionChild implements Blob, EngineLOB",
"removed": [
" SQLState.BLOB_POSITION_TOO_LARGE, new Long(logicalPos));"
]
},
{
"added": [
" logicalPos);"
],
"header": "@@ -328,7 +328,7 @@ final class EmbedBlob extends ConnectionChild implements Blob, EngineLOB",
"removed": [
" new Long(logicalPos));"
]
},
{
"added": [
" SQLState.BLOB_BAD_POSITION, startPos);",
" SQLState.BLOB_NONPOSITIVE_LENGTH, length);"
],
"header": "@@ -463,10 +463,10 @@ final class EmbedBlob extends ConnectionChild implements Blob, EngineLOB",
"removed": [
" SQLState.BLOB_BAD_POSITION, new Long(startPos));",
" SQLState.BLOB_NONPOSITIVE_LENGTH, new Integer(length));"
]
},
{
"added": [
" SQLState.BLOB_POSITION_TOO_LARGE, startPos);"
],
"header": "@@ -526,7 +526,7 @@ final class EmbedBlob extends ConnectionChild implements Blob, EngineLOB",
"removed": [
" SQLState.BLOB_POSITION_TOO_LARGE, new Long(startPos));"
]
},
{
"added": [
" SQLState.BLOB_BAD_POSITION, start);"
],
"header": "@@ -627,7 +627,7 @@ final class EmbedBlob extends ConnectionChild implements Blob, EngineLOB",
"removed": [
" SQLState.BLOB_BAD_POSITION, new Long(start));"
]
},
{
"added": [
" SQLState.BLOB_BAD_POSITION, start);"
],
"header": "@@ -729,7 +729,7 @@ final class EmbedBlob extends ConnectionChild implements Blob, EngineLOB",
"removed": [
" SQLState.BLOB_BAD_POSITION, new Long(start));"
]
},
{
"added": [
" pos);",
" pos);",
" offset);",
" len);",
" len);"
],
"header": "@@ -918,25 +918,25 @@ final class EmbedBlob extends ConnectionChild implements Blob, EngineLOB",
"removed": [
" new Long(pos));",
" new Long(pos));",
" new Long(offset));",
" new Long(len));",
" new Long(len));"
]
},
{
"added": [
" SQLState.BLOB_POSITION_TOO_LARGE, pos);",
" SQLState.BLOB_BAD_POSITION, pos);"
],
"header": "@@ -973,10 +973,10 @@ final class EmbedBlob extends ConnectionChild implements Blob, EngineLOB",
"removed": [
" SQLState.BLOB_POSITION_TOO_LARGE, new Long(pos));",
" SQLState.BLOB_BAD_POSITION, new Long(pos));"
]
},
{
"added": [
" SQLState.BLOB_LENGTH_TOO_LONG, len);"
],
"header": "@@ -1015,7 +1015,7 @@ final class EmbedBlob extends ConnectionChild implements Blob, EngineLOB",
"removed": [
" SQLState.BLOB_LENGTH_TOO_LONG, new Long(len));"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/jdbc/EmbedClob.java",
"hunks": [
{
"added": [
" SQLState.BLOB_BAD_POSITION, pos);",
" SQLState.BLOB_NONPOSITIVE_LENGTH, length);"
],
"header": "@@ -202,10 +202,10 @@ final class EmbedClob extends ConnectionChild implements Clob, EngineLOB",
"removed": [
" SQLState.BLOB_BAD_POSITION, new Long(pos));",
" SQLState.BLOB_NONPOSITIVE_LENGTH, new Integer(length));"
]
},
{
"added": [
" SQLState.BLOB_BAD_POSITION, start);"
],
"header": "@@ -317,7 +317,7 @@ final class EmbedClob extends ConnectionChild implements Clob, EngineLOB",
"removed": [
" SQLState.BLOB_BAD_POSITION, new Long(start));"
]
},
{
"added": [
" SQLState.BLOB_BAD_POSITION, start);"
],
"header": "@@ -433,7 +433,7 @@ final class EmbedClob extends ConnectionChild implements Clob, EngineLOB",
"removed": [
" SQLState.BLOB_BAD_POSITION, new Long(start));"
]
},
{
"added": [
" SQLState.BLOB_BAD_POSITION, pos);"
],
"header": "@@ -558,7 +558,7 @@ restartScan:",
"removed": [
" SQLState.BLOB_BAD_POSITION, new Long(pos));"
]
},
{
"added": [
" offset, len, str);"
],
"header": "@@ -587,7 +587,7 @@ restartScan:",
"removed": [
" new Integer(offset), new Integer(len), str);"
]
},
{
"added": [
" pos);"
],
"header": "@@ -602,7 +602,7 @@ restartScan:",
"removed": [
" new Long(pos));"
]
},
{
"added": [
" SQLState.BLOB_NONPOSITIVE_LENGTH, len);"
],
"header": "@@ -665,7 +665,7 @@ restartScan:",
"removed": [
" SQLState.BLOB_NONPOSITIVE_LENGTH, new Long(len));"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java",
"hunks": [
{
"added": [
"\t\t\tthrow newSQLException(SQLState.UNIMPLEMENTED_ISOLATION_LEVEL, level);"
],
"header": "@@ -2243,7 +2243,7 @@ public class EmbedConnection implements EngineConnection",
"removed": [
"\t\t\tthrow newSQLException(SQLState.UNIMPLEMENTED_ISOLATION_LEVEL, new Integer(level));"
]
},
{
"added": [
"\t\tgetlobHMObj().put(loc, LOBReference);"
],
"header": "@@ -3299,7 +3299,7 @@ public class EmbedConnection implements EngineConnection",
"removed": [
"\t\tgetlobHMObj().put(new Integer(loc), LOBReference);"
]
},
{
"added": [
"\t\tgetlobHMObj().remove(key);"
],
"header": "@@ -3309,7 +3309,7 @@ public class EmbedConnection implements EngineConnection",
"removed": [
"\t\tgetlobHMObj().remove(new Integer(key));"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java",
"hunks": [
{
"added": [
"\t\t\tthrow newSQLException(SQLState.COLUMN_NOT_FOUND, columnIndex);"
],
"header": "@@ -355,8 +355,7 @@ public class EmbedResultSet extends ConnectionChild",
"removed": [
"\t\t\tthrow newSQLException(SQLState.COLUMN_NOT_FOUND, ",
" new Integer(columnIndex));"
]
},
{
"added": [
"\t\t\tthrow Util.generateCsSQLException(SQLState.INVALID_FETCH_SIZE, rows);"
],
"header": "@@ -2300,8 +2299,7 @@ public class EmbedResultSet extends ConnectionChild",
"removed": [
"\t\t\tthrow Util.generateCsSQLException(SQLState.INVALID_FETCH_SIZE,",
"\t\t\t\t\tnew Integer(rows));"
]
},
{
"added": [
"\t\t\t\t\tcolumnIndex, String.valueOf(rd.getColumnCount()));"
],
"header": "@@ -2459,7 +2457,7 @@ public class EmbedResultSet extends ConnectionChild",
"removed": [
"\t\t\t\t\tnew Integer(columnIndex), String.valueOf(rd.getColumnCount()));"
]
},
{
"added": [
"\t\t\t\tthrow newSQLException(SQLState.BAD_SCALE_VALUE, scale);"
],
"header": "@@ -3300,7 +3298,7 @@ public class EmbedResultSet extends ConnectionChild",
"removed": [
"\t\t\t\tthrow newSQLException(SQLState.BAD_SCALE_VALUE, new Integer(scale));"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/jdbc/EmbedStatement.java",
"hunks": [
{
"added": [
"\t\t\tthrow newSQLException(SQLState.INVALID_MAXFIELD_SIZE, max);"
],
"header": "@@ -434,7 +434,7 @@ public class EmbedStatement extends ConnectionChild",
"removed": [
"\t\t\tthrow newSQLException(SQLState.INVALID_MAXFIELD_SIZE, new Integer(max));"
]
},
{
"added": [
"\t\t\tthrow newSQLException(SQLState.INVALID_MAX_ROWS_VALUE, max);"
],
"header": "@@ -495,7 +495,7 @@ public class EmbedStatement extends ConnectionChild",
"removed": [
"\t\t\tthrow newSQLException(SQLState.INVALID_MAX_ROWS_VALUE, new Long(max));"
]
},
{
"added": [
" throw newSQLException(SQLState.INVALID_QUERYTIMEOUT_VALUE, seconds);"
],
"header": "@@ -537,8 +537,7 @@ public class EmbedStatement extends ConnectionChild",
"removed": [
" throw newSQLException(SQLState.INVALID_QUERYTIMEOUT_VALUE,",
" new Integer(seconds));"
]
},
{
"added": [
" throw newSQLException(SQLState.INVALID_FETCH_DIRECTION, direction);"
],
"header": "@@ -904,8 +903,7 @@ public class EmbedStatement extends ConnectionChild",
"removed": [
" throw newSQLException(SQLState.INVALID_FETCH_DIRECTION, ",
" new Integer(direction));"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/jdbc/LOBStreamControl.java",
"hunks": [
{
"added": [
" SQLState.BLOB_POSITION_TOO_LARGE, pos);",
" SQLState.BLOB_POSITION_TOO_LARGE, pos);"
],
"header": "@@ -135,14 +135,14 @@ final class LOBStreamControl {",
"removed": [
" SQLState.BLOB_POSITION_TOO_LARGE, new Long(pos));",
" SQLState.BLOB_POSITION_TOO_LARGE, new Long(pos));"
]
},
{
"added": [
" SQLState.BLOB_NONPOSITIVE_LENGTH, (pos + 1));",
" SQLState.BLOB_POSITION_TOO_LARGE, (pos + 1));",
" SQLState.BLOB_POSITION_TOO_LARGE, (pos + 1));",
" SQLState.BLOB_POSITION_TOO_LARGE, (pos + 1));",
" SQLState.BLOB_POSITION_TOO_LARGE, (pos + 1));",
" SQLState.BLOB_INVALID_OFFSET, off);"
],
"header": "@@ -163,30 +163,30 @@ final class LOBStreamControl {",
"removed": [
" SQLState.BLOB_NONPOSITIVE_LENGTH, new Long(pos + 1));",
" SQLState.BLOB_POSITION_TOO_LARGE, new Long(pos + 1));",
" SQLState.BLOB_POSITION_TOO_LARGE, new Long(pos + 1));",
" SQLState.BLOB_POSITION_TOO_LARGE, new Long(pos + 1));",
" SQLState.BLOB_POSITION_TOO_LARGE, new Long(pos + 1));",
" SQLState.BLOB_INVALID_OFFSET, new Integer(off));"
]
},
{
"added": [
" length, sz));"
],
"header": "@@ -388,7 +388,7 @@ final class LOBStreamControl {",
"removed": [
" new Long(length), new Long(sz)));"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/jdbc/authentication/AuthenticationServiceBase.java",
"hunks": [
{
"added": [
" return passwordLifetime;"
],
"header": "@@ -460,7 +460,7 @@ public abstract class AuthenticationServiceBase",
"removed": [
" return new Long( passwordLifetime );"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/load/ColumnInfo.java",
"hunks": [
{
"added": [
"\t\t\t\tint cIndex = Integer.parseInt(columnIndex );"
],
"header": "@@ -135,7 +135,7 @@ class ColumnInfo {",
"removed": [
"\t\t\t\tint cIndex = (new Integer(columnIndex )).intValue();"
]
},
{
"added": [
" jdbcColumnTypes.add((int) dataType);"
],
"header": "@@ -194,7 +194,7 @@ class ColumnInfo {",
"removed": [
" jdbcColumnTypes.add(new Integer(dataType));"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/load/Import.java",
"hunks": [
{
"added": [
" _importers.put( importCounter, this );"
],
"header": "@@ -80,7 +80,7 @@ public class Import extends ImportAbstract{",
"removed": [
" _importers.put( new Integer( importCounter ), this );"
]
},
{
"added": [
" Integer importCounter = bumpImportCounter();"
],
"header": "@@ -217,7 +217,7 @@ public class Import extends ImportAbstract{",
"removed": [
" Integer importCounter = new Integer( bumpImportCounter() );"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/load/LoadError.java",
"hunks": [
{
"added": [
"\t\t\t\t\t\t\t\t\t\t\t lineNumber, columnNumber));\t\t\t\t \t"
],
"header": "@@ -53,7 +53,7 @@ class LoadError {",
"removed": [
"\t\t\t\t\t\t\t\t\t\t\t new Integer(lineNumber),new Integer(columnNumber)));\t\t\t\t \t"
]
},
{
"added": [
"\t\t\t\tStandardException.newException(SQLState.INVALID_COLUMN_NUMBER, numberOfColumns ));"
],
"header": "@@ -127,9 +127,7 @@ class LoadError {",
"removed": [
"\t\t\t\tStandardException.newException(SQLState.INVALID_COLUMN_NUMBER,",
"\t\t\t\t\t\t\t\t\t\t\t new Integer(numberOfColumns)",
"\t\t\t\t\t\t\t\t\t\t\t ));"
]
},
{
"added": [
"\t\t\t\t\t\t\t\t\t\t\t lineNumber));"
],
"header": "@@ -152,7 +150,7 @@ class LoadError {",
"removed": [
"\t\t\t\t\t\t\t\t\t\t\t new Integer(lineNumber)));"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/services/jce/JCECipherFactory.java",
"hunks": [
{
"added": [
"\t\t\tthrow StandardException.newException(SQLState.ILLEGAL_BP_LENGTH, MIN_BOOTPASS_LENGTH);"
],
"header": "@@ -299,7 +299,7 @@ final class JCECipherFactory implements CipherFactory",
"removed": [
"\t\t\tthrow StandardException.newException(SQLState.ILLEGAL_BP_LENGTH, new Integer(MIN_BOOTPASS_LENGTH));"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/services/locks/Timeout.java",
"hunks": [
{
"added": [
" conglomId = tc.findConglomid( value.longValue() );"
],
"header": "@@ -293,7 +293,7 @@ public final class Timeout",
"removed": [
" conglomId = new Long( tc.findConglomid( value.longValue() ) );"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/services/stream/RollingFileStream.java",
"hunks": [
{
"added": [
" return file.exists();"
],
"header": "@@ -461,7 +461,7 @@ public class RollingFileStream extends OutputStream {",
"removed": [
" return new Boolean(file.exists());"
]
},
{
"added": [
" return file1.renameTo(file2);"
],
"header": "@@ -495,7 +495,7 @@ public class RollingFileStream extends OutputStream {",
"removed": [
" return new Boolean(file1.renameTo(file2));"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java",
"hunks": [
{
"added": [
"\t\t\tLong hashKey = cd.getConglomerateNumber();"
],
"header": "@@ -6885,7 +6885,7 @@ public final class\tDataDictionaryImpl",
"removed": [
"\t\t\tLong hashKey = new Long(cd.getConglomerateNumber());"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/catalog/SequenceGenerator.java",
"hunks": [
{
"added": [
" if ( restart ) { startValue = _RESTART_VALUE; }",
" else { startValue = _currentValue; }"
],
"header": "@@ -238,9 +238,9 @@ public class SequenceGenerator",
"removed": [
" if ( restart ) { startValue = new Long( _RESTART_VALUE ); }",
" else { startValue = new Long( _currentValue ); }"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/CastNode.java",
"hunks": [
{
"added": [
" return getCastFromIntegralType((long) Double.parseDouble(cleanCharValue),"
],
"header": "@@ -532,7 +532,7 @@ class CastNode extends ValueNode",
"removed": [
"\t\t\t\t\treturn getCastFromIntegralType((new Double(cleanCharValue)).longValue(),"
]
},
{
"added": [
"\t\t\t\t\tdoubleValue = Double.parseDouble(cleanCharValue);"
],
"header": "@@ -558,7 +558,7 @@ class CastNode extends ValueNode",
"removed": [
"\t\t\t\t\tdoubleValue = new Double(cleanCharValue);"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/execute/DMLWriteGeneratedColumnsResultSet.java",
"hunks": [
{
"added": [
" aiCache[i].getLong());"
],
"header": "@@ -127,7 +127,7 @@ abstract public class DMLWriteGeneratedColumnsResultSet extends DMLWriteResultSe",
"removed": [
" new Long(aiCache[i].getLong()));"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/execute/InsertResultSet.java",
"hunks": [
{
"added": [
"\t\t\t\tLong fkConglom = indexConversionTable.get(fkInfo.fkConglomNumbers[0]);"
],
"header": "@@ -1422,8 +1422,7 @@ class InsertResultSet extends DMLWriteGeneratedColumnsResultSet implements Targe",
"removed": [
"\t\t\t\tLong fkConglom = indexConversionTable.get(",
"\t\t\t\t\t\t\t\t\t\tnew Long(fkInfo.fkConglomNumbers[0]));"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/execute/rts/RealBasicNoPutResultSetStatistics.java",
"hunks": [
{
"added": [
" optimizerEstimatedRowCount) + \"\\n\" +",
" optimizerEstimatedCost);"
],
"header": "@@ -131,10 +131,10 @@ abstract class RealBasicNoPutResultSetStatistics",
"removed": [
" new Double(optimizerEstimatedRowCount)) + \"\\n\" +",
" new Double(optimizerEstimatedCost));"
]
},
{
"added": [
" this.numOpens,",
" this.optimizerEstimatedRowCount,",
" this.optimizerEstimatedCost,",
" this.rowsSeen,",
" this.rowsFiltered,",
" this.rowsSeen - this.rowsFiltered,"
],
"header": "@@ -218,20 +218,20 @@ abstract class RealBasicNoPutResultSetStatistics",
"removed": [
" new Integer(this.numOpens),",
" new Double(this.optimizerEstimatedRowCount),",
" new Double(this.optimizerEstimatedCost),",
" new Integer(this.rowsSeen),",
" new Integer(this.rowsFiltered),",
" new Integer(this.rowsSeen - this.rowsFiltered),"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/execute/rts/RealHashScanStatistics.java",
"hunks": [
{
"added": [
" this.hashtableSize"
],
"header": "@@ -351,7 +351,7 @@ public class RealHashScanStatistics",
"removed": [
" new Integer(this.hashtableSize)"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/execute/rts/RealJoinResultSetStatistics.java",
"hunks": [
{
"added": [
" this.numOpens,",
" this.optimizerEstimatedRowCount,",
" this.optimizerEstimatedCost,",
" this.rowsSeenLeft,",
" this.rowsSeenRight,",
" this.rowsFiltered,",
" this.rowsReturned,"
],
"header": "@@ -113,20 +113,20 @@ public abstract class RealJoinResultSetStatistics",
"removed": [
" new Integer(this.numOpens),",
" new Double(this.optimizerEstimatedRowCount),",
" new Double(this.optimizerEstimatedCost),",
" new Integer(this.rowsSeenLeft),",
" new Integer(this.rowsSeenRight),",
" new Integer(this.rowsFiltered),",
" new Integer(this.rowsReturned),"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/execute/rts/RealTableScanStatistics.java",
"hunks": [
{
"added": [
" this.fetchSize,"
],
"header": "@@ -347,7 +347,7 @@ public class RealTableScanStatistics",
"removed": [
" new Integer(this.fetchSize),"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/execute/xplain/XPLAINUtil.java",
"hunks": [
{
"added": [
" descriptor.setNo_visited_pages(Integer.parseInt(vp_property));",
" descriptor.setNo_visited_rows(Integer.parseInt(vr_property));",
" descriptor.setNo_qualified_rows(Integer.parseInt(qr_property));",
" descriptor.setNo_fetched_columns(Integer.parseInt(fc_property));",
" descriptor.setNo_visited_deleted_rows(Integer.parseInt(dvr_property));",
" descriptor.setBtree_height(Integer.parseInt(bth_property));"
],
"header": "@@ -302,42 +302,42 @@ public class XPLAINUtil {",
"removed": [
" descriptor.setNo_visited_pages(new Integer(vp_property));",
" descriptor.setNo_visited_rows(new Integer(vr_property));",
" descriptor.setNo_qualified_rows(new Integer(qr_property));",
" descriptor.setNo_fetched_columns(new Integer(fc_property));",
" descriptor.setNo_visited_deleted_rows(new Integer(dvr_property));",
" descriptor.setBtree_height(new Integer(bth_property));"
]
},
{
"added": [
" descriptor.setNo_input_rows(Integer.parseInt(ir_property));",
" descriptor.setNo_output_rows(Integer.parseInt(or_property));"
],
"header": "@@ -384,13 +384,13 @@ public class XPLAINUtil {",
"removed": [
" descriptor.setNo_input_rows(new Integer(ir_property));",
" descriptor.setNo_output_rows(new Integer(or_property));"
]
},
{
"added": [
" descriptor.setNo_merge_runs(Integer.parseInt(nomr_property));"
],
"header": "@@ -398,7 +398,7 @@ public class XPLAINUtil {",
"removed": [
" descriptor.setNo_merge_runs(new Integer(nomr_property));"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/store/access/RAMAccessManager.java",
"hunks": [
{
"added": [
" conglom_id);"
],
"header": "@@ -392,7 +392,7 @@ public abstract class RAMAccessManager",
"removed": [
" new Long(conglom_id));"
]
},
{
"added": [
" Long conglomid_obj = conglomid;"
],
"header": "@@ -468,7 +468,7 @@ public abstract class RAMAccessManager",
"removed": [
" Long conglomid_obj = new Long(conglomid);"
]
},
{
"added": [
" conglom_cache.create(conglomid, conglom);"
],
"header": "@@ -513,7 +513,7 @@ public abstract class RAMAccessManager",
"removed": [
" conglom_cache.create(new Long(conglomid), conglom);"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/store/access/RAMTransaction.java",
"hunks": [
{
"added": [
" conglomId);"
],
"header": "@@ -383,7 +383,7 @@ public class RAMTransaction",
"removed": [
" new Long(conglomId));"
]
},
{
"added": [
"\t\t\t\tconglom = (Conglomerate) tempCongloms.get(conglomId);"
],
"header": "@@ -403,7 +403,7 @@ public class RAMTransaction",
"removed": [
"\t\t\t\tconglom = (Conglomerate) tempCongloms.get(new Long(conglomId));"
]
},
{
"added": [
" SQLState.AM_NO_SUCH_CONGLOMERATE_DROP, conglomId);"
],
"header": "@@ -589,7 +589,7 @@ public class RAMTransaction",
"removed": [
" SQLState.AM_NO_SUCH_CONGLOMERATE_DROP, new Long(conglomId));"
]
},
{
"added": [
"\t\t\ttempCongloms.put(conglomId, conglom);"
],
"header": "@@ -811,7 +811,7 @@ public class RAMTransaction",
"removed": [
"\t\t\ttempCongloms.put(new Long(conglomId), conglom);"
]
},
{
"added": [
"\t\t\t\ttempCongloms.remove(conglomId);"
],
"header": "@@ -994,7 +994,7 @@ public class RAMTransaction",
"removed": [
"\t\t\t\ttempCongloms.remove(new Long(conglomId));"
]
},
{
"added": [
" SQLState.AM_NO_SUCH_SORT, id);"
],
"header": "@@ -1822,7 +1822,7 @@ public class RAMTransaction",
"removed": [
" SQLState.AM_NO_SUCH_SORT, new Long(id));"
]
},
{
"added": [
" SQLState.AM_NO_SUCH_SORT, id);"
],
"header": "@@ -1891,7 +1891,7 @@ public class RAMTransaction",
"removed": [
" SQLState.AM_NO_SUCH_SORT, new Long(id));"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/store/access/btree/BTreeController.java",
"hunks": [
{
"added": [
" err_containerid);"
],
"header": "@@ -1360,7 +1360,7 @@ public class BTreeController extends OpenBTree implements ConglomerateController",
"removed": [
" new Long(err_containerid));"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/store/access/btree/BTreeScan.java",
"hunks": [
{
"added": [
" this.scan_state);"
],
"header": "@@ -872,7 +872,7 @@ public abstract class BTreeScan extends OpenBTree implements ScanManager",
"removed": [
" new Integer(this.scan_state));"
]
},
{
"added": [
" (pos.current_rh == null), ",
" (pos.current_positionKey == null));"
],
"header": "@@ -889,8 +889,8 @@ public abstract class BTreeScan extends OpenBTree implements ScanManager",
"removed": [
" new Boolean(pos.current_rh == null), ",
" new Boolean(pos.current_positionKey == null));"
]
},
{
"added": [
" err_containerid,",
" scan_position.current_rh.getPageNumber(),",
" scan_position.current_rh.getId());"
],
"header": "@@ -1120,9 +1120,9 @@ public abstract class BTreeScan extends OpenBTree implements ScanManager",
"removed": [
" new Long(err_containerid),",
" new Long(scan_position.current_rh.getPageNumber()),",
" new Long(scan_position.current_rh.getId()));"
]
},
{
"added": [
" err_containerid,",
" scan_position.current_rh.getPageNumber(),",
" scan_position.current_rh.getId());"
],
"header": "@@ -1162,9 +1162,9 @@ public abstract class BTreeScan extends OpenBTree implements ScanManager",
"removed": [
" new Long(err_containerid),",
" new Long(scan_position.current_rh.getPageNumber()),",
" new Long(scan_position.current_rh.getId()));"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/store/access/btree/OpenBTree.java",
"hunks": [
{
"added": [
" SQLState.BTREE_IS_CLOSED, err_containerid));"
],
"header": "@@ -270,7 +270,7 @@ public class OpenBTree",
"removed": [
" SQLState.BTREE_IS_CLOSED, new Long(err_containerid)));"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/store/access/conglomerate/GenericConglomerateController.java",
"hunks": [
{
"added": [
" invalidColumn, ",
" open_conglom.getFormatIds().length));"
],
"header": "@@ -248,8 +248,8 @@ public abstract class GenericConglomerateController",
"removed": [
" new Long(invalidColumn), ",
" new Long(open_conglom.getFormatIds().length)));"
]
},
{
"added": [
" invalidColumn, ",
" open_conglom.getFormatIds().length));"
],
"header": "@@ -353,8 +353,8 @@ public abstract class GenericConglomerateController",
"removed": [
" new Long(invalidColumn), ",
" new Long(open_conglom.getFormatIds().length)));"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/store/access/conglomerate/GenericScanController.java",
"hunks": [
{
"added": [
" scan_position.current_rh.getPageNumber(),",
" scan_position.current_rh.getId());"
],
"header": "@@ -247,8 +247,8 @@ public abstract class GenericScanController",
"removed": [
" new Long(scan_position.current_rh.getPageNumber()),",
" new Long(scan_position.current_rh.getId()));"
]
},
{
"added": [
" scan_position.current_rh.getPageNumber(),",
" scan_position.current_rh.getId());"
],
"header": "@@ -1509,8 +1509,8 @@ public abstract class GenericScanController",
"removed": [
" new Long(scan_position.current_rh.getPageNumber()),",
" new Long(scan_position.current_rh.getId()));"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/store/access/heap/Heap.java",
"hunks": [
{
"added": [
" column_id, ",
" this.format_ids.length));"
],
"header": "@@ -444,8 +444,8 @@ public class Heap",
"removed": [
" new Long(column_id), ",
" new Long(this.format_ids.length)));"
]
},
{
"added": [
" Long.toString(id.getContainerId()));"
],
"header": "@@ -718,7 +718,7 @@ public class Heap",
"removed": [
" new Long(id.getContainerId()).toString());"
]
},
{
"added": [
" Long.toString(container_key.getContainerId()));"
],
"header": "@@ -794,7 +794,7 @@ public class Heap",
"removed": [
" new Long(container_key.getContainerId()).toString());"
]
},
{
"added": [
" id.getContainerId());"
],
"header": "@@ -865,7 +865,7 @@ public class Heap",
"removed": [
" new Long(id.getContainerId()));"
]
},
{
"added": [
" id.getContainerId());"
],
"header": "@@ -914,7 +914,7 @@ public class Heap",
"removed": [
" new Long(id.getContainerId()));"
]
},
{
"added": [
" Long.toString(id.getContainerId()));"
],
"header": "@@ -949,7 +949,7 @@ public class Heap",
"removed": [
" new Long(id.getContainerId()).toString());"
]
},
{
"added": [
" id.getContainerId());"
],
"header": "@@ -1042,7 +1042,7 @@ public class Heap",
"removed": [
" new Long(id.getContainerId()));"
]
},
{
"added": [
" id.getContainerId());"
],
"header": "@@ -1097,7 +1097,7 @@ public class Heap",
"removed": [
" new Long(id.getContainerId()));"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/store/access/heap/HeapController.java",
"hunks": [
{
"added": [
" invalidColumn, ",
" heap.format_ids.length));"
],
"header": "@@ -236,8 +236,8 @@ public class HeapController",
"removed": [
" new Long(invalidColumn), ",
" new Long(heap.format_ids.length)));"
]
},
{
"added": [
" heap.getId().getContainerId());"
],
"header": "@@ -365,7 +365,7 @@ public class HeapController",
"removed": [
" new Long(heap.getId().getContainerId()));"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/store/access/sort/MergeInserter.java",
"hunks": [
{
"added": [
"\t\t\tmergeRuns.addElement(conglomid);",
" stat_mergeRunsSize.addElement(runSize);"
],
"header": "@@ -189,14 +189,14 @@ final class MergeInserter implements SortController",
"removed": [
"\t\t\tmergeRuns.addElement(new Long(conglomid));",
" stat_mergeRunsSize.addElement(new Integer(runSize));"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/store/access/sort/MergeSort.java",
"hunks": [
{
"added": [
"\t\t\tmergeRuns.addElement(containerId);"
],
"header": "@@ -237,7 +237,7 @@ class MergeSort implements Sort",
"removed": [
"\t\t\tmergeRuns.addElement(new Long(containerId));"
]
},
{
"added": [
"\t\t\tmergeRuns.addElement(containerId);"
],
"header": "@@ -296,7 +296,7 @@ class MergeSort implements Sort",
"removed": [
"\t\t\tmergeRuns.addElement(new Long(containerId));"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/store/raw/data/BaseContainer.java",
"hunks": [
{
"added": [
" getSegmentId(), ",
" getContainerId());"
],
"header": "@@ -209,8 +209,8 @@ abstract class BaseContainer implements Lockable {",
"removed": [
" new Long(getSegmentId()), ",
" new Long(getContainerId()));"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/store/raw/data/FileContainer.java",
"hunks": [
{
"added": [
"\t\t\tBoolean bool = isReusableRecordId();"
],
"header": "@@ -683,7 +683,7 @@ abstract class FileContainer",
"removed": [
"\t\t\tBoolean bool = new Boolean(isReusableRecordId());"
]
},
{
"added": [
" fid);"
],
"header": "@@ -795,7 +795,7 @@ abstract class FileContainer",
"removed": [
" new Long(fid));"
]
},
{
"added": [
" checksum.getValue(), ",
" onDiskChecksum, "
],
"header": "@@ -838,8 +838,8 @@ abstract class FileContainer",
"removed": [
" new Long(checksum.getValue()), ",
" new Long(onDiskChecksum), "
]
},
{
"added": [
" getIdentity(), fid);"
],
"header": "@@ -1105,7 +1105,7 @@ abstract class FileContainer",
"removed": [
" getIdentity(), new Long(fid));"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/store/raw/log/LogToFile.java",
"hunks": [
{
"added": [
"\t\t\t\t\t\t\t\tlogFile, endPosition, eof);"
],
"header": "@@ -1132,7 +1132,7 @@ public final class LogToFile implements LogFactory, ModuleControl, ModuleSupport",
"removed": [
"\t\t\t\t\t\t\t\tlogFile, new Long(endPosition), new Long(eof));"
]
},
{
"added": [
" maxLogFileNumber); "
],
"header": "@@ -2046,7 +2046,7 @@ public final class LogToFile implements LogFactory, ModuleControl, ModuleSupport",
"removed": [
" new Long(maxLogFileNumber)); "
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/store/raw/log/Scan.java",
"hunks": [
{
"added": [
" checkLength,",
" recordLength,",
" inst,",
" currentLogFileNumber));"
],
"header": "@@ -376,10 +376,10 @@ public class Scan implements StreamLogScan {",
"removed": [
" new Long(checkLength),",
" new Long(recordLength),",
" new Long(inst),",
" new Long(currentLogFileNumber)));"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/store/replication/slave/SlaveController.java",
"hunks": [
{
"added": [
" slavePort = Integer.parseInt(port);"
],
"header": "@@ -138,7 +138,7 @@ public class SlaveController",
"removed": [
" slavePort = (new Integer(port)).intValue();"
]
}
]
},
{
"file": "java/optional/org/apache/derby/optional/lucene/LuceneListIndexesVTI.java",
"hunks": [
{
"added": [
" col,",
" getColumnCount()"
],
"header": "@@ -151,8 +151,8 @@ class LuceneListIndexesVTI extends StringColumnVTI",
"removed": [
" new Integer( col ),",
" new Integer( getColumnCount() )"
]
}
]
},
{
"file": "java/tools/org/apache/derby/impl/tools/ij/xaHelper.java",
"hunks": [
{
"added": [
"\t\t\tm.invoke(ds, new Object[] {value});"
],
"header": "@@ -589,7 +589,7 @@ class xaHelper implements xaAbstractHelper",
"removed": [
"\t\t\tm.invoke(ds, new Object[] {new Integer(value)});"
]
}
]
},
{
"file": "java/tools/org/apache/derby/impl/tools/optional/DBMDWrapper.java",
"hunks": [
{
"added": [
" else if ( Integer.TYPE == type ) { return 1; }",
" else if ( Short.TYPE == type ) { return (short) 1; }"
],
"header": "@@ -810,8 +810,8 @@ public class DBMDWrapper implements OptionalTool",
"removed": [
" else if ( Integer.TYPE == type ) { return new Integer( 1 ); }",
" else if ( Short.TYPE == type ) { return new Short( (short) 1 ); }"
]
}
]
}
] |
derby-DERBY-6856-ddebc878
|
DERBY-6856: Disable SystemPrivilegesPermissionTest.testSerialization(), an unnecessary test case which fails on JDK 9. Tests passed cleanly on derby-6856-10-aa-disable-permissions-subverting-test.diff.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1778945 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-6857-0d57d84c
|
DERBY-6857: Deprecate support for building Derby under JDKs 6 and 7
Remove the JVMInfo constants for Java 6 and 7, since they are no longer
supported.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1728767 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/drda/org/apache/derby/drda/NetworkServerControl.java",
"hunks": [
{
"added": [],
"header": "@@ -31,7 +31,6 @@ import java.security.PrivilegedAction;",
"removed": [
"import org.apache.derby.iapi.services.info.JVMInfo;"
]
}
]
},
{
"file": "java/engine/org/apache/derby/iapi/services/info/JVMInfo.java",
"hunks": [
{
"added": [
" <LI> 7 - not used, was for JDK 1.6",
" <LI> 8 - not used, was for JDK 1.7",
" public static final int J2SE_18 = 9; // Java SE 8"
],
"header": "@@ -47,16 +47,14 @@ public abstract class JVMInfo",
"removed": [
"\t\t<LI> 7 - J2SE_16 - JDK 1.6",
" <LI> 8 - J2SE_17 - JDK 1.7",
"\tpublic static final int J2SE_16 = 7; // Java SE 6, not J2SE",
" public static final int J2SE_17 = 8; // Java SE 7",
" public static final int J2SE_18 = 9;"
]
},
{
"added": [],
"header": "@@ -67,8 +65,6 @@ public abstract class JVMInfo",
"removed": [
" case J2SE_16: return 0; ",
" case J2SE_17: return 1; "
]
},
{
"added": [
" // version 1.8, which is the lowest level we support.",
" String javaVersion = \"1.8\";",
" System.getProperty(\"java.specification.version\", javaVersion);",
" if (javaVersion.equals(\"1.8\")) {",
" id = J2SE_18;"
],
"header": "@@ -87,36 +83,25 @@ public abstract class JVMInfo",
"removed": [
" // version 1.6, which is the lowest level we support.",
"\t\tString javaVersion;",
"",
" System.getProperty(\"java.specification.version\", \"1.6\");",
"",
" javaVersion = \"1.6\";",
" if (javaVersion.equals(\"1.6\"))",
" {",
" id = J2SE_16;",
" }",
" else if (javaVersion.equals(\"1.7\"))",
" {",
" id = J2SE_17;",
" }",
" else if (javaVersion.equals(\"1.8\")) {",
" id = J2SE_16;"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/jdbc/EmbedStatement.java",
"hunks": [
{
"added": [
"import java.sql.BatchUpdateException;",
"import java.util.Arrays;"
],
"header": "@@ -33,11 +33,11 @@ import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;",
"removed": [
"import java.security.AccessController;",
"import java.security.PrivilegedAction;"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/jdbc/Util.java",
"hunks": [
{
"added": [],
"header": "@@ -22,8 +22,6 @@",
"removed": [
"import java.lang.reflect.Constructor;",
"import java.sql.BatchUpdateException;"
]
},
{
"added": [],
"header": "@@ -35,7 +33,6 @@ import org.apache.derby.iapi.reference.MessageId;",
"removed": [
"import org.apache.derby.iapi.services.info.JVMInfo;"
]
}
]
}
] |
derby-DERBY-6857-0feae43b
|
DERBY-6857: Deprecate support for building Derby under JDKs 6 and 7
Make ClassInvestigator understand the new byte codes added in Java 7
to support InvokeDynamic and lambda. Also transform an inner class to
a lambda in the NetworkServerControl class to test that
ClassInvestigator understands the new codes.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1728732 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/drda/org/apache/derby/drda/NetworkServerControl.java",
"hunks": [
{
"added": [
"import java.security.PrivilegedAction;"
],
"header": "@@ -27,7 +27,7 @@ import java.net.InetAddress;",
"removed": [
"import java.security.PrivilegedExceptionAction;"
]
}
]
},
{
"file": "java/engine/org/apache/derby/iapi/services/classfile/ClassInvestigator.java",
"hunks": [
{
"added": [
" final int tag = in.getU1();",
" case VMDescriptor.CONSTANT_MethodType:"
],
"header": "@@ -469,12 +469,12 @@ public class ClassInvestigator extends ClassHolder {",
"removed": [
"\t\tint tag;\t\t",
"\t\ttag = in.readUnsignedByte();"
]
},
{
"added": [
" case VMDescriptor.CONSTANT_InvokeDynamic:"
],
"header": "@@ -482,6 +482,7 @@ public class ClassInvestigator extends ClassHolder {",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/iapi/services/classfile/VMDescriptor.java",
"hunks": [
{
"added": [
" int CONSTANT_MethodHandle = 15;",
" int CONSTANT_MethodType = 16;",
" int CONSTANT_InvokeDynamic = 18;"
],
"header": "@@ -68,6 +68,9 @@ public interface VMDescriptor {",
"removed": []
}
]
}
] |
derby-DERBY-6857-c491355c
|
DERBY-6857: Make classlister prune the constants files from the rosters of jar file contents; commit derby-6857-04-aa-pruneConstantClasses.diff.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1727680 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/build/org/apache/derbyBuild/classlister.java",
"hunks": [
{
"added": [
" //",
" // Exclude classes which are referenced only by the compiler",
" // in order to copy constants into the target class. These were not recorded",
" // in the constant pool by Java compilers at level 7 or earlier.",
" // However, these started turning up under Windows with Java 8",
" // after the base compilation level was changed to Java 8 by the work",
" // on https://issues.apache.org/jira/browse/DERBY-6857. See that issue",
" // for more information.",
" //",
" if (",
" className.startsWith(\"org.apache.derby.iapi.reference.DRDAConstants\") ||",
" className.startsWith(\"org.apache.derby.shared.common.sanity.SanityState\") ||",
" className.startsWith(\"org.apache.derbyPreBuild.ReleaseProperties\")",
" )",
" { return; }",
""
],
"header": "@@ -511,6 +511,22 @@ public class classlister {",
"removed": []
}
]
}
] |
derby-DERBY-6864-3602a8c8
|
DERBY-6864: RawDBReaderTest fails on Windows
RawDBReaderTest.runRecoveryScript() opens a FileReader, but doesn't
close it. When the test harness tries to delete the test directory
upon completion of the test, it fails because one of the files in the
directory is still open.
This patch makes runRecoveryScript() open the FileReader in a
try-with-resources statement, so that it is automatically closed when
it goes out of scope.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1728370 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-6864-5a3453db
|
DERBY-6864: RawDBReaderTest fails on Windows
DataFileVTI.makeDecryptionEngine() opens a stream that reads from
service.properties, but it never closes the stream. This prevents the
file from being deleted later. This patch makes it open the stream in
a try-with-resources statement so that it gets closed automatically.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1728459 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/optional/org/apache/derby/optional/dump/DataFileVTI.java",
"hunks": [
{
"added": [],
"header": "@@ -29,17 +29,11 @@ import java.io.FileInputStream;",
"removed": [
"import java.io.ObjectInput;",
"import java.io.ObjectInputStream;",
"import java.io.ObjectOutputStream;",
"import java.io.OutputStream;",
"import java.io.PrintStream;",
"import java.security.PrivilegedAction;"
]
},
{
"added": [],
"header": "@@ -58,7 +52,6 @@ import java.util.Properties;",
"removed": [
"import org.apache.derby.iapi.jdbc.AuthenticationService;"
]
}
]
}
] |
derby-DERBY-6864-5eb3cdfe
|
DERBY-6864: RawDBReaderTest fails on Windows
Use BaseTestCase.assertDirectoryDeleted() instead of File.delete()
to delete the db directory, so that we get more information if the
directory cannot be deleted.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1728426 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-6865-14248ac9
|
DERBY-6865: RestrictiveFilePermissionsTest fails on Windows
Move the contents of FilePermissionServiceImpl into FileUtil. It was
originally separated out of FileUtil because it used functionality
only available on Java 7 and higher, so it had to be loaded via
reflection. Since Java 8 is the minimum level on trunk, it could be
used directly from FileUtil without reflection.
The reason for the test failure was that a recent change caused
FilePermissionServiceImpl to be excluded from derby.jar, so that its
services were not used, and the database files ended up with unexpected
permissions.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1728681 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/iapi/services/io/FileUtil.java",
"hunks": [
{
"added": [
"import java.nio.file.Files;",
"import java.nio.file.Path;",
"import java.nio.file.attribute.AclEntry;",
"import java.nio.file.attribute.AclEntryPermission;",
"import java.nio.file.attribute.AclEntryType;",
"import java.nio.file.attribute.AclFileAttributeView;",
"import java.nio.file.attribute.PosixFileAttributeView;",
"import java.nio.file.attribute.PosixFilePermission;",
"import java.util.Collections;",
"import java.util.EnumSet;"
],
"header": "@@ -33,8 +33,17 @@ import org.apache.derby.io.StorageFile;",
"removed": [
"import org.apache.derby.iapi.services.info.JVMInfo;"
]
},
{
"added": [],
"header": "@@ -459,28 +468,6 @@ public abstract class FileUtil {",
"removed": [
"",
" // Members used by limitAccessToOwner",
" private final static FilePermissionService filePermissionService =",
" loadFilePermissionService();",
"",
" private static FilePermissionService loadFilePermissionService() {",
" try {",
" Class cl = Class.forName(",
" FilePermissionService.class.getName() + \"Impl\");",
" return (FilePermissionService) cl.newInstance();",
" } catch (ClassNotFoundException ex) {",
" } catch (InstantiationException ex) {",
" } catch (IllegalAccessException ex) {",
" } catch (LinkageError e) {",
" }",
"",
" // Could not create an instance. This most likely means we are",
" // not on Java 7 or higher. Just return null, and let",
" // limitAccessToOwner() choose another strategy on older platforms.",
" return null;",
" }",
""
]
},
{
"added": [
" * On Windows, with NTFS with ACLs, we limit access also for Windows",
" * using the new {@code java.nio.file.attribute} package."
],
"header": "@@ -503,9 +490,8 @@ public abstract class FileUtil {",
"removed": [
" * On Windows, with NTFS with ACLs, if running with Java 7 or higher, we",
" * limit access also for Windows using the new {@code",
" * java.nio.file.attribute} package."
]
},
{
"added": [
" if (Boolean.parseBoolean(value.trim())) {",
" // running with the network server started from the command line.",
" if (PropertyUtil.getSystemBoolean(",
" Property.SERVER_STARTED_FROM_CMD_LINE, false)) {"
],
"header": "@@ -530,16 +516,14 @@ public abstract class FileUtil {",
"removed": [
" if (Boolean.valueOf(value.trim()).booleanValue()) {",
" // running with the network server started from the command line",
" // *and* at Java 7 or above",
" if (JVMInfo.JDK_ID >= JVMInfo.J2SE_17 &&",
" (PropertyUtil.getSystemBoolean(",
" Property.SERVER_STARTED_FROM_CMD_LINE, false)) ) {"
]
}
]
}
] |
derby-DERBY-6865-8aa8deb9
|
DERBY-6865: RestrictiveFilePermissionsTest fails on Windows
Remove use of reflection in the test. Reflection was used to access
functionality only available on Java 7 and higher. Since Java 8 is
the minimum level now, reflection is no longer needed.
This doesn't fix the test failure, but it makes it easier to debug
the test.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1728667 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-6868-949e80b7
|
DERBY-6868: Remove the dependency on Jakarta ORO
Rewrite the Sed class so that it uses java.util.regex instead of
Jakarta ORO for regular expression matching and substitution.
Remove tools/java/jakarta-oro-2.0.8.jar and all references to it.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1729326 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/testing/org/apache/derbyTesting/functionTests/harness/Sed.java",
"hunks": [
{
"added": [
" * written using the java.util.regex regular expression classes.",
"import java.util.List;",
"import java.util.regex.Pattern;",
"import java.util.stream.Collectors;"
],
"header": "@@ -25,17 +25,18 @@ package org.apache.derbyTesting.functionTests.harness;",
"removed": [
" * written using the OROMatcher Perl5 regular expression classes.",
"import org.apache.oro.text.regex.*;",
"import java.util.Enumeration;"
]
},
{
"added": [
" searchStrings.addElement(\"^ Waiting XID : \\\\{.*\\\\}\");"
],
"header": "@@ -148,7 +149,7 @@ public class Sed",
"removed": [
" searchStrings.addElement(\"^ Waiting XID : {.*}\");"
]
},
{
"added": [],
"header": "@@ -313,17 +314,8 @@ public class Sed",
"removed": [
"\t\t",
" boolean lineDeleted = false;",
" PatternMatcher matcher;",
" Perl5Compiler pcompiler;",
" PatternMatcherInput input;",
" String result = \"\";",
" String regex;",
" Vector<Pattern> delPatternVector = new Vector<Pattern>();",
" Vector<Pattern> subPatternVector = new Vector<Pattern>();"
]
},
{
"added": [
" for (String key : sedp.stringPropertyNames())"
],
"header": "@@ -332,9 +324,8 @@ public class Sed",
"removed": [
" for (Enumeration e = sedp.propertyNames(); e.hasMoreElements(); )",
" String key = (String)e.nextElement();"
]
},
{
"added": [],
"header": "@@ -374,10 +365,6 @@ public class Sed",
"removed": [
" //Create Perl5Compiler and Perl5Matcher",
" pcompiler = new Perl5Compiler();",
" matcher = new Perl5Matcher();",
""
]
},
{
"added": [
" List<Pattern> deletePatterns = deleteLines.stream()",
" .map(Pattern::compile).collect(Collectors.toList());",
" List<Pattern> substitutePatterns = searchStrings.stream()",
" .map(Pattern::compile).collect(Collectors.toList());"
],
"header": "@@ -393,42 +380,12 @@ public class Sed",
"removed": [
" for (int i = 0; i < deleteLines.size(); i++)",
" {",
" try",
" {",
" regex = (String)deleteLines.elementAt(i);",
" //System.out.println(\"The pattern: \" + regex);",
" Pattern pattern = pcompiler.compile(regex);",
" if (pattern == null)",
" System.out.println(\"pattern is null\");",
" delPatternVector.addElement(pattern);",
" }",
" catch(MalformedPatternException e)",
" {",
" System.out.println(\"Bad pattern.\");",
" System.out.println(e.getMessage());",
" }",
" }",
" for (int i = 0; i < searchStrings.size(); i++)",
" {",
" try",
" {",
" regex = (String)searchStrings.elementAt(i);",
" //System.out.println(\"The pattern: \" + regex);",
" Pattern pattern = pcompiler.compile(regex);",
" if (pattern == null)",
" System.out.println(\"pattern is null\");",
" subPatternVector.addElement(pattern);",
" }",
" catch(MalformedPatternException e)",
" {",
" System.out.println(\"Bad pattern.\");",
" System.out.println(e.getMessage());",
" }",
" }"
]
},
{
"added": [
" boolean lineDeleted = false;"
],
"header": "@@ -440,7 +397,7 @@ public class Sed",
"removed": [
" lineDeleted = false;"
]
}
]
}
] |
derby-DERBY-6869-3592c633
|
DERBY-6869: XMLXXETest fails in non-English locales
Decorate the test with a LocaleTestSetup that forces it to run in US
locale, so that it always sees English error messages.
Change the failing assert so that it reports the original exception in
case it doesn't get the expected exception. Makes it easier to debug
the test.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1729402 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-6875-9a1012a6
|
DERBY-6875: Mirror selection broken on Derby download pages.
This change changes the tool which generates the Derby download page for
a new release, to remove the comment markers from the mirror selection
portion of the page.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1732683 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/build/org/apache/derbyBuild/ReleaseNotesTransformer.java",
"hunks": [
{
"added": [
" \"[if-any http] [for http]\\n\" +",
" \"[end] [end]\\n\" +",
" \"[if-any ftp] [for ftp]\\n\" +",
" \"[end] [end]\\n\" +",
" \"[if-any backup] [for backup]\\n\" +",
" \"[end] [end]\\n\" +"
],
"header": "@@ -91,15 +91,15 @@ public class ReleaseNotesTransformer extends Task",
"removed": [
" \"<!--[if-any http] [for http]-->\\n\" +",
" \"<!--[end] [end]-->\\n\" +",
" \"<!--[if-any ftp] [for ftp]-->\\n\" +",
" \"<!--[end] [end]-->\\n\" +",
" \"<!--[if-any backup] [for backup]-->\\n\" +",
" \"<!--[end] [end]-->\\n\" +"
]
}
]
}
] |
derby-DERBY-6879-677a71c4
|
DERBY-6879: Engine deadlock between XA timeout handling and cleanupOnError
This patch was contributed by Brett Bergquist (brett at thebergquistfamily dot com)
The original problem to be solved is that a connection that is performing a
XA transaction that discovers an error that must be cleaned up is going to
have a lock on a EmbedConnection and will then require a lock on the
XATransactionState.
And if the same XA transaction times out (because of the XA transaction
timer value) while the original XA transaction is being worked, then the
timeout handling is going to have a lock on the XATransactionState and then
require a lock on the EmbedConnection, triggering the deadlock.
The change in the patch fixes this problem by altering the locking on
the XATransactionState when invoked via the timeout by removing the
synchronization on the "cancel" method and instead using inline
synchronization on the "XATransactionState" while its internals are being
altered.
Then, it releases the XATransactionState lock to allow the
EmbedConnection.rollback method to be invoked without the lock.
Finally, it acquires the lock again to finish cleaning up the XATransactionState.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1751978 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/testing/org/apache/derbyTesting/functionTests/util/DeadlockWatchdog.java",
"hunks": [
{
"added": [
"/*",
" * Derby - Class org.apache.derbyTesting.functionTests.util.Barrier",
" *",
" * Licensed to the Apache Software Foundation (ASF) under one or more",
" * contributor license agreements. See the NOTICE file distributed with",
" * this work for additional information regarding copyright ownership.",
" * The ASF licenses this file to You under the Apache License, Version 2.0",
" * (the \"License\"); you may not use this file except in compliance with",
" * the License. You may obtain a copy of the License at",
" *",
" * http://www.apache.org/licenses/LICENSE-2.0",
" *",
" * Unless required by applicable law or agreed to in writing,",
" * software distributed under the License is distributed on an",
" * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,",
" * either express or implied. See the License for the specific",
" * language governing permissions and limitations under the License.",
" */",
"package org.apache.derbyTesting.functionTests.util;",
"",
"import java.io.IOException;",
"import java.lang.management.ManagementFactory;",
"import java.lang.management.ThreadMXBean;",
"import java.security.AccessController;",
"import java.security.PrivilegedExceptionAction;",
"import javax.management.InstanceNotFoundException;",
"import javax.management.MBeanException;",
"import javax.management.MalformedObjectNameException;",
"import javax.management.ReflectionException;",
"",
"/**",
" * A deadlock watch utlity. An instance of this class can be created and started",
" * and it will look for a Java level deadlock at the time given if not stopped.",
" * A deadlock is detected using JMX and the ThreadMXBean",
" */",
"public class DeadlockWatchdog implements Runnable {",
" ",
" private boolean stopped = false;",
" private long timeout;",
" ",
" public DeadlockWatchdog(long timeout) {",
" this.timeout = timeout;",
" }",
" ",
" public synchronized void start() {",
" stopped = false;",
" Thread t = new Thread(this, \"WATCHDOG\");",
" t.setDaemon(true);",
" t.start(); ",
" }",
" ",
" public synchronized void stop() {",
" stopped = true;",
" notifyAll();",
" }",
" ",
" public synchronized void run() {",
" final long until = System.currentTimeMillis() + timeout;",
" long now;",
" while (!stopped && until > (now = System.currentTimeMillis())) {",
" try {",
" wait(until - now);",
" } catch (InterruptedException e) {",
" }",
" }",
" if (!stopped) {",
" try {",
" boolean res = AccessController.doPrivileged(",
" new PrivilegedExceptionAction<Boolean>() {",
" public Boolean run() throws IOException, MalformedObjectNameException, InstanceNotFoundException, MBeanException, ReflectionException {",
" return checkForDeadlock();",
" }",
" });",
"",
" if (res) {",
" System.err.println(\"Deadlock detected\");",
" System.exit(1);",
" }",
" } catch (Exception x) {",
" System.err.println(\"Watchdog failed: \" + x.toString());",
" System.exit(1);",
" }",
" }",
" } ",
" ",
" boolean checkForDeadlock() throws MalformedObjectNameException, InstanceNotFoundException, MBeanException, ReflectionException, IOException {",
" ThreadMXBean bean = ManagementFactory.getThreadMXBean();",
" long[] findDeadlockedThreads = bean.findDeadlockedThreads();",
" if (null != findDeadlockedThreads && 0 != findDeadlockedThreads.length) {",
" return true;",
" }",
"",
" return false;",
" } ",
"}"
],
"header": "@@ -0,0 +1,95 @@",
"removed": []
}
]
}
] |
derby-DERBY-6879-698bfec5
|
DERBY-6879: Engine deadlock between XA timeout handling and cleanupOnError
This patch was contributed by Brett Bergquist (brett at thebergquistfamily dot com)
This change is a follow-up to revision 1751977.
The problem with that revision occurs if a timeout occurs calling "cancel"
and if an error occurs on the clients connection causing the "cleanupOnError"
to be called at the same time.
This change creates a new private static class that is used to track if
"cancel" or "cleanupOnError" has been invoked. The methods are synchronized
so that there is no timing issue on checking and recording the state.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1753333 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/jdbc/XATransactionState.java",
"hunks": [
{
"added": [
" ",
" /**",
" * A class used to monitor if the transaction is in the middle of",
" * cancelling or cleaning up on an error. ",
" * ",
" * See DERBY-6879",
" * ",
" */",
" private static class CleanupOrCancelMonitor {",
" ",
" private Long cancelThreadId;",
" private Long cleanupThreadId;",
" ",
" /**",
" * See if it is ok to cancel. It is okay to cancel if the transaction",
" * is not cleaning up from an error. The assumption is that if the ",
" * cleanUpOnError is/has been invoked, then there is no reason for",
" * the cancel to be processed as the transaction is going to end",
" * (ab)normally.",
" * ",
" * @return <code>true</code> if it is okay to cancel.",
" */",
" public synchronized boolean okToCancel() {",
" boolean res = false;",
" if (null == cancelThreadId && null == cleanupThreadId) {",
" cancelThreadId = Thread.currentThread().getId();",
" res = true;",
" }",
" return res;",
" }",
" ",
" /**",
" * See if it is ok to cleanup. It is okay to cleanup if the transaction",
" * is not cancelling. The assumption is that if the ",
" * cancel is/has been invoked, then there is no reason to try to",
" * mark the transaction as being in error. The transaction will ",
" * be cancelled in any case.",
" * ",
" * @return <code>true</code> if it is okay to cleanup.",
" */",
" private synchronized boolean okToCleanup() {",
" boolean res = false;",
" if (null == cleanupThreadId && null == cancelThreadId) {",
" cleanupThreadId = Thread.currentThread().getId();",
" res = true;",
" }",
" return res;",
" }",
" };",
" ",
" CleanupOrCancelMonitor cleanupOrCancelMonitor = new CleanupOrCancelMonitor();",
" "
],
"header": "@@ -63,6 +63,58 @@ final class XATransactionState extends ContextImpl {",
"removed": []
},
{
"added": [
" // See if it is okay to cleanup. This is for DERBY-6879",
" if (cleanupOrCancelMonitor.okToCleanup()) {",
" if (t instanceof StandardException) {",
" StandardException se = (StandardException) t;",
" if (se.getSeverity() >= ExceptionSeverity.SESSION_SEVERITY) {",
" popMe();",
" return;",
" }",
" if (se.getSeverity() == ExceptionSeverity.TRANSACTION_SEVERITY) {",
"",
" synchronized (this) {",
" // prior to the DERBY-5552 fix, we would disable the connection",
" // here with conn.setApplicationConnection(null);",
" // which could cause a NPE",
" notifyAll();",
" associationState = TRO_FAIL;",
" if (SQLState.DEADLOCK.equals(se.getMessageId()))",
" rollbackOnlyCode = XAException.XA_RBDEADLOCK;",
" else if (se.isLockTimeout())",
" rollbackOnlyCode = XAException.XA_RBTIMEOUT;",
" else",
" rollbackOnlyCode = XAException.XA_RBOTHER;",
" }",
" }",
" }",
" }",
" synchronized (this) {",
" if (associationState == XATransactionState.TRO_FAIL)",
" throw new XAException(rollbackOnlyCode);",
" boolean isSuspendedByResource = (suspendedList != null) && (suspendedList.get(resource) != null);",
" if (flags == XAResource.TMRESUME) {",
" if (!isSuspendedByResource)",
" throw new XAException(XAException.XAER_PROTO);",
" } else {",
" // cannot join a transaction we have suspended.",
" if (isSuspendedByResource)",
" throw new XAException(XAException.XAER_PROTO);",
" }",
"",
" while (associationState == XATransactionState.T1_ASSOCIATED) {",
" try {",
" wait();",
" } catch (InterruptedException ie) {",
" throw new XAException(XAException.XA_RETRY);",
" }",
" }",
" switch (associationState) {",
" case XATransactionState.T0_NOT_ASSOCIATED:",
" break;",
" case XATransactionState.TRO_FAIL:",
" throw new XAException(rollbackOnlyCode);",
" default:",
" throw new XAException(XAException.XAER_NOTA);",
" }",
" if (isPrepared)",
" throw new XAException(XAException.XAER_PROTO);",
" if (isSuspendedByResource) {",
" suspendedList.remove(resource);",
" }",
" associationState = XATransactionState.T1_ASSOCIATED;",
" associatedResource = resource;",
" }",
" boolean rollbackOnly = false;",
" synchronized (this) {",
"",
"",
" boolean isSuspendedByResource = (suspendedList != null) && (suspendedList.get(resource) != null);",
"",
" if (!endingCurrentXid) {",
" while (associationState == XATransactionState.T1_ASSOCIATED) {",
"",
" try {",
" wait();",
" } catch (InterruptedException ie) {",
" throw new XAException(XAException.XA_RETRY);",
" }",
" }",
" }",
"",
" switch (associationState) {",
" case XATransactionState.TC_COMPLETED:",
" throw new XAException(XAException.XAER_NOTA);",
" case XATransactionState.TRO_FAIL:",
" if (endingCurrentXid)",
" flags = XAResource.TMFAIL;",
" else",
" throw new XAException(rollbackOnlyCode);",
" }",
"",
" boolean notify = false;",
" switch (flags) {",
" case XAResource.TMSUCCESS:",
" if (isSuspendedByResource) {",
" suspendedList.remove(resource);",
" }",
" else {",
" if (resource != associatedResource)",
" throw new XAException(XAException.XAER_PROTO);",
"",
" associationState = XATransactionState.T0_NOT_ASSOCIATED;",
" associatedResource = null;",
" notify = true;",
" }",
"",
" conn.setApplicationConnection(null);",
" break;",
"",
" case XAResource.TMFAIL:",
"",
" if (isSuspendedByResource) {",
" suspendedList.remove(resource);",
" } else {",
" if (resource != associatedResource)",
" throw new XAException(XAException.XAER_PROTO);",
" associatedResource = null;",
" }",
"",
" if (associationState != XATransactionState.TRO_FAIL) {",
" associationState = XATransactionState.TRO_FAIL;",
" rollbackOnlyCode = XAException.XA_RBROLLBACK;",
" }",
" conn.setApplicationConnection(null);",
" notify = true;",
" rollbackOnly = true;",
" break;",
"",
" case XAResource.TMSUSPEND:",
" if (isSuspendedByResource)",
" throw new XAException(XAException.XAER_PROTO);",
"",
" if (resource != associatedResource)",
" throw new XAException(XAException.XAER_PROTO);",
" suspendedList.put(resource, this);",
" associationState = XATransactionState.T0_NOT_ASSOCIATED;",
" associatedResource = null;",
" conn.setApplicationConnection(null);",
" notify = true;",
" break;",
" default:",
" throw new XAException(XAException.XAER_INVAL);",
" }",
" if (notify)",
" notifyAll();",
" return rollbackOnly;",
" }"
],
"header": "@@ -142,185 +194,187 @@ final class XATransactionState extends ContextImpl {",
"removed": [
"\t\tif (t instanceof StandardException) {",
"\t\t\tStandardException se = (StandardException) t;",
" ",
" if (se.getSeverity() >= ExceptionSeverity.SESSION_SEVERITY) {",
" popMe();",
" return;",
" }",
"\t\t\tif (se.getSeverity() == ExceptionSeverity.TRANSACTION_SEVERITY) {",
"",
"\t\t\t\tsynchronized (this) {",
"\t\t\t\t\t// prior to the DERBY-5552 fix, we would disable the connection",
"\t\t\t\t\t// here with conn.setApplicationConnection(null);",
"\t\t\t\t\t// which could cause a NPE",
"\t\t\t\t\tnotifyAll();",
"\t\t\t\t\tassociationState = TRO_FAIL;",
"\t\t\t\t\tif (SQLState.DEADLOCK.equals(se.getMessageId()))",
"\t\t\t\t\t\trollbackOnlyCode = XAException.XA_RBDEADLOCK;",
"\t\t\t\t\telse if (se.isLockTimeout())",
"\t\t\t\t\t\trollbackOnlyCode = XAException.XA_RBTIMEOUT;",
"\t\t\t\t\telse",
"\t\t\t\t\t\trollbackOnlyCode = XAException.XA_RBOTHER;",
"\t\t\t\t}",
"\t\t\t}",
"\t\t}",
"\t\tsynchronized (this) {",
"\t\t\tif (associationState == XATransactionState.TRO_FAIL)",
"\t\t\t\tthrow new XAException(rollbackOnlyCode);",
"\t\t\tboolean isSuspendedByResource = (suspendedList != null) && (suspendedList.get(resource) != null);",
"\t\t\tif (flags == XAResource.TMRESUME) {",
"\t\t\t\tif (!isSuspendedByResource)",
"\t\t\t\t\tthrow new XAException(XAException.XAER_PROTO);",
"\t\t\t} else {",
"\t\t\t\t// cannot join a transaction we have suspended.",
"\t\t\t\tif (isSuspendedByResource)",
"\t\t\t\t\tthrow new XAException(XAException.XAER_PROTO);",
"\t\t\t}",
"\t\t\twhile (associationState == XATransactionState.T1_ASSOCIATED) {",
"\t\t\t\t",
"\t\t\t\ttry {",
"\t\t\t\t\twait();",
"\t\t\t\t} catch (InterruptedException ie) {",
"\t\t\t\t\tthrow new XAException(XAException.XA_RETRY);",
"\t\t\t\t}",
"\t\t\t}",
"\t\t\tswitch (associationState) {",
"\t\t\tcase XATransactionState.T0_NOT_ASSOCIATED:",
"\t\t\t\tbreak;",
"\t\t\tcase XATransactionState.TRO_FAIL:",
"\t\t\t\tthrow new XAException(rollbackOnlyCode);",
"\t\t\tdefault:",
"\t\t\t\tthrow new XAException(XAException.XAER_NOTA);",
"\t\t\t}",
"\t\t\tif (isPrepared)",
"\t\t\t\tthrow new XAException(XAException.XAER_PROTO);",
"\t\t\tif (isSuspendedByResource) {",
"\t\t\t\tsuspendedList.remove(resource);",
"\t\t\t}",
"\t\t\tassociationState = XATransactionState.T1_ASSOCIATED;",
"\t\t\tassociatedResource = resource;",
"\t\t}",
"\t\tboolean rollbackOnly = false;",
"\t\tsynchronized (this) {",
"",
"",
"\t\t\tboolean isSuspendedByResource = (suspendedList != null) && (suspendedList.get(resource) != null);",
"",
"\t\t\tif (!endingCurrentXid) {",
"\t\t\t\twhile (associationState == XATransactionState.T1_ASSOCIATED) {",
"\t\t\t\t\t",
"\t\t\t\t\ttry {",
"\t\t\t\t\t\twait();",
"\t\t\t\t\t} catch (InterruptedException ie) {",
"\t\t\t\t\t\tthrow new XAException(XAException.XA_RETRY);",
"\t\t\t\t\t}",
"\t\t\t\t}",
"\t\t\t}",
"",
"\t\t\tswitch (associationState) {",
"\t\t\tcase XATransactionState.TC_COMPLETED:",
"\t\t\t\tthrow new XAException(XAException.XAER_NOTA);",
"\t\t\tcase XATransactionState.TRO_FAIL:",
"\t\t\t\tif (endingCurrentXid)",
"\t\t\t\t\tflags = XAResource.TMFAIL;",
"\t\t\t\telse",
"\t\t\t\t\tthrow new XAException(rollbackOnlyCode);",
"\t\t\t}",
"",
"\t\t\tboolean notify = false;",
"\t\t\tswitch (flags) {",
"\t\t\tcase XAResource.TMSUCCESS:",
"\t\t\t\tif (isSuspendedByResource) {",
"\t\t\t\t\tsuspendedList.remove(resource);",
"\t\t\t\t}",
"\t\t\t\telse {",
"\t\t\t\t\tif (resource != associatedResource)",
"\t\t\t\t\t\tthrow new XAException(XAException.XAER_PROTO);",
"",
"\t\t\t\t\tassociationState = XATransactionState.T0_NOT_ASSOCIATED;",
"\t\t\t\t\tassociatedResource = null;",
"\t\t\t\t\tnotify = true;",
"\t\t\t\t}",
"",
"\t\t\t\tconn.setApplicationConnection(null);",
"\t\t\t\tbreak;",
"",
"\t\t\tcase XAResource.TMFAIL:",
"",
"\t\t\t\tif (isSuspendedByResource) {",
"\t\t\t\t\tsuspendedList.remove(resource);",
"\t\t\t\t} else {",
"\t\t\t\t\tif (resource != associatedResource)",
"\t\t\t\t\t\tthrow new XAException(XAException.XAER_PROTO);",
"\t\t\t\t\tassociatedResource = null;",
"\t\t\t\t}",
"\t\t\t\t",
"\t\t\t\tif (associationState != XATransactionState.TRO_FAIL) {",
"\t\t\t\t\tassociationState = XATransactionState.TRO_FAIL;",
"\t\t\t\t\trollbackOnlyCode = XAException.XA_RBROLLBACK;",
"\t\t\t\t}",
"\t\t\t\tconn.setApplicationConnection(null);",
"\t\t\t\tnotify = true;",
"\t\t\t\trollbackOnly = true;",
"\t\t\t\tbreak;",
"",
"\t\t\tcase XAResource.TMSUSPEND:",
"\t\t\t\tif (isSuspendedByResource)",
"\t\t\t\t\tthrow new XAException(XAException.XAER_PROTO);",
"\t\t\t\t",
"\t\t\t\tif (resource != associatedResource)",
"\t\t\t\t\tthrow new XAException(XAException.XAER_PROTO);",
"\t\t\t\tsuspendedList.put(resource, this);",
"\t\t\t\tassociationState = XATransactionState.T0_NOT_ASSOCIATED;",
"\t\t\t\tassociatedResource = null;",
"\t\t\t\tconn.setApplicationConnection(null);",
"\t\t\t\tnotify = true;",
"\t\t\t\tbreak;",
"\t\t\tdefault:",
"\t\t\t\tthrow new XAException(XAException.XAER_INVAL);",
"\t\t\t}",
"\t\t\tif (notify)",
"\t\t\t\tnotifyAll();",
"\t\t\treturn rollbackOnly;",
"\t\t}"
]
},
{
"added": [
" // See if it is ok to cancel. This is for DERBY-6879",
" if (cleanupOrCancelMonitor.okToCancel()) {",
" synchronized (this) {",
" // We remove the XID so that the client code if any",
" // will get an XAER_NOTA when it accesses the XA transaction",
" // once it starts being canceled. This makes since in that",
" // once the cancel starts, the client will not be able",
" // to access the XA transaction. See DERBY-6879",
" creatingResource.removeXATransaction(xid);",
" // Check performTimeoutRollback just to be sure that",
" // the cancellation task was not started",
" // just before the xa_commit/rollback",
" // obtained this object's monitor.",
" if (performTimeoutRollback) {",
"",
" // Log the message about the transaction cancelled",
" if (messageId != null)",
" Monitor.logTextMessage(messageId, xid.toString());",
"",
" // Check whether the transaction is associated",
" // with any EmbedXAResource instance.",
" if (associationState == XATransactionState.T1_ASSOCIATED) {",
" conn.cancelRunningStatement();",
" EmbedXAResource assocRes = associatedResource;",
" end(assocRes, XAResource.TMFAIL, true);",
" }",
"",
" // Rollback the global transaction",
" try {",
" conn.xa_rollback();",
" } catch (SQLException sqle) {",
" XAException ex = new XAException(XAException.XAER_RMERR);",
" ex.initCause(sqle);",
" throw ex;",
" }",
"",
" // Do the cleanup on the resource",
" creatingResource.returnConnectionToResource(this, xid);",
" }",
" "
],
"header": "@@ -406,53 +460,49 @@ final class XATransactionState extends ContextImpl {",
"removed": [
" // Note that the synchronization has changed for this method. See",
" // DERBY-6879.",
" //",
" boolean needsRollback = false;",
" ",
" // This method now synchronizes on this instanace to ensure that the state",
" // is consistent when accessed and modified. See DERBY-6879",
" synchronized (this) {",
" // Check performTimeoutRollback just to be sure that",
" // the cancellation task was not started",
" // just before the xa_commit/rollback",
" // obtained this object's monitor.",
" needsRollback = this.performTimeoutRollback;",
" // Log the message about the transaction cancelled",
" if (messageId != null)",
" Monitor.logTextMessage(messageId, xid.toString());",
"",
" // Check whether the transaction is associated",
" // with any EmbedXAResource instance.",
" if (associationState == XATransactionState.T1_ASSOCIATED) {",
" conn.cancelRunningStatement();",
" EmbedXAResource assocRes = associatedResource;",
" end(assocRes, XAResource.TMFAIL, true);",
" }",
" }",
" if (needsRollback) {",
" // While the rollback is performed on the connection, ",
" // this XATransactionState is ont synchronized to work around ",
" // the issue reported in DERBY-6879",
" try {",
" // Rollback the global transaction",
" conn.xa_rollback();",
" } catch (SQLException sqle) {",
" XAException ex = new XAException(XAException.XAER_RMERR);",
" ex.initCause(sqle);",
" throw ex;",
"",
" // This method now synchronizes on this instanace again to ensure that the state",
" // is consistent when accessed and modified. See DERBY-6879",
" synchronized (this) {",
" // Do the cleanup on the resource",
" creatingResource.returnConnectionToResource(this, xid);",
" }",
" "
]
}
]
}
] |
derby-DERBY-6879-88b727b0
|
DERBY-6879: Engine deadlock between XA timeout handling and cleanupOnError
This patch was contributed by Brett Bergquist (brett at thebergquistfamily dot com)
The original problem to be solved is that a connection that is performing a
XA transaction that discovers an error that must be cleaned up is going to
have a lock on a EmbedConnection and will then require a lock on the
XATransactionState.
And if the same XA transaction times out (because of the XA transaction
timer value) while the original XA transaction is being worked, then the
timeout handling is going to have a lock on the XATransactionState and then
require a lock on the EmbedConnection, triggering the deadlock.
The change in the patch fixes this problem by altering the locking on
the XATransactionState when invoked via the timeout by removing the
synchronization on the "cancel" method and instead using inline
synchronization on the "XATransactionState" while its internals are being
altered.
Then, it releases the XATransactionState lock to allow the
EmbedConnection.rollback method to be invoked without the lock.
Finally, it acquires the lock again to finish cleaning up the XATransactionState.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1751977 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/jdbc/XATransactionState.java",
"hunks": [
{
"added": [
" public synchronized boolean cancel() {",
" public synchronized void run() {",
" if (null != xaState) {",
" xaState.cancel(MessageId.CONN_XA_TRANSACTION_TIMED_OUT);",
" }"
],
"header": "@@ -107,16 +107,18 @@ final class XATransactionState extends ContextImpl {",
"removed": [
" public boolean cancel() {",
" public void run() {",
" xaState.cancel(MessageId.CONN_XA_TRANSACTION_TIMED_OUT);"
]
},
{
"added": [
" void cancel(String messageId) throws XAException {",
" // Note that the synchronization has changed for this method. See",
" // DERBY-6879.",
" //",
" boolean needsRollback = false;",
" ",
" // This method now synchronizes on this instanace to ensure that the state",
" // is consistent when accessed and modified. See DERBY-6879",
" synchronized (this) {",
" // Check performTimeoutRollback just to be sure that",
" // the cancellation task was not started",
" // just before the xa_commit/rollback",
" // obtained this object's monitor.",
" needsRollback = this.performTimeoutRollback;"
],
"header": "@@ -403,13 +405,20 @@ final class XATransactionState extends ContextImpl {",
"removed": [
" synchronized void cancel(String messageId) throws XAException {",
" // Check performTimeoutRollback just to be sure that",
" // the cancellation task was not started",
" // just before the xa_commit/rollback",
" // obtained this object's monitor.",
" if (performTimeoutRollback) {",
""
]
}
]
}
] |
derby-DERBY-688-24f43da2
|
DERBY-688: Enhancements to XML functionality toward XPath/XQuery support
This revision contains d688_phase2_v1_code.patch and d688_phase2_v3_tests.patch
This patch was contributed by Army Brown (qozinx@gmail.com).
Attaching a "phase 2" patch that does the following:
- Adds syntax and binding logic for XMLQUERY operator
- Updates syntax for XMLEXISTS to match XMLQUERY and does some refactoring
so that the two can share code. The most user-visible change in this area
is the change from BY VALUE to BY REF syntax, which required test updates
and corresponding master file updates.
Also as part of these changes I've rewritten some of the parse logic to
make it more easily extendible to a broader XMLQUERY syntax (as defined in
SQL/XML[2006]) when/if Derby supports the broader syntax (esp. optional
context items and variable bindings) in the future.
- These phase 2 patches do *not* actually implement the XMLQUERY operator
yet; they just allow parsing and binding of the operator. Execution-time
logic will come in a subsequent patch.
For the sake of review I've separated the Phase 2 patches into two
different parts:
d688_phase2_v1_code.patch: The code changes.
d688_phase2_v3_tests.patch: The test/master changes.
When committed, though, *both* patches should be committed together
in order to avoid test diffs.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@429764 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/sql/compile/BinaryOperatorNode.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.services.io.StoredFormatIds;",
""
],
"header": "@@ -29,6 +29,8 @@ import org.apache.derby.iapi.error.StandardException;",
"removed": []
},
{
"added": [
"\tpublic final static int XMLQUERY_OP = 1;",
"\t\t\"xmlquery\"",
"\t\t\"XMLQuery\"",
"\t\tClassName.BooleanDataValue,\t\t// XMLExists",
"\t\tClassName.XMLDataValue\t\t\t// XMLQuery",
"\t\t{ClassName.StringDataValue, ClassName.XMLDataValue},\t// XMLExists",
"\t\t{ClassName.StringDataValue, ClassName.XMLDataValue}\t\t// XMLQuery"
],
"header": "@@ -98,24 +100,29 @@ public class BinaryOperatorNode extends ValueNode",
"removed": [
"\t\tClassName.BooleanDataValue\t\t// XMLExists",
"\t\t{ClassName.StringDataValue, ClassName.XMLDataValue}\t\t// XMLExists"
]
},
{
"added": [
"\t\tif ((operatorType == XMLEXISTS_OP) || (operatorType == XMLQUERY_OP))",
"\t\t\treturn bindXMLQuery();"
],
"header": "@@ -305,8 +312,8 @@ public class BinaryOperatorNode extends ValueNode",
"removed": [
"\t\tif (operatorType == XMLEXISTS_OP)",
"\t\t\treturn bindXMLExists();"
]
},
{
"added": [
" * Bind an XMLEXISTS or XMLQUERY operator. Makes sure",
" * the operand type and target type are both correct",
" * and sets the result type.",
" public ValueNode bindXMLQuery()",
" throws StandardException"
],
"header": "@@ -335,12 +342,14 @@ public class BinaryOperatorNode extends ValueNode",
"removed": [
" * Bind an XMLEXISTS operator. Makes sure the operand type",
" * and target type are both correct, and sets the result type.",
" public ValueNode bindXMLExists() throws StandardException"
]
},
{
"added": [
" // Right operand must be an XML data value. NOTE: This",
" // is a Derby-specific restriction, not an SQL/XML one.",
" // We have this restriction because the query engine",
" // that we use (currently Xalan) cannot handle non-XML",
" // context items.",
" SQLState.LANG_INVALID_CONTEXT_ITEM_TYPE,",
" rightOperandType.getSQLTypeName());"
],
"header": "@@ -361,15 +370,17 @@ public class BinaryOperatorNode extends ValueNode",
"removed": [
" // Right operand is an XML data value.",
" SQLState.LANG_BINARY_OPERATOR_NOT_SUPPORTED, ",
" methodName,",
" leftOperandType.getSQLTypeName(),",
" rightOperandType.getSQLTypeName());"
]
},
{
"added": [
" // Set the result type of this operator.",
" if (operatorType == XMLEXISTS_OP) {",
" // For XMLEXISTS, the result type is always SQLBoolean.",
" // The \"true\" in the next line says that the result",
" // can be nullable--which it can be if evaluation of",
" // the expression returns a null (this is per SQL/XML",
" // spec, 8.4)",
" setType(new DataTypeDescriptor(TypeId.BOOLEAN_ID, true));",
" }",
" else {",
" // The result of an XMLQUERY operator is always another",
" // XML data value, per SQL/XML spec 6.17: \"...yielding a value",
" // X1 of an XML type.\"",
" setType(DataTypeDescriptor.getBuiltInDataTypeDescriptor(",
" StoredFormatIds.XML_TYPE_ID));",
" }",
""
],
"header": "@@ -381,11 +392,23 @@ public class BinaryOperatorNode extends ValueNode",
"removed": [
" // Set the result type of this XMLExists operator--it's always",
" // SQLBoolean. The \"true\" in the next line says that the result",
" // can be nullable--which it can be if evaluation of the expression",
" // returns a null (this is per SQL/XML spec section 8.4).",
" setType(new DataTypeDescriptor(TypeId.BOOLEAN_ID, true));"
]
},
{
"added": [
"\t\t// If we're dealing with XMLEXISTS or XMLQUERY, there is some",
"\t\tboolean xmlGen =",
"\t\t\t(operatorType == XMLQUERY_OP) || (operatorType == XMLEXISTS_OP);"
],
"header": "@@ -461,9 +484,10 @@ public class BinaryOperatorNode extends ValueNode",
"removed": [
"\t\t// If we're dealing with XMLEXISTS, there is some",
"\t\tboolean xmlGen = (operatorType == XMLEXISTS_OP);"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/execute/SqlXmlExecutor.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.reference.SQLState;"
],
"header": "@@ -21,6 +21,7 @@",
"removed": []
},
{
"added": [
" // case of XMLEXISTS and XMLQUERY)."
],
"header": "@@ -120,7 +121,7 @@ public class SqlXmlExecutor {",
"removed": [
" // case of XMLEXISTS)."
]
},
{
"added": [
" * Constructor 3: Used for XMLEXISTS/XMLQUERY ops."
],
"header": "@@ -159,7 +160,7 @@ public class SqlXmlExecutor {",
"removed": [
" * Constructor 3: Used for XMLEXISTS ops."
]
}
]
}
] |
derby-DERBY-688-3bcc92e6
|
DERBY-688: Enhancements to XML functionality toward XPath and XQuery support
This revision contains d688_phase5_v1.patch.
This patch was contributed by Army Brown (qozinx@gmail.com).
The phase 5 patch, d688_phase5_v1.patch, adds code to determine whether or
not the user's classpath has the required XML classes and, if not, to throw
a user-friendly(-ier) error message whenver the user attempts to use any of
the XML operators.
I inquired as to the best way to do this in the following thread:
http://thread.gmane.org/gmane.comp.apache.db.derby.devel/25307/focus=25315
Dan suggested a) looking at the Derby code that loads modules, and
b) adding a new utility method to the ClassInspector class.
I looked at the module-loading code and it ultimately just makes a call to
Class.forName() and ignores a module if that call throws a LinkageError or
a ClassNotFoundException; see the getImplementations() method in
BaseMonitor.java. So based on that I added a utility method to ClassInspector
that does the same thing, except that it just returns "true" if the call
to Class.forName() succeeds and "false" otherwise. I made the new method
static because it doesn't rely on any state specific to ClassInspector and
because it would have taken a good deal of searching for me to figure out
how to instantiate an instance of ClassInspector correctly from within
the XML datatype class.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@430670 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/iapi/types/SqlXmlUtil.java",
"hunks": [
{
"added": [
" * deeper in the execution codepath. The initial check for the",
" * required XML classes can be found in XML.checkXMLRequirements()."
],
"header": "@@ -89,7 +89,8 @@ import org.apache.xalan.templates.OutputProperties;",
"removed": [
" * deeper in the execution codepath."
]
},
{
"added": [
" DocumentBuilderFactory dBF = null;",
" try {",
"",
" dBF = DocumentBuilderFactory.newInstance();",
"",
" } catch (Throwable e) {",
"",
" /* We assume that if we get an error creating the",
" * DocumentBuilderFactory, it's because there's no",
" * JAXP implementation. This can happen in the",
" * (admittedly unlikely) case where the classpath",
" * contains the JAXP _interfaces_ (ex. via xml-apis.jar)",
" * and the Xalan classes but does not actually",
" * contain a JAXP _implementation_. In that case the",
" * check in XML.checkXMLRequirements() will pass",
" * and this class (SqlXmlUtil) will be instantiated",
" * successfully--which is how we get to this constructor.",
" * But then attempts to create a DocumentBuilderFactory",
" * will fail, bringing us here. Note that we can't",
" * check for a valid JAXP implementation in the",
" * XML.checkXMLRequirements() method because we",
" * always want to allow the XML.java class to be",
" * instantiated, even if the required XML classes",
" * are not present--and that means that it (the",
" * XML class) cannot reference DocumentBuilder nor",
" * any of the JAXP classes directly.",
" */",
" throw StandardException.newException(",
" SQLState.LANG_MISSING_XML_CLASSES, \"JAXP\");",
"",
" }",
""
],
"header": "@@ -154,7 +155,38 @@ public class SqlXmlUtil",
"removed": [
" DocumentBuilderFactory dBF = DocumentBuilderFactory.newInstance();"
]
}
]
},
{
"file": "java/engine/org/apache/derby/iapi/types/XML.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.services.loader.ClassInspector;"
],
"header": "@@ -29,6 +29,7 @@ import org.apache.derby.iapi.services.io.StoredFormatIds;",
"removed": []
},
{
"added": [
" /*",
" * Status variable used to verify that user's classpath contains",
" * required classes for accessing/operating on XML data values.",
" private static String xmlReqCheck = null;"
],
"header": "@@ -123,17 +124,11 @@ public class XML",
"removed": [
" /**",
" Loaded at execution time, this holds XML-related objects",
" that were created once during compilation but can be re-used",
" for each row in the target result set for the current",
" SQL statement. In other words, we create the objects",
" once per SQL statement, instead of once per row. In the",
" case of XMLEXISTS, one of the \"objects\" is the compiled",
" query expression, which means we don't have to compile",
" the expression for each row and thus we save some time.",
" private SqlXmlUtil sqlxUtil;"
]
},
{
"added": [
" setXType(((XMLDataValue)theValue).getXType());"
],
"header": "@@ -292,7 +287,7 @@ public class XML",
"removed": [
" \tsetXType(((XMLDataValue)theValue).getXType());"
]
}
]
}
] |
derby-DERBY-688-6e7bbc8c
|
DERBY-688: Enhancements to XML functionality toward XPath/XQuery support
This revision contains d688_phase1_v3.patch.
This patch was contributed by Army Brown (qozinx@gmail.com).
Attaching a "phase 1" patch, d688_phase1_v1.patch, for this issue that does the following:
1. Reorganizes XML-specific code as follows:
- Moves all code that relies on JAXP and Xalan classes
out of XML.java and into a new class, SqlXmlUtil.java.
See comments at the beginning of SqlXmlUtil for an
explanation of why this was done.
- Creates a new class, SqlXmlExecutor, in the impl.sql.execute
package that serves as the class on which all XML operator
calls are generated. Ex. for XMLEXISTS, instead of
generating:
<xmlOperand>.XMLExists(<query-expr>, xmlOperand)
we now generate:
<SqlXmlExecutor>.XMLSerialize(<query-expr>, xmlOperand)
Along with making the code cleaner by allowing all
XML operator calls to be defined in the same class,
this new class has other benefits, as well--see
comments at the beginning of SqlXmlExecutor for
more of an explanation.
2. Changes implementation of XPath from XSLT processing to
the low-level Xalan API, which is faster, more flexible,
and better for implementation of the XMLQUERY operator
(the XMLQUERY operator will be coming in subsequent
phases). Note that as part of this change I've removed
the dependency on an explicit declaration of Xerces
as the parser; Derby will now pick up the parser from
the JVM (i.e. this patch resolves DERBY-567).
3. Makes a small change to the XMLEXISTS operator to bring
it more in line with SQL/XML spec. More specifically,
the query expression that is specified must now be a string
literal; parameters and other expressions are not allowed.
4. Updates the XML test and master files (lang/xml_general.sql
and lang/xmlBinding.java) to bring them in sync with the latest
Derby codeline. Since the XML tests are not (yet) run
as part of derbyall, the master files need to be updated
to reflect some client/server changes that have gone into
the codeline for 10.2 (for example, server pre-fetching
behavior).
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@429698 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/iapi/types/XML.java",
"hunks": [
{
"added": [],
"header": "@@ -46,28 +46,6 @@ import java.io.ObjectOutput;",
"removed": [
"import org.xml.sax.ErrorHandler;",
"import org.xml.sax.XMLReader;",
"import org.xml.sax.SAXException;",
"import org.xml.sax.SAXParseException;",
"import org.xml.sax.InputSource;",
"",
"import org.xml.sax.helpers.DefaultHandler;",
"import org.xml.sax.helpers.XMLReaderFactory;",
"",
"import javax.xml.transform.Templates;",
"import javax.xml.transform.TransformerFactory;",
"",
"import javax.xml.transform.sax.SAXResult;",
"import javax.xml.transform.sax.TemplatesHandler;",
"import javax.xml.transform.sax.TransformerHandler;",
"",
"// Note that even though the following has a Xalan",
"// package name, it IS part of the JDK 1.4 API, and",
"// thus we can compile it without having Xalan in",
"// our classpath.",
"import org.apache.xalan.processor.TransformerFactoryImpl;",
""
]
},
{
"added": [],
"header": "@@ -94,18 +72,6 @@ public class XML",
"removed": [
" // Parser class to use for parsing XML. We use the",
" // Xerces parser, so (for now) we require that Xerces",
" // be in the user's classpath. Note that we load",
" // the Xerces class dynamically (using the class ",
" // name) so that Derby will build even if Xerces",
" // isn't in the build environment; i.e. Xerces is",
" // only required if XML is actually going to be used",
" // at runtime; it's not required for a successful",
" // build nor for non-XML database use.",
" protected static final String XML_PARSER_CLASS =",
" \"org.apache.xerces.parsers.SAXParser\";",
""
]
},
{
"added": [
" /**",
" Loaded at execution time, this holds XML-related objects",
" that were created once during compilation but can be re-used",
" for each row in the target result set for the current",
" SQL statement. In other words, we create the objects",
" once per SQL statement, instead of once per row. In the",
" case of XMLEXISTS, one of the \"objects\" is the compiled",
" query expression, which means we don't have to compile",
" the expression for each row and thus we save some time.",
" */",
" private SqlXmlUtil sqlxUtil;"
],
"header": "@@ -119,16 +85,17 @@ public class XML",
"removed": [
" // An XML reader for reading and parsing SAX events.",
" protected XMLReader saxReader;",
"",
" // XSLT objects used when performing an XSLT query, which",
" // is the query mechanism for this UTF8-based implementation.",
" private static final String XPATH_PLACEHOLDER = \"XPATH_PLACEHOLDER\";",
" private static final String QUERY_MATCH_STRING = \"MATCH\";",
" private static String xsltStylesheet;",
" private XMLReader xsltReader;",
" private TransformerFactoryImpl saxTFactory;"
]
},
{
"added": [
" * store the _serialized_ version locally and then return",
" * this XMLDataValue.",
" *",
" * @param sqlxUtil Contains SQL/XML objects and util",
" * methods that facilitate execution of XML-related",
" * operations",
" * @return If 'text' constitutes a valid XML document,",
" * it has been stored in this XML value and this XML",
" * value is returned; otherwise, an exception is thrown. ",
" * @exception StandardException Thrown on error.",
" public XMLDataValue XMLParse(String text, boolean preserveWS,",
" SqlXmlUtil sqlxUtil) throws StandardException",
" // Currently the only way a user can view the contents of",
" // an XML value is by explicitly calling XMLSERIALIZE.",
" // So do a serialization now and just store the result,",
" // so that we don't have to re-serialize every time a",
" // call is made to XMLSERIALIZE.",
" text = sqlxUtil.serializeToString(text);"
],
"header": "@@ -430,26 +397,32 @@ public class XML",
"removed": [
" * store the _parsed_ version for subsequent use.",
"\t * If 'text' constitutes a valid XML document,",
" * it has been stored in this XML value and nothing",
" * is returned; otherwise, an exception is thrown.",
" * @exception StandardException Thrown on parse error.",
" public void parseAndLoadXML(String text, boolean preserveWS)",
" throws StandardException",
" // We're just going to use the text exactly as it",
" // is, so we just need to see if it parses. ",
" loadSAXReader();",
" saxReader.parse(",
" new InputSource(new StringReader(text)));"
]
},
{
"added": [
" // Couldn't parse the XML document. Throw a StandardException"
],
"header": "@@ -460,7 +433,7 @@ public class XML",
"removed": [
" // The text isn't a valid XML document. Throw a StandardException"
]
},
{
"added": [
" return this;",
" * Serializes this XML value into a string with a user-specified",
" * character type, and returns that string via the received",
" * StringDataValue (if the received StringDataValue is non-null",
" * and of the correct type; else, a new StringDataValue is",
" * returned).",
" *"
],
"header": "@@ -471,15 +444,17 @@ public class XML",
"removed": [
" return;",
" * Converts this XML value into a string with a user-specified",
" * type, and returns that string via the received StringDataValue",
" * (if the received StringDataValue is non-null; else a new",
" * StringDataValue is returned)."
]
},
{
"added": [
" \"with a non-string target type: \" + targetType);"
],
"header": "@@ -505,7 +480,7 @@ public class XML",
"removed": [
" \"with a non-string target type.\");"
]
},
{
"added": [
" // we already have it as a UTF-8 string, so just use",
" // that.",
" result.setValue(getString());"
],
"header": "@@ -526,8 +501,9 @@ public class XML",
"removed": [
" // we already have it as a string, so just use that.",
" result.setValue(xmlStringValue.getString());"
]
}
]
},
{
"file": "java/engine/org/apache/derby/iapi/types/XMLDataValue.java",
"hunks": [
{
"added": [
" /**",
" * Method to parse an XML string and, if it's valid,",
" * store the _serialized_ version locally and then return",
" * this XMLDataValue.",
" * @param text The string value to check.",
" * @param sqlxUtil Contains SQL/XML objects and util",
" * methods that facilitate execution of XML-related",
" * operations",
" * @return If 'text' constitutes a valid XML document,",
" * it has been stored in this XML value and this XML",
" * value returned; otherwise, an exception is thrown. ",
" * @exception StandardException Thrown on error.",
"\tpublic XMLDataValue XMLParse(String text, boolean preserveWS,",
"\t\tSqlXmlUtil sqlxUtil) throws StandardException;",
" * Serializes this XML value into a string with a user-specified",
" * character type, and returns that string via the received",
" * StringDataValue (if the received StringDataValue is non-null",
" * and of the correct type; else, a new StringDataValue is",
" * returned)."
],
"header": "@@ -24,43 +24,32 @@ import org.apache.derby.iapi.error.StandardException;",
"removed": [
" /*",
" ** NOTE: Officially speaking, the XMLParse operator",
" ** is not defined here; it is instead defined on the",
" ** StringDataValue interface (and implemented in",
" ** SQLChar.java) since it is called with a _String_",
" ** operand, not with an XML operand. That said,",
" ** though, the implemention in SQLChar.java",
" ** really just calls the \"parseAndLoadXML\" method that's",
" ** defined on this interface, so it's this interface",
" ** that really does the work.",
" **",
" ** XMLSerialize and XMLExists, on the other hand,",
" ** are called with XML operands, and thus they",
" ** can just be defined in this interface.",
" */",
"",
" /**",
" * Parse the received string value as XML. If the",
" * parse succeeds, store the string value as the",
" * contents of this XML value. If 'text' constitutes a valid XML document,",
" * it has been stored in this XML value and nothing",
" * is returned; otherwise, an exception is thrown.",
" * @param xmlText The string value to check.",
" * @exception StandardException Thrown on parse error.",
" public void parseAndLoadXML(String xmlText, boolean preserveWS)",
" throws StandardException;",
" * Converts this XML value into a string with a user-specified",
" * type, and returns that string via the received StringDataValue.",
" * (if the received StringDataValue is non-null and of the",
" * correct type; else, a new StringDataValue is returned)."
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/BinaryOperatorNode.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.types.SqlXmlUtil;"
],
"header": "@@ -34,6 +34,7 @@ import org.apache.derby.impl.sql.compile.ActivationClassBuilder;",
"removed": []
},
{
"added": [
"\t// Class used to compile an XML query expression and/or load/process",
"\t// XML-specific objects.",
"\tprivate SqlXmlUtil sqlxUtil;",
""
],
"header": "@@ -116,6 +117,10 @@ public class BinaryOperatorNode extends ValueNode",
"removed": []
},
{
"added": [
" // Left operand is query expression and must be a string",
" // literal. SQL/XML spec doesn't allow params nor expressions",
" // 6.17: <XQuery expression> ::= <character string literal> ",
" if (!(leftOperand instanceof CharConstantNode))",
" {",
" throw StandardException.newException(",
" SQLState.LANG_INVALID_XML_QUERY_EXPRESSION);",
" }",
" else {",
" // compile the query expression.",
" sqlxUtil = new SqlXmlUtil();",
" sqlxUtil.compileXQExpr(",
" ((CharConstantNode)leftOperand).getString());"
],
"header": "@@ -340,24 +345,19 @@ public class BinaryOperatorNode extends ValueNode",
"removed": [
" // Left operand is query expression, and must be a string.",
" if (leftOperandType != null) {",
" switch (leftOperandType.getJDBCTypeId())",
" {",
" case Types.CHAR:",
" case Types.VARCHAR:",
" case Types.LONGVARCHAR:",
" case Types.CLOB:",
" break;",
" default:",
" {",
" throw StandardException.newException(",
" SQLState.LANG_BINARY_OPERATOR_NOT_SUPPORTED, ",
" methodName,",
" leftOperandType.getSQLTypeName(),",
" rightOperandType.getSQLTypeName());",
" }",
" }"
]
},
{
"added": [],
"header": "@@ -371,15 +371,6 @@ public class BinaryOperatorNode extends ValueNode",
"removed": [
" // Is there a ? parameter on the left?",
" if (leftOperand.requiresTypeFromContext())",
" {",
" // Set the left operand to be a VARCHAR, which should be",
" // long enough to hold the XPath expression.",
" leftOperand.setType(",
" DataTypeDescriptor.getBuiltInDataTypeDescriptor(Types.VARCHAR));",
" }",
""
]
},
{
"added": [
"\t\t// If we're dealing with XMLEXISTS, there is some",
"\t\t// additional work to be done.",
"\t\tboolean xmlGen = (operatorType == XMLEXISTS_OP);",
"",
"\t\tif (xmlGen) {",
"\t\t// We create an execution-time object so that we can retrieve",
"\t\t// saved objects (esp. our compiled query expression) from",
"\t\t// the activation. We do this for two reasons: 1) this level",
"\t\t// of indirection allows us to separate the XML data type",
"\t\t// from the required XML implementation classes (esp. JAXP",
"\t\t// and Xalan classes)--for more on how this works, see the",
"\t\t// comments in SqlXmlUtil.java; and 2) we can take",
"\t\t// the XML query expression, which we've already compiled,",
"\t\t// and pass it to the execution-time object for each row,",
"\t\t// which means that we only have to compile the query",
"\t\t// expression once per SQL statement (instead of once per",
"\t\t// row); see SqlXmlExecutor.java for more.",
"\t\t\tmb.pushNewStart(",
"\t\t\t\t\"org.apache.derby.impl.sql.execute.SqlXmlExecutor\");",
"\t\t\tmb.pushNewComplete(addXmlOpMethodParams(acb, mb));",
"\t\t}"
],
"header": "@@ -469,6 +460,27 @@ public class BinaryOperatorNode extends ValueNode",
"removed": []
},
{
"added": [
"\t\t\t**",
"\t\t\t** UNLESS we're generating an XML operator such as XMLEXISTS.",
"\t\t\t** In that case we want to generate",
"\t\t\t** ",
"\t\t\t** SqlXmlExecutor.method(left, right)\"",
"\t\t\t**",
"\t\t\t** and we've already pushed the SqlXmlExecutor object to",
"\t\t\t** the stack.",
"\t\t\tif (!xmlGen) {",
"\t\t\t\tmb.dup();",
"\t\t\t\tmb.cast(rightInterfaceType);",
"\t\t\t\t// stack: right,right",
"\t\t\t}"
],
"header": "@@ -526,15 +538,25 @@ public class BinaryOperatorNode extends ValueNode",
"removed": [
"\t\t\tmb.dup();",
"\t\t\tmb.cast(rightInterfaceType);",
"\t\t\t// stack: right,right"
]
},
{
"added": [
"\t\t\tif (xmlGen) {",
"\t\t\t// This is for an XMLEXISTS operation, so invoke the method",
"\t\t\t// on our execution-time object.",
"\t\t\t\tmb.callMethod(VMOpcode.INVOKEVIRTUAL, null,",
"\t\t\t\t\tmethodName, resultTypeName, 2);",
"\t\t\t}",
"\t\t\telse {",
"\t\t\t\tmb.callMethod(VMOpcode.INVOKEINTERFACE, receiverType,",
"\t\t\t\t\tmethodName, resultTypeName, 2);",
"\t\t\t}"
],
"header": "@@ -604,7 +626,16 @@ public class BinaryOperatorNode extends ValueNode",
"removed": [
"\t\t\tmb.callMethod(VMOpcode.INVOKEINTERFACE, receiverType, methodName, resultTypeName, 2);"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/UnaryOperatorNode.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.types.SqlXmlUtil;"
],
"header": "@@ -37,6 +37,7 @@ import org.apache.derby.iapi.services.io.StoredFormatIds;",
"removed": []
},
{
"added": [
"\t// Class used to hold XML-specific objects required for",
"\t// parsing/serializing XML data.",
"\tprivate SqlXmlUtil sqlxUtil;",
""
],
"header": "@@ -113,6 +114,10 @@ public class UnaryOperatorNode extends ValueNode",
"removed": []
},
{
"added": [
" // Create a new XML compiler object; the constructor",
" // here automatically creates the XML-specific objects ",
" // required for parsing/serializing XML, so all we",
" // have to do is create an instance.",
" sqlxUtil = new SqlXmlUtil();",
""
],
"header": "@@ -391,6 +396,12 @@ public class UnaryOperatorNode extends ValueNode",
"removed": []
},
{
"added": [
"\t\t// For XML operator we do some extra work.",
"\t\tboolean xmlGen = (operatorType == XMLPARSE_OP) ||",
"\t\t\t(operatorType == XMLSERIALIZE_OP);",
"",
"\t\tif (xmlGen) {",
"\t\t// We create an execution-time object from which we call",
"\t\t// the necessary methods. We do this for two reasons: 1) this",
"\t\t// level of indirection allows us to separate the XML data type",
"\t\t// from the required XML implementation classes (esp. JAXP and",
"\t\t// Xalan classes)--for more on how this works, see the comments",
"\t\t// in SqlXmlUtil.java; and 2) this allows us to create the",
"\t\t// required XML objects a single time (which we did at bind time",
"\t\t// when we created a new SqlXmlUtil) and then reuse those objects",
"\t\t// for each row in the target result set, instead of creating",
"\t\t// new objects every time; see SqlXmlUtil.java for more.",
"\t\t\tmb.pushNewStart(",
"\t\t\t\t\"org.apache.derby.impl.sql.execute.SqlXmlExecutor\");",
"\t\t\tmb.pushNewComplete(addXmlOpMethodParams(acb, mb));",
"\t\t}",
""
],
"header": "@@ -631,6 +642,26 @@ public class UnaryOperatorNode extends ValueNode",
"removed": []
},
{
"added": [
"",
"\t\t\t/* If we're calling a method on a class (SqlXmlExecutor) instead",
"\t\t\t * of calling a method on the operand interface, then we invoke",
"\t\t\t * VIRTUAL; we then have 2 args (the operand and the local field)",
"\t\t\t * instead of one, i.e:",
"\t\t\t *",
"\t\t\t * SqlXmlExecutor.method(operand, field)",
"\t\t\t *",
"\t\t\t * instead of",
"\t\t\t *",
"\t\t\t * <operand>.method(field).",
"\t\t\t */",
"\t\t\tif (xmlGen) {",
"\t\t\t\tmb.callMethod(VMOpcode.INVOKEVIRTUAL, null,",
"\t\t\t\t\tmethodName, resultTypeName, 2);",
"\t\t\t}",
"\t\t\telse {",
"\t\t\t\tmb.callMethod(VMOpcode.INVOKEINTERFACE,",
"\t\t\t\t\t(String) null, methodName, resultTypeName, 1);",
"\t\t\t}"
],
"header": "@@ -650,8 +681,26 @@ public class UnaryOperatorNode extends ValueNode",
"removed": [
"\t\t\tint numParams = 1 + addMethodParams(mb);",
"\t\t\tmb.callMethod(VMOpcode.INVOKEINTERFACE, (String) null, methodName, resultTypeName, numParams);"
]
},
{
"added": [
"\t\t\tmb.callMethod(VMOpcode.INVOKEINTERFACE, (String) null,",
"\t\t\t\tmethodName, resultTypeName, 0);"
],
"header": "@@ -659,8 +708,8 @@ public class UnaryOperatorNode extends ValueNode",
"removed": [
"\t\t\tint numParams = addMethodParams(mb);",
"\t\t\tmb.callMethod(VMOpcode.INVOKEINTERFACE, (String) null, methodName, resultTypeName, numParams);"
]
},
{
"added": [
" * Add some additional arguments to our method call for",
" * XML related operations like XMLPARSE and XMLSERIALIZE.",
" protected int addXmlOpMethodParams(ExpressionClassBuilder acb,",
"\t\tMethodBuilder mb) throws StandardException",
" if ((operatorType != XMLPARSE_OP) && (operatorType != XMLSERIALIZE_OP))",
" // nothing to do.",
" return 0;",
" // primitive types. Note: we don't have to save",
" // any objects for XMLSERIALIZE because it doesn't",
" // require any XML-specific objects: it just returns",
" // the serialized version of the XML value, which we",
" // already found when the XML value was created (ex.",
" // as part of the XMLPARSE work)."
],
"header": "@@ -738,25 +787,28 @@ public class UnaryOperatorNode extends ValueNode",
"removed": [
" * This method allows different operators to add",
" * primitive arguments to the generated method call,",
" * if needed.",
" protected int addMethodParams(MethodBuilder mb)",
" if (operatorType == XMLPARSE_OP) {",
" // We push whether or not we want to preserve whitespace.",
" mb.push(((Boolean)additionalArgs[0]).booleanValue());",
" return 1;",
" }",
" // primitive types."
]
}
]
}
] |
derby-DERBY-688-9f654e53
|
DERBY-688: Enhancements to XML functionality toward XPath/XQuery support
This revision contains d688_phase3_v1_code.patch and d688_phase3_v1_tests.patch
This patch was contributed by Army Brown (qozinx@gmail.com).
Attaching a "phase 3" patch that implements the XMLQUERY operator. The patch is in two parts:
- d688_phase3_v1_code.patch
- d688_phase3_v1_tests.patch
When committed, though, *both* patches should be committed together in
order to avoid test diffs.
The SQL parsing/compile time logic was added as part of the phase 2 patch;
this patch handles the execution-time logic by making the necessary Xalan
calls to evaluate an expression and to retrieve the results.
The phase 3 patch also adds logic to distinguish between two "types" of XML:
XML(DOCUMENT(ANY)) and XML(SEQUENCE), as defined in the SQL/XML[2006]
specification. The reason we need to distinguish between the two is that
the result of evaluating an XML query expression against an XML document
can be an arbitrary list of items including atomic values, attributes,
etc.--i.e. a sequence of items that is *not* required to form a valid
DOCUMENT node. For now, though, we only allow valid DOCUMENTs to be
inserted into XML columns, so we have to be able to look at the results
of the XMLQUERY operator to determine whether or not it's a valid DOCUMENT,
and if not we disallow insertion of that result into an XML column.
We can, however, keep the result transiently and pass it into other
operations that accept an XML value (namely, XMLSERIALIZE, which a user
can then use to retrieve the results in serialized form).
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@429847 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/iapi/types/SqlXmlUtil.java",
"hunks": [
{
"added": [
"import org.w3c.dom.Element;",
"import org.w3c.dom.NodeList;"
],
"header": "@@ -32,7 +32,9 @@ import java.io.StringReader;",
"removed": []
},
{
"added": [
" * the received xmlContext. Then if returnResults is false,",
" * return an empty sequence (ArrayList) if evaluation yields",
" * at least one item and return null if evaluation yields zero",
" * items (the caller can then just check for null to see if the",
" * query returned any items). If returnResults is true, then return",
" * return a sequence (ArrayList) containing all items returned",
" * from evaluation of the expression. This array list can contain",
" * any combination of atomic values and XML nodes; it may also",
" * be empty.",
" * the stored (compiled) query expression",
" * @param returnResults Whether or not to return the actual",
" * results of the query",
" * @param resultXType The qualified XML type of the result",
" * of evaluating the expression, if returnResults is true.",
" * If the result is a sequence of one Document or Element node",
" * then this will be XML(DOCUMENT(ANY)); else it will be",
" * XML(SEQUENCE). If returnResults is false, this value",
" * is ignored.",
" * @return If returnResults is false then return an empty",
" * ArrayList if evaluation returned at least one item and return",
" * null otherwise. If returnResults is true then return an",
" * array list containing all of the result items and return",
" * the qualified XML type via the resultXType parameter.",
" protected ArrayList evalXQExpression(XMLDataValue xmlContext,",
" boolean returnResults, int [] resultXType) throws Exception"
],
"header": "@@ -285,21 +287,39 @@ public class SqlXmlUtil",
"removed": [
" * the received xmlContext and return whether or not at least",
" * one item in the xmlContext is returned.",
" * the stored (compiled) query expression.",
" * @return True if evaluation returned at least one item,",
" * false otherwise.",
" protected boolean evalXQExpression(XMLDataValue xmlContext)",
" throws Exception"
]
},
{
"added": [
" /* Create a DOM node from the xmlContext, since that's how",
" * we feed the context to Xalan. We do this by creating",
" * a Document node using DocumentBuilder, which means that",
" * the serialized form of the context node must be a string",
" * value that is parse-able by DocumentBuilder--i.e. it must",
" * constitute a valid XML document. If that's true then",
" * the context item's qualified type will be DOC_ANY.",
" */",
" if (xmlContext.getXType() != XML.XML_DOC_ANY)",
" {",
" throw StandardException.newException(",
" SQLState.LANG_INVALID_XML_CONTEXT_ITEM,",
" (returnResults ? \"XMLQUERY\" : \"XMLEXISTS\"));",
" } ",
""
],
"header": "@@ -308,8 +328,21 @@ public class SqlXmlUtil",
"removed": [
" // Create a DOM node from the xmlContext, since that's how",
" // we feed the context to Xalan."
]
}
]
},
{
"file": "java/engine/org/apache/derby/iapi/types/XML.java",
"hunks": [
{
"added": [
"import java.util.ArrayList;",
""
],
"header": "@@ -46,6 +46,8 @@ import java.io.ObjectOutput;",
"removed": []
},
{
"added": [
" // Some syntax-related constants used to determine",
" // operator behavior.",
" public static final short XQ_PASS_BY_REF = 1;",
" public static final short XQ_PASS_BY_VALUE = 2;",
" public static final short XQ_RETURN_SEQUENCE = 3;",
" public static final short XQ_RETURN_CONTENT = 4;",
" public static final short XQ_EMPTY_ON_EMPTY = 5;",
" public static final short XQ_NULL_ON_EMPTY = 6;",
"",
" /* Per SQL/XML[2006] 4.2.2, there are several different",
" * XML \"types\" defined through use of primary and secondary",
" * \"type modifiers\". For Derby we only support two kinds:",
" *",
" * XML(DOCUMENT(ANY)) : A valid and well-formed XML",
" * document as defined by W3C, meaning that there is",
" * exactly one root element node. This is the only",
" * type of XML that can be stored into a Derby XML",
" * column. This is also the type returned by a call",
" * to XMLPARSE since we require the DOCUMENT keyword.",
" *",
" * XML(SEQUENCE): A sequence of items (could be nodes or",
" * atomic values). This is the type returned from an",
" * XMLQUERY operation. Any node that is XML(DOCUMENT(ANY))",
" * is also XML(SEQUENCE). Note that an XML(SEQUENCE)",
" * value is *only* storable into a Derby XML column",
" * if it is also an XML(DOCUMENT(ANY)). See the",
" * normalize method below for the code that enforces",
" * this.",
" */",
" public static final int XML_DOC_ANY = 0;",
" public static final int XML_SEQUENCE = 1;",
"",
" // The fully-qualified type for this XML value.",
" private int xType;"
],
"header": "@@ -76,14 +78,40 @@ public class XML",
"removed": [
"\t// Some syntax-related constants used to determine",
"\t// operator behavior.",
"\tpublic static final short XQ_PASS_BY_REF = 1;",
"\tpublic static final short XQ_PASS_BY_VALUE = 2;",
"\tpublic static final short XQ_RETURN_SEQUENCE = 3;",
"\tpublic static final short XQ_RETURN_CONTENT = 4;",
"\tpublic static final short XQ_EMPTY_ON_EMPTY = 5;",
"\tpublic static final short XQ_NULL_ON_EMPTY = 6;"
]
},
{
"added": [
" xType = -1;"
],
"header": "@@ -112,6 +140,7 @@ public class XML",
"removed": []
},
{
"added": [
" xType = -1;",
" }",
"",
" /**",
" * Private constructor used for the getClone() method.",
" * Takes a SQLChar and clones it and also takes a",
" * qualified XML type and stores that as this XML",
" * object's qualified type.",
" * @param val A SQLChar instance to clone and use for",
" * this XML value.",
" * @param qualXType Qualified XML type.",
" */",
" private XML(SQLChar val, int xmlType)",
" {",
" xmlStringValue = (val == null ? null : (SQLChar)val.getClone());",
" setXType(xmlType);"
],
"header": "@@ -123,6 +152,22 @@ public class XML",
"removed": []
},
{
"added": [
" return new XML(xmlStringValue, getXType());"
],
"header": "@@ -134,7 +179,7 @@ public class XML",
"removed": [
" return new XML(xmlStringValue);"
]
},
{
"added": [
"",
" // If we read it from disk then it must have type",
" // XML_DOC_ANY because that's all we allow to be",
" // written into an XML column.",
" setXType(XML_DOC_ANY);",
" * @see DataValueDescriptor#setFrom",
" *",
" * Note: ",
" String strVal = theValue.getString();",
" if (strVal == null)",
" {",
" xmlStringValue = null;",
"",
" // Null is a valid value for DOCUMENT(ANY)",
" setXType(XML_DOC_ANY);",
" return;",
" }",
"",
" // Here we just store the received value locally.",
" xmlStringValue.setValue(strVal);",
"",
" /*",
" * Assumption is that if theValue is not an XML",
" * value then the caller is aware of whether or",
" * not theValue constitutes a valid XML(DOCUMENT(ANY))",
" * and will behave accordingly (see in particular the",
" * XMLQuery method of this class, which calls the",
" * setValue() method of XMLDataValue which in turn",
" * brings us to this method).",
" */",
" if (theValue instanceof XMLDataValue)",
" \tsetXType(((XMLDataValue)theValue).getXType());"
],
"header": "@@ -206,16 +251,47 @@ public class XML",
"removed": [
" xmlStringValue.setValue(theValue.getString());"
]
},
{
"added": [
" /**",
" * Normalization method - this method will always be called when",
" * storing an XML value into an XML column, for example, when",
" * inserting/updating. We always force normalization in this",
" * case because we need to make sure the qualified type of the",
" * value we're trying to store is XML_DOC_ANY--we don't allow",
" * anything else.",
" *",
" * @param desiredType The type to normalize the source column to",
" * @param source The value to normalize",
" *",
" * @exception StandardException Thrown if source is not",
" * XML_DOC_ANY.",
" */",
" public void normalize(",
" DataTypeDescriptor desiredType,",
" DataValueDescriptor source)",
" throws StandardException",
" {",
" if (SanityManager.DEBUG) {",
" SanityManager.ASSERT(source instanceof XMLDataValue,",
" \"Tried to store non-XML value into XML column; \" +",
" \"should have thrown error at compile time.\");",
" }",
"",
" if (((XMLDataValue)source).getXType() != XML_DOC_ANY) {",
" throw StandardException.newException(",
" SQLState.LANG_INVALID_XML_COLUMN_ASSIGN);",
" }",
"",
" ((DataValueDescriptor) this).setValue(source);",
" return;",
"",
" }",
""
],
"header": "@@ -281,6 +357,41 @@ public class XML",
"removed": []
},
{
"added": [
"",
" // If we read it from disk then it must have type",
" // XML_DOC_ANY because that's all we allow to be",
" // written into an XML column.",
" setXType(XML_DOC_ANY);"
],
"header": "@@ -330,6 +441,11 @@ public class XML",
"removed": []
},
{
"added": [
"",
" // If we read it from disk then it must have type",
" // XML_DOC_ANY because that's all we allow to be",
" // written into an XML column.",
" setXType(XML_DOC_ANY);"
],
"header": "@@ -390,6 +506,11 @@ public class XML",
"removed": []
},
{
"added": [
" setXType(XML_DOC_ANY);"
],
"header": "@@ -450,6 +571,7 @@ public class XML",
"removed": []
},
{
"added": [
" return new SQLBoolean(null !=",
" sqlxUtil.evalXQExpression(this, false, new int[1]));"
],
"header": "@@ -558,7 +680,8 @@ public class XML",
"removed": [
" return new SQLBoolean(sqlxUtil.evalXQExpression(this));"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/ResultColumn.java",
"hunks": [
{
"added": [
"",
"\t\t// Are we inserting/updating an XML column? If so, we always",
"\t\t// return false so that normalization will occur. We have to",
"\t\t// do this because there are different \"kinds\" of XML values",
"\t\t// and we need to make sure they match--but we don't know",
"\t\t// the \"kind\" until execution time. See the \"normalize\"",
"\t\t// method in org.apache.derby.iapi.types.XML for more.",
"\t\tif (resultColumnType.getTypeId().isXMLTypeId())",
"\t\t\treturn false;",
""
],
"header": "@@ -975,6 +975,16 @@ public class ResultColumn extends ValueNode",
"removed": []
}
]
}
] |
derby-DERBY-688-e1858949
|
DERBY-688: Enhancements to XML functionality toward XPath/XQuery support
This patch was contributed by Army Brown (qozinx@gmail.com)
This change contains d688_phase6_v1.patch, which changes the SQLSTATEs for
XML errors to match the SQL/XML specification where possible, and that
moves the Derby-specific XML sql states to a compile-time range
(42Z70 - 42Z7Z) instead of an execution-time range (X0Xxx).
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@433450 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/iapi/types/XML.java",
"hunks": [
{
"added": [
" SQLState.LANG_NOT_AN_XML_DOCUMENT);"
],
"header": "@@ -377,7 +377,7 @@ public class XML",
"removed": [
" SQLState.LANG_INVALID_XML_COLUMN_ASSIGN);"
]
},
{
"added": [
" SQLState.LANG_INVALID_XML_DOCUMENT, xe);"
],
"header": "@@ -559,7 +559,7 @@ public class XML",
"removed": [
" SQLState.LANG_NOT_AN_XML_DOCUMENT, xe);"
]
},
{
"added": [
" // Failed somewhere during evaluation of the XML query expression;",
" // turn error into a StandardException and throw it.",
" SQLState.LANG_XML_QUERY_ERROR, xe, \"XMLEXISTS\");"
],
"header": "@@ -677,13 +677,13 @@ public class XML",
"removed": [
" // We don't expect to get here. Turn it into a StandardException",
" // (if needed), then throw it.",
" SQLState.LANG_UNEXPECTED_XML_EXCEPTION, xe);"
]
}
]
},
{
"file": "java/shared/org/apache/derby/shared/common/reference/SQLState.java",
"hunks": [
{
"added": [
"\t\t<LI> 2200J-2200R for SQL/XML errors (based on SQL/XML[2006]) </LI>"
],
"header": "@@ -119,7 +119,7 @@ package org.apache.derby.shared.common.reference;",
"removed": [
"\t\t<LI> 2200J-2200R for SQL/XML errors (based on SQL/XML[2003]) </LI>"
]
},
{
"added": [
"\t** 2200J-00R - For SQL/XML errors (based on SQL/XML[2006])."
],
"header": "@@ -576,7 +576,7 @@ public interface SQLState {",
"removed": [
"\t** 2200J-00R - For SQL/XML errors (based on SQL/XML[2003])."
]
},
{
"added": [
"\t// From SQL/XML[2006] spec; there are others, but",
"\tString LANG_XML_QUERY_ERROR = \"10000\";",
"\tString LANG_INVALID_XML_DOCUMENT = \"2200M\";",
"\tString LANG_INVALID_XML_CONTEXT_ITEM = \"2200V\";"
],
"header": "@@ -698,10 +698,13 @@ public interface SQLState {",
"removed": [
"\t// From SQL/XML[2003] spec; there are others, but"
]
},
{
"added": [
"\t// 42Z70 - 42Z7Z: For Derby-specific XML compilation errors",
"\t// (not defined by SQL/XML standard).",
"\tString LANG_ATTEMPT_TO_BIND_XML = \"42Z70\";",
"\tString LANG_ATTEMPT_TO_SELECT_XML = \"42Z71\";",
"\tString LANG_XML_KEYWORD_MISSING = \"42Z72\";",
"\tString LANG_INVALID_XMLSERIALIZE_TYPE = \"42Z73\";",
"\tString LANG_UNSUPPORTED_XML_FEATURE = \"42Z74\";",
"\tString LANG_INVALID_XML_QUERY_EXPRESSION = \"42Z75\";",
"\tString LANG_MULTIPLE_XML_CONTEXT_ITEMS = \"42Z76\";",
"\tString LANG_INVALID_CONTEXT_ITEM_TYPE = \"42Z77\";",
"\tString LANG_MISSING_XML_CLASSES = \"42Z78\";",
"\tString LANG_XMLPARSE_UNKNOWN_PARAM_TYPE = \"42Z79\";",
"\tString LANG_UNEXPECTED_XML_EXCEPTION = \"42Z7Z\";",
""
],
"header": "@@ -967,6 +970,20 @@ public interface SQLState {",
"removed": []
}
]
}
] |
derby-DERBY-688-f67c2ee7
|
DERBY-688: Enhancements to XML functionality toward XPath/XQuery support
This patch was submitted by Army Brown (qozinx@gmail.com)
Attaching a "phase 7" patch, d688_phase7_v1.patch, that does the following:
1 - Makes changes to catch all "Throwable" errors that might be
thrown by Xalan or JAXP, instead of just catching the exceptions
declared by the APIs. This is per the email thread here:
http://www.nabble.com/xalan-assertion-when-execution-a-xml-query...-tf2149830.html#a5953476
This allows Derby to continue working as normal if/when an
unexpected Xalan/JAXP error (such NPE or assertion failure)
occurs. In that case the statement itself will fail and the
error will be printed, but Derby will continue to work as
expected after the failure.
2 - Slight change so that, in the event of an unexpected Xalan
compilation error, the name of the operator that encountered
the error will be printed as part of Derby's message. Currently
the operator name isn't passed in and thus "{0}" shows up
in the error message, which is incorrect.
3 - Fixes a small bug in XML query execution code that was leading
to NPEs in Xalan. Namely, the current code passes a null argument
into Xalan where a non-null is expected (and required) for namespace
prefix resolution.
4 - Makes the first of two changes required to ensure Derby SQL/XML
support agrees with the specification. The two changes are
mentioned in my previous comments; this phase 7 patch addresses
the first one (insertion of a non-Document node into a Derby XML
column should not be allowed).
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@434556 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/iapi/types/SqlXmlUtil.java",
"hunks": [
{
"added": [
"import org.apache.xml.utils.PrefixResolverDefault;",
""
],
"header": "@@ -56,6 +56,8 @@ import org.apache.xpath.XPathContext;",
"removed": []
},
{
"added": [
" } catch (Throwable t) {",
"",
" /* Must be something caused by JAXP or Xalan; wrap it in a",
" * StandardException and rethrow it. Note: we catch \"Throwable\"",
" * here to catch as many external errors as possible in order",
" * to minimize the chance of an uncaught JAXP/Xalan error (such",
" * as a NullPointerException) causing Derby to fail in a more",
" * serious way. In particular, an uncaught Java exception",
" * like NPE can result in Derby throwing \"ERROR 40XT0: An",
" * internal error was identified by RawStore module\" for all",
" * statements on the connection after the failure--which we",
" * clearly don't want. If we catch the error and wrap it,",
" * though, the statement will fail but Derby will continue to",
" * run as normal.",
" */ ",
" SQLState.LANG_UNEXPECTED_XML_EXCEPTION, t);"
],
"header": "@@ -203,12 +205,23 @@ public class SqlXmlUtil",
"removed": [
" } catch (Exception e) {",
"",
" // Must be something caused by JAXP or Xalan; wrap it in a",
" // StandardException and rethrow it.",
" SQLState.LANG_UNEXPECTED_XML_EXCEPTION, e);"
]
},
{
"added": [
" public void compileXQExpr(String queryExpr, String opName)",
" /* The following XPath constructor compiles the expression",
" * as part of the construction process. We have to pass",
" * in a PrefixResolver object in order to avoid NPEs when",
" * invalid/unknown functions are used, so we just create",
" * a dummy one, which means prefixes will not be resolved",
" * in the query (Xalan will just throw an error if a prefix",
" * is used). In the future we may want to revisit this",
" * to make it easier for users to query based on namespaces.",
" */",
" query = new XPath(queryExpr, null,",
" new PrefixResolverDefault(dBuilder.newDocument()),",
" XPath.SELECT);",
"",
" } catch (Throwable te) {",
"",
" /* Something went wrong during compilation of the",
" * expression; wrap the error and re-throw it.",
" * Note: we catch \"Throwable\" here to catch as many",
" * Xalan-produced errors as possible in order to",
" * minimize the chance of an uncaught Xalan error",
" * (such as a NullPointerException) causing Derby",
" * to fail in a more serious way. In particular, an",
" * uncaught Java exception like NPE can result in",
" * Derby throwing \"ERROR 40XT0: An internal error was",
" * identified by RawStore module\" for all statements on",
" * the connection after the failure--which we clearly",
" * don't want. If we catch the error and wrap it,",
" * though, the statement will fail but Derby will",
" * continue to run as normal. ",
" */",
" SQLState.LANG_XML_QUERY_ERROR, te, opName);"
],
"header": "@@ -225,21 +238,43 @@ public class SqlXmlUtil",
"removed": [
" public void compileXQExpr(String queryExpr)",
" // The following XPath constructor compiles the expression",
" // as part of the construction process.",
" query = new XPath(queryExpr, null, null, XPath.SELECT);",
"",
" } catch (TransformerException te) {",
"",
" // Something went wrong during compilation of the",
" // expression; wrap the error and re-throw it.",
" SQLState.LANG_XML_QUERY_ERROR, te);"
]
},
{
"added": [
" * If the result is a sequence of exactly one Document node"
],
"header": "@@ -344,7 +379,7 @@ public class SqlXmlUtil",
"removed": [
" * If the result is a sequence of one Document or Element node"
]
}
]
},
{
"file": "java/engine/org/apache/derby/iapi/types/XML.java",
"hunks": [
{
"added": [
" } catch (Throwable t) {",
" /* Couldn't parse the XML document. Throw a StandardException",
" * with the parse exception (or other error) nested in it.",
" * Note: we catch \"Throwable\" here to catch as many external",
" * errors as possible in order to minimize the chance of an",
" * uncaught JAXP/Xalan error (such as a NullPointerException)",
" * causing Derby to fail in a more serious way. In particular,",
" * an uncaught Java exception like NPE can result in Derby",
" * throwing \"ERROR 40XT0: An internal error was identified by",
" * RawStore module\" for all statements on the connection after",
" * the failure--which we clearly don't want. If we catch the",
" * error and wrap it, though, the statement will fail but Derby",
" * will continue to run as normal.",
" */ ",
" SQLState.LANG_INVALID_XML_DOCUMENT, t);",
""
],
"header": "@@ -555,11 +555,23 @@ public class XML",
"removed": [
" } catch (Exception xe) {",
" // Couldn't parse the XML document. Throw a StandardException",
" // with the parse exception nested in it.",
" SQLState.LANG_INVALID_XML_DOCUMENT, xe);"
]
},
{
"added": [
" } catch (StandardException se) {",
"",
" // Just re-throw it.",
" throw se;",
"",
" } catch (Throwable xe) {",
" /* Failed somewhere during evaluation of the XML query expression;",
" * turn error into a StandardException and throw it. Note: we",
" * catch \"Throwable\" here to catch as many Xalan-produced errors",
" * as possible in order to minimize the chance of an uncaught Xalan",
" * error (such as a NullPointerException) causing Derby to fail in",
" * a more serious way. In particular, an uncaught Java exception",
" * like NPE can result in Derby throwing \"ERROR 40XT0: An internal",
" * error was identified by RawStore module\" for all statements on",
" * the connection after the failure--which we clearly don't want. ",
" * If we catch the error and wrap it, though, the statement will",
" * fail but Derby will continue to run as normal. ",
" */",
" throw StandardException.newException(",
" SQLState.LANG_XML_QUERY_ERROR, xe, \"XMLEXISTS\");"
],
"header": "@@ -676,15 +688,26 @@ public class XML",
"removed": [
" } catch (Exception xe) {",
" // Failed somewhere during evaluation of the XML query expression;",
" // turn error into a StandardException and throw it.",
" if (xe instanceof StandardException)",
" throw (StandardException)xe;",
" else {",
" throw StandardException.newException(",
" SQLState.LANG_XML_QUERY_ERROR, xe, \"XMLEXISTS\");",
" }"
]
}
]
}
] |
derby-DERBY-6880-21044de3
|
DERBY-6880: Update failing with java.sql.SQLDataException
This change reverts part of the changes made by revision 1628596 for DERBY-6742.
Specifically, the section of code added to UpdateResultSet.collectAffectedRows
is removed. That code caused problems with certain SQL UPDATE statements
which were compiled with Statement.RETURN_GENERATED_KEYS. The new test cases
added by this change include several examples of such SQL statements.
The JDBC documentation for the intended behavior of UPDATE statements with the
RETURN_GENERATED_KEYS option is unclear; the intended behavior is much
clearer with INSERT statements. Given that I don't understand the intended
behavior, it seems safer to me to return Derby to the previous state for
UPDATE statements; namely, that no attempt is made to compute the set of
generated keys for an UPDATE statement.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1741380 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-6881-349d2a29
|
DERBY-6881: Test failures with JDK 9-ea b111
ClassLoaderTestSetup casts the context class loader to URLClassLoader
in order to create a new URLClassLoader with the same URLs as the
original class loader. In JDK 9, the context class loader is no longer
a URLClassLoader after JEP 261. This code now results in a
ClassCastException.
The point of ClassLoaderTestSetup is to change the context class
loader to something which is not the system class loader. It does not
have to be a clone of the original context class loader. This patch
therefore changes ClassLoaderTestSetup so that it sets the context
class loader to an empty URLClassLoader which wraps the system class
loader. This avoids the unreliable cast and the resulting
ClassCastException.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1737188 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/testing/org/apache/derbyTesting/junit/ClassLoaderTestSetup.java",
"hunks": [
{
"added": [],
"header": "@@ -24,7 +24,6 @@ import java.net.URLClassLoader;",
"removed": [
"import org.apache.derbyTesting.functionTests.tests.upgradeTests.UpgradeClassLoader;"
]
},
{
"added": [
" private static ClassLoader makeClassLoader() {",
" PrivilegedAction<ClassLoader> pa = () -> new URLClassLoader(new URL[0]);",
" return AccessController.doPrivileged(pa);"
],
"header": "@@ -45,15 +44,9 @@ public class ClassLoaderTestSetup extends BaseJDBCTestSetup {",
"removed": [
" private static ClassLoader makeClassLoader(final ClassLoader old) {",
" return AccessController.doPrivileged(",
" new PrivilegedAction<URLClassLoader>() {",
" @Override",
" public URLClassLoader run() {",
" URL[] jars = ((URLClassLoader)old).getURLs();",
" return new URLClassLoader(jars, null);",
" }",
" });"
]
},
{
"added": [
" setThreadLoader(makeClassLoader());"
],
"header": "@@ -61,7 +54,7 @@ public class ClassLoaderTestSetup extends BaseJDBCTestSetup {",
"removed": [
" setThreadLoader(makeClassLoader(oldLoader));"
]
}
]
}
] |
derby-DERBY-6882-5b838fd0
|
DERBY-6882: Add ALTER TABLE ALTER COLUMN ... SET GENERATED functionality, which switches an identity column from ALWAYS to BY DEFAULT and vice-versa.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1738368 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/sql/compile/ColumnDefinitionNode.java",
"hunks": [
{
"added": [
"\t//alter table command to change the ALWAYS vs DEFAULT nature of an autoinc column",
"\tpublic static final int MODIFY_AUTOINCREMENT_ALWAYS_VS_DEFAULT = 3;"
],
"header": "@@ -86,6 +86,8 @@ public class ColumnDefinitionNode extends TableElementNode",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/ModifyColumnNode.java",
"hunks": [
{
"added": [
" final static int K_MODIFY_COLUMN_GENERATED_ALWAYS = 5;",
" final static int K_MODIFY_COLUMN_GENERATED_BY_DEFAULT = 6;"
],
"header": "@@ -54,6 +54,8 @@ class ModifyColumnNode extends ColumnDefinitionNode",
"removed": []
},
{
"added": [
" case K_MODIFY_COLUMN_GENERATED_ALWAYS:",
" return ColumnInfo.MODIFY_COLUMN_GENERATED_ALWAYS;",
"",
" case K_MODIFY_COLUMN_GENERATED_BY_DEFAULT:",
" return ColumnInfo.MODIFY_COLUMN_GENERATED_BY_DEFAULT;",
""
],
"header": "@@ -317,6 +319,12 @@ class ModifyColumnNode extends ColumnDefinitionNode",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/execute/AlterTableConstantAction.java",
"hunks": [
{
"added": [
"\t\t\t\t}",
"\t\t\t\telse if (",
" (columnInfo[ix].action == ColumnInfo.MODIFY_COLUMN_GENERATED_ALWAYS) ||",
" (columnInfo[ix].action == ColumnInfo.MODIFY_COLUMN_GENERATED_BY_DEFAULT)",
" )",
"\t\t\t\t{",
" modifyIdentityState(ix);"
],
"header": "@@ -531,6 +531,13 @@ class AlterTableConstantAction extends DDLSingleTableConstantAction",
"removed": []
}
]
}
] |
derby-DERBY-6885-bb5be6f1
|
DERBY-6885: Remove ReuseFactory
The methods getInteger(), getShort(), getByte(), getLong() and
getBoolean() are now simple wrappers around Integer.valueOf(),
Short.valueOf(), and so on. They no longer have any purpose, and can
be removed. Callers can either call the corresponding valueOf() method
directly or rely on auto-boxing (which use valueOf() implicitly).
The remaining method, getZeroLenByteArray(), which returns a static
instance of an empty byte array, is replaced with a static final field
in the ArrayUtil class.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1740842 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/iapi/services/io/ArrayInputStream.java",
"hunks": [
{
"added": [],
"header": "@@ -27,10 +27,6 @@ import java.io.EOFException;",
"removed": [
"import org.apache.derby.iapi.services.io.LimitObjectInput;",
"import org.apache.derby.iapi.services.io.ErrorObjectInput;",
"import org.apache.derby.iapi.util.ReuseFactory;",
""
]
}
]
},
{
"file": "java/engine/org/apache/derby/iapi/services/io/FormatableBitSet.java",
"hunks": [
{
"added": [],
"header": "@@ -21,9 +21,7 @@",
"removed": [
"import org.apache.derby.iapi.services.io.ArrayUtil;",
"import org.apache.derby.iapi.util.ReuseFactory;"
]
}
]
},
{
"file": "java/engine/org/apache/derby/iapi/types/SQLTimestamp.java",
"hunks": [
{
"added": [],
"header": "@@ -27,13 +27,11 @@ import org.apache.derby.iapi.error.StandardException;",
"removed": [
"import org.apache.derby.iapi.services.context.ContextService;",
"import org.apache.derby.iapi.util.ReuseFactory;"
]
},
{
"added": [
" throw StandardException.newException(SQLState.LANG_INVALID_FUNCTION_ARGUMENT, intervalType,"
],
"header": "@@ -1056,8 +1054,7 @@ public final class SQLTimestamp extends DataType",
"removed": [
" throw StandardException.newException( SQLState.LANG_INVALID_FUNCTION_ARGUMENT,",
" ReuseFactory.getInteger( intervalType),"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/GenericPreparedStatement.java",
"hunks": [
{
"added": [],
"header": "@@ -63,7 +63,6 @@ import org.apache.derby.iapi.sql.execute.ExecPreparedStatement;",
"removed": [
"import org.apache.derby.iapi.util.ReuseFactory;"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/GenericResultDescription.java",
"hunks": [
{
"added": [],
"header": "@@ -21,7 +21,6 @@",
"removed": [
"import org.apache.derby.iapi.reference.SQLState;"
]
},
{
"added": [],
"header": "@@ -29,9 +28,7 @@ import org.apache.derby.shared.common.sanity.SanityManager;",
"removed": [
"import org.apache.derby.iapi.services.io.FormatIdUtil;",
"import org.apache.derby.iapi.util.ReuseFactory;"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/CastNode.java",
"hunks": [
{
"added": [],
"header": "@@ -41,7 +41,6 @@ import org.apache.derby.iapi.types.DataValueDescriptor;",
"removed": [
"import org.apache.derby.iapi.util.ReuseFactory;"
]
},
{
"added": [
" (byte) longValue,"
],
"header": "@@ -614,7 +613,7 @@ class CastNode extends ValueNode",
"removed": [
" ReuseFactory.getByte((byte) longValue),"
]
},
{
"added": [
" (short) longValue,"
],
"header": "@@ -625,8 +624,7 @@ class CastNode extends ValueNode",
"removed": [
" ReuseFactory.getShort(",
" (short) longValue),"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/ColumnOrdering.java",
"hunks": [
{
"added": [],
"header": "@@ -24,7 +24,6 @@ package org.apache.derby.impl.sql.compile;",
"removed": [
"import org.apache.derby.iapi.util.ReuseFactory;"
]
},
{
"added": [
" tables.add(tableNumber);",
" columns.add(columnNumber);"
],
"header": "@@ -110,8 +109,8 @@ class ColumnOrdering {",
"removed": [
" tables.add(ReuseFactory.getInteger(tableNumber));",
" columns.add(ReuseFactory.getInteger(columnNumber));"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/CompilerContextImpl.java",
"hunks": [
{
"added": [],
"header": "@@ -67,7 +67,6 @@ import org.apache.derby.iapi.store.access.SortCostController;",
"removed": [
"import org.apache.derby.iapi.util.ReuseFactory;"
]
},
{
"added": [
" Long conglomNum = conglomerateNumber;"
],
"header": "@@ -429,7 +428,7 @@ public class CompilerContextImpl extends ContextImpl",
"removed": [
" Long conglomNum = ReuseFactory.getLong(conglomerateNumber);"
]
},
{
"added": [
"\t\tprivTypeStack.add(currPrivType);"
],
"header": "@@ -700,7 +699,7 @@ public class CompilerContextImpl extends ContextImpl",
"removed": [
"\t\tprivTypeStack.add(ReuseFactory.getInteger(currPrivType));"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/DeleteNode.java",
"hunks": [
{
"added": [],
"header": "@@ -24,7 +24,6 @@ package\torg.apache.derby.impl.sql.compile;",
"removed": [
"import java.util.Iterator;"
]
},
{
"added": [],
"header": "@@ -54,7 +53,6 @@ import org.apache.derby.iapi.sql.dictionary.TriggerDescriptor;",
"removed": [
"import org.apache.derby.iapi.util.ReuseFactory;"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/FromList.java",
"hunks": [
{
"added": [],
"header": "@@ -35,7 +35,6 @@ import org.apache.derby.iapi.sql.compile.Optimizer;",
"removed": [
"import org.apache.derby.iapi.util.ReuseFactory;"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/HashJoinStrategy.java",
"hunks": [
{
"added": [],
"header": "@@ -42,7 +42,6 @@ import org.apache.derby.iapi.sql.dictionary.DataDictionary;",
"removed": [
"import org.apache.derby.iapi.util.ReuseFactory;"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/IntersectOrExceptNode.java",
"hunks": [
{
"added": [],
"header": "@@ -38,7 +38,6 @@ import org.apache.derby.iapi.sql.compile.RowOrdering;",
"removed": [
"import org.apache.derby.iapi.util.ReuseFactory;"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/OrderedColumnList.java",
"hunks": [
{
"added": [],
"header": "@@ -23,7 +23,6 @@ package\torg.apache.derby.impl.sql.compile;",
"removed": [
"import org.apache.derby.iapi.util.ReuseFactory;"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/Predicate.java",
"hunks": [
{
"added": [],
"header": "@@ -33,7 +33,6 @@ import org.apache.derby.iapi.sql.compile.Visitor;",
"removed": [
"import org.apache.derby.iapi.util.ReuseFactory;"
]
},
{
"added": [
" searchClauses.contains(ro.getOperator());"
],
"header": "@@ -551,7 +550,7 @@ public final class Predicate extends QueryTreeNode implements OptimizablePredica",
"removed": [
" searchClauses.contains(ReuseFactory.getInteger(ro.getOperator()));"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/TernaryOperatorNode.java",
"hunks": [
{
"added": [],
"header": "@@ -38,7 +38,6 @@ import org.apache.derby.iapi.sql.compile.Visitor;",
"removed": [
"import org.apache.derby.iapi.util.ReuseFactory;"
]
},
{
"added": [
" rightOperand.getTypeId().getSQLTypeName(), 2,"
],
"header": "@@ -892,8 +891,7 @@ class TernaryOperatorNode extends OperatorNode",
"removed": [
" rightOperand.getTypeId().getSQLTypeName(),",
" ReuseFactory.getInteger( 2),"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/UpdateNode.java",
"hunks": [
{
"added": [],
"header": "@@ -55,7 +55,6 @@ import org.apache.derby.iapi.sql.execute.ExecPreparedStatement;",
"removed": [
"import org.apache.derby.iapi.util.ReuseFactory;"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/execute/BaseActivation.java",
"hunks": [
{
"added": [],
"header": "@@ -81,7 +81,6 @@ import org.apache.derby.iapi.types.DataValueFactory;",
"removed": [
"import org.apache.derby.iapi.util.ReuseFactory;"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/store/access/RAMTransaction.java",
"hunks": [
{
"added": [],
"header": "@@ -27,7 +27,6 @@ import java.util.Iterator;",
"removed": [
"import org.apache.derby.iapi.util.ReuseFactory;"
]
},
{
"added": [],
"header": "@@ -68,8 +67,6 @@ import org.apache.derby.iapi.store.raw.ContainerHandle;",
"removed": [
"import org.apache.derby.iapi.store.raw.Page;",
"import org.apache.derby.iapi.store.raw.PageKey;"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/store/raw/RawStore.java",
"hunks": [
{
"added": [],
"header": "@@ -58,12 +58,10 @@ import org.apache.derby.iapi.util.StringUtil;",
"removed": [
"import org.apache.derby.io.StorageRandomAccessFile;",
"import org.apache.derby.iapi.util.ReuseFactory;"
]
},
{
"added": [],
"header": "@@ -72,7 +70,6 @@ import org.apache.derby.iapi.reference.Property;",
"removed": [
"import java.security.PrivilegedExceptionAction;"
]
},
{
"added": [],
"header": "@@ -81,7 +78,6 @@ import java.io.Serializable;",
"removed": [
"import java.io.OutputStream;"
]
},
{
"added": [
" return actionRegularFile.exists();",
" return actionStorageFile.exists();",
" return actionRegularFile.delete();",
" return actionStorageFile.delete();"
],
"header": "@@ -2720,16 +2716,16 @@ public final class RawStore implements RawStoreFactory, ModuleControl, ModuleSup",
"removed": [
" return ReuseFactory.getBoolean(actionRegularFile.exists());",
" return ReuseFactory.getBoolean(actionStorageFile.exists());",
" return ReuseFactory.getBoolean(actionRegularFile.delete());",
" return ReuseFactory.getBoolean(actionStorageFile.delete());"
]
},
{
"added": [
" return created;",
" return actionRegularFile.isDirectory();",
" return FileUtil.removeDirectory(actionRegularFile);",
" return actionRegularFile.renameTo(actionRegularFile2);",
" return FileUtil.copyDirectory(",
" storageFactory, actionStorageFile, actionRegularFile,",
" actionBuffer, actionFilter, actionCopySubDirs);",
" return FileUtil.copyDirectory(",
" (WritableStorageFactory) storageFactory, actionRegularFile,",
" actionStorageFile, actionBuffer, actionFilter);",
" return FileUtil.copyFile((WritableStorageFactory) storageFactory,",
" actionRegularFile, actionStorageFile);"
],
"header": "@@ -2737,42 +2733,36 @@ public final class RawStore implements RawStoreFactory, ModuleControl, ModuleSup",
"removed": [
" return ReuseFactory.getBoolean(created);",
" return ReuseFactory.getBoolean(actionRegularFile.isDirectory());",
" return ReuseFactory.getBoolean(FileUtil.removeDirectory(actionRegularFile));",
" return ReuseFactory.getBoolean(actionRegularFile.renameTo(actionRegularFile2));",
" return ReuseFactory.getBoolean(FileUtil.copyDirectory(storageFactory,",
" actionStorageFile,",
" actionRegularFile,",
" actionBuffer,",
" actionFilter,",
" actionCopySubDirs));",
" return ReuseFactory.getBoolean(FileUtil.copyDirectory((WritableStorageFactory)storageFactory,",
" actionRegularFile,",
" actionStorageFile,",
" actionBuffer,",
" actionFilter));",
" return ReuseFactory.getBoolean(FileUtil.copyFile((WritableStorageFactory) storageFactory,",
" actionRegularFile,",
" actionStorageFile));"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/store/raw/data/BaseDataFileFactory.java",
"hunks": [
{
"added": [],
"header": "@@ -78,7 +78,6 @@ import org.apache.derby.iapi.util.ByteArray;",
"removed": [
"import org.apache.derby.iapi.util.ReuseFactory;"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/store/raw/data/EncryptOrDecryptData.java",
"hunks": [
{
"added": [],
"header": "@@ -33,7 +33,6 @@ import org.apache.derby.iapi.store.access.TransactionController;",
"removed": [
"import org.apache.derby.iapi.util.ReuseFactory;"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/store/raw/data/RAFContainer.java",
"hunks": [
{
"added": [],
"header": "@@ -28,7 +28,6 @@ import org.apache.derby.iapi.services.io.FormatIdUtil;",
"removed": [
"import org.apache.derby.iapi.util.ReuseFactory;"
]
},
{
"added": [
" PrivilegedAction<Boolean> pa = () ->",
" FileUtil.copyFile(dataFactory.getStorageFactory(), from, to);",
" boolean success = AccessController.doPrivileged(pa);",
" if (!success) {"
],
"header": "@@ -833,15 +832,10 @@ class RAFContainer extends FileContainer implements PrivilegedExceptionAction<Ob",
"removed": [
" Boolean success = AccessController.doPrivileged(",
" new PrivilegedAction<Boolean>() {",
" public Boolean run() {",
" return ReuseFactory.getBoolean(FileUtil.copyFile(",
" dataFactory.getStorageFactory(), from, to));",
" }",
" });",
"",
" if (!success.booleanValue()) {"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/store/raw/data/StreamFileContainer.java",
"hunks": [
{
"added": [],
"header": "@@ -30,7 +30,6 @@ import org.apache.derby.iapi.services.io.Storable;",
"removed": [
"import org.apache.derby.iapi.services.io.FormatIdUtil;"
]
},
{
"added": [],
"header": "@@ -38,27 +37,18 @@ import org.apache.derby.iapi.services.monitor.Monitor;",
"removed": [
"import org.apache.derby.iapi.store.access.RowUtil;",
"import org.apache.derby.io.StorageFactory;",
"import org.apache.derby.io.WritableStorageFactory;",
"import org.apache.derby.impl.store.raw.data.DecryptInputStream;",
"import org.apache.derby.impl.store.raw.data.StoredFieldHeader;",
"import org.apache.derby.impl.store.raw.data.StoredRecordHeader;",
"",
"import org.apache.derby.iapi.services.io.ArrayInputStream;",
"import org.apache.derby.iapi.util.ReuseFactory;"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/store/raw/log/LogToFile.java",
"hunks": [
{
"added": [],
"header": "@@ -69,7 +69,6 @@ import org.apache.derby.iapi.store.access.DatabaseInstant;",
"removed": [
"import org.apache.derby.iapi.util.ReuseFactory;"
]
},
{
"added": [
"\t\t\treturn activeFile.exists();",
" return activeFile.delete();"
],
"header": "@@ -5836,10 +5835,10 @@ public final class LogToFile implements LogFactory, ModuleControl, ModuleSupport",
"removed": [
"\t\t\treturn ReuseFactory.getBoolean(activeFile.exists());",
" return ReuseFactory.getBoolean(activeFile.delete());"
]
},
{
"added": [
"\t\t\treturn activeFile.canWrite();"
],
"header": "@@ -5853,7 +5852,7 @@ public final class LogToFile implements LogFactory, ModuleControl, ModuleSupport",
"removed": [
"\t\t\treturn ReuseFactory.getBoolean(activeFile.canWrite());"
]
},
{
"added": [
" return created;",
"\t\t\treturn FileUtil.copyFile(logStorageFactory, activeFile, toFile);",
" return !activeFile.exists() || activeFile.deleteAll();",
" return FileUtil.copyFile(logStorageFactory, toFile, activeFile);"
],
"header": "@@ -5862,22 +5861,20 @@ public final class LogToFile implements LogFactory, ModuleControl, ModuleSupport",
"removed": [
" return ReuseFactory.getBoolean(created);",
"\t\t\treturn ReuseFactory.getBoolean(FileUtil.copyFile(logStorageFactory, activeFile, toFile));",
" if( ! activeFile.exists())",
" return ReuseFactory.getBoolean( true);",
"\t\t\treturn ReuseFactory.getBoolean(activeFile.deleteAll());",
" return ReuseFactory.getBoolean(FileUtil.copyFile( logStorageFactory, toFile, activeFile));"
]
}
]
}
] |
derby-DERBY-6890-dc05c9d8
|
DERBY-6890: ALTER TABLE DROP COLUMN corrupts secondary index collation data.
During ALTER TABLE DROP COLUMN, we rebuild all the indexes on the table. Some
indexes may be entirely dropped, some indexes may be rebuilt with a subset
of columns, some indexes are simply rebuild with essentially the same content.
The issue is that the index rebuild logic was incorrectly setting the
collation data for each index. So the indexes had the right data, but the
wrong collation information, causing them to be damaged.
This change moves the computation of the index collation ids out of the
setUpAllSorts method, into the getAffectedIndexes method, where it is simpler
to compute the index collation ids appropriately, because the code in that
location already has logic to manipulate both the old (pre-DROP) and new
(post-DROP) table descriptions, and so it is straightforward to compute the
correct collation ids there.
As part of this change, an old test case in CollationTest2, which was marked
with the comment "this test does not work yet", and was disabled, is changed
(un-commented) and is now enabled.
I found no new problems with this test case. I believe that, at the time
that comment was written, there were bugs in Derby that have since been
repaired, and hence it is appropriate to enable this test case at this time.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1749069 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/sql/execute/AlterTableConstantAction.java",
"hunks": [
{
"added": [
"\t\t\tcollation = new int[numIndexes][]; ",
"\t\t\t\t// Setup collation id array to be passed in on call to create index.",
"\t\t\t\tcollation[i] = ",
"\t\t\t\t\tcompressIRGs[j].getColumnCollationIds(",
"\t\t\t\t\t\ttd.getColumnDescriptorList());",
""
],
"header": "@@ -2922,12 +2922,18 @@ class AlterTableConstantAction extends DDLSingleTableConstantAction",
"removed": []
},
{
"added": [
"\t\t\t\t\tint[] newCollation = new int[collation[i].length - 1];",
"\t\t\t\t\t\tnewCollation[k] = collation[i][k + step];",
"\t\t\t\t\tcollation[i] = newCollation;",
"\t\telse",
"\t\t{",
"\t\t\tcollation = new int[numIndexes][]; ",
"\t\t\tfor (int i = 0; i < numIndexes; i++)",
"\t\t\t{",
"\t\t\t\tcollation[i] = ",
"\t\t\t\t\tcompressIRGs[i].getColumnCollationIds(",
"\t\t\t\t\t\ttd.getColumnDescriptorList());",
"\t\t\t}",
"\t\t}"
],
"header": "@@ -2960,22 +2966,35 @@ class AlterTableConstantAction extends DDLSingleTableConstantAction",
"removed": []
},
{
"added": [],
"header": "@@ -3103,7 +3122,6 @@ class AlterTableConstantAction extends DDLSingleTableConstantAction",
"removed": [
" collation = new int[numIndexes][]; "
]
}
]
}
] |
derby-DERBY-6891-f5bf9a9e
|
DERBY-6891: Improve the synchronization behavior of DerbyObservable; commit derby-6891-01-ab-synchronizeMethods.diff.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1750214 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/iapi/services/monitor/DerbyObservable.java",
"hunks": [
{
"added": [
"import java.util.ArrayList;"
],
"header": "@@ -21,7 +21,7 @@",
"removed": [
"import java.util.Vector;"
]
},
{
"added": [
" private ArrayList<DerbyObserver> _observers;"
],
"header": "@@ -39,7 +39,7 @@ public class DerbyObservable",
"removed": [
" private Vector<DerbyObserver> _observers;"
]
},
{
"added": [
" public DerbyObservable() { _observers = new ArrayList<DerbyObserver>(); }"
],
"header": "@@ -48,7 +48,7 @@ public class DerbyObservable",
"removed": [
" public DerbyObservable() { _observers = new Vector<DerbyObserver>(); }"
]
},
{
"added": [
" public synchronized void addObserver(DerbyObserver observer)",
" if (!_observers.contains(observer)) { _observers.add(observer); }"
],
"header": "@@ -63,11 +63,11 @@ public class DerbyObservable",
"removed": [
" public void addObserver(DerbyObserver observer)",
" if (!_observers.contains(observer)) { _observers.addElement(observer); }"
]
},
{
"added": [
" public synchronized int countObservers() { return _observers.size(); }",
" public synchronized void deleteObserver(DerbyObserver observer) { _observers.remove(observer); }"
],
"header": "@@ -75,14 +75,14 @@ public class DerbyObservable",
"removed": [
" public int countObservers() { return _observers.size(); }",
" public void deleteObserver(DerbyObserver observer) { _observers.removeElement(observer); }"
]
},
{
"added": [
" protected synchronized void setChanged() { _hasChanged = true; }"
],
"header": "@@ -129,6 +129,6 @@ public class DerbyObservable",
"removed": [
" protected void setChanged() { _hasChanged = true; }"
]
}
]
}
] |
derby-DERBY-6902-3ef48bb1
|
DERBY-6902: Value out of range error
This change adds still more new test cases to ParameterMappingTest, derived
from the original scenario described in the issue.
The new test cases explore some datatype conversions from string-to-integer.
They also look at some other variations on the original query from the
issue, demonstrating that the details of the phrasing of the query affect
the query compiler's decisions about intermediate data types.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1770458 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-6902-9fbbcb81
|
DERBY-6902: Value out of range error
This change adds several new test cases to ParameterMappingTest, derived
from the original scenario described in the issue.
These test cases are designed to demonstrate the particular exception
discussed in the issue, as well as to demonstrate several ways to use
a CAST operator so that the query executes as desired.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1769904 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-6904-f15ef888
|
DERBY-6903: ALTER TABLE ALTER COLUMN resets CYCLE option
DERBY-6904: Enhance ALTER TABLE to allow CYCLE option to be changed
DERBY-6905: Enhance SYS.SYSCOLUMNS to report the CYCLE value
DERBY-6906: Allow a GENERATED column to explicitly specify NO CYCLE
This patch was contributed by Harshvardhan Gupta (harshvardhan145 at gmail dot com)
The patch adds the CYCLE property as a fundamental property associated
with a column similar to current increment value, current increment step etc.
* SYS.SYSCOLUMNS extended to hold the cycle value of identity column.
* Extended the grammar to accept "cycle","no cycle" in alter clause
and changed the underlying column descriptor and sequencing objects.
* ALTER clause not involving cycle option (i.e increment and restart)
won't affect the cycle option.
The code flow for the upgrade handling was modelled after Derby-534
for introducing a new in column SYSTRIGGERS. There are new behaviors
for SYSCOLUMNS in both soft- and hard-upgrade scenarios.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1797283 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/iapi/sql/dictionary/ColumnDescriptor.java",
"hunks": [
{
"added": [
"\tprivate boolean\t\t\t\tautoincCycle;"
],
"header": "@@ -66,6 +66,7 @@ public final class ColumnDescriptor extends TupleDescriptor",
"removed": []
},
{
"added": [
"\t\t\t\t\t long userChangedWhat, boolean autoincCycle)",
"\t\t\t\tautoincInc,autoincCycle);\t\t\t\t"
],
"header": "@@ -102,11 +103,11 @@ public final class ColumnDescriptor extends TupleDescriptor",
"removed": [
"\t\t\t\t\t long userChangedWhat)",
"\t\t\t\tautoincInc);\t\t\t\t"
]
},
{
"added": [
"\t\t\t\t\t\t UUID defaultUUID, long autoincStart, long autoincInc, boolean autoincCycle)"
],
"header": "@@ -132,7 +133,7 @@ public final class ColumnDescriptor extends TupleDescriptor",
"removed": [
"\t\t\t\t\t\t UUID defaultUUID, long autoincStart, long autoincInc)"
]
},
{
"added": [
"\t\tthis.autoincCycle = autoincCycle;"
],
"header": "@@ -153,6 +154,7 @@ public final class ColumnDescriptor extends TupleDescriptor",
"removed": []
},
{
"added": [
" long autoincStart, long autoincInc, long autoincValue, boolean autoincCycle)"
],
"header": "@@ -181,7 +183,7 @@ public final class ColumnDescriptor extends TupleDescriptor",
"removed": [
" long autoincStart, long autoincInc, long autoincValue)"
]
},
{
"added": [
"\t\tthis.autoincCycle = autoincCycle;"
],
"header": "@@ -199,6 +201,7 @@ public final class ColumnDescriptor extends TupleDescriptor",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java",
"hunks": [
{
"added": [
" \t",
" \t// log the current dictionary version. Moving this statement to top as SYSCOLUMNSRowFactory",
" \t// queries the version info. SEE Derby-6904 ",
" dictionaryVersion = softwareVersion;"
],
"header": "@@ -777,7 +777,10 @@ public final class\tDataDictionaryImpl",
"removed": [
" "
]
},
{
"added": [],
"header": "@@ -788,8 +791,6 @@ public final class\tDataDictionaryImpl",
"removed": [
"\t\t\t\t// log the current dictionary version",
"\t\t\t\tdictionaryVersion = softwareVersion;"
]
},
{
"added": [
" (UUID) null, 0, 0, 0, false);"
],
"header": "@@ -4372,7 +4373,7 @@ public final class\tDataDictionaryImpl",
"removed": [
" (UUID) null, 0, 0, 0);"
]
},
{
"added": [
"\t/**",
"\t *\tAdd autoinccycle columns to an SYSCOLUMNS system catalog",
"\t *",
"\t *\t@param\ttc\t\t\t\tTransaction controller.",
"\t *",
"\t *\t@exception StandardException Standard Derby error policy",
"\t */",
"\tvoid upgrade_SYSCOLUMNS_AUTOINCCYCLE(TransactionController tc) throws StandardException{",
"\t\tTabInfoImpl ti = coreInfo[SYSCOLUMNS_CORE_NUM];",
"\t\tupgrade_addColumns(ti.getCatalogRowFactory(),new int[]{10},tc);",
"\t}",
""
],
"header": "@@ -8466,6 +8467,18 @@ public final class\tDataDictionaryImpl",
"removed": []
},
{
"added": [
"\t\t\t 0, 0, false"
],
"header": "@@ -9116,7 +9129,7 @@ public final class\tDataDictionaryImpl",
"removed": [
"\t\t\t 0, 0"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/catalog/SYSCOLUMNSRowFactory.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.types.*;"
],
"header": "@@ -29,6 +29,7 @@ import org.apache.derby.catalog.UUID;",
"removed": []
},
{
"added": [],
"header": "@@ -41,15 +42,6 @@ import org.apache.derby.iapi.sql.dictionary.UniqueTupleDescriptor;",
"removed": [
"import org.apache.derby.iapi.types.DataTypeDescriptor;",
"import org.apache.derby.iapi.types.DataValueDescriptor;",
"import org.apache.derby.iapi.types.DataValueFactory;",
"import org.apache.derby.iapi.types.SQLChar;",
"import org.apache.derby.iapi.types.SQLInteger;",
"import org.apache.derby.iapi.types.SQLLongint;",
"import org.apache.derby.iapi.types.SQLVarchar;",
"import org.apache.derby.iapi.types.TypeId;",
"import org.apache.derby.iapi.types.UserType;"
]
},
{
"added": [
"\tprotected static final int\t\tSYSCOLUMNS_COLUMN_COUNT = 10;"
],
"header": "@@ -63,7 +55,7 @@ public class SYSCOLUMNSRowFactory extends CatalogRowFactory",
"removed": [
"\tprotected static final int\t\tSYSCOLUMNS_COLUMN_COUNT = 9;"
]
},
{
"added": [
"\tprotected static final int\t\tSYSCOLUMNS_AUTOINCREMENTINCCYCLE = 10;"
],
"header": "@@ -78,6 +70,7 @@ public class SYSCOLUMNSRowFactory extends CatalogRowFactory",
"removed": []
},
{
"added": [
"\t",
"\t// SYSCOLUMNSRowFactory class needs to access the DD version to perform soft / hard upgrades if any.",
"\tprivate final DataDictionary dataDictionary;",
"",
" SYSCOLUMNSRowFactory(DataDictionary dd,UUIDFactory uuidf, ExecutionFactory ef, DataValueFactory dvf)",
"\t\tthis(dd, uuidf, ef, dvf, TABLENAME_STRING);",
" SYSCOLUMNSRowFactory(DataDictionary dd,UUIDFactory uuidf, ExecutionFactory ef, DataValueFactory dvf,",
"\t\tthis.dataDictionary = dd;"
],
"header": "@@ -115,16 +108,21 @@ public class SYSCOLUMNSRowFactory extends CatalogRowFactory",
"removed": [
" SYSCOLUMNSRowFactory(UUIDFactory uuidf, ExecutionFactory ef, DataValueFactory dvf)",
"\t\tthis(uuidf, ef, dvf, TABLENAME_STRING);",
" SYSCOLUMNSRowFactory(UUIDFactory uuidf, ExecutionFactory ef, DataValueFactory dvf,"
]
},
{
"added": [
" \t@Override",
" \tpublic ExecRow makeRow(TupleDescriptor td, TupleDescriptor parent)",
"\t\t\t\t\tthrows StandardException{",
"\treturn makeRow(td, getHeapColumnCount());",
"\t}",
"\t@Override",
"\tpublic ExecRow makeEmptyRowForCurrentVersion() throws StandardException {",
" return makeRow(null, SYSCOLUMNS_COLUMN_COUNT);",
" }",
"",
"\tprivate ExecRow makeRow(TupleDescriptor td, int columnCount)"
],
"header": "@@ -141,8 +139,18 @@ public class SYSCOLUMNSRowFactory extends CatalogRowFactory",
"removed": [
"\tpublic ExecRow makeRow(TupleDescriptor td, TupleDescriptor parent)"
]
},
{
"added": [
"\t\tboolean\t\t\t\t\tautoincCycle = false;"
],
"header": "@@ -156,6 +164,7 @@ public class SYSCOLUMNSRowFactory extends CatalogRowFactory",
"removed": []
},
{
"added": [
"\t\t\tautoincCycle = column.getAutoincCycle();",
""
],
"header": "@@ -178,6 +187,8 @@ public class SYSCOLUMNSRowFactory extends CatalogRowFactory",
"removed": []
},
{
"added": [
"\t\trow = getExecutionFactory().getValueRow(columnCount);"
],
"header": "@@ -200,7 +211,7 @@ public class SYSCOLUMNSRowFactory extends CatalogRowFactory",
"removed": [
"\t\trow = getExecutionFactory().getValueRow(SYSCOLUMNS_COLUMN_COUNT);"
]
},
{
"added": [
"\t\t\tif (row.nColumns() >= 10) {",
" // This column is present only if the data dictionary version is",
" // 10.14 or higher.",
" row.setColumn(SYSCOLUMNS_AUTOINCREMENTINCCYCLE,",
"\t\t\t\t\tnew SQLBoolean(autoincCycle));",
" \t}",
"\t\t\t",
"",
"\t\t\tif (row.nColumns() >= 10) {",
" // This column is present only if the data dictionary version is",
" // 10.14 or higher.",
" row.setColumn(SYSCOLUMNS_AUTOINCREMENTINCCYCLE,",
"\t\t\t\t\tnew SQLBoolean(autoincCycle));",
" \t}",
"\t\t}",
"\t\telse if(autoinc_create_or_modify_Start_Increment == ColumnDefinitionNode.MODIFY_AUTOINCREMENT_CYCLE_VALUE){",
"\t\t\tColumnDescriptor column = (ColumnDescriptor)td;",
"\t\t\trow.setColumn(SYSCOLUMNS_AUTOINCREMENTVALUE, new SQLLongint(",
"\t\t\t\t\tcolumn.getTableDescriptor().getColumnDescriptor(colName).getAutoincValue()));",
"\t\t\trow.setColumn(SYSCOLUMNS_AUTOINCREMENTSTART, new SQLLongint(",
"\t\t\t\t\tcolumn.getTableDescriptor().getColumnDescriptor(colName).getAutoincStart()));",
"\t\t\trow.setColumn(SYSCOLUMNS_AUTOINCREMENTINC, new SQLLongint(",
"\t\t\t\t\tcolumn.getTableDescriptor().getColumnDescriptor(colName).getAutoincInc()));",
"\t\t\tif (row.nColumns() >= 10) {",
" // This column is present only if the data dictionary version is",
" // 10.14 or higher.",
" row.setColumn(SYSCOLUMNS_AUTOINCREMENTINCCYCLE,",
"\t\t\t\t\tnew SQLBoolean(autoincCycle));",
" \t}"
],
"header": "@@ -247,15 +258,44 @@ public class SYSCOLUMNSRowFactory extends CatalogRowFactory",
"removed": []
},
{
"added": [
"\t\t\tif (row.nColumns() >= 10) {",
" // This column is present only if the data dictionary version is",
" // 10.14 or higher.",
" row.setColumn(SYSCOLUMNS_AUTOINCREMENTINCCYCLE,",
"\t\t\t\t\tnew SQLBoolean(autoincCycle));",
" \t}"
],
"header": "@@ -265,6 +305,12 @@ public class SYSCOLUMNSRowFactory extends CatalogRowFactory",
"removed": []
},
{
"added": [
"\t\t\t",
"\t\t\tint expectedCols =",
" dd.checkVersion(DataDictionary.DD_VERSION_DERBY_10_14, null)",
" ? SYSCOLUMNS_COLUMN_COUNT",
" : (SYSCOLUMNS_COLUMN_COUNT - 1);",
"",
"",
"\t\t\tSanityManager.ASSERT(row.nColumns() == expectedCols, "
],
"header": "@@ -326,7 +372,14 @@ public class SYSCOLUMNSRowFactory extends CatalogRowFactory",
"removed": [
"\t\t\tSanityManager.ASSERT(row.nColumns() == SYSCOLUMNS_COLUMN_COUNT, "
]
},
{
"added": [
"\t\tboolean autoincCycle = false;"
],
"header": "@@ -340,6 +393,7 @@ public class SYSCOLUMNSRowFactory extends CatalogRowFactory",
"removed": []
},
{
"added": [
"\t\tif (row.nColumns() >= 10){",
"\t\t\tDataValueDescriptor col = row.getColumn(SYSCOLUMNS_AUTOINCREMENTINCCYCLE);",
"\t\t\tautoincCycle = col.getBoolean();",
"\t\t}",
"",
"",
"\t\t// Hard upgraded tables <=10.13 come with a false autoincCyle before they are first",
"\t\t// explicitly set with cycle or no cycle command.",
" autoincValue, autoincCycle);"
],
"header": "@@ -421,16 +475,24 @@ public class SYSCOLUMNSRowFactory extends CatalogRowFactory",
"removed": [
" autoincValue);"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/ColumnDefinitionNode.java",
"hunks": [
{
"added": [
" boolean autoincrementCycle;"
],
"header": "@@ -66,7 +66,7 @@ public class ColumnDefinitionNode extends TableElementNode",
"removed": [
" long autoincrementCycle;"
]
},
{
"added": [
"\tpublic static final int MODIFY_AUTOINCREMENT_CYCLE_VALUE = 4;"
],
"header": "@@ -90,6 +90,7 @@ public class ColumnDefinitionNode extends TableElementNode",
"removed": []
},
{
"added": [
"\t\t\t\tautoincrementCycle = aii[QueryTreeNode.AUTOINCREMENT_CYCLE] == 1 ? true : false;"
],
"header": "@@ -144,7 +145,7 @@ public class ColumnDefinitionNode extends TableElementNode",
"removed": [
"\t\t\t\tautoincrementCycle = aii[QueryTreeNode.AUTOINCREMENT_CYCLE];"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/ModifyColumnNode.java",
"hunks": [
{
"added": [
" \t\tsuper(name, defaultNode, dataTypeServices, autoIncrementInfo, cm);",
" \tthis.kind = kind;",
"\t}"
],
"header": "@@ -70,10 +70,9 @@ class ModifyColumnNode extends ColumnDefinitionNode",
"removed": [
" super(name, defaultNode, dataTypeServices, autoIncrementInfo, cm);",
" this.kind = kind;",
" }",
""
]
},
{
"added": [
" } else if (autoinc_create_or_modify_Start_Increment ==",
" ColumnDefinitionNode.MODIFY_AUTOINCREMENT_CYCLE_VALUE) {",
" return ColumnInfo.MODIFY_COLUMN_DEFAULT_CYCLE;"
],
"header": "@@ -304,6 +303,9 @@ class ModifyColumnNode extends ColumnDefinitionNode",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/TableElementList.java",
"hunks": [
{
"added": [
"\t\t\t\t\t\t\t\tColumnInfo.DROP, 0, 0, false, 0);"
],
"header": "@@ -455,7 +455,7 @@ class TableElementList extends QueryTreeNodeVector<TableElementNode>",
"removed": [
"\t\t\t\t\t\t\t\tColumnInfo.DROP, 0, 0, 0, 0);"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/execute/AlterTableConstantAction.java",
"hunks": [
{
"added": [
"\t\t\t\t\t\t columnInfo[ix].action ==",
"\t\t\t\t\t\t ColumnInfo.MODIFY_COLUMN_DEFAULT_CYCLE ||"
],
"header": "@@ -485,6 +485,8 @@ class AlterTableConstantAction extends DDLSingleTableConstantAction",
"removed": []
},
{
"added": [
" columnInfo[ix].autoinc_create_or_modify_Start_Increment,",
" columnInfo[ix].autoincCycle"
],
"header": "@@ -1233,7 +1235,8 @@ class AlterTableConstantAction extends DDLSingleTableConstantAction",
"removed": [
" columnInfo[ix].autoinc_create_or_modify_Start_Increment"
]
},
{
"added": [
"\t\t\t\t\t\t\t\t columnInfo[ix].autoincInc,",
"\t\t\t\t\t\t\t\t columnInfo[ix].autoincCycle"
],
"header": "@@ -2058,7 +2061,8 @@ class AlterTableConstantAction extends DDLSingleTableConstantAction",
"removed": [
"\t\t\t\t\t\t\t\t columnInfo[ix].autoincInc"
]
},
{
"added": [
"\t\t\t\t\t\t\t\t\tcolumnDescriptor.getAutoincInc(),",
"\t\t\t\t\t\t\t\t\tcolumnDescriptor.getAutoincCycle());"
],
"header": "@@ -2124,7 +2128,8 @@ class AlterTableConstantAction extends DDLSingleTableConstantAction",
"removed": [
"\t\t\t\t\t\t\t\t\tcolumnDescriptor.getAutoincInc());"
]
},
{
"added": [
"\t\t\t\t\t\t\t\t\t\t\t\t columnInfo[ix].autoinc_create_or_modify_Start_Increment,",
"\t\t\t\t\t\t\t\t\t\t\t\t columnInfo[ix].autoincCycle"
],
"header": "@@ -2181,7 +2186,8 @@ class AlterTableConstantAction extends DDLSingleTableConstantAction",
"removed": [
"\t\t\t\t\t\t\t\t\t\t\t\t columnInfo[ix].autoinc_create_or_modify_Start_Increment"
]
},
{
"added": [
"\t\t} ",
" (columnInfo[ix].action == ColumnInfo.MODIFY_COLUMN_DEFAULT_RESTART) ||",
" (columnInfo[ix].action == ColumnInfo.MODIFY_COLUMN_DEFAULT_CYCLE) "
],
"header": "@@ -2201,12 +2207,13 @@ class AlterTableConstantAction extends DDLSingleTableConstantAction",
"removed": [
"\t\t}",
" (columnInfo[ix].action == ColumnInfo.MODIFY_COLUMN_DEFAULT_RESTART)"
]
},
{
"added": [
" if ( (columnInfo[ix].action == ColumnInfo.MODIFY_COLUMN_DEFAULT_INCREMENT) || (columnInfo[ix].action == ColumnInfo.MODIFY_COLUMN_DEFAULT_CYCLE ))"
],
"header": "@@ -2219,7 +2226,7 @@ class AlterTableConstantAction extends DDLSingleTableConstantAction",
"removed": [
" if ( columnInfo[ix].action == ColumnInfo.MODIFY_COLUMN_DEFAULT_INCREMENT )"
]
},
{
"added": [
" if ( (columnInfo[ix].action == ColumnInfo.MODIFY_COLUMN_DEFAULT_INCREMENT) || (columnInfo[ix].action == ColumnInfo.MODIFY_COLUMN_DEFAULT_CYCLE ) )"
],
"header": "@@ -2233,7 +2240,7 @@ class AlterTableConstantAction extends DDLSingleTableConstantAction",
"removed": [
" if ( columnInfo[ix].action == ColumnInfo.MODIFY_COLUMN_DEFAULT_INCREMENT )"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/execute/ColumnInfo.java",
"hunks": [
{
"added": [
" boolean autoincCycle;"
],
"header": "@@ -75,7 +75,7 @@ public class ColumnInfo implements Formatable",
"removed": [
" long autoincCycle;"
]
},
{
"added": [
"\tpublic static final int MODIFY_COLUMN_DEFAULT_CYCLE = 10;"
],
"header": "@@ -96,6 +96,7 @@ public class ColumnInfo implements Formatable",
"removed": []
},
{
"added": [
"\t\t\t\t\t boolean\t\t\t\t\t\tautoincCycle,"
],
"header": "@@ -131,7 +132,7 @@ public class ColumnInfo implements Formatable",
"removed": [
"\t\t\t\t\t long autoincCycle,"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/execute/CreateTableConstantAction.java",
"hunks": [
{
"added": [
" columnInfo[ix].autoinc_create_or_modify_Start_Increment,",
" columnInfo[ix].autoincCycle"
],
"header": "@@ -287,7 +287,8 @@ class CreateTableConstantAction extends DDLConstantAction",
"removed": [
" columnInfo[ix].autoinc_create_or_modify_Start_Increment"
]
},
{
"added": [
" columnInfo[ix].autoincInc,",
" columnInfo[ix].autoincCycle"
],
"header": "@@ -313,7 +314,8 @@ class CreateTableConstantAction extends DDLConstantAction",
"removed": [
" columnInfo[ix].autoincInc"
]
}
]
}
] |
derby-DERBY-6918-43d83c68
|
DERBY-6918: Problem with schema name containing a period
When processing DELETE statements in a database schema including
referential integrity constraints that specify ON DELETE CASCADE,
it is easiest to keep the schema name and table name separate,
rather than pasting them together into a compound name joined with
a period, because pasting them together results in ambiguity about
which period separates the schema name from the table name, and
which period was simply part of the schema name proper.
Adjusted the logic in DeleteNode and DMLModStatementNode accordingly.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1772428 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/sql/compile/DMLModStatementNode.java",
"hunks": [
{
"added": [
"\tprotected String[] fkSchemaNames; // referencing schema names."
],
"header": "@@ -95,6 +95,7 @@ abstract class DMLModStatementNode extends DMLStatementNode",
"removed": []
},
{
"added": [
"\t\tArrayList<String> refSchemaNames = new ArrayList<String>(1);"
],
"header": "@@ -908,6 +909,7 @@ abstract class DMLModStatementNode extends DMLStatementNode",
"removed": []
},
{
"added": [
"\t\t\t\t\t\trefSchemaNames.add(fktd.getSchemaName());",
"\t\t\t\t\t\trefTableNames.add(fktd.getName());"
],
"header": "@@ -988,7 +990,8 @@ abstract class DMLModStatementNode extends DMLStatementNode",
"removed": [
"\t\t\t\t\t\trefTableNames.add(fktd.getSchemaName() + \".\" + fktd.getName());"
]
},
{
"added": [
"\t\t\tfkSchemaNames = new String[size];"
],
"header": "@@ -1056,6 +1059,7 @@ abstract class DMLModStatementNode extends DMLStatementNode",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/DeleteNode.java",
"hunks": [
{
"added": [
"\t\t\t\t\t\tdependentNodes[i] = getDependentTableNode(",
"\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t fkSchemaNames[i],",
"\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t fkTableNames[i],"
],
"header": "@@ -368,7 +368,9 @@ class DeleteNode extends DMLModStatementNode",
"removed": [
"\t\t\t\t\t\tdependentNodes[i] = getDependentTableNode(fkTableNames[i],"
]
}
]
}
] |
derby-DERBY-694-ad94e28d
|
DERBY-694: Commit Narayanan's DERBY-694_v6.diff patch so that statement severity errors don't close jdbc objects which they shouldn't.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@430051 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/client/org/apache/derby/client/am/Connection.java",
"hunks": [
{
"added": [
" ",
" /**",
" * ",
" * Rollback the specific UnitOfWorkListener. ",
" * @param uwl The UnitOfWorkLitener to be rolled back",
" *",
" */",
" public void completeSpecificRollback(UnitOfWorkListener uwl) {",
" java.util.Set keySet = CommitAndRollbackListeners_.keySet();",
" for (java.util.Iterator i = keySet.iterator(); i.hasNext();) {",
" UnitOfWorkListener listener = (UnitOfWorkListener) i.next();",
" if(listener == uwl) {",
" listener.completeLocalRollback(i);",
" break;",
" }",
" }",
" inUnitOfWork_ = false;",
" }"
],
"header": "@@ -1841,6 +1841,24 @@ public abstract class Connection implements java.sql.Connection,",
"removed": []
}
]
},
{
"file": "java/client/org/apache/derby/client/am/Statement.java",
"hunks": [
{
"added": [
"public class Statement implements java.sql.Statement, StatementCallbackInterface{"
],
"header": "@@ -25,7 +25,7 @@ import java.sql.SQLException;",
"removed": [
"public class Statement implements java.sql.Statement, StatementCallbackInterface, UnitOfWorkListener {"
]
}
]
},
{
"file": "java/client/org/apache/derby/client/am/StatementCallbackInterface.java",
"hunks": [
{
"added": [
"public interface StatementCallbackInterface extends UnitOfWorkListener {"
],
"header": "@@ -29,7 +29,7 @@ package org.apache.derby.client.am;",
"removed": [
"public interface StatementCallbackInterface {"
]
}
]
},
{
"file": "java/client/org/apache/derby/client/net/NetConnectionReply.java",
"hunks": [
{
"added": [
"import org.apache.derby.client.am.StatementCallbackInterface;",
"import org.apache.derby.client.am.ResultSetCallbackInterface;",
"import org.apache.derby.client.am.UnitOfWorkListener;",
"import org.apache.derby.shared.common.error.ExceptionSeverity;",
"import org.apache.derby.shared.common.error.ExceptionUtil;"
],
"header": "@@ -25,12 +25,17 @@ import javax.transaction.xa.Xid;",
"removed": []
},
{
"added": [
" NetSqlca sqlca = parseAbnormalEndUow(connection,null);"
],
"header": "@@ -343,7 +348,7 @@ public class NetConnectionReply extends Reply",
"removed": [
" NetSqlca sqlca = parseAbnormalEndUow(connection);"
]
},
{
"added": [
" ",
" /**",
" * Perform necessary actions for parsing of a ABNUOWRM message.",
" *",
" * @param connection an implementation of the ConnectionCallbackInterface",
" *",
" * @return an NetSqlca object obtained from parsing the ABNUOWRM",
" * @throws DisconnectException",
" *",
" */",
" NetSqlca parseAbnormalEndUow(ConnectionCallbackInterface connection,UnitOfWorkListener uwl) throws DisconnectException {",
" parseABNUOWRM();",
" ",
" if(ExceptionUtil.getSeverityFromIdentifier(netSqlca.getSqlState()) > ",
" ExceptionSeverity.STATEMENT_SEVERITY || uwl == null)",
" connection.completeAbnormalUnitOfWork();",
" else",
" connection.completeAbnormalUnitOfWork(uwl);",
" ",
" ",
" /**",
" * Perform necessary actions for parsing of a ABNUOWRM message.",
" *",
" * @param connection an implementation of the StatementCallbackInterface",
" *",
" * @return an NetSqlca object obtained from parsing the ABNUOWRM",
" * @throws DisconnectException",
" *",
" */",
" NetSqlca parseAbnormalEndUow(StatementCallbackInterface s) throws DisconnectException {",
" return parseAbnormalEndUow(s.getConnectionCallbackInterface(),s);",
" }",
" ",
" /**",
" * Perform necessary actions for parsing of a ABNUOWRM message.",
" *",
" * @param connection an implementation of the ResultsetCallbackInterface",
" *",
" * @return an NetSqlca object obtained from parsing the ABNUOWRM",
" * @throws DisconnectException",
" *",
" */",
" NetSqlca parseAbnormalEndUow(ResultSetCallbackInterface r) throws DisconnectException {",
" return parseAbnormalEndUow(r.getConnectionCallbackInterface(),r);",
" }"
],
"header": "@@ -467,16 +472,58 @@ public class NetConnectionReply extends Reply",
"removed": [
"",
" NetSqlca parseAbnormalEndUow(ConnectionCallbackInterface connection) throws DisconnectException {",
" parseABNUOWRM(connection);"
]
},
{
"added": [
" void parseABNUOWRM() throws DisconnectException {"
],
"header": "@@ -1713,7 +1760,7 @@ public class NetConnectionReply extends Reply",
"removed": [
" void parseABNUOWRM(ConnectionCallbackInterface connection) throws DisconnectException {"
]
}
]
},
{
"file": "java/client/org/apache/derby/client/net/NetResultSetReply.java",
"hunks": [
{
"added": [
" //passing the ResultSetCallbackInterface implementation will",
" //help in retrieving the the UnitOfWorkListener that needs to",
" //be rolled back ",
" NetSqlca sqlca = parseAbnormalEndUow(resultSetI);"
],
"header": "@@ -193,7 +193,10 @@ public class NetResultSetReply extends NetStatementReply implements ResultSetRep",
"removed": [
" NetSqlca sqlca = parseAbnormalEndUow(resultSetI.getConnectionCallbackInterface());"
]
}
]
},
{
"file": "java/client/org/apache/derby/client/net/NetStatementReply.java",
"hunks": [
{
"added": [
" //passing the StatementCallbackInterface implementation will",
" //help in retrieving the the UnitOfWorkListener that needs to",
" //be rolled back ",
" NetSqlca sqlca = parseAbnormalEndUow(statement);"
],
"header": "@@ -516,7 +516,10 @@ public class NetStatementReply extends NetPackageReply implements StatementReply",
"removed": [
" NetSqlca sqlca = parseAbnormalEndUow(statement.getConnectionCallbackInterface());"
]
},
{
"added": [
" //passing the StatementCallbackInterface implementation will",
" //help in retrieving the the UnitOfWorkListener that needs to",
" //be rolled back",
" NetSqlca sqlca = parseAbnormalEndUow(statement);"
],
"header": "@@ -548,7 +551,10 @@ public class NetStatementReply extends NetPackageReply implements StatementReply",
"removed": [
" NetSqlca sqlca = parseAbnormalEndUow(statement.getConnectionCallbackInterface());"
]
},
{
"added": [
" //passing the StatementCallbackInterface implementation will",
" //help in retrieving the the UnitOfWorkListener that needs to",
" //be rolled back",
" NetSqlca sqlca = parseAbnormalEndUow(statement);"
],
"header": "@@ -582,7 +588,10 @@ public class NetStatementReply extends NetPackageReply implements StatementReply",
"removed": [
" NetSqlca sqlca = parseAbnormalEndUow(statement.getConnectionCallbackInterface());"
]
},
{
"added": [
" //passing the StatementCallbackInterface implementation will",
" //help in retrieving the the UnitOfWorkListener that needs to",
" //be rolled back",
" NetSqlca sqlca = parseAbnormalEndUow(statementI);"
],
"header": "@@ -609,7 +618,10 @@ public class NetStatementReply extends NetPackageReply implements StatementReply",
"removed": [
" NetSqlca sqlca = parseAbnormalEndUow(statementI.getConnectionCallbackInterface());"
]
},
{
"added": [
" //passing the StatementCallbackInterface implementation will",
" //help in retrieving the the UnitOfWorkListener that needs to",
" //be rolled back",
" NetSqlca sqlca = parseAbnormalEndUow(statementI);"
],
"header": "@@ -638,7 +650,10 @@ public class NetStatementReply extends NetPackageReply implements StatementReply",
"removed": [
" NetSqlca sqlca = parseAbnormalEndUow(statementI.getConnectionCallbackInterface());"
]
}
]
}
] |
derby-DERBY-6956-2a5acb4b
|
DERBY-6956: CREATE TABLE AS SELECT cannot copy DECIMAL(31,6)
This change adds several test tests to serve as regression tests.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1805356 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-6959-2636edd9
|
DERBY-6959: Require Standard SET keyword when changing the cycling behavior of an identity column; commit derby-6959-01-ab-requireSETkeyword.diff.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1808071 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-6961-71bdb5f4
|
DERBY-6961: Correctly handle ALTER TABLE...SET [NO] CYCLE on exhausted identity columns; commit derby-6961-01-aa-recyclingExhaustedIdentityColumns.diff.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1808668 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/sql/execute/AlterTableConstantAction.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.types.TypeId;"
],
"header": "@@ -80,6 +80,7 @@ import org.apache.derby.iapi.store.access.TransactionController;",
"removed": []
},
{
"added": [
" private static final int RANGE_TOP = 0;",
" private static final int RANGE_BOTTOM = 1;"
],
"header": "@@ -94,6 +95,8 @@ import org.apache.derby.shared.common.sanity.SanityManager;",
"removed": []
},
{
"added": [
" ",
" if (columnInfo[ix].action == ColumnInfo.MODIFY_COLUMN_DEFAULT_CYCLE)",
" {",
" if (columnInfo[ix].autoincCycle)",
" {",
" // ALTER TABLE ALTER COLUMN $columnName SET CYCLE",
" if (currentValue == null)",
" {",
" //",
" // If the current value is NULL, then the sequence generator",
" // is exhausted and it must have been a NO CYCLE generator,",
" // which we are changing to CYCLE.",
" // According to the 2016 SQL Standard, section 4.27.2",
" // (Operations involving sequence generators),",
" // the next value of the sequence generator should be the minimum value",
" // (for an ascending sequence generator) or the maximum value",
" // (for a descending sequence generator). See DERBY-6961.",
" // This logic will have to change in the future if we",
" // let users configure the maximum and minimum values of identity columns.",
" //",
" int topOrBottom = (columnInfo[ix].autoincInc > 0) ? RANGE_BOTTOM : RANGE_TOP;",
" currentValue = getRangeBound(columnInfo[ix].dataType, topOrBottom);",
" }",
" }",
" else",
" {",
" // ALTER TABLE ALTER COLUMN $columnName SET NO CYCLE",
" //",
" // If we are just about to issue the rollover value,",
" // set it to NULL in order to prevent cycling.",
" int topOrBottom = (columnInfo[ix].autoincInc > 0) ? RANGE_BOTTOM : RANGE_TOP;",
" Long rolloverValue = getRangeBound(columnInfo[ix].dataType, topOrBottom);",
"",
" if ((currentValue != null) && (currentValue.equals(rolloverValue)))",
" { currentValue = null; }",
" }",
" }"
],
"header": "@@ -2230,6 +2233,43 @@ class AlterTableConstantAction extends DDLSingleTableConstantAction",
"removed": []
}
]
}
] |
derby-DERBY-6974-e1dddd62
|
DERBY-6974: Convert Derby build to JDK 9 and compile at Java 9 byte code level.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1813709 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/build/org/apache/derbyBuild/javadoc/DiskLayoutTaglet.java",
"hunks": [
{
"added": [
"import jdk.javadoc.doclet.Taglet;",
"import com.sun.source.doctree.DocTree;",
"import com.sun.source.doctree.TextTree;",
"import com.sun.source.doctree.UnknownBlockTagTree;",
"import com.sun.source.doctree.UnknownInlineTagTree;",
"import com.sun.source.util.SimpleDocTreeVisitor;",
"import java.util.EnumSet;",
"import java.util.List;",
"import java.util.Set;",
"import javax.lang.model.element.Element;",
"public class DiskLayoutTaglet implements Taglet",
"{",
" private static final String NAME = \"derby.diskLayout\";",
" private static final String ROWNAME = \"Disk Layout\";",
" private static final EnumSet<Location> allowedSet = EnumSet.allOf(Location.class);",
"",
" private static final DerbyDocTreeVisitor dummyVisitor = new DerbyDocTreeVisitor();",
" "
],
"header": "@@ -21,13 +21,26 @@",
"removed": [
"import com.sun.tools.doclets.Taglet;",
"import com.sun.javadoc.*;",
"public class DiskLayoutTaglet implements Taglet {",
" private String NAME = \"derby.diskLayout\";",
" private String ROWNAME = \"Disk Layout\";"
]
},
{
"added": [
" @Override",
" public Set<Taglet.Location> getAllowedLocations() {",
" return allowedSet;",
" }"
],
"header": "@@ -36,53 +49,10 @@ public class DiskLayoutTaglet implements Taglet {",
"removed": [
" /**",
" * disk_layout not expected to be used in field documentation.",
" * @return false",
" */",
" public boolean inField() {",
" return false;",
" }",
"",
" /**",
" * disk_layout not expected to be used in constructor documentation.",
" * @return false",
" */",
" public boolean inConstructor() {",
" return false;",
" }",
"",
" /**",
" * disk_layout not expected to be used in constructor documentation.",
" * @return false",
" */",
" public boolean inMethod() {",
" return false;",
" }",
"",
" /**",
" * disk_layout can be used in overview documentation.",
" * @return true",
" */",
" public boolean inOverview() {",
" return true;",
" }",
"",
" /**",
" * disk_layout can be used in package documentation.",
" * @return true",
" */",
" public boolean inPackage() {",
" return true;",
" }",
"",
" /**",
" * disk_layout can be used in type documentation.",
" * @return true",
" */",
" public boolean inType() {",
" return true;",
" }"
]
}
]
},
{
"file": "java/build/org/apache/derbyBuild/javadoc/FormatIdTaglet.java",
"hunks": [
{
"added": [
"import jdk.javadoc.doclet.Taglet;",
"import com.sun.source.doctree.DocTree;",
"import java.util.EnumSet;",
"import java.util.List;",
"import java.util.Set;",
"import javax.lang.model.element.Element;",
" private static final String NAME = \"derby.formatId\";",
" private static final String ROWNAME = \"Format ID\";",
" private static final EnumSet<Location> allowedSet = EnumSet.allOf(Location.class);",
" public String getName() { return NAME; }",
" @Override",
" public Set<Taglet.Location> getAllowedLocations() { return allowedSet; }"
],
"header": "@@ -20,71 +20,28 @@",
"removed": [
"import com.sun.tools.doclets.Taglet;",
"import com.sun.javadoc.*;",
" private String NAME = \"derby.formatId\";",
" private String ROWNAME = \"Format ID\";",
" public String getName() {",
" return NAME;",
" }",
" /**",
" * format_id not expected to be used in field documentation.",
" * @return false",
" */",
" public boolean inField() {",
" return false;",
" }",
"",
"",
" /**",
" * format_id not expected to be used in constructor documentation.",
" * @return false",
" */",
" public boolean inConstructor() {",
" return false;",
" }",
"",
" /**",
" * format_id not expected to be used in method documentation.",
" * @return false",
" */",
" public boolean inMethod() {",
" return false;",
" }",
"",
" /**",
" * format_id can be used in overview documentation.",
" * @return true",
" */",
" public boolean inOverview() {",
" return true;",
" }",
"",
" /**",
" * format_id can be used in package documentation.",
" * @return true",
" */",
" public boolean inPackage() {",
" return true;",
" }",
"",
" /**",
" * format_id can be used in type documentation.",
" * @return true",
" */",
" public boolean inType() {",
" return true;",
" }"
]
}
]
},
{
"file": "java/build/org/apache/derbyBuild/javadoc/PurposeTaglet.java",
"hunks": [
{
"added": [
"import jdk.javadoc.doclet.Taglet;",
"import com.sun.source.doctree.DocTree;",
"import java.util.EnumSet;",
"import java.util.List;",
"import java.util.Set;",
"import javax.lang.model.element.Element;",
" private static final String NAME = \"derby.purpose\";",
" private static final String ROWNAME = \"Purpose\";",
" private static final EnumSet<Location> allowedSet = EnumSet.allOf(Location.class);",
" public String getName() { return NAME; }",
" @Override",
" public Set<Taglet.Location> getAllowedLocations() { return allowedSet; }"
],
"header": "@@ -20,70 +20,28 @@",
"removed": [
"import com.sun.tools.doclets.Taglet;",
"import com.sun.javadoc.*;",
" private String NAME = \"derby.purpose\";",
" private String ROWNAME = \"Purpose\";",
" public String getName() {",
" return NAME;",
" }",
"",
" /**",
" * purpose not expected to be used in field documentation.",
" * @return false",
" */",
" public boolean inField() {",
" return false;",
" }",
"",
" /**",
" * purpose not expected to be used in constructor documentation.",
" * @return false",
" */",
" public boolean inConstructor() {",
" return false;",
" }",
"",
" /**",
" * purpose not expected to be used in method documentation.",
" * @return false",
" */",
" public boolean inMethod() {",
" return false;",
" }",
" /**",
" * purpose can be used in overview documentation.",
" * @return true",
" */",
" public boolean inOverview() {",
" return true;",
" }",
"",
" /**",
" * purpose can be used in package documentation.",
" * @return true",
" */",
" public boolean inPackage() {",
" return true;",
" }",
"",
" /**",
" * purpose can be used in type documentation.",
" * @return true",
" */",
" public boolean inType() {",
" return true;",
" }"
]
}
]
},
{
"file": "java/build/org/apache/derbyBuild/javadoc/UpgradeTaglet.java",
"hunks": [
{
"added": [
"import jdk.javadoc.doclet.Taglet;",
"import com.sun.source.doctree.DocTree;",
"import java.util.EnumSet;",
"import java.util.List;",
"import java.util.Set;",
"import javax.lang.model.element.Element;",
" private static final String NAME = \"derby.upgrade\";",
" private static final String ROWNAME = \"Upgrade\";",
" private static final EnumSet<Location> allowedSet = EnumSet.allOf(Location.class);",
" public String getName() { return NAME; }",
" @Override",
" public Set<Taglet.Location> getAllowedLocations() { return allowedSet; }"
],
"header": "@@ -21,69 +21,27 @@",
"removed": [
"import com.sun.tools.doclets.Taglet;",
"import com.sun.javadoc.*;",
" private String NAME = \"derby.upgrade\";",
" private String ROWNAME = \"Upgrade\";",
" public String getName() {",
" return NAME;",
" }",
"",
" /**",
" * upgrade not expected to be used in field documentation.",
" * @return false",
" */",
" public boolean inField() {",
" return false;",
" }",
"",
" /**",
" * upgrade not expected to be used in constructor documentation.",
" * @return false",
" */",
" public boolean inConstructor() {",
" return false;",
" }",
"",
" /**",
" * upgrade not expected to be used in method documentation.",
" * @return false",
" */",
" public boolean inMethod() {",
" return false;",
" }",
" /**",
" * upgrade can be used in overview documentation.",
" * @return true",
" */",
" public boolean inOverview() {",
" return true;",
" }",
"",
" /**",
" * upgrade can be used in package documentation.",
" * @return true",
" */",
" public boolean inPackage() {",
" return true;",
" }",
"",
" /**",
" * upgrade can be used in type documentation.",
" * @return true",
" */",
" public boolean inType() {",
" return true;",
" }"
]
}
]
},
{
"file": "java/client/org/apache/derby/jdbc/BasicClientXADataSource40.java",
"hunks": [
{
"added": [
"import java.sql.ShardingKeyBuilder;",
"import java.sql.SQLFeatureNotSupportedException;"
],
"header": "@@ -21,7 +21,9 @@",
"removed": []
}
]
},
{
"file": "java/client/org/apache/derby/jdbc/ClientXADataSource.java",
"hunks": [
{
"added": [
"import java.sql.ShardingKeyBuilder;",
"import java.sql.SQLException;",
"import java.sql.SQLFeatureNotSupportedException;"
],
"header": "@@ -21,6 +21,9 @@",
"removed": []
}
]
},
{
"file": "java/client/org/apache/derby/jdbc/ClientXADataSource40.java",
"hunks": [
{
"added": [
"import java.sql.ShardingKeyBuilder;",
"import java.sql.SQLException;",
"import java.sql.SQLFeatureNotSupportedException;"
],
"header": "@@ -21,6 +21,9 @@",
"removed": []
}
]
},
{
"file": "java/client/org/apache/derby/jdbc/ClientXADataSourceInterface.java",
"hunks": [
{
"added": [
"import java.sql.ShardingKeyBuilder;",
"import java.sql.SQLException;",
"import java.sql.SQLFeatureNotSupportedException;"
],
"header": "@@ -21,6 +21,9 @@",
"removed": []
}
]
}
] |
derby-DERBY-6977-5cc99059
|
DERBY-6977: Eliminate collisions on generated names for constraints; commit derby-6977-01-ad-useUUID.diff.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1815172 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java",
"hunks": [
{
"added": [
" // Used for generating system names which are strictly increasing",
" // within a VM instance. This ordering is purely in order to preserve",
" // deterministic results in the regression tests.",
" private int systemSQLNameSeed = 0;"
],
"header": "@@ -438,12 +438,10 @@ public final class\tDataDictionaryImpl",
"removed": [
"\t//systemSQLNameNumber is the number used as the last digit during the previous call to getSystemSQLName.",
"\t//If it is 9 for a given calendarForLastSystemSQLName, we will restart the counter to 0",
"\t//and increment the calendarForLastSystemSQLName by 10ms.",
"\tprivate int systemSQLNameNumber;",
"\tprivate GregorianCalendar calendarForLastSystemSQLName = new GregorianCalendar();",
"\tprivate long timeForLastSystemSQLName;"
]
}
]
},
{
"file": "java/testing/org/apache/derbyTesting/functionTests/harness/Sed.java",
"hunks": [
{
"added": [
"",
" //",
" // Original comment:",
" // \"Filter for constraint names - bug 5622 - our internal constraint names are too long.",
" // To be db2 compatible, we have reworked them.\"",
" // The db2-compatibility caused name collisions and was removed with DERBY-6977.",
" //",
" constraintNameFilter.append(\"SQL[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]-\");"
],
"header": "@@ -120,11 +120,15 @@ public class Sed",
"removed": [
" ",
" // Filter for constraint names - bug 5622 - our internal constraint names are too long. To be db2 compatible, we have reworked them.",
" constraintNameFilter.append(\"SQL[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]\");",
" searchStrings.addElement(constraintNameFilter.toString());"
]
}
]
},
{
"file": "java/testing/org/apache/derbyTesting/junit/JDBC.java",
"hunks": [
{
"added": [
"",
" private static final int GENERATED_NAME_LENGTH = 50;",
" * <code>true</code> for all strings on this format: SQL0123456789-a816c00e-015f-ac0f-670f-0000033bdb30",
" if (!(o instanceof String)) { return false; }",
" if (!(tmpstr.startsWith(\"SQL\"))) { return false; }",
" if (tmpstr.length() != GENERATED_NAME_LENGTH) { return false; }",
" for (int i=3 ; i < GENERATED_NAME_LENGTH ; i++)",
" char currentChar = tmpstr.charAt(i);",
" if (Character.digit(currentChar, 16) >= 0) { continue; }",
" if (currentChar == '-') { continue; }",
" return false;",
" return true;"
],
"header": "@@ -40,32 +40,27 @@ import junit.framework.AssertionFailedError;",
"removed": [
" * <code>true</code> for all strings on this format: SQL061021105830900",
" boolean b = true;",
" if (!(o instanceof String))",
" b = false;",
" if (!(tmpstr.startsWith(\"SQL\")))",
" b = false;",
" if (tmpstr.length() != 18)",
" b = false;",
" for (int i=3 ; i<18 ; i++)",
" if (Character.isDigit(tmpstr.charAt(i)))",
" continue;",
" else",
" {",
" b = false;",
" break;",
" }",
" return b;"
]
}
]
}
] |
derby-DERBY-7-2537b48c
|
DERBY-7: The NULLIF built-in function of Derby seems to accept
only string types. Passing any other type argument raises error.
Fix submitted by Mamta Satoor (msatoor@gmail.com)
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@227281 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/sql/compile/ConditionalNode.java",
"hunks": [
{
"added": [
"\t//true means we are here for NULLIF(V1,V2), false means we are here for following",
"\t//CASE WHEN BooleanExpression THEN thenExpression ELSE elseExpression END",
"\tboolean\tthisIsNullIfNode;"
],
"header": "@@ -68,6 +68,9 @@ public class ConditionalNode extends ValueNode",
"removed": []
},
{
"added": [
"\tpublic void init(Object testCondition, Object thenElseList, Object thisIsNullIfNode)",
"\t\tthis.thisIsNullIfNode = ((Boolean) thisIsNullIfNode).booleanValue();"
],
"header": "@@ -76,10 +79,11 @@ public class ConditionalNode extends ValueNode",
"removed": [
"\tpublic void init(Object testCondition, Object thenElseList)"
]
}
]
}
] |
derby-DERBY-700-48ceb6e4
|
DERBY-700 backout change pending discussion on StorageFile changes.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@547062 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/io/DirFile.java",
"hunks": [
{
"added": [],
"header": "@@ -196,19 +196,6 @@ class DirFile extends File implements StorageFile",
"removed": [
" ",
" /**",
" * Return Random Acess file to the lock file, that is used to ",
" * get the exclusing file lock. File locks are not acquired on ",
" * jvms before jdk14, this method just return <code> null </code>. ",
" *",
" * @return null, there is opened lock file. ",
" */",
" public StorageRandomAccessFile getLockedFile() {",
" return null;",
" }",
"",
""
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/io/DirFile4.java",
"hunks": [
{
"added": [
"\t\t\t\tlockFileOpen = new RandomAccessFile((File) this, \"rw\");"
],
"header": "@@ -150,7 +150,7 @@ class DirFile4 extends DirFile",
"removed": [
"\t\t\t\tlockFileOpen = new DirRandomAccessFile4((File) this, \"rw\");"
]
},
{
"added": [
"\t\t\t\t\tlockFileOpen.writeInt(EXCLUSIVE_FILE_LOCK);",
"\t\t\t\t\tlockFileChannel.force(true);"
],
"header": "@@ -163,6 +163,8 @@ class DirFile4 extends DirFile",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/store/raw/data/BaseDataFileFactory.java",
"hunks": [
{
"added": [
""
],
"header": "@@ -147,8 +147,8 @@ public class BaseDataFileFactory",
"removed": [
""
]
},
{
"added": [],
"header": "@@ -235,11 +235,6 @@ public class BaseDataFileFactory",
"removed": [
"",
" /* derby jvm instance id used to prevent concurrent intra-jvm ",
" * boots of a database */ ",
" private static final String DERBY_JVM_ID = \"derby.storage.jvmInstanceId\";",
""
]
},
{
"added": [
" AccessController.doPrivileged( this);"
],
"header": "@@ -1860,7 +1855,7 @@ public class BaseDataFileFactory",
"removed": [
" AccessController.doPrivileged( this);"
]
},
{
"added": [
" // Called from within a privilege block"
],
"header": "@@ -1879,10 +1874,7 @@ public class BaseDataFileFactory",
"removed": [
" ",
" /**",
" * @throws StandardException",
" */"
]
},
{
"added": [
" exFileLock = ",
" storageFactory.newStorageFile( DB_EX_LOCKFILE_NAME);"
],
"header": "@@ -1984,8 +1976,8 @@ public class BaseDataFileFactory",
"removed": [
" \t\texFileLock = ",
" \t\t\tstorageFactory.newStorageFile( DB_EX_LOCKFILE_NAME);"
]
},
{
"added": [
" // filelock is unreliable, but we should at least leave a file"
],
"header": "@@ -2012,7 +2004,7 @@ public class BaseDataFileFactory",
"removed": [
" // filelock is unreliable, but we should at least leave a file"
]
},
{
"added": [],
"header": "@@ -2061,23 +2053,7 @@ public class BaseDataFileFactory",
"removed": [
" /* if it reached here means, db is protected from ",
" * being booted by multiple jvm instances. But file lock method ",
" * used to do that does not protect a db being booted by another ",
" * class loader in the same jvm. Get a lock that will",
" * protect the db being booted by another class loader, if ",
" * it is not booted by another class loader already.",
" */",
" try {",
" getIntraJvmDbLock();",
" }catch (IOException ioe) {",
" throw StandardException.newException(",
" SQLState.DATA_MULTIPLE_CLASSLOADERS_ON_DB, ",
" ioe, databaseDirectory);",
" }",
"",
""
]
},
{
"added": [
" private void privReleaseJBMSLockOnDB() throws IOException"
],
"header": "@@ -2104,7 +2080,7 @@ public class BaseDataFileFactory",
"removed": [
" private void privReleaseJBMSLockOnDB() throws IOException, StandardException"
]
},
{
"added": [
"",
"\t\t//release the lock that is acquired using tryLock() to prevent",
"\t\t//multiple jvm booting the same database on Unix environments.",
"\t\tif(exFileLock != null)",
""
],
"header": "@@ -2116,16 +2092,12 @@ public class BaseDataFileFactory",
"removed": [
" ",
"\t\t// release the lock that is acquired using tryLock() to prevent",
"\t\t// multiple jvm booting the same database on Unix environments.",
"\t\tif(exFileLock != null) {",
" // release the intra-jvm lock, that is used ",
" // to prevent database boots from a different class ",
" // loaders in the same jvm.",
" releaseIntraJvmDbLock();",
" }"
]
},
{
"added": [
" privGetJBMSLockOnDB();"
],
"header": "@@ -2848,12 +2820,7 @@ public class BaseDataFileFactory",
"removed": [
" \tFile dataDir = new File (dataDirectory);",
" \tString baseName= dataDir.getName().intern();",
" synchronized(baseName) ",
" { ",
" \tprivGetJBMSLockOnDB();",
" }"
]
}
]
},
{
"file": "java/shared/org/apache/derby/shared/common/reference/SQLState.java",
"hunks": [
{
"added": [],
"header": "@@ -22,7 +22,6 @@",
"removed": [
""
]
}
]
}
] |
derby-DERBY-700-6e1c9cd2
|
DERBY-700 Derby does not prevent dual boot of database from different
ClassLoaders on Linux
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@547042 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/io/DirFile.java",
"hunks": [
{
"added": [
" ",
" /**",
" * Return Random Acess file to the lock file, that is used to ",
" * get the exclusing file lock. File locks are not acquired on ",
" * jvms before jdk14, this method just return <code> null </code>. ",
" *",
" * @return null, there is opened lock file. ",
" */",
" public StorageRandomAccessFile getLockedFile() {",
" return null;",
" }",
"",
""
],
"header": "@@ -196,6 +196,19 @@ class DirFile extends File implements StorageFile",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/io/DirFile4.java",
"hunks": [
{
"added": [
"\t\t\t\tlockFileOpen = new DirRandomAccessFile4((File) this, \"rw\");"
],
"header": "@@ -150,7 +150,7 @@ class DirFile4 extends DirFile",
"removed": [
"\t\t\t\tlockFileOpen = new RandomAccessFile((File) this, \"rw\");"
]
},
{
"added": [],
"header": "@@ -163,8 +163,6 @@ class DirFile4 extends DirFile",
"removed": [
"\t\t\t\t\tlockFileOpen.writeInt(EXCLUSIVE_FILE_LOCK);",
"\t\t\t\t\tlockFileChannel.force(true);"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/store/raw/data/BaseDataFileFactory.java",
"hunks": [
{
"added": [
"\tprivate String\t\t\tdataDirectory;\t // root directory of files."
],
"header": "@@ -147,8 +147,8 @@ public class BaseDataFileFactory",
"removed": [
"\tprivate String\t\t\tdataDirectory;\t // root directory of files."
]
},
{
"added": [
"",
" /* derby jvm instance id used to prevent concurrent intra-jvm ",
" * boots of a database */ ",
" private static final String DERBY_JVM_ID = \"derby.storage.jvmInstanceId\";",
""
],
"header": "@@ -235,6 +235,11 @@ public class BaseDataFileFactory",
"removed": []
},
{
"added": [
" AccessController.doPrivileged( this);"
],
"header": "@@ -1855,7 +1860,7 @@ public class BaseDataFileFactory",
"removed": [
" AccessController.doPrivileged( this);"
]
},
{
"added": [
" ",
" /**",
" * @throws StandardException",
" */"
],
"header": "@@ -1874,7 +1879,10 @@ public class BaseDataFileFactory",
"removed": [
" // Called from within a privilege block"
]
},
{
"added": [
" \t\texFileLock = ",
" \t\t\tstorageFactory.newStorageFile( DB_EX_LOCKFILE_NAME);"
],
"header": "@@ -1976,8 +1984,8 @@ public class BaseDataFileFactory",
"removed": [
" exFileLock = ",
" storageFactory.newStorageFile( DB_EX_LOCKFILE_NAME);"
]
},
{
"added": [
" // filelock is unreliable, but we should at least leave a file"
],
"header": "@@ -2004,7 +2012,7 @@ public class BaseDataFileFactory",
"removed": [
" // filelock is unreliable, but we should at least leave a file"
]
},
{
"added": [
" /* if it reached here means, db is protected from ",
" * being booted by multiple jvm instances. But file lock method ",
" * used to do that does not protect a db being booted by another ",
" * class loader in the same jvm. Get a lock that will",
" * protect the db being booted by another class loader, if ",
" * it is not booted by another class loader already.",
" */",
" try {",
" getIntraJvmDbLock();",
" }catch (IOException ioe) {",
" throw StandardException.newException(",
" SQLState.DATA_MULTIPLE_CLASSLOADERS_ON_DB, ",
" ioe, databaseDirectory);",
" }",
"",
""
],
"header": "@@ -2053,7 +2061,23 @@ public class BaseDataFileFactory",
"removed": []
},
{
"added": [
" private void privReleaseJBMSLockOnDB() throws IOException, StandardException"
],
"header": "@@ -2080,7 +2104,7 @@ public class BaseDataFileFactory",
"removed": [
" private void privReleaseJBMSLockOnDB() throws IOException"
]
},
{
"added": [
" ",
"\t\t// release the lock that is acquired using tryLock() to prevent",
"\t\t// multiple jvm booting the same database on Unix environments.",
"\t\tif(exFileLock != null) {",
" // release the intra-jvm lock, that is used ",
" // to prevent database boots from a different class ",
" // loaders in the same jvm.",
" releaseIntraJvmDbLock();",
" }"
],
"header": "@@ -2092,12 +2116,16 @@ public class BaseDataFileFactory",
"removed": [
"",
"\t\t//release the lock that is acquired using tryLock() to prevent",
"\t\t//multiple jvm booting the same database on Unix environments.",
"\t\tif(exFileLock != null)",
""
]
},
{
"added": [
" \tFile dataDir = new File (dataDirectory);",
" \tString baseName= dataDir.getName().intern();",
" synchronized(baseName) ",
" { ",
" \tprivGetJBMSLockOnDB();",
" }"
],
"header": "@@ -2820,7 +2848,12 @@ public class BaseDataFileFactory",
"removed": [
" privGetJBMSLockOnDB();"
]
}
]
},
{
"file": "java/shared/org/apache/derby/shared/common/reference/SQLState.java",
"hunks": [
{
"added": [
""
],
"header": "@@ -22,6 +22,7 @@",
"removed": []
}
]
}
] |
derby-DERBY-700-8a393cee
|
DERBY-700 part 2 add ClassLoaderBootTest
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@547046 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-700-992b79d1
|
DERBY-4588 Provide a diagnostic property that will print a stack trace on succes
sful boot to help diagnose dual boot issues after the DERBY-700 fix
To use, set the property derby.stream.error.logBootTrace=true
A stack trace will print in the derby.log on boot and shutdown.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@934996 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/store/raw/data/BaseDataFileFactory.java",
"hunks": [
{
"added": [
" boolean logBootTrace = Boolean.valueOf(startParams.getProperty(Property.LOG_BOOT_TRACE,",
" PropertyUtil.getSystemProperty(Property.LOG_BOOT_TRACE))).booleanValue();"
],
"header": "@@ -354,7 +354,8 @@ public class BaseDataFileFactory",
"removed": [
""
]
},
{
"added": [
" if (logBootTrace)",
" Monitor.logThrowable(new Throwable(\"boot trace\"));"
],
"header": "@@ -364,6 +365,8 @@ public class BaseDataFileFactory",
"removed": []
},
{
"added": [
"\t\tboolean logBootTrace = PropertyUtil.getSystemBoolean(Property.LOG_BOOT_TRACE);"
],
"header": "@@ -461,6 +464,7 @@ public class BaseDataFileFactory",
"removed": []
},
{
"added": [
"\t",
"\t\tif (logBootTrace)",
"\t\t\tMonitor.logThrowable(new Throwable(\"shutdown trace\"));",
"\t\t\t"
],
"header": "@@ -469,6 +473,10 @@ public class BaseDataFileFactory",
"removed": []
}
]
}
] |
derby-DERBY-700-c73be02b
|
DERBY-700: Some cleanup of ClassLoaderBootTest.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@805858 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-704-23c70bdc
|
Fix to DERBY-704, submitted by Knut Anders Hatlen
From Knut:
<quote>
The patch modifies the search for a free slot in the page cache
(org.apache.derby.impl.services.cache.Clock.findFreeItem()) in the
following way:
1) find out how many invalid pages there are in the page cache
2) check whether pages that are skipped in the search are invalid
3) if the number of skipped invalid pages equals the number of
invalid pages, stop the search for invalid pages
</quote>
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@344270 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/services/cache/Clock.java",
"hunks": [
{
"added": [
"\t\t// no need to sync on getting the sizes since if they are",
"\t\t// wrong we will discover it in the loop.",
"\t\t\t\tint invalidItems = holders.size() - validItemCount;",
"",
"\t\t\t\tfor (int i = holders.size() - 1; (invalidItems > 0) && (i >= 0) ; i--) {",
"\t\t\t\t\tif (item.isKept()) {",
"\t\t\t\t\t\tif (!item.isValid()) invalidItems--;",
"\t\t\t\t\t}"
],
"header": "@@ -856,18 +856,21 @@ final class Clock extends Hashtable implements CacheManager, Serviceable {",
"removed": [
"\t\t// no need to sync on getting the sizes since the if",
"\t\t// they are wrong we will just not find a invalid entry in",
"\t\t// the lookup below.",
"\t\t\t\tfor (int i = holders.size() - 1; i >= 0 ; i--) {",
"\t\t\t\t\tif (item.isKept())"
]
}
]
}
] |
derby-DERBY-704-688ccfab
|
DERBY-704 Large page cache kills initial performance, additional comments from Knut.Hatlen@Sun.COM
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@345215 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/services/cache/Clock.java",
"hunks": [
{
"added": [
"\t\t\t\t// 1) find out how many invalid items there are in the",
"\t\t\t\t// cache",
"\t\t\t\t// 2) search for a free invalid item",
"\t\t\t\t// 3) stop searching when there are no more invalid",
"\t\t\t\t// items to find",
"",
"\t\t\t\t// Invalid items might occur in the cache when",
"\t\t\t\t// a) a new item is created in growCache(), but it",
"\t\t\t\t// is not in use yet, or",
"\t\t\t\t// b) an item is deleted (usually when a table is",
"\t\t\t\t// dropped)",
"",
"\t\t\t\t// It is critical to break out of the loop as soon as",
"\t\t\t\t// possible since we are blocking others trying to",
"\t\t\t\t// access the page cache. New items are added to the",
"\t\t\t\t// end of the page cache, so the search for invalid",
"\t\t\t\t// items should start from the end.",
""
],
"header": "@@ -862,8 +862,26 @@ final class Clock extends Hashtable implements CacheManager, Serviceable {",
"removed": []
}
]
}
] |
derby-DERBY-706-2e4a44ee
|
DERBY-706 Improve testing and increase code coverage for Network Server classes
have attached a second patch 'derby-706_2.diff' which adds some more tests and re-arranges/removes some internal methods. Details of patch are:
* DDMWriter: Removes min method because Math.min is used. Use doesRequestContainData() method.
* DDMReader: Use readCodePoint() method
* DRDAConnThread: QRYOPTVAL codepoint is not part of DRDA spec. parseCcsidSBC was giving NPE.
* CodePointNameTable: Add codepoints to be used in protocol.tests
* protocol.tests: Added tests to cover methods which were not tested before.
* Session, DRDAStatement, Database, DRDAProtocolException: Remove some methods which are not needed. The same can be done using other methods.
* TestProto: Use lookup method.
* testProtocol: Added "derby.drda.traceAll=true" to derby.properties file to test methods in DssTrace
* testProperties: Added test for trace off command. Added "derby.drda.traceAll=true" to derby.properties file to test memcheck.
* runtimeinfo: Rearranged test because the output was not predictable on different jvms/machines.
Ran derbyall with Sun JDK 1.4.2 on WinXP. No failures.
Contributed by Deepa Remesh
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@356553 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/drda/org/apache/derby/impl/drda/CodePointNameTable.java",
"hunks": [
{
"added": [
" put (new Integer (CodePoint.MONITOR), \"MONITOR\");"
],
"header": "@@ -70,6 +70,7 @@ class CodePointNameTable extends java.util.Hashtable",
"removed": []
},
{
"added": [
" put (new Integer (CodePoint.PKGNAMCT), \"PKGNAMCT\");"
],
"header": "@@ -83,6 +84,7 @@ class CodePointNameTable extends java.util.Hashtable",
"removed": []
}
]
},
{
"file": "java/drda/org/apache/derby/impl/drda/DDMReader.java",
"hunks": [
{
"added": [],
"header": "@@ -285,17 +285,6 @@ class DDMReader",
"removed": [
"\t/**",
"\t * Return buffer ",
"\t *",
"\t *",
"\t * @return buffer",
"\t */",
"\tprotected byte [] getBuffer()",
"\t{",
"\t\treturn buffer;",
"\t}",
""
]
}
]
},
{
"file": "java/drda/org/apache/derby/impl/drda/DDMWriter.java",
"hunks": [
{
"added": [],
"header": "@@ -1720,12 +1720,6 @@ class DDMWriter",
"removed": [
"",
"\tprivate static int min (int i, int j)",
"\t{",
"\t\treturn (i < j) ? i : j;",
"\t}",
""
]
}
]
},
{
"file": "java/drda/org/apache/derby/impl/drda/DRDAConnThread.java",
"hunks": [
{
"added": [],
"header": "@@ -1714,10 +1714,6 @@ public class DRDAConnThread extends Thread {",
"removed": [
"\t\t\t\tcase CodePoint.QRYOPTVAL:",
"\t\t\t\t\t// optimize for n rows. Not supported by cloudscape(ignore)",
"\t\t\t\t\tparseQRYOPTVAL();",
"\t\t\t\t\tbreak;"
]
},
{
"added": [],
"header": "@@ -1896,12 +1892,6 @@ public class DRDAConnThread extends Thread {",
"removed": [
"\tprivate int parseQRYOPTVAL() throws DRDAProtocolException",
"\t{",
"\t\treader.skipBytes();",
"\t\treturn 0;",
"\t}",
""
]
}
]
},
{
"file": "java/drda/org/apache/derby/impl/drda/Database.java",
"hunks": [
{
"added": [],
"header": "@@ -163,21 +163,6 @@ class Database",
"removed": [
"\t/**",
"\t * Get prepared statement based on pkgnamcsn",
"\t *",
"\t * @param pkgnamcsn - key to access statement",
"\t * @return prepared statement",
"\t */",
"\tprotected PreparedStatement getPreparedStatement(String pkgnamcsn) ",
"\t\tthrows SQLException",
"\t{",
"\t\tcurrentStatement = getDRDAStatement(pkgnamcsn);",
"\t\tif (currentStatement == null)",
"\t\t\treturn null;",
"\t\treturn currentStatement.getPreparedStatement();",
"\t}",
"\t"
]
}
]
}
] |
derby-DERBY-706-82c7dde0
|
DERBY-706 Improve testing and increase code coverage for Network Server classes
Contributed by Deepa Remesh
This patch adds some tests for network server and re-arranges/removes some internal methods which are not used.
Details of patch are: * derbynet/getCurrentProperties.java - Added tests for NetworkServerControl.logConnections and setTraceDirectory methods. Modified getCurrentProperties_sed.properties to use a substitute instead of delete for traceDirectory. * derbynet/testProperties.java - Added some more command line tests. * derbynet/timeslice.java and maxthreads.java - Added tests for invalid values. * derbynet/runtimeinfo.java and sysinfo.java - Added test to call methods in NetworkServer control * Modified master files. * DRDAResultSet.java - removed unused constructor "DRDAResultSet(ResultSet rs)" * DRDAStatement.java - Changed getNumRsCols() to use getRsDRDATypes() instead of directly calling DRDAResultSet method. Removed isProcedure() method which is not used. Changed getResultSetCursorName() to call drdaRs.getResultSetCursorName() which handles case for null result set. * NetworkServerControlImpl.java - Removed methods for connection pooling which is not implemented and not used. With this patch, I ran derbyall with Sun JDK 1.4.2. No failures.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@348577 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/drda/org/apache/derby/impl/drda/DRDAStatement.java",
"hunks": [
{
"added": [],
"header": "@@ -802,7 +802,6 @@ class DRDAStatement",
"removed": [
""
]
},
{
"added": [
"\t\tint[] rsDrdaTypes = getRsDRDATypes();"
],
"header": "@@ -1183,7 +1182,7 @@ class DRDAStatement",
"removed": [
"\t\tint[] rsDrdaTypes = currentDrdaRs.getRsDRDATypes();"
]
}
]
},
{
"file": "java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java",
"hunks": [
{
"added": [],
"header": "@@ -915,48 +915,6 @@ public final class NetworkServerControlImpl {",
"removed": [
"\t/**",
"\t * Set connection pool parameters for a database",
"\t *",
"\t * @param database\tdatabase parameters applied to",
"\t * @param min\t\tminimum number of connections, if 0, pooled connections not used",
"\t *\t\t\t\t\t\tif -1, use default\t\t\t\t\t\t",
"\t * @param max\t\tmaximum number of connections, if 0, pooled connections ",
"\t *\t\t\t\t\t\tcreated when no free connection available, if -1, ",
"\t *\t\t\t\t\t\tuse default",
"\t * @param host\t\tmachine network server is running on, if null, localhost is used",
"\t * @param portNumber\tport number server is to use, if <= 0, default port number",
"\t *\t\t\tis used",
"\t *",
"\t * @exception Exception\tthrows an exception if an error occurs",
"\t */",
"\tprotected void setConnectionPoolParameters(String database, int min, int max,",
"\t\tString host, int portNumber)",
"\t\tthrows Exception",
"\t{",
"\t\tconsolePropertyMessage(\"DRDA_NotImplemented.S\", \"conpool\");",
"\t}",
"",
"\t/**",
"\t * Set default connection pool parameters ",
"\t *",
"\t * @param min\t\tminimum number of connections, if 0, pooled connections not used",
"\t *\t\t\t\t\t\tif -1, use default",
"\t * @param max\t\tmaximum number of connections, if 0, pooled connections ",
"\t *\t\t\t\t\t\tcreated when no free connection available",
"\t *\t\t\t\t\t\tif -1, use default",
"\t * @param host\t\tmachine network server is running on, if null, localhost is used",
"\t * @param portNumber\tport number server is to use, if <= 0, default port number",
"\t *\t\t\tis used",
"\t *",
"\t * @exception Exception\tthrows an exception if an error occurs",
"\t */",
"\tprotected void setConnectionPoolParameters(int min, int max, String host, ",
"\t\t\tint portNumber) throws Exception",
"\t{",
"\t\tconsolePropertyMessage(\"DRDA_NotImplemented.S\", \"conpool\");",
"\t}",
""
]
}
]
}
] |
derby-DERBY-707-b7cdec2d
|
DERBY-707 providing RowLocation for deleted+purged row to GenericConglomerateController causes nullpointerexception, submitted by andreas.korneliussen@sun.com
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@345237 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/store/access/conglomerate/GenericConglomerateController.java",
"hunks": [
{
"added": [
" if (!open_conglom.latchPage(pos)) ",
" {",
" return false;",
" }"
],
"header": "@@ -180,7 +180,10 @@ public abstract class GenericConglomerateController",
"removed": [
" open_conglom.latchPage(pos);"
]
},
{
"added": [
" if (!open_conglom.latchPage(pos)) ",
" {",
" return false;",
" }"
],
"header": "@@ -362,7 +365,10 @@ public abstract class GenericConglomerateController",
"removed": [
" open_conglom.latchPage(pos);"
]
}
]
},
{
"file": "java/testing/org/apache/derbyTesting/unitTests/store/T_AccessFactory.java",
"hunks": [
{
"added": [
" * test 1 - test heap fetch, delete and replace of row on page which does not exist. ",
" * test 2 - test heap fetch, delete and replace of row on page where row does not exist."
],
"header": "@@ -3750,8 +3750,8 @@ public class T_AccessFactory extends T_Generic",
"removed": [
" * test 1 - test heap fetch of row on page which does not exist. ",
" * test 2 - test heap fetch of row on page where row does not exist."
]
},
{
"added": [
" // Test heap fetch of row on page which does not exist.",
" ",
" // Test heap replace of row on page which does not exist.",
" FormatableBitSet update_desc = new FormatableBitSet(1);",
" if (cc.replace(deleted_page_rowloc, big_row.getRowArray(), update_desc)) ",
" {",
" throw T_Fail.testFailMsg(",
" \"(readUncommitted) delete should ret false for reclaimed page.\");",
" }",
" ",
" // Test heap fetch (overloaded call) of row on page which does not exist.",
" if (cc.fetch(deleted_page_rowloc, big_row.getRowArray(), null, true))",
" {",
" throw T_Fail.testFailMsg(",
" \"(readUncommitted) fetch should ret false for reclaimed page.\");",
" }",
" ",
" // Test heap delete of row on page which does not exist.",
" if (cc.delete(deleted_page_rowloc)) ",
" {",
" throw T_Fail.testFailMsg(",
" \"(readUncommitted) delete should ret false for reclaimed page.\");",
" }",
" "
],
"header": "@@ -3848,11 +3848,35 @@ public class T_AccessFactory extends T_Generic",
"removed": []
},
{
"added": [
" // test heap fetch of row on page where row does not exist.",
" ",
" // test heap replace of row on page where row does not exist.",
" if (cc.replace(deleted_page_rowloc, big_row.getRowArray(), update_desc)) ",
" {",
" throw T_Fail.testFailMsg(",
" \"(readUncommitted) delete should ret false for reclaimed page.\");",
" }",
"",
" // test heap fetch (overloaded) of row on page where row does not exist.",
" if (cc.fetch(deleted_page_rowloc, big_row.getRowArray(), null, true))",
" {",
" throw T_Fail.testFailMsg(",
" \"(readUncommitted) fetch should ret false for reclaimed page.\");",
" }",
" ",
" // test heap delete of row on page where row does not exist.",
" if (cc.delete(deleted_page_rowloc)) ",
" {",
" throw T_Fail.testFailMsg(",
" \"(readUncommitted) delete should ret false for reclaimed page.\");",
" }",
""
],
"header": "@@ -3943,11 +3967,34 @@ public class T_AccessFactory extends T_Generic",
"removed": []
}
]
}
] |
derby-DERBY-709-a4b59331
|
DERBY-709, committing on behalf of Suresh Thalamati
-- Removed the requirement for read permission on "user.dir" for backup to
run under security manager. Absolute Path were used only to log into backup
history file. Changed it to log canonical paths only if it can be obtainer
,otherwise only relative paths are written to the backup history file.
-- Added a missing privileged blocks to the save service.properties file into
the backup.
-- Added privileged blocks for test util file functions that are called
through SQL functions/procedures.
-- Enabled some of the tests which were not running under security manager
earlier because of this bug to run by default with security manager.
Backup tests that test backup with jar Operations still can not be run under
security manager due to bug DERBY-537.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@381389 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/store/raw/RawStore.java",
"hunks": [
{
"added": [
" private static final int REGULAR_FILE_GET_CANONICALPATH_ACTION = 15;",
" private static final int STORAGE_FILE_GET_CANONICALPATH_ACTION = 16;"
],
"header": "@@ -140,6 +140,8 @@ public final class RawStore implements RawStoreFactory, ModuleControl, ModuleSup",
"removed": []
},
{
"added": [
" StorageFile dbHistoryFile = null;",
" File backupHistoryFile = null;",
" "
],
"header": "@@ -592,8 +594,10 @@ public final class RawStore implements RawStoreFactory, ModuleControl, ModuleSup",
"removed": [
""
]
},
{
"added": [
" ",
"\t\t\tbackupcopy = new File(backupDir, dbname);",
" MessageId.STORE_BACKUP_STARTED, ",
" canonicalDbName, ",
" getFilePath(backupcopy)));",
" ",
" // check if a backup copy of this database already exists,"
],
"header": "@@ -604,14 +608,17 @@ public final class RawStore implements RawStoreFactory, ModuleControl, ModuleSup",
"removed": [
" MessageId.STORE_BACKUP_STARTED, canonicalDbName));",
"",
"\t\t\t// if a backup copy of this database already exists,",
"\t\t\tbackupcopy = new File(backupDir, dbname);"
]
},
{
"added": [
" getFilePath(backupcopy),",
" getFilePath(oldbackup)));"
],
"header": "@@ -637,8 +644,8 @@ public final class RawStore implements RawStoreFactory, ModuleControl, ModuleSup",
"removed": [
" backupcopy.getCanonicalPath(),",
" oldbackup.getCanonicalPath()));"
]
},
{
"added": [
" dbHistoryFile = storageFactory.newStorageFile(BACKUP_HISTORY);",
" backupHistoryFile = new File(backupcopy, BACKUP_HISTORY); ",
" // copy the history file into the backup. ",
" if(!privCopyFile(dbHistoryFile, backupHistoryFile))",
" throw StandardException. ",
" newException(SQLState.RAWSTORE_ERROR_COPYING_FILE,",
" dbHistoryFile, backupHistoryFile); ",
"",
""
],
"header": "@@ -651,6 +658,15 @@ public final class RawStore implements RawStoreFactory, ModuleControl, ModuleSup",
"removed": []
},
{
"added": [
" logHistory(historyFile,",
" MessageService.getTextMessage(",
" MessageId.STORE_DATA_SEG_BACKUP_COMPLETED,",
" getFilePath(segBackup)));",
""
],
"header": "@@ -780,13 +796,12 @@ public final class RawStore implements RawStoreFactory, ModuleControl, ModuleSup",
"removed": [
"\t\t\tlogHistory(historyFile,",
" MessageService.getTextMessage(",
" MessageId.STORE_COPIED_DB_DIR,",
" canonicalDbName,",
" backupcopy.getCanonicalPath()));",
"\t\t"
]
},
{
"added": [
" getFilePath(logdir),",
" getFilePath(logBackup)));"
],
"header": "@@ -794,8 +809,8 @@ public final class RawStore implements RawStoreFactory, ModuleControl, ModuleSup",
"removed": [
" logdir.getCanonicalPath(),",
" logBackup.getCanonicalPath()));"
]
},
{
"added": [
" getFilePath(oldbackup)));",
" // copy the updated version of history file with current",
" // backup information into the backup.",
" if(!privCopyFile(dbHistoryFile, backupHistoryFile))",
" throw StandardException. ",
" newException(SQLState.RAWSTORE_ERROR_COPYING_FILE,",
" dbHistoryFile, backupHistoryFile); "
],
"header": "@@ -841,13 +856,19 @@ public final class RawStore implements RawStoreFactory, ModuleControl, ModuleSup",
"removed": [
" oldbackup.getCanonicalPath()));"
]
},
{
"added": [
" /*",
" * Get the file path. If the canonical path can be obtained then return the ",
" * canonical path, otherwise just return the abstract path. Typically if",
" * there are no permission to read user.dir when running under security",
" * manager canonical path can not be obtained.",
" *",
" * This method is used to a write path name to error/status log file, where it",
" * would be nice to print full paths but not esstential that the user ",
" * grant permissions to read user.dir property.",
" */",
" private String getFilePath(StorageFile file) {",
" String path = privGetCanonicalPath(file);",
" if(path != null ) {",
" return path;",
" }else {",
" //can not get the canoncal path, ",
" // return the abstract path",
" return file.getPath();",
" }",
" }",
"",
" /*",
" * Get the file path. If the canonical path can be obtained then return the ",
" * canonical path, otherwise just return the abstract path. Typically if",
" * there are no permission to read user.dir when running under security",
" * manager canonical path can not be obtained.",
" *",
" * This method is used to a write a file path name to error/status log file, ",
" * where it would be nice to print full paths but not esstential that the user",
" * grant permissions to read user.dir property.",
" *",
" */",
" private String getFilePath(File file) {",
" String path = privGetCanonicalPath(file);",
" if(path != null ) {",
" return path;",
" }else {",
" // can not get the canoncal path, ",
" // return the abstract path",
" return file.getPath();",
" }",
" }"
],
"header": "@@ -1172,6 +1193,48 @@ public final class RawStore implements RawStoreFactory, ModuleControl, ModuleSup",
"removed": []
},
{
"added": [
"",
"",
" private synchronized String privGetCanonicalPath(final StorageFile file)",
" {",
" actionCode = STORAGE_FILE_GET_CANONICALPATH_ACTION;",
" actionStorageFile = file;",
"",
" try",
" {",
" return (String) AccessController.doPrivileged( this);",
" }",
" catch( PrivilegedActionException pae) { return null;} // does not throw an exception",
" finally",
" {",
" actionStorageFile = null;",
" }",
" }",
"",
"",
" private synchronized String privGetCanonicalPath(final File file)",
" {",
" actionCode = REGULAR_FILE_GET_CANONICALPATH_ACTION;",
" actionRegularFile = file;",
"",
" try",
" {",
" return (String) AccessController.doPrivileged( this);",
" }",
" catch( PrivilegedActionException pae) { return null;} // does not throw an exception",
" finally",
" {",
" actionRegularFile = null;",
" }",
" }",
""
],
"header": "@@ -1472,7 +1535,41 @@ public final class RawStore implements RawStoreFactory, ModuleControl, ModuleSup",
"removed": [
" "
]
}
]
},
{
"file": "java/testing/org/apache/derbyTesting/functionTests/util/FTFileUtil.java",
"hunks": [
{
"added": [
"import java.security.AccessController;",
"import java.security.PrivilegedAction;",
"import java.security.PrivilegedActionException;",
"import java.security.PrivilegedExceptionAction;",
""
],
"header": "@@ -22,6 +22,11 @@ package org.apache.derbyTesting.functionTests.util;",
"removed": []
},
{
"added": [
" * rename a file. ",
" * This method is called by some tests through a SQL procedure:",
" * RENAME_FILE(LOCATION VARCHAR(32000), NAME VARCHAR(32000), ",
" * NEW_NAME VARCHAR(32000))",
" * @param location location of the file",
" * @param name the file's name",
"\t * @param newName the file's new name",
"\tpublic static void renameFile(String location, String name , ",
" String newName) throws Exception",
"\t\tfinal File src = new File(location, name);",
"\t\tfinal File dst = new File(location, newName);",
" ",
" // needs to run in a privileged block as it will be",
"\t\t// called through a SQL statement and thus a generated",
"\t\t// class. The generated class on the stack has no permissions",
"\t\t// granted to it.",
" AccessController.doPrivileged(new PrivilegedExceptionAction() {",
" public Object run() throws Exception {",
" if(!src.renameTo(dst))",
" {",
" throw new Exception(\"unable to rename File: \" +",
" src.getAbsolutePath() +",
" \" To: \" + dst.getAbsolutePath());",
" }",
" ",
" return null; // nothing to return",
" }",
" });",
" }",
" * This method is called by some tests through a SQL function:",
" * fileExists(fileName varchar(128))returns VARCHAR(100)",
" *",
" public static String fileExists(String fileName) ",
" throws PrivilegedActionException",
" final File fl = new File(fileName);",
" ",
" // needs to run in a privileged block as it will be",
"\t\t// called through a SQL statement and thus a generated",
"\t\t// class. The generated class on the stack has no permissions",
"\t\t// granted to it.",
"",
" return (String) ",
" AccessController.doPrivileged(new PrivilegedExceptionAction() {",
" public Object run()",
" {",
" if(fl.exists()) {",
" return \"true\";",
" }else {",
" return \"false\";",
" }",
" }",
" });"
],
"header": "@@ -50,40 +55,71 @@ public class FTFileUtil",
"removed": [
"\t rename a file",
"\t @param location location of the file",
"\t @param name the file's name",
"\t @param newName the file's new name",
"\tpublic static void renameFile(String location, String name , String newName) throws Exception",
"\t\tFile src = new File(location, name);",
"\t\tFile dst = new File(location, newName);",
"\t\tif(!src.renameTo(dst))",
"\t\t{",
"\t\t\tthrow new Exception(\"unable to rename File: \" +",
"\t\t\t\t\t\t\t\tsrc.getAbsolutePath() +",
"\t\t\t\t\t\t\t \" To: \" + dst.getAbsolutePath());",
"\t\t}",
"\t}",
" public static String fileExists(String fileName) throws Exception",
" File fl = new File(fileName);",
" if(fl.exists()) {",
" return \"true\";",
" }else {",
" return \"false\";",
" }"
]
},
{
"added": [
" * Remove a directory and all of its contents.",
" * This method is called by some tests through a SQL function:",
" * removeDirectory(fileName varchar(128)) returns VARCHAR(100)",
" * @param name the file's name.",
"\tpublic static String removeDirectory(final String directory)",
" throws PrivilegedActionException",
" // needs to run in a privileged block as it will be",
"\t\t// called through a SQL statement and thus a generated",
"\t\t// class. The generated class on the stack has no permissions",
"\t\t// granted to it.",
"",
" return (String) ",
" AccessController.doPrivileged(new PrivilegedExceptionAction() {",
" public Object run()",
" {",
" return (removeDirectory(",
" new File(directory)) ? \"true\" : \"false\");",
" }",
" });"
],
"header": "@@ -128,17 +164,32 @@ public class FTFileUtil",
"removed": [
" *\tRemove a directory and all of its contents.",
" * @param name the file's name.",
"\tpublic static String removeDirectory(String directory)",
"\t return (removeDirectory(new File(directory)) ? \"true\" : \"false\");"
]
}
]
}
] |
derby-DERBY-709-e9308b5f
|
DERBY-709, committing on behalf of Suresh Thalamati
This patch (derby-709_latest.diff) fixes the problems appreared with earlier
patch when tests are run againest JARS.
--- correctly catch the Security Exception when there is no permission to get
a canonical path.
--- Modified the deryb_tests.plocy to allow deltes in
${user.dir}${/}extinout${/}- .,
It is needed because, backup tests deletes the old copy of the backup at the
backup location.
--- set noSecurityManager = true for the tests that can not be run under
security manager due to bug : 1066
--- changes st_1 properties to use external tests dirs , so that tests does not
required "user.dir" permission to create parent directories for the backup
paths.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@381883 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/store/raw/RawStore.java",
"hunks": [
{
"added": [
"import java.lang.SecurityException;",
""
],
"header": "@@ -83,6 +83,8 @@ import java.net.MalformedURLException;",
"removed": []
},
{
"added": [
" catch( PrivilegedActionException pae) { ",
" return null;",
" } // does not throw an exception",
" catch(SecurityException se) {",
" // there are no permission to get canonical path ",
" // just return null.",
" return null;",
" }"
],
"header": "@@ -1546,7 +1548,14 @@ public final class RawStore implements RawStoreFactory, ModuleControl, ModuleSup",
"removed": [
" catch( PrivilegedActionException pae) { return null;} // does not throw an exception"
]
}
]
}
] |
derby-DERBY-712-139ca850
|
DERBY-712: Wire in cacheable sequence generation, making the NEXT VALUE FOR clause behave as expected.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@907654 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/iapi/sql/dictionary/SequenceDescriptor.java",
"hunks": [
{
"added": [
" * See the header comment of SYSSEQUENCESRowFactory for the",
" * contract of that table. In particular, if the CURRENTVALUE column",
" * is null, then the sequence has been exhausted and no more values",
" * can be generated from it."
],
"header": "@@ -37,6 +37,10 @@ import org.apache.derby.impl.sql.catalog.DDdependableFinder;",
"removed": []
},
{
"added": [
" private Long currentValue; // could be null",
" private boolean canCycle;"
],
"header": "@@ -47,12 +51,12 @@ public class SequenceDescriptor extends TupleDescriptor",
"removed": [
" private long currentValue;",
" private boolean cycle;"
]
},
{
"added": [
" DataTypeDescriptor dataType, Long currentValue,",
" long startValue, long minimumValue, long maximumValue, long increment, boolean canCycle) {"
],
"header": "@@ -64,8 +68,8 @@ public class SequenceDescriptor extends TupleDescriptor",
"removed": [
" DataTypeDescriptor dataType, long currentValue,",
" long startValue, long minimumValue, long maximumValue, long increment, boolean cycle) {"
]
},
{
"added": [
" this.canCycle = canCycle;"
],
"header": "@@ -83,7 +87,7 @@ public class SequenceDescriptor extends TupleDescriptor",
"removed": [
" this.cycle = cycle;"
]
},
{
"added": [
" \"canCycle: \" + canCycle + \"\\n\";"
],
"header": "@@ -113,7 +117,7 @@ public class SequenceDescriptor extends TupleDescriptor",
"removed": [
" \"cycle: \" + cycle + \"\\n\";"
]
},
{
"added": [
" public Long getCurrentValue() {"
],
"header": "@@ -284,7 +288,7 @@ public class SequenceDescriptor extends TupleDescriptor",
"removed": [
" public long getCurrentValue() {"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java",
"hunks": [
{
"added": [
" private CacheManager sequenceGeneratorCache;",
"\tint\t\t\t\tstmtCacheSize;",
" private int seqgenCacheSize;"
],
"header": "@@ -369,10 +369,12 @@ public final class\tDataDictionaryImpl",
"removed": [
"\tint\t\t\t\tstmtCacheSize;\t"
]
},
{
"added": [
"\t\tvalue = startParams.getProperty(Property.LANG_SEQGEN_CACHE_SIZE);",
"\t\tseqgenCacheSize = PropertyUtil.intPropertyValue(Property.LANG_SEQGEN_CACHE_SIZE, value,",
"\t\t\t\t\t\t\t\t\t 0, Integer.MAX_VALUE, Property.LANG_SEQGEN_CACHE_SIZE_DEFAULT);",
""
],
"header": "@@ -602,6 +604,10 @@ public final class\tDataDictionaryImpl",
"removed": []
},
{
"added": [
"\t\tsequenceGeneratorCache = cf.newCacheManager",
" ( this, \"SequenceGeneratorCache\", seqgenCacheSize, seqgenCacheSize );"
],
"header": "@@ -640,6 +646,8 @@ public final class\tDataDictionaryImpl",
"removed": []
},
{
"added": [
"\t\tif ( cm == OIDTdCache ) { return new OIDTDCacheable( this ); }",
"\t\telse if ( cm == nameTdCache ) { return new NameTDCacheable( this ); }",
" else if ( cm == permissionsCache ) { return new PermissionsCacheable( this ); }",
" else if ( cm == sequenceGeneratorCache ) { return new SequenceUpdater.SyssequenceUpdater( this ); }",
"\t\telse { return new SPSNameCacheable( this ); }"
],
"header": "@@ -868,15 +876,11 @@ public final class\tDataDictionaryImpl",
"removed": [
"\t\tif (cm == OIDTdCache)",
"\t\t\treturn new OIDTDCacheable(this);",
"\t\telse if (cm == nameTdCache)",
"\t\t\treturn new NameTDCacheable(this);",
" else if( cm == permissionsCache)",
" return new PermissionsCacheable(this);",
"\t\telse {",
"\t\t\treturn new SPSNameCacheable(this);",
"\t\t}"
]
},
{
"added": [
"\t\tsequenceGeneratorCache.cleanAll();",
"\t\tsequenceGeneratorCache.ageOut();"
],
"header": "@@ -8134,6 +8138,8 @@ public final class\tDataDictionaryImpl",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/catalog/SYSSEQUENCESRowFactory.java",
"hunks": [
{
"added": [
" * Factory for creating a SYSSEQUENCES row. The contract of this table is this:",
" * if the CURRENTVALUE column is null, then the sequence is exhausted and",
" * no more values can be generated from it.",
"public class SYSSEQUENCESRowFactory extends CatalogRowFactory",
"{",
" public static final String TABLENAME_STRING = \"SYSSEQUENCES\";",
" public static final int SYSSEQUENCES_COLUMN_COUNT = 10;",
" public static final int SYSSEQUENCES_SEQUENCEID = 1;",
" public static final int SYSSEQUENCES_SEQUENCENAME = 2;",
" public static final int SYSSEQUENCES_SCHEMAID = 3;",
" public static final int SYSSEQUENCES_SEQUENCEDATATYPE = 4;",
" public static final int SYSSEQUENCES_CURRENT_VALUE = 5;",
" public static final int SYSSEQUENCES_START_VALUE = 6;",
" public static final int SYSSEQUENCES_MINIMUM_VALUE = 7;",
" public static final int SYSSEQUENCES_MAXIMUM_VALUE = 8;",
" public static final int SYSSEQUENCES_INCREMENT = 9;",
" public static final int SYSSEQUENCES_CYCLE_OPTION = 10;"
],
"header": "@@ -45,25 +45,27 @@ import org.apache.derby.iapi.types.DataTypeDescriptor;",
"removed": [
" * Factory for creating a SYSSEQUENCES row.",
"public class SYSSEQUENCESRowFactory extends CatalogRowFactory {",
" private static final String TABLENAME_STRING = \"SYSSEQUENCES\";",
"",
" private static final int SYSSEQUENCES_COLUMN_COUNT = 10;",
" private static final int SYSSEQUENCES_SEQUENCEID = 1;",
" private static final int SYSSEQUENCES_SEQUENCENAME = 2;",
" private static final int SYSSEQUENCES_SCHEMAID = 3;",
" private static final int SYSSEQUENCES_SEQUENCEDATATYPE = 4;",
" private static final int SYSSEQUENCES_CURRENT_VALUE = 5;",
" private static final int SYSSEQUENCES_START_VALUE = 6;",
" private static final int SYSSEQUENCES_MINIMUM_VALUE = 7;",
" private static final int SYSSEQUENCES_MAXIMUM_VALUE = 8;",
" private static final int SYSSEQUENCES_INCREMENT = 9;",
" private static final int SYSSEQUENCES_CYCLE_OPTION = 10;"
]
},
{
"added": [
" Long currentValue = null;",
" boolean canCycle = false;"
],
"header": "@@ -118,12 +120,12 @@ public class SYSSEQUENCESRowFactory extends CatalogRowFactory {",
"removed": [
" long currentValue = 0;",
" boolean cycle = false;"
]
},
{
"added": [
" canCycle = sd.canCycle();"
],
"header": "@@ -143,7 +145,7 @@ public class SYSSEQUENCESRowFactory extends CatalogRowFactory {",
"removed": [
" cycle = sd.isCycle();"
]
},
{
"added": [
" SQLLongint curVal;",
" if ( currentValue == null ) { curVal = new SQLLongint(); }",
" else { curVal = new SQLLongint( currentValue.longValue() ); }",
" row.setColumn(SYSSEQUENCES_CURRENT_VALUE, curVal );"
],
"header": "@@ -162,7 +164,10 @@ public class SYSSEQUENCESRowFactory extends CatalogRowFactory {",
"removed": [
" row.setColumn(SYSSEQUENCES_CURRENT_VALUE, new SQLLongint(currentValue));"
]
},
{
"added": [
" row.setColumn(SYSSEQUENCES_CYCLE_OPTION, new SQLChar(canCycle ? \"Y\" : \"N\"));"
],
"header": "@@ -177,7 +182,7 @@ public class SYSSEQUENCESRowFactory extends CatalogRowFactory {",
"removed": [
" row.setColumn(SYSSEQUENCES_CYCLE_OPTION, new SQLChar(cycle ? \"Y\" : \"N\"));"
]
},
{
"added": [
" Long currentValue;"
],
"header": "@@ -203,7 +208,7 @@ public class SYSSEQUENCESRowFactory extends CatalogRowFactory {",
"removed": [
" long currentValue;"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/NextSequenceNode.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.reference.SQLState;",
"import org.apache.derby.iapi.reference.ClassName;",
"import org.apache.derby.iapi.services.classfile.VMOpcode;"
],
"header": "@@ -21,9 +21,12 @@",
"removed": []
},
{
"added": [
" if ( sequenceDescriptor == null )",
" {",
" throw StandardException.newException(SQLState.LANG_OBJECT_NOT_FOUND, \"SEQUENCE\", sequenceName.getFullTableName());",
" }",
""
],
"header": "@@ -69,6 +72,11 @@ public class NextSequenceNode extends ValueNode {",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/execute/BaseActivation.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.types.StringDataValue;"
],
"header": "@@ -75,6 +75,7 @@ import org.apache.derby.iapi.types.DataValueDescriptor;",
"removed": []
}
]
},
{
"file": "java/shared/org/apache/derby/shared/common/reference/SQLState.java",
"hunks": [
{
"added": [
" String LANG_SEQUENCE_GENERATOR_EXHAUSTED = \"2200H.S\";"
],
"header": "@@ -699,6 +699,7 @@ public interface SQLState {",
"removed": []
}
]
}
] |
derby-DERBY-712-1c7cfce2
|
DERBY-712: Support for sequences
Added NextSequenceNode.java that was forgotten in the previous
commit. Contributed by Suran Jayathilaka <suranjay@gmail.com>.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@894146 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/sql/compile/NextSequenceNode.java",
"hunks": [
{
"added": [
"/*",
"",
" Derby - Class org.apache.derby.impl.sql.compile.NextSequenceNode",
"",
" Licensed to the Apache Software Foundation (ASF) under one or more",
" contributor license agreements. See the NOTICE file distributed with",
" this work for additional information regarding copyright ownership.",
" The ASF licenses this file to you under the Apache License, Version 2.0",
" (the \"License\"); you may not use this file except in compliance with",
" the License. You may obtain a copy of the License at",
"",
" http://www.apache.org/licenses/LICENSE-2.0",
"",
" Unless required by applicable law or agreed to in writing, software",
" distributed under the License is distributed on an \"AS IS\" BASIS,",
" WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.",
" See the License for the specific language governing permissions and",
" limitations under the License.",
"",
" */",
"package org.apache.derby.impl.sql.compile;",
"",
"import org.apache.derby.iapi.error.StandardException;",
"import org.apache.derby.iapi.services.sanity.SanityManager;",
"import org.apache.derby.iapi.services.compiler.MethodBuilder;",
"import org.apache.derby.iapi.services.compiler.LocalField;",
"import org.apache.derby.iapi.sql.dictionary.SequenceDescriptor;",
"import org.apache.derby.iapi.sql.dictionary.SchemaDescriptor;",
"",
"import java.util.Vector;",
"import java.sql.Types;",
"",
"/**",
" * A class that represents a value obtained from a Sequence using 'NEXT VALUE'",
" */",
"public class NextSequenceNode extends ValueNode {",
"",
" private TableName sequenceName;",
" private SequenceDescriptor sequenceDescriptor;",
"",
" /**",
" * Initializer for a NextSequenceNode",
" *",
" * @param sequenceName The name of the sequence being called",
" * @throws org.apache.derby.iapi.error.StandardException",
" * Thrown on error",
" */",
" public void init(Object sequenceName) throws StandardException {",
" this.sequenceName = (TableName) sequenceName;",
" }",
"",
" /**",
" * Bind this expression. This means binding the sub-expressions,",
" * as well as figuring out what the return type is for this expression.",
" *",
" * @param fromList The FROM list for the query this",
" * expression is in, for binding columns.",
" * @param subqueryList The subquery list being built as we find SubqueryNodes",
" * @param aggregateVector The aggregate vector being built as we find AggregateNodes",
" * @return The new top of the expression tree.",
" * @throws StandardException Thrown on error",
" */",
" public ValueNode bindExpression(",
" FromList fromList, SubqueryList subqueryList,",
" Vector aggregateVector, boolean forQueryRewrite)",
" throws StandardException {",
"",
" // lookup sequence object in the data dictionary",
" SchemaDescriptor sd = getSchemaDescriptor(sequenceName.getSchemaName());",
" sequenceDescriptor = getDataDictionary().getSequenceDescriptor(sd, sequenceName.getTableName());",
"",
" // set the datatype of the value node",
" this.setType(sequenceDescriptor.getDataType());",
"",
" ValueNode returnNode = this;",
"",
" return returnNode;",
"",
" }",
"",
"",
" public void generateExpression",
" (",
" ExpressionClassBuilder acb,",
" MethodBuilder mb",
" ) throws StandardException {",
"",
" //TODO : Proper implementation for value generation",
" generateConstant(acb, mb); //dummy method to return a constant",
"",
" acb.generateDataValue(mb, getTypeCompiler(),",
" getTypeServices().getCollationType(), (LocalField) null);",
"",
" }",
"",
" /**",
" * Dummy implementation to return a constant. Will be replaced with actual NEXT VALUE logic.",
" *",
" * @param ecb The ExpressionClassBuilder for the class being built",
" * @param mb The method the expression will go into",
" * @throws StandardException on error",
" */",
" public void generateConstant",
" (",
" ExpressionClassBuilder ecb,",
" MethodBuilder mb",
" ) throws StandardException {",
" switch (getTypeServices().getJDBCTypeId()) {",
" case Types.INTEGER:",
" mb.push(1);",
" break;",
" default:",
" if (SanityManager.DEBUG) {",
" SanityManager.THROWASSERT(",
" \"Unexpected dataType = \" + getTypeServices().getJDBCTypeId());",
" }",
" }",
"",
" }",
"",
" /**",
" * Convert this object to a String. See comments in QueryTreeNode.java",
" * for how this should be done for tree printing.",
" *",
" * @return This object as a String",
" */",
"",
" public String toString() {",
" if (SanityManager.DEBUG) {",
" return super.toString();",
" } else {",
" return \"\";",
" }",
" }",
"",
" protected boolean isEquivalent(ValueNode other) throws StandardException {",
" return false;",
" }",
"}"
],
"header": "@@ -0,0 +1,139 @@",
"removed": []
}
]
}
] |
derby-DERBY-712-2f4a1a09
|
DERBY-712: Only allow RESTRICTed drops of sequences.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@910255 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/testing/org/apache/derbyTesting/junit/JDBC.java",
"hunks": [
{
"added": [
" if ( \"TYPE\".equals( dropType ) || \"SEQUENCE\".equals( dropType ) ) { raw = raw + \" restrict \"; }"
],
"header": "@@ -389,7 +389,7 @@ public class JDBC {",
"removed": [
" if ( \"TYPE\".equals( dropType ) ) { raw = raw + \" restrict \"; }"
]
}
]
}
] |
derby-DERBY-712-4e119ab7
|
DERBY-712: Fix problem in 888060 having to do with placement of sanity ifdefs.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@888129 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/sql/compile/PrivilegeNode.java",
"hunks": [
{
"added": [
" }",
" switch( this.objectType)",
" {",
" case TABLE_PRIVILEGES:",
" if( SanityManager.DEBUG)",
" }",
" objectName = (TableName) objectOfPrivilege;",
" this.specificPrivileges = (TablePrivilegesNode) specificPrivileges;",
" break;",
" ",
" case ROUTINE_PRIVILEGES:",
" if( SanityManager.DEBUG)",
" {",
" }",
" routineDesignator = (RoutineDesignator) objectOfPrivilege;",
" objectName = routineDesignator.name;",
" break;",
" ",
" default:",
" if( SanityManager.DEBUG)",
" {",
" }"
],
"header": "@@ -65,27 +65,36 @@ public class PrivilegeNode extends QueryTreeNode",
"removed": [
" switch( this.objectType)",
" case TABLE_PRIVILEGES:",
" objectName = (TableName) objectOfPrivilege;",
" this.specificPrivileges = (TablePrivilegesNode) specificPrivileges;",
" break;",
"",
" case ROUTINE_PRIVILEGES:",
" routineDesignator = (RoutineDesignator) objectOfPrivilege;",
" objectName = routineDesignator.name;",
" break;",
"",
" default:",
" } // end of init"
]
}
]
}
] |
derby-DERBY-712-66d9f5a2
|
DERBY-712: Small cleanup of PrivilegeNode before adding support for USAGE privilege.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@888060 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/sql/compile/PrivilegeNode.java",
"hunks": [
{
"added": [
" private TableName objectName;",
" private TablePrivilegesNode specificPrivileges; // Null for routine and usage privs",
" private RoutineDesignator routineDesignator; // null for table and usage privs"
],
"header": "@@ -47,8 +47,9 @@ public class PrivilegeNode extends QueryTreeNode",
"removed": [
" private Object objectOfPrivilege;",
" private TablePrivilegesNode specificPrivileges; // Null for routines"
]
},
{
"added": [],
"header": "@@ -60,8 +61,6 @@ public class PrivilegeNode extends QueryTreeNode",
"removed": [
" this.objectOfPrivilege = objectOfPrivilege;",
" this.specificPrivileges = (TablePrivilegesNode) specificPrivileges;"
]
},
{
"added": [
" objectName = (TableName) objectOfPrivilege;",
" this.specificPrivileges = (TablePrivilegesNode) specificPrivileges;",
" routineDesignator = (RoutineDesignator) objectOfPrivilege;",
" objectName = routineDesignator.name;"
],
"header": "@@ -69,19 +68,17 @@ public class PrivilegeNode extends QueryTreeNode",
"removed": [
" SanityManager.ASSERT( objectOfPrivilege instanceof TableName,",
" \"incorrect name type, \" + objectOfPrivilege.getClass().getName()",
" + \", used with table privilege\");",
" SanityManager.ASSERT( objectOfPrivilege instanceof RoutineDesignator,",
" \"incorrect name type, \" + objectOfPrivilege.getClass().getName()",
" + \", used with table privilege\");"
]
},
{
"added": [
" SchemaDescriptor sd = getSchemaDescriptor( objectName.getSchemaName(), true);",
" objectName.setSchemaName( sd.getSchemaName() );",
" ",
" // Can not grant/revoke permissions from self",
" if (grantees.contains(sd.getAuthorizationId()))",
" {",
" throw StandardException.newException",
" (SQLState.AUTH_GRANT_REVOKE_NOT_ALLOWED, objectName.getFullTableName());",
" }",
"",
"",
" // can't grant/revoke privileges on system tables",
" {",
" throw StandardException.newException(SQLState.AUTH_GRANT_REVOKE_NOT_ALLOWED, objectName.getFullTableName());",
" }",
" ",
" TableDescriptor td = getTableDescriptor( objectName.getTableName(), sd);",
" {",
" throw StandardException.newException( SQLState.LANG_TABLE_NOT_FOUND, objectName);",
" }",
" {",
" }",
" {",
" throw StandardException.newException(SQLState.AUTH_GRANT_REVOKE_NOT_ALLOWED, objectName.getFullTableName());",
" }",
" {",
" throw StandardException.newException(SQLState.AUTH_GRANT_REVOKE_NOT_ALLOWED, objectName.getFullTableName());",
" }",
" sd.getUUID().toString(), objectName.getTableName(),",
" routineDesignator.isFunction ? AliasInfo.ALIAS_NAME_SPACE_FUNCTION_AS_CHAR : AliasInfo.ALIAS_NAME_SPACE_PROCEDURE_AS_CHAR",
" if( routineDesignator.paramTypeList == null)",
" {",
" throw StandardException.newException( ( routineDesignator.isFunction ? SQLState.LANG_AMBIGUOUS_FUNCTION_NAME",
" objectName.getFullTableName());",
" }",
" if (routineDesignator.isFunction) {",
" objectName.getFullTableName());",
" objectName.getFullTableName());"
],
"header": "@@ -106,71 +103,78 @@ public class PrivilegeNode extends QueryTreeNode",
"removed": [
" SchemaDescriptor sd = null;",
"\t\t",
" TableName tableName = (TableName) objectOfPrivilege;",
" sd = getSchemaDescriptor( tableName.getSchemaName(), true);",
" throw StandardException.newException(SQLState.AUTH_GRANT_REVOKE_NOT_ALLOWED, tableName.getFullTableName());",
"\t\t\t\t",
" TableDescriptor td = getTableDescriptor( tableName.getTableName(), sd);",
" throw StandardException.newException( SQLState.LANG_TABLE_NOT_FOUND, tableName);",
" throw StandardException.newException(SQLState.AUTH_GRANT_REVOKE_NOT_ALLOWED, tableName.getFullTableName());",
"",
"\t\t\t// Can not grant/revoke permissions from self",
"\t\t\tif (grantees.contains(sd.getAuthorizationId()))",
"\t\t\t\tthrow StandardException.newException(SQLState.AUTH_GRANT_REVOKE_NOT_ALLOWED,",
"\t\t\t\t\t\t td.getQualifiedName());",
" RoutineDesignator rd = (RoutineDesignator) objectOfPrivilege;",
" sd = getSchemaDescriptor( rd.name.getSchemaName(), true);",
"",
" throw StandardException.newException(SQLState.AUTH_GRANT_REVOKE_NOT_ALLOWED, rd.name.getFullTableName());",
" sd.getUUID().toString(), rd.name.getTableName(),",
" rd.isFunction ? AliasInfo.ALIAS_NAME_SPACE_FUNCTION_AS_CHAR : AliasInfo.ALIAS_NAME_SPACE_PROCEDURE_AS_CHAR",
"\t\t\t// Can not grant/revoke permissions from self",
"\t\t\tif (grantees.contains(sd.getAuthorizationId()))",
"\t\t\t\tthrow StandardException.newException(SQLState.AUTH_GRANT_REVOKE_NOT_ALLOWED,",
"\t\t\t\t\t\t rd.name.getFullTableName());",
"",
" if( rd.paramTypeList == null)",
" throw StandardException.newException( ( rd.isFunction ? SQLState.LANG_AMBIGUOUS_FUNCTION_NAME",
" rd.name.getFullTableName());",
" if (rd.isFunction) {",
" rd.name.getFullTableName());",
" rd.name.getFullTableName());"
]
},
{
"added": [
" if (parameterCount != routineDesignator.paramTypeList.size())",
" if( ! parameterTypes[parmIdx].equals( routineDesignator.paramTypeList.get( parmIdx)))"
],
"header": "@@ -185,13 +189,13 @@ public class PrivilegeNode extends QueryTreeNode",
"removed": [
" if (parameterCount != rd.paramTypeList.size())",
" if( ! parameterTypes[parmIdx].equals( rd.paramTypeList.get( parmIdx)))"
]
},
{
"added": [
" StringBuffer sb = new StringBuffer( objectName.getFullTableName());",
" for( int i = 0; i < routineDesignator.paramTypeList.size(); i++)",
" sb.append( routineDesignator.paramTypeList.get(i).toString());",
" routineDesignator.setAliasDescriptor( proc);",
"",
" default:",
" SanityManager.THROWASSERT( \"Invalid privilege objectType: \" + this.objectType);"
],
"header": "@@ -201,20 +205,23 @@ public class PrivilegeNode extends QueryTreeNode",
"removed": [
" StringBuffer sb = new StringBuffer( rd.name.getFullTableName());",
" for( int i = 0; i < rd.paramTypeList.size(); i++)",
" sb.append( rd.paramTypeList.get(i).toString());",
" rd.setAliasDescriptor( proc);"
]
},
{
"added": [
" return routineDesignator.makePrivilegeInfo();"
],
"header": "@@ -239,7 +246,7 @@ public class PrivilegeNode extends QueryTreeNode",
"removed": [
" return ((RoutineDesignator) objectOfPrivilege).makePrivilegeInfo();"
]
}
]
}
] |
derby-DERBY-712-80eb35f4
|
DERBY-712: Committed Suran Jayathilaka's create_drop_sequence_d.patch. This adds CREATE/DROP SEQUENCE commands.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@810151 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/iapi/sql/depend/DependencyManager.java",
"hunks": [
{
"added": [
"\tdatadictionary keeping track of dependencies between objects that it handles"
],
"header": "@@ -35,7 +35,7 @@ import org.apache.derby.iapi.store.access.TransactionController;",
"removed": [
"\tdatadictionary keeping track of dependcies between objects that it handles"
]
}
]
},
{
"file": "java/engine/org/apache/derby/iapi/sql/dictionary/SequenceDescriptor.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.sql.depend.DependencyManager;",
"import org.apache.derby.iapi.sql.depend.Dependent;",
"import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;",
"import org.apache.derby.iapi.store.access.TransactionController;",
" implements Provider, Dependent, UniqueSQLObjectDescriptor {"
],
"header": "@@ -24,19 +24,22 @@ package org.apache.derby.iapi.sql.dictionary;",
"removed": [
"import org.apache.derby.catalog.TypeDescriptor;",
" implements Provider, UniqueSQLObjectDescriptor {"
]
},
{
"added": [
" /**",
" * Drop this sequence descriptor",
" *",
" * @throws StandardException Could not be dropped.",
" */",
" public void drop(LanguageConnectionContext lcc) throws StandardException",
" {",
" DataDictionary dd = getDataDictionary();",
" DependencyManager dm = getDataDictionary().getDependencyManager();",
" TransactionController tc = lcc.getTransactionExecute();",
"",
" // invalidate compiled statements which depend on this sequence",
" dm.invalidateFor(this, DependencyManager.DROP_SEQUENCE, lcc);",
"",
" // drop the sequence",
" dd.dropSequenceDescriptor(this, tc);",
"",
" // Clear the dependencies for the sequence",
" dm.clearDependencies(lcc, this);",
"",
" }",
"",
" /**",
"\t * Check that all of the dependent's dependencies are valid.",
"\t *",
"\t * @return true if the dependent is currently valid",
"\t */",
"\tpublic synchronized boolean isValid()",
"\t{",
"\t\treturn true;",
"\t}",
"",
" /**",
"\t * Prepare to mark the dependent as invalid (due to at least one of",
"\t * its dependencies being invalid).",
"\t *",
"\t * @param action\tThe action causing the invalidation",
"\t * @param p\t\t\tthe provider",
"\t * @param lcc\t\tthe language connection context",
"\t *",
"\t * @exception StandardException thrown if unable to make it invalid",
"\t */",
"\tpublic void prepareToInvalidate",
"\t(",
"\t\tProvider \t\t\t\t\tp,",
"\t\tint\t\t\t\t\t\t\taction,",
"\t\tLanguageConnectionContext\tlcc",
"\t) throws StandardException",
"\t{",
"\t\tswitch (action)",
"\t\t{ \t\t\t",
"\t\t\tdefault:",
"\t\t\t\tbreak;",
"\t\t}",
"\t}",
" /**",
"\t * Mark the dependent as invalid (due to at least one of",
"\t * its dependencies being invalid).",
"\t *",
"\t * @param \tlcc the language connection context",
"\t * @param\taction\tThe action causing the invalidation",
"\t *",
"\t * @exception StandardException thrown if called in sanity mode",
"\t */",
"\tpublic void makeInvalid(int action, LanguageConnectionContext lcc) throws StandardException",
"\t{",
"\t\tswitch (action)",
"\t\t{",
"\t\t\t// invalidate this sequence descriptor",
"\t\t\tcase DependencyManager.USER_RECOMPILE_REQUEST:",
"\t\t\t\tDependencyManager dm = getDataDictionary().getDependencyManager();",
"\t\t\t\tdm.invalidateFor(this, DependencyManager.PREPARED_STATEMENT_RELEASE, lcc);",
"\t\t\t\tbreak;",
"",
"\t\t\tdefault:",
"\t\t\t\tbreak;",
"\t\t}",
"",
"\t}",
""
],
"header": "@@ -107,6 +110,86 @@ public class SequenceDescriptor extends TupleDescriptor",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/catalog/SYSSEQUENCESRowFactory.java",
"hunks": [
{
"added": [
" /*",
" ** What is stored in the column is a TypeDescriptorImpl, which",
" ** points to a BaseTypeIdImpl. These are simple types that are",
" ** intended to be movable to the client, so they don't have",
" ** the entire implementation. We need to wrap them in DataTypeServices",
" ** and TypeId objects that contain the full implementations for",
" ** language processing.",
" */",
" TypeDescriptor catalogType = (TypeDescriptor) row.getColumn(SYSSEQUENCES_SEQUENCEDATATYPE).",
" DataTypeDescriptor dataTypeServices =",
" DataTypeDescriptor.getType(catalogType);"
],
"header": "@@ -232,8 +232,18 @@ public class SYSSEQUENCESRowFactory extends CatalogRowFactory {",
"removed": [
" DataTypeDescriptor dataType = (DataTypeDescriptor) row.getColumn(SYSSEQUENCES_SEQUENCEDATATYPE)."
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/C_NodeNames.java",
"hunks": [
{
"added": [
" static final String CREATE_SEQUENCE_NODE_NAME = \"org.apache.derby.impl.sql.compile.CreateSequenceNode\";",
"",
" static final String CREATE_TABLE_NODE_NAME = \"org.apache.derby.impl.sql.compile.CreateTableNode\";"
],
"header": "@@ -91,7 +91,9 @@ public interface C_NodeNames",
"removed": [
"\tstatic final String CREATE_TABLE_NODE_NAME = \"org.apache.derby.impl.sql.compile.CreateTableNode\";"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/execute/GenericConstantActionFactory.java",
"hunks": [
{
"added": [
"import org.apache.derby.impl.sql.compile.TableName;"
],
"header": "@@ -52,6 +52,7 @@ import org.apache.derby.catalog.UUID;",
"removed": []
},
{
"added": [
" /**",
"\t * Make the ConstantAction for a CREATE SEQUENCE statement.",
"\t *",
"\t * @param sequenceName\tName of sequence.",
"\t */",
"\tpublic\tConstantAction\tgetCreateSequenceConstantAction(TableName sequenceName)",
"\t{",
" return new CreateSequenceConstantAction(sequenceName.getSchemaName(), sequenceName.getTableName());",
"\t}",
" /**"
],
"header": "@@ -318,8 +319,17 @@ public class GenericConstantActionFactory",
"removed": [
"\t/**"
]
}
]
}
] |
derby-DERBY-712-9ce74923
|
DERBY-712: Add dblook support for sequences.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@898123 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/sql/compile/CreateSequenceNode.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.types.DataTypeDescriptor;",
"import org.apache.derby.iapi.reference.SQLState;",
"import org.apache.derby.iapi.types.TypeId;",
"",
"public class CreateSequenceNode extends DDLStatementNode",
"{",
" private TableName _sequenceName;",
" private DataTypeDescriptor _dataType;",
" private Long _initialValue;",
" private Long _stepValue;",
" private Long _maxValue;",
" private Long _minValue;",
" private Boolean _cycle;"
],
"header": "@@ -26,14 +26,25 @@ import org.apache.derby.iapi.services.sanity.SanityManager;",
"removed": [
"public class CreateSequenceNode extends DDLStatementNode {",
" private TableName sequenceName;"
]
},
{
"added": [
" * @param dataType Exact numeric type of the new sequence",
" * @param initialValue Starting value",
" * @param stepValue Increment amount",
" * @param maxValue Largest value returned by the sequence generator",
" * @param minValue Smallest value returned by the sequence generator",
" * @param cycle True if the generator should wrap around, false otherwise",
" * @param sequenceName The name of the new sequence",
" *",
" * @throws org.apache.derby.iapi.error.StandardException on error",
" public void init",
" (",
" Object sequenceName,",
" Object dataType,",
" Object initialValue,",
" Object stepValue,",
" Object maxValue,",
" Object minValue,",
" Object cycle",
" ) throws StandardException {",
" _sequenceName = (TableName) sequenceName;",
" initAndCheck(_sequenceName);",
"",
" _dataType = (DataTypeDescriptor) dataType;",
" _initialValue = (Long) initialValue;",
" _stepValue = (Long) stepValue;",
" _maxValue = (Long) maxValue;",
" _minValue = (Long) minValue;",
" _cycle = (Boolean) cycle;"
],
"header": "@@ -41,12 +52,35 @@ public class CreateSequenceNode extends DDLStatementNode {",
"removed": [
" * @throws org.apache.derby.iapi.error.StandardException",
" * Thrown on error",
" public void init(Object sequenceName) throws StandardException {",
" this.sequenceName = (TableName) sequenceName;",
" initAndCheck(sequenceName);"
]
},
{
"added": [
" \"sequenceName: \" + \"\\n\" + _sequenceName + \"\\n\";"
],
"header": "@@ -62,7 +96,7 @@ public class CreateSequenceNode extends DDLStatementNode {",
"removed": [
" \"sequenceName: \" + \"\\n\" + sequenceName + \"\\n\";"
]
},
{
"added": [
" // set the default schema name if the user did not explicitly specify a schema",
" if (_sequenceName.getSchemaName() == null) {",
" _sequenceName.setSchemaName(sd.getSchemaName());",
"",
" // Right now we only support vanilla sequences",
" if ( (_dataType != null) && ( !_dataType.getTypeId().equals( TypeId.INTEGER_ID ) ) ) { throw unimplementedFeature(); }",
" if ( (_initialValue != null) && ( _initialValue.longValue() != -2147483648L ) ) { throw unimplementedFeature(); }",
" if ( (_stepValue != null) && ( _stepValue.longValue() != 1L ) ) { throw unimplementedFeature(); }",
" if ( (_maxValue != null) && ( _maxValue.longValue() != 2147483647L ) ) { throw unimplementedFeature(); }",
" if ( (_minValue != null) && ( _minValue.longValue() != -2147483648L ) ) { throw unimplementedFeature(); }",
" if ( (_cycle != null) && ( _cycle != Boolean.FALSE ) ) { throw unimplementedFeature(); }",
" "
],
"header": "@@ -80,11 +114,19 @@ public class CreateSequenceNode extends DDLStatementNode {",
"removed": [
"// sequenceName.bind( getDataDictionary() );",
" // set the default schema name if the user did not explicitly specify a schema",
" if (sequenceName.getSchemaName() == null) {",
" sequenceName.setSchemaName(sd.getSchemaName());"
]
}
]
},
{
"file": "java/tools/org/apache/derby/impl/tools/dblook/DB_Alias.java",
"hunks": [
{
"added": [
"\t * @param at10_6 True if the database is at 10.6 or higher",
"\tpublic static void doProceduresFunctionsAndUDTs(Connection conn, boolean at10_6 )"
],
"header": "@@ -45,9 +45,10 @@ public class DB_Alias",
"removed": [
"\tpublic static void doProceduresFunctionsAndUDTs(Connection conn)"
]
}
]
},
{
"file": "java/tools/org/apache/derby/impl/tools/dblook/DB_GrantRevoke.java",
"hunks": [
{
"added": [
"\t * @param at10_6 True if the databse level is 10.6 or higher",
"\tpublic static void doAuthorizations(Connection conn, boolean at10_6)",
" ResultSet rs;",
"",
" if ( at10_6 )",
" {",
" // Generate udt privilege statements",
" rs = stmt.executeQuery(\"SELECT P.GRANTEE, S.SCHEMANAME, A.ALIAS, P.PERMISSION, P.OBJECTTYPE FROM \" +",
" \"SYS.SYSPERMS P, SYS.SYSALIASES A, SYS.SYSSCHEMAS S WHERE A.SCHEMAID = \" +",
" \"S.SCHEMAID AND P.OBJECTID = A.ALIASID AND A.ALIASTYPE='A'\");",
" generateUDTPrivs(rs);",
" ",
" // Generate sequence privilege statements",
" rs = stmt.executeQuery(\"SELECT P.GRANTEE, S.SCHEMANAME, SEQ.SEQUENCENAME, P.PERMISSION, P.OBJECTTYPE FROM \" +",
" \"SYS.SYSPERMS P, SYS.SYSSEQUENCES SEQ, SYS.SYSSCHEMAS S WHERE SEQ.SCHEMAID = \" +",
" \"S.SCHEMAID AND P.OBJECTID = SEQ.SEQUENCEID\");",
" generateSequencePrivs(rs);",
" }",
"",
" rs = stmt.executeQuery(\"SELECT GRANTEE, SCHEMANAME, TABLENAME, SELECTPRIV, \" +"
],
"header": "@@ -36,13 +36,31 @@ public class DB_GrantRevoke {",
"removed": [
"\tpublic static void doAuthorizations(Connection conn)",
"\t\tResultSet rs = stmt.executeQuery(\"SELECT GRANTEE, SCHEMANAME, TABLENAME, SELECTPRIV, \" +"
]
},
{
"added": [],
"header": "@@ -54,12 +72,6 @@ public class DB_GrantRevoke {",
"removed": [
"\t\t// Generate udt privilege statements",
"\t\trs = stmt.executeQuery(\"SELECT P.GRANTEE, S.SCHEMANAME, A.ALIAS, P.PERMISSION, P.OBJECTTYPE FROM \" +",
"\t\t\t\"SYS.SYSPERMS P, SYS.SYSALIASES A, SYS.SYSSCHEMAS S WHERE A.SCHEMAID = \" +",
"\t\t\t\"S.SCHEMAID AND P.OBJECTID = A.ALIASID AND A.ALIASTYPE='A'\");",
"\t\tgenerateUDTPrivs(rs);",
""
]
}
]
},
{
"file": "java/tools/org/apache/derby/tools/dblook.java",
"hunks": [
{
"added": [
"import org.apache.derby.impl.tools.dblook.DB_Sequence;"
],
"header": "@@ -45,6 +45,7 @@ import org.apache.derby.impl.tools.dblook.DB_Jar;",
"removed": []
},
{
"added": [
" boolean at10_6 = atVersion( conn, 10, 6 );",
""
],
"header": "@@ -516,6 +517,8 @@ public final class dblook {",
"removed": []
},
{
"added": [
" DB_Sequence.doSequences( conn );",
"",
"\t\t\t\tDB_Alias.doProceduresFunctionsAndUDTs(this.conn, at10_6 );"
],
"header": "@@ -523,10 +526,12 @@ public final class dblook {",
"removed": [
"\t\t\t\tDB_Alias.doProceduresFunctionsAndUDTs(this.conn);"
]
},
{
"added": [
"\t\t\tDB_GrantRevoke.doAuthorizations(this.conn, at10_6);"
],
"header": "@@ -541,7 +546,7 @@ public final class dblook {",
"removed": [
"\t\t\tDB_GrantRevoke.doAuthorizations(this.conn);"
]
},
{
"added": [
" /**",
" * Return true if we are at 10.6 or later.",
" */",
" private static boolean atVersion( Connection conn, int major, int minor ) throws SQLException",
" {",
" PreparedStatement ps = null;",
" ResultSet rs = null;",
" try {",
" ps = conn.prepareStatement( \"values syscs_util.syscs_get_database_property('DataDictionaryVersion')\" );",
" rs = ps.executeQuery();",
"",
" rs.next();",
"",
" String versionString = rs.getString( 1 );",
" int dotIdx = versionString.indexOf( '.' );",
" int actualMajor = Integer.parseInt( versionString.substring( 0, dotIdx ) );",
" int actualMinor = Integer.parseInt( versionString.substring( dotIdx + 1, versionString.length() ) );",
"",
" if ( actualMajor > major ) { return true; }",
" if ( actualMajor < major ) { return false; }",
"",
" boolean result = ( actualMinor >= minor );",
" ",
" return result;",
" }",
" finally",
" {",
" if ( rs != null ) { rs.close(); }",
" if ( ps != null ) { ps.close(); }",
" }",
" }",
"\t"
],
"header": "@@ -1155,5 +1160,37 @@ public final class dblook {",
"removed": []
}
]
}
] |
derby-DERBY-712-a4cbe6f7
|
DERBY-712: Wire in USAGE privilege for SEQUENCEs.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@896883 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/sql/execute/DDLConstantAction.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.sql.dictionary.StatementGenericPermission;"
],
"header": "@@ -55,6 +55,7 @@ import org.apache.derby.iapi.sql.dictionary.RoleGrantDescriptor;",
"removed": []
},
{
"added": [
"\t\t\t// CHECK constraint, any EXECUTE or USAGE privileges. If the REFERENCES is"
],
"header": "@@ -332,7 +333,7 @@ abstract class DDLConstantAction implements ConstantAction",
"removed": [
"\t\t\t// CHECK constraint, any EXECUTE privileges. If the REFERENCES is"
]
},
{
"added": [
"\t\t\t\t\t\t || statPerm instanceof StatementRolePermission",
" || statPerm instanceof StatementGenericPermission ) {"
],
"header": "@@ -361,7 +362,8 @@ abstract class DDLConstantAction implements ConstantAction",
"removed": [
"\t\t\t\t\t\t || statPerm instanceof StatementRolePermission) {"
]
}
]
},
{
"file": "java/testing/org/apache/derbyTesting/junit/JDBC.java",
"hunks": [
{
"added": [
" // sequences",
" if ( sysSequencesExists( conn ) )",
" {",
" psf = conn.prepareStatement",
" (",
" \"SELECT SEQUENCENAME FROM SYS.SYSSEQUENCES A, SYS.SYSSCHEMAS S\" +",
" \" WHERE A.SCHEMAID = S.SCHEMAID \" +",
" \" AND S.SCHEMANAME = ?\");",
" psf.setString(1, schema);",
" rs = psf.executeQuery();",
" dropUsingDMD(s, rs, schema, \"SEQUENCENAME\", \"SEQUENCE\");",
" psf.close();",
" }",
""
],
"header": "@@ -314,6 +314,20 @@ public class JDBC {",
"removed": []
},
{
"added": [
"",
" /**",
" * Return true if the SYSSEQUENCES table exists.",
" */",
" private static boolean sysSequencesExists( Connection conn ) throws SQLException",
" {",
" PreparedStatement ps = null;",
" ResultSet rs = null;",
" try {",
" ps = conn.prepareStatement",
" (",
" \"select count(*) from sys.systables t, sys.sysschemas s\\n\" +",
" \"where t.schemaid = s.schemaid\\n\" +",
" \"and ( cast(s.schemaname as varchar(128)))= 'SYS'\\n\" +",
" \"and ( cast(t.tablename as varchar(128))) = 'SYSSEQUENCES'\" );",
" rs = ps.executeQuery();",
" rs.next();",
" return ( rs.getInt( 1 ) > 0 );",
" }",
" finally",
" {",
" if ( rs != null ) { rs.close(); }",
" if ( ps != null ) { ps.close(); }",
" }",
" }"
],
"header": "@@ -321,6 +335,31 @@ public class JDBC {",
"removed": []
}
]
}
] |
derby-DERBY-712-bb219830
|
DERBY-712: Committed Suran's patch createseq_args_bind_b.diff, making it possible to create sequences with different datatypes, boundaries, steps, and cycling.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@905369 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/sql/compile/CreateSequenceNode.java",
"hunks": [
{
"added": [
"",
" if (dataType != null) {",
" _dataType = (DataTypeDescriptor) dataType;",
" } else {",
" _dataType = DataTypeDescriptor.INTEGER;",
" }",
"",
" _stepValue = (stepValue != null ? (Long) stepValue : new Long(1));",
" if (_dataType.getTypeId().equals(TypeId.SMALLINT_ID)) {",
" _minValue = (minValue != null ? (Long) minValue : new Long(Short.MIN_VALUE));",
" _maxValue = (maxValue != null ? (Long) maxValue : new Long(Short.MAX_VALUE));",
" } else if (_dataType.getTypeId().equals(TypeId.INTEGER_ID)) {",
" _minValue = (minValue != null ? (Long) minValue : new Long(Integer.MIN_VALUE));",
" _maxValue = (maxValue != null ? (Long) maxValue : new Long(Integer.MAX_VALUE));",
" } else {",
" // Could only be BIGINT",
" _minValue = (minValue != null ? (Long) minValue : new Long(Long.MIN_VALUE));",
" _maxValue = (maxValue != null ? (Long) maxValue : new Long(Long.MAX_VALUE));",
" }",
"",
" if (initialValue != null) {",
" _initialValue = (Long) initialValue;",
" } else {",
" if (_stepValue.longValue() > 0L) {",
" _initialValue = _minValue;",
" } else {",
" _initialValue = _maxValue;",
" }",
" }",
" _cycle = (cycle != null ? (Boolean) cycle : Boolean.FALSE);",
"",
" // automatically create the schema if it doesn't exist"
],
"header": "@@ -71,17 +71,42 @@ public class CreateSequenceNode extends DDLStatementNode",
"removed": [
" _dataType = (DataTypeDescriptor) dataType;",
" _initialValue = (Long) initialValue;",
" _stepValue = (Long) stepValue;",
" _maxValue = (Long) maxValue;",
" _minValue = (Long) minValue;",
" _cycle = (Boolean) cycle;",
" // automcatically create the schema if it doesn't exist"
]
},
{
"added": [
" // set the default schema name if the user did not explicitly specify a schema",
" if (_dataType.getTypeId().equals(TypeId.SMALLINT_ID)) {",
" if (_minValue.longValue() < Short.MIN_VALUE || _minValue.longValue() >= Short.MAX_VALUE) {",
" throw StandardException.newException(",
" SQLState.LANG_SEQ_ARG_OUT_OF_DATATYPE_RANGE,",
" \"MINVALUE\",",
" \"SMALLINT\",",
" Short.MIN_VALUE + \"\",",
" Short.MAX_VALUE + \"\");",
" }",
" if (_maxValue.longValue() <= Short.MIN_VALUE || _maxValue.longValue() > Short.MAX_VALUE) {",
" throw StandardException.newException(",
" SQLState.LANG_SEQ_ARG_OUT_OF_DATATYPE_RANGE,",
" \"MAXVALUE\",",
" \"SMALLINT\",",
" Short.MIN_VALUE + \"\",",
" Short.MAX_VALUE + \"\");",
" }",
" } else if (_dataType.getTypeId().equals(TypeId.INTEGER_ID)) {",
" if (_minValue.longValue() < Integer.MIN_VALUE || _minValue.longValue() >= Integer.MAX_VALUE) {",
" throw StandardException.newException(",
" SQLState.LANG_SEQ_ARG_OUT_OF_DATATYPE_RANGE,",
" \"MINVALUE\",",
" \"INTEGER\",",
" Integer.MIN_VALUE + \"\",",
" Integer.MAX_VALUE + \"\");",
" }",
" if (_maxValue.longValue() <= Integer.MIN_VALUE || _maxValue.longValue() > Integer.MAX_VALUE) {",
" throw StandardException.newException(",
" SQLState.LANG_SEQ_ARG_OUT_OF_DATATYPE_RANGE,",
" \"MAXVALUE\",",
" \"INTEGER\",",
" Integer.MIN_VALUE + \"\",",
" Integer.MAX_VALUE + \"\");",
" }",
" } else {",
" // BIGINT",
" if (_minValue.longValue() < Long.MIN_VALUE || _minValue.longValue() >= Long.MAX_VALUE) {",
" throw StandardException.newException(",
" SQLState.LANG_SEQ_ARG_OUT_OF_DATATYPE_RANGE,",
" \"MINVALUE\",",
" \"BIGINT\",",
" Long.MIN_VALUE + \"\",",
" Long.MAX_VALUE + \"\");",
" }",
" if (_maxValue.longValue() <= Long.MIN_VALUE || _maxValue.longValue() > Long.MAX_VALUE) {",
" throw StandardException.newException(",
" SQLState.LANG_SEQ_ARG_OUT_OF_DATATYPE_RANGE,",
" \"MAXVALUE\",",
" \"BIGINT\",",
" Long.MIN_VALUE + \"\",",
" Long.MAX_VALUE + \"\");",
" }",
" }",
"",
" if (_minValue.longValue() >= _maxValue.longValue()) {",
" throw StandardException.newException(",
" SQLState.LANG_SEQ_MIN_EXCEEDS_MAX,",
" _minValue.toString(),",
" _maxValue.toString());",
" }",
"",
" if (_initialValue.longValue() < _minValue.longValue() || _initialValue.longValue() > _maxValue.longValue()) {",
" throw StandardException.newException(",
" SQLState.LANG_SEQ_INVALID_START,",
" _initialValue.toString(),",
" _minValue.toString(),",
" _maxValue.toString());",
" } ",
"",
" if (_stepValue.longValue() == 0L) {",
" throw StandardException.newException(",
" SQLState.LANG_SEQ_INCREMENT_ZERO);",
" }",
"",
" if (_stepValue.longValue() > _maxValue.longValue()",
" || _stepValue.longValue() < _minValue.longValue()) {",
" throw StandardException.newException(",
" SQLState.LANG_SEQ_INCREMENT_OUT_OF_RANGE,",
" _stepValue.toString(),",
" _minValue.toString(),",
" _maxValue.toString());",
" }",
""
],
"header": "@@ -113,19 +138,94 @@ public class CreateSequenceNode extends DDLStatementNode",
"removed": [
" // set the default schema name if the user did not explicitly specify a schema",
" // Right now we only support vanilla sequences",
" if ( (_dataType != null) && ( !_dataType.getTypeId().equals( TypeId.INTEGER_ID ) ) ) { throw unimplementedFeature(); }",
" if ( (_initialValue != null) && ( _initialValue.longValue() != -2147483648L ) ) { throw unimplementedFeature(); }",
" if ( (_stepValue != null) && ( _stepValue.longValue() != 1L ) ) { throw unimplementedFeature(); }",
" if ( (_maxValue != null) && ( _maxValue.longValue() != 2147483647L ) ) { throw unimplementedFeature(); }",
" if ( (_minValue != null) && ( _minValue.longValue() != -2147483648L ) ) { throw unimplementedFeature(); }",
" if ( (_cycle != null) && ( _cycle != Boolean.FALSE ) ) { throw unimplementedFeature(); }",
" "
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/execute/CreateSequenceConstantAction.java",
"hunks": [
{
"added": [
" private String _sequenceName;",
" private String _schemaName;",
" private DataTypeDescriptor _dataType;",
" private long _initialValue;",
" private long _stepValue;",
" private long _maxValue;",
" private long _minValue;",
" private boolean _cycle;"
],
"header": "@@ -39,8 +39,14 @@ import org.apache.derby.shared.common.reference.SQLState;",
"removed": [
" private String sequenceName;",
" private String schemaName;"
]
},
{
"added": [
" * @param dataType Exact numeric type of the new sequence",
" * @param initialValue Starting value",
" * @param stepValue Increment amount",
" * @param maxValue Largest value returned by the sequence generator",
" * @param minValue Smallest value returned by the sequence generator",
" * @param cycle True if the generator should wrap around, false otherwise",
" public CreateSequenceConstantAction",
" (",
" String schemaName,",
" String sequenceName,",
" DataTypeDescriptor dataType,",
" long initialValue,",
" long stepValue,",
" long maxValue,",
" long minValue,",
" boolean cycle",
" )",
" {",
" this._schemaName = schemaName;",
" this._sequenceName = sequenceName;",
" this._dataType = dataType;",
" this._initialValue = initialValue;",
" this._stepValue = stepValue;",
" this._maxValue = maxValue;",
" this._minValue = minValue;",
" this._cycle = cycle;"
],
"header": "@@ -48,10 +54,33 @@ class CreateSequenceConstantAction extends DDLConstantAction {",
"removed": [
" public CreateSequenceConstantAction(String schemaName, String sequenceName) {",
" this.schemaName = schemaName;",
" this.sequenceName = sequenceName;"
]
},
{
"added": [
" schemaDescriptor = DDLConstantAction.getSchemaDescriptorForCreate(dd, activation, _schemaName);",
" SequenceDescriptor seqDef = dd.getSequenceDescriptor(schemaDescriptor, _sequenceName);",
" seqDef.getDescriptorType(), _sequenceName);",
" seqDef = ddg.newSequenceDescriptor(",
" schemaDescriptor,",
" _sequenceName,",
" _dataType,",
" _initialValue, // current value",
" _initialValue,",
" _minValue,",
" _maxValue,",
" _stepValue,",
" _cycle); // whether the sequence can wrap-around"
],
"header": "@@ -74,22 +103,30 @@ class CreateSequenceConstantAction extends DDLConstantAction {",
"removed": [
" schemaDescriptor = DDLConstantAction.getSchemaDescriptorForCreate(dd, activation, schemaName);",
" SequenceDescriptor seqDef = dd.getSequenceDescriptor(schemaDescriptor, sequenceName);",
" seqDef.getDescriptorType(), sequenceName);",
" seqDef = ddg.newSequenceDescriptor(schemaDescriptor,",
" sequenceName, DataTypeDescriptor.INTEGER_NOT_NULL, Integer.MIN_VALUE, Integer.MIN_VALUE, Integer.MIN_VALUE, Integer.MAX_VALUE, 1, false); // is definition"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/execute/GenericConstantActionFactory.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.types.DataTypeDescriptor;"
],
"header": "@@ -47,6 +47,7 @@ import org.apache.derby.iapi.store.access.StaticCompiledOpenConglomInfo;",
"removed": []
}
]
}
] |
derby-DERBY-712-bb40bcbe
|
DERBY-712: Commit Suran Jayathilaka's first increment of work for sequence generators: this patch adds two new system catalogs, SYSSEQUENCES and SYSPERMS.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@792245 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/iapi/services/io/StoredFormatIds.java",
"hunks": [
{
"added": [
"",
" /**",
" class org.apache.derby.impl.sql.catalog.SequenceDescriptorFinder",
" */",
" static public final int SEQUENCE_DESCRIPTOR_FINDER_V01_ID =",
" (MIN_ID_2 + 472);",
"",
" static public final int PERM_DESCRIPTOR_FINDER_V01_ID = (MIN_ID_2 + 473);"
],
"header": "@@ -610,6 +610,14 @@ public interface StoredFormatIds {",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/iapi/sql/dictionary/DataDescriptorGenerator.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.types.DataTypeDescriptor;"
],
"header": "@@ -29,6 +29,7 @@ import org.apache.derby.catalog.types.ReferencedColumnsDescriptorImpl;",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/iapi/sql/dictionary/DataDictionary.java",
"hunks": [
{
"added": [
" public static final int SYSSEQUENCES_CATALOG_NUM = 20;",
" public static final int SYSPERMS_CATALOG_NUM = 21;",
" /* static finals for constraints"
],
"header": "@@ -189,8 +189,10 @@ public interface DataDictionary",
"removed": [
"\t/* static finals for constraints "
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.sql.dictionary.SequenceDescriptor;",
"import org.apache.derby.iapi.sql.dictionary.PermDescriptor;"
],
"header": "@@ -65,6 +65,8 @@ import org.apache.derby.iapi.sql.dictionary.TableDescriptor;",
"removed": []
},
{
"added": [
"\t\t\t\t\t\t\t\t\t\"SYSROLES\",",
" \"SYSSEQUENCES\",",
" \"SYSPERMS\"",
" };"
],
"header": "@@ -297,8 +299,10 @@ public final class\tDataDictionaryImpl",
"removed": [
"\t\t\t\t\t\t\t\t\t\"SYSROLES\"",
"\t\t\t\t\t\t\t\t\t};"
]
},
{
"added": [
" // This catalog was added in 10.6. Don't look for this catalog if we",
" // have soft-upgraded from an older release.",
" if( dictionaryVersion.majorVersionNumber >= DataDictionary.DD_VERSION_DERBY_10_6)",
" {",
" if (isSchemaReferenced(tc, getNonCoreTI(SYSSEQUENCES_CATALOG_NUM),",
" SYSSEQUENCESRowFactory.SYSSEQUENCES_INDEX2_ID,",
" 2,",
" schemaIdOrderable))",
" {",
" return false;",
" }",
" }",
"",
" return true;"
],
"header": "@@ -2234,7 +2238,20 @@ public final class\tDataDictionaryImpl",
"removed": [
"\t\treturn true;"
]
},
{
"added": [
"",
" case SYSSEQUENCES_CATALOG_NUM:",
"\t\t\t\tretval = new TabInfoImpl(new SYSSEQUENCESRowFactory(",
"\t\t\t\t\t\t\t\t\t\t\t luuidFactory, exFactory, dvf));",
"",
"\t\t\t\tbreak;",
"",
" case SYSPERMS_CATALOG_NUM:",
"\t\t\t\tretval = new TabInfoImpl(new SYSPERMSRowFactory(",
"\t\t\t\t\t\t\t\t\t\t\t luuidFactory, exFactory, dvf));",
"",
"\t\t\t\tbreak; ",
" }"
],
"header": "@@ -8926,7 +8943,19 @@ public final class\tDataDictionaryImpl",
"removed": [
"\t\t\t}"
]
}
]
},
{
"file": "java/storeless/org/apache/derby/impl/storeless/EmptyDictionary.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.sql.dictionary.SequenceDescriptor;",
"import org.apache.derby.iapi.sql.dictionary.PermDescriptor;"
],
"header": "@@ -49,6 +49,8 @@ import org.apache.derby.iapi.sql.dictionary.RoutinePermsDescriptor;",
"removed": []
}
]
}
] |
derby-DERBY-716-2d3677b5
|
DERBY-716: Datatype tests and fix to collation of string columns returned by table functions.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@585710 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/catalog/types/TypeDescriptorImpl.java",
"hunks": [
{
"added": [
"import org.apache.derby.shared.common.reference.JDBC40Translation;",
""
],
"header": "@@ -21,6 +21,8 @@",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/CreateAliasNode.java",
"hunks": [
{
"added": [
"import org.apache.derby.catalog.types.RowMultiSetImpl;"
],
"header": "@@ -40,6 +40,7 @@ import org.apache.derby.iapi.services.sanity.SanityManager;",
"removed": []
},
{
"added": [
"\t/**",
"\t * Set the collation of the columns in a Table Function's returned row set.",
"\t */",
"\tprivate void setTableFunctionCollations()",
" throws StandardException",
" {",
"\t\tif ( aliasInfo.isTableFunction() )",
" {",
" RoutineAliasInfo info = (RoutineAliasInfo) aliasInfo;",
" RowMultiSetImpl tableFunctionReturnType = (RowMultiSetImpl) ((DataTypeDescriptor) info.getReturnType()).getTypeId().getBaseTypeId();",
" TypeDescriptor[] types = tableFunctionReturnType.getTypes();",
" int returnedTableColumnCount = types.length;",
" SchemaDescriptor sd = getSchemaDescriptor();",
"",
" for ( int i = 0; i < returnedTableColumnCount; i++ )",
" {",
" TypeDescriptorImpl tdi = (TypeDescriptorImpl) types[ i ];",
" if ( tdi.isStringType() )",
" {",
" tdi.setCollationType( sd.getCollationType() );",
" }",
" }",
" }",
"",
" }",
" "
],
"header": "@@ -304,6 +305,32 @@ public class CreateAliasNode extends DDLStatementNode",
"removed": []
}
]
}
] |
derby-DERBY-716-3953c9e5
|
DERBY-716: Expose VTICosting and VTIEnvironment in Derby's public api.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@574945 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/vti/VTICosting.java",
"hunks": [
{
"added": [
" * <P>",
" * to cost Table Functions. The methods on this interface provide the optimizer",
" * </P>",
" *",
" * <UL> ",
" * <LI> The estimated number of rows returned by the Table Function in a single instantiation.",
" * <LI> The estimated cost to instantiate and iterate through the Table Function.",
" * <LI> Whether or not the Table Function can be instantiated multiple times within a single query execution.",
" * </UL>",
" *",
" * <P>",
" * The optimizer places a Table Function in the join order after making some",
" * assumptions:",
" * </P>",
" *",
" * <UL>",
" * <LI><B>Cost</B> - The optimizer hard-codes a guess about how expensive",
" * it is to materialize a Table Function.",
" * </LI>",
" * <LI><B>Count</B> - The optimizer also hard-codes a guess about how",
" * many rows a Table Function returns.",
" * </LI>",
" * <LI><B>Repeatability</B> - The optimizer assumes that the same results",
" * come back each time you invoke a Table Function.",
" * </LI>",
" * </Ul>",
" *",
" * The class which contains your Table Function can override these assumptions",
" * and improve the join order as follows:",
" * </P>",
" *",
" * <UL>",
" * <LI><B>Implement</B> - The class must implement <a href=\"./VTICosting.html\">VTICosting</a>.",
" * </LI>",
" * <LI><B>Construct</B> - The class must contain a public, no-arg constructor.",
" * </LI>",
" * </Ul>",
" *",
" * <P>",
" * The methods in this interface take a <a href=\"./VTIEnvironment.html\">VTIEnvironment</a>",
" * argument. This is a state variable created by the optimizer. The methods in",
" * this interface can use this state variable to pass information to one",
" * another and learn other details of the operating environment.",
" * </P>",
" *",
"\t * A useful constant: the default estimated number of rows returned by a",
"\t * Table Function.",
"\t A useful constant: The default estimated cost of instantiating and",
"\t iterating throught a Table Function.",
"\t * Get the estimated row count for a single scan of a Table Function.",
"\t * @param vtiEnvironment The state variable for optimizing the Table Function.",
"\t * @return\tThe estimated row count for a single scan of the Table Function."
],
"header": "@@ -24,39 +24,76 @@ package org.apache.derby.vti;",
"removed": [
" * to cost VTIs.",
" * ",
" The methods on the interface provide the optimizer",
" <UL> ",
" <LI> the estimated number of rows returned by the VTI in a single instantiation.",
" <LI> the estimated cost to instantiate and iterate through the VTI.",
" <LI> whether or not the VTI can be instantiated multiple times within a single query execution",
" </UL>",
" * This class can only be used within an SQL-J statement. Using the methods",
" * in application-side Java code results in Exceptions being thrown.",
"\t * A useful constant: the default estimated number of rows returned by a VTI.",
"\t A useful constant: The default estimated cost of instantiating and iterating throught a VTI.",
"\t * Get the estimated row count for a single scan of a VTI.",
"\t * @param vtiEnvironment The VTIEnvironment.",
"\t * @return\tThe estimated row count for a single scan of a VTI."
]
},
{
"added": [
"\t * Get the estimated cost for a single instantiation of a Table Function.",
"\t * @param vtiEnvironment The state variable for optimizing the Table Function.",
"\t * @return\tThe estimated cost for a single instantiation of the Table Function."
],
"header": "@@ -64,11 +101,11 @@ public interface VTICosting",
"removed": [
"\t * Get the estimated cost for a single instantiation of a VTI.",
"\t * @param vtiEnvironment The VTIEnvironment.",
"\t * @return\tThe estimated cost for a single instantiation of a VTI."
]
}
]
},
{
"file": "java/engine/org/apache/derby/vti/VTIEnvironment.java",
"hunks": [
{
"added": [
" *",
" * <P>",
" *\tVTIEnvironment is the state variable created by the optimizer to help it",
" *\tplace a Table Function in the join order.",
" *\tThe methods of <a href=\"./VTICosting.html\">VTICosting</a> use this state variable in",
" *\torder to pass information to each other and learn other details of the",
" *\toperating environment.",
" * </P>"
],
"header": "@@ -22,11 +22,14 @@",
"removed": [
" * ",
" *\tVTIEnvironment is an interface used in costing VTIs.",
" * ",
" * The interface is",
" * passed as a parameter to various methods in the Virtual Table interface."
]
},
{
"added": [
"\t\tReturn true if this instance of the Table Function has been created for compilation,"
],
"header": "@@ -34,7 +37,7 @@ public interface VTIEnvironment",
"removed": [
"\t\tReturn true if this instance of the VTI has been created for compilation,"
]
}
]
}
] |
derby-DERBY-716-4aef9b04
|
DERBY-716: Commit first increment of VTI work, enabling DDL for table functions and their invocation in simple SELECTs.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@555032 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/catalog/types/BaseTypeIdImpl.java",
"hunks": [
{
"added": [
" \": \" + getSQLTypeName();"
],
"header": "@@ -195,7 +195,7 @@ public class BaseTypeIdImpl implements Formatable",
"removed": [
" \": \" + SQLTypeName;"
]
},
{
"added": [
" return this.getSQLTypeName().equals(((BaseTypeIdImpl)that).getSQLTypeName());"
],
"header": "@@ -205,7 +205,7 @@ public class BaseTypeIdImpl implements Formatable",
"removed": [
" return this.SQLTypeName.equals(((BaseTypeIdImpl)that).getSQLTypeName());"
]
}
]
},
{
"file": "java/engine/org/apache/derby/catalog/types/RoutineAliasInfo.java",
"hunks": [
{
"added": [
"\t/** PARAMETER STYLE DERBY_JDBC_RESULT_SET */",
"\tpublic static final short PS_DERBY_JDBC_RESULT_SET = PS_JAVA + 1;",
""
],
"header": "@@ -52,6 +52,9 @@ public class RoutineAliasInfo extends MethodAliasInfo",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/iapi/services/io/StoredFormatIds.java",
"hunks": [
{
"added": [
" public static final int ROW_MULTISET_CATALOG_ID = ",
" (MIN_ID_2 + 468);",
"",
" public static final int ROW_MULTISET_TYPE_ID_IMPL = ",
" (MIN_ID_2 + 469);",
" "
],
"header": "@@ -879,6 +879,12 @@ public interface StoredFormatIds {",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/iapi/sql/dictionary/AliasDescriptor.java",
"hunks": [
{
"added": [
"import org.apache.derby.catalog.types.RoutineAliasInfo;"
],
"header": "@@ -25,11 +25,11 @@ import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;",
"removed": [
""
]
}
]
},
{
"file": "java/engine/org/apache/derby/iapi/sql/execute/ResultSetFactory.java",
"hunks": [
{
"added": [
"\t\t@param isDerbyStyleTableFunction True if this is a Derby-style table function"
],
"header": "@@ -641,6 +641,7 @@ public interface ResultSetFactory {",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/iapi/types/DataTypeDescriptor.java",
"hunks": [
{
"added": [
"import org.apache.derby.catalog.types.BaseTypeIdImpl;",
"import org.apache.derby.catalog.types.RowMultiSetImpl;"
],
"header": "@@ -28,6 +28,8 @@ import java.sql.Types;",
"removed": []
},
{
"added": [
"\t/**",
"\t * Get a DataTypeServices that corresponds to a SQL Row Multiset",
"\t *",
"\t * @param columnNames Names of the columns in the Row Muliset",
"\t * @param types Types of the columns in the Row Muliset",
"\t *",
"\t * @return\tA new DataTypeDescriptor describing the SQL Row Multiset",
"\t */",
"\tpublic static DataTypeDescriptor getRowMultiSet",
"\t(",
"\t\tString[]\t columnNames,",
"\t\tDataTypeDescriptor[]\ttypes",
"\t)",
"\t{",
"\t\tRowMultiSetImpl rms = new RowMultiSetImpl( columnNames, types );",
"\t\tTypeId typeID = new TypeId( StoredFormatIds.ROW_MULTISET_CATALOG_ID, rms );",
"",
"\t\treturn new DataTypeDescriptor( typeID, true);",
"\t}",
""
],
"header": "@@ -252,6 +254,26 @@ public final class DataTypeDescriptor implements TypeDescriptor, Formatable",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java",
"hunks": [
{
"added": [
"\t{",
"\t\tif (SchemaDescriptor.STD_SYSTEM_DIAG_SCHEMA_NAME.equals(",
"\t\t\ttd.getSchemaName()))",
"\t\t{ return getBuiltinVTIClass( td, asTableFunction ); }",
"\t\telse // see if it's a user-defined table function",
"\t\t{",
"\t\t String schemaName = td.getSchemaName();",
"\t\t String functionName = td.getDescriptorName();",
"\t\t SchemaDescriptor sd = getSchemaDescriptor( td.getSchemaName(), null, true );",
"",
"\t\t if ( sd != null )",
"\t\t {",
"\t\t AliasDescriptor ad = getAliasDescriptor( sd.getUUID().toString(), functionName, AliasInfo.ALIAS_TYPE_FUNCTION_AS_CHAR );",
"",
"\t\t if ( (ad != null) && ad.isTableFunction() ) { return ad.getJavaClassName(); }",
"",
"\t\t throw StandardException.newException",
"\t\t ( SQLState.LANG_NOT_TABLE_FUNCTION, schemaName, functionName );",
"\t\t }",
"\t\t}",
"\t\t",
"\t\treturn null;",
"\t}",
"",
"\t/**",
"\t * @see DataDictionary#getBuiltinVTIClass(TableDescriptor, boolean)",
"\t */",
"\tpublic String getBuiltinVTIClass(TableDescriptor td, boolean asTableFunction)",
"\t\tthrows StandardException"
],
"header": "@@ -11232,6 +11232,35 @@ public final class\tDataDictionaryImpl",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/FromVTI.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.types.DataTypeDescriptor;"
],
"header": "@@ -51,6 +51,7 @@ import org.apache.derby.iapi.sql.dictionary.ColumnDescriptor;",
"removed": []
},
{
"added": [
"import org.apache.derby.catalog.TypeDescriptor;",
"import org.apache.derby.catalog.types.RoutineAliasInfo;",
"import org.apache.derby.catalog.types.RowMultiSetImpl;"
],
"header": "@@ -58,7 +59,10 @@ import org.apache.derby.iapi.reference.SQLState;",
"removed": []
},
{
"added": [
"\tMethodCallNode\tmethodCall;",
"\tboolean\t\t\t\tisDerbyStyleTableFunction;"
],
"header": "@@ -97,13 +101,14 @@ public class FromVTI extends FromTable implements VTIEnvironment",
"removed": [
"\tNewInvocationNode\tnewInvocation;"
]
},
{
"added": [
"\t * @param invocation\t\tThe constructor or static method for the VTI"
],
"header": "@@ -147,7 +152,7 @@ public class FromVTI extends FromTable implements VTIEnvironment",
"removed": [
"\t * @param newInvocation\t\tThe constructor for the VTI"
]
},
{
"added": [
"\t\t\t\t\tObject invocation,",
" init( invocation,"
],
"header": "@@ -155,13 +160,13 @@ public class FromVTI extends FromTable implements VTIEnvironment",
"removed": [
"\t\t\t\t\tObject newInvocation,",
" init( newInvocation,"
]
},
{
"added": [
"\t * @param invocation\t\tThe constructor or static method for the VTI"
],
"header": "@@ -169,7 +174,7 @@ public class FromVTI extends FromTable implements VTIEnvironment",
"removed": [
"\t * @param newInvocation\t\tThe constructor for the VTI"
]
},
{
"added": [
"\t\t\t\t\tObject invocation,"
],
"header": "@@ -178,7 +183,7 @@ public class FromVTI extends FromTable implements VTIEnvironment",
"removed": [
"\t\t\t\t\tObject newInvocation,"
]
},
{
"added": [
"",
"\t\tthis.methodCall = (MethodCallNode) invocation;",
""
],
"header": "@@ -186,7 +191,9 @@ public class FromVTI extends FromTable implements VTIEnvironment",
"removed": [
"\t\tthis.newInvocation = (NewInvocationNode) newInvocation;"
]
},
{
"added": [
"\t\t\tif (methodCall != null)",
"\t\t\t\tprintLabel(depth, \"methodCall: \");",
"\t\t\t\tmethodCall.treePrint(depth + 1);"
],
"header": "@@ -408,10 +415,10 @@ public class FromVTI extends FromTable implements VTIEnvironment",
"removed": [
"\t\t\tif (newInvocation != null)",
"\t\t\t\tprintLabel(depth, \"newInvocation: \");",
"\t\t\t\tnewInvocation.treePrint(depth + 1);"
]
},
{
"added": [
"\t * Return true if this VTI is a constructor. Otherwise, it is a static method.",
"\tpublic boolean isConstructor()",
"\t\treturn ( methodCall instanceof NewInvocationNode );",
"\t}",
"",
"\t/** ",
"\t * Return the constructor or static method invoked from this node",
"\t */",
"\tpublic MethodCallNode getMethodCall()",
"\t{",
"\t\treturn methodCall;"
],
"header": "@@ -429,13 +436,19 @@ public class FromVTI extends FromTable implements VTIEnvironment",
"removed": [
"\t * Return the new invocation from this node.",
"\t *",
"\t * @return ResultSetNode\tThe new invocation from this node.",
"\tpublic NewInvocationNode getNewInvocation()",
"\t\treturn newInvocation;"
]
},
{
"added": [
" return methodCall.getJavaClassName();"
],
"header": "@@ -496,7 +509,7 @@ public class FromVTI extends FromTable implements VTIEnvironment",
"removed": [
" return newInvocation.getJavaClassName();"
]
},
{
"added": [
"\t\t/* Bind the constructor or static method - does basic error checking.",
"\t\tmethodCall.bindExpression(fromListParam,",
"\t\t/* If we have a valid constructor, does class implement the correct interface? ",
"\t\tif ( isConstructor() )",
"\t\t NewInvocationNode constructor = (NewInvocationNode) methodCall;",
" ",
"\t\t if (!constructor.assignableTo(\"java.sql.PreparedStatement\"))",
"\t\t {",
"\t\t\telse if (! constructor.assignableTo(\"java.sql.ResultSet\"))",
"\t\t }",
"\t\t else",
"\t\t {",
"\t\t\t version2 = true;",
"\t\t }",
"\t\t /* If this is a version 2 VTI */",
"\t\t if (version2)",
"\t\t {",
"\t\t\timplementsPushable = constructor.assignableTo(\"org.apache.derby.vti.IQualifyable\");",
"\t\t }",
"\t\t // Remember whether or not the VTI implements the VTICosting interface",
"\t\t implementsVTICosting = constructor.assignableTo(ClassName.VTICosting);",
"\t\tmethodParms = methodCall.getMethodParms();"
],
"header": "@@ -521,54 +534,59 @@ public class FromVTI extends FromTable implements VTIEnvironment",
"removed": [
"\t\t/* Bind the constructor - does basic error checking.",
"\t\tnewInvocation.bindExpression(fromListParam,",
"\t\t/* We have a valid constructor. Does class implement the correct interface? ",
"\t\tif (!newInvocation.assignableTo(\"java.sql.PreparedStatement\"))",
"\t\t\telse if (! newInvocation.assignableTo(\"java.sql.ResultSet\"))",
"\t\t}",
"\t\telse",
"\t\t{",
"\t\t\tversion2 = true;",
"\t\t}",
"\t\t/* If this is a version 2 VTI */",
"\t\tif (version2)",
"\t\t{",
"\t\t\timplementsPushable = newInvocation.assignableTo(\"org.apache.derby.vti.IQualifyable\");",
"\t\t// Remember whether or not the VTI implements the VTICosting interface",
"\t\timplementsVTICosting = newInvocation.assignableTo(ClassName.VTICosting);",
"\t\tmethodParms = newInvocation.getMethodParms();"
]
},
{
"added": [
"\t\tif ((isConstructor()) && ((triggerTableId = getSpecialTriggerVTITableName(lcc, methodCall.getJavaClassName())) != null) )"
],
"header": "@@ -578,7 +596,7 @@ public class FromVTI extends FromTable implements VTIEnvironment",
"removed": [
"\t\tif ((triggerTableId = getSpecialTriggerVTITableName(lcc, newInvocation.getJavaClassName())) != null)\t"
]
},
{
"added": [
"\t\t\tresultColumns = (ResultColumnList) getNodeFactory().getNode(",
"\t\t\t\t\t\t\t\t\t\t\t\tC_NodeTypes.RESULT_COLUMN_LIST,",
"\t\t\t\t\t\t\t\t\t\t\t\tgetContextManager());",
"",
"\t\t\t// if this is a Derby-style Table Function, then build the result",
"\t\t\t// column list from the RowMultiSetImpl return datatype",
"\t\t\tRoutineAliasInfo routineInfo = methodCall.getRoutineInfo();",
"",
"\t\t\tif (",
"\t\t\t (routineInfo !=null) &&",
"\t\t\t routineInfo.getReturnType().isRowMultiSet() &&",
"\t\t\t (routineInfo.getParameterStyle() == RoutineAliasInfo.PS_DERBY_JDBC_RESULT_SET)",
"\t\t\t )\t\t\t{",
"\t\t\t isDerbyStyleTableFunction = true;",
"\t\t\t createResultColumnsForTableFunction( routineInfo.getReturnType() );",
"\t\t\t}",
"\t\t\telse",
" ",
"\t\t\t ResultSetMetaData rsmd = getResultSetMetaData();",
"\t",
"\t\t\t /* Wouldn't it be nice if we knew that the class/object would never",
"\t\t\t * return a null ResultSetMetaData.",
"\t\t\t */",
"\t\t\t if (rsmd == null)",
"\t\t\t {",
"\t\t\t }",
"\t\t\t // Remember how many columns VTI returns for partial row calculation",
"\t\t\t try",
"\t\t\t {",
"\t\t\t }",
"\t\t\t catch (SQLException sqle)",
"\t\t\t {",
"\t\t\t }",
"\t\t\t resultColumns.createListFromResultSetMetaData(rsmd, exposedName, ",
"\t\t\t\t\t\t\t\t\t\t\t\t\t\t getVTIName() );",
"\t\t\t}"
],
"header": "@@ -591,32 +609,49 @@ public class FromVTI extends FromTable implements VTIEnvironment",
"removed": [
"\t\t\tResultSetMetaData rsmd = getResultSetMetaData();",
"\t",
"\t\t\t/* Wouldn't it be nice if we knew that the class/object would never",
"\t\t\t * return a null ResultSetMetaData.",
"\t\t\t */",
"\t\t\tif (rsmd == null)",
"\t\t\t}",
"\t\t\t// Remember how many columns VTI returns for partial row calculation",
"\t\t\ttry",
"\t\t\t{",
"\t\t\t}",
"\t\t\tcatch (SQLException sqle)",
"\t\t\t{",
"\t\t\t}",
"\t\t\tresultColumns = (ResultColumnList) getNodeFactory().getNode(",
"\t\t\t\t\t\t\t\t\t\t\t\tC_NodeTypes.RESULT_COLUMN_LIST,",
"\t\t\t\t\t\t\t\t\t\t\t\tgetContextManager());",
"\t\t\tresultColumns.createListFromResultSetMetaData(rsmd, exposedName, ",
"\t\t\t\t\t\t\t\t\t\t\t\t\t\t newInvocation.getJavaClassName());"
]
},
{
"added": [
"\t\tNewInvocationNode constructor = (NewInvocationNode) methodCall;",
"\t\tClass[] paramTypeClasses = constructor.getMethodParameterClasses();"
],
"header": "@@ -705,7 +740,8 @@ public class FromVTI extends FromTable implements VTIEnvironment",
"removed": [
"\t\tClass[] paramTypeClasses = newInvocation.getMethodParameterClasses();"
]
},
{
"added": [
" String javaClassName = methodCall.getJavaClassName();",
" Constructor constr = classInspector.getClass(javaClassName).getConstructor(paramTypeClasses);",
" return constr.newInstance(paramObjects);"
],
"header": "@@ -781,10 +817,10 @@ public class FromVTI extends FromTable implements VTIEnvironment",
"removed": [
" String javaClassName = newInvocation.getJavaClassName();",
" Constructor constructor = classInspector.getClass(javaClassName).getConstructor(paramTypeClasses);",
" return constructor.newInstance(paramObjects);"
]
},
{
"added": [
"\t\tmaterializable = methodCall.areParametersQueryInvariant();"
],
"header": "@@ -846,7 +882,7 @@ public class FromVTI extends FromTable implements VTIEnvironment",
"removed": [
"\t\tmaterializable = newInvocation.areParametersQueryInvariant();"
]
},
{
"added": [
"\t\tmethodCall.accept(getCRs);"
],
"header": "@@ -887,7 +923,7 @@ public class FromVTI extends FromTable implements VTIEnvironment",
"removed": [
"\t\tnewInvocation.accept(getCRs);"
]
},
{
"added": [
"\t\tmethodCall.preprocess("
],
"header": "@@ -1025,7 +1061,7 @@ public class FromVTI extends FromTable implements VTIEnvironment",
"removed": [
"\t\tnewInvocation.preprocess("
]
},
{
"added": [
"\t\tmethodCall.categorize(referencedTableMap, false);"
],
"header": "@@ -1040,7 +1076,7 @@ public class FromVTI extends FromTable implements VTIEnvironment",
"removed": [
"\t\tnewInvocation.categorize(referencedTableMap, false);"
]
},
{
"added": [
"\t\tmethodCall.getCorrelationTables(correlationMap);"
],
"header": "@@ -1054,7 +1090,7 @@ public class FromVTI extends FromTable implements VTIEnvironment",
"removed": [
"\t\tnewInvocation.getCorrelationTables(correlationMap);"
]
},
{
"added": [
"\t\tmethodCall.accept(rcrv);"
],
"header": "@@ -1168,7 +1204,7 @@ public class FromVTI extends FromTable implements VTIEnvironment",
"removed": [
"\t\tnewInvocation.accept(rcrv);"
]
},
{
"added": [
"\t\tmb.push(methodCall.getJavaClassName()); // arg 5"
],
"header": "@@ -1239,7 +1275,7 @@ public class FromVTI extends FromTable implements VTIEnvironment",
"removed": [
"\t\tmb.push(newInvocation.getJavaClassName()); // arg 5"
]
},
{
"added": [
"\t\t// Whether or not this is a Derby-style Table Function",
"\t\tmb.push(isDerbyStyleTableFunction);",
"",
"\t\treturn 15;"
],
"header": "@@ -1269,7 +1305,10 @@ public class FromVTI extends FromTable implements VTIEnvironment",
"removed": [
"\t\treturn 14;"
]
},
{
"added": [
"\t\tmethodCall.generateExpression(acb, userExprFun);"
],
"header": "@@ -1296,7 +1335,7 @@ public class FromVTI extends FromTable implements VTIEnvironment",
"removed": [
"\t\tnewInvocation.generateExpression(acb, userExprFun);"
]
},
{
"added": [
"\t\t// methodCall knows it is returning its value;"
],
"header": "@@ -1314,7 +1353,7 @@ public class FromVTI extends FromTable implements VTIEnvironment",
"removed": [
"\t\t// newInvocation knows it is returning its value;"
]
},
{
"added": [
"\t\treturn (! baseTable) && name.equals(methodCall.getJavaClassName());"
],
"header": "@@ -1365,7 +1404,7 @@ public class FromVTI extends FromTable implements VTIEnvironment",
"removed": [
"\t\treturn (! baseTable) && name.equals(newInvocation.getJavaClassName());"
]
},
{
"added": [
"\t\t\tmethodCall = (MethodCallNode) methodCall.accept(v);"
],
"header": "@@ -1388,7 +1427,7 @@ public class FromVTI extends FromTable implements VTIEnvironment",
"removed": [
"\t\t\tnewInvocation = (NewInvocationNode) newInvocation.accept(v);"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/MethodCallNode.java",
"hunks": [
{
"added": [
"import java.util.Enumeration;"
],
"header": "@@ -58,6 +58,7 @@ import org.apache.derby.catalog.types.RoutineAliasInfo;",
"removed": []
},
{
"added": [
" /**",
" * Get the details on the invoked routines.",
" */",
" public RoutineAliasInfo getRoutineInfo()",
" {",
" return routineInfo;",
" }",
""
],
"header": "@@ -139,6 +140,14 @@ abstract class MethodCallNode extends JavaValueNode",
"removed": []
},
{
"added": [
"\t/**",
"\t *\tGet the resolved Classes of our parameters",
"\t *",
"\t *\t@return\tthe Classes of our parameters",
"\t */",
"\tpublic\tClass[]\tgetMethodParameterClasses() ",
"\t{ ",
"\t\tClassInspector ci = getClassFactory().getClassInspector();",
"",
"\t\tClass[]\tparmTypeClasses = new Class[methodParms.length];",
"\t\tfor (int i = 0; i < methodParms.length; i++)",
"\t\t{",
"\t\t\tString className = methodParameterTypes[i];",
"\t\t\ttry",
"\t\t\t{",
"\t\t\t\tparmTypeClasses[i] = ci.getClass(className);",
"\t\t\t}",
"\t\t\tcatch (ClassNotFoundException cnfe)",
"\t\t\t{",
"\t\t\t\t/* We should never get this exception since we verified ",
"\t\t\t\t * that the classes existed at bind time. Just return null.",
"\t\t\t\t */",
"\t\t\t\tif (SanityManager.DEBUG)",
"\t\t\t\t{",
"\t\t\t\t\tSanityManager.THROWASSERT(\"Unexpected exception\", cnfe);",
"\t\t\t\t}",
"\t\t\t\treturn null;",
"\t\t\t}",
"\t\t}",
"",
"\t\treturn parmTypeClasses;",
"\t}",
"",
"\t/**",
"\t * Build a JBitSet of all of the tables that we are",
"\t * correlated with.",
"\t *",
"\t * @param correlationMap\tThe JBitSet of the tables that we are correlated with.",
"\t */",
"\tvoid getCorrelationTables(JBitSet correlationMap)",
"\t\tthrows StandardException",
"\t{",
"\t\tCollectNodesVisitor getCRs = new CollectNodesVisitor(ColumnReference.class);",
"\t\tsuper.accept(getCRs);",
"\t\tVector colRefs = getCRs.getList();",
"\t\tfor (Enumeration e = colRefs.elements(); e.hasMoreElements(); )",
"\t\t{",
"\t\t\tColumnReference ref = (ColumnReference)e.nextElement();",
"\t\t\tif (ref.getCorrelated())",
"\t\t\t{",
"\t\t\t\tcorrelationMap.set(ref.getTableNumber());",
"\t\t\t}",
"\t\t}",
"\t}",
""
],
"header": "@@ -175,6 +184,61 @@ abstract class MethodCallNode extends JavaValueNode",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/NewInvocationNode.java",
"hunks": [
{
"added": [
"\tprivate boolean isBuiltinVTI = false;",
""
],
"header": "@@ -63,6 +63,8 @@ public class NewInvocationNode extends MethodCallNode",
"removed": []
},
{
"added": [
"\t\tthis.isBuiltinVTI =",
"\t\t ( getDataDictionary().getBuiltinVTIClass( td, isTableFunctionVTI) != null);",
""
],
"header": "@@ -161,6 +163,9 @@ public class NewInvocationNode extends MethodCallNode",
"removed": []
},
{
"added": [
"\t/**",
"\t * Report whether this node represents a builtin VTI.",
"\t */",
"\tpublic boolean isBuiltinVTI() { return isBuiltinVTI; }",
""
],
"header": "@@ -189,6 +194,11 @@ public class NewInvocationNode extends MethodCallNode",
"removed": []
},
{
"added": [],
"header": "@@ -199,39 +209,6 @@ public class NewInvocationNode extends MethodCallNode",
"removed": [
"\t/**",
"\t *\tGet the resolved Classes of our parameters",
"\t *",
"\t *\t@return\tthe Classes of our parameters",
"\t */",
"\tpublic\tClass[]\tgetMethodParameterClasses() ",
"\t{ ",
"\t\tClassInspector ci = getClassFactory().getClassInspector();",
"",
"\t\tClass[]\tparmTypeClasses = new Class[methodParms.length];",
"\t\tfor (int i = 0; i < methodParms.length; i++)",
"\t\t{",
"\t\t\tString className = methodParameterTypes[i];",
"\t\t\ttry",
"\t\t\t{",
"\t\t\t\tparmTypeClasses[i] = ci.getClass(className);",
"\t\t\t}",
"\t\t\tcatch (ClassNotFoundException cnfe)",
"\t\t\t{",
"\t\t\t\t/* We should never get this exception since we verified ",
"\t\t\t\t * that the classes existed at bind time. Just return null.",
"\t\t\t\t */",
"\t\t\t\tif (SanityManager.DEBUG)",
"\t\t\t\t{",
"\t\t\t\t\tSanityManager.THROWASSERT(\"Unexpected exception\", cnfe);",
"\t\t\t\t}",
"\t\t\t\treturn null;",
"\t\t\t}",
"\t\t}",
"",
"\t\treturn parmTypeClasses;",
"\t}",
""
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java",
"hunks": [
{
"added": [
"\t\t\t\t\t\t\t\t\t\t\t\t\t targetVTI.getMethodCall().getJavaClassName());"
],
"header": "@@ -836,7 +836,7 @@ public class ResultColumnList extends QueryTreeNodeVector",
"removed": [
"\t\t\t\t\t\t\t\t\t\t\t\t\t targetVTI.getNewInvocation().getJavaClassName());"
]
},
{
"added": [
"\t\t\t\taddColumn( tableName, rsmd.getColumnName(index), dts );"
],
"header": "@@ -3286,19 +3286,7 @@ public class ResultColumnList extends QueryTreeNodeVector",
"removed": [
"\t\t\t\tValueNode bcn = (ValueNode) getNodeFactory().getNode(",
"\t\t\t\t\t\t\t\t\t\t\tC_NodeTypes.BASE_COLUMN_NODE,",
"\t\t\t\t\t\t\t\t\t\t\trsmd.getColumnName(index),",
"\t\t\t\t\t\t\t\t\t \t\ttableName,",
"\t\t\t\t\t\t\t\t\t\t\tdts,",
"\t\t\t\t\t\t\t\t\t\t\tgetContextManager());",
"\t\t\t\tResultColumn rc = (ResultColumn) getNodeFactory().getNode(",
"\t\t\t\t\t\t\t\t\t\tC_NodeTypes.RESULT_COLUMN,",
"\t\t\t\t\t\t\t\t\t\trsmd.getColumnName(index),",
"\t\t\t\t\t\t\t\t\t\tbcn,",
"\t\t\t\t\t\t\t\t\t\tgetContextManager());",
"\t\t\t\trc.setType(dts);",
"\t\t\t\taddResultColumn(rc);"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/VTIDeferModPolicy.java",
"hunks": [
{
"added": [
" String VTIClassName = targetVTI.getMethodCall().getJavaClassName();"
],
"header": "@@ -70,7 +70,7 @@ class VTIDeferModPolicy implements Visitor",
"removed": [
" String VTIClassName = targetVTI.getNewInvocation().getJavaClassName();"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/execute/GenericResultSetFactory.java",
"hunks": [
{
"added": [
"\t\t\t\t\t\t\t\t\t double optimizerEstimatedCost,",
"\t\t\t\t\t\t\t\t\t boolean isDerbyStyleTableFunction",
" )"
],
"header": "@@ -443,7 +443,9 @@ public class GenericResultSetFactory implements ResultSetFactory",
"removed": [
"\t\t\t\t\t\t\t\t\t double optimizerEstimatedCost)"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/execute/VTIResultSet.java",
"hunks": [
{
"added": [
"\tprivate boolean isDerbyStyleTableFunction;",
""
],
"header": "@@ -92,6 +92,8 @@ class VTIResultSet extends NoPutResultSetImpl",
"removed": []
},
{
"added": [
"\t\t\t\t double optimizerEstimatedCost,",
"\t\t\t\t boolean isDerbyStyleTableFunction",
" ) "
],
"header": "@@ -111,7 +113,9 @@ class VTIResultSet extends NoPutResultSetImpl",
"removed": [
"\t\t\t\t double optimizerEstimatedCost) "
]
},
{
"added": [
"\t\tthis.isDerbyStyleTableFunction = isDerbyStyleTableFunction;"
],
"header": "@@ -124,6 +128,7 @@ class VTIResultSet extends NoPutResultSetImpl",
"removed": []
}
]
}
] |
derby-DERBY-716-524a8b4d
|
DERBY-716: Add optimizer support for Derby-style Table Functions.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@574276 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/sql/compile/FromVTI.java",
"hunks": [
{
"added": [
"import java.lang.reflect.Modifier;"
],
"header": "@@ -78,6 +78,7 @@ import org.apache.derby.iapi.sql.execute.ExecutionContext;",
"removed": []
},
{
"added": [
"\t\t\t\tVTICosting vtic = getVTICosting();"
],
"header": "@@ -231,7 +232,7 @@ public class FromVTI extends FromTable implements VTIEnvironment",
"removed": [
"\t\t\t\tVTICosting vtic = (version2) ? (VTICosting) ps : (VTICosting) rs;"
]
},
{
"added": [
"\t\t// Is the parameter list to the constructor valid for a VTI?",
"\t\tmethodParms = methodCall.getMethodParms();",
"",
" RoutineAliasInfo routineInfo = methodCall.getRoutineInfo();",
"",
" if (",
" (routineInfo !=null) &&",
" routineInfo.getReturnType().isRowMultiSet() &&",
" (routineInfo.getParameterStyle() == RoutineAliasInfo.PS_DERBY_JDBC_RESULT_SET)",
" )\t\t\t{",
" isDerbyStyleTableFunction = true;",
" }",
" "
],
"header": "@@ -543,6 +544,19 @@ public class FromVTI extends FromTable implements VTIEnvironment",
"removed": []
},
{
"added": [
" if ( isDerbyStyleTableFunction )",
" {",
" implementsVTICosting = implementsDerbyStyleVTICosting( methodCall.getJavaClassName() );",
" }",
" "
],
"header": "@@ -583,10 +597,11 @@ public class FromVTI extends FromTable implements VTIEnvironment",
"removed": [
"",
"",
"\t\t// Is the parameter list to the constructor valid for a VTI?",
"\t\tmethodParms = methodCall.getMethodParms();"
]
},
{
"added": [
"",
"\t\t\tif ( isDerbyStyleTableFunction ) {"
],
"header": "@@ -615,14 +630,8 @@ public class FromVTI extends FromTable implements VTIEnvironment",
"removed": [
"\t\t\tRoutineAliasInfo routineInfo = methodCall.getRoutineInfo();",
"",
"\t\t\tif (",
"\t\t\t (routineInfo !=null) &&",
"\t\t\t routineInfo.getReturnType().isRowMultiSet() &&",
"\t\t\t (routineInfo.getParameterStyle() == RoutineAliasInfo.PS_DERBY_JDBC_RESULT_SET)",
"\t\t\t )\t\t\t{",
"\t\t\t isDerbyStyleTableFunction = true;"
]
}
]
}
] |
derby-DERBY-716-83ce7fb7
|
DERBY-716: Add test verifying correct behavior of table functions in subqueries with correlated references to outer query blocks.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@587491 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-716-c6c266ba
|
DERBY-716: Exclude summary row 0 from getFunctionColumns() result for Table Functions.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@564800 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/catalog/GetProcedureColumns.java",
"hunks": [
{
"added": [
"\t\tint functionParamCursor = -2;",
""
],
"header": "@@ -133,6 +133,8 @@ public class GetProcedureColumns extends org.apache.derby.vti.VTITemplate",
"removed": []
},
{
"added": [
"\t\t\t functionParamCursor = -1;"
],
"header": "@@ -145,6 +147,7 @@ public class GetProcedureColumns extends org.apache.derby.vti.VTITemplate",
"removed": []
}
]
}
] |
derby-DERBY-716-e9ff7be5
|
DERBY-716: Prevent table function creation after soft-upgrade, verify with a regression test.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@578452 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-718-11ee500e
|
DERBY-718 Network client: deleteRow() makes getter methods return nulls for the following rows. Submitted by Fernanda.Pizzorno@Sun.COM
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@348798 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-721-31f29a4b
|
- DERBY-721_4 - State of InputStream retrieved from resultset is not clean , if there exists previous InputStream . Patch to throw exception if user get stream for a value in result set twice . by Tomohito Nakayama (tomonaka@basil.ocn.ne.jp)
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@357435 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/client/org/apache/derby/client/am/ResultSet.java",
"hunks": [
{
"added": [
" ",
" private boolean[] streamUsedFlags_;",
" "
],
"header": "@@ -188,7 +188,9 @@ public abstract class ResultSet implements java.sql.ResultSet,",
"removed": [
""
]
},
{
"added": [
"\t",
"\tunuseStreams();"
],
"header": "@@ -262,6 +264,8 @@ public abstract class ResultSet implements java.sql.ResultSet,",
"removed": []
},
{
"added": [
"\t",
"\tuseStream(column);",
""
],
"header": "@@ -919,7 +923,10 @@ public abstract class ResultSet implements java.sql.ResultSet,",
"removed": []
},
{
"added": [
"\t",
"\tuseStream(column);",
""
],
"header": "@@ -941,7 +948,10 @@ public abstract class ResultSet implements java.sql.ResultSet,",
"removed": []
},
{
"added": [
"\t",
"\tuseStream(column);",
"\t"
],
"header": "@@ -965,7 +975,10 @@ public abstract class ResultSet implements java.sql.ResultSet,",
"removed": []
},
{
"added": [
"\t",
"\tuseStream(column);",
"\t"
],
"header": "@@ -993,7 +1006,10 @@ public abstract class ResultSet implements java.sql.ResultSet,",
"removed": []
},
{
"added": [
" ",
"\tresetRowsetFlags();",
"\tunuseStreams();"
],
"header": "@@ -1571,7 +1587,9 @@ public abstract class ResultSet implements java.sql.ResultSet,",
"removed": [
" resetRowsetFlags();"
]
},
{
"added": [
"\tunuseStreams();",
"\t"
],
"header": "@@ -1602,7 +1620,8 @@ public abstract class ResultSet implements java.sql.ResultSet,",
"removed": [
""
]
},
{
"added": [
"\tunuseStreams();"
],
"header": "@@ -1642,6 +1661,7 @@ public abstract class ResultSet implements java.sql.ResultSet,",
"removed": []
},
{
"added": [
"\tunuseStreams();"
],
"header": "@@ -1687,6 +1707,7 @@ public abstract class ResultSet implements java.sql.ResultSet,",
"removed": []
},
{
"added": [
"\tunuseStreams();"
],
"header": "@@ -1785,6 +1806,7 @@ public abstract class ResultSet implements java.sql.ResultSet,",
"removed": []
},
{
"added": [
"\t",
"\tunuseStreams();"
],
"header": "@@ -1857,6 +1879,8 @@ public abstract class ResultSet implements java.sql.ResultSet,",
"removed": []
},
{
"added": [
"\t",
"\tunuseStreams();"
],
"header": "@@ -1970,6 +1994,8 @@ public abstract class ResultSet implements java.sql.ResultSet,",
"removed": []
},
{
"added": [
"\t",
"\t ",
"\t unuseStreams();",
"\t "
],
"header": "@@ -2617,10 +2643,14 @@ public abstract class ResultSet implements java.sql.ResultSet,",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java",
"hunks": [
{
"added": [
" ",
" private boolean[] streamUsedFlags;"
],
"header": "@@ -156,6 +156,8 @@ public abstract class EmbedResultSet extends ConnectionChild",
"removed": []
},
{
"added": [
"\t\t",
"\t\tinitStreamUseFlags(getMetaData().getColumnCount());"
],
"header": "@@ -205,6 +207,8 @@ public abstract class EmbedResultSet extends ConnectionChild",
"removed": []
},
{
"added": [
"\t\t\t",
"\t\t\tunuseStreams();",
"\t\t\t"
],
"header": "@@ -441,7 +445,9 @@ public abstract class EmbedResultSet extends ConnectionChild",
"removed": [
""
]
},
{
"added": [
"\t\t useStream(columnIndex);",
""
],
"header": "@@ -1043,6 +1049,8 @@ public abstract class EmbedResultSet extends ConnectionChild",
"removed": []
},
{
"added": [
"\t\t ",
"\t\t useStream(columnIndex);"
],
"header": "@@ -1150,6 +1158,8 @@ public abstract class EmbedResultSet extends ConnectionChild",
"removed": []
}
]
}
] |
derby-DERBY-721-947123bc
|
- DERBY-721 State of InputStream retrieved from resultset is not clean , if there exists previous InputStream - Patch by Tomohito Nakayama (tomonaka@basil.ocn.ne.jp)
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@349079 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/jdbc/BinaryToRawStream.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.types.Resetable;",
"import org.apache.derby.iapi.error.StandardException;"
],
"header": "@@ -21,6 +21,8 @@",
"removed": []
},
{
"added": [
"",
"\tIf source stream implements Resetable interface , ",
"\tthe source can be shared among other objects and ",
"\tnot closed when close method of this class was called.",
""
],
"header": "@@ -30,6 +32,11 @@ import java.io.EOFException;",
"removed": []
}
]
}
] |
derby-DERBY-721-ce0c6c47
|
- DERBY-721_2 State of Reader retrieved from resultset is not clean , if there exists previous Reader - Patch by Tomohito Nakayama (tomonaka@basil.ocn.ne.jp)
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@349718 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/jdbc/UTF8Reader.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.types.Resetable;",
"import org.apache.derby.iapi.error.StandardException;",
" ",
" *",
" * If source InputStream of this class is Resetable, close method of this class reset the source instead of close it,",
" * because the source InputStream can be shared.",
" *",
" */"
],
"header": "@@ -26,9 +26,16 @@ import java.io.IOException;",
"removed": [
"*/"
]
},
{
"added": [
"\tpublic void close() throws IOException"
],
"header": "@@ -140,7 +147,7 @@ public final class UTF8Reader extends Reader",
"removed": [
"\tpublic void close()"
]
}
]
}
] |
derby-DERBY-721-da10c02a
|
- rollback DERBY-721 and DERBY-721_2 because they will implicitly restrict spec of network driver. - Patch by Tomohito Nakayama (tomonaka@basil.ocn.ne.jp)
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@355437 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/jdbc/BinaryToRawStream.java",
"hunks": [
{
"added": [],
"header": "@@ -21,8 +21,6 @@",
"removed": [
"import org.apache.derby.iapi.types.Resetable;",
"import org.apache.derby.iapi.error.StandardException;"
]
},
{
"added": [],
"header": "@@ -32,11 +30,6 @@ import java.io.EOFException;",
"removed": [
"",
"\tIf source stream implements Resetable interface , ",
"\tthe source can be shared among other objects and ",
"\tnot closed when close method of this class was called.",
""
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/jdbc/UTF8Reader.java",
"hunks": [
{
"added": [
"*/"
],
"header": "@@ -26,16 +26,9 @@ import java.io.IOException;",
"removed": [
"import org.apache.derby.iapi.types.Resetable;",
"import org.apache.derby.iapi.error.StandardException;",
" ",
" *",
" * If source InputStream of this class is Resetable, close method of this class reset the source instead of close it,",
" * because the source InputStream can be shared.",
" *",
" */"
]
},
{
"added": [
"\tpublic void close()"
],
"header": "@@ -147,7 +140,7 @@ public final class UTF8Reader extends Reader",
"removed": [
"\tpublic void close() throws IOException"
]
}
]
}
] |
derby-DERBY-728-1451af79
|
DERBY-728 subtask DERBY-4757 (Client) Implement UTF8 support on DRDA
(partial) Consolidate references to CcsidManager to facilitate switch from EBCDIC to UTF8
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@987667 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/client/org/apache/derby/client/net/NetAgent.java",
"hunks": [
{
"added": [
" NetXAConnectionRequest netXAConnectionRequest_ = new NetXAConnectionRequest(this, netConnection_.commBufferSize_);"
],
"header": "@@ -192,7 +192,7 @@ public class NetAgent extends Agent {",
"removed": [
" NetXAConnectionRequest netXAConnectionRequest_ = new NetXAConnectionRequest(this, currentCcsidManager_, netConnection_.commBufferSize_);"
]
}
]
},
{
"file": "java/client/org/apache/derby/client/net/NetConnectionRequest.java",
"hunks": [
{
"added": [
" NetConnectionRequest(NetAgent netAgent, int bufferSize) {",
" super(netAgent, bufferSize);"
],
"header": "@@ -29,8 +29,8 @@ import org.apache.derby.client.am.ClientMessageId;",
"removed": [
" NetConnectionRequest(NetAgent netAgent, CcsidManager ccsidManager, int bufferSize) {",
" super(netAgent, ccsidManager, bufferSize);"
]
}
]
},
{
"file": "java/client/org/apache/derby/client/net/Reply.java",
"hunks": [
{
"added": [],
"header": "@@ -38,7 +38,6 @@ public class Reply {",
"removed": [
" private CcsidManager ccsidManager_;"
]
},
{
"added": [],
"header": "@@ -73,7 +72,6 @@ public class Reply {",
"removed": [
" ccsidManager_ = netAgent.getCurrentCcsidManager();"
]
},
{
"added": [
" String result = netAgent_.getCurrentCcsidManager()",
" .convertToJavaString(buffer_, pos_, length);"
],
"header": "@@ -668,7 +666,8 @@ public class Reply {",
"removed": [
" String result = ccsidManager_.convertToJavaString(buffer_, pos_, length);"
]
},
{
"added": [
" String result = netAgent_.getCurrentCcsidManager()",
" .convertToJavaString(buffer_, pos_, len);"
],
"header": "@@ -695,7 +694,8 @@ public class Reply {",
"removed": [
" String result = ccsidManager_.convertToJavaString(buffer_, pos_, len);"
]
}
]
},
{
"file": "java/client/org/apache/derby/client/net/Request.java",
"hunks": [
{
"added": [],
"header": "@@ -54,11 +54,6 @@ public class Request {",
"removed": [
" // the ccsid manager for the connection is stored in this object. it will",
" // be used when constructing character ddm data. it will NOT be used for",
" // building any FDOCA data.",
" protected CcsidManager ccsidManager_;",
""
]
},
{
"added": [
" Request(NetAgent netAgent, int minSize) {"
],
"header": "@@ -82,21 +77,12 @@ public class Request {",
"removed": [
" Request(NetAgent netAgent, int minSize, CcsidManager ccsidManager) {",
" ccsidManager_ = ccsidManager;",
" // construct a request object specifying the ccsid manager instance",
" // to be used when building ddm character data. This will also create",
" // a buffer using the default size (see final static DEFAULT_BUFFER_SIZE value).",
" Request(NetAgent netAgent, CcsidManager ccsidManager, int bufferSize) {",
" //this (netAgent, Request.DEFAULT_BUFFER_SIZE, ccsidManager);",
" this(netAgent, bufferSize, ccsidManager);",
" }",
""
]
},
{
"added": [],
"header": "@@ -115,13 +101,6 @@ public class Request {",
"removed": [
" // set the ccsid manager value. this method allows the ccsid manager to be",
" // changed so a request object can be reused by different connections with",
" // different ccsid managers.",
" final void setCcsidMgr(CcsidManager ccsidManager) {",
" ccsidManager_ = ccsidManager;",
" }",
""
]
},
{
"added": [
" int byteLengthLimit, String sqlState) throws SqlException {",
" ",
" /* Grab the current CCSID MGR from the NetAgent */ ",
" CcsidManager currentCcsidMgr = netAgent_.getCurrentCcsidManager();",
" ",
" int maxByteLength = currentCcsidMgr.getByteLength(string);",
""
],
"header": "@@ -1161,8 +1140,13 @@ public class Request {",
"removed": [
" int byteLengthLimit, String sqlState) throws SqlException { ",
" int maxByteLength = ccsidManager_.maxBytesPerChar() * string.length();"
]
},
{
"added": [
" offset_ = currentCcsidMgr.convertFromJavaString(string, bytes_, offset_, netAgent_);"
],
"header": "@@ -1171,7 +1155,7 @@ public class Request {",
"removed": [
" offset_ = ccsidManager_.convertFromJavaString(string, bytes_, offset_, netAgent_);"
]
},
{
"added": [
" bytes_[offset_++] = currentCcsidMgr.space_;"
],
"header": "@@ -1183,7 +1167,7 @@ public class Request {",
"removed": [
" bytes_[offset_++] = ccsidManager_.space_;"
]
},
{
"added": [
" ",
" /* Grab the current CCSID MGR from the NetAgent */ ",
" CcsidManager currentCcsidMgr = netAgent_.getCurrentCcsidManager();",
" ",
" int stringLength = currentCcsidMgr.getByteLength(string);",
" ",
" offset_ = currentCcsidMgr.convertFromJavaString(string, bytes_, offset_, netAgent_);",
" bytes_[offset_++] = currentCcsidMgr.space_;"
],
"header": "@@ -1207,11 +1191,16 @@ public class Request {",
"removed": [
" int stringLength = string.length();",
" offset_ = ccsidManager_.convertFromJavaString(string, bytes_, offset_, netAgent_);",
" bytes_[offset_++] = ccsidManager_.space_;"
]
},
{
"added": [
" netAgent_.getCurrentCcsidManager()",
" .convertFromJavaString(mask.toString(), bytes_, passwordStart_, netAgent_);"
],
"header": "@@ -1327,7 +1316,8 @@ public class Request {",
"removed": [
" ccsidManager_.convertFromJavaString(mask.toString(), bytes_, passwordStart_, netAgent_);"
]
}
]
},
{
"file": "java/drda/org/apache/derby/impl/drda/DRDAString.java",
"hunks": [
{
"added": [
" ",
" /** Keep the DDMWriter as it contains the current CCSID manager being used */",
" private final DDMWriter writer;"
],
"header": "@@ -31,8 +31,9 @@ package org.apache.derby.impl.drda;",
"removed": [
" /** Object used to convert byte buffer to string. */",
" private final CcsidManager ccsidManager;"
]
},
{
"added": [
" DRDAString(DDMWriter w) {",
" this.writer = w;"
],
"header": "@@ -47,9 +48,9 @@ final class DRDAString {",
"removed": [
" DRDAString(CcsidManager m) {",
" this.ccsidManager = m;"
]
},
{
"added": [
" writer.getCurrentCcsidManager().convertToJavaString(buffer);"
],
"header": "@@ -112,7 +113,7 @@ final class DRDAString {",
"removed": [
" ccsidManager.convertToJavaString(buffer);"
]
}
]
}
] |
derby-DERBY-728-802cd1c7
|
DERBY-728 Unable to create databases whose name containg Chinese characters through the client driver (partial)
Fix SanityManger usage to be wrapped in if (SanityManager.DEBUG) blocks.
Contrubuted by Tiago R. Espinha ( tiago dot derby at yahoo dot co dot uk )
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@959089 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/drda/org/apache/derby/impl/drda/Utf8CcsidManager.java",
"hunks": [
{
"added": [
" if (SanityManager.DEBUG) {",
" SanityManager.THROWASSERT(\"Could not convert Java String to byte[] in UTF-8\", e);",
" }"
],
"header": "@@ -49,7 +49,9 @@ public class Utf8CcsidManager extends CcsidManager {",
"removed": [
" SanityManager.THROWASSERT(\"Could not convert UCS2 (String) to UTF-8 (byte[])\", e);"
]
},
{
"added": [
" if (SanityManager.DEBUG) {",
" SanityManager.THROWASSERT(\"Could not convert byte[] to Java String using UTF-8 encoding\", e);",
" }"
],
"header": "@@ -58,7 +60,9 @@ public class Utf8CcsidManager extends CcsidManager {",
"removed": [
" SanityManager.THROWASSERT(\"Could not convert UCS2 (byte[]) to UTF-8 (String)\", e);"
]
},
{
"added": [
" if (SanityManager.DEBUG) {",
" SanityManager.THROWASSERT(\"Could not convert byte[] to Java String using UTF-8 encoding with offset\",e);",
" }"
],
"header": "@@ -67,7 +71,9 @@ public class Utf8CcsidManager extends CcsidManager {",
"removed": [
" SanityManager.THROWASSERT(\"Could not convert UCS2 (byte[]) to UTF-8 (String) with offset\",e);"
]
}
]
}
] |
derby-DERBY-728-cdfb2d18
|
DERBY-728 Unable to create databases whose name containg Chinese characters through the client driver
Incremental patches DERBY-728_p2.diff, DERBY-728_p2-test.diff
Add server side UTf8CcsidManager and unit test.
Change names of "convertXXXUCS2" methods to "convertXXXJavaString" for clarification.
UNICODEMGR level negotiation to use the the code has not yet been added.
contributed by Tiago R. Espinha tiago dot derby at yahoo dot co dot uk
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@957580 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/drda/org/apache/derby/impl/drda/CcsidManager.java",
"hunks": [
{
"added": [
" abstract byte[] convertFromJavaString (String sourceString);"
],
"header": "@@ -44,7 +44,7 @@ abstract class CcsidManager",
"removed": [
" abstract byte[] convertFromUCS2 (String sourceString);"
]
}
]
},
{
"file": "java/drda/org/apache/derby/impl/drda/DDMReader.java",
"hunks": [
{
"added": [
"\tprivate Utf8CcsidManager utf8CcsidManager;",
"\tprivate EbcdicCcsidManager ebcdicCcsidManager;"
],
"header": "@@ -109,6 +109,8 @@ class DDMReader",
"removed": []
},
{
"added": [
"\tDDMReader(InputStream inputStream)",
"\t\t"
],
"header": "@@ -175,11 +177,11 @@ class DDMReader",
"removed": [
"\tDDMReader(CcsidManager ccsidManager, InputStream inputStream)",
"\t\tthis.ccsidManager = ccsidManager;"
]
},
{
"added": [
"\t\tthis.utf8CcsidManager = new Utf8CcsidManager();",
" this.ebcdicCcsidManager = new EbcdicCcsidManager();",
" this.ccsidManager = ebcdicCcsidManager;"
],
"header": "@@ -202,9 +204,11 @@ class DDMReader",
"removed": [
"\t\t\tccsidManager = agent.ccsidManager;"
]
},
{
"added": [
"\t// Switch the ccsidManager to the UTF-8 instance",
" protected void setUtf8Ccsid() {",
" ccsidManager = utf8CcsidManager;",
" }",
" ",
" // Switch the ccsidManager to the EBCDIC instance",
" protected void setEbcdicCcsid() {",
" ccsidManager = ebcdicCcsidManager;",
" }",
" ",
" // Get the current ccsidManager",
" protected CcsidManager getCurrentCcsidManager() {",
" return ccsidManager;",
" }",
" "
],
"header": "@@ -218,6 +222,21 @@ class DDMReader",
"removed": []
},
{
"added": [
"\t\t\treturn ccsidManager.convertToJavaString(plainText);"
],
"header": "@@ -1378,7 +1397,7 @@ class DDMReader",
"removed": [
"\t\t\treturn ccsidManager.convertToUCS2(plainText);"
]
},
{
"added": [
"\t\tString result = ccsidManager.convertToJavaString(buffer, pos, length);"
],
"header": "@@ -1394,7 +1413,7 @@ class DDMReader",
"removed": [
"\t\tString result = ccsidManager.convertToUCS2 (buffer, pos, length);"
]
}
]
},
{
"file": "java/drda/org/apache/derby/impl/drda/DDMWriter.java",
"hunks": [
{
"added": [
"\t// CCSID manager for translation of strings in the protocol to UTF-8 and EBCDIC",
"\tprivate EbcdicCcsidManager ebcdicCcsidManager;",
"\tprivate Utf8CcsidManager utf8CcsidManager;",
"\t",
"\t// Current CCSID manager"
],
"header": "@@ -69,7 +69,11 @@ class DDMWriter",
"removed": [
"\t// CCSID manager for translation of strings in the protocol to EBCDIC"
]
},
{
"added": [
"\tDDMWriter (DRDAConnThread agent, DssTrace dssTrace)",
"\t // Create instances of the two ccsid managers and default to EBCDIC",
"\t this.ebcdicCcsidManager = new EbcdicCcsidManager();",
"\t this.utf8CcsidManager = new Utf8CcsidManager();",
"\t this.ccsidManager = this.ebcdicCcsidManager;",
"\t "
],
"header": "@@ -120,10 +124,14 @@ class DDMWriter",
"removed": [
"\tDDMWriter (CcsidManager ccsidManager, DRDAConnThread agent, DssTrace dssTrace)",
"\t\tthis.ccsidManager = ccsidManager;"
]
},
{
"added": [
"\t// Switch the ccsidManager to the UTF-8 instance",
"\tprotected void setUtf8Ccsid() {",
"\t ccsidManager = utf8CcsidManager;",
"\t}",
"\t",
"\t// Switch the ccsidManager to the EBCDIC instance",
"\tprotected void setEbcdicCcsid() {",
"\t ccsidManager = ebcdicCcsidManager;",
"\t}",
"\t",
"\t// Get the current ccsidManager",
"\tprotected CcsidManager getCurrentCcsidManager() {",
"\t return ccsidManager;",
"\t}",
"\t"
],
"header": "@@ -138,6 +146,21 @@ class DDMWriter",
"removed": []
},
{
"added": [
"\t\tccsidManager.convertFromJavaString(string, buffer);"
],
"header": "@@ -883,7 +906,7 @@ class DDMWriter",
"removed": [
"\t\tccsidManager.convertFromUCS2(string, buffer);"
]
},
{
"added": [
"\t\tccsidManager.convertFromJavaString(string, buffer);"
],
"header": "@@ -901,7 +924,7 @@ class DDMWriter",
"removed": [
"\t\tccsidManager.convertFromUCS2(string, buffer);"
]
}
]
},
{
"file": "java/drda/org/apache/derby/impl/drda/DRDAConnThread.java",
"hunks": [
{
"added": [],
"header": "@@ -102,7 +102,6 @@ class DRDAConnThread extends Thread {",
"removed": [
"\tprotected CcsidManager ccsidManager = new EbcdicCcsidManager();"
]
},
{
"added": [
"\tprivate DRDAString rdbnam = null;",
"\tprivate DRDAString rdbcolid = null;",
"\tprivate DRDAString pkgid = null;",
"\tprivate DRDAString pkgcnstkn = null;"
],
"header": "@@ -155,13 +154,13 @@ class DRDAConnThread extends Thread {",
"removed": [
"\tprivate DRDAString rdbnam = new DRDAString(ccsidManager);",
"\tprivate DRDAString rdbcolid = new DRDAString(ccsidManager);",
"\tprivate DRDAString pkgid = new DRDAString(ccsidManager);",
"\tprivate DRDAString pkgcnstkn = new DRDAString(ccsidManager);"
]
}
]
},
{
"file": "java/drda/org/apache/derby/impl/drda/EbcdicCcsidManager.java",
"hunks": [
{
"added": [
"\tbyte[] convertFromJavaString (String sourceString)",
"\t\tconvertFromJavaString(sourceString, buf);",
"\tvoid convertFromJavaString (String sourceString, ByteBuffer buffer)"
],
"header": "@@ -124,14 +124,14 @@ class EbcdicCcsidManager extends CcsidManager",
"removed": [
"\tbyte[] convertFromUCS2 (String sourceString)",
"\t\tconvertFromUCS2(sourceString, buf);",
"\tvoid convertFromUCS2 (String sourceString, ByteBuffer buffer)"
]
},
{
"added": [
"\tString convertToJavaString (byte[] sourceBytes)"
],
"header": "@@ -142,7 +142,7 @@ class EbcdicCcsidManager extends CcsidManager",
"removed": [
"\tString convertToUCS2 (byte[] sourceBytes)"
]
}
]
},
{
"file": "java/drda/org/apache/derby/impl/drda/TestProto.java",
"hunks": [
{
"added": [],
"header": "@@ -52,7 +52,6 @@ public class TestProto {",
"removed": [
"\tprivate\tstatic final CcsidManager ccsidManager = new EbcdicCcsidManager();"
]
},
{
"added": [
"\tprivate DDMWriter writer = new DDMWriter(null, null);"
],
"header": "@@ -124,7 +123,7 @@ public class TestProto {",
"removed": [
"\tprivate DDMWriter writer = new DDMWriter(ccsidManager, null, null);"
]
},
{
"added": [
"\t\t\treader = new DDMReader(monitorIs);"
],
"header": "@@ -140,7 +139,7 @@ public class TestProto {",
"removed": [
"\t\t\treader = new DDMReader(ccsidManager, monitorIs);"
]
},
{
"added": [
"\t\t\t\t\twriter.getCurrentCcsidManager().space);"
],
"header": "@@ -402,7 +401,7 @@ public class TestProto {",
"removed": [
"\t\t\t\t\tccsidManager.space);"
]
},
{
"added": [
"\t\t\t\t\twriter.padBytes(writer.getCurrentCcsidManager().space, ",
"\t\t\t\t\t reqLen-strLen);"
],
"header": "@@ -435,7 +434,8 @@ public class TestProto {",
"removed": [
"\t\t\t\t\twriter.padBytes(ccsidManager.space, reqLen-strLen);"
]
},
{
"added": [
"\t\t\treturn writer.getCurrentCcsidManager().convertFromJavaString(str);"
],
"header": "@@ -680,7 +680,7 @@ public class TestProto {",
"removed": [
"\t\t\treturn ccsidManager.convertFromUCS2(str);"
]
}
]
}
] |
derby-DERBY-728-df2ca5a3
|
DERBY-728 Unable to create databases whose name containg Chinese characters through the client driver
Small cleanup patch to add getters for short and regular datbase name.
Contributed by Tiago Espina (tiago dot derby at yahoo dot com )
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@953058 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/drda/org/apache/derby/impl/drda/DRDAConnThread.java",
"hunks": [
{
"added": [
"\t\t\treturn database.getDatabaseName();"
],
"header": "@@ -421,7 +421,7 @@ class DRDAConnThread extends Thread {",
"removed": [
"\t\t\treturn database.dbName;"
]
},
{
"added": [
" dbname = database.getDatabaseName();"
],
"header": "@@ -493,7 +493,7 @@ class DRDAConnThread extends Thread {",
"removed": [
" dbname = database.dbName;"
]
},
{
"added": [
"\t\t\tdbname = database.getDatabaseName();"
],
"header": "@@ -533,7 +533,7 @@ class DRDAConnThread extends Thread {",
"removed": [
"\t\t\tdbname = database.dbName;"
]
},
{
"added": [
"\t\twriteRDBNAM(database.getDatabaseName());"
],
"header": "@@ -1214,7 +1214,7 @@ class DRDAConnThread extends Thread {",
"removed": [
"\t\twriteRDBNAM(database.dbName);"
]
},
{
"added": [
"\t\tString realName = database.getDatabaseName(); //first strip off properties"
],
"header": "@@ -1345,7 +1345,7 @@ class DRDAConnThread extends Thread {",
"removed": [
"\t\tString realName = database.dbName; //first strip off properties"
]
},
{
"added": [
" (database.getDatabaseName().indexOf(Attribute.PASSWORD_ATTR) == -1))"
],
"header": "@@ -1386,7 +1386,7 @@ class DRDAConnThread extends Thread {",
"removed": [
" (database.dbName.indexOf(Attribute.PASSWORD_ATTR) == -1))"
]
},
{
"added": [
"\t \t\t\tprintln2Log(database.getDatabaseName(), session.drdaID, se.getMessage());"
],
"header": "@@ -1408,7 +1408,7 @@ class DRDAConnThread extends Thread {",
"removed": [
"\t \t\t\tprintln2Log(database.dbName, session.drdaID, se.getMessage());"
]
},
{
"added": [
"\t\t\tprintln2Log(database.getDatabaseName(), session.drdaID, "
],
"header": "@@ -1428,7 +1428,7 @@ class DRDAConnThread extends Thread {",
"removed": [
"\t\t\tprintln2Log(database.dbName, session.drdaID, "
]
},
{
"added": [
"\t\t\t\t\t\tprintln2Log(database.getDatabaseName(), session.drdaID, \"Failed attempt to reload driver \" +re.getMessage() );"
],
"header": "@@ -1442,7 +1442,7 @@ class DRDAConnThread extends Thread {",
"removed": [
"\t\t\t\t\t\tprintln2Log(database.dbName, session.drdaID, \"Failed attempt to reload driver \" +re.getMessage() );"
]
},
{
"added": [
"\t \t\tprintln2Log(database.getDatabaseName(), session.drdaID,",
"\t\t\t\t\t\tdatabase.getDatabaseName());"
],
"header": "@@ -1451,9 +1451,9 @@ class DRDAConnThread extends Thread {",
"removed": [
"\t \t\tprintln2Log(database.dbName, session.drdaID,",
"\t\t\t\t\t\tdatabase.dbName);"
]
},
{
"added": [
"\t\twriteRDBNAM(database.getDatabaseName());"
],
"header": "@@ -2262,7 +2262,7 @@ class DRDAConnThread extends Thread {",
"removed": [
"\t\twriteRDBNAM(database.dbName);"
]
},
{
"added": [
"\t\twriteRDBNAM(database.getDatabaseName());"
],
"header": "@@ -2281,7 +2281,7 @@ class DRDAConnThread extends Thread {",
"removed": [
"\t\twriteRDBNAM(database.dbName);"
]
},
{
"added": [
"\t\twriteRDBNAM(database.getDatabaseName());"
],
"header": "@@ -2300,7 +2300,7 @@ class DRDAConnThread extends Thread {",
"removed": [
"\t\twriteRDBNAM(database.dbName);"
]
},
{
"added": [
"\t\twriteRDBNAM(database.getDatabaseName());"
],
"header": "@@ -2849,7 +2849,7 @@ class DRDAConnThread extends Thread {",
"removed": [
"\t\twriteRDBNAM(database.dbName);"
]
},
{
"added": [
"\t\t\t\t\t\t\t println2Log(database.getDatabaseName(), session.drdaID,"
],
"header": "@@ -3039,7 +3039,7 @@ class DRDAConnThread extends Thread {",
"removed": [
"\t\t\t\t\t\t\t println2Log(database.dbName, session.drdaID,"
]
},
{
"added": [
" println2Log(database.getDatabaseName(), session.drdaID,"
],
"header": "@@ -3059,7 +3059,7 @@ class DRDAConnThread extends Thread {",
"removed": [
" println2Log(database.dbName, session.drdaID,"
]
},
{
"added": [
"\t\t\t\t\t\tif (database.getDatabaseName() == null) {",
"\t\t\t\t\t\telse if (!database.getDatabaseName().equals(dbname))"
],
"header": "@@ -3113,13 +3113,13 @@ class DRDAConnThread extends Thread {",
"removed": [
"\t\t\t\t\t\tif (database.dbName == null) {",
"\t\t\t\t\t\telse if (!database.dbName.equals(dbname))"
]
},
{
"added": [
"\t\tif (database == null || database.getDatabaseName() == null)"
],
"header": "@@ -3141,7 +3141,7 @@ class DRDAConnThread extends Thread {",
"removed": [
"\t\tif (database == null || database.dbName == null)"
]
},
{
"added": [
"\t\t\t\t\t\tif (!database.getDatabaseName().equals(dbname))"
],
"header": "@@ -3329,7 +3329,7 @@ class DRDAConnThread extends Thread {",
"removed": [
"\t\t\t\t\t\tif (!database.dbName.equals(dbname))"
]
},
{
"added": [
"\t\twriteRDBNAM(database.getDatabaseName());"
],
"header": "@@ -5389,7 +5389,7 @@ class DRDAConnThread extends Thread {",
"removed": [
"\t\twriteRDBNAM(database.dbName);"
]
},
{
"added": [
" if (!rdbnam.toString().equals(database.getDatabaseName()))"
],
"header": "@@ -5435,7 +5435,7 @@ class DRDAConnThread extends Thread {",
"removed": [
" if (!rdbnam.toString().equals(database.dbName))"
]
},
{
"added": [
" if (!rdbnam.toString().equals(database.getDatabaseName()))"
],
"header": "@@ -5480,7 +5480,7 @@ class DRDAConnThread extends Thread {",
"removed": [
" if (!rdbnam.toString().equals(database.dbName))"
]
},
{
"added": [
"\t\t\twriteRDBNAM(database.getDatabaseName());"
],
"header": "@@ -6266,7 +6266,7 @@ class DRDAConnThread extends Thread {",
"removed": [
"\t\t\twriteRDBNAM(database.dbName);"
]
},
{
"added": [
"\t\t\t\tdbname = database.getDatabaseName();"
],
"header": "@@ -6388,7 +6388,7 @@ class DRDAConnThread extends Thread {",
"removed": [
"\t\t\t\tdbname = database.dbName;"
]
},
{
"added": [
"\t\t\tdbname = database.getDatabaseName();"
],
"header": "@@ -8302,7 +8302,7 @@ class DRDAConnThread extends Thread {",
"removed": [
"\t\t\tdbname = database.dbName;"
]
},
{
"added": [
"\t\t\t\tdbname = database.getDatabaseName();"
],
"header": "@@ -8329,7 +8329,7 @@ class DRDAConnThread extends Thread {",
"removed": [
"\t\t\t\tdbname = database.dbName;"
]
},
{
"added": [
"\t\tif (database != null && database.getDatabaseName().equals(rdbnam))"
],
"header": "@@ -8563,7 +8563,7 @@ class DRDAConnThread extends Thread {",
"removed": [
"\t\tif (database != null && database.dbName.equals(rdbnam))"
]
}
]
},
{
"file": "java/drda/org/apache/derby/impl/drda/Database.java",
"hunks": [
{
"added": [
" /*",
" * Considering that we are now doing some fiddling with the db name",
" * it is probably wise to keep dbName and shortDbName private and have ",
" * accessors for them.",
" */",
"\tprivate String dbName;\t\t\t// database name ",
"\tprivate String shortDbName; // database name without attributes"
],
"header": "@@ -42,9 +42,13 @@ import org.apache.derby.iapi.services.sanity.SanityManager;",
"removed": [
"",
"\tprotected String dbName;\t\t\t// database name ",
"\tprotected String shortDbName; // database name without attributes"
]
}
]
},
{
"file": "java/drda/org/apache/derby/impl/drda/XADatabase.java",
"hunks": [
{
"added": [
"\t\txaDataSource.setDatabaseName(getShortDbName());"
],
"header": "@@ -71,7 +71,7 @@ class XADatabase extends Database {",
"removed": [
"\t\txaDataSource.setDatabaseName(shortDbName);"
]
}
]
}
] |
derby-DERBY-728-ffe112b1
|
DERBY-4009 (partial) Accommodate length delimited DRDA strings where character length does not equal byte length
Change client RDBNAM, USERID, and PASSWORD to allow for CcsidManager where the byte length might not equal the string length. Right now we just have EbcdicCcsidManager which has a maximum bytes per char as 1. But, this lays the groundwork for UTF8 which will be added later as part of DERBY-728
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@747881 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/client/org/apache/derby/client/net/NetConnectionRequest.java",
"hunks": [
{
"added": [
" ",
" writeScalarString(CodePoint.RDBNAM, rdbnam,",
" NetConfiguration.PKG_IDENTIFIER_FIXED_LEN, //minimum RDBNAM length in bytes",
" NetConfiguration.PKG_IDENTIFIER_MAX_LEN, //maximum RDBNAM length in bytes",
" SQLState.NET_DBNAME_TOO_LONG);",
" "
],
"header": "@@ -490,20 +490,12 @@ public class NetConnectionRequest extends Request implements ConnectionRequestIn",
"removed": [
" int rdbnamLength = rdbnam.length();",
" if (rdbnamLength <= NetConfiguration.PKG_IDENTIFIER_FIXED_LEN) {",
" writeScalarPaddedString(CodePoint.RDBNAM,",
" rdbnam,",
" NetConfiguration.PKG_IDENTIFIER_FIXED_LEN); // minimum length of RDBNAM",
" } else {",
" if (rdbnamLength <= NetConfiguration.PKG_IDENTIFIER_MAX_LEN) {",
" writeScalarString(CodePoint.RDBNAM, rdbnam);",
" } else {",
" throw new SqlException(netAgent_.logWriter_, ",
" new ClientMessageId(SQLState.NET_DBNAME_TOO_LONG), rdbnam);",
" }",
" //\"at SQLAM level \" + netAgent_.targetSqlam_);",
" }"
]
},
{
"added": [
" ",
" writeScalarString(CodePoint.USRID, usrid,0,NetConfiguration.USRID_MAXSIZE,",
" SQLState.NET_USERID_TOO_LONG);",
" if ((passwordLength == 0) ) {"
],
"header": "@@ -515,18 +507,14 @@ public class NetConnectionRequest extends Request implements ConnectionRequestIn",
"removed": [
" int usridLength = usrid.length();",
" if ((usridLength == 0) || (usridLength > NetConfiguration.USRID_MAXSIZE)) {",
" throw new SqlException(netAgent_.logWriter_, ",
" new ClientMessageId(SQLState.NET_USERID_TOO_LONG));",
" }",
"",
" writeScalarString(CodePoint.USRID, usrid);",
" if ((passwordLength == 0) || (passwordLength > NetConfiguration.PASSWORD_MAXSIZE)) {"
]
}
]
},
{
"file": "java/client/org/apache/derby/client/net/Request.java",
"hunks": [
{
"added": [
" /**",
" * Write string with no minimum or maximum limit.",
" * @param codePoint codepoint to write ",
" * @param string value to write",
" * @throws SqlException",
" */",
" writeScalarString(codePoint, string, 0,Integer.MAX_VALUE,null);",
" ",
" } ",
" ",
" /**",
" * insert a 4 byte length/codepoint pair plus ddm character data into",
" * the buffer. This method assumes that the String argument can be",
" * converted by the ccsid manager. This should be fine because usually",
" * there are restrictions on the characters which can be used for ddm",
" * character data. ",
" * The two byte length field will contain the length of the character data",
" * and the length of the 4 byte llcp. This method does not handle",
" * scenarios which require extended length bytes.",
" * ",
" * @param codePoint codepoint to write ",
" * @param string value",
" * @param byteMinLength minimum length. String will be padded with spaces ",
" * if value is too short. Assumes space character is one byte.",
" * @param byteLengthLimit Limit to string length. SQLException will be ",
" * thrown if we exceed this limit.",
" * @param sqlState SQLState to throw with string as param if byteLengthLimit",
" * is exceeded.",
" * @throws SqlException if string exceeds byteLengthLimit",
" */",
" final void writeScalarString(int codePoint, String string, int byteMinLength,",
" int byteLengthLimit, String sqlState) throws SqlException { ",
" int maxByteLength = ccsidManager_.maxBytesPerChar() * string.length();",
" ensureLength(offset_ + maxByteLength + 4);",
" // Skip length for now until we know actual length",
" int lengthOffset = offset_;",
" offset_ += 2;",
" ",
" ",
" ",
" int stringByteLength = offset_ - lengthOffset - 4;",
" // reset the buffer and throw an SQLException if the length is too long",
" if (stringByteLength > byteLengthLimit) {",
" offset_ = lengthOffset;",
" throw new SqlException(netAgent_.logWriter_, ",
" new ClientMessageId(sqlState), string);",
" // pad if we don't reach the byteMinLength limit",
" if (stringByteLength < byteMinLength) {",
" for (int i = stringByteLength ; i < byteMinLength; i++) {",
" bytes_[offset_++] = ccsidManager_.space_;",
" }",
" stringByteLength = byteMinLength;",
" }",
" // now write the length. We have the string byte length plus",
" // 4 bytes, 2 for length and 2 for codepoint.",
" int totalLength = stringByteLength + 4;",
" bytes_[lengthOffset] = (byte) ((totalLength >>> 8) & 0xff);",
" bytes_[lengthOffset + 1] = (byte) ((totalLength) & 0xff);",
" ",
""
],
"header": "@@ -1246,51 +1246,73 @@ public class Request {",
"removed": [
" // insert a 4 byte length/codepoint pair plus ddm character data into",
" // the buffer. This method assumes that the String argument can be",
" // converted by the ccsid manager. This should be fine because usually",
" // there are restrictions on the characters which can be used for ddm",
" // character data. This method also assumes that the string.length() will",
" // be the number of bytes following the conversion.",
" // The two byte length field will contain the length of the character data",
" // and the length of the 4 byte llcp. This method does not handle",
" // scenarios which require extended length bytes.",
" int stringLength = string.length();",
" ensureLength(offset_ + stringLength + 4);",
" bytes_[offset_++] = (byte) (((stringLength + 4) >>> 8) & 0xff);",
" bytes_[offset_++] = (byte) ((stringLength + 4) & 0xff);",
" bytes_[offset_++] = (byte) ((codePoint >>> 8) & 0xff);",
" bytes_[offset_++] = (byte) (codePoint & 0xff);",
" offset_ = ccsidManager_.convertFromUCS2(string, bytes_, offset_, netAgent_);",
" }",
"",
" // insert a 4 byte length/codepoint pair plus ddm character data into the",
" // buffer. The ddm character data is padded if needed with the ccsid manager's",
" // space character if the length of the character data is less than paddedLength.",
" // Note: this method is not to be used for String truncation and the string length",
" // must be <= paddedLength.",
" // This method assumes that the String argument can be",
" // converted by the ccsid manager. This should be fine because usually",
" // there are restrictions on the characters which can be used for ddm",
" // character data. This method also assumes that the string.length() will",
" // be the number of bytes following the conversion. The two byte length field",
" // of the llcp will contain the length of the character data including the pad",
" // and the length of the llcp or 4. This method will not handle extended length",
" // scenarios.",
" final void writeScalarPaddedString(int codePoint, String string, int paddedLength) throws SqlException {",
" int stringLength = string.length();",
" ensureLength(offset_ + paddedLength + 4);",
" bytes_[offset_++] = (byte) (((paddedLength + 4) >>> 8) & 0xff);",
" bytes_[offset_++] = (byte) ((paddedLength + 4) & 0xff);",
" for (int i = 0; i < paddedLength - stringLength; i++) {",
" bytes_[offset_++] = ccsidManager_.space_;"
]
}
]
}
] |
derby-DERBY-729-985f758e
|
DERBY-729 Scalar time and date functions return 0 instead NULL when argument is NULL. Submitted by Bernt M. Johnsen
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@451147 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/iapi/types/SQLDate.java",
"hunks": [
{
"added": [
" NumberDataValue nullValueInt() {",
" return new SQLInteger();",
" }",
"",
" ",
" throws StandardException",
" if (isNull()) {",
" return nullValueInt();",
" } else { ",
" return SQLDate.setSource(getYear(encodedDate), result);",
" }",
" }"
],
"header": "@@ -594,20 +594,25 @@ public final class SQLDate extends DataType",
"removed": [
"\t\t\t\t\t\t\tthrows StandardException",
"\t\tif (SanityManager.DEBUG)",
"\t\t{",
"\t\t\tSanityManager.ASSERT(!isNull(), \"getYear called on a null\");",
"\t\t}",
"\t\treturn SQLDate.setSource(getYear(encodedDate), result);",
"\t}"
]
},
{
"added": [
" if (isNull()) {",
" return nullValueInt();",
" } else {",
" return SQLDate.setSource(getMonth(encodedDate), result);",
" }"
],
"header": "@@ -617,11 +622,11 @@ public final class SQLDate extends DataType",
"removed": [
"\t\tif (SanityManager.DEBUG)",
"\t\t{",
"\t\t\tSanityManager.ASSERT(!isNull(), \"getMonth called on a null\");",
"\t\t}",
"\t\treturn SQLDate.setSource(getMonth(encodedDate), result);"
]
},
{
"added": [
" if (isNull()) {",
" return nullValueInt();",
" } else {",
" return SQLDate.setSource(getDay(encodedDate), result);",
" }"
],
"header": "@@ -632,11 +637,11 @@ public final class SQLDate extends DataType",
"removed": [
"\t\tif (SanityManager.DEBUG)",
"\t\t{",
"\t\t\tSanityManager.ASSERT(!isNull(), \"getDate called on a null\");",
"\t\t}",
"\t\treturn SQLDate.setSource(getDay(encodedDate), result);"
]
},
{
"added": [],
"header": "@@ -647,10 +652,6 @@ public final class SQLDate extends DataType",
"removed": [
"\t\tif (SanityManager.DEBUG)",
"\t\t{",
"\t\t\tSanityManager.ASSERT(!isNull(), \"getHours called on null.\");",
"\t\t}"
]
},
{
"added": [],
"header": "@@ -663,10 +664,6 @@ public final class SQLDate extends DataType",
"removed": [
"\t\tif (SanityManager.DEBUG)",
"\t\t{",
"\t\t\tSanityManager.ASSERT(!isNull(), \"getMinutes called on null.\");",
"\t\t}"
]
}
]
},
{
"file": "java/engine/org/apache/derby/iapi/types/SQLTime.java",
"hunks": [
{
"added": [
" NumberDataValue nullValueInt() {",
" return new SQLInteger();",
" }",
""
],
"header": "@@ -656,6 +656,10 @@ public final class SQLTime extends DataType",
"removed": []
},
{
"added": [],
"header": "@@ -664,10 +668,6 @@ public final class SQLTime extends DataType",
"removed": [
"\t\tif (SanityManager.DEBUG)",
"\t\t{",
"\t\t\tSanityManager.ASSERT(!isNull(), \"getYear called on null.\");",
"\t\t}"
]
},
{
"added": [],
"header": "@@ -680,10 +680,6 @@ public final class SQLTime extends DataType",
"removed": [
"\t\tif (SanityManager.DEBUG)",
"\t\t{",
"\t\t\tSanityManager.ASSERT(!isNull(), \"getMonth called on null.\");",
"\t\t}"
]
},
{
"added": [],
"header": "@@ -696,10 +692,6 @@ public final class SQLTime extends DataType",
"removed": [
"\t\tif (SanityManager.DEBUG)",
"\t\t{",
"\t\t\tSanityManager.ASSERT(!isNull(), \"getDate called on null.\");",
"\t\t}"
]
},
{
"added": [
" if (isNull()) {",
" return nullValueInt();",
" } else { ",
" return SQLDate.setSource(getHour(encodedTime), result);",
" }"
],
"header": "@@ -712,11 +704,11 @@ public final class SQLTime extends DataType",
"removed": [
"\t\tif (SanityManager.DEBUG)",
"\t\t{",
"\t\t\tSanityManager.ASSERT(!isNull(), \"getHours called on null\");",
"\t\t}",
"\t\treturn SQLDate.setSource(getHour(encodedTime), result);"
]
},
{
"added": [
" if (isNull()) {",
" return nullValueInt();",
" } else { ",
" return SQLDate.setSource(getMinute(encodedTime), result);",
" }"
],
"header": "@@ -727,11 +719,11 @@ public final class SQLTime extends DataType",
"removed": [
"\t\tif (SanityManager.DEBUG)",
"\t\t{",
"\t\t\tSanityManager.ASSERT(!isNull(), \"getMinutes called on null\");",
"\t\t}",
"\t\treturn SQLDate.setSource(getMinute(encodedTime), result);"
]
}
]
},
{
"file": "java/engine/org/apache/derby/iapi/types/SQLTimestamp.java",
"hunks": [
{
"added": [
" NumberDataValue nullValueInt() {",
" return new SQLInteger();",
" }",
"",
" NumberDataValue nullValueDouble() {",
" return new SQLDouble();",
" }"
],
"header": "@@ -729,6 +729,13 @@ public final class SQLTimestamp extends DataType",
"removed": []
},
{
"added": [
" if (isNull()) {",
" return nullValueInt();",
" } else { ",
" return SQLDate.setSource(SQLDate.getYear(encodedDate), result);",
" }"
],
"header": "@@ -738,11 +745,11 @@ public final class SQLTimestamp extends DataType",
"removed": [
"\t\tif (SanityManager.DEBUG)",
"\t\t{",
"\t\t\tSanityManager.ASSERT(!isNull(), \"getYear called on a null\");",
"\t\t}",
"\t\treturn SQLDate.setSource(SQLDate.getYear(encodedDate), result);"
]
},
{
"added": [
" if (isNull()) {",
" return nullValueInt();",
" } else { ",
" return SQLDate.setSource(SQLDate.getMonth(encodedDate), result);",
" }"
],
"header": "@@ -753,11 +760,11 @@ public final class SQLTimestamp extends DataType",
"removed": [
"\t\tif (SanityManager.DEBUG)",
"\t\t{",
"\t\t\tSanityManager.ASSERT(!isNull(), \"getMonth called on a null\");",
"\t\t}",
"\t\treturn SQLDate.setSource(SQLDate.getMonth(encodedDate), result);"
]
},
{
"added": [
" if (isNull()) {",
" return nullValueInt();",
" } else { ",
" return SQLDate.setSource(SQLDate.getDay(encodedDate), result);",
" }"
],
"header": "@@ -768,11 +775,11 @@ public final class SQLTimestamp extends DataType",
"removed": [
"\t\tif (SanityManager.DEBUG)",
"\t\t{",
"\t\t\tSanityManager.ASSERT(!isNull(), \"getDate called on a null\");",
"\t\t}",
"\t\treturn SQLDate.setSource(SQLDate.getDay(encodedDate), result);"
]
},
{
"added": [
" if (isNull()) {",
" return nullValueInt();",
" } else { ",
" return SQLDate.setSource(SQLTime.getHour(encodedTime), result);",
" }"
],
"header": "@@ -783,11 +790,11 @@ public final class SQLTimestamp extends DataType",
"removed": [
"\t\tif (SanityManager.DEBUG)",
"\t\t{",
"\t\t\tSanityManager.ASSERT(!isNull(), \"getHours called on a null\");",
"\t\t}",
"\t\treturn SQLDate.setSource(SQLTime.getHour(encodedTime), result);"
]
},
{
"added": [
" if (isNull()) {",
" return nullValueInt();",
" } else { ",
" return SQLDate.setSource(SQLTime.getMinute(encodedTime), result);",
" }"
],
"header": "@@ -798,11 +805,11 @@ public final class SQLTimestamp extends DataType",
"removed": [
"\t\tif (SanityManager.DEBUG)",
"\t\t{",
"\t\t\tSanityManager.ASSERT(!isNull(), \"getMinute called on a null\");",
"\t\t}",
"\t\treturn SQLDate.setSource(SQLTime.getMinute(encodedTime), result);"
]
}
]
}
] |
derby-DERBY-733-9008adea
|
DERBY-733, committed on behalf of Knut Anders Hatlen.
Attached patch (DERBY-733-more-exception-handling.diff) that addresses
Mike's concerns for exception handling. If something goes wrong when
locking, Derby will now fall back to the old behaviour.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@357275 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/store/raw/data/RAFContainer.java",
"hunks": [
{
"added": [
"\t\t\t\t// couldn't construct the lock, fall back to old behaviour",
"",
"\t\t\t\thasJava5FairLocks = false;"
],
"header": "@@ -148,6 +148,9 @@ class RAFContainer extends FileContainer implements PrivilegedExceptionAction",
"removed": []
},
{
"added": [
"\t\t\t\t// Something bad happened while trying to lock the",
"\t\t\t\t// region. Since the locking is not required for",
"\t\t\t\t// anything other than ensuring fairness, it is ok to",
"\t\t\t\t// fall back to pre-1.5 behaviour.",
"\t\t\t\thasJava5FairLocks = false;"
],
"header": "@@ -286,6 +289,11 @@ class RAFContainer extends FileContainer implements PrivilegedExceptionAction",
"removed": []
},
{
"added": [
"\t\t\t\t\t// An error occurred while unlocking the",
"\t\t\t\t\t// region. The region might still be locked, so",
"\t\t\t\t\t// we'd better stop using this kind of",
"\t\t\t\t\t// locking. There will be no loss of",
"\t\t\t\t\t// functionality, only a possible loss of",
"\t\t\t\t\t// fairness.",
"\t\t\t\t\thasJava5FairLocks = false;"
],
"header": "@@ -308,6 +316,13 @@ class RAFContainer extends FileContainer implements PrivilegedExceptionAction",
"removed": []
}
]
}
] |
derby-DERBY-733-a2f90d4f
|
Fix for DERBY-733. Committed on behalf of Knut Anders Hatlen.
I have attached a patch which invokes ReentrantLock.lock() and
unlock() when reading in a page from disk. I did not build my own
ReentrantLock replacement, as I said I would. Instead, I have used
reflection to enable this feature if the JVM supports it. This seemed
like an easier approach, and I also discovered that the handling of
threads waiting for monitors had changed between 1.4 and 1.5 and that
this issue was not so serious on 1.4.
The maximum response time was drastically reduced in the disk-bound
case. Derbyall ran successfully on both Sun JVM 1.4.2 and 1.5.0. I
have also tested the performance, and I could not see any change in
throughput or CPU usage. (The performance test was run with a very
small page cache and with a database that was many times bigger than
the page cache, but smaller than the file system cache. This way,
Derby called readPage() very often, but it was CPU-bound since the
requested page always was in the file system cache.)
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@356884 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/store/raw/data/RAFContainer.java",
"hunks": [
{
"added": [
"import java.lang.reflect.Method;",
"import java.lang.reflect.Constructor;"
],
"header": "@@ -54,6 +54,8 @@ import java.io.RandomAccessFile;",
"removed": []
},
{
"added": [
"\t/* Fields with references to classes and methods in ReentrantLock",
"\t * introduced in Java 1.5. Reflection is used to only use these",
" * interfaces if they exist.",
" * ",
" */",
"\tprivate static Class fairLockClass;",
"\tprivate static Constructor fairLockConstructor;",
"\tprivate static Method lock;",
"\tprivate static Method unlock;",
"\tprivate static boolean hasJava5FairLocks = false;",
"",
"\t// Use reflection to find the constructor, lock() and unlock() in",
"\t// java.util.concurrent.locks.ReentrantLock. If the class and its",
"\t// methods are found, hasJava5FairLocks will be true and fair",
"\t// locking can be used.",
"\tstatic {",
"\t\ttry {",
"\t\t\tfairLockClass = ",
" Class.forName(\"java.util.concurrent.locks.ReentrantLock\");",
"",
"\t\t\tfairLockConstructor = ",
" fairLockClass.getConstructor(new Class[] { Boolean.TYPE });",
"",
"\t\t\tlock = fairLockClass.getMethod(\"lock\", new Class[0]);",
"\t\t\tunlock = fairLockClass.getMethod(\"unlock\", new Class[0]);",
"\t\t\thasJava5FairLocks = true;",
"\t\t}",
"\t\tcatch (NoSuchMethodException nsme) {}",
"\t\tcatch (ClassNotFoundException cnfe) {}",
"\t}",
"",
"\t/**",
"\t * Object of type java.util.concurrent.locks.ReentrantLock. It is",
"\t * used to prevent starvation when many threads are reading from",
"\t * the same file.",
"\t */",
"\tprivate Object fairLock;"
],
"header": "@@ -93,6 +95,43 @@ class RAFContainer extends FileContainer implements PrivilegedExceptionAction",
"removed": []
},
{
"added": [
"",
"\t\t// If Java 1.5 fair locks are available, construct one.",
"\t\tif (hasJava5FairLocks) {",
"\t\t\ttry {",
"\t\t\t\t// construct a lock with fairness set to true",
"\t\t\t\tfairLock = ",
" fairLockConstructor.newInstance(",
" new Object[] { Boolean.TRUE });",
"\t\t\t} catch (Exception e) {",
"\t\t\t\tif (SanityManager.DEBUG) {",
"\t\t\t\t\tSanityManager.THROWASSERT(",
" \"failed constructing ReentrantLock\", e);",
"\t\t\t\t}",
"\t\t\t}",
"\t\t}"
],
"header": "@@ -100,6 +139,21 @@ class RAFContainer extends FileContainer implements PrivilegedExceptionAction",
"removed": []
},
{
"added": [
"\t\t// Use Java 1.5 fair locks if they are available.",
"\t\tif (hasJava5FairLocks) {",
"\t\t\ttry {",
"\t\t\t\tlock.invoke(fairLock, null);",
"\t\t\t} catch (Exception e) {",
"\t\t\t\tif (SanityManager.DEBUG) {",
"\t\t\t\t\tSanityManager.THROWASSERT(",
" \"failed invoking ReentrantLock.lock()\", e);",
"\t\t\t\t}",
"\t\t\t}",
"\t\t}",
"\t\ttry {",
"\t\t\t// Starvation might occur at this point if many threads",
"\t\t\t// are waiting for the monitor. This section is therefore",
"\t\t\t// surrounded by calls to ReentrantLock.lock()/unlock() if",
"\t\t\t// we are running Java 1.5 or higher.",
"\t\t\tsynchronized (this) {",
"\t\t\t\tfileData.seek(pageOffset);",
"\t\t\t\tfileData.readFully(pageData, 0, pageSize);",
"\t\t\t}",
"\t\t} finally {",
"\t\t\t// Unlock this section.",
"\t\t\tif (hasJava5FairLocks) {",
"\t\t\t\ttry {",
"\t\t\t\t\tunlock.invoke(fairLock, null);",
"\t\t\t\t} catch (Exception e) {",
"\t\t\t\t\tif (SanityManager.DEBUG) {",
"\t\t\t\t\t\tSanityManager.THROWASSERT(",
" \"failed invoking ReentrantLock.unlock()\", e);",
"\t\t\t\t\t}",
"\t\t\t\t}",
"\t\t\t}"
],
"header": "@@ -227,11 +281,39 @@ class RAFContainer extends FileContainer implements PrivilegedExceptionAction",
"removed": [
"\t\tsynchronized (this) {",
"",
"\t\t\tfileData.seek(pageOffset);",
"\t\t\tfileData.readFully(pageData, 0, pageSize);"
]
}
]
}
] |
derby-DERBY-733-f0cd4bf3
|
DERBY-801 (partial) Allow parallel access to data files
Backing out the patch for DERBY-733 as it is not needed anymore and
the code is cleaner without it.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@447856 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/store/raw/data/RAFContainer.java",
"hunks": [
{
"added": [],
"header": "@@ -55,8 +55,6 @@ import java.io.RandomAccessFile;",
"removed": [
"import java.lang.reflect.Method;",
"import java.lang.reflect.Constructor;"
]
},
{
"added": [],
"header": "@@ -97,43 +95,6 @@ class RAFContainer extends FileContainer implements PrivilegedExceptionAction",
"removed": [
"\t/* Fields with references to classes and methods in ReentrantLock",
"\t * introduced in Java 1.5. Reflection is used to only use these",
" * interfaces if they exist.",
" * ",
" */",
"\tprivate static Class fairLockClass;",
"\tprivate static Constructor fairLockConstructor;",
"\tprivate static Method lock;",
"\tprivate static Method unlock;",
"\tprivate static boolean hasJava5FairLocks = false;",
"",
"\t// Use reflection to find the constructor, lock() and unlock() in",
"\t// java.util.concurrent.locks.ReentrantLock. If the class and its",
"\t// methods are found, hasJava5FairLocks will be true and fair",
"\t// locking can be used.",
"\tstatic {",
"\t\ttry {",
"\t\t\tfairLockClass = ",
" Class.forName(\"java.util.concurrent.locks.ReentrantLock\");",
"",
"\t\t\tfairLockConstructor = ",
" fairLockClass.getConstructor(new Class[] { Boolean.TYPE });",
"",
"\t\t\tlock = fairLockClass.getMethod(\"lock\", new Class[0]);",
"\t\t\tunlock = fairLockClass.getMethod(\"unlock\", new Class[0]);",
"\t\t\thasJava5FairLocks = true;",
"\t\t}",
"\t\tcatch (NoSuchMethodException nsme) {}",
"\t\tcatch (ClassNotFoundException cnfe) {}",
"\t}",
"",
"\t/**",
"\t * Object of type java.util.concurrent.locks.ReentrantLock. It is",
"\t * used to prevent starvation when many threads are reading from",
"\t * the same file.",
"\t */",
"\tprivate Object fairLock;"
]
},
{
"added": [],
"header": "@@ -141,24 +102,6 @@ class RAFContainer extends FileContainer implements PrivilegedExceptionAction",
"removed": [
"",
"\t\t// If Java 1.5 fair locks are available, construct one.",
"\t\tif (hasJava5FairLocks) {",
"\t\t\ttry {",
"\t\t\t\t// construct a lock with fairness set to true",
"\t\t\t\tfairLock = ",
" fairLockConstructor.newInstance(",
" new Object[] { Boolean.TRUE });",
"\t\t\t} catch (Exception e) {",
"\t\t\t\t// couldn't construct the lock, fall back to old behaviour",
"",
"\t\t\t\thasJava5FairLocks = false;",
"\t\t\t\tif (SanityManager.DEBUG) {",
"\t\t\t\t\tSanityManager.THROWASSERT(",
" \"failed constructing ReentrantLock\", e);",
"\t\t\t\t}",
"\t\t\t}",
"\t\t}"
]
},
{
"added": [
"\t\tsynchronized (this) {",
"\t\t\tfileData.seek(pageOffset);",
"",
"\t\t\tfileData.readFully(pageData, 0, pageSize);"
],
"header": "@@ -286,51 +229,11 @@ class RAFContainer extends FileContainer implements PrivilegedExceptionAction",
"removed": [
"\t\t// Use Java 1.5 fair locks if they are available.",
"\t\tif (hasJava5FairLocks) {",
"\t\t\ttry {",
"\t\t\t\tlock.invoke(fairLock, null);",
"\t\t\t} catch (Exception e) {",
"\t\t\t\t// Something bad happened while trying to lock the",
"\t\t\t\t// region. Since the locking is not required for",
"\t\t\t\t// anything other than ensuring fairness, it is ok to",
"\t\t\t\t// fall back to pre-1.5 behaviour.",
"\t\t\t\thasJava5FairLocks = false;",
"\t\t\t\tif (SanityManager.DEBUG) {",
"\t\t\t\t\tSanityManager.THROWASSERT(",
" \"failed invoking ReentrantLock.lock()\", e);",
"\t\t\t\t}",
"\t\t\t}",
"\t\t}",
"\t\ttry {",
"\t\t\t// Starvation might occur at this point if many threads",
"\t\t\t// are waiting for the monitor. This section is therefore",
"\t\t\t// surrounded by calls to ReentrantLock.lock()/unlock() if",
"\t\t\t// we are running Java 1.5 or higher.",
"\t\t\tsynchronized (this) {",
"\t\t\t\tfileData.seek(pageOffset);",
"\t\t\t\tfileData.readFully(pageData, 0, pageSize);",
"\t\t\t}",
"\t\t} finally {",
"\t\t\t// Unlock this section.",
"\t\t\tif (hasJava5FairLocks) {",
"\t\t\t\ttry {",
"\t\t\t\t\tunlock.invoke(fairLock, null);",
"\t\t\t\t} catch (Exception e) {",
"\t\t\t\t\t// An error occurred while unlocking the",
"\t\t\t\t\t// region. The region might still be locked, so",
"\t\t\t\t\t// we'd better stop using this kind of",
"\t\t\t\t\t// locking. There will be no loss of",
"\t\t\t\t\t// functionality, only a possible loss of",
"\t\t\t\t\t// fairness.",
"\t\t\t\t\thasJava5FairLocks = false;",
"\t\t\t\t\tif (SanityManager.DEBUG) {",
"\t\t\t\t\t\tSanityManager.THROWASSERT(",
" \"failed invoking ReentrantLock.unlock()\", e);",
"\t\t\t\t\t}",
"\t\t\t\t}",
"\t\t\t}"
]
}
]
}
] |
derby-DERBY-737-da67b78a
|
DERBY-737: SYSCS_UTIL.SYSCS_COMPRESS_TABLE should create statistics
This patch was contributed by Mamta A. Satoor (msatoor@gmail.com)
The changes have been very localized in
AlterTableConstantAction.java!updateIndex(). Currently, this method checks
if statistics already exist for an index. If yes, then it sets a flag
updateStatistics to true. Later, the code checks for this flag and drops
the existing statistics and creates new statistics for that index provided
the user table at this point is not empty. So, as we can see, if there is
an index with no preexisting statistics, the flag updateStatistics will be
set to false and hence no statistics related code is executed and hence
even though the user table is not empty at the time of compress, no
statistics get generated for such an index.
I am proposing to fix the problem by still using the flag to see if
an index has pre-existing statistics. If yes, then we should drop
those statistics. Next, whether the index has pre-existing statistics or
not, go ahead and create new statistics for the index provided the
user table is not currently empty.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@464551 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/iapi/db/OnlineCompress.java",
"hunks": [
{
"added": [
" // key column in base row. All offsets are 0 "
],
"header": "@@ -334,7 +334,7 @@ public class OnlineCompress",
"removed": [
" // key collumn in base row. All offsets are 0 "
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/execute/AlterTableConstantAction.java",
"hunks": [
{
"added": [
"\t\t\t\tcCount = new CardinalityCounter(tc.openSortRowSource(sortIds[index]));"
],
"header": "@@ -1574,7 +1574,7 @@ class AlterTableConstantAction extends DDLSingleTableConstantAction",
"removed": [
"\t\t\t\tcCount = tc.openSortRowSource(sortIds[index]);"
]
},
{
"added": [
"\t\t\t//For an index, if the statistics already exist, then drop them.",
"\t\t\t//The statistics might not exist for an index if the index was",
"\t\t\t//created when the table was empty.",
"\t\t\t//At ALTER TABLE COMPRESS time, for both kinds of indexes ",
"\t\t\t//(ie one with preexisting statistics and with no statistics), ",
"\t\t\t//create statistics for them if the table is not empty. ",
"\t\t\t//DERBY-737 \"SYSCS_UTIL.SYSCS_COMPRESS_TABLE should create",
"\t\t\t//statistics if they do not exist\"",
"\t\t\tif (updateStatistics)",
"\t\t\t\tdd.dropStatisticsDescriptors(td.getUUID(), cd.getUUID(), tc);",
"\t\t\t",
"\t\t\tlong numRows;",
"\t\t\tif ((numRows = ((CardinalityCounter)cCount).getRowCount()) > 0)",
"\t\t\t{",
"\t\t\t\tlong[] c = ((CardinalityCounter)cCount).getCardinality();",
"\t\t\t\tfor (int i = 0; i < c.length; i++)",
"\t\t\t\t{",
"\t\t\t\t\tStatisticsDescriptor statDesc =",
"\t\t\t\t\t\tnew StatisticsDescriptor(dd, dd.getUUIDFactory().createUUID(),",
"\t\t\t\t\t\t\t\tcd.getUUID(), td.getUUID(), \"I\", new StatisticsImpl(numRows, c[i]),",
"\t\t\t\t\t\t\t\ti + 1);",
"\t\t\t\t\tdd.addDescriptor(statDesc, null, // no parent descriptor",
"\t\t\t\t\t\t\tDataDictionary.SYSSTATISTICS_CATALOG_NUM,",
"\t\t\t\t\t\t\ttrue, tc);\t// no error on duplicate.",
"\t\t\t\t}",
"\t\t\t}"
],
"header": "@@ -1585,6 +1585,32 @@ class AlterTableConstantAction extends DDLSingleTableConstantAction",
"removed": []
},
{
"added": [],
"header": "@@ -1601,26 +1627,6 @@ class AlterTableConstantAction extends DDLSingleTableConstantAction",
"removed": [
"\t\tif (updateStatistics)",
"\t\t{",
"\t\t\tdd.dropStatisticsDescriptors(td.getUUID(), cd.getUUID(), tc);",
"\t\t\tlong numRows;",
"\t\t\tif ((numRows = ((CardinalityCounter)cCount).getRowCount()) > 0)",
"\t\t\t{",
"\t\t\t\tlong[] c = ((CardinalityCounter)cCount).getCardinality();",
"\t\t\t\tfor (int i = 0; i < c.length; i++)",
"\t\t\t\t{",
"\t\t\t\t\tStatisticsDescriptor statDesc = ",
"\t\t\t\t\t\tnew StatisticsDescriptor(dd, dd.getUUIDFactory().createUUID(),",
"\t\t\t\t\t\t\t\t\t\t\t\t\tcd.getUUID(), td.getUUID(), \"I\", new StatisticsImpl(numRows, c[i]),",
"\t\t\t\t\t\t\t\t\t\t\t\t\ti + 1);",
"\t\t\t\t\tdd.addDescriptor(statDesc, null, // no parent descriptor",
"\t\t\t\t\t\t\t\t\t DataDictionary.SYSSTATISTICS_CATALOG_NUM,",
"\t\t\t\t\t\t\t\t\t true, tc);\t// no error on duplicate.",
"\t\t\t\t}",
"\t\t\t}",
"\t\t}",
""
]
}
]
}
] |
derby-DERBY-750-7e95befd
|
DERBY-750, committing on behalf of Suresh Thalamati.
By looking at the stacks, my suspicion is backup is looking at a table that
is not completely created yet, container file might be there but the
first page (Alloc page) might have been created.
It might take some time for me to fix this one. As a temporary solution,
attached patch comments out the section of the test that might be hitting this
problem.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@357272 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.