id
stringlengths
22
25
commit_message
stringlengths
137
6.96k
diffs
listlengths
0
63
derby-DERBY-2991-d4333738
DERBY-2991: Index split deadlock Added more test cases for BTreeForwardScan.fetchRows(). git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@746273 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2991-ebf2f360
DERBY-2991: Added a JUnit performance test for index scans git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@729039 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2991-f487e071
DERBY-2991: Index split deadlock Added more test cases for BTreeForwardScan.fetchRows() where the current leaf page was split while the index scan was waiting for a row lock. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@746954 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2992-8f01b3ce
DERBY-2992: getBinaryStream returns incorrect result (truncated value) if underlying blob is deleted Made OverflowInputStream throw exception if the underlying value is deleted/modified. (i.e. if the next overflow page cannot be found/accessed). Added a new error message (D015). Incorporated repro (originally contributed by Kathey Marsden, kmarsdenderby at sbcglobal dot net). Patch file: derby-2992-1b-throw_exception_on_eof.diff git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@908586 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/store/raw/data/OverflowInputStream.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.services.i18n.MessageService;" ], "header": "@@ -25,6 +25,7 @@ import org.apache.derby.iapi.error.StandardException;", "removed": [] }, { "added": [ "import org.apache.derby.shared.common.reference.MessageId;", "", "import java.io.EOFException;" ], "header": "@@ -33,6 +34,9 @@ import org.apache.derby.iapi.types.Resetable;", "removed": [] } ] } ]
derby-DERBY-3-a8db6658
DERBY-4442: Default value and identity in an INSERT result set evaluated too early Always add a ProjectRestrictNode on top of the source result set for an insert if the source columns are not ordered the same way as the target columns, or if inserting into a subset of the columns, and the source is not a table constructor. Then the adding of default values to the source result column list happens on top of the original source result node, and not inside that node. This means that the source result is produced before the default values are added, and the generation of the defaults happens at the correct time. As a side-effect, these other issues are fixed: DERBY-3 Identity column not filled consecutively with "insert ... select distinct" DERBY-4433 Cannot insert from EXCEPT/INTERSECT when target table has more columns than the source Much of the added code is actually old code revived from the Subversion history. Before DERBY-1644, we used to put a ProjectRestrictNode on top of the source result if it was a SetOperatorNode. The code that inserted the ProjectRestrictNode was added back and changed to operate on ResultSetNode instead of SetOperatorNode. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@885421 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/compile/InsertNode.java", "hunks": [ { "added": [ "\t\tresultSet = enhanceAndCheckForAutoincrement(resultSet, inOrder, colMap);" ], "header": "@@ -411,9 +411,7 @@ public final class InsertNode extends DMLModStatementNode", "removed": [ "\t\tenhanceAndCheckForAutoincrement(resultSet, inOrder,", "\t\t\t\tnumTableColumns, colMap, dataDictionary,", " targetTableDescriptor, targetVTI );" ] }, { "added": [ "\t * @return a node representing the source for the insert", "\tResultSetNode enhanceAndCheckForAutoincrement(", "\t\t\tResultSetNode resultSet, boolean inOrder, int[] colMap)" ], "header": "@@ -529,19 +527,13 @@ public final class InsertNode extends DMLModStatementNode", "removed": [ "\t * @param numTableColumns # of columns in target RCL", "\t * @param dataDictionary DataDictionary to use", "\t * @param targetTableDescriptor Table Descriptor for target", "\t * @param targetVTI Target description if it is a VTI", "\tprivate void enhanceAndCheckForAutoincrement(ResultSetNode resultSet, ", "\t\t\tboolean inOrder, int numTableColumns, int []colMap, ", "\t\t\tDataDictionary dataDictionary,", "\t\t\tTableDescriptor targetTableDescriptor,", " FromVTI targetVTI)" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/ResultSetNode.java", "hunks": [ { "added": [ "\t * we will add a ProjectRestrictNode on top of the source with an RCL that", "\t * @param target the target node for the insert", "\t * @param inOrder are source cols in same order as target cols?", "\t * @return a node that replaces this node and whose RCL matches the target", "\t * RCL. May return this node if no changes to the RCL are needed, or if the", "\t * RCL is modified in-place.", "\tResultSetNode enhanceRCLForInsert(", "\t\t\tInsertNode target, boolean inOrder, int[] colMap)", "\t\tthrows StandardException", "\t{", "\t\tif (!inOrder || resultColumns.size() < target.resultColumnList.size()) {", "\t\t\treturn generateProjectRestrictForInsert(target, colMap);", "\t\t}", "\t\treturn this;", "\t}", "", "\t/**", "\t * Generate an RCL that can replace the original RCL of this node to", "\t * match the RCL of the target for the insert.", "\t *", "\t * @param target the target node for the insert", "\t * @param colMap int array representation of correspondence between", "\t * RCLs - colmap[i] = -1 -&gt; missing in current RCL", "\t * colmap[i] = j -&gt; targetRCL(i) &lt;-&gt; thisRCL(j+1)", "\t * @return an RCL that matches the target RCL", "\t */", "\tResultColumnList getRCLForInsert(InsertNode target, int[] colMap)" ], "header": "@@ -916,24 +916,42 @@ public abstract class ResultSetNode extends QueryTreeNode", "removed": [ "\t * we will reorder and/or add defaults to the current RCL so that is", "\t * @param numTargetColumns\t# of columns in target RCL", "\t * @param dataDictionary\tDataDictionary to use", "\t * @param targetTD\t\t\tTableDescriptor for target if the target is not a VTI, null if a VTI", " * @param targetVTI Target description if it is a VTI, null if not a VTI", "\tpublic void enhanceRCLForInsert(int numTargetColumns, int[] colMap, ", "\t\t\t\t\t\t\t\t\t\t\t DataDictionary dataDictionary,", "\t\t\t\t\t\t\t\t\t\t\t TableDescriptor targetTD,", " FromVTI targetVTI)" ] }, { "added": [ "\t\tint numTargetColumns = target.resultColumnList.size();" ], "header": "@@ -946,10 +964,10 @@ public abstract class ResultSetNode extends QueryTreeNode", "removed": [ "\t\t\tColumnReference newColumnReference;" ] }, { "added": [ "\t\t\t\tnewResultColumn = genNewRCForInsert(", "\t\t\t\t\t\ttarget.targetTableDescriptor,", "\t\t\t\t\t\ttarget.targetVTI,", "\t\t\t\t\t\tindex + 1,", "\t\t\t\t\t\ttarget.getDataDictionary());", "\t\treturn newResultCols;" ], "header": "@@ -958,14 +976,17 @@ public abstract class ResultSetNode extends QueryTreeNode", "removed": [ "\t\t\t\tnewResultColumn = genNewRCForInsert(targetTD, targetVTI, index + 1, dataDictionary);", "\t\t/* Set the source RCL to the massaged version */", "\t\tresultColumns = newResultCols;" ] } ] } ]
derby-DERBY-3002-b5105f32
DERBY-3002: Add partial support for ROLLUP variant of GROUP BY clause This change adds an initial implementation of support for the ROLLUP style of GROUP BY. Specifying ROLLUP causes Derby to perform multiple nested levels of grouping in a single pass over the input data, returning the results in a single result set. Most of the changes were made to GroupedAggregateResultSet, which is enhanced to be able to perform multiple levels of grouping in a single pass over the (sorted) input data. There are also changes to the SQL grammar to allow the new syntax to be specified, and changes to GroupByNode to pass the rollup specification through to the execution engine. Several tests were added to the OLAPTest test suite. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@824966 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/sql/execute/ResultSetFactory.java", "hunks": [ { "added": [ "\t\t@param isRollup true if this is a GROUP BY ROLLUP()" ], "header": "@@ -487,6 +487,7 @@ public interface ResultSetFactory {", "removed": [] }, { "added": [ "\t\tdouble optimizerEstimatedCost,", "\t\tboolean isRollup) " ], "header": "@@ -499,7 +500,8 @@ public interface ResultSetFactory {", "removed": [ "\t\tdouble optimizerEstimatedCost) " ] }, { "added": [ "\t\t@param isRollup true if this is a GROUP BY ROLLUP()" ], "header": "@@ -521,6 +523,7 @@ public interface ResultSetFactory {", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/GroupByList.java", "hunks": [ { "added": [ "\tboolean rollup = false;" ], "header": "@@ -47,6 +47,7 @@ import java.util.Vector;", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/GroupByNode.java", "hunks": [ { "added": [ "\t\tif (this.groupingList != null && this.groupingList.isRollup())", " {", "\t\t\tresultColumns.setNullability(true);", "\t\t\tparent.getResultColumns().setNullability(true);", " }" ], "header": "@@ -183,6 +183,11 @@ public class GroupByNode extends SingleChildResultSetNode", "removed": [] }, { "added": [ "\t\t\t\tSanityManager.ASSERT(groupingList != null || numDistinct == 1," ], "header": "@@ -252,7 +257,7 @@ public class GroupByNode extends SingleChildResultSetNode", "removed": [ "\t\t\t\tSanityManager.ASSERT(numDistinct == 1," ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/GenericResultSetFactory.java", "hunks": [ { "added": [ "\t\tdouble optimizerEstimatedCost,", "\t\tboolean isRollup) ", "\t\t\t\t\t\toptimizerEstimatedCost, isRollup);" ], "header": "@@ -346,13 +346,14 @@ public class GenericResultSetFactory implements ResultSetFactory", "removed": [ "\t\tdouble optimizerEstimatedCost) ", "\t\t\t\t\t\toptimizerEstimatedCost);" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/GroupedAggregateResultSet.java", "hunks": [ { "added": [ "import java.util.ArrayList;", "import java.util.List;", "import java.util.HashSet;" ], "header": "@@ -21,7 +21,10 @@", "removed": [] }, { "added": [ "import org.apache.derby.iapi.sql.execute.ExecAggregator;" ], "header": "@@ -29,6 +32,7 @@ import org.apache.derby.iapi.services.loader.GeneratedMethod;", "removed": [] }, { "added": [ " * The implementation is capable of computing multiple levels of grouping", " * in a single result set (this is requested using GROUP BY ROLLUP).", " *", " * This implementation has 3 variations, which it chooses according to", " * the following rules:", " * - If the data are guaranteed to arrive already in sorted order, we make", " * a single pass over the data, computing the aggregates in-line as the", " * data are read.", " * - If the statement requests either multiple ROLLUP levels, or a DISTINCT", " * grouping, then the data are first sorted, then we make a single", " * pass over the data as above.", " * - Otherwise, the data are sorted, and a SortObserver is used to compute", " * the aggregations inside the sort, and the results are read back directly", " * from the sorter.", " *", " * Note that, as of the introduction of the ROLLUP support, we no longer", " * ALWAYS compute the aggregates using a SortObserver, which is an", " * arrangement by which the sorter calls back into the aggregates during", " * the sort process each time it consolidates two rows with the same", " * sort key. Using aggregate sort observers is an efficient technique, but", " * it was complex to extend it to the ROLLUP case, so to simplify the code", " * we just have one path for both already-sorted and un-sorted data sources", " * in the ROLLUP case.", " *" ], "header": "@@ -46,6 +50,30 @@ import org.apache.derby.iapi.types.RowLocation;", "removed": [] }, { "added": [ "\t// - resultRows: This is the current accumulating grouped result that", "\t// we are computing, at each level of aggregation. If we are not", "\t// doing a ROLLUP, then there is only one entry in resultRows, and", "\t// it contains the currently-accumulating aggregated result. If we", "\t// are doing a ROLLUP, then there are N+1 entries in resultRows,", "\t// as follows (imagine we're doing ROLLUP(a,b,c,d):", "\t// [0]: GROUP BY ()", "\t// [1]: GROUP BY (A)", "\t// [2]: GROUP BY (A,B)", "\t// [3]: GROUP BY (A,B,C)", "\t// [4]: GROUP BY (A,B,C,D)", "\t// - finishedResults: this list is used only when a ROLLUP is computing", "\t// multiple levels of aggregation at once, and the results for", "\t// several groupings have been completed, but not yet returned to", "\t// our caller.", "\t// - distinctValues: used only if DISTINCT aggregates are present,", "\t// this is a HashSet for each aggregate for each level of grouping,", "\t// and the HashSet instances contain the values this aggregate", "\t// has seen during this group instance, to eliminate duplicates.", "\t//", "\tprivate boolean resultsComplete;", "\tprivate List finishedResults;", "\tprivate ExecIndexRow[]\t\t\tresultRows;", "\tprivate HashSet [][]\t\t\tdistinctValues;", "", "\tprivate boolean rollup;", "\tprivate boolean usingAggregateObserver = false;" ], "header": "@@ -70,15 +98,35 @@ class GroupedAggregateResultSet extends GenericAggregateResultSet", "removed": [ "\t// In order group bys", "\tprivate ExecIndexRow currSortedRow;", "\tprivate boolean nextCalled;", "\t// used to track and close sorts", "\tprivate long distinctAggSortId;", "\tprivate boolean dropDistinctAggSort;", "\tprivate boolean dropGenericSort;" ] }, { "added": [ "\t\t\t\t\tdouble optimizerEstimatedCost,", "\t\t\t\t\tboolean isRollup) throws StandardException ", "\t\trollup = isRollup;", "\t\tfinishedResults = new ArrayList();" ], "header": "@@ -112,10 +160,13 @@ class GroupedAggregateResultSet extends GenericAggregateResultSet", "removed": [ "\t\t\t\t double optimizerEstimatedCost) throws StandardException " ] }, { "added": [ "\t\thasDistinctAggregate = aggInfoList.hasDistinct();", "\t\t// If there is no ROLLUP, and no DISTINCT, and the data are", "\t\t// not in sorted order, then we can use AggregateSortObserver", "\t\t// to compute the aggregation in the sorter:", "\t\tusingAggregateObserver =", "\t\t\t!isInSortedOrder &&", "\t\t\t!rollup &&", "\t\t\t!hasDistinctAggregate;" ], "header": "@@ -127,6 +178,14 @@ class GroupedAggregateResultSet extends GenericAggregateResultSet", "removed": [] }, { "added": [ "\t\t/* If this is an in-order group by then we do not need the sorter.", "\t\t * (We can do the aggregation ourselves.)", "\t\t * We save a clone of the first row so that subsequent next()s", "\t\t * do not overwrite the saved row.", "\t\t */", "\t\tif (!isInSortedOrder)", "\t\t\tscanController = loadSorter();", "", "\t\tExecIndexRow currSortedRow = getNextRowFromRS();", "\t\tresultsComplete = (currSortedRow == null);", "\t\tif (usingAggregateObserver)", "\t\t{", "\t\t\tif (currSortedRow != null)", "\t\t\t\tfinishedResults.add(", "\t\t\t\t\tfinishAggregation(currSortedRow).getClone());", "\t\t}", "\t\telse if (!resultsComplete)", "\t\t{", "\t\t\tif (rollup)", "\t\t\t\tresultRows = new ExecIndexRow[order.length+1];", "\t\t\t\tresultRows = new ExecIndexRow[1];", "\t\t\tif (aggInfoList.hasDistinct())", "\t\t\t distinctValues = new HashSet[resultRows.length][aggregates.length];", "\t\t\tfor (int r = 0; r < resultRows.length; r++)", "\t\t\t\tresultRows[r] =", "\t\t\t\t\t(ExecIndexRow) currSortedRow.getClone();", "\t\t\t\tinitializeVectorAggregation(resultRows[r]);", "\t\t\t\tif (aggInfoList.hasDistinct())", "\t\t\t\t\tdistinctValues[r] = new HashSet[aggregates.length];", "\t\t\t\tinitializeDistinctMaps(r, true);", "\t\t}" ], "header": "@@ -159,27 +218,40 @@ class GroupedAggregateResultSet extends GenericAggregateResultSet", "removed": [ "\t\t\t/* If this is an in-order group by then we do not need the sorter.", "\t\t\t * (We can do the aggregation ourselves.)", "\t\t\t * We save a clone of the first row so that subsequent next()s", "\t\t\t * do not overwrite the saved row.", "\t\t\t */", "\t\t\tif (isInSortedOrder)", "\t\t\t{", "\t\t\t\tcurrSortedRow = getNextRowFromRS();", "\t\t\t\tif (currSortedRow != null)", "\t\t\t\t{", "\t\t\t\t\tcurrSortedRow = (ExecIndexRow) currSortedRow.getClone();", "\t\t\t\t\tinitializeVectorAggregation(currSortedRow);", "\t\t\t\t}", "\t\t\t}", "\t\t\t\t/*", "\t\t\t\t** Load up the sorter", "\t\t\t\t*/", "\t\t\t\tscanController = loadSorter();" ] }, { "added": [ "\t * source scan. When done, close" ], "header": "@@ -197,8 +269,7 @@ class GroupedAggregateResultSet extends GenericAggregateResultSet", "removed": [ "\t * source scan. If we have a vector aggregate, initialize", "\t * the aggregator for each source row. When done, close" ] }, { "added": [ "\t\tSortObserver observer;", "\t\tif (usingAggregateObserver)", "\t\t\tobserver = new AggregateSortObserver(true, aggregates,", "\t\t\t\taggregates, sortTemplateRow);", "\t\telse", "\t\t\tobserver = new BasicSortObserver(true, false,", "\t\t\t\tsortTemplateRow, true);", "", "\t\tgenericSortId = tc.createSort((Properties)null, ", "\t\t\t\tsortTemplateRow.getRowArray(),", "\t\t\t\torder,", "\t\t\t\tobserver,", "\t\t\t\tfalse,", "\t\t\t\tinputRowCountEstimate, // est rows", "\t\t\t\tmaxRowSize\t\t\t// est rowsize ", "\t\t);", "\t\tsorter = tc.openSort(genericSortId);" ], "header": "@@ -210,106 +281,29 @@ class GroupedAggregateResultSet extends GenericAggregateResultSet", "removed": [ "\t\tlong \t\t\t\t\tsortId;", "\t\tboolean\t\t\t\t\tinOrder = isInSortedOrder;", "\t\tColumnOrdering[] currentOrdering = order;", "", "\t\t/*", "\t\t** Do we have any distinct aggregates? If so, we'll need", "\t\t** a separate sort. We use all of the sorting columns and", "\t\t** drop the aggregation on the distinct column. Then", "\t\t** we'll feed this into the sorter again w/o the distinct", "\t\t** column in the ordering list.", "\t\t*/", "\t\tif (aggInfoList.hasDistinct())", "\t\t{", "\t\t\thasDistinctAggregate = true;", "\t\t\t", "\t\t\tGenericAggregator[] aggsNoDistinct = getSortAggregators(aggInfoList, true,", "\t\t\t\t\t\tactivation.getLanguageConnectionContext(), source);", "\t\t\tSortObserver sortObserver = new AggregateSortObserver(true, aggsNoDistinct, aggregates,", "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t sortTemplateRow);", "", "\t\t\tsortId = tc.createSort((Properties)null, ", "\t\t\t\t\tsortTemplateRow.getRowArray(),", "\t\t\t\t\torder,", "\t\t\t\t\tsortObserver,", "\t\t\t\t\tfalse,\t\t\t// not in order", "\t\t\t\t\tinputRowCountEstimate,\t\t\t\t// est rows, -1 means no idea\t", "\t\t\t\t\tmaxRowSize\t\t// est rowsize", "\t\t\t\t\t);", "\t\t\tsorter = tc.openSort(sortId);", "\t\t\tdistinctAggSortId = sortId;", "\t\t\tdropDistinctAggSort = true;", "\t\t\t\t", "\t\t\twhile ((sourceRow = source.getNextRowCore())!=null) ", "\t\t\t{", "\t\t\t\tsorter.insert(sourceRow.getRowArray());", "\t\t\t\trowsInput++;", "\t\t\t}", "", "\t\t\t/*", "\t\t\t** End the sort and open up the result set", "\t\t\t*/", "\t\t\tsource.close();", "\t\t\tsortProperties = sorter.getSortInfo().getAllSortInfo(sortProperties);", "\t\t\tsorter.completedInserts();", "", "\t\t\tscanController = ", " tc.openSortScan(sortId, activation.getResultSetHoldability());", "\t\t\t", "\t\t\t/*", "\t\t\t** Aggs are initialized and input rows", "\t\t\t** are in order. All we have to do is", "\t\t\t** another sort to remove (merge) the ", "\t\t\t** duplicates in the distinct column", "\t\t\t*/\t", "\t\t\tinOrder = true;", "\t\t\tinputRowCountEstimate = rowsInput;", "\t", "\t\t\t/*", "\t\t\t** Drop the last column from the ordering. The", "\t\t\t** last column is the distinct column. Don't", "\t\t\t** pay any attention to the fact that the ordering", "\t\t\t** object's name happens to correspond to a techo", "\t\t\t** band from the 80's.", "\t\t\t**", "\t\t\t** If there aren't any ordering columns other", "\t\t\t** than the distinct (i.e. for scalar distincts)", "\t\t\t** just skip the 2nd sort altogether -- we'll", "\t\t\t** do the aggregate merge ourselves rather than", "\t\t\t** force a 2nd sort.", "\t\t\t*/", "\t\t\tif (order.length == 1)", "\t\t\t{", "\t\t\t\treturn scanController;", "\t\t\t}", "", "\t\t\tColumnOrdering[] newOrder = new ColumnOrdering[order.length - 1];", "\t\t\tSystem.arraycopy(order, 0, newOrder, 0, order.length - 1);", "\t\t\tcurrentOrdering = newOrder;", "\t\t}", "", "\t\tSortObserver sortObserver = new AggregateSortObserver(true, aggregates, aggregates,", "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t sortTemplateRow);", "", "\t\tsortId = tc.createSort((Properties)null, ", "\t\t\t\t\t\tsortTemplateRow.getRowArray(),", "\t\t\t\t\t\tcurrentOrdering,", "\t\t\t\t\t\tsortObserver,", "\t\t\t\t\t\tinOrder,", "\t\t\t\t\t\tinputRowCountEstimate, // est rows", "\t\t\t\t\t \tmaxRowSize\t\t\t// est rowsize ", "\t\t\t\t\t\t);", "\t\tsorter = tc.openSort(sortId);", "\t\tgenericSortId = sortId;", "\t\tdropGenericSort = true;" ] }, { "added": [ "\t\tsortProperties = sorter.getSortInfo().", "\t\t\tgetAllSortInfo(sortProperties);", "\t\tif (aggInfoList.hasDistinct())", "\t\t{", "\t\t\t/*", "\t\t\t** If there was a distinct aggregate, then that column", "\t\t\t** was automatically included as the last column in", "\t\t\t** the sort ordering. But we don't want it to be part", "\t\t\t** of the ordering anymore, because we aren't grouping", "\t\t\t** by that column, we just sorted it so that distinct", "\t\t\t** aggregation would see the values in order.", "\t\t\t*/", "\t\t\tint numDistinctAggs = 0;", "\t\t\tfor (int i = 0; i < aggregates.length; i++)", "\t\t\t{", "\t\t\t\tAggregatorInfo aInfo = (AggregatorInfo)", "\t\t\t\t\taggInfoList.elementAt(i);", "\t\t\t\tif (aInfo.isDistinct())", "\t\t\t\t\tnumDistinctAggs++;", "\t\t\t}", "\t\t\t// Although it seems like N aggs could have been", "\t\t\t// added at the end, in fact only one has been", "\t\t\t// FIXME -- need to get GroupByNode to handle this", "\t\t\t// correctly, but that requires understanding", "\t\t\t// scalar distinct aggregates.", "\t\t\tnumDistinctAggs = 1;", "\t\t\tif (order.length > numDistinctAggs)", "\t\t\t{", "\t\t\t\tColumnOrdering[] newOrder = new ColumnOrdering[", "\t\t\t\t\torder.length - numDistinctAggs];", "\t\t\t\tSystem.arraycopy(order, 0, newOrder, 0,", "\t\t\t\t\torder.length-numDistinctAggs);", "\t\t\t\torder = newOrder;", "\t\t\t}", "\t\t}", "\t\treturn tc.openSortScan(genericSortId,", "\t\t\tactivation.getResultSetHoldability());" ], "header": "@@ -317,10 +311,44 @@ class GroupedAggregateResultSet extends GenericAggregateResultSet", "removed": [ "\t\tsortProperties = sorter.getSortInfo().getAllSortInfo(sortProperties);", "", "\t\treturn tc.openSortScan(sortId, activation.getResultSetHoldability());" ] }, { "added": [ "\t\tif (finishedResults.size() > 0)", "\t\t\treturn makeCurrent(finishedResults.remove(0));", "\t\telse if (resultsComplete)", "\t\t\treturn null;", "\t\tExecIndexRow nextRow = getNextRowFromRS();", "\t\t// No rows, no work to do", "\t\tif (nextRow == null)", "\t\t\treturn finalizeResults();", "\t\t// If the aggregation was performed using the SortObserver, the", "\t\t// result row from the sorter is complete and ready to return:", "\t\tif (usingAggregateObserver)", "\t\t\treturn finishAggregation(nextRow);", "", "\t\t/* Drain and merge rows until we find new distinct values for the grouping columns. */", "\t\twhile (nextRow != null)", "\t\t{", "\t\t\t/* We found a new set of values for the grouping columns. ", "\t\t\t * Update the current row and return this group. ", "\t\t\t *", "\t\t\t * Note that in the case of GROUP BY ROLLUP,", "\t\t\t * there may be more than one level of grouped", "\t\t\t * aggregates which is now complete. We can", "\t\t\t * only return 1, and the other completed", "\t\t\t * groups are held in finishedResults until", "\t\t\t * our caller calls getNextRowCore() again to", "\t\t\t * get the next level of results.", "\t\t\t */", "\t\t\tExecIndexRow currSortedRow =", "\t\t\t\t resultRows[resultRows.length-1];", " ExecRow origRow = (ExecRow)nextRow.getClone();;", " initializeVectorAggregation(nextRow);", "\t\t\tint distinguisherCol = ", "\t\t\t\t sameGroupingValues(currSortedRow, nextRow);", "", "\t\t\tfor (int r = 0; r < resultRows.length; r++)", "\t\t\t\tboolean sameGroup = (rollup ?", "\t\t\t\t r <= distinguisherCol :", "\t\t\t\t distinguisherCol == order.length);", "\t\t\t\tif (sameGroup)", "\t\t\t\t\t/* Same group - initialize the new", "\t\t\t\t\t row and then merge the aggregates */", "\t\t\t\t\t//initializeVectorAggregation(nextRow);", "\t\t\t\t\tmergeVectorAggregates(nextRow, resultRows[r], r);", "\t\t\t\t\tsetRollupColumnsToNull(resultRows[r],r);", "\t\t\t\t\tfinishedResults.add(finishAggregation(resultRows[r]));", "\t\t\t\t\t/* Save a clone of the new row so", "\t\t\t\t\t that it doesn't get overwritten */", "\t\t\t\t\tresultRows[r] = (ExecIndexRow)", "\t\t\t\t\t\t origRow.getClone();", "\t\t\t\t\tinitializeVectorAggregation(resultRows[r]);", "\t\t\t\t\tinitializeDistinctMaps(r, false);", "\t\t\tif (finishedResults.size() > 0)", "\t\t\t\tnextTime += getElapsedMillis(beginTime);", "\t\t\t\trowsReturned++;", " return makeCurrent(finishedResults.remove(0));", "\t\t\t// Get the next row", "\t\t\tnextRow = getNextRowFromRS();", "\t\t}", "\t\treturn finalizeResults();", "\t}", "\t// Return the passed row, after ensuring that we call setCurrentRow", "\tprivate ExecRow makeCurrent(Object row)", "\t\tthrows StandardException", "\t{", "\t\tExecRow resultRow = (ExecRow)row;", "\t\tsetCurrentRow(resultRow);", "\t\treturn resultRow;", "\t}", "\tprivate ExecRow finalizeResults()", "\t\tthrows StandardException", "\t{", "\t\t// We've drained the source, so no more rows to return", "\t\tresultsComplete = true;", "\t\tif (! usingAggregateObserver )", "\t\t{", "\t\t\tfor (int r = 0; r < resultRows.length; r++)", "\t\t\t\tsetRollupColumnsToNull(resultRows[r],r);", "\t\t\t\tfinishedResults.add(finishAggregation(resultRows[r]));", "\t\tnextTime += getElapsedMillis(beginTime);", "\t\tif (finishedResults.size() > 0)", "\t\t\treturn makeCurrent(finishedResults.remove(0));", "\t\telse", "\t\t\treturn null;" ], "header": "@@ -341,82 +369,105 @@ class GroupedAggregateResultSet extends GenericAggregateResultSet", "removed": [ "\t\t// In order group by", "\t\tif (isInSortedOrder)", "\t\t{", "\t\t\t// No rows, no work to do", "\t\t\tif (currSortedRow == null)", "\t\t\t{", "\t\t\t\tnextTime += getElapsedMillis(beginTime);", "\t\t\t\treturn null;", "\t\t\t}", "\t\t ExecIndexRow nextRow = getNextRowFromRS();", "\t\t\t/* Drain and merge rows until we find new distinct values for the grouping columns. */", "\t\t\twhile (nextRow != null)", "\t\t\t\t/* We found a new set of values for the grouping columns. ", "\t\t\t\t * Update the current row and return this group. ", "\t\t\t\t */", "\t\t\t\tif (! sameGroupingValues(currSortedRow, nextRow))", "\t\t\t\t\tExecIndexRow result = currSortedRow;", "", "\t\t\t\t\t/* Save a clone of the new row so that it doesn't get overwritten */", "\t\t\t\t\tcurrSortedRow = (ExecIndexRow) nextRow.getClone();", "\t\t\t\t\tinitializeVectorAggregation(currSortedRow);", "", "\t\t\t\t\tnextTime += getElapsedMillis(beginTime);", "\t\t\t\t\trowsReturned++;", "\t\t\t\t\treturn finishAggregation(result);", "\t\t\t\t\t/* Same group - initialize the new row and then merge the aggregates */", "\t\t\t\t\tinitializeVectorAggregation(nextRow);", "\t\t\t\t\tmergeVectorAggregates(nextRow, currSortedRow);", "", "\t\t\t\t// Get the next row", "\t\t\t\tnextRow = getNextRowFromRS();", "", "\t\t\t// We've drained the source, so no more rows to return", "\t\t\tExecIndexRow result = currSortedRow;", "\t\t\tcurrSortedRow = null;", "\t\t\tnextTime += getElapsedMillis(beginTime);", "\t\t\treturn finishAggregation(result);", "\t\t}", "\t\telse", "\t\t{", "\t\t ExecIndexRow sortResult = null;", "", "\t if ((sortResult = getNextRowFromRS()) != null)", "\t\t\t\tsetCurrentRow(sortResult);", "\t\t\t/*", "\t\t\t** Only finish the aggregation", "\t\t\t** if we have a return row. We don't generate", "\t\t\t** a row on a vector aggregate unless there was", "\t\t\t** a group.", "\t\t\t*/", "\t\t\tif (sortResult != null)", "\t\t\t{", "\t\t\t\tsortResult = finishAggregation(sortResult);", "\t\t\t\tcurrentRow = sortResult;", "\t\t\t}", "\t\t\tif (sortResult != null)", "\t\t\t\trowsReturned++;", "", "\t\t\tnextTime += getElapsedMillis(beginTime);", "\t\t return sortResult;" ] }, { "added": [ "\t * @return\tThe order index number which first distinguished", "\t *\t\t\tthese rows, or order.length if the rows match.", "\tprivate int sameGroupingValues(ExecRow currRow, ExecRow newRow)" ], "header": "@@ -427,12 +478,12 @@ class GroupedAggregateResultSet extends GenericAggregateResultSet", "removed": [ "\t * @return\tWhether or not to filter out the new row has the same values for the ", "\t *\t\t\tgrouping columns as the current row.", "\tprivate boolean sameGroupingValues(ExecRow currRow, ExecRow newRow)" ] }, { "added": [ "\t\t\t\treturn index;", "\t\treturn order.length;" ], "header": "@@ -441,10 +492,10 @@ class GroupedAggregateResultSet extends GenericAggregateResultSet", "removed": [ "\t\t\t\treturn false;", "\t\treturn true;" ] }, { "added": [ "\t\t\tif (!isInSortedOrder)" ], "header": "@@ -468,16 +519,9 @@ class GroupedAggregateResultSet extends GenericAggregateResultSet", "removed": [ "\t\t\tif (dropDistinctAggSort)", "\t\t\t{", "\t\t\t\ttc.dropSort(distinctAggSortId);", "\t\t\t\tdropDistinctAggSort = false;", "\t\t\t}", "", "\t\t\tif (dropGenericSort)", "\t\t\t\tdropGenericSort = false;" ] }, { "added": [ "\t// We are performing a ROLLUP aggregation and", "\t// we need to set the N rolled-up columns in this", "\t// row to NULL.", "\tprivate void setRollupColumnsToNull(ExecRow row, int resultNum)", "\t\tthrows StandardException", "\t{", "\t\tint numRolledUpCols = resultRows.length - resultNum - 1;", "\t\tfor (int i = 0; i < numRolledUpCols; i++)", "\t\t{", "\t\t\tint rolledUpColIdx = order.length - 1 - i;", "\t\t\tDataValueDescriptor rolledUpColumn =", "\t\t\t\trow.getColumn(order[rolledUpColIdx].getColumnId() + 1);", "\t\t\trolledUpColumn.setToNull();", "\t\t}", "\t}", "" ], "header": "@@ -597,6 +641,22 @@ class GroupedAggregateResultSet extends GenericAggregateResultSet", "removed": [] }, { "added": [ "" ], "header": "@@ -616,6 +676,7 @@ class GroupedAggregateResultSet extends GenericAggregateResultSet", "removed": [] } ] } ]
derby-DERBY-3004-4f278dd3
DERBY-3004: Get rid of the finalizer in EmbedResultSet Moved code from EmbedResultSet.finalize() to EmbedStatement.finalize() to make allocation and garbage collection of EmbedResultSet objects cheaper (ResultSets are normally allocated more frequently than Statements). git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@566981 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java", "hunks": [ { "added": [ "\t the activation or the finalization of the parent EmbedStatement", "\t @see EmbedStatement#finalize()", "\t @see EmbedPreparedStatement#finalize()" ], "header": "@@ -129,9 +129,10 @@ public abstract class EmbedResultSet extends ConnectionChild", "removed": [ "\t the activation or the finalization of the ResultSet", "\t c.f. EmbedPreparedStatement.finalize()." ] } ] }, { "file": "java/engine/org/apache/derby/impl/jdbc/EmbedStatement.java", "hunks": [ { "added": [ "\tEmbedResultSet results;" ], "header": "@@ -76,7 +76,7 @@ public class EmbedStatement extends ConnectionChild", "removed": [ "\tjava.sql.ResultSet results;" ] }, { "added": [ " /**", " * Mark the statement and its single-use activation as unused. This method", " * should be called from <code>EmbedPreparedStatement</code>'s finalizer as", " * well, even though prepared statements reuse activations, since", " * <code>getGeneratedKeys()</code> uses a single-use activation regardless", " * of statement type.", " */", " protected void finalize() throws Throwable {", " super.finalize();", "", " // We mark the activation as not being used and", " // that is it. We rely on the connection to sweep", " // through the activations to find the ones that", " // aren't in use, and to close them. We cannot", " // do a activation.close() here because there are", " // synchronized methods under close that cannot", " // be called during finalization.", " if (results != null && results.singleUseActivation != null) {", " results.singleUseActivation.markUnused();", " }", " }", "" ], "header": "@@ -320,6 +320,28 @@ public class EmbedStatement extends ConnectionChild", "removed": [] } ] } ]
derby-DERBY-3008-1b41764b
DERBY-3008 Set forCreateTable state of CreateIndexConstantAction at compile time. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@566425 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/compile/TableElementList.java", "hunks": [ { "added": [ "\t\t\t\tindexAction = genIndexAction(", " forCreateTable,", " constraintDN.requiresUniqueIndex()," ], "header": "@@ -673,7 +673,9 @@ public class TableElementList extends QueryTreeNodeVector", "removed": [ "\t\t\t\tindexAction = genIndexAction(constraintDN.requiresUniqueIndex()," ] }, { "added": [ " boolean forCreateTable," ], "header": "@@ -772,6 +774,7 @@ public class TableElementList extends QueryTreeNodeVector", "removed": [] }, { "added": [ " if (SanityManager.DEBUG)", " {", " if (forCreateTable)", " SanityManager.THROWASSERT(\"DROP INDEX with forCreateTable true\");", " }" ], "header": "@@ -787,6 +790,11 @@ public class TableElementList extends QueryTreeNodeVector", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/CreateIndexConstantAction.java", "hunks": [ { "added": [ " /**", " * Is this for a CREATE TABLE, i.e. it is", " * for a constraint declared in a CREATE TABLE", " * statement that requires a backing index.", " */", " private final boolean forCreateTable;" ], "header": "@@ -68,6 +68,12 @@ import org.apache.derby.iapi.types.TypeId;", "removed": [] }, { "added": [ " * @param forCreateTable Being executed within a CREATE TABLE statement" ], "header": "@@ -84,6 +90,7 @@ class CreateIndexConstantAction extends IndexConstantAction", "removed": [] }, { "added": [ " boolean forCreateTable," ], "header": "@@ -97,6 +104,7 @@ class CreateIndexConstantAction extends IndexConstantAction", "removed": [] }, { "added": [ " this.forCreateTable = forCreateTable;" ], "header": "@@ -110,6 +118,7 @@ class CreateIndexConstantAction extends IndexConstantAction", "removed": [] }, { "added": [], "header": "@@ -155,7 +164,6 @@ class CreateIndexConstantAction extends IndexConstantAction", "removed": [ "\t\tboolean\t\t\t\t\t\tforCreateTable;" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/GenericConstantActionFactory.java", "hunks": [ { "added": [ " * @param forCreateTable Executed as part of a CREATE TABLE" ], "header": "@@ -194,6 +194,7 @@ public class GenericConstantActionFactory", "removed": [] }, { "added": [ " boolean forCreateTable," ], "header": "@@ -208,6 +209,7 @@ public class GenericConstantActionFactory", "removed": [] }, { "added": [ "\t\t\t( forCreateTable, unique, indexType, schemaName, indexName, tableName, tableId," ], "header": "@@ -222,7 +224,7 @@ public class GenericConstantActionFactory", "removed": [ "\t\t\t( unique, indexType, schemaName, indexName, tableName, tableId," ] } ] } ]
derby-DERBY-3008-68db840f
DERBY-3008 (partial) Create a boolean forCreateTable flag in the CrreateConstraintConstantAction (set at compile time). Activation still has such a field, will be removed in future changes. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@565930 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/compile/AlterTableNode.java", "hunks": [ { "added": [ "\tprivate void\tprepConstantAction() throws StandardException" ], "header": "@@ -375,7 +375,7 @@ public class AlterTableNode extends DDLStatementNode", "removed": [ "\tpublic void\tprepConstantAction() throws StandardException" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/TableElementList.java", "hunks": [ { "added": [ " * @param forCreateTable ConstraintConstantAction is for a create table." ], "header": "@@ -616,6 +616,7 @@ public class TableElementList extends QueryTreeNodeVector", "removed": [] }, { "added": [ "\tvoid genConstraintActions(boolean forCreateTable," ], "header": "@@ -623,7 +624,7 @@ public class TableElementList extends QueryTreeNodeVector", "removed": [ "\tvoid genConstraintActions(" ] }, { "added": [ " if (SanityManager.DEBUG)", " {", " // Can't drop constraints on a create table.", " SanityManager.ASSERT(!forCreateTable);", " }" ], "header": "@@ -680,6 +681,11 @@ public class TableElementList extends QueryTreeNodeVector", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/CreateConstraintConstantAction.java", "hunks": [ { "added": [ " private final boolean forCreateTable;", " ", "\tprivate String[]\t\tcolumnNames;" ], "header": "@@ -65,7 +65,9 @@ import org.apache.derby.iapi.services.loader.ClassFactory;", "removed": [ "\tString[]\t\tcolumnNames;" ] }, { "added": [ " * @param forCreateTable Constraint is being added for a CREATE TABLE" ], "header": "@@ -87,6 +89,7 @@ public class CreateConstraintConstantAction extends ConstraintConstantAction", "removed": [] }, { "added": [ " boolean forCreateTable," ], "header": "@@ -103,6 +106,7 @@ public class CreateConstraintConstantAction extends ConstraintConstantAction", "removed": [] }, { "added": [ " this.forCreateTable = forCreateTable;" ], "header": "@@ -115,6 +119,7 @@ public class CreateConstraintConstantAction extends ConstraintConstantAction", "removed": [] }, { "added": [], "header": "@@ -154,7 +159,6 @@ public class CreateConstraintConstantAction extends ConstraintConstantAction", "removed": [ "\t\tboolean\t\t\t\t\t\tforCreateTable;" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/GenericConstantActionFactory.java", "hunks": [ { "added": [ " * @param forCreateTable True if for a CREATE TABLE" ], "header": "@@ -156,6 +156,7 @@ public class GenericConstantActionFactory", "removed": [] }, { "added": [ " boolean forCreateTable," ], "header": "@@ -171,6 +172,7 @@ public class GenericConstantActionFactory", "removed": [] }, { "added": [ "\t\t\t( constraintName, constraintType, forCreateTable, tableName, " ], "header": "@@ -183,7 +185,7 @@ public class GenericConstantActionFactory", "removed": [ "\t\t\t( constraintName, constraintType, tableName, " ] } ] } ]
derby-DERBY-3009-f5ec6ec7
DERBY-3009: Out of memory error when creating a very large table Clear the local state in AlterTableConstantAction after invocation so that the memory held in the table descriptors can be freed. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1086527 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/execute/AlterTableConstantAction.java", "hunks": [ { "added": [ " /**", " * Run this constant action.", " *", " * @param activation the activation in which to run the action", " * @throws StandardException if an error happens during execution", " * of the action", " */", " public void executeConstantAction(Activation activation)", " throws StandardException {", " try {", " executeConstantActionBody(activation);", " } finally {", " clearState();", " }", " }", "" ], "header": "@@ -262,6 +262,22 @@ class AlterTableConstantAction extends DDLSingleTableConstantAction", "removed": [] }, { "added": [ " private void executeConstantActionBody(Activation activation)" ], "header": "@@ -269,7 +285,7 @@ class AlterTableConstantAction extends DDLSingleTableConstantAction", "removed": [ " public void executeConstantAction(Activation activation)" ] } ] } ]
derby-DERBY-3012-09787898
DERBY-3012 Pass in TransactionController to DataDictionary.getTableDescriptor(String name). Mainly a signature change, more changes needed to use the pass in transaction git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@566318 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/diag/SpaceTable.java", "hunks": [ { "added": [ " SchemaDescriptor sd = dd.getSchemaDescriptor(schemaName, tc, true);", " TableDescriptor td = dd.getTableDescriptor(tableName,sd, tc);" ], "header": "@@ -138,8 +138,8 @@ public class SpaceTable extends VTITemplate implements VTICosting {", "removed": [ " SchemaDescriptor sd = dd.getSchemaDescriptor(schemaName, lcc.getTransactionExecute(), true);", " TableDescriptor td = dd.getTableDescriptor(tableName,sd);" ] } ] }, { "file": "java/engine/org/apache/derby/iapi/db/OnlineCompress.java", "hunks": [ { "added": [ " data_dictionary.getTableDescriptor(tableName, sd, nested_tc);" ], "header": "@@ -272,7 +272,7 @@ public class OnlineCompress", "removed": [ " data_dictionary.getTableDescriptor(tableName, sd);" ] }, { "added": [ " data_dictionary.getTableDescriptor(tableName, sd, tc);" ], "header": "@@ -474,7 +474,7 @@ public class OnlineCompress", "removed": [ " data_dictionary.getTableDescriptor(tableName, sd);" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java", "hunks": [ { "added": [ "\t\t\t\t\tSchemaDescriptor schema, TransactionController tc)" ], "header": "@@ -1769,14 +1769,13 @@ public final class\tDataDictionaryImpl", "removed": [ "\t *", "\t\t\t\t\tSchemaDescriptor schema)" ] }, { "added": [ "\t\tTableDescriptor td = getTableDescriptor(rowFactory.getCatalogName(), sd, tc);" ], "header": "@@ -6664,7 +6663,7 @@ public final class\tDataDictionaryImpl", "removed": [ "\t\tTableDescriptor td = getTableDescriptor(rowFactory.getCatalogName(), sd);" ] }, { "added": [ "\t\t\ttd = getTableDescriptor( rowFactory.getCatalogName(), sd, tc );" ], "header": "@@ -6732,7 +6731,7 @@ public final class\tDataDictionaryImpl", "removed": [ "\t\t\ttd = getTableDescriptor( rowFactory.getCatalogName(), sd );" ] }, { "added": [ "\t\tlong\t\t\t\tconglomID = getTableDescriptor( rowFactory.getCatalogName(), sd, tc ).getHeapConglomerateId();" ], "header": "@@ -6770,7 +6769,7 @@ public final class\tDataDictionaryImpl", "removed": [ "\t\tlong\t\t\t\tconglomID = getTableDescriptor( rowFactory.getCatalogName(), sd ).getHeapConglomerateId();" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/CreateAliasConstantAction.java", "hunks": [ { "added": [ "\t\t\tTableDescriptor targetTD = dd.getTableDescriptor(aliasName, sd, tc);" ], "header": "@@ -242,7 +242,7 @@ class CreateAliasConstantAction extends DDLConstantAction", "removed": [ "\t\t\tTableDescriptor targetTD = dd.getTableDescriptor(aliasName, sd);" ] } ] }, { "file": "java/testing/org/apache/derbyTesting/functionTests/util/TestPropertyInfo.java", "hunks": [ { "added": [ "\t\t\ttd = dd.getTableDescriptor(conglomerateName, sd, tc);" ], "header": "@@ -140,7 +140,7 @@ public class TestPropertyInfo", "removed": [ "\t\t\ttd = dd.getTableDescriptor(conglomerateName, sd);" ] } ] } ]
derby-DERBY-302-a4e85351
Fix for DERBY-302, committing on behalf of DERBY-302 - Insert on Clob of 500k of data using streams takes long time. It takes 3 mins on a sun jvm1.4.2 and 20 seconds with ibm jvm 1.4.2. The following fix improves the performance of insert into a 500k blob from 20 seconds to around 1 second. Note that by changing just the test program time was reduced from 3 minutes to avg around 20 seconds. Currently in derby, for an insert on a clob using setCharacterStream what will happen is , the entire stream will be materialized into a char array and sent to store for the insert. ( we should not have to stream here. I will file another jira issue for this and put in all information I learnt) Given this is how inserts for large clobs are happening, the performance issue analysis is as follows: -- profiler run shows that most time is spent in SQLChar.readExternal which is where the materialization into a char array for the user's input stream happens. The growth of this array happens gradually till the entire stream is materialized into the array. Below code snippet shows by how much the array is grown each time when it realizes it has to read more bytes from the stream. The dvd hierarchy for clob is - SQLClob ( dvd) extends SQLVarChar extends SQLChar. So in SQLChar.readExternal ........ int growby = in.available(); if(growby < 64) growby = 64 and then an allocation and an arraycopy to the new allocated array. -- In the code snippet, 'in' is the wrapper around the user's stream which is ReaderToUTF8Stream. ReaderToUTF8Stream extends InputStream and does not override available() method . As per the spec, InputStream.available() returns 0. -- Thus each time, the array growth is by 64 bytes which is obviously not performant. so for a 500k clob insert, this would mean allocation & arraycopy steps happen ~8000 times. -- The ReaderToUTF8Stream that has the user's stream reads from the stream and does the utf8 conversion and puts it in a 4k array. I think it is reasonable to have a 32k buffer to store this information for clobs. Although I think there seems to be more possible optimizations in this area, I prefer the incremental approach too :) so this patch is a first step towards fixing the insert clob performance in the current system. Fix includes: -- enhanced the way the array was grown to keep the original 64 bytes for char ( seems reasonable given the upper limit for char) but override it to have 4k for varchar and clobs. -- OVERRIDE AVAILABLE() IN READERTOUTF8STREAM TO RETURN A BETTER ESTIMATE OF HOW MANY BYTES CAN BE READ. git-svn-id: https://svn.apache.org/repos/asf/incubator/derby/code/trunk@190415 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/types/SQLChar.java", "hunks": [ { "added": [ " /**", " * threshold, that decides when we return space back to the VM", " * see getString() where it is used", " */", " protected final static int RETURN_SPACE_THRESHOLD = 4096;", " ", " /**", " * when we know that the array needs to grow by at least", " * one byte, it is not performant to grow by just one byte", " * instead this amount is used to provide a reasonable growby size.", " */", " private final static int GROWBY_FOR_CHAR = 64;" ], "header": "@@ -86,6 +86,18 @@ public class SQLChar", "removed": [] }, { "added": [ "\t\t\t\tif (len > RETURN_SPACE_THRESHOLD) {" ], "header": "@@ -335,7 +347,7 @@ public class SQLChar", "removed": [ "\t\t\t\tif (len > 4096) {" ] }, { "added": [ " // minimum amount that is reasonable to grow the array", " // when we know the array needs to growby at least one", " // byte but we dont want to grow by one byte as that", " // is not performant", " int minGrowBy = growBy();" ], "header": "@@ -641,6 +653,11 @@ public class SQLChar", "removed": [] }, { "added": [ " if (requiredLength < minGrowBy)", " requiredLength = minGrowBy;" ], "header": "@@ -654,8 +671,8 @@ public class SQLChar", "removed": [ " if (requiredLength < 64)", " requiredLength = 64;" ] }, { "added": [ " // We know that the array needs to be grown by at least one.", " // Note, for large data (clob > 32k), it is performant", " // to grow the array by atleast 4k rather than a small amount", " // Even better maybe to grow by 32k but then may be", " // a little excess(?) for small data. ", " // hopefully in.available() will give a fair", " // estimate of how much data can be read to grow the ", " // array by larger and necessary chunks.", " // This performance issue due to ", " // the slow growth of this array was noticed since inserts", " // on clobs was taking a really long time as", " // the array here grew previously by 64 bytes each time ", " // till stream was drained. (Derby-302)", " // for char, growby 64 seems reasonable, but for varchar", " // clob 4k or 32k is performant and hence", " // growBy() is override correctly to ensure this", " if (growby < minGrowBy)", " growby = minGrowBy;" ], "header": "@@ -707,12 +724,26 @@ readingLoop:", "removed": [ "", " // We know at the array needs to be grown by at least one.", " if (growby < 64)", " growby = 64;" ] } ] }, { "file": "java/engine/org/apache/derby/impl/jdbc/ReaderToUTF8Stream.java", "hunks": [ { "added": [ " // buffer to hold the data read from stream ", " // and converted to UTF8 format", " private final static int BUFSIZE = 32768;", "\t\tbuffer = new byte[BUFSIZE];" ], "header": "@@ -43,11 +43,14 @@ final class ReaderToUTF8Stream", "removed": [ "\t\tbuffer = new byte[4096];" ] }, { "added": [ " /**", " * Return an optimized version of bytes available to read from ", " * the stream ", " * Note, it is not exactly per java.io.InputStream#available()", " */", " public final int available()", " {", " int remainingBytes = reader.getLimit();", " // this object buffers BUFSIZE bytes that can be read ", " // and when that is finished it reads the next available bytes", " // from the reader object ", " // reader.getLimit() returns the remaining bytes available", " // on this stream", " return (BUFSIZE > remainingBytes ? remainingBytes : BUFSIZE);", " }" ], "header": "@@ -196,5 +199,20 @@ final class ReaderToUTF8Stream", "removed": [] } ] } ]
derby-DERBY-3023-125f9182
DERBY-4679 Several left outer joins causes unstable query with incorrect results Patch derby-4679b, which solves the following problem: When transitive closure generates new criteria into the query, it is sometimes confused by situations where the same column name appears in a result column list multiple times due to flattening of sub-queries. Flattening requires remapping of (table, column) numbers in column references. In cases where the same column name appears in a result column list multiple times, this lead to remapping (reassigning) wrong (table, column) numbers to column references in join predicates transformed to where clauses as a result of the flattening. See also DERBY-2526 and DERBY-3023 whose fixes which were partial solutions to the problem of wrong column number remappings confusing the transitive closure of search predicates performed by the preprocessing step of the optimizer. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@952237 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/compile/ColumnReference.java", "hunks": [ { "added": [ " /* For remembering original (tn,cn) of this CR during join flattening. */", " private int tableNumberBeforeFlattening = -1;", " private int columnNumberBeforeFlattening = -1;", "" ], "header": "@@ -71,6 +71,10 @@ public class ColumnReference extends ValueNode", "removed": [] }, { "added": [], "header": "@@ -850,12 +854,6 @@ public class ColumnReference extends ValueNode", "removed": [ "\t\t\t\ttableNumber = ft.getTableNumber();", "\t\t\t\tif (SanityManager.DEBUG)", "\t\t\t\t{", "\t\t\t\t\tSanityManager.ASSERT(tableNumber != -1,", "\t\t\t\t\t\t\"tableNumber not expected to be -1\");", "\t\t\t\t}" ] } ] } ]
derby-DERBY-3025-cb29d726
DERBY-3025: NPE when connecting to database with securityMechanism=8 Use an internal attribute name when passing security mechanism from the network server to the embedded driver. This prevents confusion if an embedded connection is established with securityMechanism specified (in which case the security mechanism should be ignored). git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@570663 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-3032-78cb2da6
DERBY-3032 Derby java.lang.ClassCastException returning null from a case statement in subquery git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@572738 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/compile/ConditionalNode.java", "hunks": [ { "added": [ "\t * @param fromList FromList to pass on to bindExpression if recast is performed", "\t * @param subqueryList SubqueryList to pass on to bindExpression if recast is performed", "\t * @param aggregateVector AggregateVector to pass on to bindExpression if recast is performed", "\t DataTypeDescriptor castType, FromList fromList,", "\t SubqueryList subqueryList, Vector aggregateVector)", "\t\t", "\t\t// need to have nullNodes nullable", "\t\tcastType.setNullability(true);" ], "header": "@@ -282,16 +282,22 @@ public class ConditionalNode extends ValueNode", "removed": [ "\t DataTypeDescriptor castType)", "" ] }, { "added": [ "\t\t\t// recast and rebind. findTypes would have bound as SQL CHAR.", "\t\t\t// need to rebind here. (DERBY-3032)", "\t\t\t((ValueNode) thenElseList.elementAt(0)).bindExpression(fromList, subqueryList, aggregateVector);", "\t\t\t", "\t\t\t castType,fromList, subqueryList, aggregateVector);", "\t\t\t// recast and rebind. findTypes would have bound as SQL CHAR.", "\t\t\t// need to rebind here. (DERBY-3032)", "\t\t\t((ValueNode) thenElseList.elementAt(1)).bindExpression(fromList, subqueryList, aggregateVector);", "\t\t\t castType,fromList,subqueryList,aggregateVector);" ], "header": "@@ -299,22 +305,29 @@ public class ConditionalNode extends ValueNode", "removed": [ "\t\t\t castType);", "\t\t\t castType);" ] } ] } ]
derby-DERBY-3033-9247f313
DERBY-3033: NullPointerExceptions with flattening of NOT EXISTS subqueries This patch modifies the behavior of queries which contain correlated subqueries using a NOT EXISTS predicate. For example: select ... from a, b where <join criteria> and not exists (select from c where c.col = b.col) Depending on various conditions, subqueries may be "flattened", which is a term used to describe an internal rewriting process in which the subquery is converted into a same-level join with the parent tables. For many types of queries, such flattening results in multiple tables equijoined together, and the optimizer may recognize, via transitive closure of the equijoin predicates, additional opportunities for join predicates. However, when a NOT EXISTS table is in the join's from list, join predicates that mention the NOT EXISTS table cannot be used for such transitive closure, because these are not equijoin predicates, they are equi-NON-join predicates: the join succeeds when there are NOT matching rows in that table. Prior to this change, Derby might incorrectly infer an equijoin predicate in such a situation, which could lead to wrong results, or to crashes during query execution when the join processing attempted to access the non-existing rows. This change modifies the PredicateList processing to note when a join predicate includes a NOT EXISTS table, and to omit that join predicate from transitive closure processing. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@581943 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/compile/PredicateList.java", "hunks": [ { "added": [ "\t *", "\t * Note that an equijoin predicate between two tables CANNOT be", "\t * used for transitive closure, if either of the tables is in the", "\t * fromlist for NOT EXISTS. In that case, the join predicate", "\t * actually specifies that the rows from the indicated table must", "\t * NOT exist, and therefore those non-existent rows cannot be", "\t * transitively joined to the other matching tables. See DERBY-3033", "\t * for a description of a situation in which this actually arises." ], "header": "@@ -1817,6 +1817,14 @@ public class PredicateList extends QueryTreeNodeVector implements OptimizablePre", "removed": [] } ] } ]
derby-DERBY-3035-c48e69a1
DERBY-3035 Cannot restore backups without BACKUP.HISTORY file git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@712693 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-3037-0f450705
DERBY-3304 DERBY-3037 DERBY-1585 I am adding a test case to check for the resultset from the java procedure call when the java procedure has done a rollback inside it. This test shows that in trunk, after checkin 602991 for DERBY-1585, a procedure does not return a resultset if there was a rollbck inside the procedure with resultset creation before rollback. This behavior is different than what happens in 10.2 codeline. In 10.2, a procedure will return a *closed* resultset if there was a rollback inside the procedure. But a procedure should not return closed result sets, so it appears that trunk is behaving correctly and 10.2's behavior was incorrect. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@628130 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/junit/JDBC.java", "hunks": [ { "added": [ " * Assert that the statement has no more results(getMoreResults) and it ", " * indeed does not return any resultsets(by checking getResultSet). ", " * Also, ensure that update count is -1.", " \tAssert.assertFalse(s.getMoreResults());", " Assert.assertTrue(s.getUpdateCount() == -1);", " Assert.assertNull(s.getResultSet());" ], "header": "@@ -523,15 +523,17 @@ public class JDBC {", "removed": [ " * Assert that the statement has no more results. Logic taken", " * from javadoc for java.sql.Statement.getMoreResults.", " Assert.assertTrue((s.getMoreResults() == false)", " && (s.getUpdateCount() == -1));" ] } ] } ]
derby-DERBY-3037-0f4ab910
DERBY-3037 EmbedStatement.executeStatement at line 1276 was calling finish rather than close on the Language Resultset. I fixed that to make a call to close. In addition, I also had to move the code for collecting the stats from finish to close method in NoRowsResultSetImpl. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@604976 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/execute/NoRowsResultSetImpl.java", "hunks": [ { "added": [ " * Dump the stat if not already done so. Close all of the open subqueries." ], "header": "@@ -324,32 +324,12 @@ abstract class NoRowsResultSetImpl implements ResultSet", "removed": [ " * No rows to return, does nothing", "\t\tisOpen = false;", "\t}", "", "\t/**", "\t * Find out if the <code>ResultSet</code> is closed.", "\t *", "\t * @return <code>true</code> if closed, <code>false</code> otherwise", "\t */", "\tpublic boolean isClosed() {", "\t\treturn !isOpen;", "\t}", "", "\t/**", "\t *\tdoesn't need to do anything, as no calls", "\t *\tare made that need to be restricted once", "\t *\tthe result set is 'finished'.", "\t *", "\t * @exception StandardException on error", "\t */", "\tpublic void finish() throws StandardException {" ] }, { "added": [ "\t\tisOpen = false;", "\t}", "", "\t/**", "\t * Find out if the <code>ResultSet</code> is closed.", "\t *", "\t * @return <code>true</code> if closed, <code>false</code> otherwise", "\t */", "\tpublic boolean isClosed() {", "\t\treturn !isOpen;", "\t}", "", "\tpublic void\tfinish() throws StandardException", "\t{" ], "header": "@@ -406,6 +386,20 @@ abstract class NoRowsResultSetImpl implements ResultSet", "removed": [] } ] } ]
derby-DERBY-3037-a660147e
DERBY-3037 This commit makes sure that EmbeddedResultSet.close() calls Language Resultset.close rather than Language Resultset.finish. This change caused few tests to fail. The tests had runtime statistics on but the code to dump the runtime statistics was in Language Resutlset.finish and not in Language Resultset.close. To fix this, I have moved the code to dump runtime statistics from Language Resutlset.finish into Lanugage ResultSet.close This has fixed the test failures. As for the 2nd part of this jira entry which is to have activation.close() call Language Resultset.finish(). This already happens in impl.sql.execute.BaseActivation.close() and hence no work was needed for the 2nd part. Will merge this change into 10.3 codeline soon. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@601830 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/execute/BasicNoPutResultSetImpl.java", "hunks": [ { "added": [], "header": "@@ -28,11 +28,8 @@ import org.apache.derby.iapi.error.StandardException;", "removed": [ "import org.apache.derby.iapi.services.monitor.Monitor;", "import org.apache.derby.iapi.services.stream.HeaderPrintWriter;", "import org.apache.derby.iapi.sql.ResultDescription;" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/NoPutResultSetImpl.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.services.monitor.Monitor;", "import org.apache.derby.iapi.services.stream.HeaderPrintWriter;", "import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;" ], "header": "@@ -25,10 +25,12 @@ import org.apache.derby.iapi.error.StandardException;", "removed": [ "import org.apache.derby.iapi.services.loader.GeneratedMethod;" ] }, { "added": [ "\t\t\t/*", "\t\t\t** If run time statistics tracing is turned on, then now is the", "\t\t\t** time to dump out the information.", "\t\t\t*/", "\t\t\tLanguageConnectionContext lcc = getLanguageConnectionContext();", "\t\t\tif (lcc.getRunTimeStatisticsMode())", "\t\t\t{", "\t\t\t\tendExecutionTime = getCurrentTimeMillis();", "", "\t\t\t\tlcc.setRunTimeStatisticsObject(", "\t\t\t\t\tlcc.getExecutionContext().getResultSetStatisticsFactory().getRunTimeStatistics(activation, this, subqueryTrackingArray));", "", "\t\t\t\tHeaderPrintWriter istream = lcc.getLogQueryPlan() ? Monitor.getStream() : null;", "\t\t\t\tif (istream != null)", "\t\t\t\t{", "\t\t\t\t\tistream.printlnWithHeader(LanguageConnectionContext.xidStr + ", "\t\t\t\t\t\t\t\t\t\t\t lcc.getTransactionExecute().getTransactionIdString() +", "\t\t\t\t\t\t\t\t\t\t\t \"), \" +", "\t\t\t\t\t\t\t\t\t\t\t LanguageConnectionContext.lccStr +", "\t\t\t\t\t\t\t\t\t\t\t lcc.getInstanceNumber() +", "\t\t\t\t\t\t\t\t\t\t\t \"), \" +", "\t\t\t\t\t\t\t\t\t\t\t lcc.getRunTimeStatisticsObject().getStatementText() + \" ******* \" +", "\t\t\t\t\t\t\t\t\t\t\t lcc.getRunTimeStatisticsObject().getStatementExecutionPlanText());", "\t\t\t\t}", "\t\t\t}", "" ], "header": "@@ -136,6 +138,32 @@ extends BasicNoPutResultSetImpl", "removed": [] } ] } ]
derby-DERBY-3038-1c709640
DERBY-3038 SYSCS_IMPORT_TABLE FAILS with No current connection after shutdown/reconnect to encrypted database : 10.3.1.4 regression Patch DERBY-3038-2, will merge into 10.3 branch too. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@574733 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-304-c10c4049
DERBY-304 submitted on behalf of Suresh Thalamati Fix : 1) Do not allow backup path to be any derby database directory. A directory is assumed to be a derby database directory if it has service.properties file in it. 2) copy files needed from the database home into the backup one by one instead of recursive copy from the top directory. 3) while copying the directories under jar directory, copy each sub directory separately without copying any subdirectories under them (There should not be any unless if user has created explicitly or created backup at that location). 4) Log and Seg0 directory are NOT already copied recursively, this was changed as part of online backup work (DERBY-239). git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@379620 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/services/io/FileUtil.java", "hunks": [ { "added": [ " return copyDirectory( storageFactory, from, to, null, null, true);", "", " String[] filter, ", " boolean copySubDirs)" ], "header": "@@ -223,14 +223,16 @@ nextFile:\tfor (int i = 0; i < list.length; i++) {", "removed": [ " return copyDirectory( storageFactory, from, to, null, null);", " String[] filter)" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/JarDDL.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.store.access.FileResource;" ], "header": "@@ -25,6 +25,7 @@ import org.apache.derby.iapi.error.StandardException;", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/store/raw/RawStore.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.store.access.FileResource;" ], "header": "@@ -39,6 +39,7 @@ import org.apache.derby.iapi.services.i18n.MessageService;", "removed": [] }, { "added": [], "header": "@@ -98,17 +99,6 @@ import java.security.PrivilegedExceptionAction;", "removed": [ " ", " // files that should not be copied into the backup using simple ", " // directory copy or not needed in the backup at all. ", "\tprivate static final String[] BACKUP_FILTER =", "\t{ DataFactory.TEMP_SEGMENT_NAME, // not required to be in the backup", " DataFactory.DB_LOCKFILE_NAME, // not required to be in the backup", " DataFactory.DB_EX_LOCKFILE_NAME, // not required to be in the backup", " LogFactory.LOG_DIRECTORY_NAME, // written to the backup using log factory", " \"seg0\" // written to the backup using data factory", " };", "" ] }, { "added": [ " private boolean actionCopySubDirs;", " private static final int STORAGE_FILE_LIST_DIRECTORY_ACTION = 13;", " private static final int COPY_STORAGE_FILE_TO_REGULAR_ACTION = 14;", "" ], "header": "@@ -144,10 +134,13 @@ public final class RawStore implements RawStoreFactory, ModuleControl, ModuleSup", "removed": [ " " ] }, { "added": [ "", " // check if a user has given the backup as a database directory by", " // mistake, backup path can not be a derby database directory. ", " // If a directory contains PersistentService.PROPERTIES_NAME, it ", " // is assumed as derby database directory because derby databases", " // always has this file. ", " ", " if (privExists(new File(backupDir, PersistentService.PROPERTIES_NAME))) { ", " throw StandardException.newException(", " SQLState.RAWSTORE_CANNOT_BACKUP_INTO_DATABASE_DIRECTORY,", " (File) backupDir); ", " }" ], "header": "@@ -579,6 +572,18 @@ public final class RawStore implements RawStoreFactory, ModuleControl, ModuleSup", "removed": [] }, { "added": [ " // create the backup database directory", " if (!privMkdirs(backupcopy))", " throw StandardException.newException(", " SQLState.RAWSTORE_CANNOT_CREATE_BACKUP_DIRECTORY,", " (File) backupcopy);", " // if they are any jar file stored in the database, copy them into", " // the backup. ", " StorageFile jarDir = ", " storageFactory.newStorageFile(FileResource.JAR_DIRECTORY_NAME);", " if (privExists(jarDir)) {", "", " // find the list of schema directories under the jar dir and", " // then copy only the plain files under those directories. One could", " // just use the recursive copy of directory to copy all the files", " // under the jar dir, but the problem with that is if a user ", " // gives jar directory as the backup path by mistake, copy will ", " // fail while copying the backup dir onto itself in recursion", "", " String [] jarSchemaList = privList(jarDir);", " File backupJarDir = new File(backupcopy, ", " FileResource.JAR_DIRECTORY_NAME);", " // Create the backup jar directory", " if (!privMkdirs(backupJarDir))", " {", " throw StandardException.newException(", " SQLState.RAWSTORE_CANNOT_CREATE_BACKUP_DIRECTORY,", " (File) backupJarDir);", " }", " for (int i = 0; i < jarSchemaList.length; i++)", " {", " StorageFile jarSchemaDir = ", " storageFactory.newStorageFile(jarDir, jarSchemaList[i]);", " File backupJarSchemaDir = new File(backupJarDir, jarSchemaList[i]);", " if (!privCopyDirectory(jarSchemaDir, backupJarSchemaDir, ", " (byte[])null, null, false)) {", " throw StandardException.", " newException(SQLState.RAWSTORE_ERROR_COPYING_FILE,", " jarSchemaDir, backupJarSchemaDir); ", " }", " }", " }", " // save service properties into the backup, Read in property ", " // from service.properties file, remove logDevice from it, ", " // then write it to the backup.", " StorageFile logdir = logFactory.getLogDirectory();", " ", " try {", " ", " String name = Monitor.getMonitor().getServiceName(this);", " PersistentService ps = Monitor.getMonitor().getServiceType(this);", " String fullName = ps.getCanonicalServiceName(name);", " Properties prop = ps.getServiceProperties(fullName, (Properties)null);", " StorageFile defaultLogDir = ", " storageFactory.newStorageFile( LogFactory.LOG_DIRECTORY_NAME);", "", " if (!logdir.equals(defaultLogDir)) ", " {", " prop.remove(Attribute.LOG_DEVICE);", " if (SanityManager.DEBUG)", " SanityManager.ASSERT(prop.getProperty(Attribute.LOG_DEVICE) == null,", " \"cannot get rid of logDevice property\");", " logHistory(historyFile,", " MessageService.getTextMessage(", " MessageId.STORE_EDITED_SERVICEPROPS));", " }", " ", " // save the service properties into the backup.", " ps.saveServiceProperties( backupcopy.getPath(), prop, false);", " }catch(StandardException se) {", " logHistory(historyFile,", " MessageService.getTextMessage(", " MessageId.STORE_ERROR_EDIT_SERVICEPROPS)", " + se);", " return; // skip the rest and let finally block clean up", " }", " // Incase of encrypted database and the key is an external ", " // encryption key, there is an extra file with name ", " // Attribute.CRYPTO_EXTERNAL_KEY_VERIFY_FILE , this file should be", " // copied in to the backup.", " StorageFile verifyKeyFile = ", " storageFactory.newStorageFile(", " Attribute.CRYPTO_EXTERNAL_KEY_VERIFY_FILE);", " if (privExists(verifyKeyFile)) {", " File backupVerifyKeyFile = ", " new File(backupcopy, Attribute.CRYPTO_EXTERNAL_KEY_VERIFY_FILE);", " if(!privCopyFile(verifyKeyFile, backupVerifyKeyFile))", " throw StandardException.", " newException(SQLState.RAWSTORE_ERROR_COPYING_FILE,", " verifyKeyFile, backupVerifyKeyFile); ", " }", " " ], "header": "@@ -638,61 +643,107 @@ public final class RawStore implements RawStoreFactory, ModuleControl, ModuleSup", "removed": [ "", " // copy the files that does not need any special handling and are ", " // needed to be in the database directory to the backup directory. ", " // See BACKUP_FILTER for all the files that are not copied ", " // to the database directory by the call below. After this copy ", " // information from log(transaction log), seg0(data segment) has ", " // to be copied into the backup from the database.", "\t\t\t", " if (!privCopyDirectory(dbase, backupcopy, (byte[])null, BACKUP_FILTER))", " throw StandardException.", " newException(SQLState.RAWSTORE_ERROR_COPYING_FILE,", " dbase, backupcopy);", "\t\t\t", "\t\t\tStorageFile logdir = logFactory.getLogDirectory();", "", "\t\t\t// munge service.properties file if necessary", "\t\t\tStorageFile defaultLogDir = storageFactory.newStorageFile( LogFactory.LOG_DIRECTORY_NAME);", "\t\t\tif (!logdir.equals(defaultLogDir))", "\t\t\t{", "\t\t\t\t// Read in property from service.properties file, remove", "\t\t\t\t// logDevice from it, then write it out again.", "\t\t\t\ttry", "\t\t\t\t{", "\t\t\t\t\tString name = Monitor.getMonitor().getServiceName(this);", "\t\t\t\t\tPersistentService ps = Monitor.getMonitor().getServiceType(this);", "\t\t\t\t\tString fullName = ps.getCanonicalServiceName(name);", "\t\t\t\t\tProperties prop = ps.getServiceProperties(fullName, (Properties)null);", "\t\t\t\t\tprop.remove(Attribute.LOG_DEVICE);", "\t\t\t\t\tif (SanityManager.DEBUG)", "\t\t\t\t\t\tSanityManager.ASSERT(prop.getProperty(Attribute.LOG_DEVICE) == null,", "\t\t\t\t\t\t\t\t\t\t\t \"cannot get rid of logDevice property\");", "\t\t\t\t\tps.saveServiceProperties( backupcopy.getCanonicalPath(), prop, true);", "\t\t\t\t\tlogHistory(historyFile,", " MessageService.getTextMessage(", " MessageId.STORE_EDITED_SERVICEPROPS));", "\t\t\t\t}", "\t\t\t\tcatch(StandardException se)", "\t\t\t\t{", "\t\t\t\t\tlogHistory(historyFile,", " MessageService.getTextMessage(", " MessageId.STORE_ERROR_EDIT_SERVICEPROPS)", " + se);", "\t\t\t\t\treturn; // skip the rest and let finally block clean up", "\t\t\t\t}", "\t\t\t}" ] }, { "added": [ "\t\treturn privCopyDirectory(from, to, (byte[])null, ", " (String[])null, true);" ], "header": "@@ -1124,7 +1175,8 @@ public final class RawStore implements RawStoreFactory, ModuleControl, ModuleSup", "removed": [ "\t\treturn privCopyDirectory(from, to, (byte[])null, (String[])null);" ] }, { "added": [ " private synchronized boolean privCopyDirectory(StorageFile from, ", " File to, ", " byte[] buffer, ", " String[] filter,", " boolean copySubdirs)", " actionCopySubDirs = copySubdirs;" ], "header": "@@ -1297,13 +1349,18 @@ public final class RawStore implements RawStoreFactory, ModuleControl, ModuleSup", "removed": [ " private synchronized boolean privCopyDirectory( StorageFile from, File to, byte[] buffer, String[] filter)" ] }, { "added": [ " private synchronized boolean privCopyFile( StorageFile from, File to)", " {", " actionCode = COPY_STORAGE_FILE_TO_REGULAR_ACTION;", " actionStorageFile = from;", " actionRegularFile = to;", "", " try", " {", " Object ret = AccessController.doPrivileged( this);", " return ((Boolean) ret).booleanValue();", " }", " catch( PrivilegedActionException pae) { return false;} // does not throw an exception", " finally", " {", " actionStorageFile = null;", " actionRegularFile = null;", " }", " }", "", "" ], "header": "@@ -1364,6 +1421,26 @@ public final class RawStore implements RawStoreFactory, ModuleControl, ModuleSup", "removed": [] }, { "added": [ " private synchronized String[] privList(final StorageFile file)", " {", " actionCode = STORAGE_FILE_LIST_DIRECTORY_ACTION;", " actionStorageFile = file;", "", " try", " {", " return (String[]) AccessController.doPrivileged( this);", " }", " catch( PrivilegedActionException pae) { return null;} // does not throw an exception", " finally", " {", " actionStorageFile = null;", " }", " }", " ", "" ], "header": "@@ -1380,6 +1457,23 @@ public final class RawStore implements RawStoreFactory, ModuleControl, ModuleSup", "removed": [] }, { "added": [ " actionFilter,", " actionCopySubDirs));" ], "header": "@@ -1420,7 +1514,8 @@ public final class RawStore implements RawStoreFactory, ModuleControl, ModuleSup", "removed": [ " actionFilter));" ] } ] } ]
derby-DERBY-3041-c06280c2
DERBY-3041 (partial) Removed the classes utilMain14 and Main14. utilMain14.createStatement() was moved to utilMain. utilMain.setHoldability() and utilMain.getHoldability() were removed since they serve no purpose now that we don't support Java 1.3. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@572058 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/tools/org/apache/derby/impl/tools/ij/ijException.java", "hunks": [ { "added": [], "header": "@@ -59,7 +59,6 @@ public class ijException extends RuntimeException {", "removed": [ "\tprivate final static String HoldCursorsNotSupported = \"IJ_HoldCursAre4\";" ] } ] }, { "file": "java/tools/org/apache/derby/impl/tools/ij/utilMain.java", "hunks": [ { "added": [ " private static final String JDBC_NOTSUPPORTED =", " \"JDBC 3 method called - not yet supported\";", "" ], "header": "@@ -57,6 +57,9 @@ import java.sql.PreparedStatement;", "removed": [] }, { "added": [], "header": "@@ -656,50 +659,6 @@ public class utilMain implements java.security.PrivilegedAction {", "removed": [ "\t// JDBC 2.0 support", "", "", "\t/**", "\t * Connections by default create ResultSet objects with holdability true. This method can be used", "\t * to change the holdability of the connection by passing one of ResultSet.HOLD_CURSORS_OVER_COMMIT", "\t * or ResultSet.CLOSE_CURSORS_AT_COMMIT.", "\t *", "\t * @param conn\t\t\tThe connection.", "\t * @param holdType\tThe new holdability for the Connection object.", "\t *", "\t * @return\tThe connection object with holdability set to passed value.", "\t */", "\tConnection setHoldability(Connection conn, int holdType)", "\t\tthrows SQLException", "\t{", " //Prior to db2 compatibility work, the default holdability for connections was close cursors over commit and all the tests", " //were written based on that assumption", " //Later, as part of db2 compatibility, we changed the default holdability for connection to hold cursors over commit.", " //But in order for the existing tests to work fine, the tests needed a way to set the holdability to close cursors for connections", " conn.setHoldability(ResultSet.CLOSE_CURSORS_AT_COMMIT);", " return conn;", "\t}", "", "\t/**", "\t * Retrieves the current holdability of ResultSet objects created using this", "\t * Connection object.", "\t *", "\t * @return The holdability, one of ResultSet.HOLD_CURSORS_OVER_COMMIT", "\t * or ResultSet.CLOSE_CURSORS_AT_COMMIT", "\t *", "\t */", "\tint getHoldability(Connection conn)", "\t\tthrows SQLException", "\t{", " //this method is used to make sure we are not trying to create a statement with holdability different than the connection holdability", " //This is because jdk13 and lower does not have support for that.", " //The holdability of connection and statement can differ if connection holdability is set to close cursor on commit using reflection", " //and statement is getting created with holdability true", " //Another instance of holdability of connection and statement not being same is when connection holdability is hold cursor", " //over commit and statement is being created with holdability false", " return conn.getHoldability();", "\t}", "" ] } ] }, { "file": "java/tools/org/apache/derby/tools/ij.java", "hunks": [ { "added": [], "header": "@@ -21,7 +21,6 @@", "removed": [ "import org.apache.derby.iapi.services.info.JVMInfo;" ] }, { "added": [ " Main.main(args);" ], "header": "@@ -57,19 +56,7 @@ public class ij {", "removed": [ "", "\t /* We decide which verion of ij (2.0 or 4.0) to", "\t * load based on the same criteria that the JDBC driver", "\t * uses.", "\t */", "\t if (JVMInfo.JDK_ID == JVMInfo.J2SE_13)", "\t {", "\t\t Main.main(args);", "\t }", "\t else", "\t {", "\t\t org.apache.derby.impl.tools.ij.Main14.main(args);", "\t }" ] }, { "added": [ "\t Main ijE = new Main(false);" ], "header": "@@ -101,20 +88,7 @@ public class ij {", "removed": [ "\t Main ijE;", "\t if (JVMInfo.JDK_ID == JVMInfo.J2SE_13)", "\t {", "\t\t ijE = new Main(false);", "\t }", "\t else", "\t {", "\t\t // temp - allow ij to continue to work under jdk131", "\t\t // will resolve as part of DEBRY-1609", "\t\t // jdk13 gets error loading Main14 due to the", "\t\t // class now being built with the jdk14 target flag.", "\t\t // ijE = new org.apache.derby.impl.tools.ij.Main14(false);", "\t\t ijE = new Main(false);", "\t }\t " ] } ] } ]
derby-DERBY-3041-ccf72fbf
DERBY-3041: Removed the createStatement() method in utilMain and factored out common error checks in operations on scrollable cursors. These changes also removed workarounds for problems in very old versions of WebLogic and JCC. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@572244 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/tools/org/apache/derby/impl/tools/ij/utilMain.java", "hunks": [ { "added": [], "header": "@@ -21,8 +21,6 @@", "removed": [ "import org.apache.derby.iapi.reference.JDBC20Translation;", "" ] }, { "added": [], "header": "@@ -39,8 +37,6 @@ import java.io.FileInputStream;", "removed": [ "import java.security.AccessController;", "import java.security.PrivilegedAction;" ] }, { "added": [], "header": "@@ -57,9 +53,6 @@ import java.sql.PreparedStatement;", "removed": [ " private static final String JDBC_NOTSUPPORTED =", " \"JDBC 3 method called - not yet supported\";", "" ] }, { "added": [], "header": "@@ -85,8 +78,6 @@ public class utilMain implements java.security.PrivilegedAction {", "removed": [ "\tprotected boolean isJCC;\t//The driver being used is JCC", "" ] }, { "added": [], "header": "@@ -125,14 +116,6 @@ public class utilMain implements java.security.PrivilegedAction {", "removed": [ "\t\tString framework_property = util.getSystemProperty(\"framework\");", "\t\t", "\t\tif (framework_property != null)", "\t\t{", "\t\t\tif (framework_property.equals(\"DB2jNet\") ", "\t\t\t\t\t|| framework_property.equals(\"DB2jcc\"))", "\t\t\t\tisJCC = true;", "\t\t}" ] }, { "added": [ " /**", " * Check that the cursor is scrollable.", " *", " * @param rs the ResultSet to check", " * @param operation which operation this is checked for", " * @exception ijException if the cursor isn't scrollable", " * @exception SQLException if a database error occurs", " */", " private void checkScrollableCursor(ResultSet rs, String operation)", " throws ijException, SQLException {", " if (rs.getType() == ResultSet.TYPE_FORWARD_ONLY) {", " throw ijException.forwardOnlyCursor(operation);" ], "header": "@@ -659,38 +642,18 @@ public class utilMain implements java.security.PrivilegedAction {", "removed": [ "\t/**", "\t * Create the right kind of statement (scrolling or not)", "\t * off of the specified connection.", "\t *", "\t * @param conn\t\t\tThe connection.", "\t * @param scrollType\tThe scroll type of the cursor.", "\t *", "\t * @return\tThe statement.", "\t */", "\tStatement createStatement(Connection conn, int scrollType, int holdType)", "\t\tthrows SQLException", "\t{", " try {", " return conn.createStatement(", " scrollType, ResultSet.CONCUR_READ_ONLY, holdType);", " } catch(SQLException se) {", " // since jcc doesn't yet support JDBC3.0 we have to go back to", " // JDBC2.0", " if (isJCC && se.getMessage().equals(JDBC_NOTSUPPORTED)) {", " return conn.createStatement(scrollType,", " ResultSet.CONCUR_READ_ONLY);", " }", " throw se;", " } catch(AbstractMethodError ame) {", " // because weblogic 4.5 doesn't yet implement jdbc 2.0 interfaces,", " // we need to go back to jdbc 1.x functionality", " // The jcc obfuscated jar gets this error", " if (isJCC) {", " return conn.createStatement(scrollType,", " ResultSet.CONCUR_READ_ONLY);", " }", " return conn.createStatement();" ] }, { "added": [ " checkScrollableCursor(rs, \"ABSOLUTE\");" ], "header": "@@ -709,13 +672,7 @@ public class utilMain implements java.security.PrivilegedAction {", "removed": [ " boolean forwardOnly = (rs.getStatement().getResultSetType() == JDBC20Translation.TYPE_FORWARD_ONLY);", "", " if (forwardOnly)", "\t\t{", "\t\t\tthrow ijException.forwardOnlyCursor(\"ABSOLUTE\");", "\t\t}", "" ] }, { "added": [ " checkScrollableCursor(rs, \"RELATIVE\");" ], "header": "@@ -735,14 +692,7 @@ public class utilMain implements java.security.PrivilegedAction {", "removed": [ " \tboolean forwardOnly = (rs.getStatement().getResultSetType() == JDBC20Translation.TYPE_FORWARD_ONLY);", "", " \t// relative is only allowed on scroll cursors", "\t\tif (forwardOnly)", "\t\t{", "\t\t\tthrow ijException.forwardOnlyCursor(\"RELATIVE\");", "\t\t}", "" ] }, { "added": [ " checkScrollableCursor(rs, \"BEFORE FIRST\");" ], "header": "@@ -760,14 +710,7 @@ public class utilMain implements java.security.PrivilegedAction {", "removed": [ " \tboolean forwardOnly = (rs.getStatement().getResultSetType() == JDBC20Translation.TYPE_FORWARD_ONLY);", "", " \t// before first is only allowed on scroll cursors", "\t\tif (forwardOnly)", "\t\t{", "\t\t\tthrow ijException.forwardOnlyCursor(\"BEFORE FIRST\");", "\t\t}", "" ] }, { "added": [ " checkScrollableCursor(rs, \"FIRST\");" ], "header": "@@ -786,14 +729,7 @@ public class utilMain implements java.security.PrivilegedAction {", "removed": [ " \tboolean forwardOnly = (rs.getStatement().getResultSetType() == JDBC20Translation.TYPE_FORWARD_ONLY);", "", " \t// first is only allowed on scroll cursors", "\t\tif (forwardOnly)", "\t\t{", "\t\t\tthrow ijException.forwardOnlyCursor(\"FIRST\");", "\t\t}", "" ] }, { "added": [ " checkScrollableCursor(rs, \"AFTER LAST\");" ], "header": "@@ -811,20 +747,7 @@ public class utilMain implements java.security.PrivilegedAction {", "removed": [ " \tboolean forwardOnly;", " try {", " \tforwardOnly = (rs.getStatement().getResultSetType() == JDBC20Translation.TYPE_FORWARD_ONLY);", " } catch (AbstractMethodError ame) {", " //because weblogic 4.5 doesn't yet implement jdbc 2.0 interfaces, need to go back", " //to jdbc 1.x functionality", " forwardOnly = true;", " }", "\t\t// after last is only allowed on scroll cursors", "\t\tif (forwardOnly)", "\t\t{", "\t\t\tthrow ijException.forwardOnlyCursor(\"AFTER LAST\");", "\t\t}", "" ] }, { "added": [ " checkScrollableCursor(rs, \"LAST\");" ], "header": "@@ -843,14 +766,7 @@ public class utilMain implements java.security.PrivilegedAction {", "removed": [ " \tboolean forwardOnly = (rs.getStatement().getResultSetType() == JDBC20Translation.TYPE_FORWARD_ONLY);", "", "\t\t// last is only allowed on scroll cursors", "\t\tif (forwardOnly)", "\t\t{", "\t\t\tthrow ijException.forwardOnlyCursor(\"LAST\");", "\t\t}", "" ] }, { "added": [ " checkScrollableCursor(rs, \"PREVIOUS\");" ], "header": "@@ -868,14 +784,7 @@ public class utilMain implements java.security.PrivilegedAction {", "removed": [ " \tboolean forwardOnly = (rs.getStatement().getResultSetType() == JDBC20Translation.TYPE_FORWARD_ONLY);", " ", " \t// first is only allowed on scroll cursors", "\t\tif (forwardOnly)", "\t\t{", "\t\t\tthrow ijException.forwardOnlyCursor(\"PREVIOUS\");", "\t\t}", "" ] }, { "added": [ " checkScrollableCursor(rs, \"GETCURRENTROWNUMBER\");" ], "header": "@@ -892,15 +801,7 @@ public class utilMain implements java.security.PrivilegedAction {", "removed": [ "", "\t\tboolean forwardOnly = (rs.getStatement().getResultSetType() == JDBC20Translation.TYPE_FORWARD_ONLY);", "", "\t\t// getCurrentRow is only allowed on scroll cursors", "\t\tif (forwardOnly)", "\t\t{", "\t\t\tthrow ijException.forwardOnlyCursor(\"GETCURRENTROWNUMBER\");", "\t\t}", "" ] } ] } ]
derby-DERBY-3042-65241d51
DERBY-3042: Remove Java 1.3 specific code in NetworkServerControlImpl.setUpSocket() Removed the workaround since the network server does not run under Java 1.3 any more. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@572001 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java", "hunks": [ { "added": [ "\t\t\t\t\t\t\t\t\t\t\t\tcreateSocket(hostAddress, portNumber);", "\t\t\t\t\t\t\t\t\t\t\t\tcreateSocket(hostAddress, portNumber);" ], "header": "@@ -2241,27 +2241,17 @@ public final class NetworkServerControlImpl {", "removed": [ "\t\t\t\t\t\t\t\t\t\t// JDK131 can't connect with a client", "\t\t\t\t\t\t\t\t\t\t// socket with 0.0.0.0 (all addresses) so we will", "\t\t\t\t\t\t\t\t\t\t// getLocalHost() which will suffice.", "\t\t\t\t\t\t\t\t\t\tInetAddress connectAddress;", "\t\t\t\t\t\t\t\t\t\tif (JVMInfo.JDK_ID <= JVMInfo.J2SE_13 &&", "\t\t\t\t\t\t\t\t\t\t\thostAddress.getHostAddress().equals(\"0.0.0.0\"))", "\t\t\t\t\t\t\t\t\t\t\tconnectAddress = InetAddress.getLocalHost();", "\t\t\t\t\t\t\t\t\t\telse", "\t\t\t\t\t\t\t\t\t\t\tconnectAddress = hostAddress;", "", "\t\t\t\t\t\t\t\t\t\t\t\tcreateSocket(connectAddress, portNumber);", "\t\t\t\t\t\t\t\t\t\t\t\tcreateSocket(connectAddress, portNumber);" ] }, { "added": [ "\t\t\t\t\t\t\t\t\t\t\t\tcreateSocket(hostAddress, portNumber);" ], "header": "@@ -2269,7 +2259,7 @@ public final class NetworkServerControlImpl {", "removed": [ "\t\t\t\t\t\t\t\t\t\t\t\tcreateSocket(connectAddress, portNumber);" ] } ] } ]
derby-DERBY-3043-a9d71730
DERBY-3043: Schema does not exist error when table uses check constraint In Derby, the CREATE SCHEMA statement is optional. When a table is created, if the schema which contains it does not yet exist, the schema is automatically created as well. If the CREATE TABLE statement contained a CHECK constraint, the statement was being rejected with the error Schema 'XXX' does not exist This error occurred during compilation and bind processing for the check constraint, when the criteria used in the constraint were bound to the table definition. At that point in query processing, the schema name for the table had not yet been filled in, so the bind processing was searching the DataDictionary for a schema which did not yet exist (the schema will exist after the statement is executed, but we're still compiling the statement at this point). This change modifies the bind processing for the CHECK constraint so that the FromBaseTable object used to bind the constraint has the schema name fully filled in, ensuring that the bind processing will be able to manipulate the table without encountering no-such-schema errors. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@705887 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-3046-53d64978
DERBY-3046 This commit fixes the null pointer exception by making sure that we do not try to access the object's elements if the object is null. I have also added a test case for this fix. Additionally, while working on this, I found that we return different sql state for parameter being out of range for PreparedStatment.setObject and Preparedstatement.setXXX calls in Network Server. I have entered a Jira entry for that issue DERBY-3139. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@586596 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-3049-24e3f7e9
DERBY-3049 Remove final traces of language ResultSet.getResultDescription(). Method was being removed as the result description was not specific to the ResultSet and thus was confusing. The ResultDescription is specific to the statement and is available through the activation or prepared plan. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@601395 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/execute/DMLVTIResultSet.java", "hunks": [ { "added": [], "header": "@@ -51,19 +51,9 @@ abstract class DMLVTIResultSet extends DMLWriteResultSet", "removed": [ " ResultDescription \t\tresultDescription;", "\t/**", " * Returns the description of the inserted rows.", " * REVISIT: Do we want this to return NULL instead?", "\t */", "\tpublic ResultDescription getResultDescription()", "\t{", "\t return resultDescription;", "\t}", "" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/DeleteResultSet.java", "hunks": [ { "added": [], "header": "@@ -81,15 +81,6 @@ class DeleteResultSet extends DMLWriteResultSet", "removed": [ "\t/**", " * Returns the description of the deleted rows.", " * REVISIT: Do we want this to return NULL instead?", "\t */", "\tpublic ResultDescription getResultDescription()", "\t{", "\t return resultDescription;", "\t}", "" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/InsertResultSet.java", "hunks": [ { "added": [], "header": "@@ -97,7 +97,6 @@ class InsertResultSet extends DMLWriteResultSet implements TargetResultSet", "removed": [ " private\tResultDescription \t\tresultDescription;" ] }, { "added": [], "header": "@@ -167,15 +166,6 @@ class InsertResultSet extends DMLWriteResultSet implements TargetResultSet", "removed": [ "\t/**", " * Returns the description of the inserted rows.", " * REVISIT: Do we want this to return NULL instead?", "\t */", "\tpublic ResultDescription getResultDescription()", "\t{", "\t return resultDescription;", "\t}", "" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/UpdateResultSet.java", "hunks": [ { "added": [], "header": "@@ -61,7 +61,6 @@ class UpdateResultSet extends DMLWriteResultSet", "removed": [ " private ResultDescription \t\tresultDescription;" ] }, { "added": [], "header": "@@ -97,14 +96,6 @@ class UpdateResultSet extends DMLWriteResultSet", "removed": [ "\t/**", " * Returns the description of the updated rows.", " * REVISIT: Do we want this to return NULL instead?", "\t */", "\tpublic ResultDescription getResultDescription()", "\t{", "\t return resultDescription;", "\t}" ] }, { "added": [ " ResultDescription resultDescription;", "\t\t\tresultDescription = activation.getResultDescription();" ], "header": "@@ -181,8 +172,9 @@ class UpdateResultSet extends DMLWriteResultSet", "removed": [ "\t\t\tresultDescription = source.getResultDescription();" ] } ] } ]
derby-DERBY-3049-4ef86215
DERBY-3049 (partial) Change EmbedResultSet to get a ResultDescription from the activation. Cleanup some ResultSet implementations of getResultDescription() git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@572753 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java", "hunks": [ { "added": [ "\t\tresultDescription = theResults.getActivation().getResultDescription();" ], "header": "@@ -251,7 +251,7 @@ public abstract class EmbedResultSet extends ConnectionChild", "removed": [ "\t\tresultDescription = theResults.getResultDescription();" ] }, { "added": [ " if (columnIndex < 1 || columnIndex > resultDescription.getColumnCount())", "\t\t\t\t\tnew Integer(columnIndex), String.valueOf(resultDescription.getColumnCount()));", " if (resultDescription.getColumnDescriptor(columnIndex).getSourceTableName() == null)", "\t\t\t\t\tresultDescription.getColumnDescriptor(columnIndex).getName()," ], "header": "@@ -2219,20 +2219,19 @@ public abstract class EmbedResultSet extends ConnectionChild", "removed": [ " ResultDescription rd = theResults.getResultDescription();", " if (columnIndex < 1 || columnIndex > rd.getColumnCount())", "\t\t\t\t\tnew Integer(columnIndex), String.valueOf(rd.getColumnCount()));", " if (rd.getColumnDescriptor(columnIndex).getSourceTableName() == null)", "\t\t\t\t\ttheResults.getResultDescription().getColumnDescriptor(columnIndex).getName()," ] }, { "added": [ " for (int i=1; i<=resultDescription.getColumnCount(); i++) { " ], "header": "@@ -3592,12 +3591,11 @@ public abstract class EmbedResultSet extends ConnectionChild", "removed": [ " ResultDescription rd = theResults.getResultDescription();", " for (int i=1; i<=rd.getColumnCount(); i++) { " ] }, { "added": [ " resultDescription.getColumnDescriptor(i).getName()));" ], "header": "@@ -3605,7 +3603,7 @@ public abstract class EmbedResultSet extends ConnectionChild", "removed": [ " rd.getColumnDescriptor(i).getName()));" ] }, { "added": [ " for (int i=1, paramPosition=0; i<=resultDescription.getColumnCount(); i++) { " ], "header": "@@ -3631,7 +3629,7 @@ public abstract class EmbedResultSet extends ConnectionChild", "removed": [ " for (int i=1, paramPosition=0; i<=rd.getColumnCount(); i++) { " ] }, { "added": [ " ", " for (int i=1; i<=resultDescription.getColumnCount(); i++) { //in this for loop we are constructing columnname=?,... part of the update sql", " resultDescription.getColumnDescriptor(i).getName()) + \"=?\");" ], "header": "@@ -3690,15 +3688,14 @@ public abstract class EmbedResultSet extends ConnectionChild", "removed": [ " ResultDescription rd = theResults.getResultDescription();", "", " for (int i=1; i<=rd.getColumnCount(); i++) { //in this for loop we are constructing columnname=?,... part of the update sql", " rd.getColumnDescriptor(i).getName()) + \"=?\");" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/BasicNoPutResultSetImpl.java", "hunks": [ { "added": [], "header": "@@ -90,8 +90,6 @@ implements NoPutResultSet", "removed": [ "\tResultDescription resultDescription;", "" ] }, { "added": [], "header": "@@ -101,7 +99,6 @@ implements NoPutResultSet", "removed": [ "\t * @param resultDescription the result description. May be null." ] }, { "added": [ "\tBasicNoPutResultSetImpl(Activation activation," ], "header": "@@ -109,15 +106,13 @@ implements NoPutResultSet", "removed": [ "\tBasicNoPutResultSetImpl(ResultDescription resultDescription,", "\t\t\t\t\t\t\tActivation activation,", "\t\tthis.resultDescription = resultDescription;" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/NoPutResultSetImpl.java", "hunks": [ { "added": [ "\t\tsuper(activation," ], "header": "@@ -93,8 +93,7 @@ extends BasicNoPutResultSetImpl", "removed": [ "\t\tsuper(null,", "\t\t\t\tactivation," ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/UnionResultSet.java", "hunks": [ { "added": [], "header": "@@ -89,15 +89,6 @@ class UnionResultSet extends NoPutResultSetImpl", "removed": [ "\t/**", " * Returns the description of the first source.", " * Assumes the compiler ensured both sources", " * had the same description.", "\t */", "\tpublic ResultDescription getResultDescription() {", "\t return source1.getResultDescription();", "\t}", "" ] } ] } ]
derby-DERBY-3049-51572c87
DERBY-3049 (partial) Cleanup of some unused fields/variables in ResultSet implementations that leads to some ResultDescription related methods being no longer used and hence removed git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@600678 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/sql/dictionary/DataDescriptorGenerator.java", "hunks": [ { "added": [ "import java.sql.Timestamp;", "import org.apache.derby.catalog.types.ReferencedColumnsDescriptorImpl;", "import org.apache.derby.iapi.error.StandardException;", "import org.apache.derby.iapi.services.io.FormatableBitSet;", "import org.apache.derby.iapi.services.uuid.UUIDFactory;" ], "header": "@@ -21,30 +21,14 @@", "removed": [ "import org.apache.derby.iapi.services.monitor.Monitor;", "import org.apache.derby.iapi.error.StandardException;", "", "import org.apache.derby.iapi.sql.dictionary.*;", "", "import org.apache.derby.iapi.types.TypeId;", "import org.apache.derby.iapi.sql.depend.Dependent;", "import org.apache.derby.iapi.sql.depend.Provider;", "import org.apache.derby.iapi.reference.SQLState;", "import org.apache.derby.iapi.sql.execute.ConstantAction;", "import org.apache.derby.iapi.sql.execute.ExecPreparedStatement;", "import org.apache.derby.iapi.services.uuid.UUIDFactory;", "import org.apache.derby.iapi.services.io.FormatableBitSet;", "import org.apache.derby.catalog.AliasInfo;", "import org.apache.derby.catalog.DefaultInfo;", "import org.apache.derby.catalog.Dependable;", "import org.apache.derby.catalog.DependableFinder;", "import org.apache.derby.catalog.types.ReferencedColumnsDescriptorImpl;", "import org.apache.derby.catalog.Statistics;", "import java.sql.Timestamp;", "import java.io.InputStream;" ] }, { "added": [ " uuidf = dataDictionary.getUUIDFactory();" ], "header": "@@ -68,6 +52,7 @@ public class DataDescriptorGenerator", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/GenericResultDescription.java", "hunks": [ { "added": [ " private transient Map columnNameMap;" ], "header": "@@ -79,7 +79,7 @@ public final class GenericResultDescription", "removed": [ " private Map columnNameMap;" ] }, { "added": [], "header": "@@ -101,31 +101,6 @@ public final class GenericResultDescription", "removed": [ "\t/**", "\t * Build a GenericResultDescription ", "\t *", "\t * @param rd the result description", "\t * @param theCols the columns to take from the input rd", "\t */", "\tpublic GenericResultDescription", "\t(", "\t\tResultDescription\trd, ", "\t\tint[]\t\t\t\ttheCols", "\t) ", "\t{", "\t\tif (SanityManager.DEBUG)", "\t\t{", "\t\t\tSanityManager.ASSERT(theCols != null, \"theCols argument to GenericResultDescription is null\");", "\t\t}", "", "\t\tthis.columns = new ResultColumnDescriptor[theCols.length];", "\t\tfor (int i = 0; i < theCols.length; i++)", "\t\t{", "\t\t\tcolumns[i] = rd.getColumnDescriptor(theCols[i]);", "\t\t}", "\t\tthis.statementType = rd.getStatementType();", "\t}", "" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/DeleteCascadeResultSet.java", "hunks": [ { "added": [], "header": "@@ -59,9 +59,6 @@ class DeleteCascadeResultSet extends DeleteResultSet", "removed": [ "\tprivate CursorResultSet parentSource;", "\tprivate FKInfo parentFKInfo;", "\tprivate long fkIndexConglomNumber;" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/InsertResultSet.java", "hunks": [ { "added": [], "header": "@@ -960,7 +960,6 @@ class InsertResultSet extends DMLWriteResultSet implements TargetResultSet", "removed": [ "\t\t\tResultDescription rd;" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/TriggerEventActivator.java", "hunks": [ { "added": [ "import java.util.Vector;", "import org.apache.derby.catalog.UUID;", "import org.apache.derby.iapi.error.StandardException;", "import org.apache.derby.iapi.jdbc.ConnectionContext;", "import org.apache.derby.iapi.services.sanity.SanityManager;", "import org.apache.derby.iapi.sql.Activation;", "import org.apache.derby.iapi.sql.execute.CursorResultSet;", "import org.apache.derby.iapi.sql.execute.NoPutResultSet;", "class TriggerEventActivator" ], "header": "@@ -21,34 +21,26 @@", "removed": [ "import org.apache.derby.iapi.services.sanity.SanityManager;", "import org.apache.derby.iapi.error.StandardException;", "import org.apache.derby.iapi.sql.execute.CursorResultSet;", "import org.apache.derby.iapi.sql.execute.NoPutResultSet;", "import org.apache.derby.iapi.sql.execute.ExecRow; ", "", "import org.apache.derby.iapi.sql.Activation;", "", "import org.apache.derby.impl.sql.execute.AutoincrementCounter;", "import org.apache.derby.iapi.reference.SQLState;", "import org.apache.derby.iapi.jdbc.ConnectionContext;", "import org.apache.derby.catalog.UUID;", "", "import java.util.Vector;", "import java.sql.SQLException;", "public class TriggerEventActivator", "\tprivate TransactionController \t\t\ttc; " ] }, { "added": [ "\tTriggerEventActivator" ], "header": "@@ -72,7 +64,7 @@ public class TriggerEventActivator", "removed": [ "\tpublic TriggerEventActivator" ] }, { "added": [], "header": "@@ -92,7 +84,6 @@ public class TriggerEventActivator", "removed": [ "\t\tthis.tc = tc;" ] }, { "added": [ "\tvoid notifyEvent" ], "header": "@@ -227,7 +218,7 @@ public class TriggerEventActivator", "removed": [ "\tpublic void notifyEvent" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/UpdateResultSet.java", "hunks": [ { "added": [], "header": "@@ -34,7 +34,6 @@ import org.apache.derby.iapi.services.sanity.SanityManager;", "removed": [ "import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;" ] }, { "added": [], "header": "@@ -93,7 +92,6 @@ class UpdateResultSet extends DMLWriteResultSet", "removed": [ "\tprivate ResultDescription\t\ttriggerResultDescription;" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/WriteCursorConstantAction.java", "hunks": [ { "added": [ "\t** \twritten persistently in stored prepared statements.", " * SO, IT IS OK TO CHANGE ITS read/writeExternal.", " /**", " * Heap conglomerate identifier.", " */" ], "header": "@@ -63,12 +63,14 @@ abstract\tclass WriteCursorConstantAction implements ConstantAction, Formatable", "removed": [ "\t** \twritten persistently in stored prepared statements, ", "\t**\tnot in the replication stage. SO, IT IS OK TO CHANGE", "\t**\tITS read/writeExternal." ] } ] } ]
derby-DERBY-3049-88bb146d
DERBY-3049 (partial) More cleanup related to removing the confusing (language) ResultSet.getResultDescription() method. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@598739 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/execute/DeleteCascadeResultSet.java", "hunks": [ { "added": [ "class DeleteCascadeResultSet extends DeleteResultSet" ], "header": "@@ -53,7 +53,7 @@ import java.util.Enumeration;", "removed": [ "public class DeleteCascadeResultSet extends DeleteResultSet" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/GenericTriggerExecutor.java", "hunks": [ { "added": [ "abstract class GenericTriggerExecutor", "\tfinal InternalTriggerExecutionContext\ttec;", "\tfinal TriggerDescriptor\t\t\t\t\ttriggerd;", "\tfinal Activation\t\t\t\t\t\tactivation;", "\tfinal LanguageConnectionContext\t\t\tlcc;" ], "header": "@@ -38,17 +38,13 @@ import org.apache.derby.iapi.reference.SQLState;", "removed": [ "public abstract class GenericTriggerExecutor", "\tprotected InternalTriggerExecutionContext\ttec;", "\tprotected TriggerDescriptor\t\t\t\t\ttriggerd;", "\tprotected Activation\t\t\t\t\t\tactivation;", "\tprotected LanguageConnectionContext\t\t\tlcc;", "\tprivate\tboolean\t\t\twhenClauseRetrieved;", "\tprivate\tboolean\t\t\tactionRetrieved;", "\tprivate SPSDescriptor\twhenClause; ", "\tprivate SPSDescriptor\taction;" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/InsertResultSet.java", "hunks": [ { "added": [ "\t\t\trowHolder = new TemporaryRowHolderImpl(activation, properties);" ], "header": "@@ -953,8 +953,7 @@ class InsertResultSet extends DMLWriteResultSet implements TargetResultSet", "removed": [ "\t\t\trowHolder = new TemporaryRowHolderImpl(activation, properties,", "\t\t\t\t\t\t\t\t\t\t\t\t resultDescription);" ] }, { "added": [ "\t\t\t\tnew TemporaryRowHolderImpl(activation, properties);" ], "header": "@@ -976,7 +975,7 @@ class InsertResultSet extends DMLWriteResultSet implements TargetResultSet", "removed": [ "\t\t\t\tnew TemporaryRowHolderImpl(activation, properties, rd);" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/TemporaryRowHolderImpl.java", "hunks": [ { "added": [ "" ], "header": "@@ -72,7 +72,7 @@ class TemporaryRowHolderImpl implements TemporaryRowHolder", "removed": [ "\tprivate\tResultDescription\t\tresultDescription;" ] }, { "added": [ "\tTemporaryRowHolderImpl", "\t\tProperties \t\t\t\tproperties", "\t\tthis(activation, properties," ], "header": "@@ -103,17 +103,14 @@ class TemporaryRowHolderImpl implements TemporaryRowHolder", "removed": [ "\t * @param resultDescription the result description. Relevant for the getResultDescription", "\t * \t\tcall on the result set returned by getResultSet. May be null", "\tpublic TemporaryRowHolderImpl", "\t\tProperties \t\t\t\tproperties, ", "\t\tResultDescription\t\tresultDescription", "\t\tthis(activation, properties, resultDescription," ] }, { "added": [ "\tTemporaryRowHolderImpl", "\t\tthis(activation, properties, 1, isUniqueStream," ], "header": "@@ -124,19 +121,16 @@ class TemporaryRowHolderImpl implements TemporaryRowHolder", "removed": [ "\t * @param resultDescription the result description. Relevant for the getResultDescription", "\t * \t\tcall on the result set returned by getResultSet. May be null", "\tpublic TemporaryRowHolderImpl", "\t\tResultDescription\t\tresultDescription,", "\t\tthis(activation, properties, resultDescription, 1, isUniqueStream," ] }, { "added": [ "\tTemporaryRowHolderImpl" ], "header": "@@ -147,17 +141,14 @@ class TemporaryRowHolderImpl implements TemporaryRowHolder", "removed": [ "\t * @param resultDescription the result description. Relevant for the getResultDescription", "\t * \t\tcall on the result set returned by getResultSet. May be null", "\tpublic TemporaryRowHolderImpl", "\t\tResultDescription\t\tresultDescription," ] }, { "added": [], "header": "@@ -176,7 +167,6 @@ class TemporaryRowHolderImpl implements TemporaryRowHolder", "removed": [ "\t\tthis.resultDescription = resultDescription;" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/TemporaryRowHolderResultSet.java", "hunks": [ { "added": [], "header": "@@ -57,7 +57,6 @@ class TemporaryRowHolderResultSet implements CursorResultSet, NoPutResultSet, Cl", "removed": [ "\tprivate ResultDescription\t\tresultDescription;" ] }, { "added": [ "\tTemporaryRowHolderResultSet", "\t\tthis(tc, rowArray, isVirtualMemHeap, false, 0, holder);" ], "header": "@@ -73,19 +72,17 @@ class TemporaryRowHolderResultSet implements CursorResultSet, NoPutResultSet, Cl", "removed": [ "\t * @param resultDescription value returned by getResultDescription()", "\tpublic TemporaryRowHolderResultSet", "\t\tResultDescription\t\t\tresultDescription,", "\t\tthis(tc, rowArray, resultDescription, isVirtualMemHeap, false, 0, holder);" ] }, { "added": [ "\tTemporaryRowHolderResultSet" ], "header": "@@ -95,16 +92,14 @@ class TemporaryRowHolderResultSet implements CursorResultSet, NoPutResultSet, Cl", "removed": [ "\t * @param resultDescription value returned by getResultDescription()", "\tpublic TemporaryRowHolderResultSet", "\t\tResultDescription\t\t\tresultDescription," ] }, { "added": [], "header": "@@ -113,7 +108,6 @@ class TemporaryRowHolderResultSet implements CursorResultSet, NoPutResultSet, Cl", "removed": [ "\t\tthis.resultDescription = resultDescription;" ] }, { "added": [ "\tstatic TemporaryRowHolderResultSet getNewRSOnCurrentRow", "\t\t\tnew TemporaryRowHolderImpl(activation, null);" ], "header": "@@ -178,15 +172,14 @@ class TemporaryRowHolderResultSet implements CursorResultSet, NoPutResultSet, Cl", "removed": [ "\tpublic static TemporaryRowHolderResultSet getNewRSOnCurrentRow", "\t\t\tnew TemporaryRowHolderImpl(activation, null,", "\t\t\t\t\t\t\t\t\t rs.getResultDescription());" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/UpdateResultSet.java", "hunks": [ { "added": [ "\t\t\t\t\tnew TemporaryRowHolderImpl(activation, properties);", "\t\t\t\tnew TemporaryRowHolderImpl(activation, properties);" ], "header": "@@ -390,12 +390,10 @@ class UpdateResultSet extends DMLWriteResultSet", "removed": [ "\t\t\t\t\tnew TemporaryRowHolderImpl(activation, properties,", "\t\t\t\t\t\t\t\t\t\t\t triggerResultDescription);", "\t\t\t\tnew TemporaryRowHolderImpl(activation, properties,", "\t\t\t\t\t\t\t\t\t\t triggerResultDescription);" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/UpdateVTIResultSet.java", "hunks": [ { "added": [ "\t\t\t\tnew TemporaryRowHolderImpl(activation, properties);" ], "header": "@@ -98,8 +98,7 @@ class UpdateVTIResultSet extends DMLVTIResultSet", "removed": [ "\t\t\t\tnew TemporaryRowHolderImpl(activation, properties,", "\t\t\t\t\t\t\t\t\t\t resultDescription);" ] } ] } ]
derby-DERBY-3049-c69c8b01
DERBY-4610: Error attempting delete with cascade and triggers Backed out the fix for DERBY-3049 (four commits) using this command: svn merge -c -601395,-600678,-598739,-572753 . Additionally, two import statements that had been removed in later commits had to be reintroduced manually in BasicNoPutResultSetImpl.java and TemporaryRowHolderImpl.java. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@940462 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/sql/dictionary/DataDescriptorGenerator.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.services.monitor.Monitor;", "import org.apache.derby.iapi.error.StandardException;", "", "import org.apache.derby.iapi.sql.dictionary.*;", "", "import org.apache.derby.iapi.types.TypeId;", "import org.apache.derby.iapi.sql.depend.Dependent;", "import org.apache.derby.iapi.sql.depend.Provider;", "import org.apache.derby.iapi.reference.SQLState;", "import org.apache.derby.iapi.sql.execute.ConstantAction;", "import org.apache.derby.iapi.sql.execute.ExecPreparedStatement;", "import org.apache.derby.iapi.services.uuid.UUIDFactory;", "import org.apache.derby.iapi.services.io.FormatableBitSet;", "import org.apache.derby.catalog.AliasInfo;", "import org.apache.derby.catalog.DefaultInfo;", "import org.apache.derby.catalog.Dependable;", "import org.apache.derby.catalog.DependableFinder;", "import org.apache.derby.catalog.UUID;", "import org.apache.derby.catalog.Statistics;", "import java.sql.Timestamp;", "import java.io.InputStream;" ], "header": "@@ -21,14 +21,30 @@", "removed": [ "import java.sql.Timestamp;", "import org.apache.derby.catalog.UUID;", "import org.apache.derby.iapi.error.StandardException;", "import org.apache.derby.iapi.services.io.FormatableBitSet;", "import org.apache.derby.iapi.services.uuid.UUIDFactory;" ] }, { "added": [], "header": "@@ -53,7 +69,6 @@ public class DataDescriptorGenerator", "removed": [ " uuidf = dataDictionary.getUUIDFactory();" ] } ] }, { "file": "java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java", "hunks": [ { "added": [ "\t\tresultDescription = theResults.getResultDescription();" ], "header": "@@ -256,7 +256,7 @@ public abstract class EmbedResultSet extends ConnectionChild", "removed": [ "\t\tresultDescription = theResults.getActivation().getResultDescription();" ] }, { "added": [ " ResultDescription rd = theResults.getResultDescription();", " if (columnIndex < 1 || columnIndex > rd.getColumnCount())", "\t\t\t\t\tnew Integer(columnIndex), String.valueOf(rd.getColumnCount()));", " if (rd.getColumnDescriptor(columnIndex).getSourceTableName() == null)", "\t\t\t\t\ttheResults.getResultDescription().getColumnDescriptor(columnIndex).getName()," ], "header": "@@ -2220,19 +2220,20 @@ public abstract class EmbedResultSet extends ConnectionChild", "removed": [ " if (columnIndex < 1 || columnIndex > resultDescription.getColumnCount())", "\t\t\t\t\tnew Integer(columnIndex), String.valueOf(resultDescription.getColumnCount()));", " if (resultDescription.getColumnDescriptor(columnIndex).getSourceTableName() == null)", "\t\t\t\t\tresultDescription.getColumnDescriptor(columnIndex).getName()," ] }, { "added": [ " ResultDescription rd = theResults.getResultDescription();", " for (int i=1; i<=rd.getColumnCount(); i++) { " ], "header": "@@ -3585,11 +3586,12 @@ public abstract class EmbedResultSet extends ConnectionChild", "removed": [ " for (int i=1; i<=resultDescription.getColumnCount(); i++) { " ] }, { "added": [ " rd.getColumnDescriptor(i).getName()));" ], "header": "@@ -3597,7 +3599,7 @@ public abstract class EmbedResultSet extends ConnectionChild", "removed": [ " resultDescription.getColumnDescriptor(i).getName()));" ] }, { "added": [ " for (int i=1, paramPosition=0; i<=rd.getColumnCount(); i++) { " ], "header": "@@ -3625,7 +3627,7 @@ public abstract class EmbedResultSet extends ConnectionChild", "removed": [ " for (int i=1, paramPosition=0; i<=resultDescription.getColumnCount(); i++) { " ] }, { "added": [ " ResultDescription rd = theResults.getResultDescription();", "", " for (int i=1; i<=rd.getColumnCount(); i++) { //in this for loop we are constructing columnname=?,... part of the update sql", " rd.getColumnDescriptor(i).getName()) + \"=?\");" ], "header": "@@ -3682,14 +3684,15 @@ public abstract class EmbedResultSet extends ConnectionChild", "removed": [ " ", " for (int i=1; i<=resultDescription.getColumnCount(); i++) { //in this for loop we are constructing columnname=?,... part of the update sql", " resultDescription.getColumnDescriptor(i).getName()) + \"=?\");" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/GenericResultDescription.java", "hunks": [ { "added": [ " private Map columnNameMap;" ], "header": "@@ -79,7 +79,7 @@ public final class GenericResultDescription", "removed": [ " private transient Map columnNameMap;" ] }, { "added": [ "\t/**", "\t * Build a GenericResultDescription ", "\t *", "\t * @param rd the result description", "\t * @param theCols the columns to take from the input rd", "\t */", "\tpublic GenericResultDescription", "\t(", "\t\tResultDescription\trd, ", "\t\tint[]\t\t\t\ttheCols", "\t) ", "\t{", "\t\tif (SanityManager.DEBUG)", "\t\t{", "\t\t\tSanityManager.ASSERT(theCols != null, \"theCols argument to GenericResultDescription is null\");", "\t\t}", "", "\t\tthis.columns = new ResultColumnDescriptor[theCols.length];", "\t\tfor (int i = 0; i < theCols.length; i++)", "\t\t{", "\t\t\tcolumns[i] = rd.getColumnDescriptor(theCols[i]);", "\t\t}", "\t\tthis.statementType = rd.getStatementType();", "\t}", "" ], "header": "@@ -101,6 +101,31 @@ public final class GenericResultDescription", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/BasicNoPutResultSetImpl.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.sql.ResultDescription;" ], "header": "@@ -30,6 +30,7 @@ import org.apache.derby.iapi.services.i18n.MessageService;", "removed": [] }, { "added": [ "\tResultDescription resultDescription;", "" ], "header": "@@ -87,6 +88,8 @@ implements NoPutResultSet", "removed": [] }, { "added": [ "\t * @param resultDescription the result description. May be null." ], "header": "@@ -96,6 +99,7 @@ implements NoPutResultSet", "removed": [] }, { "added": [ "\tBasicNoPutResultSetImpl(ResultDescription resultDescription,", "\t\t\t\t\t\t\tActivation activation,", "\t\tthis.resultDescription = resultDescription;" ], "header": "@@ -103,13 +107,15 @@ implements NoPutResultSet", "removed": [ "\tBasicNoPutResultSetImpl(Activation activation," ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/DMLVTIResultSet.java", "hunks": [ { "added": [ " ResultDescription \t\tresultDescription;", "\t/**", " * Returns the description of the inserted rows.", " * REVISIT: Do we want this to return NULL instead?", "\t */", "\tpublic ResultDescription getResultDescription()", "\t{", "\t return resultDescription;", "\t}", "" ], "header": "@@ -51,9 +51,19 @@ abstract class DMLVTIResultSet extends DMLWriteResultSet", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/DeleteCascadeResultSet.java", "hunks": [ { "added": [ "public class DeleteCascadeResultSet extends DeleteResultSet", "\tprivate CursorResultSet parentSource;", "\tprivate FKInfo parentFKInfo;", "\tprivate long fkIndexConglomNumber;" ], "header": "@@ -53,12 +53,15 @@ import java.util.Enumeration;", "removed": [ "class DeleteCascadeResultSet extends DeleteResultSet" ] }, { "added": [ " public DeleteCascadeResultSet" ], "header": "@@ -68,7 +71,7 @@ class DeleteCascadeResultSet extends DeleteResultSet", "removed": [ " DeleteCascadeResultSet" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/DeleteResultSet.java", "hunks": [ { "added": [ "\t/**", " * Returns the description of the deleted rows.", " * REVISIT: Do we want this to return NULL instead?", "\t */", "\tpublic ResultDescription getResultDescription()", "\t{", "\t return resultDescription;", "\t}", "" ], "header": "@@ -81,6 +81,15 @@ class DeleteResultSet extends DMLWriteResultSet", "removed": [] }, { "added": [ "\t\t\tresultDescription = source.getResultDescription();" ], "header": "@@ -121,7 +130,7 @@ class DeleteResultSet extends DMLWriteResultSet", "removed": [ "\t\t\tresultDescription = activation.getResultDescription();" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/GenericTriggerExecutor.java", "hunks": [ { "added": [ "public abstract class GenericTriggerExecutor", "\tprotected InternalTriggerExecutionContext\ttec;", "\tprotected TriggerDescriptor\t\t\t\t\ttriggerd;", "\tprotected Activation\t\t\t\t\t\tactivation;", "\tprotected LanguageConnectionContext\t\t\tlcc;", "\tprivate\tboolean\t\t\twhenClauseRetrieved;", "\tprivate\tboolean\t\t\tactionRetrieved;", "\tprivate SPSDescriptor\twhenClause; ", "\tprivate SPSDescriptor\taction;" ], "header": "@@ -38,13 +38,17 @@ import org.apache.derby.iapi.reference.SQLState;", "removed": [ "abstract class GenericTriggerExecutor", "\tfinal InternalTriggerExecutionContext\ttec;", "\tfinal TriggerDescriptor\t\t\t\t\ttriggerd;", "\tfinal Activation\t\t\t\t\t\tactivation;", "\tfinal LanguageConnectionContext\t\t\tlcc;" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/InsertResultSet.java", "hunks": [ { "added": [ " private\tResultDescription \t\tresultDescription;" ], "header": "@@ -98,6 +98,7 @@ class InsertResultSet extends DMLWriteResultSet implements TargetResultSet", "removed": [] }, { "added": [ "\t/**", " * Returns the description of the inserted rows.", " * REVISIT: Do we want this to return NULL instead?", "\t */", "\tpublic ResultDescription getResultDescription()", "\t{", "\t return resultDescription;", "\t}", "" ], "header": "@@ -167,6 +168,15 @@ class InsertResultSet extends DMLWriteResultSet implements TargetResultSet", "removed": [] }, { "added": [ " resultDescription = sourceResultSet.getResultDescription();" ], "header": "@@ -334,7 +344,7 @@ class InsertResultSet extends DMLWriteResultSet implements TargetResultSet", "removed": [ " ResultDescription resultDescription = activation.getResultDescription();" ] }, { "added": [ "\t\t\trowHolder = new TemporaryRowHolderImpl(activation, properties,", "\t\t\t\t\t\t\t\t\t\t\t\t resultDescription);", "\t\t\tResultDescription rd;" ], "header": "@@ -944,13 +954,15 @@ class InsertResultSet extends DMLWriteResultSet implements TargetResultSet", "removed": [ "\t\t\trowHolder = new TemporaryRowHolderImpl(activation, properties);" ] }, { "added": [ "\t\t\trd = lcc.getLanguageFactory().getResultDescription(resultDescription,columnIndexes);", "\t\t\t\tnew TemporaryRowHolderImpl(activation, properties, rd);" ], "header": "@@ -963,8 +975,9 @@ class InsertResultSet extends DMLWriteResultSet implements TargetResultSet", "removed": [ "\t\t\t\tnew TemporaryRowHolderImpl(activation, properties);" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/NoPutResultSetImpl.java", "hunks": [ { "added": [ "\t\tsuper(null,", "\t\t\t\tactivation," ], "header": "@@ -93,7 +93,8 @@ extends BasicNoPutResultSetImpl", "removed": [ "\t\tsuper(activation," ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/TemporaryRowHolderImpl.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.sql.ResultDescription;" ], "header": "@@ -27,6 +27,7 @@ import org.apache.derby.iapi.sql.execute.CursorResultSet;", "removed": [] }, { "added": [ "\tprivate\tResultDescription\t\tresultDescription;" ], "header": "@@ -68,7 +69,7 @@ class TemporaryRowHolderImpl implements TemporaryRowHolder", "removed": [ "" ] }, { "added": [ "\t * @param resultDescription the result description. Relevant for the getResultDescription", "\t * \t\tcall on the result set returned by getResultSet. May be null", "\tpublic TemporaryRowHolderImpl", "\t\tProperties \t\t\t\tproperties, ", "\t\tResultDescription\t\tresultDescription", "\t\tthis(activation, properties, resultDescription," ], "header": "@@ -99,14 +100,17 @@ class TemporaryRowHolderImpl implements TemporaryRowHolder", "removed": [ "\tTemporaryRowHolderImpl", "\t\tProperties \t\t\t\tproperties", "\t\tthis(activation, properties," ] }, { "added": [ "\t * @param resultDescription the result description. Relevant for the getResultDescription", "\t * \t\tcall on the result set returned by getResultSet. May be null", "\tpublic TemporaryRowHolderImpl", "\t\tResultDescription\t\tresultDescription,", "\t\tthis(activation, properties, resultDescription, 1, isUniqueStream," ], "header": "@@ -117,16 +121,19 @@ class TemporaryRowHolderImpl implements TemporaryRowHolder", "removed": [ "\tTemporaryRowHolderImpl", "\t\tthis(activation, properties, 1, isUniqueStream," ] }, { "added": [ "\t * @param resultDescription the result description. Relevant for the getResultDescription", "\t * \t\tcall on the result set returned by getResultSet. May be null", "\tpublic TemporaryRowHolderImpl", "\t\tResultDescription\t\tresultDescription," ], "header": "@@ -137,14 +144,17 @@ class TemporaryRowHolderImpl implements TemporaryRowHolder", "removed": [ "\tTemporaryRowHolderImpl" ] }, { "added": [ "\t\tthis.resultDescription = resultDescription;" ], "header": "@@ -163,6 +173,7 @@ class TemporaryRowHolderImpl implements TemporaryRowHolder", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/TemporaryRowHolderResultSet.java", "hunks": [ { "added": [ "\tprivate ResultDescription\t\tresultDescription;" ], "header": "@@ -58,6 +58,7 @@ class TemporaryRowHolderResultSet implements CursorResultSet, NoPutResultSet, Cl", "removed": [] }, { "added": [ "\t * @param resultDescription value returned by getResultDescription()", "\tpublic TemporaryRowHolderResultSet", "\t\tResultDescription\t\t\tresultDescription,", "\t\tthis(tc, rowArray, resultDescription, isVirtualMemHeap, false, 0, holder);" ], "header": "@@ -73,17 +74,19 @@ class TemporaryRowHolderResultSet implements CursorResultSet, NoPutResultSet, Cl", "removed": [ "\tTemporaryRowHolderResultSet", "\t\tthis(tc, rowArray, isVirtualMemHeap, false, 0, holder);" ] }, { "added": [ "\t * @param resultDescription value returned by getResultDescription()", "\tpublic TemporaryRowHolderResultSet", "\t\tResultDescription\t\t\tresultDescription," ], "header": "@@ -93,14 +96,16 @@ class TemporaryRowHolderResultSet implements CursorResultSet, NoPutResultSet, Cl", "removed": [ "\tTemporaryRowHolderResultSet" ] }, { "added": [ "\t\tthis.resultDescription = resultDescription;" ], "header": "@@ -109,6 +114,7 @@ class TemporaryRowHolderResultSet implements CursorResultSet, NoPutResultSet, Cl", "removed": [] }, { "added": [ "\tpublic static TemporaryRowHolderResultSet getNewRSOnCurrentRow", "\t\t\tnew TemporaryRowHolderImpl(activation, null,", "\t\t\t\t\t\t\t\t\t rs.getResultDescription());" ], "header": "@@ -178,14 +184,15 @@ class TemporaryRowHolderResultSet implements CursorResultSet, NoPutResultSet, Cl", "removed": [ "\tstatic TemporaryRowHolderResultSet getNewRSOnCurrentRow", "\t\t\tnew TemporaryRowHolderImpl(activation, null);" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/TriggerEventActivator.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.error.StandardException;", "", "import org.apache.derby.iapi.sql.execute.ExecRow; ", "import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;", "import org.apache.derby.iapi.sql.dictionary.TriggerDescriptor;", "", "import org.apache.derby.iapi.sql.Activation;", "", "import org.apache.derby.impl.sql.execute.AutoincrementCounter;", "import org.apache.derby.iapi.reference.SQLState;", "import org.apache.derby.iapi.jdbc.ConnectionContext;", "import org.apache.derby.catalog.UUID;", "", "import java.util.Vector;", "import java.sql.SQLException;", "public class TriggerEventActivator", "\tprivate TransactionController \t\t\ttc; " ], "header": "@@ -21,26 +21,34 @@", "removed": [ "import java.util.Vector;", "", "import org.apache.derby.catalog.UUID;", "import org.apache.derby.iapi.error.StandardException;", "import org.apache.derby.iapi.jdbc.ConnectionContext;", "import org.apache.derby.iapi.sql.Activation;", "import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;", "import org.apache.derby.iapi.sql.dictionary.TriggerDescriptor;", "class TriggerEventActivator" ] }, { "added": [ "\tpublic TriggerEventActivator" ], "header": "@@ -64,7 +72,7 @@ class TriggerEventActivator", "removed": [ "\tTriggerEventActivator" ] }, { "added": [ "\t\tthis.tc = tc;" ], "header": "@@ -84,6 +92,7 @@ class TriggerEventActivator", "removed": [] }, { "added": [ "\tpublic void notifyEvent" ], "header": "@@ -218,7 +227,7 @@ class TriggerEventActivator", "removed": [ "\tvoid notifyEvent" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/UpdateResultSet.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;" ], "header": "@@ -34,6 +34,7 @@ import org.apache.derby.iapi.services.sanity.SanityManager;", "removed": [] }, { "added": [ " private ResultDescription \t\tresultDescription;" ], "header": "@@ -61,6 +62,7 @@ class UpdateResultSet extends DMLWriteResultSet", "removed": [] }, { "added": [ "\tprivate ResultDescription\t\ttriggerResultDescription;", "\t/**", " * Returns the description of the updated rows.", " * REVISIT: Do we want this to return NULL instead?", "\t */", "\tpublic ResultDescription getResultDescription()", "\t{", "\t return resultDescription;", "\t}" ], "header": "@@ -92,11 +94,20 @@ class UpdateResultSet extends DMLWriteResultSet", "removed": [] }, { "added": [ "\t\t\tresultDescription = source.getResultDescription();" ], "header": "@@ -180,9 +191,8 @@ class UpdateResultSet extends DMLWriteResultSet", "removed": [ " ResultDescription resultDescription;", "\t\t\tresultDescription = activation.getResultDescription();" ] }, { "added": [ "\t\t\t\ttriggerResultDescription = (resultDescription != null) ?", "\t\t\t\t\t\t\t\t\tresultDescription.truncateColumns(numberOfBaseColumns+1) :", "\t\t\t\t\t\t\t\t\tnull;" ], "header": "@@ -370,6 +380,9 @@ class UpdateResultSet extends DMLWriteResultSet", "removed": [] }, { "added": [ "\t\t\t\t\tnew TemporaryRowHolderImpl(activation, properties,", "\t\t\t\t\t\t\t\t\t\t\t triggerResultDescription);", "\t\t\t\tnew TemporaryRowHolderImpl(activation, properties,", "\t\t\t\t\t\t\t\t\t\t triggerResultDescription);" ], "header": "@@ -378,10 +391,12 @@ class UpdateResultSet extends DMLWriteResultSet", "removed": [ "\t\t\t\t\tnew TemporaryRowHolderImpl(activation, properties);", "\t\t\t\tnew TemporaryRowHolderImpl(activation, properties);" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/WriteCursorConstantAction.java", "hunks": [ { "added": [ "\t** \twritten persistently in stored prepared statements, ", "\t**\tnot in the replication stage. SO, IT IS OK TO CHANGE", "\t**\tITS read/writeExternal." ], "header": "@@ -63,14 +63,12 @@ abstract\tclass WriteCursorConstantAction implements ConstantAction, Formatable", "removed": [ "\t** \twritten persistently in stored prepared statements.", " * SO, IT IS OK TO CHANGE ITS read/writeExternal.", " /**", " * Heap conglomerate identifier.", " */" ] } ] } ]
derby-DERBY-3056-6c3076f6
DERBY-3056; making test run with JSR169, although not exactly testing what test was designed to test. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@573418 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-3057-af27f3c8
DERBY-3057 - enabling test TableFunctionTest.java to run with j2ME/CDC/JSR169. - adjusted method equals(Object) in junit.JDBC$GeneratedID to implement a similar check for JSR169 as is achieved with String.matches() (which is not available with JSR169) - implemented method BinaryDecimal.setValueFromResultSet() which gets executed by the test (also adjusted javadoc referring to non-existing CDCDecimal) - adjusted test TableFunctionTest to call an appropriate method instead of ResultSet.getBigDecimal() (which is not available with JSR169). git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@575364 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/types/BinaryDecimal.java", "hunks": [ { "added": [ " * BigIntegerDecimal implementation." ], "header": "@@ -36,7 +36,7 @@ import org.apache.derby.iapi.services.sanity.SanityManager;", "removed": [ " * CDCDecimal implementation." ] }, { "added": [ "\t * @return\tA BinaryDecimal containing the result of the addition" ], "header": "@@ -372,7 +372,7 @@ abstract class BinaryDecimal extends NumberDataType", "removed": [ "\t * @return\tA SQLDecimal containing the result of the addition" ] } ] }, { "file": "java/testing/org/apache/derbyTesting/junit/JDBC.java", "hunks": [ { "added": [ " // unless JSR169, use String.matches...", " if (JDBC.vmSupportsJDBC3()) ", " {", " return o instanceof String &&", " }", " else", " {", " String tmpstr = (String)o;", " 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;", " }" ], "header": "@@ -46,8 +46,34 @@ public class JDBC {", "removed": [ " return o instanceof String &&" ] } ] } ]
derby-DERBY-3060-99422a7c
DERBY-3060: Network Server incorrectly assumes that all SQLExceptions with error code 08004 are caused by an authentication failure. Contributed by Jørgen Løland git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@574870 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/drda/org/apache/derby/impl/drda/DRDAConnThread.java", "hunks": [ { "added": [ "\t\t// These tests are ok since DATABASE_NOT_FOUND,", "\t\t// NO_SUCH_DATABASE and AUTH_INVALID_USER_NAME are not", "\t\t// ambigious error codes (on the first five characters) in", "\t\t// SQLState. If they were, we would have to perform a similar", "\t\t// check as done in method isAuthenticationException", "\t\tif (sqlState.regionMatches(0,SQLState.DATABASE_NOT_FOUND,0,5) ||", "\t\t\tsqlState.regionMatches(0,SQLState.NO_SUCH_DATABASE,0,5)) {", "\t\t\t// RDB not found codepoint", "\t\t} else {", "\t\t\tif (isAuthenticationException(databaseAccessException) ||", "\t\t\t\tsqlState.regionMatches(0,SQLState.AUTH_INVALID_USER_NAME,0,5)) {", "\t\t\t\t// Not Authorized To RDB reply message codepoint", "\t\t\t} else {", "\t\t\t\t// RDB Access Failed Reply Message codepoint", " }", " }", " /**", " * There are multiple reasons for not getting a connection, and", " * all these should throw SQLExceptions with SQL state 08004", " * according to the SQL standard. Since only one of these SQL", " * states indicate that an authentication error has occurred, it", " * is not enough to check that the SQL state is 08004 and conclude", " * that authentication caused the exception to be thrown.", " *", " * This method tries to cast the exception to an EmbedSQLException", " * and use getMessageId on that object to check for authentication", " * error instead of the SQL state we get from", " * SQLExceptions#getSQLState. getMessageId returns the entire id", " * as defined in SQLState (e.g. 08004.C.1), while getSQLState only", " * return the 5 first characters (i.e. 08004 instead of 08004.C.1)", " *", " * If the cast to EmbedSQLException is not successful, the", " * assumption that SQL State 08004 is caused by an authentication", " * failure is followed even though this is not correct. This was", " * the pre DERBY-3060 way of solving the issue.", " *", " * @param sqlException The exception that is checked to see if", " * this is really caused by an authentication failure", " * @return true if sqlException is (or has to be assumed to be)", " * caused by an authentication failure, false otherwise.", " * @see SQLState", " */", " private boolean isAuthenticationException (SQLException sqlException) {", " boolean authFail = false;", "", " // get exception which carries Derby messageID and args", " SQLException se = Util.getExceptionFactory().", " getArgumentFerry(sqlException);", "", " if (se instanceof EmbedSQLException) {", " // DERBY-3060: if this is an EmbedSQLException, we can", " // check the messageId to find out what caused the", " // exception.", "", " String msgId = ((EmbedSQLException)se).getMessageId();", "", " // Of the 08004.C.x messages, only", " // SQLState.NET_CONNECT_AUTH_FAILED is an authentication", " // exception", " if (msgId.equals(SQLState.NET_CONNECT_AUTH_FAILED)) {", " authFail = true;", " }", " } else {", " String sqlState = se.getSQLState();", " if (sqlState.regionMatches(0,SQLState.LOGIN_FAILED,0,5)) {", " // Unchanged by DERBY-3060: This is not an", " // EmbedSQLException, so we cannot check the", " // messageId. As before DERBY-3060, we assume that all", " // 08004 error codes are due to an authentication", " // failure, even though this ambigious", " authFail = true;", " }", " }", " return authFail;", " }" ], "header": "@@ -1192,17 +1192,86 @@ class DRDAConnThread extends Thread {", "removed": [ "\t\tif (sqlState.regionMatches(0,SQLState.DATABASE_NOT_FOUND,0,5) |", "\t\t\tsqlState.regionMatches(0,SQLState.NO_SUCH_DATABASE,0,5))", "\t\telse", "\t\t\tif (sqlState.regionMatches(0,SQLState.LOGIN_FAILED,0,5) ||", "\t\t\t\tsqlState.regionMatches(0,SQLState.AUTH_INVALID_USER_NAME,0,5))", "\t\telse" ] }, { "added": [ "" ], "header": "@@ -1275,9 +1344,7 @@ class DRDAConnThread extends Thread {", "removed": [ "\t\t\t// need to set the security check code based on the reason the connection ", "\t\t\t// was denied, Derby doesn't say whether the userid or password caused", "\t\t\t// the problem, so we will just return userid invalid" ] } ] }, { "file": "java/engine/org/apache/derby/jdbc/InternalDriver.java", "hunks": [ { "added": [ " SQLState.NET_CONNECT_AUTH_FAILED,", " MessageService.", " getTextMessage(MessageId.AUTH_INVALID));" ], "header": "@@ -197,7 +197,9 @@ public abstract class InternalDriver implements ModuleControl {", "removed": [ " SQLState.LOGIN_FAILED, MessageService.getTextMessage(MessageId.AUTH_INVALID));" ] } ] } ]
derby-DERBY-3061-70f168c9
DERBY-3061: Fix wrong results regression caused by incorrect sorting of "probe predicates" prior to code generation. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@574635 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/compile/Predicate.java", "hunks": [ { "added": [ "\t\t/* The call to \"isRelationalOpPredicate()\" will return false", "\t\t * for a \"probe predicate\" because a probe predicate is really", "\t\t * a disguised IN list. But when it comes to sorting, the probe", "\t\t * predicate (which is of the form \"<col> = ?\") should be treated", "\t\t * as an equality--i.e. it should have precedence over any non-", "\t\t * equals predicate, per the comment at the start of this", "\t\t * method. So that's what we're checking here.", "\t\t */", "\t\tif (this.isRelationalOpPredicate() || // this is not \"in\" or", "\t\t\tthis.isInListProbePredicate()) // this is a probe predicate" ], "header": "@@ -306,7 +306,16 @@ public final class Predicate extends QueryTreeNode implements OptimizablePredica", "removed": [ "\t\tif (this.isRelationalOpPredicate()) // this is not \"in\"" ] } ] } ]
derby-DERBY-3063-0e86ea34
DERBY-3063: Extend the system function mechanism to support functions with multiple arguments. Added support for system functions with several arguments. Added numberic function ATAN2 (used the one in StrictMath). Patch file: derby-3063-2a.diff git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@694166 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java", "hunks": [ { "added": [ " * This simple table can handle an arbitrary number of arguments", " *[0] = FUNCTION name", " *[1] = RETURNS type", " *[2] = Java class", " *[3] = method name and signature", " *[4..N] = arguments (optional, if not present zero arguments is assumed)", " {\"ATAN2\", \"DOUBLE\", \"java.lang.StrictMath\", \"atan2(double,double)\", \"DOUBLE\", \"DOUBLE\"},", " {\"PI\", \"DOUBLE\", \"org.apache.derby.catalog.SystemProcedures\", \"PI()\"}," ], "header": "@@ -205,24 +205,25 @@ public final class\tDataDictionaryImpl", "removed": [ "\t* This simple table assumes zero or a single parameter", "\t*[0] = FUNCTION name", "\t*[1] = RETURNS type", "\t*[2] = Java class", "\t*[3] = method name and signature", "\t*[4] = parameter type (single parameter) or null for no parameters.", "\t\t\t{\"PI\", \"DOUBLE\", \"org.apache.derby.catalog.SystemProcedures\", \"PI()\", null}," ] }, { "added": [ " {\"RANDOM\", \"DOUBLE\", \"java.lang.StrictMath\", \"random()\"}," ], "header": "@@ -233,7 +234,7 @@ public final class\tDataDictionaryImpl", "removed": [ "\t\t\t{\"RANDOM\", \"DOUBLE\", \"java.lang.StrictMath\", \"random()\", null}," ] }, { "added": [ "", " /**", " * The index of the first parameter in entries in the SYSFUN_FUNCTIONS", " * table. Used to determine the parameter count (zero to many).", " */", " private static final int SYSFUN_FIRST_PARAMETER_INDEX = 4;", "" ], "header": "@@ -241,22 +242,19 @@ public final class\tDataDictionaryImpl", "removed": [ "\t", "\t/**", "\t * Dummy parameter name for functions from SYSFUN_FUNCTIONS.", "\t */", "\tprivate static final String[] SYSFUN_PNAME = {\"P1\"};", "\t", "\t/**", "\t * Parameter mode (IN as required) for functions from SYSFUN_FUNCTIONS.", "\t */\t", "\tprivate static final int[] SYSFUN_PMODE = {JDBC30Translation.PARAMETER_MODE_IN};" ] } ] } ]
derby-DERBY-3068-c0a8467f
DERBY-3068 testImportExportProcedureNegative(org.apache.derbyTesting.functionTests.tests.tools.ImportExportProcedureTest)junit.framework.ComparisonFailure: Unexpected SQL state. expected:<38000> but was:<XIE0S> Changed unexpectedException in import to close the stream first. Changed ImportExportProcedureTest to delete files immediately after the test instead of before the test that recreates the file. Changed deleteFile to fail if it cannot delete the file. Ran suites.All on IBM 1.5 3 times without errors, and on jdk16. There may however still be a problem with import as I did see the unchanged test fail on IBM 1.5. With the new test structure it should be easier to identify the source of the problem if it happens again. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@614893 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/load/ImportAbstract.java", "hunks": [ { "added": [ "import java.io.IOException;" ], "header": "@@ -21,6 +21,7 @@", "removed": [] }, { "added": [ "\t\tthrow importError(ex);" ], "header": "@@ -123,7 +124,7 @@ abstract class ImportAbstract extends VTITemplate {", "removed": [ "\t\tthrow LoadError.unexpectedError(ex);" ] } ] }, { "file": "java/testing/org/apache/derbyTesting/junit/SupportFilesSetup.java", "hunks": [ { "added": [ "import junit.framework.Assert;" ], "header": "@@ -30,6 +30,7 @@ import java.security.AccessController;", "removed": [] }, { "added": [ " public static void deleteFile(final String fileName) ", " AccessController.doPrivileged", " File delFile = new File(fileName);", " if (!delFile.exists())", " return null;", " Assert.assertTrue(delFile.delete());", " return null;" ], "header": "@@ -268,17 +269,20 @@ public class SupportFilesSetup extends TestSetup {", "removed": [ " public static boolean deleteFile(final String fileName) ", " Boolean ret = (Boolean) AccessController.doPrivileged", " return Boolean.valueOf((new File(fileName)).delete());", " return ret.booleanValue();" ] } ] } ]
derby-DERBY-3069-1653bccb
DERBY-3069: Add stringArrayTable, a VTI useful for testing VTIs. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1431623 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-3069-5f587f79
DERBY-3069: Fix a bug in the upgrade tests introduced by revision 1417835. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1418022 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-3069-615cb37c
DERBY-6047: Fix NPE in routine resolution introduced by work on DERBY-3069. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1435267 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/compile/StaticMethodCallNode.java", "hunks": [ { "added": [ "\t\t\tRoutineAliasInfo rai = (RoutineAliasInfo) proc.getAliasInfo();", "\t\t\tint parameterCount = rai.getParameterCount();", " boolean hasVarargs = rai.hasVarargs();" ], "header": "@@ -512,9 +512,9 @@ public class StaticMethodCallNode extends MethodCallNode", "removed": [ "\t\t\tRoutineAliasInfo routineInfo = (RoutineAliasInfo) proc.getAliasInfo();", "\t\t\tint parameterCount = routineInfo.getParameterCount();", " boolean hasVarargs = routineInfo.hasVarargs();" ] }, { "added": [ "\t\t\tTypeDescriptor[] parameterTypes = rai.getParameterTypes();", "\t\t\tif (rai.getMaxDynamicResultSets() > 0)" ], "header": "@@ -528,10 +528,10 @@ public class StaticMethodCallNode extends MethodCallNode", "removed": [ "\t\t\tTypeDescriptor[] parameterTypes = routineInfo.getParameterTypes();", "\t\t\tif (routineInfo.getMaxDynamicResultSets() > 0)" ] }, { "added": [ "\t\t\t\tint parameterMode = rai.getParameterModes()[ getRoutineArgIdx( rai, p ) ];" ], "header": "@@ -547,7 +547,7 @@ public class StaticMethodCallNode extends MethodCallNode", "removed": [ "\t\t\t\tint parameterMode = routineInfo.getParameterModes()[ getRoutineArgIdx( routineInfo, p ) ];" ] }, { "added": [ " rai," ], "header": "@@ -609,6 +609,7 @@ public class StaticMethodCallNode extends MethodCallNode", "removed": [] }, { "added": [ " rai," ], "header": "@@ -620,6 +621,7 @@ public class StaticMethodCallNode extends MethodCallNode", "removed": [] }, { "added": [ "\t\t\tthis.routineInfo = rai;" ], "header": "@@ -641,7 +643,7 @@ public class StaticMethodCallNode extends MethodCallNode", "removed": [ "\t\t\tthis.routineInfo = routineInfo;" ] }, { "added": [ " Vector aggregateVector,", " RoutineAliasInfo rai," ], "header": "@@ -675,7 +677,8 @@ public class StaticMethodCallNode extends MethodCallNode", "removed": [ " Vector aggregateVector, " ] } ] } ]
derby-DERBY-3069-68573fc4
DERBY-3069: Backing out this feature. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@630351 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/services/loader/ClassInspector.java", "hunks": [ { "added": [], "header": "@@ -21,8 +21,6 @@", "removed": [ "import org.apache.derby.iapi.services.info.JVMInfo;", "" ] }, { "added": [ "\t\t// an exact match lookup.", "\t\tif (paramClasses.length == 0) {", "", "\t\t\ttry {" ], "header": "@@ -277,11 +275,10 @@ public final class ClassInspector", "removed": [ "\t\t// an exact match lookup. this short-circuiting will not work if the VM", "\t\t// level supports varargs--this is because no arguments at all will", "\t\t// still match a signature which is just a varargs argument", "\t\tif ( !vmSupportsVarargs() && (paramClasses.length == 0) ) {", " try {" ] }, { "added": [ "" ], "header": "@@ -560,6 +557,7 @@ public final class ClassInspector", "removed": [] }, { "added": [], "header": "@@ -582,7 +580,6 @@ public final class ClassInspector", "removed": [ " Class[] varargsType = new Class[ methods.length ];" ] }, { "added": [], "header": "@@ -592,8 +589,6 @@ nextMethod:\tfor (int i = 0; i < methods.length; i++) {", "removed": [ " if ( firstTimeAround ) { varargsType[ i ] = getVarargsType( currentMethod ); }", "" ] }, { "added": [ "\t\t\t\t\t\t// regular match on parameter count", "\t\t\t\t\t\tif (currentMethodParameters.length != paramClasses.length) {" ], "header": "@@ -621,13 +616,8 @@ nextMethod:\tfor (int i = 0; i < methods.length; i++) {", "removed": [ "\t\t\t\t\t\t// regular match on parameter count. a varargs method", "\t\t\t\t\t\t// can have fewer arguments than the invoking expression.", "\t\t\t\t\t\tif (", " ( ( (currentMethodParameters.length-1) > paramClasses.length) && (varargsType[ i ] != null) ) ||", " ( (currentMethodParameters.length != paramClasses.length) && (varargsType[ i ] == null) )", " )", " {" ] }, { "added": [ "\t\t\t\t\t\t\tcurrentMethodParameters, isParam, false)) {" ], "header": "@@ -670,7 +660,7 @@ nextMethod:\tfor (int i = 0; i < methods.length; i++) {", "removed": [ " currentMethodParameters, isParam, false, varargsType[ i ])) {" ] }, { "added": [ "\t\treturn methods[candidateIndex];" ], "header": "@@ -795,8 +785,7 @@ nextMethod:\tfor (int i = 0; i < methods.length; i++) {", "removed": [ "", " return methods[candidateIndex];" ] }, { "added": [ "\t\treturn signatureConvertableFromTo(TC, null, UC, isParam, true);" ], "header": "@@ -904,7 +893,7 @@ nextMethod:\tfor (int i = 0; i < methods.length; i++) {", "removed": [ "\t\treturn signatureConvertableFromTo(TC, null, UC, isParam, true, null);" ] }, { "added": [ "\t\t\t\t\t\t\t\t\t\t\t\t boolean mixTypes) {", "\t\tif (toTypes.length < checkCount)", "\t\t\tClass toClass = toTypes[i];" ], "header": "@@ -918,33 +907,23 @@ nextMethod:\tfor (int i = 0; i < methods.length; i++) {", "removed": [ "\t *\t@param varargsType non-array type of last toTypes if the method/constructor has a varargs signature", " boolean mixTypes, Class varargsType) {", "\t\tif ( (toTypes.length < checkCount) && (varargsType == null) )", "\t\t\tClass toClass;", "", " // if the candidate method has a varargs signature, then the", " // concluding types must all be the type of the candidate's", " // last argument", " if ( (i >= (toTypes.length-1)) && (varargsType != null) )", " {", " toClass = varargsType;", " }", " else { toClass = toTypes[ i ]; }" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/MethodCallNode.java", "hunks": [ { "added": [], "header": "@@ -23,7 +23,6 @@ package\torg.apache.derby.impl.sql.compile;", "removed": [ "import org.apache.derby.iapi.services.compiler.LocalField;" ] }, { "added": [], "header": "@@ -59,8 +58,6 @@ import org.apache.derby.catalog.types.RoutineAliasInfo;", "removed": [ "import java.sql.ResultSet;", "" ] }, { "added": [ "\t\tString[] expectedTypes = methodParameterTypes;", "\t\tClassInspector classInspector = getClassFactory().getClassInspector();", "\t\t\t// type of the method", "\t\t\tString parameterType = expectedTypes[param];" ], "header": "@@ -531,49 +528,23 @@ abstract class MethodCallNode extends JavaValueNode", "removed": [ "\t\tString[] expectedTypes = methodParameterTypes;", " String varargsType = getVarargsType();", " int numPushedArgs = methodParms.length;", " int firstVararg = -1;", " LocalField varargsArrayField = null;", "", " if ( varargsType != null )", " {", " numPushedArgs = expectedTypes.length;", " firstVararg = numPushedArgs - 1;", " varargsArrayField = acb.newFieldDeclaration(Modifier.PRIVATE, varargsType + \"[]\" );", " mb.pushNewArray( varargsType, methodParms.length - firstVararg );", " mb.setField( varargsArrayField ); ", " }", "", " ClassInspector classInspector = getClassFactory().getClassInspector();", "", " boolean isVararg = (varargsType != null) && (param >= firstVararg);", " ", " // if this is a varargs method/constructor, then the trailing", " // arguments must be stuffed into a single array argument", " if ( isVararg ) { mb.getField( varargsArrayField ); }", " ", "\t\t\t// type of the method. check if it is a varargs method/constrctor", "\t\t\t// and if we have moved on to the varargs.", "\t\t\tString parameterType;", " if ( isVararg )", " { parameterType = varargsType; }", " else { parameterType = expectedTypes[param]; }", " " ] }, { "added": [ "\t\treturn methodParms.length;" ], "header": "@@ -603,12 +574,9 @@ abstract class MethodCallNode extends JavaValueNode", "removed": [ " if ( isVararg ) { mb.setArrayElement( param - firstVararg ); }", " if ( varargsType != null ) { mb.getField( varargsArrayField ); }", "", "\t\treturn numPushedArgs;" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/StaticMethodCallNode.java", "hunks": [ { "added": [ "\t\t\tint compiledResultSets = methodParameterTypes.length - methodParms.length;" ], "header": "@@ -896,7 +896,7 @@ public class StaticMethodCallNode extends MethodCallNode", "removed": [ "\t\t\tint compiledResultSets = getCompiledResultSetCount();" ] }, { "added": [ "" ], "header": "@@ -943,7 +943,7 @@ public class StaticMethodCallNode extends MethodCallNode", "removed": [ " " ] }, { "added": [ "" ], "header": "@@ -954,6 +954,7 @@ public class StaticMethodCallNode extends MethodCallNode", "removed": [] }, { "added": [], "header": "@@ -1128,5 +1129,4 @@ public class StaticMethodCallNode extends MethodCallNode", "removed": [ "" ] } ] } ]
derby-DERBY-3069-7b398e91
DERBY-3069: Support varargs in user code. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@579653 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/services/loader/ClassInspector.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.services.info.JVMInfo;", "" ], "header": "@@ -21,6 +21,8 @@", "removed": [] }, { "added": [ "\t\t// an exact match lookup. this short-circuiting will not work if the VM", "\t\t// level supports varargs--this is because no arguments at all will", "\t\t// still match a signature which is just a varargs argument", "\t\tif ( !vmSupportsVarargs() && (paramClasses.length == 0) ) {", " try {" ], "header": "@@ -275,10 +277,11 @@ public final class ClassInspector", "removed": [ "\t\t// an exact match lookup.", "\t\tif (paramClasses.length == 0) {", "", "\t\t\ttry {" ] }, { "added": [], "header": "@@ -557,7 +560,6 @@ public final class ClassInspector", "removed": [ "" ] }, { "added": [ " Class[] varargsType = new Class[ methods.length ];" ], "header": "@@ -580,6 +582,7 @@ public final class ClassInspector", "removed": [] }, { "added": [ " if ( firstTimeAround ) { varargsType[ i ] = getVarargsType( currentMethod ); }", "" ], "header": "@@ -589,6 +592,8 @@ nextMethod:\tfor (int i = 0; i < methods.length; i++) {", "removed": [] }, { "added": [ "\t\t\t\t\t\t// regular match on parameter count. a varargs method", "\t\t\t\t\t\t// can have fewer arguments than the invoking expression.", "\t\t\t\t\t\tif (", " ( ( (currentMethodParameters.length-1) > paramClasses.length) && (varargsType[ i ] != null) ) ||", " ( (currentMethodParameters.length != paramClasses.length) && (varargsType[ i ] == null) )", " )", " {" ], "header": "@@ -616,8 +621,13 @@ nextMethod:\tfor (int i = 0; i < methods.length; i++) {", "removed": [ "\t\t\t\t\t\t// regular match on parameter count", "\t\t\t\t\t\tif (currentMethodParameters.length != paramClasses.length) {" ] }, { "added": [ " currentMethodParameters, isParam, false, varargsType[ i ])) {" ], "header": "@@ -660,7 +670,7 @@ nextMethod:\tfor (int i = 0; i < methods.length; i++) {", "removed": [ "\t\t\t\t\t\t\tcurrentMethodParameters, isParam, false)) {" ] }, { "added": [ "", " return methods[candidateIndex];" ], "header": "@@ -785,7 +795,8 @@ nextMethod:\tfor (int i = 0; i < methods.length; i++) {", "removed": [ "\t\treturn methods[candidateIndex];" ] }, { "added": [ "\t\treturn signatureConvertableFromTo(TC, null, UC, isParam, true, null);" ], "header": "@@ -893,7 +904,7 @@ nextMethod:\tfor (int i = 0; i < methods.length; i++) {", "removed": [ "\t\treturn signatureConvertableFromTo(TC, null, UC, isParam, true);" ] }, { "added": [ "\t *\t@param varargsType non-array type of last toTypes if the method/constructor has a varargs signature", " boolean mixTypes, Class varargsType) {", "\t\tif ( (toTypes.length < checkCount) && (varargsType == null) )", "\t\t\tClass toClass;", "", " // if the candidate method has a varargs signature, then the", " // concluding types must all be the type of the candidate's", " // last argument", " if ( (i >= (toTypes.length-1)) && (varargsType != null) )", " {", " toClass = varargsType;", " }", " else { toClass = toTypes[ i ]; }" ], "header": "@@ -907,23 +918,33 @@ nextMethod:\tfor (int i = 0; i < methods.length; i++) {", "removed": [ "\t\t\t\t\t\t\t\t\t\t\t\t boolean mixTypes) {", "\t\tif (toTypes.length < checkCount)", "\t\t\tClass toClass = toTypes[i];" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/MethodCallNode.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.services.compiler.LocalField;" ], "header": "@@ -23,6 +23,7 @@ package\torg.apache.derby.impl.sql.compile;", "removed": [] }, { "added": [ "import java.sql.ResultSet;", "" ], "header": "@@ -58,6 +59,8 @@ import org.apache.derby.catalog.types.RoutineAliasInfo;", "removed": [] }, { "added": [ "\t\tString[] expectedTypes = methodParameterTypes;", " String varargsType = getVarargsType();", " int numPushedArgs = methodParms.length;", " int firstVararg = -1;", " LocalField varargsArrayField = null;", " if ( varargsType != null )", " {", " numPushedArgs = expectedTypes.length;", " firstVararg = numPushedArgs - 1;", " varargsArrayField = acb.newFieldDeclaration(Modifier.PRIVATE, varargsType + \"[]\" );", "", " mb.pushNewArray( varargsType, methodParms.length - firstVararg );", " mb.setField( varargsArrayField ); ", " }", "", " ClassInspector classInspector = getClassFactory().getClassInspector();", "", " boolean isVararg = (varargsType != null) && (param >= firstVararg);", " ", " // if this is a varargs method/constructor, then the trailing", " // arguments must be stuffed into a single array argument", " if ( isVararg ) { mb.getField( varargsArrayField ); }", " ", "\t\t\t// type of the method. check if it is a varargs method/constrctor", "\t\t\t// and if we have moved on to the varargs.", "\t\t\tString parameterType;", " if ( isVararg )", " { parameterType = varargsType; }", " else { parameterType = expectedTypes[param]; }", " " ], "header": "@@ -528,23 +531,49 @@ abstract class MethodCallNode extends JavaValueNode", "removed": [ "\t\tString[] expectedTypes = methodParameterTypes;", "\t\tClassInspector classInspector = getClassFactory().getClassInspector();", "\t\t\t// type of the method", "\t\t\tString parameterType = expectedTypes[param];" ] }, { "added": [ " if ( isVararg ) { mb.setArrayElement( param - firstVararg ); }", " if ( varargsType != null ) { mb.getField( varargsArrayField ); }", "", "\t\treturn numPushedArgs;" ], "header": "@@ -574,9 +603,12 @@ abstract class MethodCallNode extends JavaValueNode", "removed": [ "\t\treturn methodParms.length;" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/StaticMethodCallNode.java", "hunks": [ { "added": [ "\t\t\tint compiledResultSets = getCompiledResultSetCount();" ], "header": "@@ -892,7 +892,7 @@ public class StaticMethodCallNode extends MethodCallNode", "removed": [ "\t\t\tint compiledResultSets = methodParameterTypes.length - methodParms.length;" ] }, { "added": [ " " ], "header": "@@ -939,7 +939,7 @@ public class StaticMethodCallNode extends MethodCallNode", "removed": [ "" ] }, { "added": [], "header": "@@ -950,7 +950,6 @@ public class StaticMethodCallNode extends MethodCallNode", "removed": [ "" ] }, { "added": [ "" ], "header": "@@ -1125,4 +1124,5 @@ public class StaticMethodCallNode extends MethodCallNode", "removed": [] } ] } ]
derby-DERBY-3069-ba70926b
DERBY-3069: Fix varargs bugs in handling of primitive args and out/inout args. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1421052 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/compile/MethodCallNode.java", "hunks": [ { "added": [ " boolean hasVarargs = hasVarargs();", " int firstVarargIdx = getFirstVarargIdx();", " int paramCount = signature.length;", "\t\tfor (int i = 0; i < paramCount; i++)", "\t\t\tif (i != 0) { parmTypes.append(\", \"); }", " boolean isVararg = isVararg( i );", "", " String parmType = parmTypeNames[ i ];", " if ( parmTypeNames [i ].length() == 0 ) { parmType = \"UNTYPED\"; }", " else if ( isVararg ) { parmType = getVarargTypeName( parmType ); }", "", " parmTypes.append( parmType );", "", " {", " String primTypeName = primParmTypeNames[ i ];", " if ( isVararg ) { primTypeName = getVarargTypeName( primTypeName ); }", "\t\t\t\tparmTypes.append(\"(\" + primTypeName + \")\");", " }" ], "header": "@@ -373,17 +373,28 @@ abstract class MethodCallNode extends JavaValueNode", "removed": [ "\t\tfor (int i = 0; i < parmTypeNames.length; i++)", "\t\t\tif (i != 0)", "\t\t\t\tparmTypes.append(\", \");", "\t\t\tparmTypes.append( (parmTypeNames[i].length() != 0 ?", "\t\t\t\t\t\t\t\tparmTypeNames[i] :", "\t\t\t\t\t\t\t\t\"UNTYPED\"));", "\t\t\t\tparmTypes.append(\"(\" + primParmTypeNames[i] + \")\");" ] }, { "added": [ " /** Turn an array type name into the corresponding vararg type name */", " private String getVarargTypeName( String arrayTypeName )", " {", " return stripOneArrayLevel( arrayTypeName ) + \"...\";", " }", "" ], "header": "@@ -392,6 +403,12 @@ abstract class MethodCallNode extends JavaValueNode", "removed": [] }, { "added": [ " }", "", " /** Get the index of the first vararg if this is a varargs method */", " public int getFirstVarargIdx() { return signature.length - 1; }", "", " /** Return true if the parameter is a vararg */", " public boolean isVararg( int parameterNumber )", " {", " if ( !hasVarargs() ) { return false; }", " else", " {", " return ( parameterNumber >= getFirstVarargIdx() );", " }", " }" ], "header": "@@ -519,7 +536,20 @@ abstract class MethodCallNode extends JavaValueNode", "removed": [ " } " ] }, { "added": [ " int firstVarargIdx = getFirstVarargIdx();", " String arrayType = methodParameterTypes[ firstVarargIdx ];", " String cellType = stripOneArrayLevel( arrayType );", " String varargType = cellType;", "", " // must strip another array level off of out and in/out parameters", " if ( routineInfo != null )", " {", " if ( routineInfo.getParameterModes()[ firstVarargIdx ] != JDBC30Translation.PARAMETER_MODE_IN )", " {", " varargType = stripOneArrayLevel( varargType );", " }", " }", "", "\t\tLocalField arrayField = acb.newFieldDeclaration( Modifier.PRIVATE, arrayType );", "\t\tcb.pushNewArray( cellType, varargCount );" ], "header": "@@ -616,17 +646,27 @@ abstract class MethodCallNode extends JavaValueNode", "removed": [ " Class[] parameterTypes = ((Method) method).getParameterTypes();", " int firstVarargIdx = parameterTypes.length - 1;", " Class varargType = parameterTypes[ firstVarargIdx ].getComponentType();", " ", "\t\tLocalField arrayField = acb.newFieldDeclaration( Modifier.PRIVATE, varargType.getName() + \"[]\" );", "\t\tcb.pushNewArray( varargType.getName(), varargCount );" ] }, { "added": [ " generateAndCastOneParameter( acb, mb, i + firstVarargIdx, cellType );" ], "header": "@@ -634,7 +674,7 @@ abstract class MethodCallNode extends JavaValueNode", "removed": [ " generateAndCastOneParameter( acb, mb, i + firstVarargIdx, methodParameterTypes[ firstVarargIdx ] );" ] }, { "added": [ " else { return getRoutineArgIdx( routineInfo, invocationArgIdx ); }", " }", " protected int getRoutineArgIdx( RoutineAliasInfo rai, int invocationArgIdx )", " {", " if ( !rai.hasVarargs() ) { return invocationArgIdx; }", " int firstVarargIdx = rai.getParameterCount() - 1;" ], "header": "@@ -654,10 +694,14 @@ abstract class MethodCallNode extends JavaValueNode", "removed": [ " if ( !routineInfo.hasVarargs() ) { return invocationArgIdx; }", " int firstVarargIdx = routineInfo.getParameterCount() - 1;" ] }, { "added": [ " String methodParameter = null;", " ", "\t\t\tmethodParameter = methodParameterTypes[i];", "\t\t\t\t\tint parameterMode = routineInfo.getParameterModes()[ getRoutineArgIdx( i ) ];" ], "header": "@@ -929,13 +973,15 @@ abstract class MethodCallNode extends JavaValueNode", "removed": [ "\t\t\tString methodParameter = methodParameterTypes[i];", "\t\t\t\t\tint parameterMode = routineInfo.getParameterModes()[i];" ] }, { "added": [ "\t\t\t\t\t\tmethodParameter = stripOneArrayLevel( methodParameter );" ], "header": "@@ -943,7 +989,7 @@ abstract class MethodCallNode extends JavaValueNode", "removed": [ "\t\t\t\t\t\tmethodParameter = methodParameter.substring(0, methodParameter.length() - 2);" ] }, { "added": [ " //", " // Strip off the array type if this is a varargs arg. We are only interested in", " // whether we need to cast to the cell type.", " //", " if ( hasVarargs() && (i >= getFirstVarargIdx()) )", " {", " methodParameter = stripOneArrayLevel( methodParameter );", " }", "", " {", " // varargs may be omitted, so there may not be an invocation argument", " // corresponding to the vararg", " if ( i < methodParms.length )", " {", " methodParms[i].castToPrimitive(true);", " }", " }", " // the last routine parameter may have been a varargs. if so,", " // casting may be needed on the trailing varargs", " if ( hasVarargs() )", " {", " int firstVarargIdx = getFirstVarargIdx();", " int trailingVarargCount = methodParms.length - firstVarargIdx;", "", " // the first vararg was handled in the preceding loop", " for ( int i = 1; i < trailingVarargCount; i++ )", " {", " if (ClassInspector.primitiveType(methodParameter))", " {", " methodParms[ i + firstVarargIdx ].castToPrimitive(true);", " }", " }", " }", "" ], "header": "@@ -953,10 +999,43 @@ abstract class MethodCallNode extends JavaValueNode", "removed": [ "\t\t\t\tmethodParms[i].castToPrimitive(true);" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/StaticMethodCallNode.java", "hunks": [ { "added": [ "\t\t\t\tint parameterMode = routineInfo.getParameterModes()[ getRoutineArgIdx( routineInfo, p ) ];" ], "header": "@@ -494,7 +494,7 @@ public class StaticMethodCallNode extends MethodCallNode", "removed": [ "\t\t\t\tint parameterMode = routineInfo.getParameterModes()[p];" ] }, { "added": [ " methodParms.length," ], "header": "@@ -556,7 +556,7 @@ public class StaticMethodCallNode extends MethodCallNode", "removed": [ " parameterCount," ] }, { "added": [ " methodParms.length," ], "header": "@@ -567,7 +567,7 @@ public class StaticMethodCallNode extends MethodCallNode", "removed": [ " parameterCount," ] }, { "added": [ "\t\t\t\t\tString parameterType = methodParameterTypes[ getRoutineArgIdx( parameterNumber ) ];" ], "header": "@@ -868,7 +868,7 @@ public class StaticMethodCallNode extends MethodCallNode", "removed": [ "\t\t\t\t\tString parameterType = methodParameterTypes[parameterNumber];" ] }, { "added": [ "\t\t\tString methodParameterType = methodParameterTypes[ getRoutineArgIdx( parameterNumber ) ];", "", " // if a varargs arg, then strip off the extra array dimension added by varargs", " if ( isVararg( parameterNumber ) )", " {", " methodParameterType = stripOneArrayLevel( methodParameterType );", " arrayType = stripOneArrayLevel( arrayType );", " }", " ", " { outParamArrays = new LocalField[methodParms.length]; }" ], "header": "@@ -916,12 +916,20 @@ public class StaticMethodCallNode extends MethodCallNode", "removed": [ "\t\t\tString methodParameterType = methodParameterTypes[parameterNumber];", "\t\t\t\toutParamArrays = new LocalField[methodParms.length];" ] }, { "added": [ "\t\t\t\t\tint parameterMode = parameterModes[ getRoutineArgIdx( i ) ];", " " ], "header": "@@ -1292,7 +1300,8 @@ public class StaticMethodCallNode extends MethodCallNode", "removed": [ "\t\t\t\t\tint parameterMode = parameterModes[i];" ] } ] } ]
derby-DERBY-3069-f9596d49
DERBY-3069: DDL for varargs routines. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1417835 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/catalog/types/RoutineAliasInfo.java", "hunks": [ { "added": [ "\t/** PARAMETER STYLE DERBY */", "\tpublic static final short PS_DERBY = PS_DERBY_JDBC_RESULT_SET + 1;", "", " private static final short SECURITY_DEFINER_MASK = (short) 0x20; // Mask for the SECURITY INVOKER/DEFINER field", " private static final short VARARGS_MASK = (short) 0x40;" ], "header": "@@ -54,12 +54,14 @@ public class RoutineAliasInfo extends MethodAliasInfo", "removed": [ "", " /** Mask for the SECURITY INVOKER/DEFINER field */", " private static final short SECURITY_DEFINER_MASK = (short) 0x20;" ] }, { "added": [ "\tpublic RoutineAliasInfo", " (", " String methodName,", " int parameterCount,", " String[] parameterNames,", " TypeDescriptor[]\tparameterTypes,", " int[] parameterModes,", " int dynamicResultSets,", " short parameterStyle,", " short sqlAllowed,", " boolean isDeterministic,", " boolean hasVarargs", " )", " {" ], "header": "@@ -121,10 +123,20 @@ public class RoutineAliasInfo extends MethodAliasInfo", "removed": [ "\tpublic RoutineAliasInfo(String methodName, int parameterCount, String[] parameterNames,", " TypeDescriptor[]\tparameterTypes, int[] parameterModes, int dynamicResultSets, short parameterStyle, short sqlAllowed,", " boolean isDeterministic ) {", "" ] }, { "added": [ " hasVarargs," ], "header": "@@ -134,6 +146,7 @@ public class RoutineAliasInfo extends MethodAliasInfo", "removed": [] }, { "added": [ " boolean hasVarargs," ], "header": "@@ -151,6 +164,7 @@ public class RoutineAliasInfo extends MethodAliasInfo", "removed": [] }, { "added": [ " if ( hasVarargs ) { this.sqlOptions = (short) (sqlOptions | VARARGS_MASK); }" ], "header": "@@ -165,6 +179,7 @@ public class RoutineAliasInfo extends MethodAliasInfo", "removed": [] }, { "added": [ " public boolean hasVarargs()", " {", " return ( (sqlOptions & VARARGS_MASK) != 0 );", " }", "" ], "header": "@@ -251,6 +266,11 @@ public class RoutineAliasInfo extends MethodAliasInfo", "removed": [] }, { "added": [ " if ( hasVarargs() ) { sb.append( \" ... \" ); }" ], "header": "@@ -392,6 +412,7 @@ public class RoutineAliasInfo extends MethodAliasInfo", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java", "hunks": [ { "added": [ " {\"ACOS\", \"DOUBLE\", \"java.lang.StrictMath\", \"acos(double)\", \"true\", \"false\", \"DOUBLE\" },", " {\"ASIN\", \"DOUBLE\", \"java.lang.StrictMath\", \"asin(double)\", \"true\", \"false\", \"DOUBLE\" },", " {\"ATAN\", \"DOUBLE\", \"java.lang.StrictMath\", \"atan(double)\", \"true\", \"false\", \"DOUBLE\" },", " {\"ATAN2\", \"DOUBLE\", \"java.lang.StrictMath\", \"atan2(double,double)\", \"true\", \"false\", \"DOUBLE\", \"DOUBLE\" },", " {\"COS\", \"DOUBLE\", \"java.lang.StrictMath\", \"cos(double)\", \"true\", \"false\", \"DOUBLE\" },", " {\"SIN\", \"DOUBLE\", \"java.lang.StrictMath\", \"sin(double)\", \"true\", \"false\", \"DOUBLE\" },", " {\"TAN\", \"DOUBLE\", \"java.lang.StrictMath\", \"tan(double)\", \"true\", \"false\", \"DOUBLE\" },", " {\"PI\", \"DOUBLE\", \"org.apache.derby.catalog.SystemProcedures\", \"PI()\", \"false\", \"true\" },", " {\"DEGREES\", \"DOUBLE\", \"java.lang.StrictMath\", \"toDegrees(double)\", \"true\", \"false\", \"DOUBLE\" },", " {\"RADIANS\", \"DOUBLE\", \"java.lang.StrictMath\", \"toRadians(double)\", \"true\", \"false\", \"DOUBLE\" },", " {\"LN\", \"DOUBLE\", \"java.lang.StrictMath\", \"log(double)\", \"true\", \"false\", \"DOUBLE\" },", " {\"LOG\", \"DOUBLE\", \"java.lang.StrictMath\", \"log(double)\", \"true\", \"false\", \"DOUBLE\" }, // Same as LN", " {\"LOG10\", \"DOUBLE\", \"org.apache.derby.catalog.SystemProcedures\", \"LOG10(double)\", \"true\", \"false\", \"DOUBLE\" },", " {\"EXP\", \"DOUBLE\", \"java.lang.StrictMath\", \"exp(double)\", \"true\", \"false\", \"DOUBLE\" },", " {\"CEIL\", \"DOUBLE\", \"java.lang.StrictMath\", \"ceil(double)\", \"true\", \"false\", \"DOUBLE\" },", " {\"CEILING\", \"DOUBLE\", \"java.lang.StrictMath\", \"ceil(double)\", \"true\", \"false\", \"DOUBLE\" }, // Same as CEIL", " {\"FLOOR\", \"DOUBLE\", \"java.lang.StrictMath\", \"floor(double)\", \"true\", \"false\", \"DOUBLE\" },", " {\"SIGN\", \"INTEGER\", \"org.apache.derby.catalog.SystemProcedures\", \"SIGN(double)\", \"true\", \"false\", \"DOUBLE\" },", " {\"RANDOM\", \"DOUBLE\", \"java.lang.StrictMath\", \"random()\", \"false\", \"false\" },", " {\"RAND\", \"DOUBLE\", \"org.apache.derby.catalog.SystemProcedures\", \"RAND(int)\", \"false\", \"false\", \"INTEGER\" }, // Escape function spec.", " {\"COT\", \"DOUBLE\", \"org.apache.derby.catalog.SystemProcedures\", \"COT(double)\", \"true\", \"false\", \"DOUBLE\" },", " {\"COSH\", \"DOUBLE\", \"org.apache.derby.catalog.SystemProcedures\", \"COSH(double)\", \"true\", \"false\", \"DOUBLE\" },", " {\"SINH\", \"DOUBLE\", \"org.apache.derby.catalog.SystemProcedures\", \"SINH(double)\", \"true\", \"false\", \"DOUBLE\" },", " {\"TANH\", \"DOUBLE\", \"org.apache.derby.catalog.SystemProcedures\", \"TANH(double)\", \"true\", \"false\", \"DOUBLE\" }" ], "header": "@@ -244,30 +244,30 @@ public final class\tDataDictionaryImpl", "removed": [ " {\"ACOS\", \"DOUBLE\", \"java.lang.StrictMath\", \"acos(double)\", \"true\", \"DOUBLE\"},", "\t\t\t{\"ASIN\", \"DOUBLE\", \"java.lang.StrictMath\", \"asin(double)\", \"true\", \"DOUBLE\"},", "\t\t\t{\"ATAN\", \"DOUBLE\", \"java.lang.StrictMath\", \"atan(double)\", \"true\", \"DOUBLE\"},", " {\"ATAN2\", \"DOUBLE\", \"java.lang.StrictMath\", \"atan2(double,double)\", \"true\", \"DOUBLE\", \"DOUBLE\"},", "\t\t\t{\"COS\", \"DOUBLE\", \"java.lang.StrictMath\", \"cos(double)\", \"true\", \"DOUBLE\"},", "\t\t\t{\"SIN\", \"DOUBLE\", \"java.lang.StrictMath\", \"sin(double)\", \"true\", \"DOUBLE\"},", "\t\t\t{\"TAN\", \"DOUBLE\", \"java.lang.StrictMath\", \"tan(double)\", \"true\", \"DOUBLE\"},", " {\"PI\", \"DOUBLE\", \"org.apache.derby.catalog.SystemProcedures\", \"PI()\", \"true\"},", " {\"DEGREES\", \"DOUBLE\", \"java.lang.StrictMath\", \"toDegrees(double)\", \"true\", \"DOUBLE\"},", "\t\t\t{\"RADIANS\", \"DOUBLE\", \"java.lang.StrictMath\", \"toRadians(double)\", \"true\", \"DOUBLE\"},", "\t\t\t{\"LN\", \"DOUBLE\", \"java.lang.StrictMath\", \"log(double)\", \"true\", \"DOUBLE\"},", "\t\t\t{\"LOG\", \"DOUBLE\", \"java.lang.StrictMath\", \"log(double)\", \"true\", \"DOUBLE\"}, // Same as LN", "\t\t\t{\"LOG10\", \"DOUBLE\", \"org.apache.derby.catalog.SystemProcedures\", \"LOG10(double)\", \"true\", \"DOUBLE\"},", "\t\t\t{\"EXP\", \"DOUBLE\", \"java.lang.StrictMath\", \"exp(double)\", \"true\", \"DOUBLE\"},", "\t\t\t{\"CEIL\", \"DOUBLE\", \"java.lang.StrictMath\", \"ceil(double)\", \"true\", \"DOUBLE\"},", "\t\t\t{\"CEILING\", \"DOUBLE\", \"java.lang.StrictMath\", \"ceil(double)\", \"true\", \"DOUBLE\"}, // Same as CEIL", "\t\t\t{\"FLOOR\", \"DOUBLE\", \"java.lang.StrictMath\", \"floor(double)\", \"true\", \"DOUBLE\"},", "\t\t\t{\"SIGN\", \"INTEGER\", \"org.apache.derby.catalog.SystemProcedures\", \"SIGN(double)\", \"true\", \"DOUBLE\"},", " {\"RANDOM\", \"DOUBLE\", \"java.lang.StrictMath\", \"random()\", \"false\" },", "\t\t\t{\"RAND\", \"DOUBLE\", \"org.apache.derby.catalog.SystemProcedures\", \"RAND(int)\", \"false\", \"INTEGER\"}, // Escape function spec.", "\t\t\t{\"COT\", \"DOUBLE\", \"org.apache.derby.catalog.SystemProcedures\", \"COT(double)\", \"true\", \"DOUBLE\"},", "\t\t\t{\"COSH\", \"DOUBLE\", \"org.apache.derby.catalog.SystemProcedures\", \"COSH(double)\", \"true\", \"DOUBLE\"},", "\t\t\t{\"SINH\", \"DOUBLE\", \"org.apache.derby.catalog.SystemProcedures\", \"SINH(double)\", \"true\", \"DOUBLE\"},", "\t\t\t{\"TANH\", \"DOUBLE\", \"org.apache.derby.catalog.SystemProcedures\", \"TANH(double)\", \"true\", \"DOUBLE\"}" ] }, { "added": [ " /**", " * Index into SYSFUN_FUNCTIONS of the VARARGS indicator.", " * Used to determine whether the system function has VARARGS", " */", " private static final int SYSFUN_VARARGS_INDEX = 5;", "", " private static final int SYSFUN_FIRST_PARAMETER_INDEX = 6;" ], "header": "@@ -277,11 +277,17 @@ public final class\tDataDictionaryImpl", "removed": [ " private static final int SYSFUN_FIRST_PARAMETER_INDEX = 5;" ] }, { "added": [ " oldRai.hasVarargs()," ], "header": "@@ -2686,6 +2692,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " boolean hasVarargs = Boolean.valueOf( details[ SYSFUN_VARARGS_INDEX ] ).booleanValue();" ], "header": "@@ -7809,6 +7816,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " RoutineAliasInfo.PS_JAVA, RoutineAliasInfo.NO_SQL, isDeterministic, hasVarargs," ], "header": "@@ -7827,7 +7835,7 @@ public final class\tDataDictionaryImpl", "removed": [ " RoutineAliasInfo.PS_JAVA, RoutineAliasInfo.NO_SQL, isDeterministic," ] }, { "added": [ " boolean hasVarargs," ], "header": "@@ -10727,6 +10735,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " hasVarargs, // whether the procedure/function has VARARGS" ], "header": "@@ -10774,6 +10783,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " boolean hasVarargs," ], "header": "@@ -10846,6 +10856,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " num_out_param, num_result_sets, routine_sql_control, isDeterministic, hasVarargs," ], "header": "@@ -10853,7 +10864,7 @@ public final class\tDataDictionaryImpl", "removed": [ " num_out_param, num_result_sets, routine_sql_control, isDeterministic," ] }, { "added": [ " false," ], "header": "@@ -10913,6 +10924,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -10941,6 +10953,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -10957,6 +10970,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -10973,6 +10987,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -10989,6 +11004,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -11014,6 +11030,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -11041,6 +11058,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -11063,6 +11081,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -11085,6 +11104,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -11107,6 +11127,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -11138,6 +11159,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -11164,6 +11186,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -11181,6 +11204,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -11223,6 +11247,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -11247,6 +11272,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -11270,6 +11296,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -11309,6 +11336,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -11346,6 +11374,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -11388,6 +11417,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -11433,6 +11463,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -11469,6 +11500,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -11568,6 +11600,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -11599,6 +11632,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -11630,6 +11664,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -11661,6 +11696,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -11694,6 +11730,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -11728,6 +11765,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -11761,6 +11799,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -11794,6 +11833,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -11827,6 +11867,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -11865,6 +11906,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -11903,6 +11945,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -11930,6 +11973,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -11966,6 +12010,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -11982,6 +12027,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -12140,6 +12186,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -12190,6 +12237,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -12221,6 +12269,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -12253,6 +12302,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -12287,6 +12337,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -12324,6 +12375,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -12343,6 +12395,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -12368,6 +12421,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -12393,6 +12447,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -12413,6 +12468,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -12438,6 +12494,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -12466,6 +12523,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -12489,6 +12547,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -12510,6 +12569,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -12529,6 +12589,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -12554,6 +12615,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -12579,6 +12641,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -12601,6 +12664,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -12626,6 +12690,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -12654,6 +12719,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -12677,6 +12743,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -12719,6 +12786,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -12756,6 +12824,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -12773,6 +12842,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -12798,6 +12868,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -12814,6 +12885,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -12887,6 +12959,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -12929,6 +13002,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -12969,6 +13043,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -13016,6 +13091,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -13033,6 +13109,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -13052,6 +13129,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -13070,6 +13148,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -13086,6 +13165,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -13133,6 +13213,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -13164,6 +13245,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -13194,6 +13276,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -13224,6 +13307,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -13253,6 +13337,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " false," ], "header": "@@ -13280,6 +13365,7 @@ public final class\tDataDictionaryImpl", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/CreateAliasNode.java", "hunks": [ { "added": [ " public static final int VARARGS = ROUTINE_SECURITY_DEFINER + 1;", " public static final int ROUTINE_ELEMENT_COUNT = VARARGS + 1;" ], "header": "@@ -60,12 +60,12 @@ public class CreateAliasNode extends DDLStatementNode", "removed": [ " public static final int ROUTINE_ELEMENT_COUNT =", " ROUTINE_SECURITY_DEFINER + 1;" ] }, { "added": [ "\t\t\t\tBoolean hasVarargsO = (Boolean) routineElements[ VARARGS ];", " boolean hasVarargs = (hasVarargsO == null) ? false : hasVarargsO.booleanValue();", "" ], "header": "@@ -265,6 +265,9 @@ public class CreateAliasNode extends DDLStatementNode", "removed": [] }, { "added": [ " hasVarargs," ], "header": "@@ -300,6 +303,7 @@ public class CreateAliasNode extends DDLStatementNode", "removed": [] } ] } ]
derby-DERBY-3074-507841dc
DERBY-3074 Database shutdown exception 08006 throws SQLTransientConnectionException instead of SQLNonTransientConnectionException DERBY-3075 Client error: 08001 Error connecting to server.. throws SQLTransientConnectionException instead of SQLNonTransientConnectionException git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@576546 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/client/org/apache/derby/client/am/SQLExceptionFactory40.java", "hunks": [ { "added": [ "import java.sql.SQLNonTransientConnectionException;", "" ], "header": "@@ -28,9 +28,10 @@ import java.sql.SQLException;", "removed": [ "import java.sql.SQLTransientConnectionException;" ] } ] }, { "file": "java/engine/org/apache/derby/impl/jdbc/SQLExceptionFactory40.java", "hunks": [ { "added": [ "import java.sql.SQLNonTransientConnectionException;" ], "header": "@@ -25,9 +25,9 @@ import java.sql.SQLDataException;", "removed": [ "import java.sql.SQLTransientConnectionException;" ] }, { "added": [ " * 08 java.sql.SQLNonTransientConnectionException" ], "header": "@@ -43,7 +43,7 @@ public class SQLExceptionFactory40 extends SQLExceptionFactory {", "removed": [ " * 08 java.sql.SQLTransientConnectionException" ] } ] } ]
derby-DERBY-3075-507841dc
DERBY-3074 Database shutdown exception 08006 throws SQLTransientConnectionException instead of SQLNonTransientConnectionException DERBY-3075 Client error: 08001 Error connecting to server.. throws SQLTransientConnectionException instead of SQLNonTransientConnectionException git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@576546 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/client/org/apache/derby/client/am/SQLExceptionFactory40.java", "hunks": [ { "added": [ "import java.sql.SQLNonTransientConnectionException;", "" ], "header": "@@ -28,9 +28,10 @@ import java.sql.SQLException;", "removed": [ "import java.sql.SQLTransientConnectionException;" ] } ] }, { "file": "java/engine/org/apache/derby/impl/jdbc/SQLExceptionFactory40.java", "hunks": [ { "added": [ "import java.sql.SQLNonTransientConnectionException;" ], "header": "@@ -25,9 +25,9 @@ import java.sql.SQLDataException;", "removed": [ "import java.sql.SQLTransientConnectionException;" ] }, { "added": [ " * 08 java.sql.SQLNonTransientConnectionException" ], "header": "@@ -43,7 +43,7 @@ public class SQLExceptionFactory40 extends SQLExceptionFactory {", "removed": [ " * 08 java.sql.SQLTransientConnectionException" ] } ] } ]
derby-DERBY-3077-137e3a1a
DERBY-3077 Trying to reconnect with derby client after bringing server down throws SQL Exception 58009 rather than 08XXX exception Per Knut's suggestion, it changes expected client side errors such as SocketExceptions and IOExceptions to throw 08006 exceptions instead of 58 class exceptions. DRDA_CONNECTION_TERMINATED SOCKET_EXCEPTION COMMUNICATION_ERROR CONNECTION_FAILED_ON_DEFERRED_RESET NET_INSUFFICIENT_DATA NET_LOB_DATA_TOO_LARGE_FOR_JVM This leaves only protocol exceptions in the 58 class. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@576936 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/shared/org/apache/derby/shared/common/reference/SQLState.java", "hunks": [ { "added": [ " String DRDA_CONNECTION_TERMINATED = \"08006.C\";", " ", " // Use this version of SOCKET_EXCEPTION any time *except* when trying to", " // establish a connection, as the SQLState is different. When trying", " // to establish a connection, use CONNECT_SOCKET_EXCEPTION.", " String SOCKET_EXCEPTION = \"08006.C.2\";", " String COMMUNICATION_ERROR = \"08006.C.3\";", " String CONNECTION_FAILED_ON_DEFERRED_RESET = \"08006.C.4\";", " String NET_INSUFFICIENT_DATA = \"08006.C.5\";", " String NET_LOB_DATA_TOO_LARGE_FOR_JVM = \"08006.C.6\";", " " ], "header": "@@ -1595,8 +1595,18 @@ public interface SQLState {", "removed": [ "" ] } ] } ]
derby-DERBY-3083-7093bb67
DERBY-3083: To fix regression introduced by DERBY-2196, do not fail server startup if derbynet.jar cannot be found. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@597125 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/drda/org/apache/derby/drda/NetworkServerControl.java", "hunks": [ { "added": [ " * <li>Classes live in the jar files which we expect..</li>" ], "header": "@@ -545,6 +545,7 @@ public class NetworkServerControl{", "removed": [] }, { "added": [ " (!server.runningUnsecure()) &&", " (packagingLooksGood())", " /**", " * Return true if the server lives in the expected jar file. This", " * is meant to address DERBY-3083. We expect that the URL of", " * the jar which contains NetworkServerControl will end with the", " * string \"derbynet.jar\". If this is true, then getCodeSourcePrefix()", " * will return a prefix which can be substituted into the default", " * server policy file and so end up granting permissions to the server jar file.", " */", " private static boolean packagingLooksGood()", " throws Exception", " {", " String derbyNetURL = NetworkServerControl.class.getProtectionDomain().getCodeSource().getLocation().toExternalForm();", "", " return derbyNetURL.endsWith( DERBYNET_JAR );", " }", "", "" ], "header": "@@ -554,10 +555,28 @@ public class NetworkServerControl{", "removed": [ " (!server.runningUnsecure())" ] } ] } ]
derby-DERBY-3083-fb6b9e8d
DERBY-3083: Revert 597125. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@599086 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/drda/org/apache/derby/drda/NetworkServerControl.java", "hunks": [ { "added": [], "header": "@@ -545,7 +545,6 @@ public class NetworkServerControl{", "removed": [ " * <li>Classes live in the jar files which we expect..</li>" ] }, { "added": [ " (!server.runningUnsecure())" ], "header": "@@ -555,28 +554,10 @@ public class NetworkServerControl{", "removed": [ " (!server.runningUnsecure()) &&", " (packagingLooksGood())", " /**", " * Return true if the server lives in the expected jar file. This", " * is meant to address DERBY-3083. We expect that the URL of", " * the jar which contains NetworkServerControl will end with the", " * string \"derbynet.jar\". If this is true, then getCodeSourcePrefix()", " * will return a prefix which can be substituted into the default", " * server policy file and so end up granting permissions to the server jar file.", " */", " private static boolean packagingLooksGood()", " throws Exception", " {", " String derbyNetURL = NetworkServerControl.class.getProtectionDomain().getCodeSource().getLocation().toExternalForm();", "", " return derbyNetURL.endsWith( DERBYNET_JAR );", " }", "", "" ] } ] } ]
derby-DERBY-3085-788599fc
DERBY-3085 Fails to handle BLOB fields with a PreparedStatement with size >32750 bytes Store a reference to the stream for the streamed parameter in the DRDAStatement.paramState and then drain the stream after statement execution if needed. There is only one parameter ever streamed, so only one field needed to be added. I added a test for both BLOB's and CLOB's to Blob4ClobTest.java. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@581012 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/drda/org/apache/derby/impl/drda/DRDAConnThread.java", "hunks": [ { "added": [ "\t\t\t\t\t\t// Only the last EXTDTA is streamed. This is because all of ", "\t\t\t\t\t\t// the parameters have to be set before execution and are ", "\t\t\t\t\t\t// consecutive in the network server stream, so only the last", "\t\t\t\t\t\t// one can be streamed." ], "header": "@@ -4629,6 +4629,10 @@ class DRDAConnThread extends Thread {", "removed": [] }, { "added": [ " // Save the streamed parameter so we can drain it if it does not get used", " // by embedded when the statement is executed. DERBY-3085", " stmt.setStreamedParameter(stream);" ], "header": "@@ -4682,12 +4686,13 @@ class DRDAConnThread extends Thread {", "removed": [ " ", "" ] }, { "added": [ " setAsCharacterStream(stmt," ], "header": "@@ -4745,7 +4750,7 @@ class DRDAConnThread extends Thread {", "removed": [ " setAsCharacterStream(ps," ] }, { "added": [ " setAsCharacterStream(stmt," ], "header": "@@ -4756,7 +4761,7 @@ class DRDAConnThread extends Thread {", "removed": [ " setAsCharacterStream(ps," ] }, { "added": [ " setAsCharacterStream(stmt," ], "header": "@@ -4767,7 +4772,7 @@ class DRDAConnThread extends Thread {", "removed": [ " setAsCharacterStream(ps," ] }, { "added": [ " private static void setAsCharacterStream(DRDAStatement stmt," ], "header": "@@ -8361,7 +8366,7 @@ class DRDAConnThread extends Thread {", "removed": [ " private static void setAsCharacterStream(PreparedStatement ps," ] } ] }, { "file": "java/drda/org/apache/derby/impl/drda/DRDAStatement.java", "hunks": [ { "added": [ "import java.io.IOException;" ], "header": "@@ -21,6 +21,7 @@", "removed": [] }, { "added": [ "\t\t// The last parameter may be streamed. ", "\t\t// We need to keep a record of it so we can drain it if it is not ", "\t\t// used.", "\t\t// Only the last parameter with an EXTDTA will be streamed. ", "\t\t//(See DRDAConnThread.readAndSetAllExtParams()). ", "\t\tprivate EXTDTAReaderInputStream streamedParameter = null;" ], "header": "@@ -108,6 +109,12 @@ class DRDAStatement", "removed": [] }, { "added": [ "\t\t\tstreamedParameter = null;" ], "header": "@@ -132,6 +139,7 @@ class DRDAStatement", "removed": [] }, { "added": [ " ", "\t\t/**", "\t\t * Read the rest of the streamed parameter if not consumed", "\t\t * by the executing statement. DERBY-3085", "\t\t * @throws IOException", "\t\t */", "\t\tprotected void drainStreamedParameter() throws IOException", "\t\t{", "\t\t\tif (streamedParameter != null)", "\t\t\t{ ", "\t\t\t\t// we drain the buffer 1000 bytes at a time.", "\t\t\t\t// 1000 is just a random selection that doesn't take", "\t\t\t\t// too much memory. Perhaps something else would be ", "\t\t\t\t// more efficient?", "\t\t\t\tbyte[] buffer = new byte[1000];", "\t\t\t\tint i;", "\t\t\t\tdo {", "\t\t\t\t\ti= streamedParameter.read(buffer,0,1000);", "\t\t\t\t} while (i != -1);", "\t\t\t}", "\t\t}", " ", "", "\t\tpublic void setStreamedParameter(EXTDTAReaderInputStream eis) {", "\t\t\tstreamedParameter = eis; ", "\t\t}", "\t\t" ], "header": "@@ -223,6 +231,33 @@ class DRDAStatement", "removed": [] }, { "added": [ "\t\t// DERBY-3085 - We need to make sure we drain the streamed parameter", "\t\t// if not used by the server, for example if an update statement does not ", "\t\t// update any rows, the parameter won't be used. Network Server will", "\t\t// stream only the last parameter with an EXTDTA. This is stored when the", "\t\t// parameter is set and drained now after statement execution if needed.", "\t\ttry {", "\t\t\tdrdaParamState_.drainStreamedParameter();", "\t\t} catch (IOException e) { ", "\t\t\tUtil.javaException(e);", "\t\t}" ], "header": "@@ -664,7 +699,16 @@ class DRDAStatement", "removed": [ "" ] } ] } ]
derby-DERBY-3086-63adae87
DERBY-3086: More permissions and privilege blocks so that the server tracing and sysinfo will continue to work when the server automatically installs a security manager. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@592758 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/tools/org/apache/derby/impl/tools/sysinfo/Main.java", "hunks": [ { "added": [ "\t String classpath = null;", "", " try {", " classpath = (String) AccessController.doPrivileged( new PrivilegedAction()", " {", " public Object run()", " {", " return System.getProperty(\"java.class.path\");", " }", " }", " );" ], "header": "@@ -199,10 +199,17 @@ public static void getMainInfo (java.io.PrintWriter aw, boolean pause) {", "removed": [ "\t String classpath;", "", "\t try {", "\t\t classpath = System.getProperty(\"java.class.path\");" ] }, { "added": [ " ZipInfoProperties zip[]= Main.getAllInfo (classpath);" ], "header": "@@ -210,7 +217,7 @@ public static void getMainInfo (java.io.PrintWriter aw, boolean pause) {", "removed": [ " ZipInfoProperties zip[]= Main.getAllInfo (classpath);" ] }, { "added": [ " private static String getJavaProperty (final String whichProperty) {", " final String unavailable = Main.getTextMessage (\"SIF01.H\");", " String property = (String) AccessController.doPrivileged( new PrivilegedAction()", " {", " public Object run()", " {", " return System.getProperty (whichProperty, unavailable);", " }", " }", " );", " return property;" ], "header": "@@ -289,15 +296,20 @@ public static void getMainInfo (java.io.PrintWriter aw, boolean pause) {", "removed": [ " private static String getJavaProperty (String whichProperty) {", " String property;", " String unavailable = Main.getTextMessage (\"SIF01.H\");", "", " property = System.getProperty (whichProperty, unavailable);", " return property;" ] }, { "added": [ " private static ZipInfoProperties checkForInfo(final String cpEntry)", " return (ZipInfoProperties) AccessController.doPrivileged( new PrivilegedAction()", " {", " public Object run()", " {", " File f = new File(cpEntry);", " if ( ! f.exists())", " {", " return null;", " }", " if (f.isDirectory())", " {", " ZipInfoProperties zip = checkDirectory(cpEntry);", " return zip;", " }", " if (f.isFile())", " {", " ZipInfoProperties zip = checkFile(cpEntry);", " return zip;", " }", " return null;", " }", " }", " );", " " ], "header": "@@ -889,26 +901,34 @@ public static void getMainInfo (java.io.PrintWriter aw, boolean pause) {", "removed": [ " private static ZipInfoProperties checkForInfo(String cpEntry)", " File f = new File(cpEntry);", " if ( ! f.exists())", " {", " return null;", " }", " if (f.isDirectory())", " {", " ZipInfoProperties zip = checkDirectory(cpEntry);", " return zip;", " }", " if (f.isFile())", " {", " ZipInfoProperties zip = checkFile(cpEntry);", " return zip;", " }", " return null;" ] } ] } ]
derby-DERBY-3088-044179c3
DERBY-3088 - improvements to ServerPropertiesTest and related changes - adds an assertExecJavaCmdAsExpected method to BaseTestCase.java git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@612684 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java", "hunks": [ { "added": [ " System.out.println( \"XXX server startup command = \");", " " ], "header": "@@ -225,12 +225,12 @@ final public class NetworkServerTestSetup extends BaseTestSetup {", "removed": [ " /* System.out.println( \"XXX server startup command = \");", " */" ] } ] } ]
derby-DERBY-3088-0c8f7b8c
DERBY-3088 - (partial) follow up patch to convert testProperties to junit test ServerPropertiesTest. This change reworks the first fixture (ttestSetPortPriority) to take advantage of NetworkServerTestSetup; to do so there are changes to NetworkServerTestSetup. Also modified method execJavaCmd in junit.Utilities to do something in addition to the assertExecJavaCmdAsExpected in BaseTestCase and made use if it. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@616982 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java", "hunks": [ { "added": [ " private final boolean startServerAtSetup;" ], "header": "@@ -59,6 +59,7 @@ final public class NetworkServerTestSetup extends BaseTestSetup {", "removed": [] }, { "added": [ " this.startServerAtSetup = true;", " /**", " * Decorator this test with the NetworkServerTestSetup.", " * ", " * Sets up the server using the current configuration, but does not start.", " * ", " * @param test the Test for which this setup is used", " * @param asCommand True to start using NetworkServerControl.main()", " * within the same virtual machine, false to use NetworkServerControl.start.", " * @param startServerAtSetup False to start using NetworkServerControl.main()", " * ", " * @see NetworkServerControl#main(String[])", " * @see NetworkServerControl#start(PrintWriter)", " */", " public NetworkServerTestSetup(Test test, boolean asCommand, boolean startServerAtSetup) {", " super(test);", " this.asCommand = asCommand;", "", " this.systemProperties = null;", " this.startupArgs = null;", " this.useSeparateProcess = false;", " this.serverShouldComeUp = true;", " this.inputStreamHolder = null;", "", " this.startServerAtSetup = startServerAtSetup;", " }", " " ], "header": "@@ -97,8 +98,35 @@ final public class NetworkServerTestSetup extends BaseTestSetup {", "removed": [] }, { "added": [ " this.startServerAtSetup = true;" ], "header": "@@ -122,6 +150,7 @@ final public class NetworkServerTestSetup extends BaseTestSetup {", "removed": [] }, { "added": [ " if (startServerAtSetup)", " {", " if (useSeparateProcess)", " { serverProcess = startSeparateProcess(); }", " else if (asCommand)", " { startWithCommand(); }", " else", " { startWithAPI(); }", "", " if ( serverShouldComeUp ) { waitForServerStart(networkServerController); }", " }" ], "header": "@@ -132,14 +161,17 @@ final public class NetworkServerTestSetup extends BaseTestSetup {", "removed": [ " if (useSeparateProcess)", " { serverProcess = startSeparateProcess(); }", " else if (asCommand)", " { startWithCommand(); }", " else", " { startWithAPI(); }", " ", " if ( serverShouldComeUp ) { waitForServerStart(networkServerController); }" ] }, { "added": [ " /**", " * Return a new NetworkServerControl for the current configuration.", " * Use the port number specified.", " * This method is not for general use - in most cases, the port", " * should not be specified in the test, instead, the test framework", " * will decide what is the best port number to use.", " */", " public static NetworkServerControl getNetworkServerControl(int port)", " throws Exception", " {", " TestConfiguration config = TestConfiguration.getCurrent();", " return new NetworkServerControl", " (InetAddress.getByName(config.getHostName()), ", " port);", " }", " ", " /**", " * Return a new NetworkServerControl for the current configuration.", " * Use default values, i.e. port number and host are dependent on ", " * whatever settings are set in the environment (properties)", " */", " public static NetworkServerControl getNetworkServerControlDefault()", " throws Exception", " {", " TestConfiguration config = TestConfiguration.getCurrent();", " return new NetworkServerControl();", " }", " " ], "header": "@@ -365,6 +397,34 @@ final public class NetworkServerTestSetup extends BaseTestSetup {", "removed": [] }, { "added": [ " /**", " * Set the number of milliseconds to wait before declaring server startup", " * a failure back to the default value specified in this class.", " * ", " */", " public static void setDefaultWaitTime()", " {", " waitTime = WAIT_TIME;", " }", " " ], "header": "@@ -386,6 +446,16 @@ final public class NetworkServerTestSetup extends BaseTestSetup {", "removed": [] }, { "added": [ " public static boolean pingForServerUp(", " NetworkServerControl networkServerController, Process serverProcess,", " boolean expectServerUp)", " // If we expect the server to be or come up, then", " // it makes sense to sleep (if ping unsuccessful), then ping ", " // and repeat this for the duration of wait-time, but stop", " // when the ping is successful.", " // But if we are pinging to see if the server is - or", " // has come - down, we should do the opposite, stop if ping ", " // is unsuccessful, and repeat until wait-time if it is", " if (expectServerUp)", " return true;", " else", " {", " if (System.currentTimeMillis() - startTime > waitTime) {", " return true;", " }", " }" ], "header": "@@ -395,16 +465,30 @@ final public class NetworkServerTestSetup extends BaseTestSetup {", "removed": [ " public static boolean pingForServerStart(", " NetworkServerControl networkServerController, Process serverProcess)", " Thread.sleep(SLEEP_TIME);", " return true;" ] }, { "added": [ " if (expectServerUp){", " if (System.currentTimeMillis() - startTime > waitTime) ", " return false;", " // else, we got what we expected, done.", " else", " return false;" ], "header": "@@ -416,9 +500,13 @@ final public class NetworkServerTestSetup extends BaseTestSetup {", "removed": [ " if (System.currentTimeMillis() - startTime > waitTime) {", " return false;" ] }, { "added": [ " Thread.sleep(SLEEP_TIME);" ], "header": "@@ -438,6 +526,7 @@ final public class NetworkServerTestSetup extends BaseTestSetup {", "removed": [] } ] }, { "file": "java/testing/org/apache/derbyTesting/junit/Utilities.java", "hunks": [ { "added": [ " * Execute a java command and return the process.", " * The caller should decide what to do with the process, if anything,", " * typical activities would be to do a pr.waitFor, or to", " * get a getInputStream or getErrorStream", " * Note, that for verifying the output of a Java process, there is", " * BaseTestCase.assertExecJavaCmdAsExpected", " * @param args", " * @return the Process ", " public static Process execJavaCmd(String[] args) throws IOException, InterruptedException {" ], "header": "@@ -151,15 +151,18 @@ public class Utilities {", "removed": [ " * Execute a java command and check for the appropriate exit code.", " * return an InputStream ", " * @param args", " * @param expectedExitCode", " public static InputStream execJavaCmd(String[] args, int expectedExitCode) throws IOException, InterruptedException {", " InputStream is = null;" ] }, { "added": [ " return pr;" ], "header": "@@ -189,14 +192,8 @@ public class Utilities {", "removed": [ " is = pr.getInputStream();", " ", " // wait until the process exits", " pr.waitFor();", " ", " Assert.assertEquals(expectedExitCode,pr.exitValue());", " return is;" ] } ] } ]
derby-DERBY-3092-0fc17872
DERBY-3092 (partial) Use the Map interface to access TransactionTable.trans This change will make it easier to replace the Hashtable with a ConcurrentHashMap on platforms that support java.util.concurrent, since we don't use Hashtable-specific methods anymore. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@901100 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/store/raw/xact/TransactionTable.java", "hunks": [ { "added": [], "header": "@@ -25,7 +25,6 @@ import org.apache.derby.iapi.services.context.ContextManager;", "removed": [ "import org.apache.derby.iapi.services.io.FormatIdUtil;" ] }, { "added": [ "import java.util.Iterator;", "import java.util.Map;", "" ], "header": "@@ -37,12 +36,12 @@ import org.apache.derby.iapi.store.raw.log.LogInstant;", "removed": [ "import org.apache.derby.iapi.error.StandardException;", "", "import java.util.Enumeration;" ] }, { "added": [ "\tprivate final Map trans;" ], "header": "@@ -91,7 +90,7 @@ public class TransactionTable implements Formatable", "removed": [ "\tprivate Hashtable trans;" ] }, { "added": [ "\tpublic Map getTableForXA()" ], "header": "@@ -293,7 +292,7 @@ public class TransactionTable implements Formatable", "removed": [ "\tpublic Hashtable getTableForXA()" ] }, { "added": [ " for (Iterator it = trans.values().iterator(); it.hasNext(); )", " TransactionTableEntry entry = (TransactionTableEntry) it.next();" ], "header": "@@ -346,10 +345,9 @@ public class TransactionTable implements Formatable", "removed": [ " for (Enumeration e = trans.elements(); e.hasMoreElements();) ", " TransactionTableEntry entry = ", " (TransactionTableEntry) e.nextElement();" ] }, { "added": [ "\t\t\tfor (Iterator it = trans.values().iterator(); it.hasNext(); )", "\t\t\t\tTransactionTableEntry ent = (TransactionTableEntry) it.next();" ], "header": "@@ -383,9 +381,9 @@ public class TransactionTable implements Formatable", "removed": [ "\t\t\tfor (Enumeration e = trans.elements(); e.hasMoreElements(); )", "\t\t\t\tTransactionTableEntry ent = (TransactionTableEntry)e.nextElement();" ] }, { "added": [ "\t\t\t\tfor (Iterator it = trans.values().iterator(); it.hasNext(); )", "\t\t\t\t\tTransactionTableEntry ent =", "\t\t\t\t\t\t\t(TransactionTableEntry) it.next();" ], "header": "@@ -427,13 +425,12 @@ public class TransactionTable implements Formatable", "removed": [ "\t\t\t\tint maxcount = trans.size();", "\t\t\t\tfor (Enumeration e = trans.elements();", "\t\t\t\t\t e.hasMoreElements(); )", "\t\t\t\t\tTransactionTableEntry ent = (TransactionTableEntry)e.nextElement();" ] }, { "added": [ "\t\t\t\tfor (Iterator it = trans.values().iterator(); it.hasNext(); )", "\t\t\t\t\tTransactionTableEntry ent =", "\t\t\t\t\t\t\t(TransactionTableEntry) it.next();", "\t\t\t\t\tif (ent != null && ent.isUpdate())", "\t\t\t\t\t\t// only writes out update transaction", "\t\t\t\t\t\tout.writeObject(ent);" ], "header": "@@ -441,17 +438,14 @@ public class TransactionTable implements Formatable", "removed": [ "\t\t\t\tif (count > 0)", "\t\t\t\t\tfor (Enumeration e = trans.elements();", "\t\t\t\t\t\t e.hasMoreElements() ; )", "\t\t\t\t\t\tTransactionTableEntry ent = (TransactionTableEntry)e.nextElement();", "\t\t\t\t\t\tif (ent != null && ent.isUpdate())", "\t\t\t\t\t\t{", "\t\t\t\t\t\t\t// only writes out update transaction", "\t\t\t\t\t\t\tout.writeObject(ent);", "\t\t\t\t\t\t}" ] }, { "added": [ "\t\tfor (Iterator it = trans.values().iterator(); it.hasNext(); )", "\t\t\tTransactionTableEntry ent = (TransactionTableEntry) it.next();" ], "header": "@@ -518,10 +512,9 @@ public class TransactionTable implements Formatable", "removed": [ "\t\tfor (Enumeration e = trans.elements();", "\t\t\t e.hasMoreElements() ; )", "\t\t\tTransactionTableEntry ent = (TransactionTableEntry)e.nextElement();" ] }, { "added": [ " for (Iterator it = trans.values().iterator(); it.hasNext(); )", " TransactionTableEntry ent = (TransactionTableEntry) it.next();" ], "header": "@@ -571,9 +564,9 @@ public class TransactionTable implements Formatable", "removed": [ " for (Enumeration e = trans.elements(); e.hasMoreElements(); )", " TransactionTableEntry ent = (TransactionTableEntry) e.nextElement();" ] }, { "added": [ "\t\tfor (Iterator it = trans.values().iterator(); it.hasNext(); )", "\t\t\tTransactionTableEntry ent = (TransactionTableEntry) it.next();" ], "header": "@@ -613,10 +606,9 @@ public class TransactionTable implements Formatable", "removed": [ "\t\tfor (Enumeration e = trans.elements();", "\t\t\t e.hasMoreElements() ; )", "\t\t\tTransactionTableEntry ent = (TransactionTableEntry)e.nextElement();" ] }, { "added": [ "\t\t\tfor (Iterator it = trans.values().iterator(); it.hasNext() ; )", "\t\t\t\tTransactionTableEntry ent = (TransactionTableEntry) it.next();" ], "header": "@@ -668,11 +660,9 @@ public class TransactionTable implements Formatable", "removed": [ "\t\t\tfor (Enumeration e = trans.elements();", "\t\t\t\t e.hasMoreElements() ; )", "\t\t\t\tTransactionTableEntry ent =", "\t\t\t\t\t (TransactionTableEntry)e.nextElement();" ] }, { "added": [ " for (Iterator it = trans.values().iterator(); it.hasNext();)", " (TransactionTableEntry) it.next();" ], "header": "@@ -709,10 +699,10 @@ public class TransactionTable implements Formatable", "removed": [ " for (Enumeration e = trans.elements(); e.hasMoreElements();)", " (TransactionTableEntry)e.nextElement();" ] }, { "added": [ "\t\t\tfor (Iterator it = trans.values().iterator(); it.hasNext(); )", "\t\t\t\tent = (TransactionTableEntry) it.next();" ], "header": "@@ -767,9 +757,9 @@ public class TransactionTable implements Formatable", "removed": [ "\t\t\tfor (Enumeration e = trans.elements(); e.hasMoreElements(); )", "\t\t\t\tent = (TransactionTableEntry)e.nextElement();" ] }, { "added": [ " for (Iterator it = trans.values().iterator(); it.hasNext();)", " ent = (TransactionTableEntry) it.next();" ], "header": "@@ -792,9 +782,9 @@ public class TransactionTable implements Formatable", "removed": [ " for (Enumeration e = trans.elements(); e.hasMoreElements();)", " ent = (TransactionTableEntry)e.nextElement();" ] }, { "added": [ " for (Iterator it = trans.values().iterator(); it.hasNext(); )", " (TransactionTableEntry) it.next();" ], "header": "@@ -861,10 +851,10 @@ public class TransactionTable implements Formatable", "removed": [ " for (Enumeration e = trans.elements(); e.hasMoreElements(); )", " (TransactionTableEntry)e.nextElement();" ] }, { "added": [], "header": "@@ -935,9 +925,6 @@ public class TransactionTable implements Formatable", "removed": [ "\t\tif (SanityManager.DEBUG)", "\t\t\tSanityManager.DEBUG(\"TranTrace\", toString());", "" ] }, { "added": [ "\t\t\tif (SanityManager.DEBUG)", "\t\t\t\tSanityManager.DEBUG(\"TranTrace\", toString());", "", "\t\t\tfor (Iterator it = trans.values().iterator(); it.hasNext(); )", "\t\t\t\tTransactionTableEntry ent = (TransactionTableEntry) it.next();" ], "header": "@@ -947,17 +934,17 @@ public class TransactionTable implements Formatable", "removed": [ "\t\t\tLogInstant logInstant = null;", "\t\t\tfor (Enumeration e = trans.elements();", "\t\t\t\t e.hasMoreElements(); )", "\t\t\t\tTransactionTableEntry ent =", "\t\t\t\t\t(TransactionTableEntry)e.nextElement();" ] }, { "added": [ "\t\t\tfor (Iterator it = trans.values().iterator(); it.hasNext(); )", "\t\t\t\tTransactionTableEntry ent = (TransactionTableEntry) it.next();" ], "header": "@@ -983,11 +970,9 @@ public class TransactionTable implements Formatable", "removed": [ "\t\t\tfor (Enumeration e = trans.elements();", "\t\t\t\t e.hasMoreElements(); )", "\t\t\t\tTransactionTableEntry ent =", "\t\t\t\t\t(TransactionTableEntry)e.nextElement(); " ] } ] }, { "file": "java/engine/org/apache/derby/impl/store/raw/xact/XactXAResourceManager.java", "hunks": [ { "added": [ "import java.util.Iterator;", "import java.util.Map;" ], "header": "@@ -37,14 +37,8 @@ import org.apache.derby.iapi.store.raw.GlobalTransactionId;", "removed": [ "", "import org.apache.derby.impl.store.raw.xact.GlobalXactId;", "import org.apache.derby.impl.store.raw.xact.TransactionTable;", "import org.apache.derby.impl.store.raw.xact.TransactionTableEntry;", "import org.apache.derby.impl.store.raw.xact.Xact;", "", "import java.util.Enumeration;", "import java.util.Hashtable;" ] }, { "added": [ " Map trans_hashtable = transaction_table.getTableForXA();" ], "header": "@@ -250,7 +244,7 @@ public class XactXAResourceManager implements XAResourceManager", "removed": [ " Hashtable trans_hashtable = transaction_table.getTableForXA();" ] }, { "added": [ " for (Iterator it = trans_hashtable.values().iterator();", " it.hasNext(); i++)", " ((TransactionTableEntry) it.next()).getXact();" ], "header": "@@ -259,11 +253,11 @@ public class XactXAResourceManager implements XAResourceManager", "removed": [ " for (Enumeration e = trans_hashtable.elements(); ", " e.hasMoreElements(); i++) ", " ((TransactionTableEntry) e.nextElement()).getXact();" ] } ] } ]
derby-DERBY-3092-3c48dd92
DERBY-3092 (partial) Don't expose TransactionTable's Hashtable Added a visitEntries() method that could be used instead of getTableForXA() to inspect the contents of the transaction table. Now, the Hashtable is only visible to the TransactionTable class, which will make it easier to replace it with another Map implementation later. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@901597 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/store/raw/xact/TransactionTable.java", "hunks": [ { "added": [ " /**", " * Interface for visiting entries in the transaction table.", " * @see #visitEntries(EntryVisitor)", " */", " static interface EntryVisitor {", " /**", " * Visit an entry. {@link #visitEntries(EntryVisitor)} will call this", " * method once for each entry in the transaction table.", " *", " * @param entry the {@code TransactionTableEntry} being visited", " */", " void visit(TransactionTableEntry entry);", " }", " /**", " * <p>", " * Visit all the entries in the transaction table.", " * </p>", " *", " * <p>", " * MT - MT safe", " * </p>", " *", " * @param visitor the visitor to apply on each transaction table entry", " */", " void visitEntries(EntryVisitor visitor) {", " synchronized (trans) {", " for (Iterator it = trans.values().iterator(); it.hasNext(); ) {", " visitor.visit((TransactionTableEntry) it.next());", " }", " }", " }" ], "header": "@@ -117,7 +117,38 @@ public class TransactionTable implements Formatable", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/store/raw/xact/XactXAResourceManager.java", "hunks": [ { "added": [ "import java.util.ArrayList;" ], "header": "@@ -37,8 +37,7 @@ import org.apache.derby.iapi.store.raw.GlobalTransactionId;", "removed": [ "import java.util.Iterator;", "import java.util.Map;" ] }, { "added": [ " final ArrayList xid_list = new ArrayList();", "", " // Create a visitor that adds each of the prepared transactions", " // to xid_list.", " final TransactionTable.EntryVisitor visitor =", " new TransactionTable.EntryVisitor() {", " public void visit(TransactionTableEntry entry) {", " Xact xact = entry.getXact();", " xid_list.add(", " xa_id.getBranchQualifier()));", " };", "", " // Collect the prepared transactions.", " transaction_table.visitEntries(visitor);", "", " // Convert the list to an array suitable for being returned.", " ret_xid_list = new XAXactId[xid_list.size()];", " ret_xid_list = (XAXactId[]) xid_list.toArray(ret_xid_list);" ], "header": "@@ -244,48 +243,33 @@ public class XactXAResourceManager implements XAResourceManager", "removed": [ " Map trans_hashtable = transaction_table.getTableForXA();", " XAXactId[] xid_list = new XAXactId[trans_hashtable.size()];", " int num_prepared = 0;", "", " // Need to hold sync while linear searching the hash table.", " synchronized (trans_hashtable)", " {", " int i = 0;", "", " for (Iterator it = trans_hashtable.values().iterator();", " it.hasNext(); i++)", " {", " Xact xact = ", " ((TransactionTableEntry) it.next()).getXact();", "", " xid_list[i] = ", " xa_id.getBranchQualifier());", " num_prepared++;", " }", "", " // now need to squish the nulls out of the array to return. ", " ret_xid_list = new XAXactId[num_prepared];", " int ret_index = 0;", " for (int i = xid_list.length; i-- > 0; )", " {", " if (xid_list[i] != null)", " ret_xid_list[ret_index++] = xid_list[i];", " }", "", " if (SanityManager.DEBUG)", " {", " SanityManager.ASSERT(ret_index == num_prepared);", " }" ] } ] } ]
derby-DERBY-3092-6e66e704
DERBY-3092 (partial) Add back optimization that was mistakenly removed by the previous patch git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@901162 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/store/raw/xact/TransactionTable.java", "hunks": [ { "added": [ "\t\t\t\tif (count > 0)", "\t\t\t\t\tfor (Iterator it = trans.values().iterator(); it.hasNext();)", "\t\t\t\t\t\tTransactionTableEntry ent =", "\t\t\t\t\t\t\t\t(TransactionTableEntry) it.next();", "\t\t\t\t\t\tif (ent != null && ent.isUpdate())", "\t\t\t\t\t\t{", "\t\t\t\t\t\t\t// only write out update transactions", "\t\t\t\t\t\t\tout.writeObject(ent);", "\t\t\t\t\t\t}" ], "header": "@@ -438,14 +438,17 @@ public class TransactionTable implements Formatable", "removed": [ "\t\t\t\tfor (Iterator it = trans.values().iterator(); it.hasNext(); )", "\t\t\t\t\tTransactionTableEntry ent =", "\t\t\t\t\t\t\t(TransactionTableEntry) it.next();", "\t\t\t\t\tif (ent != null && ent.isUpdate())", "\t\t\t\t\t\t// only writes out update transaction", "\t\t\t\t\t\tout.writeObject(ent);" ] } ] } ]
derby-DERBY-3092-e21c3de3
DERBY-3092 (partial) Use visitors instead of iterators to scan the transaction table in the methods that synchronize explicitly on the Hashtable trans. This limits the usage of explicit synchronization on trans to one single method, TransactionTable.visitEntries(). git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@903200 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/store/raw/xact/TransactionTable.java", "hunks": [ { "added": [ "import java.util.ArrayList;" ], "header": "@@ -38,6 +38,7 @@ import org.apache.derby.iapi.store.raw.xact.TransactionId;", "removed": [] }, { "added": [ " To allow thread-safe iteration over the values in the Hashtable, callers", " must synchronize on the Hashtable while iterating. The method {@link", " #visitEntries(EntryVisitor)} abstracts the synchronization and iteration", " so that the callers don't need to synchronize explicitly when they go", " through the contents of the table. Methods that are only called during", " recovery don't need to take MT considerations, and can safely use iterators", " with no additional synchronization." ], "header": "@@ -81,6 +82,13 @@ import java.io.IOException;", "removed": [] }, { "added": [ " * method once for each entry in the transaction table, or until", " * {@code false} is returned by this method.", " * @return {@code true} if the scan of the transaction table should", " * continue, or {@code false} if the visitor has completed its work", " * and no more entries need to be visited", " boolean visit(TransactionTableEntry entry);" ], "header": "@@ -124,11 +132,15 @@ public class TransactionTable implements Formatable", "removed": [ " * method once for each entry in the transaction table.", " void visit(TransactionTableEntry entry);" ] }, { "added": [ " if (!visitor.visit((TransactionTableEntry) it.next())) {", " // The visitor returned false, meaning that it's done with", " // all of its work and we can stop the scan.", " break;", " }" ], "header": "@@ -145,7 +157,11 @@ public class TransactionTable implements Formatable", "removed": [ " visitor.visit((TransactionTableEntry) it.next());" ] }, { "added": [ " final GlobalXactId global_id)", " final ContextManager[] cm = new ContextManager[1];", " visitEntries(new EntryVisitor() {", " public boolean visit(TransactionTableEntry entry) {", " GlobalTransactionId entry_gid = entry.getGid();", " if (entry_gid != null && entry_gid.equals(global_id)) {", " cm[0] = entry.getXact().getContextManager();", " return cm[0] == null; // continue until context is found", " });", "", " return cm[0];" ], "header": "@@ -348,31 +364,21 @@ public class TransactionTable implements Formatable", "removed": [ " GlobalXactId global_id)", " ContextManager cm = null;", "", " // Need to hold sync while linear searching the hash table.", " synchronized (trans)", " {", " for (Iterator it = trans.values().iterator(); it.hasNext(); )", " {", " TransactionTableEntry entry = (TransactionTableEntry) it.next();", "", " if (entry != null)", " {", " GlobalTransactionId entry_gid = entry.getGid();", " if (entry_gid != null && entry_gid.equals(global_id))", " {", " cm = entry.getXact().getContextManager();", " break;", " }", " }", " ", "\t\treturn(cm);" ] }, { "added": [ " UpdateTransactionCounter counter =", " new UpdateTransactionCounter(true);", " visitEntries(counter);", " return counter.getCount() > 0;", " /**", " * Visitor class that counts update transactions. Note that update", " * transactions may be added or removed concurrently unless the caller", " * synchronizes on \"this\" (the {@code TransactionTable} instance) while", " * applying the visitor.", " */", " private static class UpdateTransactionCounter implements EntryVisitor", " {", " private final boolean stopOnFirst;", " private int count;", " /**", " * Create an instance of this visitor.", " *", " * @param stopOnFirst if {@code true}, stop the scan as soon as we", " * have found one update transaction (useful if all we care about is", " * whether or not the transaction table contains an update transaction);", " * otherwise, scan the entire transaction table", " */", " UpdateTransactionCounter(boolean stopOnFirst) {", " this.stopOnFirst = stopOnFirst;", " }", "", " /**", " * Check if the entry represents an update transaction, and update", " * the counter accordingly.", " */", " public boolean visit(TransactionTableEntry entry) {", " if (entry.isUpdate()) {", " count++;", " }", " // Continue the scan if a full scan was requested, or if no update", " // transactions have been found yet.", " return !stopOnFirst || (count == 0);", " }", "", " /**", " * Get the number of update transactions seen by this visitor", " * @return number of update transactions", " */", " int getCount() {", " return count;", " }", " }" ], "header": "@@ -391,17 +397,57 @@ public class TransactionTable implements Formatable", "removed": [ "\t\t\tfor (Iterator it = trans.values().iterator(); it.hasNext(); )", "\t\t\t{", "\t\t\t\tTransactionTableEntry ent = (TransactionTableEntry) it.next();", "\t\t\t\tif (ent != null && ent.isUpdate())", "\t\t\t\t\treturn true;", "\t\t\t}", "\t\treturn false;" ] }, { "added": [ "\tpublic void writeExternal(final ObjectOutput out) throws IOException", " // We don't care if transactions are added or removed from the table", " // while we're writing it out, as long as the number of update", " // transactions is constant. Synchronizing on \"this\" prevents other", " // threads from adding or removing update transactions.", " {", " UpdateTransactionCounter counter =", " new UpdateTransactionCounter(false);", " visitEntries(counter);", " int count = counter.getCount();", " CompressedNumber.writeInt(out, count);", " // now write them out", " if (count > 0)", " {", " // Count the number of writes in debug builds.", " final int[] writeCount =", " SanityManager.DEBUG ? new int[1] : null;", "", " final IOException[] thrownException = new IOException[1];", "", " visitEntries(new EntryVisitor() {", " public boolean visit(TransactionTableEntry entry) {", " try {", " if (entry.isUpdate()) {", " // only write out update transactions", " out.writeObject(entry);", " if (SanityManager.DEBUG) {", " writeCount[0]++;", " }", " }", " } catch (IOException ioe) {", " thrownException[0] = ioe;", " return false; // stop on error", " }", " return true; // go through entire table", " }", " });", "", " if (thrownException[0] != null) {", " throw thrownException[0];", " }", "", " // Verify that we wrote the expected number of transactions.", " if (SanityManager.DEBUG) {", " SanityManager.ASSERT(count == writeCount[0]);", " }" ], "header": "@@ -420,47 +466,59 @@ public class TransactionTable implements Formatable", "removed": [ "\tpublic void writeExternal(ObjectOutput out) throws IOException ", "\t\t//Note: syncing both on trans and this variable could be avoided if", "\t\t//all the routines in this class are sycned on \"this\" and does not", "\t\t//depend on hash table synchronization. But that will be overkill ", "\t\t//because this routine gets called only on checkpoints and others", "\t\t//are used more often.", "\t\t{\t", "\t\t\t// don't touch the transaction table when I am being written out", "\t\t\tsynchronized(trans)", "\t\t\t{", "\t\t\t\tint count = 0;", "\t\t\t\t// first count up the number of active update transactions ", "\t\t\t\tfor (Iterator it = trans.values().iterator(); it.hasNext(); )", "\t\t\t\t{", "\t\t\t\t\tTransactionTableEntry ent =", "\t\t\t\t\t\t\t(TransactionTableEntry) it.next();", "\t\t\t\t\tif (ent != null && ent.isUpdate())", "\t\t\t\t\t\tcount++;", "\t\t\t\t}", "\t\t\t\tCompressedNumber.writeInt(out, count);", "\t\t\t\t// now write them out", "\t\t\t\tif (count > 0)", "\t\t\t\t{", "\t\t\t\t\tfor (Iterator it = trans.values().iterator(); it.hasNext();)", "\t\t\t\t\t{", "\t\t\t\t\t\tTransactionTableEntry ent =", "\t\t\t\t\t\t\t\t(TransactionTableEntry) it.next();", "\t\t\t\t\t\tif (ent != null && ent.isUpdate())", "\t\t\t\t\t\t{", "\t\t\t\t\t\t\t// only write out update transactions", "\t\t\t\t\t\t\tout.writeObject(ent);", "\t\t\t\t\t\t}", "\t\t\t\t\t}", "\t\t\t\t}" ] }, { "added": [ " final LogInstant[] logInstant = new LogInstant[1];", " visitEntries(new EntryVisitor() {", " public boolean visit(TransactionTableEntry entry) {", " if (entry.isUpdate()) {", " if ((logInstant[0] == null) ||", " entry.getFirstLog().lessThan(logInstant[0])) {", " logInstant[0] = entry.getFirstLog();", " return true; // scan entire transaction table", " });", " return logInstant[0];" ], "header": "@@ -855,32 +913,20 @@ public class TransactionTable implements Formatable", "removed": [ "\t\t\tLogInstant logInstant = null;", " ", " // bug 5632: need to sychronize so that another thread does not ", " // come in and disrupt the for loop, we got an exception on next,", " // likely because hash table changed by another thread after", " // hasMoreElements() called, but before nextElement().", "", " synchronized (trans)", " {", " for (Iterator it = trans.values().iterator(); it.hasNext(); )", " {", " TransactionTableEntry ent =", " (TransactionTableEntry) it.next();", "", " if (ent != null && ent.isUpdate())", " {", " if (logInstant == null || ", " ent.getFirstLog().lessThan(logInstant))", " {", " logInstant = ent.getFirstLog();", " }", "\t\t\treturn logInstant;" ] } ] }, { "file": "java/engine/org/apache/derby/impl/store/raw/xact/XactXAResourceManager.java", "hunks": [ { "added": [ " public boolean visit(TransactionTableEntry entry) {" ], "header": "@@ -249,7 +249,7 @@ public class XactXAResourceManager implements XAResourceManager", "removed": [ " public void visit(TransactionTableEntry entry) {" ] }, { "added": [ " return true; // scan the entire transaction table" ], "header": "@@ -261,6 +261,7 @@ public class XactXAResourceManager implements XAResourceManager", "removed": [] } ] } ]
derby-DERBY-3093-98d82d9e
DERBY-3093: Intermittent transaction failure caused by internal duplicate savepoint name for triggers Don't use hashCode() to generate unique savepoint name. Contributed by James F. Adams. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@586956 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/conn/GenericStatementContext.java", "hunks": [ { "added": [ " // Counter used to create unique savepoint names.", " private static long nextNameId = Long.MIN_VALUE;", "" ], "header": "@@ -96,6 +96,9 @@ final class GenericStatementContext", "removed": [] }, { "added": [ " internalSavePointName = createInternalSavepointName();" ], "header": "@@ -105,7 +108,7 @@ final class GenericStatementContext", "removed": [ "\t\tinternalSavePointName = \"ISSP\" + hashCode();" ] }, { "added": [ " /**", " * Generate a unique name for this savepoint.", " * This method should only be called from the constructor.", " *", " * @return the savepoint name.", " */", " private synchronized static String createInternalSavepointName() {", " return \"ISSP\" + nextNameId++;", " }", "" ], "header": "@@ -115,6 +118,16 @@ final class GenericStatementContext", "removed": [] } ] } ]
derby-DERBY-3094-31d80c00
DERBY-3094: Grouping by expressions causes NullPointerException This change modifies GroupByNode.addUnAggColumns to process the expressions in the GROUP BY list in descending order of complexity, as measured by the number of column references in the GROUP BY list element. This ensures that when we are matching up expressions in the SELECT list with expressions in the GROUP BY list, that we choose the best match, and don't erroneously match a sub-expression. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@632221 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/compile/GroupByNode.java", "hunks": [ { "added": [ "import java.util.ArrayList;", "import java.util.Comparator;", "import java.util.Collections;" ], "header": "@@ -23,6 +23,9 @@ package\torg.apache.derby.impl.sql.compile;", "removed": [] }, { "added": [ "\t\tArrayList referencesToSubstitute = new ArrayList();", "\t\tArrayList havingRefsToSubstitute = null;", "\t\tif (havingClause != null)", "\t\t\thavingRefsToSubstitute = new ArrayList();" ], "header": "@@ -343,6 +346,10 @@ public class GroupByNode extends SingleChildResultSetNode", "removed": [] }, { "added": [ "\t\t\t//", "\t\t\t// Note that we don't perform the replacements", "\t\t\t// immediately, but instead we accumulate them", "\t\t\t// until the end of the loop. This allows us to", "\t\t\t// sort the expressions and process them in", "\t\t\t// descending order of complexity, necessary", "\t\t\t// because a compound expression may contain a", "\t\t\t// reference to a simple grouped column, but in", "\t\t\t// such a case we want to process the expression", "\t\t\t// as an expression, not as individual column", "\t\t\t// references. E.g., if the statement was:", "\t\t\t// SELECT ... GROUP BY C1, C1 * (C2 / 100), C3", "\t\t\t// then we don't want the replacement of the", "\t\t\t// simple column reference C1 to affect the", "\t\t\t// compound expression C1 * (C2 / 100). DERBY-3094.", "\t\t\t//", "\t\t\tValueNode vn = gbc.getColumnExpression();", "\t\t\tSubstituteExpressionVisitor vis =", "\t\t\t\tnew SubstituteExpressionVisitor(vn, vc,", "\t\t\treferencesToSubstitute.add(vis);" ], "header": "@@ -385,12 +392,27 @@ public class GroupByNode extends SingleChildResultSetNode", "removed": [ "\t\t\tSubstituteExpressionVisitor se = ", "\t\t\t\tnew SubstituteExpressionVisitor(", "\t\t\t\t\t\tgbc.getColumnExpression(),", "\t\t\t\t\t\tvc,", "\t\t\tparent.getResultColumns().accept(se);" ] }, { "added": [ "\t\t\tif (havingClause != null)", "\t\t\t{", "\t\t\t\t\tnew SubstituteExpressionVisitor(vn,vc,null);", "\t\t\t\thavingRefsToSubstitute.add(havingSE);", "\t\tComparator sorter = new ExpressionSorter();", "\t\tCollections.sort(referencesToSubstitute,sorter);", "\t\tfor (int r = 0; r < referencesToSubstitute.size(); r++)", "\t\t\tparent.getResultColumns().accept(", "\t\t\t\t(SubstituteExpressionVisitor)referencesToSubstitute.get(r));", "\t\tif (havingRefsToSubstitute != null)", "\t\t{", "\t\t\tCollections.sort(havingRefsToSubstitute,sorter);", "\t\t\tfor (int r = 0; r < havingRefsToSubstitute.size(); r++)", "\t\t\t\thavingClause.accept(", "\t\t\t\t\t(SubstituteExpressionVisitor)havingRefsToSubstitute.get(r));", "}" ], "header": "@@ -414,15 +436,26 @@ public class GroupByNode extends SingleChildResultSetNode", "removed": [ "\t\t\tif (havingClause != null) {", "\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);" ] } ] } ]
derby-DERBY-3096-7ae0ee5a
DERBY-3096 SSL handshake throws bad_certificate when server tries to authenticate client. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@596983 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/client/org/apache/derby/client/net/NaiveTrustManager.java", "hunks": [ { "added": [ "import java.io.FileInputStream;", "import javax.net.ssl.KeyManagerFactory;", "import java.security.KeyStore;", "" ], "header": "@@ -21,13 +21,17 @@", "removed": [] }, { "added": [ " java.security.KeyManagementException,", " java.security.NoSuchProviderException,", " java.security.KeyStoreException,", " java.security.UnrecoverableKeyException,", " java.security.cert.CertificateException,", " java.io.IOException", "", " ", " if (ctx.getProvider().getName().equals(\"SunJSSE\") &&", " (System.getProperty(\"javax.net.ssl.keyStore\") != null) &&", " (System.getProperty(\"javax.net.ssl.keyStorePassword\") != null)) {", " ", " // SunJSSE does not give you a working default keystore", " // when using your own trust manager. Since a keystore is", " // needed on the client when the server does", " // peerAuthentication, we have to provide one working the", " // same way as the default one.", "", " String keyStore = ", " System.getProperty(\"javax.net.ssl.keyStore\");", " String keyStorePassword =", " System.getProperty(\"javax.net.ssl.keyStorePassword\");", " ", " KeyStore ks = KeyStore.getInstance(\"JKS\");", " ks.load(new FileInputStream(keyStore),", " keyStorePassword.toCharArray());", " ", " KeyManagerFactory kmf = ", " KeyManagerFactory.getInstance(\"SunX509\", \"SunJSSE\");", " kmf.init(ks, keyStorePassword.toCharArray());", "", " ctx.init(kmf.getKeyManagers(),", " thisManager,", " null); // Use default random source", " } else {", " ctx.init(null, // Use default key manager", " thisManager,", " null); // Use default random source", " }", "", " }" ], "header": "@@ -52,18 +56,53 @@ public class NaiveTrustManager", "removed": [ " java.security.KeyManagementException", " ", " ctx.init(null, // Use default key manager", " thisManager,", " null); // Use default random source", " }" ] } ] }, { "file": "java/drda/org/apache/derby/impl/drda/NaiveTrustManager.java", "hunks": [ { "added": [ "import java.io.FileInputStream;", "import javax.net.ssl.KeyManagerFactory;", "import java.security.KeyStore;", "import org.apache.derby.iapi.services.property.PropertyUtil;", "" ], "header": "@@ -21,12 +21,17 @@", "removed": [] }, { "added": [ " java.security.KeyManagementException,", " java.security.NoSuchProviderException,", " java.security.KeyStoreException,", " java.security.UnrecoverableKeyException,", " java.security.cert.CertificateException,", " java.io.IOException", "", " ", " if (ctx.getProvider().getName().equals(\"SunJSSE\") &&", " (PropertyUtil.getSystemProperty(\"javax.net.ssl.keyStore\") != null) &&", " (PropertyUtil.getSystemProperty(\"javax.net.ssl.keyStorePassword\") != null)) {", " ", " // SunJSSE does not give you a working default keystore", " // when using your own trust manager. Since a keystore is", " // needed on the client when the server does", " // peerAuthentication, we have to provide one working the", " // same way as the default one.", "", " String keyStore = ", " PropertyUtil.getSystemProperty(\"javax.net.ssl.keyStore\");", " String keyStorePassword =", " PropertyUtil.getSystemProperty(\"javax.net.ssl.keyStorePassword\");", " ", " KeyStore ks = KeyStore.getInstance(\"JKS\");", " ks.load(new FileInputStream(keyStore),", " keyStorePassword.toCharArray());", " ", " KeyManagerFactory kmf = ", " KeyManagerFactory.getInstance(\"SunX509\", \"SunJSSE\");", " kmf.init(ks, keyStorePassword.toCharArray());", "", " ctx.init(kmf.getKeyManagers(),", " thisManager,", " null); // Use default random source", " } else {", " ctx.init(null, // Use default key manager", " thisManager,", " null); // Use default random source", " }", "" ], "header": "@@ -52,16 +57,51 @@ public class NaiveTrustManager", "removed": [ " java.security.KeyManagementException", " ", " ctx.init(null, // Use default key manager", " thisManager,", " null); // Use default random source" ] } ] }, { "file": "java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java", "hunks": [ { "added": [ "\t\t\t\t\t\t\t\t\t\t\t java.security.KeyManagementException,", " java.security.NoSuchProviderException,", " java.security.KeyStoreException,", " java.security.UnrecoverableKeyException,", " java.security.cert.CertificateException" ], "header": "@@ -2333,7 +2333,11 @@ public final class NetworkServerControlImpl {", "removed": [ "\t\t\t\t\t\t\t\t\t\t\t java.security.KeyManagementException" ] } ] } ]
derby-DERBY-3097-d9dd1e59
DERBY-4798 NPE in nested outer join Patch derby-4798a. Reintroduces the bailout code in BaseActivation#getColumnFromRow which was removed in DERBY-3097 until we understand why it is needed. Adds the repro for this issue to OuterJoinTest git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@998170 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-3098-f6973263
DERBY-3098: If allowed by transaction isolation level, release locks whenn [BC]lob.free() is called. This changes the following files: M java/engine/org/apache/derby/impl/jdbc/EmbedClob.java Only initialize storeStream once. M java/engine/org/apache/derby/impl/store/raw/data/OverflowInputStream.java Do not lock for entire duration anymore, but until corresponding BaseContainerHandle has been closed. Also, make sure that locking only happens once. M java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/BlobTest.java Add tests to test locking of Blob after free() for different isolation levels. Also, moved code from setUp that is only relevant to one test case to that specific test case. M java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ClobTest.java Add tests to test locking of Blob after free() for different isolation levels. Also, moved code from setUp that is only relevant to one test case to that specific test case. M java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/BlobClob4BlobTest.java Test that locks on Blob/Clob are released when transaction commits. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@584777 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/jdbc/EmbedClob.java", "hunks": [ { "added": [ " this.clob = new StoreStreamClob(storeStream, this);" ], "header": "@@ -144,7 +144,7 @@ final class EmbedClob extends ConnectionChild implements Clob", "removed": [ " ((Resetable) storeStream).initStream();" ] } ] }, { "file": "java/engine/org/apache/derby/impl/store/raw/data/OverflowInputStream.java", "hunks": [ { "added": [], "header": "@@ -30,7 +30,6 @@ import org.apache.derby.iapi.types.Resetable;", "removed": [ "import java.io.InputStream;" ] }, { "added": [ " ", " // Make sure record is only locked once.", " private boolean initialized = false;" ], "header": "@@ -49,6 +48,9 @@ implements Resetable", "removed": [] }, { "added": [ " /**", " * Initialize. Reopen the container. This will have the effect of", " * getting an intent shared lock on the table, which will stay around until", " * the enclosing blob/clob object is closed, or until the end of the ", " * transaction. Also get a read lock on the appropriate row.", " * ", " * @throws org.apache.derby.iapi.error.StandardException", " */", " if (initialized) return;", " ", " // it is possible that the transaction in which the stream was", " ", " We use isolation level READ_COMMITTED and reopen the container to ", " get a new container handle to use for locking. This way, the lock will", " be freed when we the container handle is closed. This will happen in", " closeStream() or when the transaction commits. ", " Hence, locks will be released before the end of transaction if ", " blobs/clobs are explicitly released.", " TransactionController.ISOLATION_READ_COMMITTED, true);" ], "header": "@@ -133,41 +135,37 @@ implements Resetable", "removed": [ " /*", " Initialize. Reopen the container. This will have the effect of", " getting an intent shared lock on the table, which will stay around until", " the end of the transaction (or until the enclosing blob/clob object is", " closed). Also get a read lock on the appropriate row.", " */", " // it is possible that the transaction in which the stream was ", " We might want to use the mode and isolation level of the container.", " This would have the advantage that, if the isolation level", " is READ_COMMITTED, resources would be freed if blobs/clob finalizers are", " called (e.g. they are garbage collected) before the end of transaction.", " If the mode was MODE_CONTAINER, openContainer would get an S lock on the", " table instead of an IS lock, and lockRecordForRead would have no effect.", "", " To do this, need to consider:", " Sometimes the container's locking policy may NOT reflect the correct", " locking policy. For example, if the container is a table (not an index)", " and Access handles the locking of the table via an index, the container's", " locking policy would be set to do no locking.", " Moreover, if the container is an index, the locking policy would", " always be set to do no locking.", "", " TransactionController.ISOLATION_REPEATABLE_READ, true);" ] } ] } ]
derby-DERBY-3099-1309add8
DERBY-3099: Pages not freed on rollback to savepoint Ensured that slotFieldSize and slotEntrySize are properly initialized before StoredPage.initSpace() is called. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@583691 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/store/raw/data/StoredPage.java", "hunks": [ { "added": [ " * totalSpace - slotEntrySize - 16 - OVERFLOW_POINTER_SIZE;", " private int maxFieldSize;" ], "header": "@@ -369,10 +369,9 @@ public class StoredPage extends CachedPage", "removed": [ " * totalSpace * (1 - spareSpace/100) - ", " * slotEntrySize * - 16 - OVERFLOW_POINTER_SIZE;", "\tprotected int maxFieldSize;" ] }, { "added": [ " // Note that the slotFieldSize and slotEntrySize need to be", " // calculated BEFORE initSpace() is called, because the", " // maxFieldSize computation in initSpace() includes these", " // values in its calculations. (DERBY-3099)", " slotFieldSize = calculateSlotFieldSize(pageSize);", " slotEntrySize = 3 * slotFieldSize;", " initSpace();" ], "header": "@@ -696,14 +695,14 @@ public class StoredPage extends CachedPage", "removed": [ " initSpace();", "\t\tif (pageSize >= 65536)", "\t\t\tslotFieldSize = LARGE_SLOT_SIZE;", "\t\telse", "\t\t\tslotFieldSize = SMALL_SLOT_SIZE;", "\t\t", "\t\tslotEntrySize = 3 * slotFieldSize;" ] }, { "added": [ " /**", " * Calculate the slot field size from the page size.", " *", " * @param pageSize page size in bytes", " * @return slot field size in bytes", " */", " private int calculateSlotFieldSize(int pageSize) {", " if (pageSize < 65536) {", " // slots are 2 bytes (unsigned short data type) for pages <64KB", " return SMALL_SLOT_SIZE;", " } else {", " // slots are 4 bytes (int data type) for pages >=64KB", " return LARGE_SLOT_SIZE;", " }", " }" ], "header": "@@ -721,6 +720,21 @@ public class StoredPage extends CachedPage", "removed": [] }, { "added": [ " if (SanityManager.DEBUG) {", " // DERBY-3099: maxFieldSize was calculated before slotFieldSize and", " // slotEntrySize had been initialized.", " int expectedFieldSize = calculateSlotFieldSize(pageData.length);", " SanityManager.ASSERT(slotFieldSize == expectedFieldSize,", " \"slotFieldSize uninitialized\");", " SanityManager.ASSERT(slotEntrySize == 3 * expectedFieldSize,", " \"slotEntrySize uninitialized\");", " }" ], "header": "@@ -3338,8 +3352,16 @@ public class StoredPage extends CachedPage", "removed": [ " if (SanityManager.DEBUG)" ] } ] } ]
derby-DERBY-3100-16b9059c
DERBY-3100: java.lang.NumberFormatException in test lang.TableFunctionTest Use locale-sensitive number parsing with NumberFormat instead of Double.parseDouble(). git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@581704 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-3107-da0b88f0
DERBY-3107: Client: Clob.free() needs to tell server to release locator. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@584717 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/client/org/apache/derby/client/am/Clob.java", "hunks": [ { "added": [ "", "", "", "" ], "header": "@@ -47,17 +47,17 @@ public class Clob extends Lob implements java.sql.Clob {", "removed": [ " ", " ", " ", " " ] }, { "added": [ "", "" ], "header": "@@ -68,10 +68,10 @@ public class Clob extends Lob implements java.sql.Clob {", "removed": [ " ", " " ] }, { "added": [ " throw new SqlException(agent_.logWriter_,", "" ], "header": "@@ -90,10 +90,10 @@ public class Clob extends Lob implements java.sql.Clob {", "removed": [ " throw new SqlException(agent_.logWriter_, ", " " ] }, { "added": [ "" ], "header": "@@ -103,7 +103,7 @@ public class Clob extends Lob implements java.sql.Clob {", "removed": [ " " ] }, { "added": [ " throw new SqlException(agent_.logWriter_,", " new ClientMessageId(SQLState.UNSUPPORTED_ENCODING)," ], "header": "@@ -120,8 +120,8 @@ public class Clob extends Lob implements java.sql.Clob {", "removed": [ " throw new SqlException(agent_.logWriter_, ", " new ClientMessageId(SQLState.UNSUPPORTED_ENCODING), " ] }, { "added": [ "", "", " throw new SqlException(agent_.logWriter_," ], "header": "@@ -144,15 +144,15 @@ public class Clob extends Lob implements java.sql.Clob {", "removed": [ " ", " ", " throw new SqlException(agent_.logWriter_, " ] }, { "added": [ "", "", "", " * Create a <code>Clob</code> object for a Clob value stored", " * @param agent context for this <code>Clob</code>", " public Clob(Agent agent, int locator)" ], "header": "@@ -161,23 +161,23 @@ public class Clob extends Lob implements java.sql.Clob {", "removed": [ " ", " ", " ", " * Create a <code>Clob</code> object for a Clob value stored ", " * @param agent context for this <code>Clob</code> ", " public Clob(Agent agent, int locator) " ] }, { "added": [ "", "" ], "header": "@@ -195,10 +195,10 @@ public class Clob extends Lob implements java.sql.Clob {", "removed": [ " ", " " ] }, { "added": [ "", "" ], "header": "@@ -214,11 +214,11 @@ public class Clob extends Lob implements java.sql.Clob {", "removed": [ " ", " " ] }, { "added": [ " * which only zero-length substrings can be returned." ], "header": "@@ -248,7 +248,7 @@ public class Clob extends Lob implements java.sql.Clob {", "removed": [ " * which only zero-length substrings can be returned. " ] }, { "added": [ "", "" ], "header": "@@ -263,11 +263,11 @@ public class Clob extends Lob implements java.sql.Clob {", "removed": [ " ", " " ] }, { "added": [ "" ], "header": "@@ -282,7 +282,7 @@ public class Clob extends Lob implements java.sql.Clob {", "removed": [ " " ] }, { "added": [ " throw new SqlException(agent_.logWriter_,", " new ClientMessageId(SQLState.BLOB_POSITION_TOO_LARGE),", " new Long(pos));" ], "header": "@@ -290,9 +290,9 @@ public class Clob extends Lob implements java.sql.Clob {", "removed": [ " throw new SqlException(agent_.logWriter_, ", " new ClientMessageId(SQLState.BLOB_POSITION_TOO_LARGE), ", " new Long(pos)); " ] }, { "added": [ " private String getSubStringX(long pos, int length) throws SqlException" ], "header": "@@ -308,7 +308,7 @@ public class Clob extends Lob implements java.sql.Clob {", "removed": [ " private String getSubStringX(long pos, int length) throws SqlException " ] }, { "added": [ "", "" ], "header": "@@ -329,11 +329,11 @@ public class Clob extends Lob implements java.sql.Clob {", "removed": [ " ", " " ] }, { "added": [ "", "" ], "header": "@@ -375,11 +375,11 @@ public class Clob extends Lob implements java.sql.Clob {", "removed": [ " ", " " ] }, { "added": [ "", "" ], "header": "@@ -422,11 +422,11 @@ public class Clob extends Lob implements java.sql.Clob {", "removed": [ " ", " " ] }, { "added": [ " throw new SqlException(agent_.logWriter_,", " throw new SqlException(agent_.logWriter_,", " new ClientMessageId(SQLState.BLOB_BAD_POSITION)," ], "header": "@@ -437,12 +437,12 @@ public class Clob extends Lob implements java.sql.Clob {", "removed": [ " throw new SqlException(agent_.logWriter_, ", " throw new SqlException(agent_.logWriter_, ", " new ClientMessageId(SQLState.BLOB_BAD_POSITION), " ] }, { "added": [ " throw new SqlException(agent_.logWriter_,", "", " //Locator support is available. Hence call", " //CLOBGETPOSITIONFROMSTRING to determine the position" ], "header": "@@ -464,15 +464,15 @@ public class Clob extends Lob implements java.sql.Clob {", "removed": [ " throw new SqlException(agent_.logWriter_, ", " ", " //Locator support is available. Hence call ", " //CLOBGETPOSITIONFROMSTRING to determine the position " ] }, { "added": [ "", "" ], "header": "@@ -487,11 +487,11 @@ public class Clob extends Lob implements java.sql.Clob {", "removed": [ " ", " " ] }, { "added": [ " throw new SqlException(agent_.logWriter_,", " new ClientMessageId(SQLState.BLOB_BAD_POSITION),", " throw new SqlException(agent_.logWriter_," ], "header": "@@ -502,13 +502,13 @@ public class Clob extends Lob implements java.sql.Clob {", "removed": [ " throw new SqlException(agent_.logWriter_, ", " new ClientMessageId(SQLState.BLOB_BAD_POSITION), ", " throw new SqlException(agent_.logWriter_, " ] }, { "added": [ " throw new SqlException(agent_.logWriter_," ], "header": "@@ -528,7 +528,7 @@ public class Clob extends Lob implements java.sql.Clob {", "removed": [ " throw new SqlException(agent_.logWriter_, " ] }, { "added": [ "", "" ], "header": "@@ -569,11 +569,11 @@ public class Clob extends Lob implements java.sql.Clob {", "removed": [ " ", " " ] }, { "added": [ "", "" ], "header": "@@ -594,11 +594,11 @@ public class Clob extends Lob implements java.sql.Clob {", "removed": [ " ", " " ] }, { "added": [ " new ClientMessageId(SQLState.BLOB_BAD_POSITION)," ], "header": "@@ -621,7 +621,7 @@ public class Clob extends Lob implements java.sql.Clob {", "removed": [ " new ClientMessageId(SQLState.BLOB_BAD_POSITION), " ] }, { "added": [ " if ((offset < 0) || offset > str.length() ) {", " throw new SqlException(agent_.logWriter_,", "", "" ], "header": "@@ -629,18 +629,18 @@ public class Clob extends Lob implements java.sql.Clob {", "removed": [ " if ((offset < 0) || offset > str.length() ) { ", " throw new SqlException(agent_.logWriter_, ", " ", " " ] }, { "added": [ "", "" ], "header": "@@ -675,11 +675,11 @@ public class Clob extends Lob implements java.sql.Clob {", "removed": [ " ", " " ] }, { "added": [ "" ], "header": "@@ -687,7 +687,7 @@ public class Clob extends Lob implements java.sql.Clob {", "removed": [ " " ] }, { "added": [ " outStream = new" ], "header": "@@ -696,7 +696,7 @@ public class Clob extends Lob implements java.sql.Clob {", "removed": [ " outStream = new " ] }, { "added": [ "", "" ], "header": "@@ -712,11 +712,11 @@ public class Clob extends Lob implements java.sql.Clob {", "removed": [ " ", " " ] }, { "added": [ "", "" ], "header": "@@ -747,11 +747,11 @@ public class Clob extends Lob implements java.sql.Clob {", "removed": [ " ", " " ] }, { "added": [ "", " throw new SqlException(agent_.logWriter_,", "", "" ], "header": "@@ -763,17 +763,17 @@ public class Clob extends Lob implements java.sql.Clob {", "removed": [ " ", " throw new SqlException(agent_.logWriter_, ", " ", " " ] }, { "added": [ "", "", "", " try {", " synchronized (agent_.connection_) {", " if (agent_.loggingEnabled()) {", " agent_.logWriter_.traceEntry(this, \"free\");", " }", " if (isLocator()) {", " agent_.connection_.locatorProcedureCall()", " .clobReleaseLocator(locator_);", " }", " }", " } catch (SqlException se) {", " throw se.getSQLException();", " }", "" ], "header": "@@ -814,14 +814,28 @@ public class Clob extends Lob implements java.sql.Clob {", "removed": [ " ", " ", " " ] }, { "added": [], "header": "@@ -868,8 +882,6 @@ public class Clob extends Lob implements java.sql.Clob {", "removed": [ " *", " * @throws SQLException." ] }, { "added": [ "" ], "header": "@@ -922,7 +934,7 @@ public class Clob extends Lob implements java.sql.Clob {", "removed": [ " " ] }, { "added": [ " throw new SqlException(agent_.logWriter_," ], "header": "@@ -964,7 +976,7 @@ public class Clob extends Lob implements java.sql.Clob {", "removed": [ " throw new SqlException(agent_.logWriter_, " ] }, { "added": [ " throw new SqlException(agent_.logWriter_," ], "header": "@@ -982,7 +994,7 @@ public class Clob extends Lob implements java.sql.Clob {", "removed": [ " throw new SqlException(agent_.logWriter_, " ] }, { "added": [ " throw new SqlException(agent_.logWriter_,", " new ClientMessageId(SQLState.UNSUPPORTED_ENCODING),", " * Checks is isValid is true. If it is not true throws" ], "header": "@@ -1002,15 +1014,15 @@ public class Clob extends Lob implements java.sql.Clob {", "removed": [ " throw new SqlException(agent_.logWriter_, ", " new ClientMessageId(SQLState.UNSUPPORTED_ENCODING), ", " * Checks is isValid is true. If it is not true throws " ] }, { "added": [ " unicodeStream_ = super.materializeStream(isAsciiStream() ?", " asciiStream_ :", "", "" ], "header": "@@ -1029,17 +1041,17 @@ public class Clob extends Lob implements java.sql.Clob {", "removed": [ " unicodeStream_ = super.materializeStream(isAsciiStream() ? ", " asciiStream_ : ", " ", " " ] } ] } ]
derby-DERBY-3110-5028317c
DERBY-3110 server hangs after trace on command fails If there is an error in turning on tracing for any of the sessions, we fail to turn global tracing on and return an error to the client. The change also wraps the tracing in a privilege block. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@592111 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/drda/org/apache/derby/impl/drda/DssTrace.java", "hunks": [ { "added": [ "import java.io.IOException;", "import java.io.PrintWriter;", "import java.security.AccessController;", "import java.security.PrivilegedActionException;", "import java.security.PrivilegedExceptionAction;", "", "" ], "header": "@@ -20,6 +20,13 @@", "removed": [] }, { "added": [ " private static final char hexDigit [] = {" ], "header": "@@ -97,7 +104,7 @@ public class DssTrace", "removed": [ " private static final char hexDigit [] = {" ] }, { "added": [ " protected void startComBufferTrace (final String fileName) throws IOException ", " try {", " ", " comBufferWriter = ((PrintWriter)AccessController.doPrivileged(", " new PrivilegedExceptionAction() {", " public Object run() throws SecurityException, IOException {", " return new PrintWriter (new java.io.BufferedWriter (new java.io.FileWriter (fileName), 4096));", " }", " }));", " } catch (PrivilegedActionException pae) {", " Exception e = pae.getException();", " if (e instanceof SecurityException)", " throw (SecurityException)pae.getException();", " else", " throw (IOException) pae.getException();", " }", " " ], "header": "@@ -160,14 +167,28 @@ public class DssTrace", "removed": [ " protected void startComBufferTrace (String fileName)", " try {", " comBufferWriter = new java.io.PrintWriter (new java.io.BufferedWriter (new java.io.FileWriter (fileName), 4096));" ] }, { "added": [ " " ], "header": "@@ -181,11 +202,8 @@ public class DssTrace", "removed": [ " catch (java.io.IOException e) {", " // The IOException is currently ignored. Handling should be added.", " }", " }" ] } ] }, { "file": "java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java", "hunks": [ { "added": [ "\t\t\t\t\t if (sessionArg != 0)", "\t\t\t\t\t\t\tsendMessage(writer, ERROR, ", "\t\t\t\t\t\t\t localizeMessage(\"DRDA_SessionNotFound.U\", ", "\t\t\t\t\t\t\t\t\t (session.langUtil == null) ? langUtil : session.langUtil,", "\t\t\t\t\t\t\t\t\t new String [] {new Integer(sessionArg).toString()}));", "\t\t\t\t\t else", "\t\t\t\t\t\t\tsendMessage(writer, ERROR, ", "\t\t\t\t\t\t\t\t\t\tlocalizeMessage(\"DRDA_ErrorStartingTracing.S\",null)); " ], "header": "@@ -1425,10 +1425,14 @@ public final class NetworkServerControlImpl {", "removed": [ "\t\t\t\t\t\tsendMessage(writer, ERROR, ", "\t\t\t\t\t\t\tlocalizeMessage(\"DRDA_SessionNotFound.U\", ", "\t\t\t\t\t\t\t(session.langUtil == null) ? langUtil : session.langUtil,", "\t\t\t\t\t\t\tnew String [] {new Integer(sessionArg).toString()}));" ] }, { "added": [ " boolean setTraceSuccessful = true;", "\t\t\t\t{", " ", "\t\t\t\t Session session = (Session) e.nextElement();", "\t\t\t\t\t\ttry {", "\t\t\t\t\t\t\tsession.setTraceOn(traceDirectory);", "\t\t\t\t\t\t} catch (Exception te ) {", "\t\t\t\t\t\t\tconsoleExceptionPrintTrace(te);", "\t\t\t\t\t\t\tsetTraceSuccessful = false;", "\t\t\t\t\t\t\tsession.setTraceOff();", "\t\t\t\t\t\t}", "\t\t\t\tif (setTraceSuccessful)", "\t\t\t\t\tsetTraceAll(on);" ], "header": "@@ -3355,18 +3359,27 @@ public final class NetworkServerControlImpl {", "removed": [ "\t\t\tsetTraceAll(on);", "\t\t\t\t{\t", "\t\t\t\t\tSession session = (Session) e.nextElement();", "\t\t\t\t\t\tsession.setTraceOn(traceDirectory);" ] } ] } ]
derby-DERBY-3113-7c490a62
DERBY-3113: Use Arrays.fill() in StoredPage.clearSection() git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@584093 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/store/raw/data/StoredPage.java", "hunks": [ { "added": [ "import java.util.Arrays;" ], "header": "@@ -73,6 +73,7 @@ import org.apache.derby.iapi.services.io.LimitObjectInput;", "removed": [] }, { "added": [ " *", " * @param offset position of first byte to clear", " * @param length how many bytes to clear", " Arrays.fill(pageData, offset, offset + length, (byte) 0);" ], "header": "@@ -1830,14 +1831,13 @@ public class StoredPage extends CachedPage", "removed": [ " * <p>", "\t\tint endOffset = offset + length;", "", "\t\twhile (offset < endOffset) ", "\t\t\tpageData[offset++] = 0;" ] } ] } ]
derby-DERBY-3116-a390adb3
DERBY-3116: totalSpace not properly initialized in AllocPage - in AllocPage.createPage(), set borrowedSpace before super.createPage() is called so that getMaxFreeSpace() returns the correct value when totalSpace is initialized - in CachedPage.setPageArray(), call usePageBuffer() also when the old buffer is reused. This ensures that totalSpace is recalculated when a page object is reused. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@644698 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/store/raw/data/AllocPage.java", "hunks": [ { "added": [ " // We need to set borrowedSpace before we call super.createPage() so", " // that totalSpace is initialized correctly (DERBY-3116).", " borrowedSpace = args.containerInfoSize;", "\t\tsuper.createPage(newIdentity, args);" ], "header": "@@ -274,9 +274,11 @@ public class AllocPage extends StoredPage", "removed": [ "\t\tsuper.createPage(newIdentity, args);", "\t\tborrowedSpace = args.containerInfoSize;" ] } ] }, { "file": "java/engine/org/apache/derby/impl/store/raw/data/CachedPage.java", "hunks": [ { "added": [ "", " // Always call usePageBuffer(), even when we reuse the buffer, so that", " // totalSpace and friends are recalculated (DERBY-3116).", " usePageBuffer(pageData);" ], "header": "@@ -857,9 +857,11 @@ public abstract class CachedPage extends BasePage implements Cacheable", "removed": [ "\t\t\t\t", "\t\t\tusePageBuffer(pageData);" ] } ] } ]
derby-DERBY-3117-beb1faaf
DERBY-3117: Improve portability of grandparent lookup in PropertySetter. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@596438 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/build/org/apache/derbyPreBuild/PropertySetter.java", "hunks": [ { "added": [ " File jdkParentDirectory = getJdkParentDirectory();", " { default_j14lib = getJreLib( jdkParentDirectory, seed14 ); }", " { default_j15lib = getJreLib( jdkParentDirectory, seed15 ); }", " /**", " * <p>", " * Get the parent directory of JAVA_HOME", " * </p>", " */", " private File getJdkParentDirectory()", " throws Exception", " {", " String javaHome = getProperty( JAVA_HOME );", " ", " // slice off the jdk1.5.0_u13/jre. ant seems to tack the \"/jre\" onto", " // the end of what the shell thinks $JAVA_HOME is:", " ", " File javaHomeDir = new File( javaHome );", " File ancestor = getParent( getParent( javaHomeDir ) );", "", " if ( ancestor == null )", " {", " echo( \"JAVA_HOME directory '\" + javaHome + \"' does not have a grandparent directory sitting above all of the JDKs.\" );", " }", " ", " return ancestor;", " }", " ", " /**", " * <p>", " * Get a file's parent directory. Return null if there is no parent directory.", " * </p>", " */", " private File getParent( File file )", " throws Exception", " {", " if ( file == null ) { return null; }", " if ( !file.exists() ) { return null; }", " ", " return file.getParentFile();", " }", "", "", " private String getJreLib( File jdkParentDirectory, String jdkName )", " if ( jdkParentDirectory == null ) { return null; }", " ", " echo( \"Directory '\" + jdkParentDirectory.getAbsolutePath() + \"' does not have any child directories containing the string '\" + jdkName + \"'.\" );" ], "header": "@@ -303,39 +303,75 @@ public class PropertySetter extends Task", "removed": [ " String javaHome = getProperty( JAVA_HOME );", " ", " // slice off the jdk1.5.0_u13/jre. ant seems to tack the \"/jre\" onto", " // the end of what the shell thinks $JAVA_HOME is:", " String sunJavaRoot = javaHome + File.separator + \"..\" + File.separator + \"..\";", " { default_j14lib = getJreLib( sunJavaRoot, seed14 ); }", " { default_j15lib = getJreLib( sunJavaRoot, seed15 ); }", " private String getJreLib( String jdkParent, String jdkName )", " File jdkParentDirectory = new File( jdkParent );", " echo( \"Directory '\" + jdkParent + \"' does not have any child directories containing the string '\" + jdkName + \"'.\" );" ] } ] } ]
derby-DERBY-3117-f9b0b054
DERBY-3117: Adjust master build script to require the Java 5 compiler to build Derby Added extra directory in which to search when building on Solaris. This increases the chance of finding JDK 1.4.2, since the default location for JDKs on Solaris changed with JDK 5.0. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@596478 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/build/org/apache/derbyPreBuild/PropertySetter.java", "hunks": [ { "added": [ "import java.util.ArrayList;", "import java.util.List;" ], "header": "@@ -25,8 +25,10 @@ import java.io.File;", "removed": [] }, { "added": [ " List<File> jdkParents = getJdkSearchPath();", " { default_j14lib = searchForJreLib(jdkParents, seed14); }", " { default_j15lib = searchForJreLib(jdkParents, seed15); }", "", " /**", " * Search for a library directory in some likely locations.", " *", " * @param parents list of potential JDK parent directories", " * @param seed search string which identifies a given JDK version", " * @return a library directory, or <code>null</code> if not found", " */", " private String searchForJreLib(List<File> parents, String seed) {", " for (File parent : parents) {", " String jreLib = getJreLib(parent, seed);", " if (jreLib != null) {", " return jreLib;", " }", " }", " return null;", " }", "", " /**", " * Get a list of potential JDK parent directories. These include the parent", " * directory of JAVA_HOME, and possibly some system dependent directories.", " *", " * @return a list of potential JDK parent directories", " */", " private List<File> getJdkSearchPath() throws Exception {", " ArrayList<File> searchPath = new ArrayList<File>();", "", " // Add parent of JAVA_HOME", " searchPath.add(getJdkParentDirectory());", "", " String osName = System.getProperty(\"os.name\");", "", " if (\"SunOS\".equals(osName)) {", " // On Solaris, JDK 1.4.2 is installed under /usr/jdk, whereas JDK", " // 5.0 and later are placed under /usr/jdk/instances. If we don't", " // find JDK 1.4.2 in the parent of JAVA_HOME, it's worth taking a", " // look at /usr/jdk before giving up.", " searchPath.add(new File(\"/usr/jdk\"));", " }", "", " return searchPath;", " }", "" ], "header": "@@ -303,20 +305,62 @@ public class PropertySetter extends Task", "removed": [ " File jdkParentDirectory = getJdkParentDirectory();", " { default_j14lib = getJreLib( jdkParentDirectory, seed14 ); }", " { default_j15lib = getJreLib( jdkParentDirectory, seed15 ); }", " " ] } ] } ]
derby-DERBY-3119-057ae460
DERBY-3119: Commit James Adams patch for resolving functions which return the Java object versions of the primitive datatypes. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@589766 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/compile/MethodCallNode.java", "hunks": [ { "added": [], "header": "@@ -792,14 +792,6 @@ abstract class MethodCallNode extends JavaValueNode", "removed": [ "", "", "\t\t\t\t// DB2 LUW does not support Java object types for SMALLINT, INTEGER, BIGINT, REAL, DOUBLE", "\t\t\t\t// and these are the only types that can map to a primitive or an object type according", "\t\t\t\t// to SQL part 13. So always map to the primitive type. We can not use the getPrimitiveSignature()", "\t\t\t\t// as it (incorrectly but historically always has) maps a DECIMAL to a double. ", "", "\t\t\t\t" ] } ] } ]
derby-DERBY-3122-4177c4f3
DERBY-3122: Remove dead code in Clob git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@583921 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/client/org/apache/derby/client/am/Clob.java", "hunks": [ { "added": [], "header": "@@ -46,8 +46,6 @@ public class Clob extends Lob implements java.sql.Clob {", "removed": [ " private PreparedStatement internalLengthStmt_ = null;", "" ] }, { "added": [], "header": "@@ -213,13 +211,6 @@ public class Clob extends Lob implements java.sql.Clob {", "removed": [ " protected void finalize() throws java.lang.Throwable {", " super.finalize();", " if (internalLengthStmt_ != null) {", " internalLengthStmt_.closeX();", " }", " }", "" ] }, { "added": [], "header": "@@ -859,15 +850,6 @@ public class Clob extends Lob implements java.sql.Clob {", "removed": [ " ", " if (internalLengthStmt_ != null) {", " try {", " internalLengthStmt_.closeX();", " }", " catch(SqlException sqle) {", " throw sqle.getSQLException();", " }", " }" ] } ] } ]
derby-DERBY-3130-bf5fd3cf
DERBY-3130: Reduce memory footprint of StoredRecordHeader Factor out some of the fields in StoredRecordHeader to reduce the object size when there's no overflow on the record. This reduces the peaks in heap space usage seen when the page cache gets filled with index pages (for instance after a SELECT COUNT(*) query). git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@643875 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/store/raw/data/StoredRecordHeader.java", "hunks": [ { "added": [], "header": "@@ -28,7 +28,6 @@ import org.apache.derby.iapi.store.raw.RecordHandle;", "removed": [ "import java.io.InputStream;" ] }, { "added": [], "header": "@@ -66,7 +65,6 @@ public final class StoredRecordHeader", "removed": [ " * RECORD_INITIAL\t\t\t- used when record header is first initialized" ] }, { "added": [ " private static final byte RECORD_DELETED = 0x01;", " private static final byte RECORD_OVERFLOW = 0x02;", " private static final byte RECORD_HAS_FIRST_FIELD = 0x04;", " private static final byte RECORD_VALID_MASK = 0x0f;" ], "header": "@@ -82,11 +80,10 @@ public final class StoredRecordHeader", "removed": [ "\tpublic static final int RECORD_INITIAL =\t\t\t0x00;", "\tpublic static final int RECORD_DELETED =\t\t\t0x01;", "\tpublic static final int RECORD_OVERFLOW =\t\t\t0x02;", "\tpublic static final int RECORD_HAS_FIRST_FIELD =\t0x04; ", " public static final int RECORD_VALID_MASK = 0x0f;" ] }, { "added": [], "header": "@@ -105,7 +102,6 @@ public final class StoredRecordHeader", "removed": [ " * RECORD_INITIAL" ] }, { "added": [ " private byte status;" ], "header": "@@ -113,7 +109,7 @@ public final class StoredRecordHeader", "removed": [ "\tprotected int status;" ] }, { "added": [ " * Class which holds the fields {@code overflowId}, {@code overflowPage}", " * and {@code firstField}, which are not needed when there is no", " * overflow. These fields are factored out to save Java heap space (see", " * DERBY-3130).", " */", " private static class OverflowInfo {", " /** Create an empty {@code OverflowInfo} object. */", " private OverflowInfo() { }", " /** Create a copy of a {@code OverflowInfo} object. */", " private OverflowInfo(OverflowInfo from) {", " overflowId = from.overflowId;", " overflowPage = from.overflowPage;", " firstField = from.firstField;", " }", " /**", " * If (hasOverflow()) then this is the id of the row on page", " * overflowPage where the next portion of the row can be found. In this", " * case there are no \"real\" fields on this page. This situation comes", " * about if a row has been updated such that the real first field no", " * longer fits on the head page.", " */", " private int overflowId;", "", " /**", " * If (hasOverflow()) then this is the page where where the next", " * portion of the row can be found. In this case there are no \"real\"", " * fields on this page.", " */", " private long overflowPage;", "", " /**", " * If (hasFirstField()) then this field is the number of the column in", " * the orginal row which is now stored as the first field in this row.", " * This row is 2nd through N'th portion of a long row.", " *", " * For example if a row has its first 3 fields on page 0 and its next 3", " * fields on page 1, then the record header of the row portion on page", " * 1 will have hasFirstField() set to true, and the value would be 4,", " * indicating that the 4th field of the row is stored as the 1st field", " * of the partial row portion stored on page 1.", " */", " private int firstField;", " }", " private OverflowInfo overflow;" ], "header": "@@ -125,37 +121,55 @@ public final class StoredRecordHeader", "removed": [ "", " * If (hasOverflow()) then this is the id of the row on page overflowPage", " * where the next portion of the row can be found. In this case there", " * are no \"real\" fields on this page. This situation comes about if a", " * row has been updated such that the real first field no longer fits on", " * the head page.", " **/", "\tprotected int\toverflowId;", " /**", " * If (hasOverflow()) then this is the page where where the next portion of", " * the row can be found. In this case there are no \"real\" fields on this ", " * page.", " **/", "\tprotected long overflowPage;", " /**", " * if (hasFirstField()) then this field is the number of the column in", " * the orginal row which is now stored as the first field in this row. This", " * row is 2nd through N'th portion of a long row. ", " *", " * For example if a row has its first 3 fields on page 0 and its next 3", " * fields on page 1, then the record header of the row portion on page 1", " * will have hasFirstField() set to true, and the value would be 4, ", " * indicating that the 4th field of the row is stored as the 1st field of", " * the partial row portion stored on page 1.", " **/", "\tprotected int\tfirstField;" ] }, { "added": [ " if (loadTargetFrom.overflow != null) {", " overflow = new OverflowInfo(loadTargetFrom.overflow);", " }" ], "header": "@@ -185,9 +199,9 @@ public final class StoredRecordHeader", "removed": [ "\t\toverflowId = loadTargetFrom.overflowId;", "\t\toverflowPage = loadTargetFrom.overflowPage;", "\t\tfirstField = loadTargetFrom.firstField;" ] }, { "added": [ "\t\treturn overflow == null ? 0 : overflow.overflowPage;", "\t\treturn overflow == null ? 0 : overflow.overflowId;", "\t\treturn overflow == null ? 0 : overflow.firstField;" ], "header": "@@ -228,17 +242,17 @@ public final class StoredRecordHeader", "removed": [ "\t\treturn overflowPage;", "\t\treturn overflowId;", "\t\treturn firstField;" ] }, { "added": [ " len += CompressedNumber.sizeInt(numberFields);", " len += CompressedNumber.sizeInt(overflow.firstField);", "\t\t\tlen += CompressedNumber.sizeLong(overflow.overflowPage);", "\t\t\tlen += CompressedNumber.sizeInt(overflow.overflowId);", " len += CompressedNumber.sizeInt(overflow.firstField);" ], "header": "@@ -301,34 +315,19 @@ public final class StoredRecordHeader", "removed": [ "", " // account for size of the numberFields field + size fo the ", " // firstField field.", " //", " // len += (CompressedNumber.sizeInt(numberFields) +", " // CompressedNumber.sizeInt(firstField);", " //", " len += ", " ((numberFields <= CompressedNumber.MAX_COMPRESSED_INT_ONE_BYTE) ?", " 1 : ", " (numberFields <= CompressedNumber.MAX_COMPRESSED_INT_TWO_BYTES) ?", " 2 : 4) +", "", " ((firstField <= CompressedNumber.MAX_COMPRESSED_INT_ONE_BYTE) ?", " 1 : ", " (firstField <= CompressedNumber.MAX_COMPRESSED_INT_TWO_BYTES) ?", " 2 : 4);", "\t\t\tlen += CompressedNumber.sizeLong(overflowPage);", "\t\t\tlen += CompressedNumber.sizeInt(overflowId);", " len += CompressedNumber.sizeInt(firstField);" ] }, { "added": [ " if (overflow == null) {", " overflow = new OverflowInfo();", " }", " overflow.firstField = firstField;" ], "header": "@@ -379,7 +378,10 @@ public final class StoredRecordHeader", "removed": [ "\t\tthis.firstField = firstField;" ] }, { "added": [ " if (overflow == null) {", " overflow = new OverflowInfo();", " }", " overflow.overflowPage = overflowHandle.getPageNumber();", " overflow.overflowId = overflowHandle.getId();", " if (overflow == null) {", " overflow = new OverflowInfo();", " }", " this.status = (byte) (loadFromTarget.status | RECORD_OVERFLOW);", " overflow.firstField = loadFromTarget.overflow.firstField;" ], "header": "@@ -390,16 +392,22 @@ public final class StoredRecordHeader", "removed": [ "\t\tthis.overflowPage = overflowHandle.getPageNumber();", "\t\tthis.overflowId = overflowHandle.getId();", "\t\tthis.status = (loadFromTarget.status | RECORD_OVERFLOW);", " this.firstField = loadFromTarget.firstField;" ] }, { "added": [ "\t\t\tlen += CompressedNumber.writeLong(out, overflow.overflowPage);", "\t\t\tlen += CompressedNumber.writeInt(out, overflow.overflowId);", "\t\t\tlen += CompressedNumber.writeInt(out, overflow.firstField);" ], "header": "@@ -437,14 +445,14 @@ public final class StoredRecordHeader", "removed": [ "\t\t\tlen += CompressedNumber.writeLong(out, overflowPage);", "\t\t\tlen += CompressedNumber.writeInt(out, overflowId);", "\t\t\tlen += CompressedNumber.writeInt(out, firstField);" ] }, { "added": [ " int s = in.read();", " if (s < 0) {", " }", "", " status = (byte) s;", " if ((s & ~RECORD_VALID_MASK) != 0)", " \t\"Invalid status in StoredRecordHeader = \" + s);", " if (hasOverflow() || hasFirstField()) {", " overflow = new OverflowInfo();", " } else {", " overflow = null;", " }", "", "\t\t\toverflow.overflowPage = CompressedNumber.readLong(in);", "\t\t\toverflow.overflowId = CompressedNumber.readInt(in);", "\t\t\toverflow.firstField = CompressedNumber.readInt(in);" ], "header": "@@ -462,44 +470,44 @@ public final class StoredRecordHeader", "removed": [ "\t\tstatus = in.read();", "\t\tif (status < 0)", " if ((status & ~RECORD_VALID_MASK) != 0)", " \t\"Invalid status in StoredRecordHeader = \" + status);", "\t\t\toverflowPage = CompressedNumber.readLong(in);", "\t\t\toverflowId = CompressedNumber.readInt(in);", " else ", " {", "\t\t\toverflowPage = 0;", "\t\t\toverflowId = 0;", "\t\t}", "\t\t\tfirstField = CompressedNumber.readInt(in);", " else ", " {", "\t\t\tfirstField = 0;", "\t\t}" ] }, { "added": [], "header": "@@ -515,39 +523,6 @@ public final class StoredRecordHeader", "removed": [ " private int readId(", " byte[] data,", " int offset)", " {", "\t\tint value = data[offset++];", "", " if ((value & ~0x3f) == 0)", " {", " // value stored in this byte.", " id = value;", "", " return(1);", " }", "\t\telse if ((value & 0x80) == 0)", "\t\t{", " // value is stored in 2 bytes. only use low 6 bits from 1st byte.", "", " id = (((value & 0x3f) << 8) | (data[offset] & 0xff));", "", " return(2);", "\t\t}", " else", " {", " // value is stored in 4 bytes. only use low 7 bits from 1st byte.", " id = ", " ((value & 0x7f) << 24) |", " ((data[offset++] & 0xff) << 16) |", " ((data[offset++] & 0xff) << 8) |", " ((data[offset] & 0xff) );", "", " return(4);", " }", " }" ] }, { "added": [ " overflow.overflowPage = ((int_value << 8) | (data[offset] & 0xff));" ], "header": "@@ -559,7 +534,7 @@ public final class StoredRecordHeader", "removed": [ " overflowPage = ((int_value << 8) | (data[offset] & 0xff));" ] }, { "added": [ " overflow.overflowPage =" ], "header": "@@ -567,7 +542,7 @@ public final class StoredRecordHeader", "removed": [ " overflowPage = " ] }, { "added": [ " overflow.overflowPage =" ], "header": "@@ -579,7 +554,7 @@ public final class StoredRecordHeader", "removed": [ " overflowPage = " ] }, { "added": [ " overflow.overflowId = value;" ], "header": "@@ -601,7 +576,7 @@ public final class StoredRecordHeader", "removed": [ " overflowId = value;" ] }, { "added": [ " overflow.overflowId =", " (((value & 0x3f) << 8) | (data[offset] & 0xff));", " overflow.overflowId =" ], "header": "@@ -609,14 +584,15 @@ public final class StoredRecordHeader", "removed": [ " overflowId = (((value & 0x3f) << 8) | (data[offset] & 0xff));", " overflowId = " ] }, { "added": [ " overflow.firstField = value;" ], "header": "@@ -634,7 +610,7 @@ public final class StoredRecordHeader", "removed": [ " firstField = value;" ] }, { "added": [ " overflow.firstField =", " (((value & 0x3f) << 8) | (data[offset] & 0xff));", " overflow.firstField =" ], "header": "@@ -642,14 +618,15 @@ public final class StoredRecordHeader", "removed": [ " firstField = (((value & 0x3f) << 8) | (data[offset] & 0xff));", " firstField = " ] }, { "added": [ " overflow = null;", " overflow = new OverflowInfo();" ], "header": "@@ -719,17 +696,14 @@ public final class StoredRecordHeader", "removed": [ "\t\t\toverflowPage = 0;", "\t\t\toverflowId = 0;", " firstField = 0;", "\t\t\toverflowPage = 0;", "\t\t\toverflowId = 0;" ] }, { "added": [ " overflow = new OverflowInfo();" ], "header": "@@ -738,6 +712,7 @@ public final class StoredRecordHeader", "removed": [] }, { "added": [], "header": "@@ -749,7 +724,6 @@ public final class StoredRecordHeader", "removed": [ " firstField = 0;" ] } ] } ]
derby-DERBY-3131-73bd5d40
DERBY-3131: Background cleaner has no daemon service after database creation Give the page cache and the container cache a background cleaner also when no recovery was performed during database boot. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@600457 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/store/raw/data/DataFactory.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.services.daemon.DaemonService;" ], "header": "@@ -23,6 +23,7 @@ package org.apache.derby.iapi.store.raw.data;", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/store/raw/data/BaseDataFileFactory.java", "hunks": [ { "added": [], "header": "@@ -2222,15 +2222,11 @@ public class BaseDataFileFactory", "removed": [ "\t\t// hook up the cache cleaner daemon after recovery is finished", "\t\tcontainerCache.useDaemonService(daemon);", "", "\t\tpageCache.useDaemonService(daemon);" ] } ] }, { "file": "java/engine/org/apache/derby/impl/store/raw/log/LogToFile.java", "hunks": [ { "added": [ "\t\t// setup checkpoint daemon and cache cleaner", "", " // use the same daemon for the cache cleaner", " dataFactory.setupCacheCleaner(checkpointDaemon);" ], "header": "@@ -1340,13 +1340,16 @@ public final class LogToFile implements LogFactory, ModuleControl, ModuleSupport", "removed": [ "\t\t// setup checktpoint daemon" ] } ] } ]
derby-DERBY-3132-129b0765
DERBY-3132: Changed some calls to deprecated methods Properties.save(OutputStream, String) -> Properties.store(OutputStream, String) URLDecoder.decode(String) -> URLDecoder.decode(String, String) ResultSet.getBigDecimal(int, int) -> ResultSet.getBigDecimal(int) git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@586317 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/build/org/apache/derbyBuild/splitmessages.java", "hunks": [ { "added": [ "\t\t\tc[i].store(fos, (String) null);" ], "header": "@@ -173,7 +173,7 @@ public class splitmessages {", "removed": [ "\t\t\tc[i].save(fos, (String) null);" ] }, { "added": [ "\t\t\t\tc[i].store(fos, (String) null);" ], "header": "@@ -181,7 +181,7 @@ public class splitmessages {", "removed": [ "\t\t\t\tc[i].save(fos, (String) null);" ] }, { "added": [ " clientProps.store(clientOutStream, (String)null);" ], "header": "@@ -198,7 +198,7 @@ public class splitmessages {", "removed": [ " clientProps.save(clientOutStream, (String)null);" ] } ] }, { "file": "java/tools/org/apache/derby/impl/tools/sysinfo/Main.java", "hunks": [ { "added": [ " String filename;", " try {", " // Should use UTF-8 according to", " // http://www.w3.org/TR/html40/appendix/notes.html#non-ascii-chars", " filename = URLDecoder.decode(loc.toString(), \"UTF-8\");", " } catch (UnsupportedEncodingException e) {", " // All JVMs are required to support UTF-8.", " return null;", " }" ], "header": "@@ -1201,7 +1201,15 @@ public static void getMainInfo (java.io.PrintWriter aw, boolean pause) {", "removed": [ " String filename = URLDecoder.decode(loc.toString());" ] } ] } ]
derby-DERBY-3132-e24d8efb
DERBY-3132: Added @deprecated javadoc tag to implementations of deprecated methods git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@586313 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/client/org/apache/derby/client/am/ResultSet.java", "hunks": [ { "added": [ " /** @deprecated */" ], "header": "@@ -783,6 +783,7 @@ public abstract class ResultSet implements java.sql.ResultSet,", "removed": [] }, { "added": [ " * @deprecated" ], "header": "@@ -1168,6 +1169,7 @@ public abstract class ResultSet implements java.sql.ResultSet,", "removed": [] }, { "added": [ " /** @deprecated */" ], "header": "@@ -1527,6 +1529,7 @@ public abstract class ResultSet implements java.sql.ResultSet,", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/jdbc/EmbedResultSet20.java", "hunks": [ { "added": [ " * @deprecated" ], "header": "@@ -93,6 +93,7 @@ public class EmbedResultSet20", "removed": [] }, { "added": [ " * @deprecated" ], "header": "@@ -128,6 +129,7 @@ public class EmbedResultSet20", "removed": [] }, { "added": [ " * @deprecated" ], "header": "@@ -141,6 +143,7 @@ public class EmbedResultSet20", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/vti/VTITemplate.java", "hunks": [ { "added": [ " * @deprecated" ], "header": "@@ -151,6 +151,7 @@ public abstract class VTITemplate implements ResultSet {", "removed": [] }, { "added": [ " * @deprecated" ], "header": "@@ -205,6 +206,7 @@ public abstract class VTITemplate implements ResultSet {", "removed": [] }, { "added": [ " * @deprecated" ], "header": "@@ -296,6 +298,7 @@ public abstract class VTITemplate implements ResultSet {", "removed": [] }, { "added": [ " * @deprecated" ], "header": "@@ -350,6 +353,7 @@ public abstract class VTITemplate implements ResultSet {", "removed": [] } ] } ]
derby-DERBY-3135-36659bbf
DERBY-3135 Committing patch derby-3135-01-jsr169numerics-aa.diff generated by Rick. This patch enforces the expectation that Derby will call getString() when reading DECIMAL/NUMERIC columns from a table function. Thanks for the patch, Rick. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@586265 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-3136-d0edfdc8
DERBY-3136 Cut down on unnecessary String and CollationElementIterator objects creation in Like.java class by changing the way we compare the character in value string vs character in the pattern string. When working with database with UCS_BASIC collation, the 2 characters should be the same otherwise we will return FALSE. When working with territory based collation, if the 2 characters are the same, then we can simply return TRUE because their collation elements will have to be same. But if the 2 characters are not same, then use the RuleBasedCollator for the territory to see if those 2 different characters match (ie they have same collation element(s) corresponding to them). git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@588147 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/types/Like.java", "hunks": [ { "added": [ "\t * If the character in val matches the character in pat, then it does not", "\t * matter if the database is UCS_BASIC or territory based, we simply return ", "\t * TRUE from the method. ", "\t * If the characters do not match and we are running with UCS_BASIC ", "\t * collation, then we will return FALSE. ", "\t * But if the database is territory based, then we want to use the Collator ", "\t * for the territory to determine if the Collator treats the 2 characters ", "\t * as equal (ie if their collation elements match, then the 2 characters ", "\t * are equal even if they are not the same character).", "\t * types. If not null, then we use it to determine the equality of the", "\t * 2 characters in pat and val if they are not same.", "", "\t\tif (val[vLoc] == pat[pLoc]) { ", "\t // same character, so two strings consisting of this ", "\t // single character must be equal regardless of territory ", "\t return true; ", "\t } else if (collator == null) { ", "\t // not same character, must be unequal in UCS_BASIC ", "\t return false; ", "\t } ", "", "\t\t//Check if the Collator for this database's territory considers these", "\t\t//2 characters as equal based on their collation elements", "\t String s1 = new String(val, vLoc, 1); ", "\t String s2 = new String(pat, pLoc, 1); ", "", "\t return collator.compare(s1, s2) == 0; " ], "header": "@@ -265,59 +265,45 @@ public class Like {", "removed": [ "\t * Make sure that the character in val matches the character in pat.", "\t * If we are dealing with UCS_BASIC character string (ie collator is null)", "\t * then we can just do simple character equality check. But if we are", "\t * dealing with territory based character string type, then we need to ", "\t * convert the character in val and pat into it's collation element(s)", "\t * and then do collation element equality comparison.", "\t * types. If not null, then we use it to get collation elements for ", "\t * character in val and pat to do the equality comparison.", "\t\tCollationElementIterator patternIterator;", "\t\tint curCollationElementInPattern;", "\t\tCollationElementIterator valueIterator;", "\t\tint curCollationElementInValue;", "", "\t\tif (collator == null) {//dealing with UCS_BASIC character string", "\t\t\tif (val[vLoc] == pat[pLoc]) ", "\t\t\t\treturn true;", "\t\t\telse ", "\t\t\t\treturn false;", "\t\t} else {//dealing with territory based character string", "\t\t\tpatternIterator = collator.getCollationElementIterator(", "\t\t\t\t\tnew String(pat, pLoc, 1));", "\t\t\tvalueIterator = collator.getCollationElementIterator(", "\t\t\t\t\tnew String(val, vLoc, 1));", "\t\t\tcurCollationElementInPattern = patternIterator.next(); ", "\t\t\tcurCollationElementInValue = valueIterator.next();", "\t\t\twhile (curCollationElementInPattern == curCollationElementInValue)", "\t\t\t{", "\t\t\t\tif (curCollationElementInPattern == CollationElementIterator.NULLORDER)", "\t\t\t\t\tbreak;", "\t\t\t\tcurCollationElementInPattern = patternIterator.next(); ", "\t\t\t\tcurCollationElementInValue = valueIterator.next(); ", "\t\t\t}", "\t\t\t//If the current collation element for the character in pattern ", "\t\t\t//and value do not match, then we have found a mismatach and it", "\t\t\t//is time to return FALSE from this method.", "\t\t\tif (curCollationElementInPattern != curCollationElementInValue)", "\t\t\t\treturn false;", "\t\t\telse", "\t\t\t\treturn true;", "\t\t}", "\t\t" ] } ] } ]
derby-DERBY-3137-09069c54
DERBY-3137 SQL roles: add catalog support Patch DERBY-3137-moreTests-b which adds a missign test case. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@727709 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-3137-0ea31cab
DERBY-3137 SQL roles: add catalog support Patch DERBY-3137-setRoleAsStringFix-b: When setting a role with a literal string argument, we should do the same checks as for dynamic parameter on the identifier validity. Added that, plus new test cases and some refactoring. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@730802 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/util/IdUtil.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.reference.Limits;" ], "header": "@@ -30,6 +30,7 @@ import java.io.StringReader;", "removed": [] } ] } ]
derby-DERBY-3137-44ea4f0f
DERBY-3137 SQL roles: add catalog support Patch DERBY-3137-setRoleNoCNF-3, which changes the behavior of SET ROLE ? and CURRENT_ROLE to comply with the latest SQL standard: - changes the behavior of SET ROLE ? to interpret the dynamic argument as a delimited SQL identifier. Up till now, it was interpreted as an identifer in internal (case normal form), but this seems wrong according to SQL 2003, section 18.3, GR3. A Java null value is no longer accepted as an argument. An empty string or a null value will give identifer parse error ("XCXA0"). NONE no longer has a special meaning when used in a dynamic ("SET ROLE ?") statement, cf. the addendum ISO/IEC 9075-2:2003/Cor.2:2007 section 18.3. Also, section 18.3, GR2 calls for whitespace to be removed from the string before interpreting it as an identifier. This is now also performed. - similarly changes the builtin function CURRENT_ROLE to now return a delimited identifer if the role is set, making it "symmetrical" with SET ROLE, that is, the output of CURRENT_ROLE can be used as input to "SET ROLE ?". When the role is not set, CURRENT_ROLE returns NULL (which can not be used as input to "SET ROLE ?", however). git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@699374 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/compile/SpecialFunctionNode.java", "hunks": [ { "added": [ "\t\t\tmethodName = \"getCurrentRoleIdDelimited\";" ], "header": "@@ -158,7 +158,7 @@ public class SpecialFunctionNode extends ValueNode", "removed": [ "\t\t\tmethodName = \"getCurrentRoleIdChecked\";" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java", "hunks": [ { "added": [ "\t * @see LanguageConnectionContext#getCurrentRoleIdDelimited(Activation a)", "\tpublic String getCurrentRoleIdDelimited(Activation a)" ], "header": "@@ -3280,9 +3280,9 @@ public class GenericLanguageConnectionContext", "removed": [ "\t * @see LanguageConnectionContext#getCurrentRoleIdChecked(Activation a)", "\tpublic String getCurrentRoleIdChecked(Activation a)" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/SetRoleConstantAction.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.util.IdUtil;" ], "header": "@@ -34,6 +34,7 @@ import org.apache.derby.iapi.error.StandardException;", "removed": [] } ] } ]
derby-DERBY-3137-4e3ddd75
DERBY-3137 SQL roles: add catalog support Patch DERBY-3137-rename-b. Renaming plus misc cleanup. No behavioral change. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@661123 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/sql/dictionary/DataDescriptorGenerator.java", "hunks": [ { "added": [ " * Create a new role grant descriptor", "\t * @param uuid unique identifier for this role grant descriptor in", "\t * time and space" ], "header": "@@ -486,9 +486,10 @@ public class DataDescriptorGenerator", "removed": [ " * Create a new role descriptor", "\t * @param uuid unique identifier for this role descriptor in time and space" ] } ] }, { "file": "java/engine/org/apache/derby/iapi/sql/dictionary/DataDictionary.java", "hunks": [ { "added": [ "\t * Drop a role grant", " * @param grantee The grantee", " * @param grantor The grantor", "\tpublic void\tdropRoleGrant(String roleName,", "\t\t\t\t\t\t\t String grantee,", "\t\t\t\t\t\t\t String grantor,", "\t\t\t\t\t\t\t TransactionController tc)", "\t * Drop all role grants corresponding to a grant of (any)", " * @param grantee The grantee" ], "header": "@@ -417,27 +417,27 @@ public interface DataDictionary", "removed": [ "\t * Drop the descriptor for a role", " * @param grantee The grantee of the descriptor", " * @param grantor The grantor of the descriptor", "\tpublic void\tdropRoleDescriptor(String roleName,", " String grantee,", " String grantor,", "\t\t\t\t\t\t\t\t TransactionController tc)", "\t * Drop all role descriptors corresponding to a grant of (any)", " * @param grantee The grantee of the descriptor" ] }, { "added": [ "\t * Drop all role grants corresponding to a grant of the" ], "header": "@@ -448,7 +448,7 @@ public interface DataDictionary", "removed": [ "\t * Drop all role descriptors corresponding to a grant of the" ] }, { "added": [ "\t * Get a role grant descriptor for a role definition.", "\tpublic RoleGrantDescriptor getRoleDefinitionDescriptor(String roleName)", "\t * Get the role grant descriptor corresponding to the uuid provided", "\t * @return The descriptor for the role grant descriptor", "\tpublic RoleGrantDescriptor getRoleGrantDescriptor(UUID uuid)", "\t * Get a descriptor for a role grant" ], "header": "@@ -1865,29 +1865,29 @@ public interface DataDictionary", "removed": [ "\t * Get a role descriptor for a role definition.", "\tpublic RoleDescriptor getRoleDefinitionDescriptor(String roleName)", "\t * Get the descriptor corresponding to the uuid", "\t * @return The descriptor for the role (definition or grant descriptor)", "\tpublic RoleDescriptor getRoleDescriptor(UUID uuid)", "\t * Get a role descriptor for a role grant" ] } ] }, { "file": "java/engine/org/apache/derby/iapi/sql/dictionary/RoleGrantDescriptor.java", "hunks": [ { "added": [ " Derby - Class org.apache.derby.iapi.sql.dictionary.RoleGrantDescriptor" ], "header": "@@ -1,6 +1,6 @@", "removed": [ " Derby - Class org.apache.derby.iapi.sql.dictionary.RoleDescriptor" ] }, { "added": [ " *", " * An instance contains information for exactly:", " * One <role definition>, cf. ISO/IEC 9075-2:2003 section 12.4 *or*", " * one <grant role statement>, section 12.5.", " *", " * A role definition is also modeled as a role grant (hence the class", " * name), but with the special grantor \"_SYSTEM\", and with a grantee", " * of the definer, in Derby this is always the current user. For a", " * role definition, the WITH ADMIN flag is also set. The information", " * contained in the isDef flag is usually redundant, but was added as", " * a precaution against a real user named _SYSTEM, for example when", " * upgrading an older database that did not forbid this.", "public class RoleGrantDescriptor extends TupleDescriptor", " implements Provider" ], "header": "@@ -34,9 +34,21 @@ import org.apache.derby.impl.sql.catalog.DDdependableFinder;", "removed": [ "public class RoleDescriptor extends TupleDescriptor", " implements Provider" ] }, { "added": [ " RoleGrantDescriptor(DataDictionary dd,", " UUID uuid,", " String roleName,", " String grantee,", " String grantor,", " boolean withAdminOption,", " boolean isDef) {" ], "header": "@@ -59,13 +71,13 @@ public class RoleDescriptor extends TupleDescriptor", "removed": [ " RoleDescriptor(DataDictionary dd,", " UUID uuid,", " String roleName,", " String grantee,", " String grantor,", " boolean withAdminOption,", " boolean isDef) {" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.sql.dictionary.RoleGrantDescriptor;" ], "header": "@@ -53,7 +53,7 @@ import org.apache.derby.iapi.sql.dictionary.ColPermsDescriptor;", "removed": [ "import org.apache.derby.iapi.sql.dictionary.RoleDescriptor;" ] }, { "added": [ "\t * @see DataDictionary#dropRoleGrant", "\tpublic void dropRoleGrant(String roleName,", "\t\t\t\t\t\t\t String grantee,", "\t\t\t\t\t\t\t String grantor,", "\t\t\t\t\t\t\t TransactionController tc)" ], "header": "@@ -1784,19 +1784,12 @@ public final class\tDataDictionaryImpl", "removed": [ "\t * Drop the descriptor for a role", "\t *", "\t * @param roleName\tThe name of the role to drop", "\t * @param grantee\tThe grantee of the descriptor", "\t * @param grantor\tThe grantor of the descriptor", "\t * @param tc\t\tTransactionController for the transaction", "\t *", "\t * @exception StandardException Thrown on error", "\tpublic void dropRoleDescriptor(String roleName,", "\t\t\t\t\t\t\t\t String grantee,", "\t\t\t\t\t\t\t\t String grantor,", "\t\t\t\t\t\t\t\t TransactionController tc)" ] }, { "added": [ "\t * @see DataDictionary#dropRoleGrantsByGrantee" ], "header": "@@ -2750,13 +2743,7 @@ public final class\tDataDictionaryImpl", "removed": [ "\t * Drop all role descriptors corresponding to a grant of (any)", "\t * role to a named authentication identifier", "\t *", "\t * @param grantee The grantee of the descriptor", "\t * @param tc Transaction Controller", "\t *", "\t * @exception StandardException Thrown on failure" ] }, { "added": [ "\tprivate boolean existsRoleGrantByGrantee(String grantee,", "\t\t\t\t\t\t\t\t\t\t\t TransactionController tc)" ], "header": "@@ -2784,8 +2771,8 @@ public final class\tDataDictionaryImpl", "removed": [ "\tpublic boolean existsRoleGrantByGrantee(String grantee,", "\t\t\t\t\t\t\t\t\t\t\tTransactionController tc)" ] }, { "added": [ "\t * @see DataDictionary#dropRoleGrantsByName" ], "header": "@@ -2801,13 +2788,7 @@ public final class\tDataDictionaryImpl", "removed": [ "\t * Drop all role descriptors corresponding to a grant of the", "\t * named role to any authentication identifier", "\t *", "\t * @param roleName The role name granted", "\t * @param tc Transaction Controller", "\t *", "\t * @exception StandardException Thrown on failure" ] }, { "added": [ "\t\t\t\t\t\t\t\t\t\tTransactionController tc,", "\t\t\t\t\t\t\t\t\t\tint catalog,", "\t\t\t\t\t\t\t\t\t\tint indexNo,", "\t\t\t\t\t\t\t\t\t\tint granteeColnoInIndex)" ], "header": "@@ -2975,10 +2956,10 @@ public final class\tDataDictionaryImpl", "removed": [ "\t\t\t\t\t\t\t\t\t TransactionController tc,", "\t\t\t\t\t\t\t\t\t int catalog,", "\t\t\t\t\t\t\t\t\t int indexNo,", "\t\t\t\t\t\t\t\t\t int granteeColnoInIndex)" ] }, { "added": [ "\t * @see DataDictionary#getRoleGrantDescriptor(UUID)", "\tpublic RoleGrantDescriptor getRoleGrantDescriptor(UUID uuid)" ], "header": "@@ -11696,33 +11677,9 @@ public final class\tDataDictionaryImpl", "removed": [ "\t * Get the descriptor for the named role.", "\t *", "\t * @param roleName\tThe role name", "\t *", "\t * @return The descriptor for the role. Can be null if not found.", "\t *", "\t * @exception StandardException Thrown on error", "\t */", "\tpublic RoleDescriptor getRoleDefinitionDescriptor(String roleName)", "\t\tthrows StandardException", "\t{", "\t\tRoleDescriptor rd = locateRoleDefinitionRow(roleName);", "", "\t\treturn rd;", "\t}", "", "\t", "\t/**", "\t * Get the descriptor corresponding to the uuid", "\t *", "\t * @param uuid", "\t *", "\t * @return The descriptor for the role (definition or grant descriptor)", "\t *", "\t * @exception StandardException Thrown on error", "\tpublic RoleDescriptor getRoleDescriptor(UUID uuid)" ] }, { "added": [ "\t\treturn (RoleGrantDescriptor)" ], "header": "@@ -11738,7 +11695,7 @@ public final class\tDataDictionaryImpl", "removed": [ "\t\treturn (RoleDescriptor)" ] }, { "added": [], "header": "@@ -11750,26 +11707,6 @@ public final class\tDataDictionaryImpl", "removed": [ "\t/**", "\t * Get a role descriptor for a role grant", "\t *", "\t * @param roleName The name of the role whose definition we seek", "\t * @param grantee The grantee", "\t * @param grantor The grantor", "\t *", "\t * @throws StandardException error", "\t */", "\tpublic RoleDescriptor getRoleGrantDescriptor(String roleName,", "\t\t\t\t\t\t\t\t\t\t\t\t String grantee,", "\t\t\t\t\t\t\t\t\t\t\t\t String grantor)", "\t\tthrows StandardException", "\t{", "\t\tRoleDescriptor rd = locateRoleGrantRow(roleName, grantee, grantor);", "", "\t\treturn rd;", "\t}", "", "" ] }, { "added": [ "\t *", "\t * @see DataDictionary#getRoleDefinitionDescriptor", "\tpublic RoleGrantDescriptor getRoleDefinitionDescriptor(String roleName)" ], "header": "@@ -11778,10 +11715,11 @@ public final class\tDataDictionaryImpl", "removed": [ "\t *", "\tprivate RoleDescriptor locateRoleDefinitionRow(String roleName)" ] }, { "added": [ "\t\treturn (RoleGrantDescriptor)" ], "header": "@@ -11800,7 +11738,7 @@ public final class\tDataDictionaryImpl", "removed": [ "\t\treturn (RoleDescriptor)" ] }, { "added": [ "\t * @return\t The descriptor for the role grant", "\t *", "\t * @see DataDictionary#getRoleGrantDescriptor(String, String, String)", "\tpublic RoleGrantDescriptor getRoleGrantDescriptor(String roleName,", "\t\t\t\t\t\t\t\t\t\t\t\t\t String grantee,", "\t\t\t\t\t\t\t\t\t\t\t\t\t String grantor)" ], "header": "@@ -11821,13 +11759,15 @@ public final class\tDataDictionaryImpl", "removed": [ "\t * @return\t The descriptor (row) for the role grant", "\tprivate RoleDescriptor locateRoleGrantRow(String roleName,", "\t\t\t\t\t\t\t\t\t\t\t String grantee,", "\t\t\t\t\t\t\t\t\t\t\t String grantor)" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/catalog/SYSROLESRowFactory.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.sql.dictionary.RoleGrantDescriptor;" ], "header": "@@ -30,7 +30,7 @@ import org.apache.derby.iapi.types.DataValueFactory;", "removed": [ "import org.apache.derby.iapi.sql.dictionary.RoleDescriptor;" ] }, { "added": [ " * @param td a role grant descriptor" ], "header": "@@ -105,7 +105,7 @@ public class SYSROLESRowFactory extends CatalogRowFactory", "removed": [ " * @param td a role descriptor" ] }, { "added": [ " RoleGrantDescriptor rgd = (RoleGrantDescriptor)td;", "", " roleid = rgd.getRoleName();", " grantee = rgd.getGrantee();", " grantor = rgd.getGrantor();", " wao = rgd.isWithAdminOption();", " isdef = rgd.isDef();", " UUID oid = rgd.getUUID();" ], "header": "@@ -126,14 +126,14 @@ public class SYSROLESRowFactory extends CatalogRowFactory", "removed": [ " RoleDescriptor roleDescriptor = (RoleDescriptor)td;", "", " roleid = roleDescriptor.getRoleName();", " grantee = roleDescriptor.getGrantee();", " grantor = roleDescriptor.getGrantor();", " wao = roleDescriptor.isWithAdminOption();", " isdef = roleDescriptor.isDef();", " UUID oid = roleDescriptor.getUUID();" ] }, { "added": [ " RoleGrantDescriptor descriptor;" ], "header": "@@ -186,7 +186,7 @@ public class SYSROLESRowFactory extends CatalogRowFactory", "removed": [ " RoleDescriptor descriptor;" ] }, { "added": [ " // first column is uuid of this role grant descriptor (char(36))" ], "header": "@@ -201,7 +201,7 @@ public class SYSROLESRowFactory extends CatalogRowFactory", "removed": [ " // first column is uuid of this role descriptor (char(36))" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.sql.dictionary.RoleGrantDescriptor;" ], "header": "@@ -53,7 +53,7 @@ import org.apache.derby.iapi.sql.dictionary.ConglomerateDescriptorList;", "removed": [ "import org.apache.derby.iapi.sql.dictionary.RoleDescriptor;" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/CreateRoleConstantAction.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.sql.dictionary.RoleGrantDescriptor;" ], "header": "@@ -31,7 +31,7 @@ import org.apache.derby.iapi.sql.Activation;", "removed": [ "import org.apache.derby.iapi.sql.dictionary.RoleDescriptor;" ] }, { "added": [ " RoleGrantDescriptor rd = dd.getRoleDefinitionDescriptor(roleName);" ], "header": "@@ -95,7 +95,7 @@ class CreateRoleConstantAction extends DDLConstantAction {", "removed": [ " RoleDescriptor rd = dd.getRoleDefinitionDescriptor(roleName);" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/DropRoleConstantAction.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.sql.dictionary.RoleGrantDescriptor;" ], "header": "@@ -27,7 +27,7 @@ import org.apache.derby.iapi.error.StandardException;", "removed": [ "import org.apache.derby.iapi.sql.dictionary.RoleDescriptor;" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/GrantRoleConstantAction.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.sql.dictionary.RoleGrantDescriptor;" ], "header": "@@ -30,7 +30,7 @@ import org.apache.derby.iapi.sql.Activation;", "removed": [ "import org.apache.derby.iapi.sql.dictionary.RoleDescriptor;" ] }, { "added": [ " RoleGrantDescriptor rd = dd.getRoleDefinitionDescriptor(role);" ], "header": "@@ -98,7 +98,7 @@ class GrantRoleConstantAction extends DDLConstantAction {", "removed": [ " RoleDescriptor rd = dd.getRoleDefinitionDescriptor(role);" ] }, { "added": [ " if (grantor.equals(lcc.getDataDictionary().", " getAuthorizationDatabaseOwner())) {", " rd.getGrantee().equals(grantor),", " \"expected database owner in role grant descriptor\");" ], "header": "@@ -117,14 +117,13 @@ class GrantRoleConstantAction extends DDLConstantAction {", "removed": [ " if (grantor.equals(rd.getGrantee())) {", " lcc.getDataDictionary().", " getAuthorizationDatabaseOwner().", " equals(grantor),", " \"expected database owner in role descriptor\");" ] }, { "added": [ " // Has it already been granted?" ], "header": "@@ -134,6 +133,7 @@ class GrantRoleConstantAction extends DDLConstantAction {", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/RevokeRoleConstantAction.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.sql.dictionary.RoleGrantDescriptor;" ], "header": "@@ -29,7 +29,7 @@ import org.apache.derby.iapi.error.StandardException;", "removed": [ "import org.apache.derby.iapi.sql.dictionary.RoleDescriptor;" ] }, { "added": [ " RoleGrantDescriptor rd = dd.getRoleDefinitionDescriptor(role);" ], "header": "@@ -93,7 +93,7 @@ class RevokeRoleConstantAction extends DDLConstantAction {", "removed": [ " RoleDescriptor rd = dd.getRoleDefinitionDescriptor(role);" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/SetRoleConstantAction.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.sql.dictionary.RoleGrantDescriptor;" ], "header": "@@ -24,7 +24,7 @@ package org.apache.derby.impl.sql.execute;", "removed": [ "import org.apache.derby.iapi.sql.dictionary.RoleDescriptor;" ] } ] }, { "file": "java/storeless/org/apache/derby/impl/storeless/EmptyDictionary.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.sql.dictionary.RoleGrantDescriptor;" ], "header": "@@ -48,7 +48,7 @@ import org.apache.derby.iapi.sql.dictionary.PermissionsDescriptor;", "removed": [ "import org.apache.derby.iapi.sql.dictionary.RoleDescriptor;" ] }, { "added": [ "\tpublic void\tdropRoleGrant(String roleName,", "\t\t\t\t\t\t\t String grantee,", "\t\t\t\t\t\t\t String grantor,", "\t\t\t\t\t\t\t TransactionController tc)" ], "header": "@@ -165,10 +165,10 @@ public class EmptyDictionary implements DataDictionary, ModuleSupportable {", "removed": [ "\tpublic void\tdropRoleDescriptor(String roleName,", " String grantee,", " String grantor,", "\t\t\t\t\t\t\t\t TransactionController tc)" ] }, { "added": [ "\tpublic RoleGrantDescriptor getRoleDefinitionDescriptor(String roleName)", "\tpublic RoleGrantDescriptor getRoleGrantDescriptor(UUID uuid)", "\tpublic RoleGrantDescriptor getRoleGrantDescriptor(String roleName,", "\t\t\t\t\t\t\t\t\t\t\t\t\t String grantee,", "\t\t\t\t\t\t\t\t\t\t\t\t\t String grantor)" ], "header": "@@ -202,23 +202,23 @@ public class EmptyDictionary implements DataDictionary, ModuleSupportable {", "removed": [ "\tpublic RoleDescriptor getRoleDefinitionDescriptor(String roleName)", "\tpublic RoleDescriptor getRoleDescriptor(UUID uuid)", "\tpublic RoleDescriptor getRoleGrantDescriptor(String roleName,", "\t\t\t\t\t\t\t\t\t\t\t\t String grantee,", "\t\t\t\t\t\t\t\t\t\t\t\t String grantor)" ] } ] } ]
derby-DERBY-3137-64f3218d
DERBY-3137 SQL roles: add catalog support Patch DERBY-3137-setRoleNoDynamicNone, which forbids use of "NONE" as an identifier to a dynamic SET ROLE statement, unless delimited. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@704754 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/execute/SetRoleConstantAction.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.util.StringUtil;" ], "header": "@@ -35,6 +35,7 @@ import org.apache.derby.iapi.sql.Activation;", "removed": [] } ] } ]
derby-DERBY-3137-a6c7bc73
DERBY-3137 SQL roles: add catalog support Patch DERBY-3137-modeTests which adds a missing test case: Creating a role that already exists. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@727417 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-3137-d02fa84d
DERBY-3137 SQL roles: add catalog support Patch DERBY-3137-ijfix: - a fix to ij's "SHOW ROLES" command to give an error message if the driver is not Derby embedded or client. The command does not use database metadata, so the generated select from SYS.SYSROLES is inherently Derby specific. - a new simple test for the command, tools/ij_show_roles.sql (run via JUnit/ToolScripts.java). The test is run both the embedded and via the network client. - a fix to escape case normal form role names to protect the role id when performing DROP ROLE in CleanDatabaseTestSetup#removeRoles (the test above provoked this bug). git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@699366 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/tools/org/apache/derby/impl/tools/ij/Session.java", "hunks": [ { "added": [ "\tboolean isEmbeddedDerby = false; // Is this the Derby Embedded JDBC Driver", "" ], "header": "@@ -52,6 +52,8 @@ class Session {", "removed": [] }, { "added": [ "\t\t\tisEmbeddedDerby = conn.getMetaData().getDriverName().", "\t\t\t\tstartsWith(\"Apache Derby Embedded JDBC Driver\");" ], "header": "@@ -61,7 +63,8 @@ class Session {", "removed": [ "" ] } ] }, { "file": "java/tools/org/apache/derby/impl/tools/ij/ijException.java", "hunks": [ { "added": [ "\tprivate final static String NotAvailableForDriver = \"IJ_NotAvailForDriver\";" ], "header": "@@ -62,6 +62,7 @@ public class ijException extends RuntimeException {", "removed": [] } ] } ]
derby-DERBY-3137-f717f799
DERBY-3137 SQL roles: add catalog support Patch DERBY-3137-uuid adds a UUID column to SYS.SYSROLES. The new column is needed for implementing persistent dependencies on role definitions and grants. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@614273 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/sql/dictionary/DataDescriptorGenerator.java", "hunks": [ { "added": [ "\t * @param uuid unique identifier for this role descriptor in time and space" ], "header": "@@ -488,6 +488,7 @@ public class DataDescriptorGenerator", "removed": [] }, { "added": [ " public RoleDescriptor newRoleDescriptor(UUID uuid,", "\t\t\t\t\t\t\t\t\t\t\tString roleName," ], "header": "@@ -497,7 +498,8 @@ public class DataDescriptorGenerator", "removed": [ " public RoleDescriptor newRoleDescriptor(String roleName," ] } ] }, { "file": "java/engine/org/apache/derby/iapi/sql/dictionary/RoleDescriptor.java", "hunks": [ { "added": [ "import org.apache.derby.catalog.UUID;", "import org.apache.derby.catalog.DependableFinder;", "import org.apache.derby.catalog.Dependable;", "import org.apache.derby.iapi.services.io.StoredFormatIds;", "import org.apache.derby.iapi.sql.depend.Provider;", "import org.apache.derby.impl.sql.catalog.DDdependableFinder;", " private final UUID uuid;" ], "header": "@@ -21,16 +21,23 @@", "removed": [] }, { "added": [ " * @param uuid unique identification in time and space of this role", " * descriptor" ], "header": "@@ -42,6 +49,8 @@ public class RoleDescriptor extends TupleDescriptor", "removed": [] }, { "added": [ " UUID uuid,", " this.uuid = uuid;" ], "header": "@@ -50,12 +59,14 @@ public class RoleDescriptor extends TupleDescriptor", "removed": [] }, { "added": [ " public UUID getUUID() {", " return uuid;", " }", "" ], "header": "@@ -63,6 +74,10 @@ public class RoleDescriptor extends TupleDescriptor", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java", "hunks": [ { "added": [ "\t\tti.deleteRow(tc, keyRow,", "\t\t\t\t\t SYSROLESRowFactory.SYSROLES_INDEX_ID_EE_OR_IDX);" ], "header": "@@ -1747,7 +1747,8 @@ public final class\tDataDictionaryImpl", "removed": [ "\t\tti.deleteRow(tc, keyRow, SYSROLESRowFactory.SYSROLES_INDEX1_ID );" ] }, { "added": [ "\t\t\t\t\t rf.SYSROLES_GRANTEE_COLPOS_IN_INDEX_ID_EE_OR," ], "header": "@@ -2696,7 +2697,7 @@ public final class\tDataDictionaryImpl", "removed": [ "\t\t\t\t\t rf.SYSROLES_GRANTEE_IN_INDEX1," ] }, { "added": [ "\t\t\t\t\t rf.SYSROLES_ROLEID_COLPOS_IN_INDEX_ID_EE_OR," ], "header": "@@ -2720,7 +2721,7 @@ public final class\tDataDictionaryImpl", "removed": [ "\t\t\t\t\t rf.SYSROLES_ROLEID_IN_INDEX1," ] }, { "added": [ "\t\t\tti.getIndexConglomerate(rf.SYSROLES_INDEX_ID_EE_OR_IDX)," ], "header": "@@ -2758,7 +2759,7 @@ public final class\tDataDictionaryImpl", "removed": [ "\t\t\tti.getIndexConglomerate(rf.SYSROLES_INDEX1_ID)," ] }, { "added": [ "\t\t\t\tti.getIndexRowGenerator(rf.SYSROLES_INDEX_ID_EE_OR_IDX),", "\t\t\t\t\t\t\t rf.SYSROLES_INDEX_ID_EE_OR_IDX);" ], "header": "@@ -2773,13 +2774,13 @@ public final class\tDataDictionaryImpl", "removed": [ "\t\t\t\tti.getIndexRowGenerator(rf.SYSROLES_INDEX1_ID),", "\t\t\t\t\t\t\t rf.SYSROLES_INDEX1_ID);" ] }, { "added": [ "\t", "\t/**", "\t * Get the descriptor corresponding to the uuid", "\t *", "\t * @param uuid", "\t *", "\t * @return The descriptor for the role (definition or grant descriptor)", "\t *", "\t * @exception StandardException Thrown on error", "\t */", "\tpublic RoleDescriptor getRoleDescriptor(UUID uuid)", "\t\tthrows StandardException", "\t{", "\t\tDataValueDescriptor UUIDStringOrderable;", "", "\t\tTabInfoImpl ti = getNonCoreTI(SYSROLES_CATALOG_NUM);", "", "\t\t/* Use UUIDStringOrderable in both start and stop position for", "\t\t * scan.", "\t\t */", "\t\tUUIDStringOrderable = getIDValueAsCHAR(uuid);", "", "\t\t/* Set up the start/stop position for the scan */", "\t\tExecIndexRow keyRow = exFactory.getIndexableRow(2);", "\t\tkeyRow.setColumn(1, UUIDStringOrderable);", "", "\t\treturn (RoleDescriptor)", "\t\t\t\t\tgetDescriptorViaIndex(", "\t\t\t\t\t\tSYSROLESRowFactory.SYSROLES_INDEX_UUID_IDX,", "\t\t\t\t\t\tkeyRow,", "\t\t\t\t\t\t(ScanQualifier [][]) null,", "\t\t\t\t\t\tti,", "\t\t\t\t\t\t(TupleDescriptor) null,", "\t\t\t\t\t\t(List) null,", "\t\t\t\t\t\tfalse);", "\t}", "" ], "header": "@@ -11506,6 +11507,43 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ "\t\t\t\t\t\tSYSROLESRowFactory.SYSROLES_INDEX_ID_DEF_IDX," ], "header": "@@ -11559,7 +11597,7 @@ public final class\tDataDictionaryImpl", "removed": [ "\t\t\t\t\t\tSYSROLESRowFactory.SYSROLES_INDEX2_ID," ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/catalog/SYSROLESRowFactory.java", "hunks": [ { "added": [ "import org.apache.derby.catalog.UUID;" ], "header": "@@ -21,6 +21,7 @@", "removed": [] }, { "added": [ " private static final int SYSROLES_COLUMN_COUNT = 6;", " private static final int SYSROLES_ROLE_UUID = 1;", " private static final int SYSROLES_ROLEID = 2;", " private static final int SYSROLES_GRANTEE = 3;", " private static final int SYSROLES_GRANTOR = 4;", " private static final int SYSROLES_WITHADMINOPTION = 5;", " private static final int SYSROLES_ISDEF = 6;", " {SYSROLES_ROLEID, SYSROLES_ISDEF},", " {SYSROLES_ROLE_UUID}", " // (role)ID_(grant)EE_(grant)OR", " static final int SYSROLES_INDEX_ID_EE_OR_IDX = 0;", " // (role)ID_(is)DEF", " static final int SYSROLES_INDEX_ID_DEF_IDX = 1;", " // UUID", " static final int SYSROLES_INDEX_UUID_IDX = 2;", "", "", " static final int SYSROLES_ROLEID_COLPOS_IN_INDEX_ID_EE_OR = 1;", " static final int SYSROLES_GRANTEE_COLPOS_IN_INDEX_ID_EE_OR = 2;", " private static final boolean[] uniqueness = {", " true,", " false, // many rows have same roleid and is not a definition", " true};", " \"c065801d-0115-382c-08df-ffffe275b270\", // SYSROLES_INDEX_ID_EE_OR", " \"787c0020-0115-382c-08df-ffffe275b270\", // SYSROLES_INDEX_ID_DEF", " \"629f8094-0116-d8f9-5f97-ffffe275b270\" // SYSROLES_INDEX_UUID" ], "header": "@@ -45,34 +46,44 @@ public class SYSROLESRowFactory extends CatalogRowFactory", "removed": [ " private static final int SYSROLES_COLUMN_COUNT = 5;", " private static final int SYSROLES_ROLEID = 1;", " private static final int SYSROLES_GRANTEE = 2;", " private static final int SYSROLES_GRANTOR = 3;", " private static final int SYSROLES_WITHADMINOPTION = 4;", " private static final int SYSROLES_ISDEF = 5;", "", " static final int SYSROLES_INDEX1_ID = 0;", " static final int SYSROLES_INDEX2_ID = 1;", "", " {SYSROLES_ROLEID, SYSROLES_ISDEF}", " static final int SYSROLES_ROLEID_IN_INDEX1 = 1;", " static final int SYSROLES_GRANTEE_IN_INDEX1 = 2;", " private static final boolean[] uniqueness = {true,false};", " \"c065801d-0115-382c-08df-ffffe275b270\", // SYSROLES_INDEX1", " \"787c0020-0115-382c-08df-ffffe275b270\" // SYSROLES_INDEX2" ] }, { "added": [ " String oid_string = null;" ], "header": "@@ -106,6 +117,7 @@ public class SYSROLESRowFactory extends CatalogRowFactory", "removed": [] }, { "added": [ " UUID oid = roleDescriptor.getUUID();", " oid_string = oid.toString();", " /* 1st column is UUID */", " row.setColumn(1, new SQLChar(oid_string));", " /* 2nd column is ROLEID */", " row.setColumn(2, new SQLVarchar(roleid));", " /* 3rd column is GRANTEE */", " row.setColumn(3, new SQLVarchar(grantee));", " /* 4th column is GRANTOR */", " row.setColumn(4, new SQLVarchar(grantor));", " /* 5th column is WITHADMINOPTION */", " row.setColumn(5, new SQLChar(wao ? \"Y\" : \"N\"));", "", " /* 6th column is ISDEF */", " row.setColumn(6, new SQLChar(isdef ? \"Y\" : \"N\"));" ], "header": "@@ -121,25 +133,30 @@ public class SYSROLESRowFactory extends CatalogRowFactory", "removed": [ " /* 1st column is ROLEID */", " row.setColumn(1, new SQLVarchar(roleid));", " /* 2nd column is GRANTEE */", " row.setColumn(2, new SQLVarchar(grantee));", " /* 3rd column is GRANTOR */", " row.setColumn(3, new SQLVarchar(grantor));", " /* 4th column is WITHADMINOPTION */", " row.setColumn(4, new SQLChar(wao ? \"Y\" : \"N\"));", " /* 4th column is ISDEF */", " row.setColumn(5, new SQLChar(isdef ? \"Y\" : \"N\"));" ] }, { "added": [ " String oid_string;" ], "header": "@@ -170,6 +187,7 @@ public class SYSROLESRowFactory extends CatalogRowFactory", "removed": [] }, { "added": [ " // first column is uuid of this role descriptor (char(36))", " oid_string = col.getString();", " // second column is roleid (varchar(128))", " roleid = col.getString();", " // third column is grantee (varchar(128))", " grantee = col.getString();", " // fourth column is grantor (varchar(128))", " grantor = col.getString();", " // fifth column is withadminoption (char(1))", " wao = col.getString();", "", " // sixth column is isdef (char(1))", " col = row.getColumn(6);", " descriptor = ddg.newRoleDescriptor", " (getUUIDFactory().recreateUUID(oid_string),", " roleid,", " grantee,", " grantor,", " wao.equals(\"Y\") ? true: false,", " isdef.equals(\"Y\") ? true: false);" ], "header": "@@ -183,31 +201,37 @@ public class SYSROLESRowFactory extends CatalogRowFactory", "removed": [ " // first column is roleid (varchar(128))", " roleid = col.getString();", " // second column is grantee (varchar(128))", " grantee = col.getString();", " // third column is grantor (varchar(128))", " grantor = col.getString();", " // fourth column is withadminoption (char(1))", " wao = col.getString();", " // fifth column is isdef (char(1))", " descriptor = ddg.newRoleDescriptor(roleid,", " grantee,", " grantor,", " wao.equals(\"Y\") ? true: false,", " isdef.equals(\"Y\") ? true: false);" ] } ] } ]
derby-DERBY-3138-3bbcfabe
DERBY-3138: Fix for this bug is to use the correct overload of accept() during preprocessing. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@587230 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-3139-53d64978
DERBY-3046 This commit fixes the null pointer exception by making sure that we do not try to access the object's elements if the object is null. I have also added a test case for this fix. Additionally, while working on this, I found that we return different sql state for parameter being out of range for PreparedStatment.setObject and Preparedstatement.setXXX calls in Network Server. I have entered a Jira entry for that issue DERBY-3139. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@586596 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-3142-9a55084e
DERBY-3142: sysinfo ignores derby.ui.locale Fetch sysinfo's resource bundle from LocalizedResource, which recognizes derby.ui.locale, instead of directly from ResourceBundle.getBundle(), which only considers the JVM's default locale. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@597610 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/tools/org/apache/derby/impl/tools/sysinfo/Main.java", "hunks": [ { "added": [ " /**", " * Name of file which contains messages for sysinfo.", " */", " private final static String MESSAGE_FILE =", " \"org.apache.derby.loc.sysinfoMessages\";", "", " /**", " * Resource for localizing the sysinfo messages.", " *", " * The default LocalizedResource reads messages from the toolsmessages", " * bundle. Create this instance to read messages from sysinfoMessages. Use", " * the locale and codeset specified by derby.ui.locale and derby.ui.codeset", " * if they are set.", " *", " * Note that this variable must be initialized when the class is loaded in", " * order to work correctly for the API methods that don't call", " * <code>main()</code>.", " */", " private final static LocalizedResource LOCALIZED_RESOURCE =", " new LocalizedResource(null, null, MESSAGE_FILE);", "" ], "header": "@@ -86,6 +86,27 @@ import org.apache.derby.iapi.tools.i18n.*;", "removed": [] }, { "added": [ "\t\treturn getCompleteMessage(msgId, new Object[0]);" ], "header": "@@ -1086,16 +1107,9 @@ public static void getMainInfo (java.io.PrintWriter aw, boolean pause) {", "removed": [ "\tprivate static ResourceBundle getBundle() {", "\t\ttry {", "\t\t\treturn ResourceBundle.getBundle(\"org.apache.derby.loc.sysinfoMessages\");", "\t\t} catch (MissingResourceException mre) {", "\t\t}", "\t\treturn null;", "\t}", "\t\treturn getCompleteMessage(msgId, (Object[]) null);" ] }, { "added": [ " return LOCALIZED_RESOURCE.getTextMessage(msgId, arguments);" ], "header": "@@ -1114,9 +1128,7 @@ public static void getMainInfo (java.io.PrintWriter aw, boolean pause) {", "removed": [ "", "\t\t// we have a base file (sysinfoMessages.properties) so don't give us a last chance.", "\t\treturn org.apache.derby.iapi.services.i18n.MessageService.formatMessage(getBundle(), msgId, arguments, false);" ] } ] } ]
derby-DERBY-3147-0fd9a50e
DERBY-3147 Add some comments to ParseId.java to clarify behaviour git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@589712 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/util/IdUtil.java", "hunks": [ { "added": [ "\tprivate static String parseId(StringReader r, boolean normalize, boolean normalizeToUpper)" ], "header": "@@ -197,7 +197,7 @@ public abstract class IdUtil", "removed": [ "\tpublic static String parseId(StringReader r, boolean normalize, boolean normalizeToUpper)" ] }, { "added": [ " /**", " * Parse a regular identifier (unquoted) returning returning either", " * the value of the identifier or a delimited identifier. Ensures", " * that all characters in the identifer are valid for a regular identifier.", " * ", " * @param r Regular identifier to parse.", " * @param normalize If true return the identifer converted to a single case, otherwise return the identifier as entered.", " * @param normalizeToUpper", " * @return the value of the identifer or a delimited identifier", " * @throws IOException Error accessing value", " * @throws StandardException Error parsing identifier.", " ", " */" ], "header": "@@ -217,6 +217,19 @@ public abstract class IdUtil", "removed": [] }, { "added": [ " ", " /**", " * Parse a delimited (quoted) identifier returning either", " * the value of the identifier or a delimited identifier.", " * @param r Quoted identifier to parse.", " * @param normalize If true return a delimited identifer, otherwise return the identifier's value.", " * @return the value of the identifer or a delimited identifier", " * @throws IOException Error accessing value", " * @throws StandardException Error parsing identifier.", " */" ], "header": "@@ -252,6 +265,16 @@ public abstract class IdUtil", "removed": [] }, { "added": [ "\t @param id an id in normal form (quotes removed, upshifted if regular)" ], "header": "@@ -608,7 +631,7 @@ public abstract class IdUtil", "removed": [ "\t @param id an id in normal form (quotes removed, upshifted)" ] } ] } ]
derby-DERBY-3147-6870e87f
DERBY-3147 (partial) Remove unused code that allowed lower-casing for SQL identifiers in the system catalogs. Derby's identifiers are always upper cased. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@588385 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/sql/dictionary/CatalogRowFactory.java", "hunks": [ { "added": [], "header": "@@ -62,7 +62,6 @@ public abstract\tclass CatalogRowFactory", "removed": [ " private boolean convertIdToLower;" ] }, { "added": [ "\t\t\t\t\t\t\t DataValueFactory dvf)" ], "header": "@@ -75,14 +74,12 @@ public abstract\tclass CatalogRowFactory", "removed": [ "\t\t\t\t\t\t\t DataValueFactory dvf,", "\t\t\t\t\t\t\t boolean convertIdToLower)", " this.convertIdToLower = convertIdToLower;" ] }, { "added": [ "\tpublic String getCanonicalHeapName() { return catalogName + \"_HEAP\"; }" ], "header": "@@ -152,7 +149,7 @@ public abstract\tclass CatalogRowFactory", "removed": [ "\tpublic String getCanonicalHeapName() { return catalogName + convertIdCase( \"_HEAP\"); }" ] }, { "added": [ "\t\treturn\tcatalogName + \"_INDEX\" + indexNumber;" ], "header": "@@ -195,7 +192,7 @@ public abstract\tclass CatalogRowFactory", "removed": [ "\t\treturn\tcatalogName + convertIdCase( \"_INDEX\") + indexNumber;" ] }, { "added": [ "\t\tthis.catalogName = catalogName;" ], "header": "@@ -226,7 +223,7 @@ public abstract\tclass CatalogRowFactory", "removed": [ "\t\tthis.catalogName = convertIdCase(catalogName);" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java", "hunks": [ { "added": [], "header": "@@ -265,9 +265,6 @@ public final class\tDataDictionaryImpl", "removed": [ "", " protected boolean convertIdToLower;", " // Convert identifiers to lower case (as in Foundation) or not." ] }, { "added": [], "header": "@@ -471,16 +468,6 @@ public final class\tDataDictionaryImpl", "removed": [ "\t\t/* There is a bootstrapping problem here. We would like to use", " * a language connection context to find the name of the system and default", " * schemas. However a language connection context is not available when a", " * database is being created, as it is when this method is called. So,", " * this method must look at the params properties to discover the identifier", " * casing and convert the standard names as necessary, essentially duplicating", " * logic found in GenericLanguageConnectionContext.", " */", " convertIdToLower = false;", "" ] }, { "added": [], "header": "@@ -6364,8 +6351,6 @@ public final class\tDataDictionaryImpl", "removed": [ " convertIdToLower ? ", "\t\t\t StringUtil.SQLToLowerCase(SchemaDescriptor.STD_SYSTEM_SCHEMA_NAME) : " ] }, { "added": [ " schema_name, " ], "header": "@@ -6580,7 +6565,7 @@ public final class\tDataDictionaryImpl", "removed": [ " convertIdToLower ? schema_name.toLowerCase() : schema_name, " ] }, { "added": [ "\t\t\tnew TabInfoImpl(new SYSTABLESRowFactory(luuidFactory, exFactory, dvf));", "\t\t\tnew TabInfoImpl(new SYSCOLUMNSRowFactory(luuidFactory, exFactory, dvf));", "\t\t\tnew TabInfoImpl(new SYSCONGLOMERATESRowFactory(luuidFactory, exFactory, dvf));", "\t\t\tnew TabInfoImpl(new SYSSCHEMASRowFactory(luuidFactory, exFactory, dvf));" ], "header": "@@ -7480,13 +7465,13 @@ public final class\tDataDictionaryImpl", "removed": [ "\t\t\tnew TabInfoImpl(new SYSTABLESRowFactory(luuidFactory, exFactory, dvf, convertIdToLower));", "\t\t\tnew TabInfoImpl(new SYSCOLUMNSRowFactory(luuidFactory, exFactory, dvf, convertIdToLower));", "\t\t\tnew TabInfoImpl(new SYSCONGLOMERATESRowFactory(luuidFactory, exFactory, dvf, convertIdToLower));", "\t\t\tnew TabInfoImpl(new SYSSCHEMASRowFactory(luuidFactory, exFactory, dvf, convertIdToLower));" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/catalog/SYSVIEWSRowFactory.java", "hunks": [ { "added": [ " SYSVIEWSRowFactory(UUIDFactory uuidf, ExecutionFactory ef, DataValueFactory dvf)", "\t\tsuper(uuidf,ef,dvf);" ], "header": "@@ -82,10 +82,9 @@ public class SYSVIEWSRowFactory extends CatalogRowFactory", "removed": [ " public\tSYSVIEWSRowFactory(UUIDFactory uuidf, ExecutionFactory ef, DataValueFactory dvf,", " boolean convertIdToLower)", "\t\tsuper(uuidf,ef,dvf,convertIdToLower);" ] } ] } ]
derby-DERBY-3147-7206fbcb
DERBY-3147 Add some tests for duplicates in the read only and full access lists as database properties. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@589796 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-3147-90676624
DERBY-3147 Remove some unused lower identifier casing code, clarify some methods in IDUtil by renaming them. Add some tests for duplicates in the read only and full access lists as database properties. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@589749 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/catalog/SystemProcedures.java", "hunks": [ { "added": [ "\t\t\tString[] st = IdUtil.parseMultiPartSQLIdentifier(jar.trim());" ], "header": "@@ -985,7 +985,7 @@ public class SystemProcedures {", "removed": [ "\t\t\tString[] st = IdUtil.parseQualifiedName(jar.trim(), true);" ] }, { "added": [ "\t\t\tString[] st = IdUtil.parseMultiPartSQLIdentifier(jar.trim());" ], "header": "@@ -1027,7 +1027,7 @@ public class SystemProcedures {", "removed": [ "\t\t\tString[] st = IdUtil.parseQualifiedName(jar.trim(), true);" ] } ] }, { "file": "java/engine/org/apache/derby/iapi/util/IdUtil.java", "hunks": [ { "added": [ "\tprivate static String delimitId(String id)" ], "header": "@@ -61,7 +61,7 @@ public abstract class IdUtil", "removed": [ "\tpublic static String delimitId(String id)" ] }, { "added": [ "\t Parse a multi-part (dot separated) SQL identifier form the", " String provided. Raise an excepion", "\t if the string does not contain valid SQL indentifiers.", " The returned String array contains the normalized form of the", " identifiers.", "\tpublic static String[] parseMultiPartSQLIdentifier(String s)", "\t\tString[] qName = parseMultiPartSQLIdentifier(r);", " /**", " Parse a multi-part (dot separated) SQL identifier form the", " StringReader provided. Raise an excepion", " if the string does not contain valid SQL indentifiers.", " The returned String array contains the normalized form of the", " identifiers.", " ", " @param s The string to be parsed", " @return An array of strings made by breaking the input string at its dots, '.'.", " @exception StandardException Oops", " */", "\tprivate static String[] parseMultiPartSQLIdentifier(StringReader r)", "\t\t\tString thisId = parseId(r,true);" ], "header": "@@ -109,40 +109,43 @@ public abstract class IdUtil", "removed": [ "\t Scan a qualified name from the String provided. Raise an excepion", "\t if the string does not contain a qualified name.", " @param normalizeToUpper If true then undelimited names are converted to upper case (the ANSI standard). If false then undelimited names are converted to lower case (used when the source database is Informix Foundation).", "\tpublic static String[] parseQualifiedName(String s, boolean normalizeToUpper)", "\t\tString[] qName = parseQualifiedName(r, normalizeToUpper);", "\t/**", "\t Scan a qualified name from a StringReader. Return an array", "\t of Strings with 1 entry per name scanned. Raise an exception", "\t if the StringReader does not contain a valid qualified name.", "", " @param r A StringReader for the string to be parsed", " @param normalizeToUpper If true then undelimited names are converted to upper case (the ANSI standard). If false then undelimited names are converted to lower case (used when the source database is Informix Foundation).", " @return An array of strings made by breaking the input string at its dots, '.'.", "\t @exception StandardException Oops", "\t */", "\tpublic static String[] parseQualifiedName(StringReader r, boolean normalizeToUpper)", "\t\t\tString thisId = parseId(r,true, normalizeToUpper);" ] }, { "added": [ "\t\tString id = parseId(r,true);" ], "header": "@@ -179,7 +182,7 @@ public abstract class IdUtil", "removed": [ "\t\tString id = parseId(r,true, true);" ] }, { "added": [ "\tprivate static String parseId(StringReader r, boolean normalize)" ], "header": "@@ -197,7 +200,7 @@ public abstract class IdUtil", "removed": [ "\tprivate static String parseId(StringReader r, boolean normalize, boolean normalizeToUpper)" ] }, { "added": [ "\t\t\t\treturn parseUnQId(r,normalize, true);" ], "header": "@@ -209,7 +212,7 @@ public abstract class IdUtil", "removed": [ "\t\t\t\treturn parseUnQId(r,normalize, normalizeToUpper);" ] }, { "added": [ "\tpublic static String[][] parseDbClassPath(String input)" ], "header": "@@ -346,7 +349,7 @@ public abstract class IdUtil", "removed": [ "\tpublic static String[][] parseDbClassPath(String input, boolean normalizeToUpper)" ] }, { "added": [ "\t\t\t\tString[] thisQName = IdUtil.parseMultiPartSQLIdentifier(r);" ], "header": "@@ -359,7 +362,7 @@ public abstract class IdUtil", "removed": [ "\t\t\t\tString[] thisQName = IdUtil.parseQualifiedName(r, normalizeToUpper);" ] }, { "added": [ "\t\t\t\tString thisId = IdUtil.parseId(r,normalize);" ], "header": "@@ -430,7 +433,7 @@ public abstract class IdUtil", "removed": [ "\t\t\t\tString thisId = IdUtil.parseId(r,normalize, true);" ] } ] }, { "file": "java/engine/org/apache/derby/impl/db/BasicDatabase.java", "hunks": [ { "added": [], "header": "@@ -128,13 +128,10 @@ public class BasicDatabase implements ModuleControl, ModuleSupportable, Property", "removed": [ "\tprivate int\t\t\tspaceInt;", "\tprivate boolean\t\tspaceIntSet;", " private boolean normalizeToUpper = true;" ] }, { "added": [ "\t\tsetLocale(databaseLocale); " ], "header": "@@ -176,10 +173,7 @@ public class BasicDatabase implements ModuleControl, ModuleSupportable, Property", "removed": [ "\t\tsetLocale(databaseLocale);", "", " normalizeToUpper = true;", " " ] }, { "added": [ "\t\t\tdbcp = IdUtil.parseDbClassPath(newClasspath);" ], "header": "@@ -644,7 +638,7 @@ public class BasicDatabase implements ModuleControl, ModuleSupportable, Property", "removed": [ "\t\t\tdbcp = IdUtil.parseDbClassPath(newClasspath, normalizeToUpper);" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/JarUtil.java", "hunks": [ { "added": [ "\t\t\tString[][]dbcp= IdUtil.parseDbClassPath(dbcp_s);" ], "header": "@@ -181,7 +181,7 @@ public class JarUtil", "removed": [ "\t\t\tString[][]dbcp= IdUtil.parseDbClassPath(dbcp_s, true);" ] } ] } ]
derby-DERBY-3147-9ac3a768
DERBY-3147 (partial) Clean of handling user identifiers and renaming some IdUtil methods with comments to make behaviour clearer. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@589804 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/util/IdUtil.java", "hunks": [ { "added": [ "c" ], "header": "@@ -129,11 +129,7 @@ public abstract class IdUtil", "removed": [ " Parse a multi-part (dot separated) SQL identifier form the", " StringReader provided. Raise an excepion", " if the string does not contain valid SQL indentifiers.", " The returned String array contains the normalized form of the", " identifiers." ] }, { "added": [ " Parse a SQL identifier from the String provided. Raise an excepion", " if the string does not contain a valid SQL indentifier.", " The returned String contains the normalized form of the", " identifier.", " ", "\tpublic static String parseSQLIdentifier(String s)" ], "header": "@@ -169,16 +165,14 @@ public abstract class IdUtil", "removed": [ "\t Convert the String provided to an ID. Throw an exception", "\t iff the string does not contain only a valid external form", "\t for an id. This is a convenience routine that simply", "\t uses getId(StringReader) to do the work.", "\t ", "\t <P> See the header for getId below for restrictions.", "\t ", "\tpublic static String parseId(String s)" ] }, { "added": [ "\t Scan a list of comma separated SQL identifiers from the string provided.", " This returns an array with containing the normalized forms of the identifiers.", " ", " This raises an an exception if" ], "header": "@@ -400,8 +394,10 @@ public abstract class IdUtil", "removed": [ "\t Scan a list of ids from the string provided. This returns", "\t an array with id per entry. This raises an an exception if" ] }, { "added": [ "\t Parse a list of comma separated SQL identifiers returning", " them a as elements in an array." ], "header": "@@ -418,7 +414,8 @@ public abstract class IdUtil", "removed": [ "\t Parse an idList. " ] }, { "added": [ "\t * Map userName to authorizationId in its normal form." ], "header": "@@ -497,7 +494,7 @@ public abstract class IdUtil", "removed": [ "\t * Map userName to authorizationId" ] }, { "added": [ "\t\t\t return parseSQLIdentifier(userName);" ], "header": "@@ -505,7 +502,7 @@ public abstract class IdUtil", "removed": [ "\t\t\t return parseId(userName);" ] }, { "added": [ "\t Return true if the normalized value of an indentifier is on the list ", " of SQL identifiers provided." ], "header": "@@ -619,7 +616,8 @@ public abstract class IdUtil", "removed": [ "\t Return true if the id provided is on the list provided." ] }, { "added": [ "\t Delete an normal value from a list of SQL identifiers.", " The returned list maintains its remaining identifiers in the", " format they were upon entry to the call.", " ", " ", "\t\tthis returns list unchanged. If list becomes empty after the removal", " null is returned." ], "header": "@@ -635,13 +633,18 @@ public abstract class IdUtil", "removed": [ "\t Delete an id from a list of ids.", "\t\tthis returns list unchanged." ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java", "hunks": [ { "added": [ "\tpublic void initialize() throws StandardException", "\t\tauthorizer = new GenericAuthorizer(IdUtil.getUserAuthorizationId(userName),this);" ], "header": "@@ -307,16 +307,11 @@ public class GenericLanguageConnectionContext", "removed": [ "\tpublic void initialize(boolean sqlConnection) throws StandardException", "\t\tauthorizer = new GenericAuthorizer(IdUtil.getUserAuthorizationId(userName),this, sqlConnection);", "", "\t\t//we can ignore the following if this is a database connection", "\t\t//associated with internal thread such as logSniffer and StageTrunc", "\t\tif(!sqlConnection)", "\t\t\treturn;" ] } ] } ]
derby-DERBY-3147-9fbf2cbb
DERBY-3147 (partial) Add two user names to AuthenticationTest that must be represented as delimited identifiers in SQL due to an @ sign or the user being 123. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@589829 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-3147-aa438ff0
DERBY-3147 Remove last traces of lower-cased identifiers from IdUtil and StringUtil. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@590730 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/util/IdUtil.java", "hunks": [ { "added": [ "\t\t\t\treturn parseUnQId(r,normalize);" ], "header": "@@ -205,7 +205,7 @@ c", "removed": [ "\t\t\t\treturn parseUnQId(r,normalize, true);" ] }, { "added": [ "\tprivate static String parseUnQId(StringReader r, boolean normalize)" ], "header": "@@ -220,13 +220,12 @@ c", "removed": [ " * @param normalizeToUpper", "\tprivate static String parseUnQId(StringReader r, boolean normalize, boolean normalizeToUpper)" ] }, { "added": [ " ", " String id = b.toString();", "\t\t\treturn StringUtil.SQLToUpperCase(id);", "\t\t\treturn id;" ], "header": "@@ -242,11 +241,13 @@ c", "removed": [ "\t\t\treturn normalizeToUpper ? StringUtil.SQLToUpperCase(b.toString()) : StringUtil.SQLToLowerCase(b.toString());", "\t\t\treturn b.toString();" ] }, { "added": [ " /**", " * Verify the read is empty (no more characters in its stream).", " * @param r", " * @throws StandardException", " */" ], "header": "@@ -305,6 +306,11 @@ c", "removed": [] }, { "added": [ "\t\tverifyEmpty(r);" ], "header": "@@ -407,7 +413,7 @@ c", "removed": [ "\t\tverifyListEmpty(r);" ] } ] }, { "file": "java/engine/org/apache/derby/iapi/util/StringUtil.java", "hunks": [ { "added": [], "header": "@@ -343,19 +343,6 @@ public class StringUtil", "removed": [ "", "\t/** Convert string to lowercase", "\t * Return java.util.Locale.ENGLISH lowercasing", "\t * @param s string to lowercase", "\t * @return lowercased string", "\t */", "\tpublic static String SQLToLowerCase(String s)", "\t{", "\t\treturn s.toLowerCase(Locale.ENGLISH);", "", "\t}", "", "" ] } ] } ]
derby-DERBY-3147-c33061f5
DERBY-3147 Add more tests for various user names and the connection authorization git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@589902 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-3148-64e8bd34
DERBY-3148: Fix JUnit test code that searches for Xalan version to avoid "Malformed \uxxxx encoding" errors when the user's classpath has "\u.." in it. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@588698 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/junit/XML.java", "hunks": [ { "added": [], "header": "@@ -34,7 +34,6 @@ import java.sql.PreparedStatement;", "removed": [ "import java.util.Properties;" ] }, { "added": [ " /* We wrote the byte array using the platform's default", " * encodinging (that's what we get with the call to", " * \"new PrintWriter(bos)\" above), so read it in using", " * the default encoding, as well (i.e. don't pass an", " * encoding into toString()).", " */", " String checkEnvOutput = bos.toString();", " /* The property we're looking for is on a single line", " * of the output, and that line starts with the name", " * of the property. So extract that line out now. If", " * we can't find it, just return \"false\" to say that", " * we could not find the minimum version. Note: it's", " * possible (though admittedly unlikely) that the", " * string \"version.xalan2_2\" appears in the user's", " * classpath. Adding an equals sign (\"=\") at the end", " * of our search pattern reduces the chance of the", " * search string appearing in the classpath, but does", " * not eliminate it...", " */", " int pos = checkEnvOutput.indexOf(\"version.xalan2_2=\");", " if (pos < 0)", " return false;", "", " String ver = checkEnvOutput.substring(", " pos, checkEnvOutput.indexOf(\"\\n\", pos));", "" ], "header": "@@ -324,13 +323,35 @@ public class XML {", "removed": [ " // Load the properties gathered from checkEnvironment().", " Properties props = new Properties();", " props.load(new ByteArrayInputStream(bos.toByteArray()));", " String ver = props.getProperty(\"version.xalan2_2\");" ] } ] } ]
derby-DERBY-3150-2bbaf40f
DERBY-3150 Add some testing of user identifier casing for JDBC connection requests including two commented out cases that fail. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@588304 13f79535-47bb-0310-9956-ffa450edef68
[]