id
stringlengths
22
25
commit_message
stringlengths
137
6.96k
diffs
listlengths
0
63
derby-DERBY-756-59b3eae1
DERBY-756: Close scan controller in DistinctScalarAggregateResultSet to avoid memory leak. Submitted by Manish Khettry (manish_khettry@yahoo.com) Here is more info from the contributor: It looks like the scan controller created in DistinctScalarAggregateResultSet is never closed. This causes the scanController instance variable in RAMTransaction to continue to grow with each open/close. Shouldn't DistinctScalarAggregateRS implement a close or a finish method (not sure what the difference is) and close the scan controller there. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@370978 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/execute/DistinctScalarAggregateResultSet.java", "hunks": [ { "added": [], "header": "@@ -20,17 +20,8 @@", "removed": [ "import org.apache.derby.iapi.services.monitor.Monitor;", "", "import org.apache.derby.iapi.services.stream.HeaderPrintWriter;", "import org.apache.derby.iapi.services.stream.InfoStreams;", "", "import org.apache.derby.iapi.services.io.Formatable;", "", "import org.apache.derby.iapi.sql.execute.CursorResultSet;", "import org.apache.derby.iapi.sql.ResultSet;" ] }, { "added": [ "" ], "header": "@@ -45,19 +36,13 @@ import org.apache.derby.iapi.store.access.ScanController;", "removed": [ "import org.apache.derby.iapi.sql.execute.ExecutionFactory;", "import org.apache.derby.iapi.sql.execute.ExecutionContext;", "import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;", "", "import org.apache.derby.iapi.types.RowLocation;", "import java.util.Vector;", "import java.util.Enumeration;" ] }, { "added": [ " /**", " * @inheritDoc", " */", " public void close() throws StandardException", " {", " super.close();", " closeSource();", " }" ], "header": "@@ -272,6 +257,14 @@ public class DistinctScalarAggregateResultSet extends ScalarAggregateResultSet", "removed": [] } ] } ]
derby-DERBY-757-62721e65
DERBY-757 Now that this routine can be called while concurrently with XA transactions being created and committed, checks have to be made to make sure the object being searched for does not go null while we are looking at it. The search is for existing xacts, so skipping when we find a null is fine. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@370967 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/store/raw/xact/TransactionTable.java", "hunks": [ { "added": [ " * This routine use to be only called during offline recovery so performance", " * was not critical. Since that time more calls have been made, including", " * one in startGlobalTransaction() so a linear search may no longer", " * be appropriate. See DERBY-828." ], "header": "@@ -337,10 +337,10 @@ public class TransactionTable implements Formatable", "removed": [ " * Only called by XactXAResourceManager.find() during offline recovery", " * of in-doubt transactions, we do not expect this to be called often ", " * so performance is not critical. Just to linear search of id's. ", " * <p>" ] }, { "added": [ " if (entry != null)", " GlobalTransactionId entry_gid = entry.getGid();", "", " if (entry_gid != null && entry_gid.equals(global_id))", " {", " cm = entry.getXact().getContextManager();", " break;", " }" ], "header": "@@ -359,11 +359,15 @@ public class TransactionTable implements Formatable", "removed": [ " if (entry.getGid() != null && ", "\t\t\t\t\tentry.getGid().equals(global_id))", " cm = entry.getXact().getContextManager();", " break;" ] } ] } ]
derby-DERBY-774-dd5a8720
DERBY-774 DRDAConnThread::doneData should use statically allocated SQLException objects. Submitted by Dyre.Tjeldvoll@Sun.COM git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@358560 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/drda/org/apache/derby/impl/drda/DRDAConnThread.java", "hunks": [ { "added": [ " ", " // The use of static exception objects is normally a bad idea,", " // but qryscraft_ and notQryscraft_ are not true exceptions and", " // will not be thrown. They are being used as containers for", " // passing data to the writeSQLCAGRP() method, and since this", " // happens frequently we would like to avoid creating a new", " // SQLException each time, (which is expensive because the", " // Throwable ctor will fill in the stack trace).", " private static final SQLException qryscraft_ = ", " new SQLException(\"End of Data\", \"00000\");", " private static final SQLException notQryscraft_ =", " new SQLException(\"End of Data\", \"02000\");", "" ], "header": "@@ -6279,6 +6279,19 @@ public class DRDAConnThread extends Thread {", "removed": [] }, { "added": [ " writeSQLCAGRP((isQRYSCRAFT ? qryscraft_ : notQryscraft_),", " (isQRYSCRAFT ? 0 : 100), 0, stmt.rowCount);" ], "header": "@@ -6333,9 +6346,8 @@ public class DRDAConnThread extends Thread {", "removed": [ "\t\t// RESOLVE: Need statics for sqlcodes.", "\t\twriteSQLCAGRP(new SQLException(\"End of Data\", (isQRYSCRAFT ? \"00000\" : \"02000\")),", "\t\t\t\t\t\t\t(isQRYSCRAFT ? 0 : 100), 0, stmt.rowCount);" ] } ] } ]
derby-DERBY-777-18c4da72
DERBY-777 Remove use of java.io.InputStreamReader.getEncoding to get the platform's default encoding. Creating this reader on System.in was causing a hang on Z/OS. Now simply use the stream/reader constructors that do not take a encoding argument and thus use the default. With this Derby does not need to know the actual value of default encoding. Merge of 358137 from 10.1 git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@359833 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/load/ControlInfo.java", "hunks": [ { "added": [], "header": "@@ -118,10 +118,6 @@ class ControlInfo", "removed": [ " // set the default code set to the platform default encoding value", " String default_data_codeset =", " (new InputStreamReader(System.in)).getEncoding();", " currentProperties.put(DATA_CODESET, default_data_codeset);" ] } ] }, { "file": "java/engine/org/apache/derby/impl/load/ImportReadData.java", "hunks": [ { "added": [ "\t InputStream inputStream;" ], "header": "@@ -215,6 +215,7 @@ final class ImportReadData implements java.security.PrivilegedExceptionAction {", "removed": [] }, { "added": [ " inputStream = url.openStream();", " inputStream = new FileInputStream(inputFileName);", " " ], "header": "@@ -222,11 +223,10 @@ final class ImportReadData implements java.security.PrivilegedExceptionAction {", "removed": [ " InputStream inputStream = url.openStream();", " bufferedReader = new BufferedReader(new InputStreamReader(inputStream, dataCodeset));", " InputStreamReader inputFileStreamReader = new InputStreamReader(new FileInputStream(inputFileName), dataCodeset);", " bufferedReader = new BufferedReader(inputFileStreamReader, 32*1024);" ] } ] }, { "file": "java/tools/org/apache/derby/iapi/tools/i18n/LocalizedResource.java", "hunks": [ { "added": [ "\t\t", "\t\t// If null at this point then the default encoding", "\t\t// will be always used.", "" ], "header": "@@ -104,10 +104,10 @@ public final class LocalizedResource implements java.security.PrivilegedAction", "removed": [ "\t\t//last chance: get default encoding", "\t\tif (encode == null ){", "\t\t \tencode = new java.io.InputStreamReader(System.in).getEncoding();", "\t\t}" ] }, { "added": [ "\t\tout = getNewOutput(System.out);", "\t\tin = getNewInput(System.in);" ], "header": "@@ -127,18 +127,8 @@ public final class LocalizedResource implements java.security.PrivilegedAction", "removed": [ "\t\ttry {", "\t\t\tout = new LocalizedOutput(System.out,encode);", "\t\t}", "\t\tcatch(UnsupportedEncodingException e){", "\t\t\tout = new LocalizedOutput(System.out);", "\t\t}", "\t\ttry {", "\t\t\tin = new LocalizedInput(System.in, encode);", "\t\t}", "\t\tcatch(UnsupportedEncodingException e){", "\t\t\tin = new LocalizedInput(System.in);", "\t\t}" ] }, { "added": [ "\t\t\tif (encode != null)", "\t\t\t return new LocalizedInput(i,encode);", "\t\t\t", "\t\treturn new LocalizedInput(i);", "\t\t\tif (encode != null)", "\t\t\t return new LocalizedOutput(o,encode);", "\t\treturn new LocalizedOutput(o);" ], "header": "@@ -224,20 +214,23 @@ public final class LocalizedResource implements java.security.PrivilegedAction", "removed": [ "\t\t\treturn new LocalizedInput(i,encode);", "\t\t\treturn new LocalizedInput(i);", "\t\t\treturn new LocalizedOutput(o,encode);", "\t\t\treturn new LocalizedOutput(o);" ] }, { "added": [], "header": "@@ -430,9 +423,6 @@ public final class LocalizedResource implements java.security.PrivilegedAction", "removed": [ "\tpublic String getEncode(){", "\t\treturn encode;", "\t}" ] } ] } ]
derby-DERBY-781-0be2d6ec
DERBY-781: Materialize select subqueries where possible to avoid recreating their resultsets multiple times. Here is more info from the contributor. Attaching a patch (d781_v1.patch) to address this issue by allowing the optimizer to consider and choose hash joins with subqueries, which is a more general case of the specific union example mentioned in the description for this issue. In brief, the patch does this by following up on the suggestions given by Jeff Lichtman in comments above and also in the following thread: http://article.gmane.org/gmane.comp.apache.db.derby.devel/12208 Since result set materialization comes for "free" with hash joins, that fact we now allow hash joins with subqueries (as of this patch) means that we implicitly have a way to materialize the subquery result sets. The details of the patch are included as DERBY-781_v1.html. I added a simple test to lang/subquery.sql to demonstrate that the optimizer can and will choose to do hash joins for subqueries, and I updated one other master file--predicatesIntoViews--for which the optimizer is now choosing a hash join instead of a nested loop. Testing of "unsafe" hash joins (see section VII of the document) and generation of correct plans is done through existing tests, esp. the lang/lojreorder.sql test, which was very useful in helping to verify the correctness of the changes. Note that I did not add the sample union query shown in the description for this issue to the tests because when I run it against the current codeline, the optimizer will already choose to do materialization of the UnionNode (via hash join) even without the patch for this issue, and thus it didn't seem like that particular test case was useful. The new test in subqery.sql is more relevant because the optimizer will choose to do a nested loop join with the subquery before my changes and will do a hash join after my changes, which seems to more accurately reflect what this issue is about. I ran derbyall using sane jars on Red Hat Linux with ibm142 and saw no new failures, and the overall execution time does not change despite the extra work the optimizer is doing. Submitted by Army Brown (qozinx@gmail.com) git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@423989 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/compile/BinaryRelationalOperatorNode.java", "hunks": [ { "added": [ "\t// Visitor for finding base tables beneath optimizables and column", "\t// references. Created once and re-used thereafter.", "\tprivate BaseTableNumbersVisitor btnVis;", "", "\t// Bit sets for holding base tables beneath optimizables and", "\t// column references. Created once and re-used thereafter.", "\tJBitSet optBaseTables;", "\tJBitSet valNodeBaseTables;", "" ], "header": "@@ -65,6 +65,15 @@ public class BinaryRelationalOperatorNode", "removed": [] }, { "added": [ "\t\tbtnVis = null;" ], "header": "@@ -115,6 +124,7 @@ public class BinaryRelationalOperatorNode", "removed": [] }, { "added": [ "\t\t// When searching for a matching column operand, we search", "\t\t// the entire subtree (if there is one) beneath optTable", "\t\t// to see if we can find any FromTables that correspond to", "\t\t// either of this op's column references.", "\t\tboolean walkSubtree = true;" ], "header": "@@ -124,16 +134,13 @@ public class BinaryRelationalOperatorNode", "removed": [ "\t\treturn getColumnOperand(ft.getTableNumber(), columnPosition);", "\t}", "\t/** @see RelationalOperator#getColumnOperand */", "\tpublic ColumnReference getColumnOperand(", "\t\t\t\t\t\t\t\tint tableNumber,", "\t\t\t\t\t\t\t\tint columnPosition)", "\t{", "" ] }, { "added": [ "\t\t\tif (valNodeReferencesOptTable(cr, ft, false, walkSubtree))" ], "header": "@@ -141,7 +148,7 @@ public class BinaryRelationalOperatorNode", "removed": [ "\t\t\tif (cr.getTableNumber() == tableNumber)" ] }, { "added": [ "\t\t\twalkSubtree = false;" ], "header": "@@ -152,6 +159,7 @@ public class BinaryRelationalOperatorNode", "removed": [] }, { "added": [ "\t\t\tif (valNodeReferencesOptTable(cr, ft, false, walkSubtree))" ], "header": "@@ -161,7 +169,7 @@ public class BinaryRelationalOperatorNode", "removed": [ "\t\t\tif (cr.getTableNumber() == tableNumber)" ] }, { "added": [ "\t\tboolean walkSubtree = true;" ], "header": "@@ -183,6 +191,7 @@ public class BinaryRelationalOperatorNode", "removed": [] }, { "added": [ "\t\t\tif (valNodeReferencesOptTable(", "\t\t\t\tcr, (FromTable)optTable, false, walkSubtree))", "\t\t\twalkSubtree = false;" ], "header": "@@ -190,13 +199,15 @@ public class BinaryRelationalOperatorNode", "removed": [ "\t\t\tif (cr.getTableNumber() == optTable.getTableNumber())" ] }, { "added": [ "\t\t\tif (valNodeReferencesOptTable(cr,", "\t\t\t\t(FromTable)optTable, false, walkSubtree))" ], "header": "@@ -206,7 +217,8 @@ public class BinaryRelationalOperatorNode", "removed": [ "\t\t\tif (cr.getTableNumber() == optTable.getTableNumber())" ] }, { "added": [ "\t\t\t\t\t\t\t\tint columnPosition,", "\t\t\t\t\t\t\t\tFromTable ft)", "\t\tboolean walkSubtree = true;" ], "header": "@@ -224,9 +236,11 @@ public class BinaryRelationalOperatorNode", "removed": [ "\t\t\t\t\t\t\t\tint columnPosition)" ] }, { "added": [ "\t\t\tif (valNodeReferencesOptTable(cr, ft, false, walkSubtree))" ], "header": "@@ -235,7 +249,7 @@ public class BinaryRelationalOperatorNode", "removed": [ "\t\t\tif (cr.getTableNumber() == tableNumber)" ] }, { "added": [ "\t\t\twalkSubtree = false;" ], "header": "@@ -249,6 +263,7 @@ public class BinaryRelationalOperatorNode", "removed": [] }, { "added": [ "\t\t\tif (valNodeReferencesOptTable(cr, ft, false, walkSubtree))" ], "header": "@@ -258,7 +273,7 @@ public class BinaryRelationalOperatorNode", "removed": [ "\t\t\tif (cr.getTableNumber() == tableNumber)" ] }, { "added": [ "\t/**", "\t * @see RelationalOperator#getOperand", "\t */", "\tpublic ValueNode getOperand(ColumnReference cRef,", "\t\tint refSetSize, boolean otherSide)", "\t{", "\t\t// Following call will initialize/reset the btnVis,", "\t\t// valNodeBaseTables, and optBaseTables fields of this object.", "\t\tinitBaseTableVisitor(refSetSize, true);", "", "\t\t// We search for the column reference by getting the *base*", "\t\t// table number for each operand and checking to see if", "\t\t// that matches the *base* table number for the cRef", "\t\t// that we're looking for. If so, then we the two", "\t\t// reference the same table so we go on to check", "\t\t// column position.", "\t\ttry {", "", "\t\t\t// Use optBaseTables for cRef's base table numbers.", "\t\t\tbtnVis.setTableMap(optBaseTables);", "\t\t\tcRef.accept(btnVis);", "", "\t\t\t// Use valNodeBaseTables for operand base table nums.", "\t\t\tbtnVis.setTableMap(valNodeBaseTables);", "", "\t\t\tColumnReference\tcr;", "\t\t\tif (leftOperand instanceof ColumnReference)", "\t\t\t{", "\t\t\t\t/*", "\t\t\t\t** The left operand is a column reference.", "\t\t\t\t** Is it the correct column?", "\t\t\t\t*/", "\t\t\t\tcr = (ColumnReference) leftOperand;", "\t\t\t\tcr.accept(btnVis);", "\t\t\t\tvalNodeBaseTables.and(optBaseTables);", "\t\t\t\tif (valNodeBaseTables.getFirstSetBit() != -1)", "\t\t\t\t{", "\t\t\t\t\t/*", "\t\t\t\t\t** The table is correct, how about the column position?", "\t\t\t\t\t*/", "\t\t\t\t\tif (cr.getSource().getColumnPosition() ==", "\t\t\t\t\t\tcRef.getColumnNumber())", "\t\t\t\t\t{", "\t\t\t\t\t\t/*", "\t\t\t\t\t\t** We've found the correct column -", "\t\t\t\t\t\t** return the appropriate side.", "\t\t\t\t\t\t*/", "\t\t\t\t\t\tif (otherSide)", "\t\t\t\t\t\t\treturn rightOperand;", "\t\t\t\t\t\treturn leftOperand;", "\t\t\t\t\t}", "\t\t\t\t}", "\t\t\t}", "", "\t\t\tif (rightOperand instanceof ColumnReference)", "\t\t\t{", "\t\t\t\t/*", "\t\t\t\t** The right operand is a column reference.", "\t\t\t\t** Is it the correct column?", "\t\t\t\t*/", "\t\t\t\tvalNodeBaseTables.clearAll();", "\t\t\t\tcr = (ColumnReference) rightOperand;", "\t\t\t\tcr.accept(btnVis);", "\t\t\t\tvalNodeBaseTables.and(optBaseTables);", "\t\t\t\tif (valNodeBaseTables.getFirstSetBit() != -1)", "\t\t\t\t{", "\t\t\t\t\t/*", "\t\t\t\t\t** The table is correct, how about the column position?", "\t\t\t\t\t*/", "\t\t\t\t\tif (cr.getSource().getColumnPosition() == ", "\t\t\t\t\t\tcRef.getColumnNumber())", "\t\t\t\t\t{", "\t\t\t\t\t\t/*", "\t\t\t\t\t\t** We've found the correct column -", "\t\t\t\t\t\t** return the appropriate side", "\t\t\t\t\t\t*/", "\t\t\t\t\t\tif (otherSide)", "\t\t\t\t\t\t\treturn leftOperand;", "\t\t\t\t\t\treturn rightOperand;", "\t\t\t\t\t}", "\t\t\t\t}", "\t\t\t}", "", "\t\t} catch (StandardException se) {", " if (SanityManager.DEBUG)", " {", " SanityManager.THROWASSERT(\"Failed when trying to \" +", " \"find base table number for column reference check:\\n\" +", " se.getMessage());", " }", "\t\t}", "", "\t\treturn null;", "\t}", "" ], "header": "@@ -277,6 +292,101 @@ public class BinaryRelationalOperatorNode", "removed": [] }, { "added": [ "\t\tValueNode exprOp = getExpressionOperand(", "\t\t\tft.getTableNumber(), columnPosition, ft);" ], "header": "@@ -298,8 +408,8 @@ public class BinaryRelationalOperatorNode", "removed": [ "\t\tValueNode exprOp =", "\t\t\t\t\tgetExpressionOperand(ft.getTableNumber(), columnPosition);" ] }, { "added": [], "header": "@@ -388,11 +498,8 @@ public class BinaryRelationalOperatorNode", "removed": [ "\t\tFromTable\tft;", "\t\tft = (FromTable) optTable;", "" ] }, { "added": [ "\t\t\tif (valNodeReferencesOptTable(", "\t\t\t\tcr, (FromTable)optTable, false, true))", "", "\t\t// Else the right operand must be the key column.", " \tif (SanityManager.DEBUG)", "\t\t\tif (!left)", "\t\t\t{", "\t\t \tSanityManager.ASSERT(", "\t\t\t\t\t(rightOperand instanceof ColumnReference) &&", "\t\t\t\t\tvalNodeReferencesOptTable((ColumnReference)rightOperand,", "\t\t\t \t\t(FromTable)optTable, false, true),", "\t\t\t\t\t\"Key column not found on either side.\");", "\t\t\t}" ], "header": "@@ -401,23 +508,25 @@ public class BinaryRelationalOperatorNode", "removed": [ "\t\t\tif (cr.getTableNumber() == ft.getTableNumber())", "\t\telse", " \t\tif (SanityManager.DEBUG)", "\t \t{", "\t\t \tSanityManager.ASSERT((rightOperand instanceof ColumnReference) &&", "\t\t\t \t\t(((ColumnReference) rightOperand).getTableNumber() ==", " \t\t\t\t\t\t\t\t\t\t\t\t\t\tft.getTableNumber()),", "\t \t\t\t\t\"Key column not found on either side.\");", "\t \t}", "\t\t\t/* The right operand is the key column */", "\t\t\tleft = false;" ] }, { "added": [ "\t\tboolean\t\t\twalkSubtree = true;" ], "header": "@@ -443,6 +552,7 @@ public class BinaryRelationalOperatorNode", "removed": [] }, { "added": [ "\t\t\tif (valNodeReferencesOptTable(", "\t\t\t\tcr, (FromTable)optTable, false, walkSubtree))", "\t\t\twalkSubtree = false;" ], "header": "@@ -452,11 +562,13 @@ public class BinaryRelationalOperatorNode", "removed": [ "\t\t\tif (cr.getTableNumber() == optTable.getTableNumber())" ] }, { "added": [ "\t\t\tif (valNodeReferencesOptTable(", "\t\t\t\tcr, (FromTable)optTable, false, walkSubtree))" ], "header": "@@ -466,7 +578,8 @@ public class BinaryRelationalOperatorNode", "removed": [ "\t\t\tif (cr.getTableNumber() == optTable.getTableNumber())" ] }, { "added": [ "\tpublic boolean isQualifier(Optimizable optTable, boolean forPush)" ], "header": "@@ -621,7 +734,7 @@ public class BinaryRelationalOperatorNode", "removed": [ "\tpublic boolean isQualifier(Optimizable optTable)" ] }, { "added": [ "\t\tboolean walkSubtree = true;" ], "header": "@@ -629,6 +742,7 @@ public class BinaryRelationalOperatorNode", "removed": [] }, { "added": [ "\t\t\tif (valNodeReferencesOptTable(cr, ft, forPush, walkSubtree))", "\t\t\twalkSubtree = false;" ], "header": "@@ -639,11 +753,12 @@ public class BinaryRelationalOperatorNode", "removed": [ "\t\t\tif (cr.getTableNumber() == ft.getTableNumber())" ] }, { "added": [ "\t\t\tif (valNodeReferencesOptTable(cr, ft, forPush, walkSubtree))" ], "header": "@@ -653,7 +768,7 @@ public class BinaryRelationalOperatorNode", "removed": [ "\t\t\tif (cr.getTableNumber() == ft.getTableNumber())" ] }, { "added": [ "\t\treturn !valNodeReferencesOptTable(otherSide, ft, forPush, true);" ], "header": "@@ -675,9 +790,7 @@ public class BinaryRelationalOperatorNode", "removed": [ "\t\ttablesReferenced = otherSide.getTablesReferenced();", "", "\t\treturn ! (tablesReferenced.get(ft.getTableNumber()));" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/HashJoinStrategy.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.util.JBitSet;", "" ], "header": "@@ -51,6 +51,8 @@ import org.apache.derby.iapi.services.sanity.SanityManager;", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/OptimizerImpl.java", "hunks": [ { "added": [ "\t/* Status variables used for \"jumping\" to previous best join", "\t * order when possible. In particular, this helps when this", "\t * optimizer corresponds to a subquery and we are trying to", "\t * find out what the best join order is if we do a hash join", "\t * with the subquery instead of a nested loop join. In that", "\t * case the previous best join order will have the best join", "\t * order for a nested loop, so we want to start there when", "\t * considering hash join because odds are that same join order", "\t * will give us the best cost for hash join, as well. We", "\t * only try this, though, if neither the previous round of", "\t * optimization nor this round relies on predicates that have", "\t * been pushed down from above--because that's the scenario", "\t * for which the best join order is likely to be same for", "\t * consecutive rounds.", "\t */", "\tprivate boolean usingPredsPushedFromAbove;", "\tprivate boolean bestJoinOrderUsedPredsFromAbove;", "" ], "header": "@@ -163,6 +163,24 @@ public class OptimizerImpl implements Optimizer", "removed": [] }, { "added": [ "", "\t\tusingPredsPushedFromAbove = false;", "\t\tbestJoinOrderUsedPredsFromAbove = false;" ], "header": "@@ -241,6 +259,9 @@ public class OptimizerImpl implements Optimizer", "removed": [] }, { "added": [ "\t\tusingPredsPushedFromAbove = false;" ], "header": "@@ -300,7 +321,7 @@ public class OptimizerImpl implements Optimizer", "removed": [ "\t\tboolean resetTimer = false;" ] }, { "added": [ "\t\t\t\t\tusingPredsPushedFromAbove = true;", "\t\tif (usingPredsPushedFromAbove)" ], "header": "@@ -310,13 +331,13 @@ public class OptimizerImpl implements Optimizer", "removed": [ "\t\t\t\t\tresetTimer = true;", "\t\tif (resetTimer)" ] }, { "added": [ "\t\tif (bestCost.isUninitialized() && foundABestPlan &&", "\t\t\t((!usingPredsPushedFromAbove && !bestJoinOrderUsedPredsFromAbove)", "\t\t\t\t|| timeExceeded))" ], "header": "@@ -377,7 +398,9 @@ public class OptimizerImpl implements Optimizer", "removed": [ "\t\tif (timeExceeded && bestCost.isUninitialized())" ] }, { "added": [ "\t\t\t *", "\t\t\t * We can also get here if we've already optimized the list", "\t\t\t * of optimizables once (in a previous round of optimization)", "\t\t\t * and now we're back to do it again. If that's true AND", "\t\t\t * we did *not* receive any predicates pushed from above AND", "\t\t\t * the bestJoinOrder from the previous round did *not* depend", "\t\t\t * on predicates pushed from above, then we'll jump to the", "\t\t\t * previous join order and start there. NOTE: if after jumping", "\t\t\t * to the previous join order and calculating the cost we haven't", "\t\t\t * timed out, we will continue looking at other join orders (as", "\t\t\t * usual) until we exhaust them all or we time out." ], "header": "@@ -404,6 +427,17 @@ public class OptimizerImpl implements Optimizer", "removed": [] }, { "added": [ "\t\t\t\tif (firstLookOrder == null)", "\t\t\t\t\tfirstLookOrder = new int[numOptimizables];" ], "header": "@@ -412,6 +446,8 @@ public class OptimizerImpl implements Optimizer", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/Predicate.java", "hunks": [ { "added": [ " if (!((RelationalOperator) or_node.getLeftOperand()).", " isQualifier(optTable, true))" ], "header": "@@ -509,7 +509,8 @@ public final class Predicate extends QueryTreeNode implements OptimizablePredica", "removed": [ " if (!((RelationalOperator) or_node.getLeftOperand()).isQualifier(optTable))" ] }, { "added": [ "\t * Relational operator nodes and 2) have a column reference", "\t * on BOTH sides, each of which has a reference to a base", "\t * table somewhere beneath it." ], "header": "@@ -852,10 +853,9 @@ public final class Predicate extends QueryTreeNode implements OptimizablePredica", "removed": [ "\t * Relational operator nodes, 2) have a column reference", "\t * on BOTH sides, and 3) have column references such that", "\t * each column reference has a reference to a base table", "\t * somewhere beneath it." ] }, { "added": [ "\t\tif (!isJoinPredicate())" ], "header": "@@ -863,23 +863,8 @@ public final class Predicate extends QueryTreeNode implements OptimizablePredica", "removed": [ "\t\t// If the predicate isn't a binary relational operator,", "\t\t// then we don't push it.", "\t\tif (!(getAndNode().getLeftOperand()", "\t\t\tinstanceof BinaryRelationalOperatorNode))", "\t\t{", "\t\t\treturn false;", "\t\t}", "", "\t\tBinaryRelationalOperatorNode opNode =", "\t\t\t(BinaryRelationalOperatorNode)getAndNode().getLeftOperand();", "", "\t\t// If either side is not a column reference, we don't push.", "\t\tif (!((opNode.getLeftOperand() instanceof ColumnReference) &&", "\t\t\t(opNode.getRightOperand() instanceof ColumnReference)))", "\t\t{", "\t\t}" ] }, { "added": [ "\t\tBinaryRelationalOperatorNode opNode =", "\t\t\t(BinaryRelationalOperatorNode)getAndNode().getLeftOperand();", "" ], "header": "@@ -891,6 +876,9 @@ public final class Predicate extends QueryTreeNode implements OptimizablePredica", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/PredicateList.java", "hunks": [ { "added": [ "\t\t\tif ( ! ((RelationalOperator) opNode).isQualifier(optTable, false))" ], "header": "@@ -405,7 +405,7 @@ public class PredicateList extends QueryTreeNodeVector implements OptimizablePre", "removed": [ "\t\t\tif ( ! ((RelationalOperator) opNode).isQualifier(optTable))" ] }, { "added": [ " if ( ! relop.isQualifier(optTable, pushPreds))" ], "header": "@@ -547,7 +547,7 @@ public class PredicateList extends QueryTreeNodeVector implements OptimizablePre", "removed": [ " if ( ! relop.isQualifier(optTable))" ] }, { "added": [ "\t\t\tif ( !isIn && ! relop.isQualifier(optTable, pushPreds))" ], "header": "@@ -617,7 +617,7 @@ public class PredicateList extends QueryTreeNodeVector implements OptimizablePre", "removed": [ "\t\t\tif ( !isIn && ! relop.isQualifier(optTable))" ] }, { "added": [ "\t\t\tif (relop == null || ! relop.isQualifier(optTable, false))" ], "header": "@@ -945,7 +945,7 @@ public class PredicateList extends QueryTreeNodeVector implements OptimizablePre", "removed": [ "\t\t\tif (relop == null || ! relop.isQualifier(optTable))" ] }, { "added": [ " baseColumns[columnNumber],", " (FromTable)optTable);" ], "header": "@@ -3339,7 +3339,8 @@ public class PredicateList extends QueryTreeNodeVector implements OptimizablePre", "removed": [ " baseColumns[columnNumber]);" ] }, { "added": [ "\t\t\tif (relop != null)", "\t\t\t\t\tValueNode exprOp = relop.getOperand(", "\t\t\t\t\t\t\t\t\tcolRef,", "\t\t\t\t\t\t\t\t\tpred.getReferencedSet().size(),", "\t\t\t\t\t\t\t\t\ttrue", "\t\t\t\t\t\t\t\t\t);" ], "header": "@@ -3392,18 +3393,17 @@ public class PredicateList extends QueryTreeNodeVector implements OptimizablePre", "removed": [ "", "\t\t\tif (relop != null &&", "\t\t\t\trelop.getOperator() == RelationalOperator.EQUALS_RELOP)", "\t\t\t\t\tValueNode exprOp = relop.getExpressionOperand(", "\t\t\t\t\t\t\t\t\t\t\tcolRef.getTableNumber(),", "\t\t\t\t\t\t\t\t\t\t\tcolRef.getColumnNumber()", "\t\t\t\t\t\t\t\t\t\t\t);" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/ProjectRestrictNode.java", "hunks": [ { "added": [ "\t\t\t/* Note: Prior to the fix for DERBY-781 we had calls here", "\t\t\t * to set the cost estimate for BestAccessPath and", "\t\t\t * BestSortAvoidancePath to equal costEstimate. That used", "\t\t\t * to be okay because prior to DERBY-781 we would only", "\t\t\t * get here once (per join order) for a given SelectNode/", "\t\t\t * RowResultSetNode and thus we could safely say that the", "\t\t\t * costEstimate from the most recent call to \"optimize()\"", "\t\t\t * was the best one so far (because we knew that we would", "\t\t\t * only call childResult.optimize() once). Now that we", "\t\t\t * support hash joins with subqueries, though, we can get", "\t\t\t * here twice per join order: once when the optimizer is", "\t\t\t * considering a nested loop join with this PRN, and once", "\t\t\t * when it is considering a hash join. This means we can't", "\t\t\t * just arbitrarily use the cost estimate for the most recent", "\t\t\t * \"optimize()\" as the best cost because that may not", "\t\t\t * be accurate--it's possible that the above call to", "\t\t\t * childResult.optimize() was for a hash join, but that", "\t\t\t * we were here once before (namely for nested loop) and", "\t\t\t * the cost of the nested loop is actually less than", "\t\t\t * the cost of the hash join. In that case it would", "\t\t\t * be wrong to use costEstimate as the cost of the \"best\"", "\t\t\t * paths because it (costEstimate) holds the cost of", "\t\t\t * the hash join, not of the nested loop join. So with", "\t\t\t * DERBY-781 the following calls were removed:", "\t\t\t * getBestAccessPath().setCostEstimate(costEstimate);", "\t\t\t * getBestSortAvoidancePath().setCostEstimate(costEstimate);", "\t\t\t * If costEstimate *does* actually hold the estimate for", "\t\t\t * the best path so far, then we will set BestAccessPath", "\t\t\t * and BestSortAvoidancePath as needed in the following", "\t\t\t * call to \"considerCost\".", "\t\t\t */" ], "header": "@@ -360,14 +360,37 @@ public class ProjectRestrictNode extends SingleChildResultSetNode", "removed": [ "\t\t\tgetBestAccessPath().setCostEstimate(costEstimate);", "", "\t\t\t/*", "\t\t\t** The current access path may not be part of a sort avoidance", "\t\t\t** path, but set the cost estimate there anyway, just in case", "\t\t\t** it is.", "\t\t\t*/", "\t\t\tgetBestSortAvoidancePath().setCostEstimate(costEstimate);" ] }, { "added": [ "\t\t// If we're doing a hash join with _this_ PRN (as opposed to", "\t\t// with this PRN's child) then we don't attempt to push", "\t\t// predicates down. There are two reasons for this: 1)", "\t\t// we don't want to push the equijoin predicate that is", "\t\t// required for the hash join, and 2) if we're doing a", "\t\t// hash join then we're going to materialize this node,", "\t\t// but if we push predicates before materialization, we", "\t\t// can end up with incorrect results (esp. missing rows).", "\t\t// So don't push anything in this case.", "\t\tboolean hashJoinWithThisPRN = hasTrulyTheBestAccessPath &&", "\t\t\t(trulyTheBestAccessPath.getJoinStrategy() != null) &&", "\t\t\ttrulyTheBestAccessPath.getJoinStrategy().isHashJoin();", "", "\t\tif ((restrictionList != null) && !alreadyPushed && !hashJoinWithThisPRN)" ], "header": "@@ -666,8 +689,20 @@ public class ProjectRestrictNode extends SingleChildResultSetNode", "removed": [ "", "\t\tif ((restrictionList != null) && !alreadyPushed)" ] }, { "added": [ "\t\t// If this PRN has TTB access path for its child, store that access", "\t\t// path in the child here, so that we can find it later when it", "\t\t// comes time to generate qualifiers for the hash predicates (we", "\t\t// need the child's access path when generating qualifiers; if we", "\t\t// don't pass the path down here, the child won't be able to find", "\t\t// it).", "\t\tif (hasTrulyTheBestAccessPath)", "\t\t{", "\t\t\t((FromTable)childResult).trulyTheBestAccessPath =", "\t\t\t\t(AccessPathImpl)getTrulyTheBestAccessPath();", "", "\t\t\t// If the child itself is another SingleChildResultSetNode", "\t\t\t// (which is also what a ProjectRestrictNode is), then tell", "\t\t\t// it that it is now holding TTB path for it's own child. Again,", "\t\t\t// this info is needed so that child knows where to find the", "\t\t\t// access path at generation time.", "\t\t\tif (childResult instanceof SingleChildResultSetNode)", "\t\t\t{", "\t\t\t\t((SingleChildResultSetNode)childResult)", "\t\t\t\t\t.hasTrulyTheBestAccessPath = hasTrulyTheBestAccessPath;", "", "\t\t\t\t// While we're at it, add the PRN's table number to the", "\t\t\t\t// child's referenced map so that we can find the equijoin", "\t\t\t\t// predicate. We have to do this because the predicate", "\t\t\t\t// will be referencing the PRN's tableNumber, not the", "\t\t\t\t// child's--and since we use the child as the target", "\t\t\t\t// when searching for hash keys (as can be seen in", "\t\t\t\t// HashJoinStrategy.divideUpPredicateLists()), the child", "\t\t\t\t// should know what this PRN's table number is. This", "\t\t\t\t// is somewhat bizarre since the child doesn't", "\t\t\t\t// actually \"reference\" this PRN, but since the child's", "\t\t\t\t// reference map is used when searching for the equijoin", "\t\t\t\t// predicate (see \"buildTableNumList\" in", "\t\t\t\t// BinaryRelationalOperatorNode), this is the simplest", "\t\t\t\t// way to pass this PRN's table number down.", "\t\t\t\tchildResult.getReferencedTableMap().set(tableNumber);", "\t\t\t}", "\t\t}", "" ], "header": "@@ -717,6 +752,45 @@ public class ProjectRestrictNode extends SingleChildResultSetNode", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/RelationalOperator.java", "hunks": [ { "added": [], "header": "@@ -67,25 +67,6 @@ public interface RelationalOperator", "removed": [ "\t/**", "\t * Check whether this RelationalOperator is a comparison of the given", "\t * column with an expression. If so, return the ColumnReference that", "\t * corresponds to the given column, and that is on one side of this", "\t * RelationalOperator or the other (this method copes with the", "\t * column being on either side of the operator). If the given column", "\t * does not appear by itself on one side of the comparison, the", "\t * method returns null.", "\t *", "\t * @param tableNumber\tThe table number of the table in question", "\t * @param columnPosition\tThe ordinal position of the column (one-based)", "\t *", "\t * @return\tThe ColumnReference on one side of this RelationalOperator", "\t *\t\t\tthat represents the given columnPosition. Returns null", "\t *\t\t\tif no such ColumnReference exists by itself on one side of", "\t *\t\t\tthis RelationalOperator.", "\t */", "\tColumnReference getColumnOperand(int tableNumber, int columnPosition);", "" ] }, { "added": [ "\t/**", "\t * Find the operand (left or right) that points to the same table", "\t * as the received ColumnReference, and then return either that", "\t * operand or the \"other\" operand, depending on the value of", "\t * otherSide. This presumes it will be found only on one", "\t * side. If not found, it will return null.", "\t *", "\t * @param cRef The ColumnReference for which we're searching.", "\t * @param refSetSize Size of the referenced map for the predicate", "\t * represented by this RelationalOperator node. This is used", "\t * for storing base table numbers when searching for cRef.", "\t * @param otherSide Assuming we find an operand that points to", "\t * the same table as cRef, then we will return the *other*", "\t * operand if otherSide is true; else we'll return the operand", "\t * that matches cRef.", "\t */", "\tValueNode getOperand(ColumnReference cRef, int refSetSize,", "\t\tboolean otherSide);", "" ], "header": "@@ -93,6 +74,25 @@ public interface RelationalOperator", "removed": [] }, { "added": [ "\t * @param ft\tWe'll look for the column in all tables at and beneath ft.", "\t * This is useful if ft is, say, a ProjectRestrictNode over a subquery--", "\t * then we want to look at all of the FROM tables in the subquery to try", "\t * to find the right column.", "\t\t\t\t\t\t\t\t\tint columnPosition,", "\t\t\t\t\t\t\t\t\tFromTable ft);" ], "header": "@@ -100,12 +100,17 @@ public interface RelationalOperator", "removed": [ "\t\t\t\t\t\t\t\t\tint columnPosition);" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/UnaryComparisonOperatorNode.java", "hunks": [ { "added": [], "header": "@@ -166,17 +166,7 @@ public class UnaryComparisonOperatorNode extends UnaryOperatorNode", "removed": [ "", "\t\treturn getColumnOperand(ft.getTableNumber(), columnPosition);", "\t}", "", "\t/** @see RelationalOperator#getColumnOperand */", "\tpublic ColumnReference getColumnOperand(", "\t\t\t\t\t\t\t\tint tableNumber,", "\t\t\t\t\t\t\t\tint columnPosition)", "\t{", "" ] }, { "added": [ "\t\t\tif (cr.getTableNumber() == ft.getTableNumber())" ], "header": "@@ -184,7 +174,7 @@ public class UnaryComparisonOperatorNode extends UnaryOperatorNode", "removed": [ "\t\t\tif (cr.getTableNumber() == tableNumber)" ] }, { "added": [ "\t/** @see RelationalOperator#getOperand */", "\tpublic ValueNode getOperand(ColumnReference cRef, int refSetSize,", "\t\tboolean otherSide)", "\t{", "\t\tif (otherSide)", "\t\t// there is no \"other\" side for Unary, so just return null.", "\t\t\treturn null;", "", "\t\tColumnReference\tcr;", "\t\tif (operand instanceof ColumnReference)", "\t\t{", "\t\t\t/*", "\t\t\t** The operand is a column reference.", "\t\t\t** Is it the correct column?", "\t\t\t*/", "\t\t\tJBitSet cRefTables = new JBitSet(refSetSize);", "\t\t\tJBitSet crTables = new JBitSet(refSetSize);", "\t\t\tBaseTableNumbersVisitor btnVis =", "\t\t\t\tnew BaseTableNumbersVisitor(crTables);", "", "\t\t\tcr = (ColumnReference) operand;", "\t\t\ttry {", "\t\t\t\tcr.accept(btnVis);", "\t\t\t\tbtnVis.setTableMap(cRefTables);", "\t\t\t\tcRef.accept(btnVis);", "\t\t\t} catch (StandardException se) {", " \tif (SanityManager.DEBUG)", " \t{", " \t SanityManager.THROWASSERT(\"Failed when trying to \" +", " \t \"find base table number for column reference check:\\n\" +", " \t se.getMessage());", " \t}", "\t\t\t}", "\t\t\tcrTables.and(cRefTables);", "\t\t\tif (crTables.getFirstSetBit() != -1)", "\t\t\t{", "\t\t\t\t/*", "\t\t\t\t** The table is correct, how about the column position?", "\t\t\t\t*/", "\t\t\t\tif (cr.getSource().getColumnPosition() ==", "\t\t\t\t\tcRef.getColumnNumber())", "\t\t\t\t{", "\t\t\t\t\t/* We've found the correct column - return it. */", "\t\t\t\t\treturn operand;", "\t\t\t\t}", "\t\t\t}", "\t\t}", "", "\t\t/* Not the column we're looking for */", "\t\treturn null;", "\t}", "" ], "header": "@@ -222,6 +212,58 @@ public class UnaryComparisonOperatorNode extends UnaryOperatorNode", "removed": [] }, { "added": [ "\t\t\t\t\t\t\t\t\t\t int columnNumber,", "\t\t\t\t\t\t\t\t\t\t FromTable ft)" ], "header": "@@ -242,7 +284,8 @@ public class UnaryComparisonOperatorNode extends UnaryOperatorNode", "removed": [ "\t\t\t\t\t\t\t\t\t\t int columnNumber)" ] } ] } ]
derby-DERBY-783-6a5edfc0
DERBY-783: Enhance ALTER TABLE to support RESTART option to enable setting of identity column start value. Submitted by Mamta Satoor (msatoor@gmail.com) Here is more info from the contributor: I have attached a review package for this feature to the JIRA entry. Following is a brief description of the changes involved. Changed sqlgrammar.jj to add parser support for ALTER TABLE <tablename> ALTER <columnName> RESTART WITH integer-constant Also, added another element to the array which keeps track of autoincrement information in the parser. This 4th element will record if the autoincrement column is getting added or it is getting altered for INCREMENT BY value change or it is getting altered for RESTART WITH value change. This information is required later in the compile and execute phase. In the compile phase, this information is used to see if a user is trying to sneak in a value of 0 for INCREMENT BY. A value of 0 for INCREMENT BY should be caught at the time of autoincrement column add or at the time of autoincrement column alter to change the INCREMENT BY value. At the time of autoincrement column alter to change the RESTART WITH value, the INCREMENT BY value should not be checked. This is done in ColumnDefinitionNode.java. TableElementList generates ColumnInfo which needs to keep track of autoincrement column change status from ColumnDefinitionNode. This infromation in ColumnInfo will be used at execute time. In the execute phase, we need to know which columns of SYSCOLUMNS table need to be changed for an ALTER TABLE command on the autoincrement column. In the past, we only allowed to change the INCREMENT BY criteria of an autoincrement column but with this feature, it is possible for a user to change the start with value of autoincrement column and leave the INCREMENT BY unchanged. This autoincrement column change information is passed to the execute phase via ColumnInfo. In order to provide this distinction between ALTER BY..INCREMENT BY.. and ALTER BY..RESTART WITH.., I have had to add a variable in ColumnDefinitionNode.java, ColumnInfo.java and ColumnDescriptor.java. The value of the variable in each of these classes depend on what parser recorded for the autoincrement column status ie adding an autoincrement column/changing INCREMENT BY of the autoincrement column/changing RESTART WITH of the autoincrement column. Hope this information along with the comments in the code will help in the code review. Please let me know if you have any comments. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@370885 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/sql/dictionary/ColumnDescriptor.java", "hunks": [ { "added": [ "import org.apache.derby.impl.sql.compile.ColumnDefinitionNode;", "" ], "header": "@@ -30,6 +30,8 @@ import org.apache.derby.iapi.sql.StatementType;", "removed": [] }, { "added": [ "\t//Following variable is used to see if the user is adding an autoincrement ", "\t//column, or if user is altering the existing autoincrement column to change ", "\t//the increment value or to change the start value. If none of the above,", "\t//then it will be set to -1", "\tlong\t\t\t\tautoinc_create_or_modify_Start_Increment = -1; ", "\t * Constructor for a ColumnDescriptor when the column involved", "\t * is an autoincrement column. The last parameter to this method", "\t * indicates if an autoincrement column is getting added or if", "\t * the autoincrement column is being modified to change the", "\t * increment value or to change the start value" ], "header": "@@ -67,9 +69,18 @@ public class ColumnDescriptor extends TupleDescriptor", "removed": [ "\t * Constructor for a ColumnDescriptor" ] }, { "added": [ "\t * @param userChangedWhat\t\tAdding an autoincrement column OR", "\t *\t\t\t\t\t\tchanging increment value or start value of", "\t *\t\t\t\t\t\tthe autoincrement column.", "\t\t\t\t\t UUID defaultUUID, long autoincStart, long autoincInc, boolean autoinc,", "\t\t\t\t\t long userChangedWhat)", "\t\tthis(columnName, columnPosition, columnType, columnDefault,", "\t\t\t\tcolumnDefaultInfo, table, defaultUUID, autoincStart,", "\t\t\t\tautoincInc, autoinc);\t\t\t\t", "\t\tautoinc_create_or_modify_Start_Increment = userChangedWhat;", "\t}", "", "\t\t/**", "\t\t * Constructor for a ColumnDescriptor", "\t\t *", "\t\t * @param columnName\t\tThe name of the column", "\t\t * @param columnPosition\tThe ordinal position of the column", "\t\t * @param columnType\t\tA DataTypeDescriptor for the type of", "\t\t *\t\t\t\tthe column", "\t\t * @param columnDefault\t\tA DataValueDescriptor representing the", "\t\t *\t\t\t\t\t\t\tdefault value of the column, if any", "\t\t *\t\t\t\t\t\t\t(null if no default)", "\t\t * @param columnDefaultInfo\t\tThe default info for the column.", "\t\t * @param table\t\t\tA TableDescriptor for the table the", "\t\t *\t\t\t\t\t\tcolumn is in", "\t\t * @param defaultUUID\t\t\tThe UUID for the default, if any.", "\t\t * @param autoincStart\tStart value for an autoincrement column.", "\t\t * @param autoincInc\tIncrement for autoincrement column", "\t\t * @param autoinc\t\tboolean value for sanity checking.", "\t\t */", "", "\t\tpublic ColumnDescriptor(String columnName, int columnPosition,", "\t\t\t\t\t\t DataTypeDescriptor columnType, DataValueDescriptor columnDefault,", "\t\t\t\t\t\t DefaultInfo columnDefaultInfo,", "\t\t\t\t\t\t TableDescriptor table,", "\t\t\t\t\t\t UUID defaultUUID, long autoincStart, long autoincInc, boolean autoinc)", "\t\t{" ], "header": "@@ -85,14 +96,49 @@ public class ColumnDescriptor extends TupleDescriptor", "removed": [ "\t\t\t\t\t UUID defaultUUID, long autoincStart, long autoincInc, boolean autoinc)" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/catalog/SYSCOLUMNSRowFactory.java", "hunks": [ { "added": [ "import org.apache.derby.impl.sql.compile.ColumnDefinitionNode;", "" ], "header": "@@ -64,6 +64,8 @@ import org.apache.derby.catalog.DefaultInfo;", "removed": [] }, { "added": [ "\t\t//The SYSCOLUMNS table's autoinc related columns change with different", "\t\t//values depending on what happened to the autoinc column, ie is the ", "\t\t//user adding an autoincrement column, or is user changing the existing ", "\t\t//autoincrement column to change it's increment value or to change it's", "\t\t//start value? Following variable is used to keep track of what happened ", "\t\t//to the autoincrement column.", "\t\tlong autoinc_create_or_modify_Start_Increment = -1;" ], "header": "@@ -199,6 +201,13 @@ public class SYSCOLUMNSRowFactory extends CatalogRowFactory", "removed": [] }, { "added": [ "\t\t\tautoinc_create_or_modify_Start_Increment = column.getAutoinc_create_or_modify_Start_Increment();" ], "header": "@@ -212,6 +221,7 @@ public class SYSCOLUMNSRowFactory extends CatalogRowFactory", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/ColumnDefinitionNode.java", "hunks": [ { "added": [ "\t//This variable tells if the autoincrement column is participating ", "\t//in create or alter table. And if it is participating in alter", "\t//table, then it further knows if it is represting a change in ", "\t//increment value or a change in start value.", "\t//This information is later used to make sure that the autoincrement", "\t//column's increment value is not 0 at the time of create, or is not", "\t//getting set to 0 at the time of increment value modification.", "\tlong\t\t\t\t\t\tautoinc_create_or_modify_Start_Increment;", "\t//autoinc_create_or_modify_Start_Increment will be set to one of the", "\t//following 3 values.", "\t//CREATE_AUTOINCREMENT - this autoincrement column definition is for create table", "\tpublic static final int CREATE_AUTOINCREMENT = 0;", "\t//MODIFY_AUTOINCREMENT_RESTART_VALUE - this column definition is for", "\t//alter table command to change the start value of the column", "\tpublic static final int MODIFY_AUTOINCREMENT_RESTART_VALUE = 1;", "\t//MODIFY_AUTOINCREMENT_INC_VALUE - this column definition is for", "\t//alter table command to change the increment value of the column", "\tpublic static final int MODIFY_AUTOINCREMENT_INC_VALUE = 2;", "\t" ], "header": "@@ -72,8 +72,27 @@ public class ColumnDefinitionNode extends TableElementNode", "removed": [] }, { "added": [ "\t\t\t\t//Parser has passed the info about autoincrement column's status in the", "\t\t\t\t//following array element. It will tell if the autoinc column is part of ", "\t\t\t\t//a create table or if is a part of alter table. And if it is part of ", "\t\t\t\t//alter table, is it for changing the increment value or for changing ", "\t\t\t\t//the start value?", "\t\t\t\tautoinc_create_or_modify_Start_Increment = aii[QueryTreeNode.AUTOINCREMENT_CREATE_MODIFY];", "\t\t\t\t" ], "header": "@@ -122,7 +141,13 @@ public class ColumnDefinitionNode extends TableElementNode", "removed": [ "" ] }, { "added": [ "\t\t\t//increment value for autoincrement column can't be 0 if the autoinc column", "\t\t\t//is part of create table or it is part of alter table to change the ", "\t\t\t//increment value. ", "\t\t\tif (isAutoincrement && autoincrementIncrement == 0 && ", "\t\t\t\t\t(autoinc_create_or_modify_Start_Increment == ColumnDefinitionNode.CREATE_AUTOINCREMENT ||", "\t\t\t\t\t\t\tautoinc_create_or_modify_Start_Increment == ColumnDefinitionNode.MODIFY_AUTOINCREMENT_INC_VALUE))" ], "header": "@@ -224,7 +249,12 @@ public class ColumnDefinitionNode extends TableElementNode", "removed": [ "\t\t\tif (isAutoincrement && autoincrementIncrement == 0)" ] }, { "added": [ "\t/**", "\t * Get the status of this autoincrement column ", "\t *", "\t * @return ColumnDefinitionNode.CREATE_AUTOINCREMENT - ", "\t * \t\tif this definition is for autoincrement column creatoin", "\t * ColumnDefinitionNode.MODIFY_AUTOINCREMENT_RESTART_VALUE -", "\t * \t\tif this definition is for alter sutoincrement column to change the start value ", "\t * ColumnDefinitionNode.MODIFY_AUTOINCREMENT_INC_VALUE ", "\t * \t\tif this definition is for alter autoincrement column to change the increment value", "\t */", "\tlong getAutoinc_create_or_modify_Start_Increment()", "\t{", "\t\tif (SanityManager.DEBUG)", "\t\t{", "\t\t\tSanityManager.ASSERT(isAutoincrement,", "\t\t\t\t\"isAutoincrement expected to be true\");", "\t\t}", "\t\treturn autoinc_create_or_modify_Start_Increment;", "\t}", "\t" ], "header": "@@ -269,6 +299,26 @@ public class ColumnDefinitionNode extends TableElementNode", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/TableElementList.java", "hunks": [ { "added": [ "\t\t\t\t\t\t\t\tColumnInfo.DROP, 0, 0, 0);" ], "header": "@@ -377,7 +377,7 @@ public class TableElementList extends QueryTreeNodeVector", "removed": [ "\t\t\t\t\t\t\t\tColumnInfo.DROP, 0, 0);" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/AlterTableConstantAction.java", "hunks": [ { "added": [ "\t\t\t\t\t\t ColumnInfo.MODIFY_COLUMN_DEFAULT_RESTART ||", "\t\t\t\t\t\t columnInfo[ix].action == ColumnInfo.MODIFY_COLUMN_DEFAULT_INCREMENT)" ], "header": "@@ -398,7 +398,8 @@ class AlterTableConstantAction extends DDLSingleTableConstantAction", "removed": [ "\t\t\t\t\t\t ColumnInfo.MODIFY_COLUMN_DEFAULT)" ] }, { "added": [ "\t\t\t\t\t\t\t\t\t\t\t\t columnInfo[ix].autoincInc != 0,", "\t\t\t\t\t\t\t\t\t\t\t\t columnInfo[ix].autoinc_create_or_modify_Start_Increment" ], "header": "@@ -1039,7 +1040,8 @@ class AlterTableConstantAction extends DDLSingleTableConstantAction", "removed": [ "\t\t\t\t\t\t\t\t\t\t\t\t columnInfo[ix].autoincInc != 0" ] }, { "added": [ "\t\tif (columnInfo[ix].action == ColumnInfo.MODIFY_COLUMN_DEFAULT_INCREMENT)" ], "header": "@@ -1047,7 +1049,7 @@ class AlterTableConstantAction extends DDLSingleTableConstantAction", "removed": [ "\t\tif (columnInfo[ix].autoincInc != 0)" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/ColumnInfo.java", "hunks": [ { "added": [ "\t//if this is an autoincrement column, then following variable will have CREATE or", "\t//MODIFY_COLUMN_DEFAULT_RESTART or MODIFY_COLUMN_DEFAULT_INCREMENT. Otherwise,", "\t//this variable will be set to -1.", "\tpublic long \t\t\t\t\t\tautoinc_create_or_modify_Start_Increment = -1;", "\t//This indicates column is for CREATE TABLE", "\tpublic static final int DROP\t\t\t\t\t= 1;", "\tpublic static final int MODIFY_COLUMN_TYPE = 2;", "\tpublic static final int MODIFY_COLUMN_CONSTRAINT = 3;", "\tpublic static final int MODIFY_COLUMN_CONSTRAINT_NOT_NULL = 4;", "\t//This indicates column is for ALTER TABLE to change the start value of autoinc column ", "\tpublic static final int MODIFY_COLUMN_DEFAULT_RESTART\t= 5;", "\t//This indicates column is for ALTER TABLE to change the increment value of autoinc column ", "\tpublic static final int MODIFY_COLUMN_DEFAULT_INCREMENT\t= 6;" ], "header": "@@ -76,13 +76,21 @@ public class ColumnInfo implements Formatable", "removed": [ "\tpublic static final int MODIFY_COLUMN_DEFAULT\t= 1;", "\tpublic static final int DROP\t\t\t\t\t= 2;", "\tpublic static final int MODIFY_COLUMN_TYPE = 3;", "\tpublic static final int MODIFY_COLUMN_CONSTRAINT = 4;", "\tpublic static final int MODIFY_COLUMN_CONSTRAINT_NOT_NULL = 5;" ] }, { "added": [ "\t\t\t\t\t long\t\t\t\t\t\t\tautoincInc,", "\t\t\t\t\t long\t\t\t\t\t\t\tautoinc_create_or_modify_Start_Increment)" ], "header": "@@ -115,7 +123,8 @@ public class ColumnInfo implements Formatable", "removed": [ "\t\t\t\t\t long\t\t\t\t\t\t\tautoincInc)" ] } ] } ]
derby-DERBY-790-b2c17727
DERBY-790: SQLException used by the networked interface to Derby is not serializable Patch contributed by Francois Orsini. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@504630 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/client/org/apache/derby/client/am/SqlException.java", "hunks": [ { "added": [ " protected transient Sqlca sqlca_ = null; // for engine generated errors only", " protected String cachedMessage_ = null;" ], "header": "@@ -74,8 +74,9 @@ import org.apache.derby.shared.common.reference.SQLState;", "removed": [ " protected Sqlca sqlca_ = null; // for engine generated errors only" ] } ] } ]
derby-DERBY-791-9d08b6af
DERBY-791: Make InsertNode visitors process the target column list. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@835417 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/compile/DMLModStatementNode.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.sql.compile.Visitable;", "import org.apache.derby.iapi.sql.compile.Visitor;" ], "header": "@@ -42,6 +42,8 @@ import org.apache.derby.iapi.sql.compile.C_NodeTypes;", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/InsertNode.java", "hunks": [ { "added": [ "\t/**", "\t * Accept the visitor for all visitable children of this node.", "\t * ", "\t * @param v the visitor", "\t *", "\t * @exception StandardException on error", "\t */", "\tvoid acceptChildren(Visitor v)", "\t\tthrows StandardException", "\t{", "\t\tsuper.acceptChildren(v);", "", "\t\tif (targetColumnList != null)", "\t\t{", "\t\t\ttargetColumnList.accept(v);", "\t\t}", "\t}", "" ], "header": "@@ -949,4 +949,22 @@ public final class InsertNode extends DMLModStatementNode", "removed": [] } ] } ]
derby-DERBY-797-bc508402
DERBY-918: Introduce new "junit" test type DERBY-934: Create a set of JUnit tests for scrollable updatable cursors. I also added these tests to the jdbcapi and derbynetclientmats suites (except for ConcurrencyTest, which takes too long to run currently) DERBY-797: After calling ResultSet.relative(0) the cursor loses its position These are all submitted together because of interdependencies. All contributed by Andreas Kornelliusen NOTE: This may cause test failures on the IBM JDK; I did not test it with this JDK, nor did I exclude these tests from running on this JDK, as I couldn't say whether they work or not (I don't have the IBM JDK). I did exclude running these tests on DerbyNet, because they have a hard failure saying "null user not supported." Ran these tests on JDK 1.4, JDK 1.3, with both embedded and network client drivers. Note that the SURTest.out has failures; this is because (a) the scrollable updatable result set work is not yet finished and (b) there are differences between network client and embedded client which need to be resolved. -------- DERBY-797 files: M java/engine/org/apache/derby/impl/sql/execute/ScrollInsensitiveResultSet.java DERBY-918 files: M java/testing/org/apache/derbyTesting/functionTests/util/TestUtil.java M java/testing/org/apache/derbyTesting/functionTests/harness/testtypes.properties M java/testing/org/apache/derbyTesting/functionTests/harness/RunTest.java DERBY-934 files: AM java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ConcurrencyTest_app.properties AM java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/SURBaseTest.java AM java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/SURQueryMixTest.java AM java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/SURQueryMixTest_app.properties AM java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ConcurrencyTest.java AM java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/SURDataModelSetup.java AM java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/SURTest.java AM java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/SURTest_app.properties A java/testing/org/apache/derbyTesting/functionTests/master/SURTest.out A java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/SURTest.out M java/testing/org/apache/derbyTesting/functionTests/suites/jdbcapi.runall M java/testing/org/apache/derbyTesting/functionTests/suites/derbynetclientmats.runall M java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNet.exclude git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@378045 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/functionTests/util/TestUtil.java", "hunks": [ { "added": [ "import java.security.AccessController;", "import java.security.PrivilegedAction;", "import java.security.PrivilegedExceptionAction;", "import java.security.PrivilegedActionException;" ], "header": "@@ -30,7 +30,10 @@ import java.util.Locale;", "removed": [ "" ] }, { "added": [ " String frameworkString = (String) AccessController.doPrivileged", " (new PrivilegedAction() {", " public Object run() {", " return System.getProperty(\"framework\");", " }", " }", " ); " ], "header": "@@ -165,7 +168,13 @@ public class TestUtil {", "removed": [ "\t\tString frameworkString = System.getProperty(\"framework\");" ] }, { "added": [ " String hostName = (String) AccessController.doPrivileged", " (new PrivilegedAction() {", " public Object run() {", " return System.getProperty(\"hostName\");", " }", " }", " ); " ], "header": "@@ -199,7 +208,13 @@ public class TestUtil {", "removed": [ " String hostName = (System.getProperty(\"hostName\"));" ] }, { "added": [ " final String driverName;" ], "header": "@@ -243,7 +258,7 @@ public class TestUtil {", "removed": [ "\t\tString driverName = null;" ] }, { "added": [ " default: ", " driverName= \"org.apache.derby.jdbc.EmbeddedDriver\";", " break;", " ", " try {", " AccessController.doPrivileged", " (new PrivilegedExceptionAction() {", " public Object run() throws Exception {", " return Class.forName(driverName).newInstance();", " }", " }", " );", " } catch (PrivilegedActionException e) {", " throw e.getException();", " }", " }" ], "header": "@@ -258,9 +273,23 @@ public class TestUtil {", "removed": [ "\t\tClass.forName(driverName).newInstance();", "\t}" ] } ] } ]
derby-DERBY-8-f578f070
Fix for DERBY-8 Connection object gets created with un-supported holdability on getting Connection object from XAConnection "inside" the global transaction DERBY-366 In jdk13, when a connection transitions from global transaction to local transaction, its default holdability of HOLD_CURSORS_OVER_COMMIT is not restored. have a patch to fix Derby-8 (Connection object gets created with un-supported holdability on getting Connection object from XAConnection "inside" the global transaction) and Derby-366 (In jdk13, when a connection transitions from global transaction to local transaction, its default holdability of HOLD_CURSORS_OVER_COMMIT is not restored.) The patch is attached to both Derby-8 and Derby-366. The fix for both these bugs was centered around fixing the holdability handling in BrokeredConnection.java This was because BrokeredConnection.java had no code for restoring the holdability of real connection object and no code for saving the current holdability state of real connection object. I put fix for both these issues in BrokeredConnection.java so that both jdk13 and jdk14+ environments will be handled correctly. Had to use reflection for this holdability work because Connection.setHoldability and Connection.getHoldability methods are not available through JDK13 apis. Contributed by Mamta Satoor git-svn-id: https://svn.apache.org/repos/asf/incubator/derby/code/trunk@191755 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/jdbc/BrokeredConnection.java", "hunks": [ { "added": [ "import java.lang.reflect.*;", "", "import org.apache.derby.iapi.reference.JDBC30Translation;", "import org.apache.derby.iapi.error.PublicAPI;", "import org.apache.derby.iapi.error.StandardException;", "", "\t", "\t// default for Derby", "\tprotected int stateHoldability = JDBC30Translation.HOLD_CURSORS_OVER_COMMIT;" ], "header": "@@ -33,12 +33,21 @@ import org.apache.derby.impl.jdbc.Util;", "removed": [] }, { "added": [ "\t\t// jdk13 does not have Connection.getHoldability method and hence using", "\t\t// reflection to cover both jdk13 and higher jdks", "\t\ttry {", "\t\t\tMethod sh = conn.getClass().getMethod(\"getHoldability\", null);", "\t\t\tstateHoldability = ((Integer)sh.invoke(conn, null)).intValue();", "\t\t} catch( Exception e)", "\t\t{", "\t\t\tthrow PublicAPI.wrapStandardException( StandardException.plainWrapException( e));", "\t\t} " ], "header": "@@ -383,6 +392,15 @@ public class BrokeredConnection implements Connection", "removed": [] }, { "added": [ "\t\tClass[] CONN_PARAM = { Integer.TYPE };", "\t\tObject[] CONN_ARG = { new Integer(stateHoldability)};" ], "header": "@@ -396,6 +414,8 @@ public class BrokeredConnection implements Connection", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/iapi/jdbc/BrokeredConnection30.java", "hunks": [ { "added": [], "header": "@@ -32,9 +32,6 @@ import org.apache.derby.iapi.reference.JDBC30Translation;", "removed": [ "\t", "\t// default for Cloudscape", "\tprivate int stateHoldability = java.sql.ResultSet.HOLD_CURSORS_OVER_COMMIT;" ] } ] } ]
derby-DERBY-801-55a6cdc3
DERBY-801 (partial) Allow parallel access to data files Adding RAFContainer4 which is used instead of RAFContainer on jdk1.4 and higher. RAFContainer4 uses FileChannels to access the data files, and therefore multiple threads may access them in parallel. Patch contributed by Anders Morken. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@447815 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/store/raw/data/BaseDataFileFactory.java", "hunks": [ { "added": [ "\t// Creates RAFContainer instances tailored to the running VM", "\tprivate RAFContainerFactory rafContainerFactory = new RAFContainerFactory();", "" ], "header": "@@ -235,6 +235,9 @@ public final class BaseDataFileFactory", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/store/raw/data/RAFContainer.java", "hunks": [ { "added": [ "\tvoid closeContainer() {" ], "header": "@@ -252,7 +252,7 @@ class RAFContainer extends FileContainer implements PrivilegedExceptionAction", "removed": [ "\tfinal void closeContainer() {" ] } ] }, { "file": "java/engine/org/apache/derby/impl/store/raw/data/RAFContainerFactory.java", "hunks": [ { "added": [ "/*", "", " Derby - RAFContainerFactory", "", " Licensed to the Apache Software Foundation (ASF) under one or more", " contributor license agreements. See the NOTICE file distributed with", " this work for additional information regarding copyright ownership.", " The ASF licenses this file to you under the Apache License, Version 2.0", " (the \"License\"); you may not use this file except in compliance with", " the License. You may obtain a copy of the License at", "", " http://www.apache.org/licenses/LICENSE-2.0", "", " Unless required by applicable law or agreed to in writing, software", " distributed under the License is distributed on an \"AS IS\" BASIS,", " WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", " See the License for the specific language governing permissions and", " limitations under the License.", "", " */", "", "package org.apache.derby.impl.store.raw.data;", "", "import org.apache.derby.iapi.services.info.JVMInfo;", "import org.apache.derby.iapi.services.sanity.SanityManager;", "", "import java.lang.reflect.Constructor;", "", "", "/**", " * Constructs <code>RAFContainer</code> objects suitable for the running JVM.", " * Java 1.4 and above get <code>RAFContainer4</code> objects capable of", " * utilizing Java's New IO framework to perform thread-safe concurrent IO to a", " * container. Java 1.3 gets plain <code>RAFContainer<code> objects that", " * serialize all IOs to the container.", " * <p>", " * Derby's support for Java 1.3 is deprecated as of this writing, and when", " * support is ultimately removed this class can go away with it as", " * <code>RAFContainer4</code> is merged back into <code>RAFContainer</code>.", " */", "class RAFContainerFactory {", "", " /**", " * Used to create <code>RAFContainer</code> or <code>RAFContainer4</code", " * objects as appropriate depending on what JVM we are running in.", " * <p>", " * MT: Immutable, initialized by constructor.", " *", " * @see newRAFContainer(BaseDataFileFactory factory)", " */", " protected final Constructor rafContainerConstructor;", "", " /**", " * Determines what JVM we're running in and loads the appropriate", " * <code>RAFContainer</code> class, and stores its Constructor in", " * rafContainerConstructor for use in", " * <code>newRafContainer(BaseDataFileFactory factory)</code>.", " */", " public RAFContainerFactory() {", " Constructor foundConstructor = null;", " try {", " Class containerClass;", " Class factoryClass = BaseDataFileFactory.class;", "", " if( JVMInfo.JDK_ID >= JVMInfo.J2SE_14) {", " containerClass = Class.forName(", " \"org.apache.derby.impl.store.raw.data.RAFContainer4\");", " } else {", " containerClass = RAFContainer.class;", " }", "", " foundConstructor = containerClass.getDeclaredConstructor(", " new Class[] {factoryClass});", " } catch (Exception e) {", " if(SanityManager.DEBUG) {", " SanityManager.DEBUG_PRINT(\"RAFContainerFactory\",", " \"Caught exception when setting up rafContainerConstructor\");", " }", " /*", " * If there's a problem we'll back away from this trick.", " * newRAFContainer() checks for null and uses a regular", " * reflectionless <code>return new RAFContainer(this)</code> if", " * that's the case.", " */", " } finally { // Ensure that rafContainerConstructor is defined", " rafContainerConstructor = foundConstructor;", " }", " }", "", " /**", " * Produces a <code>RAFContainer</code> object appropriate for this JVM.", " */", " public RAFContainer newRAFContainer(BaseDataFileFactory factory) {", " if(rafContainerConstructor != null) {", " try {", " return (RAFContainer) rafContainerConstructor.newInstance(", " new BaseDataFileFactory[] {factory});", " } catch (Exception e) {", " if(SanityManager.DEBUG) {", " SanityManager.DEBUG_PRINT(\"RAFContainerFactory\",", " \"Caught exception when attempting to create RAFContainer object\");", " }", " // Falls through and constructs old-style RAFContainer instead.", " }", " }", " /* If rafContainerConstructor is null, the static initializer may", " * have failed to load the JVM 1.4 class or its constructor */", " return new RAFContainer(factory);", " }", "}" ], "header": "@@ -0,0 +1,110 @@", "removed": [] } ] } ]
derby-DERBY-801-5cc38754
DERBY-801: Allow parallel access to data files This patch (DERBY-801-7.patch) turns the DEBUG_PRINT messages in RAFContainer4 into assertions guarding the method entry points. Patch contributed by Anders Morken. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@474695 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/store/raw/data/RAFContainer4.java", "hunks": [ { "added": [ " // If ioChannel == null and fileData supports getChannel()", " // we have a problem. See this.openContainer(ContainerKey ", " // newIdentity).", " SanityManager.ASSERT(! ((ioChannel == null) &&", " super.fileData instanceof java.io.RandomAccessFile),", " \"RAFContainer4: New style readPage attempted\" +", " \" with uninitialized ioChannel\");", "" ], "header": "@@ -172,6 +172,14 @@ class RAFContainer4 extends RAFContainer {", "removed": [] }, { "added": [], "header": "@@ -209,10 +217,6 @@ class RAFContainer4 extends RAFContainer {", "removed": [ " if(SanityManager.DEBUG) {", " SanityManager.DEBUG_PRINT(\"RAFContainer4\",", " \"New style readPage attempted with uninitialized ioChannel\");", " }" ] }, { "added": [ " if (SanityManager.DEBUG) {", " // If ioChannel == null and fileData supports getChannel()", " // we have a problem", " SanityManager.ASSERT(! ((ioChannel == null) &&", " super.fileData instanceof java.io.RandomAccessFile),", " \"RAFContainer4: New style writePage attempted \" +", " \"with uninitialized ioChannel\");", " }" ], "header": "@@ -236,6 +240,14 @@ class RAFContainer4 extends RAFContainer {", "removed": [] }, { "added": [], "header": "@@ -344,10 +356,6 @@ class RAFContainer4 extends RAFContainer {", "removed": [ " if(SanityManager.DEBUG) {", " SanityManager.DEBUG_PRINT(\"RAFContainer4\",", " \"New style writePage attempted with uninitialized ioChannel\");", " }" ] } ] } ]
derby-DERBY-801-f0cd4bf3
DERBY-801 (partial) Allow parallel access to data files Backing out the patch for DERBY-733 as it is not needed anymore and the code is cleaner without it. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@447856 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/store/raw/data/RAFContainer.java", "hunks": [ { "added": [], "header": "@@ -55,8 +55,6 @@ import java.io.RandomAccessFile;", "removed": [ "import java.lang.reflect.Method;", "import java.lang.reflect.Constructor;" ] }, { "added": [], "header": "@@ -97,43 +95,6 @@ class RAFContainer extends FileContainer implements PrivilegedExceptionAction", "removed": [ "\t/* Fields with references to classes and methods in ReentrantLock", "\t * introduced in Java 1.5. Reflection is used to only use these", " * interfaces if they exist.", " * ", " */", "\tprivate static Class fairLockClass;", "\tprivate static Constructor fairLockConstructor;", "\tprivate static Method lock;", "\tprivate static Method unlock;", "\tprivate static boolean hasJava5FairLocks = false;", "", "\t// Use reflection to find the constructor, lock() and unlock() in", "\t// java.util.concurrent.locks.ReentrantLock. If the class and its", "\t// methods are found, hasJava5FairLocks will be true and fair", "\t// locking can be used.", "\tstatic {", "\t\ttry {", "\t\t\tfairLockClass = ", " Class.forName(\"java.util.concurrent.locks.ReentrantLock\");", "", "\t\t\tfairLockConstructor = ", " fairLockClass.getConstructor(new Class[] { Boolean.TYPE });", "", "\t\t\tlock = fairLockClass.getMethod(\"lock\", new Class[0]);", "\t\t\tunlock = fairLockClass.getMethod(\"unlock\", new Class[0]);", "\t\t\thasJava5FairLocks = true;", "\t\t}", "\t\tcatch (NoSuchMethodException nsme) {}", "\t\tcatch (ClassNotFoundException cnfe) {}", "\t}", "", "\t/**", "\t * Object of type java.util.concurrent.locks.ReentrantLock. It is", "\t * used to prevent starvation when many threads are reading from", "\t * the same file.", "\t */", "\tprivate Object fairLock;" ] }, { "added": [], "header": "@@ -141,24 +102,6 @@ class RAFContainer extends FileContainer implements PrivilegedExceptionAction", "removed": [ "", "\t\t// If Java 1.5 fair locks are available, construct one.", "\t\tif (hasJava5FairLocks) {", "\t\t\ttry {", "\t\t\t\t// construct a lock with fairness set to true", "\t\t\t\tfairLock = ", " fairLockConstructor.newInstance(", " new Object[] { Boolean.TRUE });", "\t\t\t} catch (Exception e) {", "\t\t\t\t// couldn't construct the lock, fall back to old behaviour", "", "\t\t\t\thasJava5FairLocks = false;", "\t\t\t\tif (SanityManager.DEBUG) {", "\t\t\t\t\tSanityManager.THROWASSERT(", " \"failed constructing ReentrantLock\", e);", "\t\t\t\t}", "\t\t\t}", "\t\t}" ] }, { "added": [ "\t\tsynchronized (this) {", "\t\t\tfileData.seek(pageOffset);", "", "\t\t\tfileData.readFully(pageData, 0, pageSize);" ], "header": "@@ -286,51 +229,11 @@ class RAFContainer extends FileContainer implements PrivilegedExceptionAction", "removed": [ "\t\t// Use Java 1.5 fair locks if they are available.", "\t\tif (hasJava5FairLocks) {", "\t\t\ttry {", "\t\t\t\tlock.invoke(fairLock, null);", "\t\t\t} catch (Exception e) {", "\t\t\t\t// Something bad happened while trying to lock the", "\t\t\t\t// region. Since the locking is not required for", "\t\t\t\t// anything other than ensuring fairness, it is ok to", "\t\t\t\t// fall back to pre-1.5 behaviour.", "\t\t\t\thasJava5FairLocks = false;", "\t\t\t\tif (SanityManager.DEBUG) {", "\t\t\t\t\tSanityManager.THROWASSERT(", " \"failed invoking ReentrantLock.lock()\", e);", "\t\t\t\t}", "\t\t\t}", "\t\t}", "\t\ttry {", "\t\t\t// Starvation might occur at this point if many threads", "\t\t\t// are waiting for the monitor. This section is therefore", "\t\t\t// surrounded by calls to ReentrantLock.lock()/unlock() if", "\t\t\t// we are running Java 1.5 or higher.", "\t\t\tsynchronized (this) {", "\t\t\t\tfileData.seek(pageOffset);", "\t\t\t\tfileData.readFully(pageData, 0, pageSize);", "\t\t\t}", "\t\t} finally {", "\t\t\t// Unlock this section.", "\t\t\tif (hasJava5FairLocks) {", "\t\t\t\ttry {", "\t\t\t\t\tunlock.invoke(fairLock, null);", "\t\t\t\t} catch (Exception e) {", "\t\t\t\t\t// An error occurred while unlocking the", "\t\t\t\t\t// region. The region might still be locked, so", "\t\t\t\t\t// we'd better stop using this kind of", "\t\t\t\t\t// locking. There will be no loss of", "\t\t\t\t\t// functionality, only a possible loss of", "\t\t\t\t\t// fairness.", "\t\t\t\t\thasJava5FairLocks = false;", "\t\t\t\t\tif (SanityManager.DEBUG) {", "\t\t\t\t\t\tSanityManager.THROWASSERT(", " \"failed invoking ReentrantLock.unlock()\", e);", "\t\t\t\t\t}", "\t\t\t\t}", "\t\t\t}" ] } ] } ]
derby-DERBY-802-b7c1f3b0
DERBY-802 OufOfMemoryError when using BLOB from scrollable insensitive result sets. The fix is to avoid the use of cloning the rows before inserting them into the BackingStoreHashTable. The BackingStoreHashTable has been fixed so that it does not do unnecessary cloning. The estimateMemoryUsage methods of SQLBinary and its subclasses has been improved to return a better estimate, so that rows with BLOBs will be backed to disk when using BackingStoreHashTable. Tests have been committed separately. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@423034 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/store/access/BackingStoreHashtable.java", "hunks": [ { "added": [ " ", " add_row_to_hash_table(hash_table, row, needsToClone);" ], "header": "@@ -279,16 +279,8 @@ public class BackingStoreHashtable", "removed": [ "", " if (needsToClone)", " {", " row = cloneRow(row);", " }", "", " Object key = ", " KeyHasher.buildHashKey(row, key_column_numbers);", "", " add_row_to_hash_table(hash_table, key, row);" ] }, { "added": [ " /**", " * Return a shallow cloned row", " *", " * @return The cloned row row to use.", " *", " * @exception StandardException Standard exception policy.", " **/", " static DataValueDescriptor[] shallowCloneRow(DataValueDescriptor[] old_row)", " throws StandardException", " {", " DataValueDescriptor[] new_row = new DataValueDescriptor[old_row.length];", " // the only difference between getClone and cloneObject is cloneObject does", " // not objectify a stream. We use cloneObject here. DERBY-802", " for (int i = 0; i < old_row.length; i++)", " {", " if( old_row[i] != null)", " new_row[i] = (DataValueDescriptor) ", " ((CloneableObject) old_row[i]).cloneObject();", " }", "", " return(new_row);", " }", "", " * @param needsToClone If the row needs to be cloned", " Object[] row,", " boolean needsToClone )", " if( spillToDisk( hash_table, row))", " if (needsToClone)", " {", " row = cloneRow(row);", " }", " Object key = KeyHasher.buildHashKey(row, key_column_numbers);" ], "header": "@@ -378,24 +370,53 @@ public class BackingStoreHashtable", "removed": [ " Object key,", " Object[] row)", " if( spillToDisk( hash_table, key, row))" ] }, { "added": [], "header": "@@ -451,7 +472,6 @@ public class BackingStoreHashtable", "removed": [ " * @param key The row's key" ] }, { "added": [], "header": "@@ -459,7 +479,6 @@ public class BackingStoreHashtable", "removed": [ " Object key," ] }, { "added": [ " else if( max_inmemory_size > getEstimatedMemUsage(row))", " " ], "header": "@@ -472,7 +491,8 @@ public class BackingStoreHashtable", "removed": [ " else if( max_inmemory_size > 0)" ] }, { "added": [ " Object key = KeyHasher.buildHashKey(row, key_column_numbers);" ], "header": "@@ -488,7 +508,7 @@ public class BackingStoreHashtable", "removed": [ " " ] }, { "added": [], "header": "@@ -727,11 +747,6 @@ public class BackingStoreHashtable", "removed": [ " if (needsToClone)", " {", " row = cloneRow(row);", " }", "" ] } ] }, { "file": "java/engine/org/apache/derby/iapi/store/access/DiskHashtable.java", "hunks": [ { "added": [ " if( rowCount == 1) ", " {", " retValue = BackingStoreHashtable.shallowCloneRow( row); ", " } " ], "header": "@@ -206,8 +206,10 @@ public class DiskHashtable", "removed": [ " if( rowCount == 1)", " retValue = BackingStoreHashtable.cloneRow( row);" ] }, { "added": [ " {", " }", " v.add( BackingStoreHashtable.shallowCloneRow( row));" ], "header": "@@ -218,8 +220,10 @@ public class DiskHashtable", "removed": [ " v.add( BackingStoreHashtable.cloneRow( row));" ] } ] }, { "file": "java/engine/org/apache/derby/iapi/types/SQLBinary.java", "hunks": [ { "added": [ " if (dataValue == null) {", " if (streamValueLength>=0) {", " return BASE_MEMORY_USAGE + streamValueLength;", " } else {", " return getMaxMemoryUsage();", " }", " } else {", " return BASE_MEMORY_USAGE + dataValue.length;", " }", "\t/**", "\t * Return max memory usage for a SQL Binary", "\t */", "\tabstract int getMaxMemoryUsage();", "" ], "header": "@@ -109,14 +109,23 @@ abstract class SQLBinary", "removed": [ " int sz = BASE_MEMORY_USAGE;", " if( null != dataValue)", " sz += dataValue.length;", " return sz;", "" ] } ] }, { "file": "java/engine/org/apache/derby/iapi/types/SQLBit.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.reference.Limits;" ], "header": "@@ -21,6 +21,7 @@", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/iapi/types/SQLBlob.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.reference.Limits;" ], "header": "@@ -26,6 +26,7 @@ import org.apache.derby.iapi.types.TypeId;", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/iapi/types/SQLLongVarbit.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.reference.Limits;" ], "header": "@@ -26,6 +26,7 @@ import org.apache.derby.iapi.types.TypeId;", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/iapi/types/SQLVarbit.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.reference.Limits;" ], "header": "@@ -26,6 +26,7 @@ import org.apache.derby.iapi.types.TypeId;", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/ScrollInsensitiveResultSet.java", "hunks": [ { "added": [ "\t\tfinal int[] keyCols = new int[] { 0 };", "\t\t" ], "header": "@@ -229,9 +229,8 @@ public class ScrollInsensitiveResultSet extends NoPutResultSetImpl", "removed": [ "\t\tint[] keyCols = new int[1];", "\t\t// keyCols[0] = 0; // not req. arrays initialized to zero", "" ] }, { "added": [ "\t\tDataValueDescriptor[] sourceRowArray = sourceRow.getRowArray();", "\t\tht.put(true, hashRowArray);" ], "header": "@@ -992,12 +991,12 @@ public class ScrollInsensitiveResultSet extends NoPutResultSetImpl", "removed": [ "\t\tDataValueDescriptor[] sourceRowArray = sourceRow.getRowArrayClone();", "\t\tht.put(false, hashRowArray);" ] }, { "added": [ "\t", "\t/**", "\t * Get the row data at the specified position ", "\t * from the hash table.", "\t *", "\t * @param position\tThe specified position.", "\t *", "\t * @return\tThe row data at that position.", "\t *", " \t * @exception StandardException thrown on failure ", "\t */", "\tprivate DataValueDescriptor[] getRowArrayFromHashTable(int position)", "\t\tthrows StandardException", "\t{", "\t\tpositionInHashTable.setValue(position);", "\t\tfinal DataValueDescriptor[] hashRowArray = (DataValueDescriptor[]) ", "\t\t\tht.get(positionInHashTable);", "\t\t", "\t\t// Copy out the Object[] without the position.", "\t\tfinal DataValueDescriptor[] resultRowArray = new ", "\t\t\tDataValueDescriptor[hashRowArray.length - extraColumns];", "\t\tSystem.arraycopy(hashRowArray, extraColumns, resultRowArray, 0, ", "\t\t\t\t\t\t resultRowArray.length);", "\t\treturn resultRowArray;", "\t}" ], "header": "@@ -1058,6 +1057,31 @@ public class ScrollInsensitiveResultSet extends NoPutResultSetImpl", "removed": [] }, { "added": [ "\t\tExecRow newRow = row;", "\t\tboolean undoProjection = false;", "\t\t", "\t\t\t\tdoBaseRowProjection(row);", "\t\t\tundoProjection = true;" ], "header": "@@ -1082,10 +1106,13 @@ public class ScrollInsensitiveResultSet extends NoPutResultSetImpl", "removed": [ "\t\tExecRow newRow = row.getClone();", "\t\t\t\t\tdoBaseRowProjection(newRow);" ] }, { "added": [ "\t\t", "\t\t// Modify row to refer to data in the BackingStoreHashtable.", "\t\t// This allows reading of data which goes over multiple pages", "\t\t// when doing the actual update (LOBs). Putting columns of", "\t\t// type SQLBinary to disk, has destructive effect on the columns,", "\t\t// and they need to be re-read. That is the reason this is needed.", "\t\tif (undoProjection) {", "\t\t\t", "\t\t\tfinal DataValueDescriptor[] newRowData = newRow.getRowArray();", "\t\t\t", "\t\t\t// Array of original position in row", "\t\t\tfinal int[] origPos =((ProjectRestrictResultSet)source).", "\t\t\t\tgetBaseProjectMapping(); ", "\t\t\t", "\t\t\t// We want the row to contain data backed in BackingStoreHashtable", "\t\t\tfinal DataValueDescriptor[] backedData = ", "\t\t\t\tgetRowArrayFromHashTable(currentPosition);", "\t\t\t", "\t\t\tfor (int i=0; i<origPos.length; i++) {", "\t\t\t\tif (origPos[i]>=0) {", "\t\t\t\t\trow.setColumn(origPos[i], backedData[i]);", "\t\t\t\t}", "\t\t\t}", "\t\t} else {", "\t\t\trow.setRowArray(getRowArrayFromHashTable(currentPosition));", "\t\t}" ], "header": "@@ -1093,6 +1120,32 @@ public class ScrollInsensitiveResultSet extends NoPutResultSetImpl", "removed": [] }, { "added": [ "\t\tht.put(true, hashRowArray);" ], "header": "@@ -1112,7 +1165,7 @@ public class ScrollInsensitiveResultSet extends NoPutResultSetImpl", "removed": [ "\t\tht.put(false, hashRowArray);" ] } ] } ]
derby-DERBY-806-3f3b5e6a
DERBY-806 Rather than allocating a scratch RowPosition for every delete/replace/fetch, changed to use a single copy of a RowPosition allocated on demand per openGenericConglomerateController. If multiple calls to delete, replace, and/or fetch are made in the same open controller only one of these objects will be allocated. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@535878 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/store/access/conglomerate/GenericConglomerateController.java", "hunks": [ { "added": [ " RowPosition pos = ", " open_conglom.getRuntimeMem().get_scratch_row_position();" ], "header": "@@ -166,7 +166,8 @@ public abstract class GenericConglomerateController", "removed": [ " RowPosition pos = new RowPosition();" ] }, { "added": [ " RowPosition pos = ", " open_conglom.getRuntimeMem().get_scratch_row_position();" ], "header": "@@ -254,7 +255,8 @@ public abstract class GenericConglomerateController", "removed": [ " RowPosition pos = new RowPosition();" ] }, { "added": [ " RowPosition pos = ", " open_conglom.getRuntimeMem().get_scratch_row_position();" ], "header": "@@ -351,7 +353,8 @@ public abstract class GenericConglomerateController", "removed": [ " RowPosition pos = new RowPosition();" ] } ] }, { "file": "java/engine/org/apache/derby/impl/store/access/conglomerate/GenericScanController.java", "hunks": [ { "added": [ "\tFormatableBitSet\t\t\t\tscanColumnList," ], "header": "@@ -899,7 +899,7 @@ public abstract class GenericScanController", "removed": [ "\tFormatableBitSet\t\t\t\t scanColumnList," ] }, { "added": [ " scan_position = open_conglom.getRuntimeMem().get_scratch_row_position();" ], "header": "@@ -909,8 +909,7 @@ public abstract class GenericScanController", "removed": [ " // RESOLVE (mikem) - move this into runtime_mem", " scan_position = allocateScanPosition();" ] } ] }, { "file": "java/engine/org/apache/derby/impl/store/access/conglomerate/OpenConglomerateScratchSpace.java", "hunks": [ { "added": [ " private DataValueDescriptor[] scratch_template;", " private DataValueDescriptor[] scratch_row;", " * A complete array of format id's and collation_ids for this conglomerate.", " private int[] format_ids;", " private int[] collation_ids;", "", "", " /* scratch space used by ConglomerateController.delete and replace */", " private RowPosition scratch_row_position;" ], "header": "@@ -64,20 +64,24 @@ public class OpenConglomerateScratchSpace", "removed": [ " private DataValueDescriptor[] scratch_template;", " private DataValueDescriptor[] scratch_row;", " * A complete array of format id's for this conglomerate.", " private int[] format_ids;", " private int[] collation_ids;" ] }, { "added": [ " /**", " * Return a scratch RowPosition.", " * <p>", " * Used by GenericConglomerateController.delete() and ", " * GenericConglomerateController.replace(). It may be reused so callers", " * must insure that object no longer needed before next possible call", " * to get it again.", " * <p>", " *", "\t * @return a scratch RowPosition.", " *", "\t * @exception StandardException Standard exception policy.", " **/", " public RowPosition get_scratch_row_position()", " {", " if (scratch_row_position == null)", " {", " scratch_row_position = new RowPosition();", " }", "", " return(scratch_row_position);", " }", "" ], "header": "@@ -184,6 +188,29 @@ public class OpenConglomerateScratchSpace", "removed": [] } ] } ]
derby-DERBY-808-59126251
DERBY-808: PreparedStatements could take longer to execute than equivalent statements, because of incorect code in search clause transitive closure method. Handle the case of ParameterNodes, in addition to ConstantNodes on the rightside. Submitted by Satheesh Bandaram(satheesh@sourcery.org) git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@370217 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/compile/PredicateList.java", "hunks": [ { "added": [ "\t\t\t\t// RESOLVE: Consider using variant type of the expression, instead of", "\t\t\t\t// ConstantNode or ParameterNode in the future.", "\t\t\t\tif (left instanceof ColumnReference && ", "\t\t\t\t\t (right instanceof ConstantNode || right instanceof ParameterNode))" ], "header": "@@ -2037,7 +2037,10 @@ public class PredicateList extends QueryTreeNodeVector implements OptimizablePre", "removed": [ "\t\t\t\tif (left instanceof ColumnReference && right instanceof ConstantNode)" ] }, { "added": [ "", "\t\t\t\t// Don't get value for parameterNode since not known yet.", "\t\t\t\tif (((BinaryComparisonOperatorNode) ro).getRightOperand() instanceof ConstantNode)", "\t\t\t\t{", "\t\t\t\t\tConstantNode currCN = (ConstantNode) ((BinaryComparisonOperatorNode) ro).getRightOperand();", "\t\t\t\t\tsearchODV = (DataValueDescriptor) currCN.getValue();", "\t\t\t\t}", "\t\t\t\telse searchODV = null;" ], "header": "@@ -2077,8 +2080,14 @@ public class PredicateList extends QueryTreeNodeVector implements OptimizablePre", "removed": [ "\t\t\t\tConstantNode currCN = (ConstantNode) ((BinaryComparisonOperatorNode) ro).getRightOperand();", "\t\t\t\tsearchODV = (DataValueDescriptor) currCN.getValue();" ] }, { "added": [ "\t\t\t\t\t\tif (((BinaryComparisonOperatorNode) ro2).getRightOperand() instanceof ConstantNode)", "\t\t\t\t\t\t{", "\t\t\t\t\t\t\tConstantNode currCN = (ConstantNode) ((BinaryComparisonOperatorNode) ro2).getRightOperand();", "\t\t\t\t\t\t\tcurrODV = (DataValueDescriptor) currCN.getValue();", "\t\t\t\t\t\t}", "\t\t\t\t\t\telse currODV = null;" ], "header": "@@ -2152,8 +2161,12 @@ public class PredicateList extends QueryTreeNodeVector implements OptimizablePre", "removed": [ "\t\t\t\t\t\tConstantNode currCN = (ConstantNode) ((BinaryComparisonOperatorNode) ro2).getRightOperand();", "\t\t\t\t\t\tcurrODV = (DataValueDescriptor) currCN.getValue();" ] } ] } ]
derby-DERBY-809-0c1cb148
DERBY-809 Incorrect documentation for NetworkServerControl.logConnections Patch contributed by Kristian Waagan This is a small patch for the javadoc of NetworkServerControl and NetworkServerControlImpl, removing the false statement that disconnections are logged to derby.log. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@381375 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/drda/org/apache/derby/drda/NetworkServerControl.java", "hunks": [ { "added": [ "\tThis turns logging of connections on or off. ", "\tConnections are logged to derby.log. " ], "header": "@@ -62,8 +62,8 @@ import org.apache.derby.impl.drda.NetworkServerControlImpl;", "removed": [ "\tThis turns logging of connections and disconnections on and off. ", "\tConnections and disconnections are logged to derby.log. " ] }, { "added": [ "\tof connections. Default is connections are not logged.</LI>" ], "header": "@@ -110,7 +110,7 @@ import org.apache.derby.impl.drda.NetworkServerControlImpl;", "removed": [ "\tof connections and disconnections. Default is connections are not logged.</LI>" ] } ] }, { "file": "java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java", "hunks": [ { "added": [ "\tprivate boolean logConnections;\t\t// log connects" ], "header": "@@ -223,7 +223,7 @@ public final class NetworkServerControlImpl {", "removed": [ "\tprivate boolean logConnections;\t\t// log connect and disconnects" ] }, { "added": [ "\t * written to derby.log each time a connection is made." ], "header": "@@ -861,7 +861,7 @@ public final class NetworkServerControlImpl {", "removed": [ "\t * written to derby.log each time a connection connects or disconnects." ] } ] } ]
derby-DERBY-818-2a6e4592
DERBY-818 Remove the object allocation and reseting overhead for updateable ResultSet information when the ResultSet is read-only. Similar changes for the stream single fetch (getXXXStream) logic. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@370574 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java", "hunks": [ { "added": [ "import java.util.Arrays;" ], "header": "@@ -72,6 +72,7 @@ import java.io.InputStream;", "removed": [] }, { "added": [ " /**", " * Indicates which columns have already been fetched", " * as a stream for a row. Created on-demand by a getXXXStream call.", " */" ], "header": "@@ -158,6 +159,10 @@ public abstract class EmbedResultSet extends ConnectionChild", "removed": [] }, { "added": [ "\t\t// Only incur the cost of allocating and maintaining", "\t\t// updated column information if the columns can be updated.", "\t\tif (concurrencyOfThisResultSet == JDBC20Translation.CONCUR_UPDATABLE)", "\t\t{", "\t\t //initialize arrays related to updateRow implementation", "\t\t columnGotUpdated = new boolean[getMetaData().getColumnCount()];", "\t\t copyOfDatabaseRow = new DataValueDescriptor[columnGotUpdated.length];", "\t\t}" ], "header": "@@ -205,11 +210,14 @@ public abstract class EmbedResultSet extends ConnectionChild", "removed": [ "\t\t//initialize arrays related to updateRow implementation", "\t\tcolumnGotUpdated = new boolean[getMetaData().getColumnCount()];", "\t\tcopyOfDatabaseRow = new DataValueDescriptor[columnGotUpdated.length];", "\t\t", "\t\tinitStreamUseFlags(getMetaData().getColumnCount());" ] }, { "added": [ " if (columnGotUpdated != null)", " {", "\t //since we are moving off of the current row, need to initialize state corresponding to updateRow implementation", "\t Arrays.fill(columnGotUpdated, false);", "\t currentRowHasBeenUpdated = false;", " }" ], "header": "@@ -302,10 +310,12 @@ public abstract class EmbedResultSet extends ConnectionChild", "removed": [ "\t //since we are moving off of the current row, need to initialize state corresponding to updateRow implementation", "\t for (int i=0; i < columnGotUpdated.length; i++)", " columnGotUpdated[i] = false;", "\t currentRowHasBeenUpdated = false;" ] }, { "added": [ "\t\t\t// Clear the indication of which columns were fetched as streams.", "\t\t\tif (streamUsedFlags != null)", "\t\t\t Arrays.fill(streamUsedFlags, false);" ], "header": "@@ -447,7 +457,9 @@ public abstract class EmbedResultSet extends ConnectionChild", "removed": [ "\t\t\tunuseStreams();" ] }, { "added": [], "header": "@@ -545,10 +557,6 @@ public abstract class EmbedResultSet extends ConnectionChild", "removed": [ "\t //since we are moving off of the current row(by closing the resultset), need to initialize state corresponding to updateRow implementation", "\t for (int i=0; i < columnGotUpdated.length; i++)", "\t\t\t\tcolumnGotUpdated[i] = false;", "\t currentRowHasBeenUpdated = false;" ] }, { "added": [ " /**", " * Mark a column as already having a stream accessed from it.", " * If the stream was already accessed, then throw an exception.", " * @param columnIndex", " * @throws SQLException", " */", " final void useStream(int columnIndex) throws SQLException {", " \t", " \tif (streamUsedFlags == null)", " \t\tstreamUsedFlags = new boolean[getMetaData().getColumnCount()];", " \t", " \telse if (streamUsedFlags[columnIndex - 1])", "\t throw newSQLException(SQLState.LANG_STREAM_RETRIEVED_ALREADY);", " \t", " \tstreamUsedFlags[columnIndex - 1] = true;" ], "header": "@@ -3977,41 +3985,21 @@ public abstract class EmbedResultSet extends ConnectionChild", "removed": [ " ", " private void initStreamUseFlags(int numOfCol){", "\t", "\tstreamUsedFlags = new boolean[numOfCol];", "\t", "\t// Next code is not neccesary because initial value is false, which is default initial value for boolean.", "\t/*", "\t clearStreamUsedFlags();", "\t*/", " }", " ", " ", " void useStream(int columnIndex) throws SQLException {", "\t", "\tif(streamUsedFlags[columnIndex - 1]){", "\t throw newSQLException(SQLState.LANG_STREAM_RETRIEVED_ALREADY);", "\t}", "", "\tstreamUsedFlags[columnIndex - 1] = true;", "", " }", "", "", " private void unuseStreams(){", "\t", "\tfor(int i = 0;", "\t i < streamUsedFlags.length;", "\t i ++){", "\t ", "\t streamUsedFlags[i] = false;", "\t ", "\t}", "\t", " ", " " ] } ] } ]
derby-DERBY-821-5e883125
DERBY-821 Client driver: Implicitly close exhausted result sets on the server. Submitted by Knut Anders Hatlen git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@377367 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/client/org/apache/derby/client/am/Cursor.java", "hunks": [ { "added": [ " private boolean allRowsReceivedFromServer_;" ], "header": "@@ -69,7 +69,7 @@ public abstract class Cursor {", "removed": [ " public boolean allRowsReceivedFromServer_;" ] }, { "added": [ " setAllRowsReceivedFromServer(false);" ], "header": "@@ -116,7 +116,7 @@ public abstract class Cursor {", "removed": [ " allRowsReceivedFromServer_ = false;" ] }, { "added": [ " /**", " * Makes the next row the current row. Returns true if the current", " * row position is a valid row position.", " *", " * @param allowServerFetch if false, don't fetch more data from", " * the server even if more data is needed", " * @return <code>true</code> if current row position is valid", " * @exception SqlException if an error occurs", " */", " protected boolean stepNext(boolean allowServerFetch) throws SqlException {" ], "header": "@@ -133,9 +133,16 @@ public abstract class Cursor {", "removed": [ " // Makes the next row the current row.", " // Returns true if the current row position is a valid row position.", " public boolean next() throws SqlException {" ] }, { "added": [ " rowPositionIsValid = calculateColumnOffsetsForRow_(0, allowServerFetch);", " /**", " * Makes the next row the current row. Returns true if the current", " * row position is a valid row position.", " *", " * @return <code>true</code> if current row position is valid", " * @exception SqlException if an error occurs", " */", " public boolean next() throws SqlException {", " return stepNext(true);", " }", "", " /**", " * Set the value of value of allRowsReceivedFromServer_.", " *", " * @param b a <code>boolean</code> value indicating whether all", " * rows are received from the server", " */", " public void setAllRowsReceivedFromServer(boolean b) {", " /**", " * Return <code>true</code> if all rows are received from the", " * server.", " *", " * @return <code>true</code> if all rows are received from the", " * server.", " */", " public final boolean allRowsReceivedFromServer() {", " return allRowsReceivedFromServer_;", " }", "" ], "header": "@@ -162,17 +169,45 @@ public abstract class Cursor {", "removed": [ " rowPositionIsValid = calculateColumnOffsetsForRow_(0); // readFetchedRows()", " public final void setAllRowsReceivedFromServer(boolean b) {" ] }, { "added": [ " setAllRowsReceivedFromServer(false);" ], "header": "@@ -186,7 +221,7 @@ public abstract class Cursor {", "removed": [ " allRowsReceivedFromServer_ = false;" ] } ] }, { "file": "java/client/org/apache/derby/client/am/ResultSet.java", "hunks": [ { "added": [ " preClose_();" ], "header": "@@ -420,6 +420,7 @@ public abstract class ResultSet implements java.sql.ResultSet,", "removed": [] }, { "added": [ " row = (cursor_.allRowsReceivedFromServer() &&" ], "header": "@@ -2264,7 +2265,7 @@ public abstract class ResultSet implements java.sql.ResultSet,", "removed": [ " row = (cursor_.allRowsReceivedFromServer_ &&" ] }, { "added": [ " /**", " * Mark this ResultSet as closed on the server.", " */", " public void markClosedOnServer() {" ], "header": "@@ -4184,7 +4185,10 @@ public abstract class ResultSet implements java.sql.ResultSet,", "removed": [ " void markClosedOnServer() {" ] }, { "added": [], "header": "@@ -4214,19 +4218,6 @@ public abstract class ResultSet implements java.sql.ResultSet,", "removed": [ " public void setCloseOnlyStateForSingletonCursors() {", " markClosedOnServer();", " }", "", " // If autocommit is on, the commit was already flowed with the execute() that", " // generated the singleton cursor. The correct state needs to be set into", " // the result set now.", " public void setAutoCommitStateForSingletonCursors() {", " if (connection_.autoCommit_) {", " markAutoCommitted();", " }", " }", "" ] }, { "added": [ " if (cursor_.allRowsReceivedFromServer() &&", " rowsReceivedInCurrentRowset_ == 0) {" ], "header": "@@ -4650,7 +4641,8 @@ public abstract class ResultSet implements java.sql.ResultSet,", "removed": [ " if (cursor_.allRowsReceivedFromServer_ && rowsReceivedInCurrentRowset_ == 0) {" ] }, { "added": [ " cursor_.allRowsReceivedFromServer()) {" ], "header": "@@ -4756,7 +4748,7 @@ public abstract class ResultSet implements java.sql.ResultSet,", "removed": [ " cursor_.allRowsReceivedFromServer_) {" ] }, { "added": [ " if (rowsReceivedInCurrentRowset_ == 0 &&", " cursor_.allRowsReceivedFromServer()) {" ], "header": "@@ -4789,7 +4781,8 @@ public abstract class ResultSet implements java.sql.ResultSet,", "removed": [ " if (rowsReceivedInCurrentRowset_ == 0 && cursor_.allRowsReceivedFromServer_) {" ] }, { "added": [ " if (rowsReceivedInCurrentRowset_ == 0 &&", " cursor_.allRowsReceivedFromServer()) {" ], "header": "@@ -4861,8 +4854,8 @@ public abstract class ResultSet implements java.sql.ResultSet,", "removed": [ " if (rowsReceivedInCurrentRowset_ == 0 && cursor_.allRowsReceivedFromServer_) {", " //cursor_.beginningOfResultSetIsReached_ = true;" ] }, { "added": [ " if ((rowsReceivedInCurrentRowset_ == 0 &&", " cursor_.allRowsReceivedFromServer()) ||" ], "header": "@@ -4911,7 +4904,8 @@ public abstract class ResultSet implements java.sql.ResultSet,", "removed": [ " if ((rowsReceivedInCurrentRowset_ == 0 && cursor_.allRowsReceivedFromServer_) ||" ] }, { "added": [ " (cursor_.allRowsReceivedFromServer() ||", " absolutePosition_ > rowCount_)) {" ], "header": "@@ -4940,7 +4934,8 @@ public abstract class ResultSet implements java.sql.ResultSet,", "removed": [ " (cursor_.allRowsReceivedFromServer_ || absolutePosition_ > rowCount_)) {" ] }, { "added": [ " if (rowsReceivedInCurrentRowset_ == 0 &&", " cursor_.allRowsReceivedFromServer()) {" ], "header": "@@ -4949,7 +4944,8 @@ public abstract class ResultSet implements java.sql.ResultSet,", "removed": [ " if (rowsReceivedInCurrentRowset_ == 0 && cursor_.allRowsReceivedFromServer_) {" ] }, { "added": [ " if (rowsReceivedInCurrentRowset_ == 0 &&", " cursor_.allRowsReceivedFromServer()) {" ], "header": "@@ -4979,7 +4975,8 @@ public abstract class ResultSet implements java.sql.ResultSet,", "removed": [ " if (rowsReceivedInCurrentRowset_ == 0 && cursor_.allRowsReceivedFromServer_) {" ] }, { "added": [ " if (rowsReceivedInCurrentRowset_ == 0 &&", " cursor_.allRowsReceivedFromServer()) {" ], "header": "@@ -5022,7 +5019,8 @@ public abstract class ResultSet implements java.sql.ResultSet,", "removed": [ " if (rowsReceivedInCurrentRowset_ == 0 && cursor_.allRowsReceivedFromServer_) {" ] }, { "added": [ " absolutePosition_ = (cursor_.allRowsReceivedFromServer()) ?" ], "header": "@@ -5070,7 +5068,7 @@ public abstract class ResultSet implements java.sql.ResultSet,", "removed": [ " absolutePosition_ = (cursor_.allRowsReceivedFromServer_) ?" ] } ] }, { "file": "java/client/org/apache/derby/client/am/SqlCode.java", "hunks": [ { "added": [ " /**", " * Return the SQL code represented by this instance.", " *", " * @return an SQL code", " */", " public final int getCode() {" ], "header": "@@ -34,7 +34,12 @@ public class SqlCode {", "removed": [ " int getCode() {" ] } ] }, { "file": "java/client/org/apache/derby/client/net/NetCursor.java", "hunks": [ { "added": [ "import org.apache.derby.client.am.SqlCode;" ], "header": "@@ -28,6 +28,7 @@ import org.apache.derby.client.am.SignedBinary;", "removed": [] }, { "added": [ " /** Flag indicating whether the result set on the server is", " * implicitly closed when end-of-data is received. */", " private boolean qryclsimpEnabled_;", "" ], "header": "@@ -55,6 +56,10 @@ public class NetCursor extends org.apache.derby.client.am.Cursor {", "removed": [] }, { "added": [ " /**", " * Calculate the column offsets for a row.", " * <p>", " * Pseudo-code:", " * <ol>", " * <li>parse thru the current row in dataBuffer computing column", " * offsets</li>", " * <li>if (we hit the super.lastValidBytePosition, ie. encounter", " * partial row)", " * <ol>", " * <li>shift partial row bytes to beginning of dataBuffer", " * (this.shiftPartialRowToBeginning())</li>", " * <li>reset current row position (also done by", " * this.shiftPartialRowToBeginning())</li>", " * <li>send and recv continue-query into commBuffer", " * (rs.flowContinueQuery())</li>", " * <li>parse commBuffer up to QRYDTA", " * (rs.flowContinueQuery())</li>", " * <li>copy query data from reply's commBuffer to our", " * dataBuffer (this.copyQrydta())</li>", " * </ol>", " * </ol>", " *", " * @param rowIndex row index", " * @param allowServerFetch if true, allow fetching more data from", " * server", " * @return <code>true</code> if the current row position is a", " * valid row position.", " * @exception SqlException", " * @exception DisconnectException", " */", " protected", " boolean calculateColumnOffsetsForRow_(int rowIndex,", " boolean allowServerFetch)", " throws SqlException, DisconnectException", " {" ], "header": "@@ -80,18 +85,42 @@ public class NetCursor extends org.apache.derby.client.am.Cursor {", "removed": [ " // Pseudo-code:", " // parse thru the current row in dataBuffer computing column offsets", " // if (we hit the super.lastValidBytePosition, ie. encounter partial row) {", " // shift partial row bytes to beginning of dataBuffer (this.shiftPartialRowToBeginning())", " // reset current row position (also done by this.shiftPartialRowToBeginning())", " // send and recv continue-query into commBuffer (rs.flowContinueQuery())", " // parse commBuffer up to QRYDTA (rs.flowContinueQuery())", " // copy query data from reply's commBuffer to our dataBuffer (this.copyQrydta())", " // }", " // Returns true if the current row position is a valid row position.", " // rename this to parse*()", " protected boolean calculateColumnOffsetsForRow_(int rowIndex) throws SqlException, org.apache.derby.client.am.DisconnectException {" ] }, { "added": [ " if (sqlcode == SqlCode.END_OF_DATA.getCode()) {", " setAllRowsReceivedFromServer(true);" ], "header": "@@ -117,8 +146,8 @@ public class NetCursor extends org.apache.derby.client.am.Cursor {", "removed": [ " if (sqlcode == 100) {", " allRowsReceivedFromServer_ = true;" ] }, { "added": [ " if (allRowsReceivedFromServer() &&", " (position_ == lastValidBytePosition_)) {" ], "header": "@@ -146,7 +175,8 @@ public class NetCursor extends org.apache.derby.client.am.Cursor {", "removed": [ " if (allRowsReceivedFromServer_ && (position_ == lastValidBytePosition_)) {" ] }, { "added": [ " if (!allRowsReceivedFromServer()) {", " !netResultSet_.scrollable_ &&", " !extdtaPositions_.isEmpty()) {", " if (allowServerFetch) {", " } else {", " return false;" ], "header": "@@ -266,16 +296,19 @@ public class NetCursor extends org.apache.derby.client.am.Cursor {", "removed": [ " if (!allRowsReceivedFromServer_) {", " extdtaPositions_.size() > 0 && !netResultSet_.scrollable_) {", " if (!extdtaPositions_.isEmpty()) {" ] }, { "added": [ " if (!blocking_ && allRowsReceivedFromServer() &&", " daNullIndicator == 0xFF) {", " /**", " * Scan the data buffer to see if end of data (SQL state 02000)", " * has been received. This method should only be called when the", " * cursor is being closed since the pointer to the current row can", " * be modified.", " *", " * @exception SqlException", " */", " void scanDataBufferForEndOfData() throws SqlException {", " while (!allRowsReceivedFromServer() &&", " (position_ != lastValidBytePosition_)) {", " stepNext(false);", " }", " }", "" ], "header": "@@ -294,13 +327,29 @@ public class NetCursor extends org.apache.derby.client.am.Cursor {", "removed": [ " if (!blocking_ && allRowsReceivedFromServer_ && daNullIndicator == 0xFF) {" ] } ] }, { "file": "java/client/org/apache/derby/client/net/NetDatabaseMetaData.java", "hunks": [ { "added": [ " /** True if the server supports QRYCLSIMP. */", " private boolean supportsQryclsimp_;" ], "header": "@@ -28,6 +28,8 @@ public class NetDatabaseMetaData extends org.apache.derby.client.am.DatabaseMeta", "removed": [] }, { "added": [ " //", " // WARNING WARNING WARNING !!!!", " //", " // If you define an instance variable of NetDatabaseMetaData that", " // you want computeFeatureSet_() to compute, DO NOT assign an", " // initial value to the variable in the", " // declaration. NetDatabaseMetaData's constructor will invoke", " // DatabaseMetaData's constructor, which then invokes", " // computeFeatureSet_(). Initialization of instance variables in", " // NetDatabaseMetaData will happen *after* the invocation of", " // computeFeatureSet_() and will therefore overwrite the computed", " // values. So, LEAVE INSTANCE VARIABLES UNINITIALIZED!", " //", " // END OF WARNING", " // Support for QRYCLSIMP was added in 10.2.0", " if (productLevel_.greaterThanOrEqualTo(10, 2, 0)) {", " supportsQryclsimp_ = true;", " } else {", " supportsQryclsimp_ = false;", " }" ], "header": "@@ -61,12 +63,32 @@ public class NetDatabaseMetaData extends org.apache.derby.client.am.DatabaseMeta", "removed": [] } ] }, { "file": "java/client/org/apache/derby/client/net/NetResultSet.java", "hunks": [ { "added": [ " while (netCursor_.calculateColumnOffsetsForRow_(row, true)) {" ], "header": "@@ -112,7 +112,7 @@ public class NetResultSet extends org.apache.derby.client.am.ResultSet {", "removed": [ " while (netCursor_.calculateColumnOffsetsForRow_(row)) {" ] }, { "added": [ " !netCursor_.allRowsReceivedFromServer() && !isRowsetCursor_ &&", " while (netCursor_.calculateColumnOffsetsForRow_(row, true)) {" ], "header": "@@ -124,10 +124,10 @@ public class NetResultSet extends org.apache.derby.client.am.ResultSet {", "removed": [ " !netCursor_.allRowsReceivedFromServer_ && !isRowsetCursor_ &&", " while (netCursor_.calculateColumnOffsetsForRow_(row)) {" ] } ] }, { "file": "java/client/org/apache/derby/client/net/NetSqldta.java", "hunks": [ { "added": [ " if (allRowsReceivedFromServer()) {", " setAllRowsReceivedFromServer(true);" ], "header": "@@ -31,10 +31,10 @@ public class NetSqldta extends NetCursor {", "removed": [ " if (allRowsReceivedFromServer_) {", " allRowsReceivedFromServer_ = true;" ] } ] }, { "file": "java/client/org/apache/derby/client/net/NetStatementReply.java", "hunks": [ { "added": [ " NetResultSet netResultSet = parseOPNQRYRM(statementI, false);" ], "header": "@@ -397,7 +397,7 @@ public class NetStatementReply extends NetPackageReply implements StatementReply", "removed": [ " NetResultSet netResultSet = parseOPNQRYRM(statementI);" ] }, { "added": [ " NetResultSet netResultSet = parseOPNQRYRM(statementI, true);" ], "header": "@@ -439,7 +439,7 @@ public class NetStatementReply extends NetPackageReply implements StatementReply", "removed": [ " NetResultSet netResultSet = parseOPNQRYRM(statementI);" ] }, { "added": [ " /**", " * Open Query Complete Reply Message indicates to the requester", " * that an OPNQRY or EXCSQLSTT command completed normally and that", " * the query process has been initiated. It also indicates the", " * type of query protocol and cursor used for the query.", " * <p>", " * When an EXCSQLSTT contains an SQL statement that invokes a", " * stored procedure, and the procedure completes, an OPNQRYRM is", " * returned for each answer set.", " *", " * @param statementI statement callback interface", " * @param isOPNQRYreply If true, parse a reply to an OPNQRY", " * command. Otherwise, parse a reply to an EXCSQLSTT command.", " * @return a <code>NetResultSet</code> value", " * @exception DisconnectException", " */", " protected NetResultSet parseOPNQRYRM(StatementCallbackInterface statementI,", " boolean isOPNQRYreply)", " throws DisconnectException", " {" ], "header": "@@ -694,13 +694,26 @@ public class NetStatementReply extends NetPackageReply implements StatementReply", "removed": [ " // Open Query Complete Reply Message indicates to the requester that", " // an OPNQRY or EXCSQLSTT command completed normally and that the query", " // process has been initiated. It also indicates the type of query protocol", " // and cursor used for the query.", " // When an EXCSQLSTT contains an SQL statement that invokes a stored procedure,", " // and the procedure completes, an OPNQRYRM is returned for each answer set.", " protected NetResultSet parseOPNQRYRM(StatementCallbackInterface statementI) throws DisconnectException {" ] } ] }, { "file": "java/client/org/apache/derby/client/net/NetStatementRequest.java", "hunks": [ { "added": [ " // Tell the server to close forward-only result sets", " // implicitly when they are exhausted. The server will ignore", " // this parameter if the result set is scrollable.", " if (netAgent_.netConnection_.serverSupportsQryclsimp()) {", " buildQRYCLSIMP();", " }", "" ], "header": "@@ -339,6 +339,13 @@ public class NetStatementRequest extends NetPackageRequest implements StatementR", "removed": [] } ] }, { "file": "java/drda/org/apache/derby/impl/drda/CodePointNameTable.java", "hunks": [ { "added": [ " put (new Integer (CodePoint.FRCFIXROW), \"FRCFIXROW\");" ], "header": "@@ -65,6 +65,7 @@ class CodePointNameTable extends java.util.Hashtable", "removed": [] } ] }, { "file": "java/drda/org/apache/derby/impl/drda/DRDAConnThread.java", "hunks": [ { "added": [ "\t\tif (!stmt.hasdata()) {", "\t\t\tfinal boolean qryclsOnLmtblkprc =", "\t\t\t\tappRequester.supportsQryclsimpForLmtblkprc();", "\t\t\tif (stmt.isRSCloseImplicit(qryclsOnLmtblkprc)) {", "\t\t\t\tstmt.rsClose();", "\t\t\t}" ], "header": "@@ -6043,9 +6043,12 @@ public class DRDAConnThread extends Thread {", "removed": [ "\t\tif( (!stmt.hasdata()) &&", "\t\t\tstmt.isRSCloseImplicit()) {", "\t\t\tstmt.rsClose();" ] } ] }, { "file": "java/drda/org/apache/derby/impl/drda/DRDAResultSet.java", "hunks": [ { "added": [ "\tprotected int qryclsimp;\t\t\t// Implicit Query Close Setting" ], "header": "@@ -59,7 +59,7 @@ class DRDAResultSet", "removed": [ "\tprivate int qryclsimp; // Implicit Query Close Setting" ] }, { "added": [ "\t\t// Initialize qryclsimp to NO. Only result sets requested by", "\t\t// an OPNQRY command should be implicitly closed. OPNQRY will", "\t\t// set qryclsimp later in setOPNQRYOptions().", "\t\tqryclsimp = CodePoint.QRYCLSIMP_NO;" ], "header": "@@ -92,6 +92,10 @@ class DRDAResultSet", "removed": [] } ] } ]
derby-DERBY-822-a10e4569
DERBY-822: Client driver: Pre-fetch data on executeQuery() This patch makes the network server include query data when it replies to an OPNQRY command. (Query data is only included when there are no LOB columns and the protocol is limited block protocol.) git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@394859 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/drda/org/apache/derby/impl/drda/DRDAConnThread.java", "hunks": [ { "added": [ " /**", " * Cleans up and closes a result set if an exception is thrown", " * when collecting QRYDTA in response to OPNQRY or CNTQRY.", " *", " * @param stmt the DRDA statement to clean up", " * @param sqle the exception that was thrown", " * @param writerMark start index for the first DSS to clear from", " * the output buffer", " * @exception DRDAProtocolException if a DRDA protocol error is", " * detected", " */", " private void cleanUpAndCloseResultSet(DRDAStatement stmt,", " SQLException sqle,", " int writerMark)", " throws DRDAProtocolException", " {", " if (stmt != null) {", " writer.clearDSSesBackToMark(writerMark);", " if (!stmt.rsIsClosed()) {", " try {", " stmt.rsClose();", " } catch (SQLException ec) {", " if (SanityManager.DEBUG) {", " trace(\"Warning: Error closing result set\");", " }", " }", " writeABNUOWRM();", " writeSQLCARD(sqle, CodePoint.SVRCOD_ERROR, 0, 0);", " }", " } else {", " writeSQLCARDs(sqle, 0);", " }", " errorInChain(sqle);", " }", "" ], "header": "@@ -574,6 +574,41 @@ class DRDAConnThread extends Thread {", "removed": [] }, { "added": [ "\t\t\t\t\t\t// if we got a SQLException we need to clean up and", "\t\t\t\t\t\t// close the result set Beetle 4758", "\t\t\t\t\t\tcleanUpAndCloseResultSet(stmt, e, writerMark);" ], "header": "@@ -614,30 +649,9 @@ class DRDAConnThread extends Thread {", "removed": [ "\t\t\t\t\t\tif (stmt != null)", " \t\t\t\t\t\t{", "\t\t\t\t\t\t\t// if we got a SQLException we need to clean up and", " \t\t\t\t\t\t\t// close the statement Beetle 4758", "\t\t\t\t\t\t\twriter.clearDSSesBackToMark(writerMark);", " \t\t\t\t\t\t\tif (! stmt.rsIsClosed())", " \t\t\t\t\t\t\t{", " \t\t\t\t\t\t\t\ttry {", " \t\t\t\t\t\t\t\t\tstmt.rsClose();", " \t\t\t\t\t\t\t\t}", " \t\t\t\t\t\t\t\tcatch (SQLException ec)", " \t\t\t\t\t\t\t\t{", " \t\t\t\t\t\t\t\t\tif (SanityManager.DEBUG)", " \t\t\t\t\t\t\t\t\t\ttrace(\"Warning: Error closing statement\");", "\t\t\t\t\t\t\t\t}", "\t\t\t\t\t\t\t\twriteABNUOWRM();", "\t\t\t\t\t\t\t\twriteSQLCARD(e,CodePoint.SVRCOD_ERROR,0,0);", "\t\t\t\t\t\t\t}", "\t\t\t\t\t\t}", "\t\t\t\t\t\telse ", "\t\t\t\t\t\t{", "\t\t\t\t\t\t\twriteSQLCARDs(e, 0);", "\t\t\t\t\t\t}", "\t\t\t\t\t\terrorInChain(e);" ] } ] }, { "file": "java/drda/org/apache/derby/impl/drda/DRDAResultSet.java", "hunks": [ { "added": [ "\tprotected boolean hasLobColumns() throws SQLException" ], "header": "@@ -439,7 +439,7 @@ class DRDAResultSet", "removed": [ "\tprivate boolean hasLobColumns()\tthrows SQLException" ] } ] } ]
derby-DERBY-822-fc6efec2
DERBY-1014: Make tests less sensitive to pre-fetching Attached a patch (DERBY-1014-v1.diff) which modifies tests in preparation for DERBY-822. There are two types of changes: 1) Invoke ResultSet.next() to expose error even when the driver isn't pre-fetching data. 2) Filter out some of the run-time statistics before comparing with the canon. lang/wisconsin.java: * Added patterns to the sed file. Cursor names and some of the run-time statistics are filtered out. * Canons for DerbyNet and DerbyNetClient were deleted since they are no longer needed. Each of these files is 1.5M, so the diff is huge. lang/scrollCursors1.sql: * Added patterns to the sed file. Number of rows seen and number of reads from hash table will be filtered out. jdbcapi/parameterMetaDataJdbc30.java: * Added a call to ResultSet.next() to provoke an error in a test case for DERBY-44 regardless of framework/pre-fetching. jdbcapi/resultset.java: * Don't print column headers until one row is successfully retrieved (achieved by calling ResultSet.next() earlier). jdbcapi/setTransactionIsolation.java: * Added a call to ResultSet.next() to provoke a timeout regardless of framework/pre-fetching. * Added patterns to the sed file. Filtered out number of pages visited, number of rows qualified/visited etc. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@387214 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-826-379f95fb
DERBY-826: Improve sysinfo behavior in situations where the Derby classes are loaded indirectly, such as through the manifest Class-Path attribute. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@394334 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/tools/org/apache/derby/impl/tools/sysinfo/Main.java", "hunks": [ { "added": [ " Copyright 1998, 2004, 2006 The Apache Software Foundation or its licensors, as applicable." ], "header": "@@ -2,7 +2,7 @@", "removed": [ " Copyright 1998, 2004 The Apache Software Foundation or its licensors, as applicable." ] }, { "added": [], "header": "@@ -44,7 +44,6 @@ import java.lang.reflect.Method;", "removed": [ "import java.security.PrivilegedAction;" ] }, { "added": [ " <P>", " Sysinfo reports values relevant to the current Derby configuration.", " Sysinfo looks for properties files in org.apache.derby.info named after", " the genus names in org.apache.derby.tools.sysinfo, and gets their location", " using getResource. It also searches the classpath and attempts to load", " the info properties files from the directory or jar locations on the", " classpath, and eliminates any duplicated information. If no files", " are found, or some other exception occurs, the" ], "header": "@@ -56,13 +55,16 @@ import org.apache.derby.iapi.tools.i18n.*;", "removed": [ " <i>Copyright &#169; 1998, Cloudscape, Inc. All rights reserved.</i>", " SysInfo reports values relevant to the Cloudscape product found on", " the CLASSPATH. It looks for a file called sysinfo.properties in", " the CLASSPATH using getResourceAsStream. If the file", " is not found, or some other exception occurs, the" ] }, { "added": [], "header": "@@ -381,8 +383,6 @@ public static void getMainInfo (java.io.PrintWriter aw, boolean pause) {", "removed": [ " \t", " \t" ] }, { "added": [ " /**", " * Get all the info we can obtain from the local execution context", " * as to the availability of the Derby classes by attempting to load", " * the info files with loadZipFromResource() and checking classpath", " * locations with checkForInfo if the classpath is accessible.", " *", " * @param classpath the classpath, or null if not accessible", " * @return an array of ZipInfoProperties with the locations of the located", " * resources", " * @see #loadZipFromResource()", " * @see #checkForInfo(String)", " */", " ZipInfoProperties zips[] = loadZipFromResource();", "", " // No info properties files found, but here we are in sysinfo.", " // Avoid an NPE in mergeZips by creating a ZipInfoProperties array", " // with the location of the sysinfo that is currently executing.", " if (zips == null)", " {", " zips = new ZipInfoProperties[1];", " ZipInfoProperties zip = new ZipInfoProperties(ProductVersionHolder.getProductVersionHolderFromMyEnv(org.apache.derby.tools.sysinfo.TOOLS));", " zip.setLocation(getFileWhichLoadedClass(new Main().getClass()));", " zips[0] = zip;", " }", "" ], "header": "@@ -719,8 +719,33 @@ public static void getMainInfo (java.io.PrintWriter aw, boolean pause) {", "removed": [] }, { "added": [ "\t\t\t\t\tZipInfoProperties cpzips[] = new ZipInfoProperties[v.size()];", "\t\t\t\t\tv.copyInto(cpzips);", "\t\t\t\t\treturn mergeZips(zips, cpzips);", " return mergeZips(zips, null);" ], "header": "@@ -736,12 +761,12 @@ public static void getMainInfo (java.io.PrintWriter aw, boolean pause) {", "removed": [ "\t\t\t\t\tZipInfoProperties zips[] = new ZipInfoProperties[v.size()];", "\t\t\t\t\tv.copyInto(zips);", "\t\t\t\t\treturn zips;", " return loadZipFromResource();" ] }, { "added": [ " * Attempt to load the info properties files specified in infoNames[i]", " * using getResourceAsStream(). If none are able to be loaded, return", " * a null array.", " *", " * @return An array of ZipInfoProperties with the locations from which", " * the info properties files were loaded.", " * @see #infoNames" ], "header": "@@ -754,10 +779,13 @@ public static void getMainInfo (java.io.PrintWriter aw, boolean pause) {", "removed": [ " This method returns exactly one ZipInfoProperty in the array.", " If it is able to load the sysinfo file as a resource, it returns", " the ZipInfoProperty associated with that. Otherwise, the ZipInfoProperty", " will be empty." ] }, { "added": [ " ", " // get the real location of the info file", " URL locUrl = (URL) AccessController.doPrivileged", " (new PrivilegedAction() {", " public Object run() {", " URL realUrl = new Main().getClass().getResource(resource);", " return realUrl;", " }", " });", "", "\t\t\tze.setLocation(formatURL(locUrl));" ], "header": "@@ -781,7 +809,17 @@ public static void getMainInfo (java.io.PrintWriter aw, boolean pause) {", "removed": [ "\t\t\tze.setLocation(resource);" ] }, { "added": [ " /**", " * Split the classpath into separate elements.", " *", " * @param cp the classpath, if accessible.", " * @return a String array with the individual classpath elements.", " */" ], "header": "@@ -798,6 +836,12 @@ public static void getMainInfo (java.io.PrintWriter aw, boolean pause) {", "removed": [] }, { "added": [ " /**", " * Given an individual element of the element of the classpath, call", " * checkDirectory() if the element is a directory or checkFile()", " * if the element is a file.", " *", " * @param cpEntry the classpath element", " * @return a ZipInfoProperties if an info properties file is found.", " */" ], "header": "@@ -815,6 +859,14 @@ public static void getMainInfo (java.io.PrintWriter aw, boolean pause) {", "removed": [] }, { "added": [ " /**", " * Check a given directory for the presence of an info properties file in", " * org/apache/derby/info inside the directory.", " *", " * @param dirname the directory to check as a String", " * @return a ZipInfoProperties if a file is found, otherwise null.", " */" ], "header": "@@ -835,10 +887,15 @@ public static void getMainInfo (java.io.PrintWriter aw, boolean pause) {", "removed": [ "", "" ] }, { "added": [ " /**", " * Check inside a jar file for the presence of a Derby info properties", " * file. There is a special case for db2jcc, which does not have a Derby", " * info propeties file. If db2jcc is in the filename, acquire DB2Driver", " * via reflection and get the version number from it.", " *", " * @param filename the jar file to check", " * @return ZipInfoProperties with the jar file set as the location", " * or null if not found.", " */" ], "header": "@@ -874,6 +931,16 @@ public static void getMainInfo (java.io.PrintWriter aw, boolean pause) {", "removed": [] }, { "added": [ " return formatURL(result);", " }", " });", " }", "", " /**", " * <P>", " * Merge and flatten two arrays of ZipInfoProperties, removing any ", " * duplicates. There may be duplicates in the arrays because", " * loadZipFromResource may find all the properties files in the same", " * location, such as when loading from compiled source instead of", " * packaged jars. Also, a poorly constructed classpath may contain", " * duplicate entries that each contain the Derby classes, and we", " * need only report the first of each such instances found.", " * <P>", " * The second array may be null if the classpath was empty, in which", " * case we still remove the duplicates from the first array and return ", " * the shortened array.", " *", " * @param zip1 the first array from loadZipWithResource", " * @param zip2 the second array from analyzing the classpath", " * @return the merged array", " */", " private static ZipInfoProperties[] mergeZips(ZipInfoProperties[] zip1,", " ZipInfoProperties[] zip2)", " {", " Vector v = new Vector();", " boolean foundDup = false;", " ", " // remove duplicates from first array", " for (int i = 0; i < zip1.length; i++)", " {", " if (zip1[i] != null && zip1.length > 1)", " {", " for (int j = i + 1; j < zip1.length; j++)", " if (zip1[i].getLocation().equals(zip1[j].getLocation()))", " zip1[j] = null;", " if (zip1[i] != null)", " v.addElement(zip1[i]);", " }", " ", " // if provided a second array, remove any locations in second array", " // still in first array.", " if (zip2 != null)", " {", " for (int j = 0; j < zip2.length; j++)", " {", " for (int k = 0; k < v.size(); k++)", " {", " ZipInfoProperties z = (ZipInfoProperties)v.get(k);", " if (zip2[j].getLocation().equals(z.getLocation()))", " foundDup = true;", " }", " if (!foundDup)", " {", " v.addElement(zip2[j]);", " }", " foundDup = false;", " }", " }", " ", " ZipInfoProperties[] merged = new ZipInfoProperties[v.size()];", " v.copyInto(merged);", " return merged;", "", " /**", " * Strip a given URL down to the filename. The URL will be a jarfile or", " * directory containing a Derby info properties file. Return the canonical", " * path for the filename, with the path separators normalized.", " */", " private static String formatURL(URL loc)", " {", " String filename = loc.toString();", "", " if (filename.startsWith(\"jar:\")) { filename = filename.substring(4); }", " if (filename.startsWith(\"file:\")) { filename = filename.substring(5); }", " if (filename.indexOf(\"!\") > -1) { filename = filename.substring(0, filename.indexOf(\"!\")); }", " if (filename.indexOf(\"/org/apache/derby\") > -1) { ", " filename = filename.substring(0, filename.indexOf(\"/org/apache/derby\")); ", " }", " if (filename.charAt(0) == '/' && ", " Character.isLetter(filename.charAt(1)) &&", " filename.charAt(2) == ':' &&", " filename.charAt(2) == '/') { filename = filename.substring(1); }", "", " String result = \"\"; ", " try {", " result = new File(filename).getCanonicalPath().replace('/', File.separatorChar);", " } catch (IOException e) {", " result = \"IOException\";", " }", " return result;", " }", "" ], "header": "@@ -1036,26 +1103,103 @@ public static void getMainInfo (java.io.PrintWriter aw, boolean pause) {", "removed": [ " String loc;", "", " // If the class is found directly as a class file, loc has the", " // filename of that classfile. If the class is found in a jar,", " // loc has the format: ", " // file:[jarName]!className", " // In that case, we fetch the jarName and return it.", " if (\"file\".equals(result.getProtocol()))", " {", " loc = result.getPath();", " if (loc.indexOf(\"!\") > 0)", " loc = loc.substring(0, loc.indexOf(\"!\"));", " }", " else", " loc = result.toString();", " return loc;", " });" ] } ] } ]
derby-DERBY-827-109cb266
DERBY-827 (partial) Performance can be improved by re-using language ResultSets across Activation executions Reset candidate row array between executions. Based on patch/ideas from Dyre Tjeldvoll. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@537353 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/execute/DependentResultSet.java", "hunks": [ { "added": [ "class DependentResultSet extends ScanResultSet implements CursorResultSet" ], "header": "@@ -58,7 +58,7 @@ import org.apache.derby.iapi.services.i18n.MessageService;", "removed": [ "class DependentResultSet extends NoPutResultSetImpl implements CursorResultSet" ] }, { "added": [], "header": "@@ -90,7 +90,6 @@ class DependentResultSet extends NoPutResultSetImpl implements CursorResultSet", "removed": [ "\tprotected\tExecRow\t\tcandidate;" ] }, { "added": [], "header": "@@ -111,9 +110,6 @@ class DependentResultSet extends NoPutResultSetImpl implements CursorResultSet", "removed": [ "\tpublic int isolationLevel;", "\tpublic int lockMode;", "" ] }, { "added": [ "\t\tint isolationLevel,\t\t// ignored" ], "header": "@@ -145,7 +141,7 @@ class DependentResultSet extends NoPutResultSetImpl implements CursorResultSet", "removed": [ "\t\tint isolationLevel," ] }, { "added": [ "\t\tsuper(activation, resultSetNumber, resultRowAllocator,", "\t\t\t lockMode, tableLocked,", "\t\t\t //Because the scan for the tables in this result set are done", "\t\t\t //internally for delete cascades, isolation should be set to", "\t\t\t //REPEATABLE READ irrespective what the user level isolation", "\t\t\t //level is.", "\t\t\t TransactionController.ISOLATION_REPEATABLE_READ,", "\t\t\t optimizerEstimatedRowCount, optimizerEstimatedCost);" ], "header": "@@ -156,10 +152,14 @@ class DependentResultSet extends NoPutResultSetImpl implements CursorResultSet", "removed": [ "\t\tsuper(activation,", "\t\t\t\tresultSetNumber,", "\t\t\t\toptimizerEstimatedRowCount,", "\t\t\t\toptimizerEstimatedCost);" ] }, { "added": [], "header": "@@ -206,31 +206,9 @@ class DependentResultSet extends NoPutResultSetImpl implements CursorResultSet", "removed": [ "\t\t", "\t\t//unless the table locking is specified in sys.systables,", "\t\t//irrespective of what optimizer says choose record level ", "\t\t//locking for dependent result sets.", "\t\tif (! tableLocked)", "\t\t{", "\t\t\tthis.lockMode = TransactionController.MODE_RECORD;", "\t\t}else", "\t\t{", "\t\t\tthis.lockMode = lockMode;", "\t\t}", "", "", "\t\t//Because the scan for the tables in this result set are done", "\t\t//internally for delete cascades, isolation should be set to", "\t\t//REPEATABLE READ irrespective what the user level isolation level is.", "\t\tthis.isolationLevel = TransactionController.ISOLATION_REPEATABLE_READ;", "", "\t\t/* Only call row allocators once */", "\t\tcandidate = (ExecRow) resultRowAllocator.invoke(activation);", "\t\t", "" ] }, { "added": [ "\t\tinitIsolationLevel();" ], "header": "@@ -552,7 +530,7 @@ class DependentResultSet extends NoPutResultSetImpl implements CursorResultSet", "removed": [ "" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/HashScanResultSet.java", "hunks": [ { "added": [], "header": "@@ -73,7 +73,6 @@ public class HashScanResultSet extends ScanResultSet", "removed": [ "\tprotected\tExecRow\t\tcandidate; // candidate row is sparse" ] }, { "added": [ "\t\t\t\tresultRowAllocator," ], "header": "@@ -153,6 +152,7 @@ public class HashScanResultSet extends ScanResultSet", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/LastIndexKeyResultSet.java", "hunks": [ { "added": [], "header": "@@ -57,8 +57,6 @@ import java.util.Properties;", "removed": [ "\tprotected\tExecRow\t\tcandidate;", "" ] }, { "added": [ "\t\t\t\tresultRowAllocator," ], "header": "@@ -128,6 +126,7 @@ class LastIndexKeyResultSet extends ScanResultSet", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/ScanResultSet.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.services.loader.GeneratedMethod;", "import org.apache.derby.iapi.sql.execute.ExecRow;" ], "header": "@@ -20,7 +20,9 @@", "removed": [] }, { "added": [ " /** The candidate row. */", " final ExecRow candidate;", "", " * @param resultRowAllocator method which generates rows" ], "header": "@@ -46,11 +48,15 @@ abstract class ScanResultSet extends NoPutResultSetImpl {", "removed": [] }, { "added": [ " GeneratedMethod resultRowAllocator,", " double optimizerEstimatedCost) throws StandardException {" ], "header": "@@ -58,9 +64,10 @@ abstract class ScanResultSet extends NoPutResultSetImpl {", "removed": [ " double optimizerEstimatedCost) {" ] }, { "added": [ "", " /* Only call row allocators once */", " candidate = (ExecRow) resultRowAllocator.invoke(activation);" ], "header": "@@ -78,6 +85,9 @@ abstract class ScanResultSet extends NoPutResultSetImpl {", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/TableScanResultSet.java", "hunks": [ { "added": [], "header": "@@ -80,7 +80,6 @@ class TableScanResultSet extends ScanResultSet", "removed": [ "\tprotected\tExecRow\t\tcandidate;" ] }, { "added": [ "\t\t\t\tresultRowAllocator," ], "header": "@@ -179,6 +178,7 @@ class TableScanResultSet extends ScanResultSet", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/store/access/heap/HeapRowLocation.java", "hunks": [ { "added": [ " /**", " * Recycle this HeapRowLocation object.", " *", " * @return this object reset to its initial state", " */", " public DataValueDescriptor recycle() {", " pageno = 0L;", " recid = 0;", " rh = null;", " return this;", " }", "" ], "header": "@@ -114,6 +114,18 @@ public class HeapRowLocation extends DataType implements RowLocation", "removed": [] } ] } ]
derby-DERBY-827-698ab621
DERBY-4204: Runtime statistics not collected on re-execution of statement Make sure NoRowsResultSetImpl.close() prints the collected runtime statistics each time close() is called on a result set that is not currently closed. After DERBY-827 close() didn't print the statistics if the result set had been closed and reopened. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@774281 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/execute/NoRowsResultSetImpl.java", "hunks": [ { "added": [], "header": "@@ -62,7 +62,6 @@ import org.apache.derby.iapi.types.DataValueDescriptor;", "removed": [ "\tprivate boolean dumpedStats;" ] }, { "added": [], "header": "@@ -344,7 +343,6 @@ abstract class NoRowsResultSetImpl implements ResultSet", "removed": [ "\t\tif (! dumpedStats)" ] } ] } ]
derby-DERBY-827-95e850d9
DERBY-827 (partial) Clean up generation of execute() method of activation to ensure that if the ResultSet is re-used then the execute actions are still called per-execute instead of once when the result set is created. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@521882 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/compile/ActivationClassBuilder.java", "hunks": [ { "added": [ "\tprivate\tMethodBuilder\tbeginExecuteMethod()" ], "header": "@@ -201,7 +201,7 @@ class ActivationClassBuilder\textends\tExpressionClassBuilder", "removed": [ "\tpublic\tMethodBuilder\tbeginExecuteMethod()" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/ExpressionClassBuilder.java", "hunks": [ { "added": [], "header": "@@ -178,28 +178,6 @@ abstract\tclass ExpressionClassBuilder implements ExpressionClassBuilderInterface", "removed": [ "\t/**", "\t * Build boiler plate for the Execute method", "\t *", "\t *", "\t *\t@return\ta method builder containing boiler plate for the Execute method", "\t *", "\t * \t@exception StandardException thrown on failure", "\t */", "\tabstract\tMethodBuilder\tbeginExecuteMethod()", "\t\tthrows StandardException;", "", "", "\t/**", "\t * Finish up the Execute method.", "\t *", "\t *", "\t * \t@exception StandardException thrown on failure", "\t */", "\tabstract\t\tvoid \t\t\tfinishExecuteMethod(boolean\t\tgenMarkAsTopNode )", "\t\tthrows StandardException;", "", "" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/SubqueryNode.java", "hunks": [ { "added": [ "\t\tMethodBuilder mb = acb.getExecuteMethod();" ], "header": "@@ -2075,7 +2075,7 @@ public class SubqueryNode extends ValueNode", "removed": [ "\t\tMethodBuilder mb = acb.executeMethod;" ] } ] } ]
derby-DERBY-827-a3363333
DERBY-827 (partial) Make MultiProbeTableScanResultSet reusable across executions. Patch contributed by A B <qozinx@gmail.com>. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@528973 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/execute/MultiProbeTableScanResultSet.java", "hunks": [ { "added": [ " /**", " * The values with which we will probe the table, as they were passed to", " * the constructor. We need to keep them unchanged in case the result set", " * is reused when a statement is re-executed (see DERBY-827).", " */", " protected DataValueDescriptor [] origProbeValues;", " /* Whether or not we need to sort the values. If all values were", " * specified as literals (as opposed to parameters) then we did the", " * sort at compile time and so we do not need to do it here." ], "header": "@@ -67,16 +67,21 @@ class MultiProbeTableScanResultSet extends TableScanResultSet", "removed": [ " /* Whether or not we need to sort the values (sorting should only", " * happen once). If all values were specified as literals (as", " * opposed to parameters) then we did the sort at compile time", " * and so we do not need to do it here." ] }, { "added": [ " this.origProbeValues = probingVals;" ], "header": "@@ -154,7 +159,7 @@ class MultiProbeTableScanResultSet extends TableScanResultSet", "removed": [ " this.probeValues = probingVals;" ] }, { "added": [ " new DataValueDescriptor[origProbeValues.length];", " pVals[i] = origProbeValues[i].getClone();", " else", " probeValues = origProbeValues;" ], "header": "@@ -183,17 +188,16 @@ class MultiProbeTableScanResultSet extends TableScanResultSet", "removed": [ " new DataValueDescriptor[probeValues.length];", " pVals[i] = probeValues[i].getClone();", "", " // Only sort once.", " needSort = false;" ] } ] } ]
derby-DERBY-827-b56d957e
DERBY-827 (partial) Performance can be improved by re-using language ResultSets across Activation executions. Set members to their initial values in ScrollInsensitiveResultSet's openCore() method. Contributed by Dyre Tjeldvoll. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@533003 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/execute/ScrollInsensitiveResultSet.java", "hunks": [ { "added": [ "\t\t// When re-using language result sets (DERBY-827) we need to", "\t\t// reset some member variables to the value they would have", "\t\t// had in a newly constructed object.", "\t\tlastPosition = 0;", "\t\tneedsRepositioning = false;", "\t\tnumFromHashTable = 0;", "\t\tnumToHashTable = 0;", "\t\tpositionInSource = 0;", "\t\tseenFirst = false;", "\t\tseenLast = false;", "" ], "header": "@@ -235,6 +235,17 @@ public class ScrollInsensitiveResultSet extends NoPutResultSetImpl", "removed": [] } ] } ]
derby-DERBY-827-c66c4e1d
DERBY-827 (partial) Test recreating the tables and changing the isolation level between executions. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@531820 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-827-f5d9f6c9
DERBY-827 (partial) Make sure MiscResultSet picks up a new ConstantAction after a recompile. Patch contributed by Dyre Tjeldvoll. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@531349 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/execute/MiscResultSet.java", "hunks": [ { "added": [ " * This is a wrapper class which invokes the Execution-time logic for", " * Misc statements. The real Execution-time logic lives inside the", " * executeConstantAction() method. Note that when re-using the", " * language result set tree across executions (DERBY-827) it is not", " * possible to store the ConstantAction as a member variable, because", " * a re-prepare of the statement will invalidate the stored", " * ConstantAction. Re-preparing a statement does not create a new", " * Activation unless the GeneratedClass has changed, so the existing", " * result set tree may survive a re-prepare." ], "header": "@@ -22,21 +22,23 @@", "removed": [ "import org.apache.derby.iapi.sql.execute.ConstantAction;", " *\tThis is a wrapper class which invokes the Execution-time logic for", " *\tMisc statements. The real Execution-time logic lives inside the", " *\texecuteConstantAction() method of the Execution constant.", " *", "\tprivate final ConstantAction constantAction;", "" ] }, { "added": [ "\t/**", "\t * Opens a MiscResultSet, executes the Activation's", "\t * ConstantAction, and then immediately closes the MiscResultSet.", "\t *", "\t * @exception StandardException Standard Derby error policy.", "\t */", "\t\tactivation.getConstantAction().executeConstantAction(activation);", "\t// Does not override close() (no action required)", "\t// Does not override finish() (no action required)", "", "\t * No action is required, but not implemented in any base class" ], "header": "@@ -48,16 +50,25 @@ class MiscResultSet extends NoRowsResultSetImpl", "removed": [ "\t\tconstantAction = activation.getConstantAction();", "\t\tconstantAction.executeConstantAction(activation);" ] } ] } ]
derby-DERBY-827-fbf13816
DERBY-827: Performance can be improved by re-using language ResultSets across Activation executions This patch enables re-use of language ResultSets. Contributed by Daniel John Debrunner. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@540921 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/execute/BaseActivation.java", "hunks": [ { "added": [], "header": "@@ -244,10 +244,6 @@ public abstract class BaseActivation implements CursorActivation, GeneratedByteC", "removed": [ "\tpublic void clearResultSet() {", "\t\tresultSet = null;", "\t}", "" ] }, { "added": [], "header": "@@ -315,7 +311,6 @@ public abstract class BaseActivation implements CursorActivation, GeneratedByteC", "removed": [ "\t\t\t\tresultSet = null; // forget about it, prepare for next exec." ] }, { "added": [], "header": "@@ -344,14 +339,6 @@ public abstract class BaseActivation implements CursorActivation, GeneratedByteC", "removed": [ "\t\t\t// we finish the result set before we call reset", "\t\t\t// because reset will set it to null.", "\t\t\tif (resultSet != null)", "\t\t\t{", "\t\t\t\tresultSet.finish();", "\t\t\t\tresultSet = null;", "\t\t\t}", "" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/NoPutResultSetImpl.java", "hunks": [ { "added": [], "header": "@@ -187,15 +187,6 @@ extends BasicNoPutResultSetImpl", "removed": [ "\t\t/*", "\t\t** If we are the activation's top result set, make it forget about", "\t\t** us, because we're closed now.", "\t\t*/", "\t\tif (activation.getResultSet() == this)", "\t\t{", "\t\t\tactivation.clearResultSet();", "\t\t}", "" ] } ] } ]
derby-DERBY-853-4afca481
DERBY-853: ResultSetMetaData.getScale returns inconsistent values This patch was contributed by Danoja Dias (danojadias at gmail dot com) When a SQL statement contains arithmetic expressions, the result of the expression may be of a different type than the operands to the expression, due to type precedence rules which may require promoting the operand values during evaluation of the expression. For example, subtracting a DOUBLE from a DECIMAL results in a DOUBLE. In some of these cases, Derby was reporting that the result column had a non-zero scale, although the result column was not of DECIMAL type. This change modifies the NumericTypeCompiler so that it only computes a non-zero scale for the result column when it is of DECIMAL type. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1755133 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/compile/NumericTypeCompiler.java", "hunks": [ { "added": [ "\t\t\tscale = higherTC.getScale(operator, leftType, rightType);" ], "header": "@@ -255,10 +255,10 @@ public final class NumericTypeCompiler extends BaseTypeCompiler", "removed": [ "\t\tscale = higherTC.getScale(operator, leftType, rightType);" ] }, { "added": [ "\t\t\tscale = 0;" ], "header": "@@ -271,6 +271,7 @@ public final class NumericTypeCompiler extends BaseTypeCompiler", "removed": [] } ] } ]
derby-DERBY-857-25449226
DERBY-857 LDAP Does not work under security manager. Wrap InitialDirContext and debug tracing in privilege blocks. Disable debug tracing if an exception occurs. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@586052 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/jdbc/authentication/LDAPAuthenticationSchemeImpl.java", "hunks": [ { "added": [ "import java.io.FileOutputStream;", "import java.io.IOException;", "import java.security.AccessController;", "import java.security.PrivilegedActionException;", "import java.security.PrivilegedExceptionAction;" ], "header": "@@ -37,6 +37,11 @@ import javax.naming.directory.*;", "removed": [] }, { "added": [ "", " DirContext ctx = privInitialDirContext(env);", " ", " " ], "header": "@@ -170,7 +175,10 @@ extends JNDIAuthenticationSchemeBase", "removed": [ "\t\t\tDirContext ctx = new InitialDirContext(env);" ] }, { "added": [ "\t", "", " /**", " * Call new InitialDirContext in a privilege block", " * @param env environment used to create the initial DirContext. Null indicates an empty environment.", " * @return an initial DirContext using the supplied environment. ", " */", " private DirContext privInitialDirContext(final Properties env) throws NamingException {", " try {", " return ((InitialDirContext)AccessController.doPrivileged(", " new PrivilegedExceptionAction() {", " public Object run() throws SecurityException, NamingException {", " return new InitialDirContext(env);", " }", " }));", " } catch (PrivilegedActionException pae) {", " Exception e = pae.getException();", " ", " if (e instanceof NamingException)", " throw (NamingException)e;", " else", " throw (SecurityException)e;", " } ", " ", " } ", "", " /**" ], "header": "@@ -189,7 +197,33 @@ extends JNDIAuthenticationSchemeBase", "removed": [ "\t/**" ] }, { "added": [ " ", " // This tracing needs some investigation and cleanup.", " // 1) It creates the file in user.dir instead of derby.system.home", " // 2) It doesn't seem to work. The file is empty after successful", " // and unsuccessful ldap connects. Perhaps the fileOutputStream", " // is never flushed and closed.", " // I (Kathey Marsden) wrapped this in a priv block and kept the previous", " // behaviour that it will not stop processing if file ", " // creation fails. Perhaps that should be investigated as well.", " FileOutputStream fos = null;", " try {", " fos = privNewFileOutputStream(\"DerbyLDAP.out\");", " } catch (Exception e) {", " // If file creation fails do not stop execution.", " }", " if (fos != null)", " initDirContextEnv.put(\"com.sun.naming.ldap.trace.ber\",fos);", "", "\t\t\t\t", "\t/**", " * Construct a new FileOutputStream in a privilege block.", " * ", "\t * @param fileName Filename to create", "\t * @return ", "\t * @throws IOException", "\t */", "\tprivate FileOutputStream privNewFileOutputStream(final String fileName) throws IOException{", "\t try {", " return ((FileOutputStream)AccessController.doPrivileged(", " new PrivilegedExceptionAction() {", " public Object run() throws SecurityException, java.io.IOException {", " return new FileOutputStream(fileName);", " }", " }));", " } catch (PrivilegedActionException pae) {", " throw (SecurityException)pae.getException();", " }", " }", "\t", "" ], "header": "@@ -353,14 +387,50 @@ extends JNDIAuthenticationSchemeBase", "removed": [ "\t\t\t\ttry {", "\t\t\t\t\tinitDirContextEnv.put(\"com.sun.naming.ldap.trace.ber\",", "\t\t\t\t\t\t\t\tnew java.io.FileOutputStream(\"CloudLDAP.out\"));", "\t\t\t\t} catch (java.io.IOException ie) {}" ] }, { "added": [ "\t\tDirContext ctx = privInitialDirContext(env);" ], "header": "@@ -389,7 +459,7 @@ extends JNDIAuthenticationSchemeBase", "removed": [ "\t\tDirContext ctx = new InitialDirContext(env);" ] } ] } ]
derby-DERBY-857-9c68d544
DERBY-857 Inline FileOutputStream privilege block. Fix javadoc warning git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@586599 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/jdbc/authentication/LDAPAuthenticationSchemeImpl.java", "hunks": [ { "added": [ " fos = ((FileOutputStream)AccessController.doPrivileged(", " new PrivilegedExceptionAction() {", " public Object run() throws SecurityException, java.io.IOException {", " return new FileOutputStream(\"DerbyLDAP.out\");", " }", " }));", " } catch (PrivilegedActionException pae) {", " // If trace file creation fails do not stop execution. " ], "header": "@@ -398,9 +398,14 @@ extends JNDIAuthenticationSchemeBase", "removed": [ " fos = privNewFileOutputStream(\"DerbyLDAP.out\");", " } catch (Exception e) {", " // If file creation fails do not stop execution." ] }, { "added": [ "\t", "\t" ], "header": "@@ -410,25 +415,8 @@ extends JNDIAuthenticationSchemeBase", "removed": [ "\t/**", " * Construct a new FileOutputStream in a privilege block.", " * ", "\t * @param fileName Filename to create", "\t * @return ", "\t * @throws IOException", "\t */", "\tprivate FileOutputStream privNewFileOutputStream(final String fileName) throws IOException{", "\t try {", " return ((FileOutputStream)AccessController.doPrivileged(", " new PrivilegedExceptionAction() {", " public Object run() throws SecurityException, java.io.IOException {", " return new FileOutputStream(fileName);", " }", " }));", " } catch (PrivilegedActionException pae) {", " throw (SecurityException)pae.getException();", " }", " }" ] } ] } ]
derby-DERBY-858-05829c13
DERBY-858 - ijConnName test output order is non-deterministic Also adjusted similarly vulnerable tests tools/ij5.sql, and junit tests derbynet.SysinfoTest and derbynet.ServerPropertiesTest git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@835153 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-862-9ec13b2c
DERBY-862: Commit bug 862_misc5.diff, more miscellaneous javadoc warnings. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@405210 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/client/org/apache/derby/client/am/ClientJDBCObjectFactory.java", "hunks": [ { "added": [ " * Returns an instance of LogicalConnection." ], "header": "@@ -78,7 +78,7 @@ public interface ClientJDBCObjectFactory {", "removed": [ " * Returns an instance of PreparedStatement" ] } ] }, { "file": "java/client/org/apache/derby/client/net/ClientJDBCObjectFactoryImpl.java", "hunks": [ { "added": [ " * @return a PreparedStatement object" ], "header": "@@ -118,7 +118,7 @@ public class ClientJDBCObjectFactoryImpl implements ClientJDBCObjectFactory{", "removed": [ " * @returns a PreparedStatement object" ] }, { "added": [ " * @return a PreparedStatement object" ], "header": "@@ -154,7 +154,7 @@ public class ClientJDBCObjectFactoryImpl implements ClientJDBCObjectFactory{", "removed": [ " * @returns a PreparedStatement object" ] } ] }, { "file": "java/client/org/apache/derby/client/net/ClientJDBCObjectFactoryImpl40.java", "hunks": [ { "added": [ " * Returns an instance of LogicalConnection.", " * This method returns an instance of LogicalConnection", " * (or LogicalConnection40) which implements java.sql.Connection." ], "header": "@@ -100,27 +100,9 @@ public class ClientJDBCObjectFactoryImpl40 implements ClientJDBCObjectFactory{", "removed": [ " * This method returns an instance of PreparedStatement", " * which implements java.sql.PreparedStatement. It has the", " * ClientPooledConnection as one of its parameters", " * this is used to raise the Statement Events when the prepared", " * statement is closed.", " *", " * @param agent The instance of NetAgent associated with this", " * CallableStatement object.", " * @param connection The connection object associated with this", " * PreparedStatement Object.", " * @param sql A String object that is the SQL statement to be sent", " * to the database.", " * @param section Section", " * @param cpc The ClientPooledConnection wraps the underlying physical", " * connection associated with this prepared statement.", " * It is used to pass the Statement closed and the Statement", " * error occurred events that occur back to the", " * ClientPooledConnection.", " * @returns a PreparedStatement object", " * @throws SqlException", " * Returns an instance of org.apache.derby.client.am.LogicalConnection40" ] }, { "added": [ " * @return a PreparedStatement object" ], "header": "@@ -165,7 +147,7 @@ public class ClientJDBCObjectFactoryImpl40 implements ClientJDBCObjectFactory{", "removed": [ " * @returns a PreparedStatement object" ] } ] }, { "file": "java/client/org/apache/derby/client/net/NetPreparedStatement.java", "hunks": [ { "added": [ " * @param netAgent The instance of NetAgent associated with this", " * @param netConnection The connection object associated with this" ], "header": "@@ -65,9 +65,9 @@ public class NetPreparedStatement extends NetStatement", "removed": [ " * @param agent The instance of NetAgent associated with this", " * @param netNonnection The connection object associated with this" ] }, { "added": [], "header": "@@ -84,7 +84,6 @@ public class NetPreparedStatement extends NetStatement", "removed": [ " * @returns a PreparedStatement object" ] } ] }, { "file": "java/drda/org/apache/derby/impl/drda/EXTDTAInputStream.java", "hunks": [ { "added": [], "header": "@@ -55,9 +55,6 @@ class EXTDTAInputStream extends InputStream {", "removed": [ "\t/**", "\t * @param binaryInputStream", "\t */" ] } ] } ]
derby-DERBY-866-04cfd282
DERBY-866: Add syscs_reset_password() and syscs_modify_password() system procedures. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1221423 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/catalog/SystemProcedures.java", "hunks": [ { "added": [], "header": "@@ -2054,7 +2054,6 @@ public class SystemProcedures {", "removed": [ " DataDescriptorGenerator ddg = dd.getDataDescriptorGenerator();" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.sql.dictionary.UserDescriptor;" ], "header": "@@ -64,6 +64,7 @@ import org.apache.derby.iapi.sql.dictionary.SubConstraintDescriptor;", "removed": [] }, { "added": [ "\t\t\t\t\t\t\t\t\t\t\t\t\"SYSCS_MODIFY_PASSWORD\"," ], "header": "@@ -455,6 +456,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ "\tpublic void updateUser( UserDescriptor newDescriptor,TransactionController tc )", "\t\tthrows StandardException", "\t{", "\t\tExecIndexRow\t\t\t\tkeyRow;", "\t\tTabInfoImpl\t\t\t\t\tti = getNonCoreTI( SYSUSERS_CATALOG_NUM );", "", "\t\t/* Set up the start/stop position for the scan */", "\t\tkeyRow = (ExecIndexRow) exFactory.getIndexableRow(1);", "\t\tkeyRow.setColumn( 1, new SQLVarchar( newDescriptor.getUserName() ) );", "", "\t\t// this zeroes out the password in the UserDescriptor", "\t\tExecRow row = ti.getCatalogRowFactory().makeRow( newDescriptor, null );", "", "\t\tboolean[] bArray = { false };", "", "\t\tint[] colsToUpdate =", " {", " SYSUSERSRowFactory.HASHINGSCHEME_COL_NUM,", " SYSUSERSRowFactory.PASSWORD_COL_NUM,", " SYSUSERSRowFactory.LASTMODIFIED_COL_NUM,", " };", "", "\t\tti.updateRow", " (", " keyRow, row,", " SYSUSERSRowFactory.SYSUSERS_INDEX1_ID,", " bArray, colsToUpdate, tc", " );", "\t}" ], "header": "@@ -7786,14 +7788,35 @@ public final class\tDataDictionaryImpl", "removed": [ "\t/** ", "\t * Drop a User from the DataDictionary", "\t *", "\t * @param userName The user to drop.", "\t * @param tc\tThe TransactionController", "\t *", "\t * @exception StandardException\t\tThrown on failure", "\t */" ] } ] }, { "file": "java/storeless/org/apache/derby/impl/storeless/EmptyDictionary.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.sql.dictionary.UserDescriptor;" ], "header": "@@ -60,6 +60,7 @@ import org.apache.derby.iapi.sql.dictionary.TableDescriptor;", "removed": [] } ] }, { "file": "java/testing/org/apache/derbyTesting/junit/CleanDatabaseTestSetup.java", "hunks": [ { "added": [ "", " // you can't drop the DBO's credentials. sorry.", " try {", " ps.executeUpdate();", " }", " catch (SQLException se)", " {", " if ( \"4251F\".equals( se.getSQLState() ) ) { continue; }", " else { throw se; }", " }" ], "header": "@@ -279,7 +279,16 @@ public class CleanDatabaseTestSetup extends BaseJDBCTestSetup {", "removed": [ " ps.executeUpdate();" ] } ] } ]
derby-DERBY-866-10f4b0f6
DERBY-866: Prevent credentials db from being created with empty username or password. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1297528 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java", "hunks": [ { "added": [ " // which is being created now. Allow this to succeed. However, here we make sure that", " // the credentials are legal. This prevents the credentials db from being", " // created with a bad DBO or password.", " String user = userInfo.getProperty(Attribute.USERNAME_ATTR);", " String password = userInfo.getProperty(Attribute.PASSWORD_ATTR);", "", " if ( emptyCredential( user ) || emptyCredential( password ) )", " {", " throw newSQLException( SQLState.AUTH_EMPTY_CREDENTIALS );", " }", " " ], "header": "@@ -1226,8 +1226,18 @@ public abstract class EmbedConnection implements EngineConnection", "removed": [ " // which is being created now. Allow this to succeed." ] }, { "added": [ " throw newSQLException(SQLState.NET_CONNECT_AUTH_FAILED,", " }" ], "header": "@@ -1256,9 +1266,9 @@ public abstract class EmbedConnection implements EngineConnection", "removed": [ "\t\t\tthrow newSQLException(SQLState.NET_CONNECT_AUTH_FAILED,", "\t\t}" ] } ] } ]
derby-DERBY-866-3b95c636
DERBY-866: Add tests for GRANT/REVOKE of execute permission on the NATIVE procs with NATIVE authentication turned on. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1245451 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-866-47f286f6
DERBY-866: Add tests for encrypted credentials db. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1294183 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/junit/ConnectionPoolDataSourceConnector.java", "hunks": [ { "added": [ "import java.util.Properties;" ], "header": "@@ -22,6 +22,7 @@ package org.apache.derbyTesting.junit;", "removed": [] }, { "added": [ " return singleUseDS( DataSourceConnector.makeCreateDBAttributes( config ) )." ], "header": "@@ -78,7 +79,7 @@ public class ConnectionPoolDataSourceConnector implements Connector {", "removed": [ " return singleUseDS(\"createDatabase\", \"create\")." ] }, { "added": [ " singleUseDS( DataSourceConnector.makeCreateDBAttributes( config ) );" ], "header": "@@ -100,7 +101,7 @@ public class ConnectionPoolDataSourceConnector implements Connector {", "removed": [ " singleUseDS(\"createDatabase\", \"create\");" ] }, { "added": [ " return singleUseDS( DataSourceConnector.makeCreateDBAttributes( config ) )." ], "header": "@@ -116,7 +117,7 @@ public class ConnectionPoolDataSourceConnector implements Connector {", "removed": [ " return singleUseDS(\"createDatabase\", \"create\")." ] }, { "added": [ " throws SQLException", " {", " return openConnection( databaseName, user, password, null );", " }", " ", " public Connection openConnection", " (String databaseName, String user, String password, Properties connectionProperties)", " throws SQLException", " {" ], "header": "@@ -124,7 +125,15 @@ public class ConnectionPoolDataSourceConnector implements Connector {", "removed": [ " throws SQLException {" ] }, { "added": [ " HashMap hm = DataSourceConnector.makeCreateDBAttributes( config );", " if ( connectionProperties != null ) { hm.putAll( connectionProperties ); }", " ConnectionPoolDataSource tmpDs = singleUseDS( hm );", " singleUseDS( DataSourceConnector.makeShutdownDBAttributes( config ) ).", " singleUseDS( DataSourceConnector.makeShutdownDBAttributes( config ) );" ], "header": "@@ -134,21 +143,22 @@ public class ConnectionPoolDataSourceConnector implements Connector {", "removed": [ " ConnectionPoolDataSource tmpDs =", " singleUseDS(\"createDatabase\", \"create\");", " singleUseDS(\"shutdownDatabase\", \"shutdown\").", " singleUseDS(\"shutdownDatabase\", \"shutdown\");" ] } ] }, { "file": "java/testing/org/apache/derbyTesting/junit/Connector.java", "hunks": [ { "added": [ "import java.util.Properties;" ], "header": "@@ -19,6 +19,7 @@", "removed": [] } ] }, { "file": "java/testing/org/apache/derbyTesting/junit/DataSourceConnector.java", "hunks": [ { "added": [ "import java.util.Properties;" ], "header": "@@ -22,6 +22,7 @@ package org.apache.derbyTesting.junit;", "removed": [] }, { "added": [ " return singleUseDS( makeCreateDBAttributes( config ) ).getConnection(); " ], "header": "@@ -64,7 +65,7 @@ public class DataSourceConnector implements Connector {", "removed": [ " return singleUseDS(\"createDatabase\", \"create\").getConnection(); " ] }, { "added": [ " DataSource tmpDs = singleUseDS( makeCreateDBAttributes( config ) );" ], "header": "@@ -84,7 +85,7 @@ public class DataSourceConnector implements Connector {", "removed": [ " DataSource tmpDs = singleUseDS(\"createDatabase\", \"create\");" ] }, { "added": [ " return singleUseDS( makeCreateDBAttributes( config ) ).getConnection", " (user, password); ", " throws SQLException", " {", " return openConnection( databaseName, user, password, null );", " }", " ", " public Connection openConnection", " (String databaseName, String user, String password, Properties connectionProperties)", " throws SQLException", " {" ], "header": "@@ -100,13 +101,21 @@ public class DataSourceConnector implements Connector {", "removed": [ " return singleUseDS(", " \"createDatabase\", \"create\").getConnection(user, password); ", " throws SQLException {" ] }, { "added": [ " HashMap hm = makeCreateDBAttributes( config );", " if ( connectionProperties != null ) { hm.putAll( connectionProperties ); }", " DataSource tmpDs = singleUseDS( hm );", " singleUseDS( makeShutdownDBAttributes( config ) ).getConnection(); ", " DataSource tmpDs = singleUseDS( makeShutdownDBAttributes( config ) );" ], "header": "@@ -116,18 +125,20 @@ public class DataSourceConnector implements Connector {", "removed": [ " DataSource tmpDs = singleUseDS(\"createDatabase\", \"create\");", " singleUseDS(\"shutdownDatabase\", \"shutdown\").getConnection(); ", " DataSource tmpDs = singleUseDS(\"shutdownDatabase\", \"shutdown\");" ] } ] }, { "file": "java/testing/org/apache/derbyTesting/junit/DriverManagerConnector.java", "hunks": [ { "added": [ " throws SQLException", " {", " return openConnection( databaseName, user, password, (Properties) null );", " }", " ", " /**", " * Open a connection using the DriverManager.", " * <BR>", " * The JDBC driver is only loaded if DriverManager.getDriver()", " * for the JDBC URL throws an exception indicating no driver is loaded.", " * <BR>", " * If the connection request fails with SQLState XJ004", " * (database not found) then the connection is retried", " * with attributes create=true.", " */", " public Connection openConnection", " (String databaseName, String user, String password, Properties connectionProperties)", " throws SQLException", " {" ], "header": "@@ -62,8 +62,25 @@ public class DriverManagerConnector implements Connector {", "removed": [ " throws SQLException {", "" ] } ] }, { "file": "java/testing/org/apache/derbyTesting/junit/XADataSourceConnector.java", "hunks": [ { "added": [ "import java.util.Properties;" ], "header": "@@ -22,6 +22,7 @@ package org.apache.derbyTesting.junit;", "removed": [] }, { "added": [ " return singleUseDS( DataSourceConnector.makeCreateDBAttributes( config ) )." ], "header": "@@ -65,7 +66,7 @@ public class XADataSourceConnector implements Connector {", "removed": [ " return singleUseDS(\"createDatabase\", \"create\")." ] }, { "added": [ " XADataSource tmpDs = singleUseDS( DataSourceConnector.makeCreateDBAttributes( config ) );" ], "header": "@@ -86,7 +87,7 @@ public class XADataSourceConnector implements Connector {", "removed": [ " XADataSource tmpDs = singleUseDS(\"createDatabase\", \"create\");" ] }, { "added": [ " return singleUseDS( DataSourceConnector.makeCreateDBAttributes( config ) ).", " throws SQLException", " {", " return openConnection( databaseName, user, password, null );", " }", " ", " public Connection openConnection", " (String databaseName, String user, String password, Properties connectionProperties)", " throws SQLException", " {" ], "header": "@@ -102,13 +103,21 @@ public class XADataSourceConnector implements Connector {", "removed": [ " return singleUseDS(\"createDatabase\", \"create\").", " throws SQLException {" ] }, { "added": [ " HashMap hm = DataSourceConnector.makeCreateDBAttributes( config );", " if ( connectionProperties != null ) { hm.putAll( connectionProperties ); }", " XADataSource tmpDs = singleUseDS( hm );", " singleUseDS( DataSourceConnector.makeShutdownDBAttributes( config ) )", " .getXAConnection().getConnection(); " ], "header": "@@ -118,14 +127,17 @@ public class XADataSourceConnector implements Connector {", "removed": [ " XADataSource tmpDs = singleUseDS(\"createDatabase\", \"create\");", " singleUseDS(\"shutdownDatabase\", \"shutdown\").getXAConnection().getConnection(); " ] }, { "added": [ " private XADataSource singleUseDS( HashMap hm )" ], "header": "@@ -136,10 +148,8 @@ public class XADataSourceConnector implements Connector {", "removed": [ " private XADataSource singleUseDS(String property, String value)", " HashMap hm = JDBCDataSource.getDataSourceProperties(config);", " hm.put(property, value);" ] } ] } ]
derby-DERBY-866-49901a4b
DERBY-866: Add expiration limits for NATIVE passwords. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1238727 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/jdbc/authentication/NativeAuthenticationServiceImpl.java", "hunks": [ { "added": [ "import java.sql.SQLWarning;" ], "header": "@@ -26,6 +26,7 @@ import java.security.MessageDigest;", "removed": [] }, { "added": [ "import org.apache.derby.iapi.error.SQLWarningFactory;" ], "header": "@@ -39,6 +40,7 @@ import org.apache.derby.iapi.sql.dictionary.UserDescriptor;", "removed": [] }, { "added": [ " private long _passwordLifetimeMillis = Property.AUTHENTICATION_NATIVE_PASSWORD_LIFETIME_DEFAULT;", " private double _passwordExpirationThreshold = Property.AUTHENTICATION_PASSWORD_EXPIRATION_THRESHOLD_DEFAULT;", " private String _badlyFormattedPasswordProperty;" ], "header": "@@ -87,6 +89,9 @@ public final class NativeAuthenticationServiceImpl", "removed": [] }, { "added": [ "", " //", " // Let the application override password lifespans.", " //", " _badlyFormattedPasswordProperty = null;", " String passwordLifetimeString = PropertyUtil.getPropertyFromSet", " (", " properties,", " Property.AUTHENTICATION_NATIVE_PASSWORD_LIFETIME", " );", " if ( passwordLifetimeString != null )", " {", " Long passwordLifetime = parsePasswordLifetime( passwordLifetimeString );", "", " if ( passwordLifetime != null ) { _passwordLifetimeMillis = passwordLifetime.longValue(); }", " else", " { _badlyFormattedPasswordProperty = Property.AUTHENTICATION_NATIVE_PASSWORD_LIFETIME; }", " }", "", " String expirationThresholdString = PropertyUtil.getPropertyFromSet", " (", " properties,", " Property.AUTHENTICATION_PASSWORD_EXPIRATION_THRESHOLD", " );", " if ( expirationThresholdString != null )", " {", " Double expirationThreshold = parsePasswordThreshold( expirationThresholdString );", "", " if ( expirationThreshold != null ) { _passwordExpirationThreshold = expirationThreshold.doubleValue(); }", " else", " { _badlyFormattedPasswordProperty = Property.AUTHENTICATION_PASSWORD_EXPIRATION_THRESHOLD; }", " }", " " ], "header": "@@ -149,6 +154,39 @@ public final class NativeAuthenticationServiceImpl", "removed": [] }, { "added": [ " if ( _badlyFormattedPasswordProperty != null )", " {", " throw StandardException.newException", " ( SQLState.BAD_PASSWORD_LIFETIME, _badlyFormattedPasswordProperty );", " }", "" ], "header": "@@ -178,6 +216,12 @@ public final class NativeAuthenticationServiceImpl", "removed": [] }, { "added": [ " throws StandardException, SQLWarning" ], "header": "@@ -340,7 +384,7 @@ public final class NativeAuthenticationServiceImpl", "removed": [ " throws StandardException" ] }, { "added": [ " SQLWarning warnings = null;", " " ], "header": "@@ -353,6 +397,8 @@ public final class NativeAuthenticationServiceImpl", "removed": [] }, { "added": [ "", " warnings = conn.getWarnings();" ], "header": "@@ -361,6 +407,8 @@ public final class NativeAuthenticationServiceImpl", "removed": [] }, { "added": [ " // let warnings percolate up so that EmbedConnection can handle notifications", " // about expiring passwords", " if ( warnings != null ) { throw warnings; }", "" ], "header": "@@ -378,6 +426,10 @@ public final class NativeAuthenticationServiceImpl", "removed": [] } ] }, { "file": "java/shared/org/apache/derby/shared/common/reference/SQLState.java", "hunks": [ { "added": [ "\tString BAD_PASSWORD_LIFETIME = \"4251J\";" ], "header": "@@ -783,6 +783,7 @@ public interface SQLState {", "removed": [] } ] } ]
derby-DERBY-866-601e027b
DERBY-866: Cleanup an NPE in NATIVE authentication and add some defensive code to frustrate blackhats. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1295189 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/jdbc/authentication/NativeAuthenticationServiceImpl.java", "hunks": [ { "added": [ " if ( userPassword == null ) { return false; }" ], "header": "@@ -284,6 +284,7 @@ public final class NativeAuthenticationServiceImpl", "removed": [] }, { "added": [ "" ], "header": "@@ -405,7 +406,7 @@ public final class NativeAuthenticationServiceImpl", "removed": [ " " ] }, { "added": [ " if ( userDescriptor == null )", " {", " //", " // Before returning, we pretend to evaluate the password.", " // This helps prevent blackhats from discovering legal usernames", " // by measuring how long password evaluation takes. For more context,", " // see the 2012-02-22 comment on DERBY-5539.", " //", " PasswordHasher hasher = dd.makePasswordHasher( getDatabaseProperties() );", " ", " hasher.hashPasswordIntoString( userName, userPassword ).toCharArray();", "", " return false;", " }" ], "header": "@@ -496,7 +497,20 @@ public final class NativeAuthenticationServiceImpl", "removed": [ " if ( userDescriptor == null ) { return false; }" ] } ] }, { "file": "java/testing/org/apache/derbyTesting/junit/DriverManagerConnector.java", "hunks": [ { "added": [ " if ( user != null ) { connectionAttributes.setProperty(\"user\", user); }", " if ( password != null ) { connectionAttributes.setProperty(\"password\", password); }" ], "header": "@@ -91,8 +91,8 @@ public class DriverManagerConnector implements Connector {", "removed": [ " connectionAttributes.setProperty(\"user\", user);", " connectionAttributes.setProperty(\"password\", password);" ] } ] } ]
derby-DERBY-866-61b02b72
DERBY-866: Add test for replicating databases when NATIVE authentication is on. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1294812 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-866-8e6d8a0c
DERBY-866: Add regression tests for GRANT/REVOKE on new procedures supporting NATIVE authentication. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1221456 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-866-92268ace
DERBY-866: Add syscs_create_user() and syscs_drop_user() system procedures. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1220807 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/catalog/SystemProcedures.java", "hunks": [ { "added": [ "import java.sql.Timestamp;" ], "header": "@@ -30,6 +30,7 @@ import java.sql.Statement;", "removed": [] }, { "added": [ "import org.apache.derby.iapi.sql.dictionary.UserDescriptor;" ], "header": "@@ -67,6 +68,7 @@ import org.apache.derby.iapi.sql.dictionary.DataDictionary;", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/catalog/types/BaseTypeIdImpl.java", "hunks": [ { "added": [ " case StoredFormatIds.PASSWORD_TYPE_ID_IMPL:" ], "header": "@@ -185,6 +185,7 @@ public class BaseTypeIdImpl implements Formatable", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/iapi/services/io/StoredFormatIds.java", "hunks": [ { "added": [ " /**", " class org.apache.derby.iapi.types.PasswordTypeId", " */", " static public final int PASSWORD_TYPE_ID =", " (MIN_ID_2 + 475);", " ", " /**", " class org.apache.derby.catalog.types.PasswordTypeIdImpl", " */", " static public final int PASSWORD_TYPE_ID_IMPL =", " (MIN_ID_2 + 476);", " " ], "header": "@@ -256,6 +256,18 @@ public interface StoredFormatIds {", "removed": [] }, { "added": [ " public static final int SQL_PASSWORD_ID = ", " (MIN_ID_2 + 477);", "" ], "header": "@@ -1517,6 +1529,9 @@ public interface StoredFormatIds {", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/iapi/sql/execute/ExecRow.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.error.StandardException;" ], "header": "@@ -21,6 +21,7 @@", "removed": [] }, { "added": [ "\tExecRow getClone() throws StandardException;" ], "header": "@@ -39,7 +40,7 @@ public interface ExecRow extends Row {", "removed": [ "\tExecRow getClone();" ] }, { "added": [ "\tExecRow getClone(FormatableBitSet clonedCols) throws StandardException;" ], "header": "@@ -50,7 +51,7 @@ public interface ExecRow extends Row {", "removed": [ "\tExecRow getClone(FormatableBitSet clonedCols);" ] } ] }, { "file": "java/engine/org/apache/derby/iapi/types/DataValueDescriptor.java", "hunks": [ { "added": [ " public DataValueDescriptor cloneHolder() throws StandardException;" ], "header": "@@ -326,7 +326,7 @@ public interface DataValueDescriptor extends Storable, Orderable", "removed": [ " public DataValueDescriptor cloneHolder();" ] } ] }, { "file": "java/engine/org/apache/derby/iapi/types/DataValueFactoryImpl.java", "hunks": [ { "added": [ " public StringDataValue getNullPassword(StringDataValue dataValue)", " {", " return new SQLPassword();", " }", " " ], "header": "@@ -806,6 +806,11 @@ abstract class DataValueFactoryImpl implements DataValueFactory, ModuleControl", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/iapi/types/SQLChar.java", "hunks": [ { "added": [ " setAndZeroOldValue( val );" ], "header": "@@ -235,27 +235,7 @@ public class SQLChar", "removed": [ " if ( val == null )", " {", " value = null;", " }", " else", " {", " int length = val.length;", " char[] localCopy = new char[ length ];", " System.arraycopy( val, 0, localCopy, 0, length );", " ", " copyState", " (", " null,", " localCopy,", " length,", " null,", " null,", " null,", " null", " );", " }" ] }, { "added": [ " throws StandardException", " if ( isNull() ) { return null; }", " char[] sourceValue = (rawData == null) ? getCharArray() : rawData;", "", " int length = sourceValue.length;", " System.arraycopy( sourceValue, 0, retval, 0, length );", " Arrays.fill( sourceValue, (char) 0 );", "", " setAndZeroOldValue( sourceValue );", " /**", " * <p>", " * This is a special setter for forcing this SQLChar to carry a password.", " * See the discussion of passwords on DERBY-866. This zeroes the old", " * character array and pokes in the new value.", " * </p>", " */", " public void setAndZeroOldValue( char[] val )", " {", " zeroRawData();", "", " if ( val == null )", " {", " value = null;", " }", " else", " {", " int length = val.length;", " char[] localCopy = new char[ length ];", " System.arraycopy( val, 0, localCopy, 0, length );", " ", " copyState", " (", " null,", " localCopy,", " length,", " null,", " null,", " null,", " null", " );", " }", " }", "" ], "header": "@@ -289,18 +269,57 @@ public class SQLChar", "removed": [ " if ( rawData == null ) { return null; }", " int length = rawData.length;", " System.arraycopy( rawData, 0, retval, 0, length );", " zeroRawData();" ] }, { "added": [ " public DataValueDescriptor cloneHolder() throws StandardException", " {" ], "header": "@@ -1398,7 +1417,8 @@ readingLoop:", "removed": [ " public DataValueDescriptor cloneHolder() {" ] } ] }, { "file": "java/engine/org/apache/derby/iapi/types/SQLPassword.java", "hunks": [ { "added": [ " Derby - Class org.apache.derby.iapi.types.SQLPassword" ], "header": "@@ -1,6 +1,6 @@", "removed": [ " Derby - Class org.apache.derby.iapi.types.SQLVarchar" ] }, { "added": [ "import java.util.Arrays;" ], "header": "@@ -23,6 +23,7 @@ package org.apache.derby.iapi.types;", "removed": [] }, { "added": [ " * SQLPassword represents a VARCHAR value with UCS_BASIC collation", " * which can only be used to wrap a char[]. See DERBY-866. This is a special", " * internal type which should never leak outside Derby into application code.", "public class SQLPassword extends SQLVarchar" ], "header": "@@ -31,14 +32,11 @@ import org.apache.derby.iapi.services.io.StoredFormatIds;", "removed": [ " * SQLVarchar represents a VARCHAR value with UCS_BASIC collation.", " *", " * SQLVarchar is mostly the same as SQLChar, so it is implemented as a", " * subclass of SQLChar. Only those methods with different behavior are", " * implemented here.", "public class SQLVarchar", "\textends SQLChar" ] }, { "added": [ "\t\treturn TypeId.PASSWORD_NAME;" ], "header": "@@ -48,7 +46,7 @@ public class SQLVarchar", "removed": [ "\t\treturn TypeId.VARCHAR_NAME;" ] }, { "added": [ " throws StandardException", " return new SQLPassword( getRawDataAndZeroIt() );" ], "header": "@@ -57,17 +55,9 @@ public class SQLVarchar", "removed": [ "\t\ttry", "\t\t{", "\t\t\treturn new SQLVarchar(getString());", "\t\t}", "\t\tcatch (StandardException se)", "\t\t{", "\t\t\tif (SanityManager.DEBUG)", "\t\t\t\tSanityManager.THROWASSERT(\"Unexpected exception\", se);", "\t\t\treturn null;", "\t\t}" ] }, { "added": [ "\t\treturn new SQLPassword();", " // passwords are never search/sorted or ever used in a collation-sensitive context", " return this;" ], "header": "@@ -76,22 +66,14 @@ public class SQLVarchar", "removed": [ "\t\treturn new SQLVarchar();", "\t\tif (collatorForComparison == null)", "\t\t{//null collatorForComparison means use UCS_BASIC for collation", "\t\t return this;\t\t\t", "\t\t} else {", "\t\t\t//non-null collatorForComparison means use collator sensitive", "\t\t\t//implementation of SQLVarchar", "\t\t CollatorSQLVarchar s = new CollatorSQLVarchar(collatorForComparison);", "\t\t s.copyState(this);", "\t\t return s;", "\t\t}" ] }, { "added": [ "\t\treturn StoredFormatIds.SQL_PASSWORD_ID;", "\tpublic SQLPassword()" ], "header": "@@ -105,25 +87,15 @@ public class SQLVarchar", "removed": [ "\t\treturn StoredFormatIds.SQL_VARCHAR_ID;", "\tpublic SQLVarchar()", "\t{", "\t}", "", "\tpublic SQLVarchar(String val)", "\t{", "\t\tsuper(val);", "\t}", "", "\tpublic SQLVarchar(Clob val)", "\t\tsuper(val);" ] }, { "added": [ " public SQLPassword( char[] val ) { super( val ); }", "\t * a value into a SQLPassword, for example, when inserting into a SQLPassword" ], "header": "@@ -134,11 +106,11 @@ public class SQLVarchar", "removed": [ " public SQLVarchar( char[] val ) { super( val ); }", "\t * a value into a SQLVarchar, for example, when inserting into a SQLVarchar" ] }, { "added": [ " if ( source == null )", " {", " throwLangSetMismatch(\"null\");", " }", " else if ( !(source instanceof SQLChar) )", " {", " throwLangSetMismatch( source.getClass().getName() );", " }", " else", " {", " normalize(desiredType, ((SQLChar) source).getRawDataAndZeroIt() );", " }", " /** The passed-in sourceValue may be zeroed out */", "\tprotected void normalize(DataTypeDescriptor desiredType, char[] sourceValue)", "\t\tint sourceWidth = sourceValue.length;", "\t\t** If the input is already the right length or shorter, no normalization is", " char[] result = sourceValue;", " ", "\t\tif (sourceWidth > desiredWidth)", " {", " result = new char[ desiredWidth ];", " System.arraycopy( sourceValue, 0, result, 0, desiredWidth );", " // we can't count on our caller to zero out the old array", " Arrays.fill( sourceValue, (char) 0 );", "\t\tsetAndZeroOldValue( result );", " protected void setFrom(DataValueDescriptor theValue) ", " throws StandardException ", " {", " if ( !(theValue instanceof SQLChar ) )", " {", " throwLangSetMismatch( theValue.getClass().getName() );", " }", " else", " {", " setAndZeroOldValue( ((SQLChar) theValue).getRawDataAndZeroIt() );", " }", " }" ], "header": "@@ -155,41 +127,60 @@ public class SQLVarchar", "removed": [ "\t\tnormalize(desiredType, source.getString());", "\tprotected void normalize(DataTypeDescriptor desiredType, String sourceValue)", "\t\tint sourceWidth = sourceValue.length();", "\t\t** If the input is already the right length, no normalization is", "\t\t**", "\t\t** It's OK for a Varchar value to be shorter than the desired width.", "\t\t** This can happen, for example, if you insert a 3-character Varchar", "\t\t** value into a 10-character Varchar column. Just return the value", "\t\t** in this case.", "\t\tif (sourceWidth > desiredWidth) {", "", "\t\t\thasNonBlankChars(sourceValue, desiredWidth, sourceWidth);", "\t\t\t/*", "\t\t\t** No non-blank characters will be truncated. Truncate the blanks", "\t\t\t** to the desired width.", "\t\t\t*/", "\t\t\tsourceValue = sourceValue.substring(0, desiredWidth);", "\t\tsetValue(sourceValue);" ] } ] }, { "file": "java/engine/org/apache/derby/iapi/types/TypeId.java", "hunks": [ { "added": [ " public static final String PASSWORD_NAME = \"PASSWORD\";" ], "header": "@@ -150,6 +150,7 @@ public final class TypeId", "removed": [] }, { "added": [ " public static final int PASSWORD_PRECEDENCE = 200;" ], "header": "@@ -210,6 +211,7 @@ public final class TypeId", "removed": [] }, { "added": [ " public static final TypeId PASSWORD_ID = create(", " StoredFormatIds.PASSWORD_TYPE_ID, StoredFormatIds.PASSWORD_TYPE_ID_IMPL);" ], "header": "@@ -245,6 +247,8 @@ public final class TypeId", "removed": [] }, { "added": [ "", " if ( tdi.getTypeId().getTypeFormatId() == StoredFormatIds.PASSWORD_TYPE_ID_IMPL )", " {", " return PASSWORD_ID;", " }", " " ], "header": "@@ -641,6 +645,12 @@ public final class TypeId", "removed": [] }, { "added": [ " private boolean isPasswordTypeId;" ], "header": "@@ -675,6 +685,7 @@ public final class TypeId", "removed": [] }, { "added": [ " case StoredFormatIds.PASSWORD_TYPE_ID:", " typePrecedence = PASSWORD_PRECEDENCE;", " javaTypeName = \"char[]\";", " maxMaxWidth = TypeId.VARCHAR_MAXWIDTH;", " isStringTypeId = true;", " isPasswordTypeId = true;", " isConcatableTypeId = true;", " break;", "" ], "header": "@@ -911,6 +922,15 @@ public final class TypeId", "removed": [] }, { "added": [ " /**", " * Does this TypeId represent a TypeId for a PASSWORD.", " *", " * @return Whether or not this TypeId represents a TypeId for a PASSWORD.", " */", " public boolean isPasswordTypeId()", " {", " return isPasswordTypeId;", " }", "" ], "header": "@@ -1027,6 +1047,16 @@ public final class TypeId", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/iapi/types/XML.java", "hunks": [ { "added": [ " boolean materialize)", " throws StandardException", " {" ], "header": "@@ -163,7 +163,9 @@ public class XML", "removed": [ " boolean materialize) {" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/GenericParameterValueSet.java", "hunks": [ { "added": [ " throws StandardException" ], "header": "@@ -79,6 +79,7 @@ final class GenericParameterValueSet implements ParameterValueSet", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java", "hunks": [ { "added": [ "\t/** ", "\t * Drop a User from the DataDictionary", "\t *", "\t * @param ad\tThe AliasDescriptor to drop", "\t * @param tc\tThe TransactionController", "\t *", "\t * @exception StandardException\t\tThrown on failure", "\t */", "", "\tpublic void dropUser( String userName, TransactionController tc )", "\t\t\tthrows StandardException", "\t{\t", "\t\tTabInfoImpl\t\t\t\t\tti = getNonCoreTI(SYSUSERS_CATALOG_NUM);", "", "\t\t/* Set up the start/stop position for the scan */", " ExecIndexRow keyRow1 = (ExecIndexRow) exFactory.getIndexableRow( 1 );", "\t\tkeyRow1.setColumn( 1, new SQLVarchar( userName ) );", "", "\t\tti.deleteRow( tc, keyRow1, SYSUSERSRowFactory.SYSUSERS_INDEX1_ID );", "\t}", "" ], "header": "@@ -7786,6 +7786,27 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " // add 10.9 specific system procedures", " create_10_9_system_procedures( tc, newlyCreatedRoutines );" ], "header": "@@ -11352,6 +11373,8 @@ public final class\tDataDictionaryImpl", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/TypeCompilerFactoryImpl.java", "hunks": [ { "added": [ " static TypeCompiler passwordTypeCompiler;" ], "header": "@@ -45,6 +45,7 @@ public class TypeCompilerFactoryImpl implements TypeCompilerFactory", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/IndexValueRow.java", "hunks": [ { "added": [ "\tpublic DataValueDescriptor[] getRowArrayClone()", " throws StandardException" ], "header": "@@ -69,7 +69,8 @@ class IndexValueRow implements ExecIndexRow {", "removed": [ "\tpublic DataValueDescriptor[] getRowArrayClone() " ] }, { "added": [ "\tpublic ExecRow getClone() throws StandardException {", "\tpublic ExecRow getClone(FormatableBitSet clonedCols) throws StandardException {" ], "header": "@@ -93,11 +94,11 @@ class IndexValueRow implements ExecIndexRow {", "removed": [ "\tpublic ExecRow getClone() {", "\tpublic ExecRow getClone(FormatableBitSet clonedCols) {" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/ValueRow.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.error.StandardException;" ], "header": "@@ -21,6 +21,7 @@", "removed": [] }, { "added": [ "\tpublic ExecRow getClone() throws StandardException", " throws StandardException" ], "header": "@@ -102,12 +103,13 @@ public class ValueRow implements ExecRow", "removed": [ "\tpublic ExecRow getClone() " ] }, { "added": [ " throws StandardException" ], "header": "@@ -168,6 +170,7 @@ public class ValueRow implements ExecRow", "removed": [] } ] }, { "file": "java/testing/org/apache/derbyTesting/junit/CleanDatabaseTestSetup.java", "hunks": [ { "added": [ " removeUsers( conn );" ], "header": "@@ -165,6 +165,7 @@ public class CleanDatabaseTestSetup extends BaseJDBCTestSetup {", "removed": [] } ] }, { "file": "java/testing/org/apache/derbyTesting/unitTests/store/T_AccessRow.java", "hunks": [ { "added": [ "\tpublic DataValueDescriptor[] getRowArrayClone()", " throws StandardException", " {" ], "header": "@@ -126,7 +126,9 @@ public class T_AccessRow", "removed": [ "\tpublic DataValueDescriptor[] getRowArrayClone() {" ] } ] } ]
derby-DERBY-866-92a2169d
DERBY-866: Add tests for NATIVE/LOCAL authentication in databases accessed via the jar and classpath subprotocols. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1244666 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/junit/TestConfiguration.java", "hunks": [ { "added": [ " /**", " * Open connection to the specified database using the supplied username and password.", " * Treat the database name as a physical database name rather than as a logical name", " * which needs to be mapped.", " * If the database does not exist, it will be created.", " * Requires that the test has been decorated with", " * additionalDatabaseDecorator with the matching name.", " * @param physicalDatabaseName The real database name to use.", " * @user name of user", " * @password password of user", " * @return connection to specified database.", " */", " public Connection openPhysicalConnection( String physicalDatabaseName, String user, String password )", " throws SQLException", " {", " return connector.openConnection", " (", " physicalDatabaseName,", " user,", " password", " );", " }", "" ], "header": "@@ -1688,6 +1688,29 @@ public final class TestConfiguration {", "removed": [] } ] } ]
derby-DERBY-866-9495437c
DERBY-866: Remove SQLPassword internal data type. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1222215 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/catalog/SystemProcedures.java", "hunks": [ { "added": [ " String password" ], "header": "@@ -2046,7 +2046,7 @@ public class SystemProcedures {", "removed": [ " char[] password" ] }, { "added": [ " UserDescriptor userDescriptor = makeUserDescriptor( lcc, userName, password.toCharArray() );" ], "header": "@@ -2066,7 +2066,7 @@ public class SystemProcedures {", "removed": [ " UserDescriptor userDescriptor = makeUserDescriptor( lcc, userName, password );" ] }, { "added": [ " String password" ], "header": "@@ -2104,7 +2104,7 @@ public class SystemProcedures {", "removed": [ " char[] password" ] }, { "added": [ " UserDescriptor userDescriptor = makeUserDescriptor( lcc, userName, password.toCharArray() );" ], "header": "@@ -2124,7 +2124,7 @@ public class SystemProcedures {", "removed": [ " UserDescriptor userDescriptor = makeUserDescriptor( lcc, userName, password );" ] } ] }, { "file": "java/engine/org/apache/derby/catalog/types/BaseTypeIdImpl.java", "hunks": [ { "added": [], "header": "@@ -185,7 +185,6 @@ public class BaseTypeIdImpl implements Formatable", "removed": [ " case StoredFormatIds.PASSWORD_TYPE_ID_IMPL:" ] } ] }, { "file": "java/engine/org/apache/derby/iapi/services/io/StoredFormatIds.java", "hunks": [ { "added": [], "header": "@@ -256,18 +256,6 @@ public interface StoredFormatIds {", "removed": [ " /**", " class org.apache.derby.iapi.types.PasswordTypeId", " */", " static public final int PASSWORD_TYPE_ID =", " (MIN_ID_2 + 475);", " ", " /**", " class org.apache.derby.catalog.types.PasswordTypeIdImpl", " */", " static public final int PASSWORD_TYPE_ID_IMPL =", " (MIN_ID_2 + 476);", " " ] }, { "added": [], "header": "@@ -1529,9 +1517,6 @@ public interface StoredFormatIds {", "removed": [ " public static final int SQL_PASSWORD_ID = ", " (MIN_ID_2 + 477);", "" ] } ] }, { "file": "java/engine/org/apache/derby/iapi/sql/execute/ExecRow.java", "hunks": [ { "added": [], "header": "@@ -21,7 +21,6 @@", "removed": [ "import org.apache.derby.iapi.error.StandardException;" ] }, { "added": [ "\tExecRow getClone();" ], "header": "@@ -40,7 +39,7 @@ public interface ExecRow extends Row {", "removed": [ "\tExecRow getClone() throws StandardException;" ] }, { "added": [ "\tExecRow getClone(FormatableBitSet clonedCols);" ], "header": "@@ -51,7 +50,7 @@ public interface ExecRow extends Row {", "removed": [ "\tExecRow getClone(FormatableBitSet clonedCols) throws StandardException;" ] } ] }, { "file": "java/engine/org/apache/derby/iapi/types/DataValueDescriptor.java", "hunks": [ { "added": [ " public DataValueDescriptor cloneHolder();" ], "header": "@@ -326,7 +326,7 @@ public interface DataValueDescriptor extends Storable, Orderable", "removed": [ " public DataValueDescriptor cloneHolder() throws StandardException;" ] } ] }, { "file": "java/engine/org/apache/derby/iapi/types/DataValueFactoryImpl.java", "hunks": [ { "added": [], "header": "@@ -806,11 +806,6 @@ abstract class DataValueFactoryImpl implements DataValueFactory, ModuleControl", "removed": [ " public StringDataValue getNullPassword(StringDataValue dataValue)", " {", " return new SQLPassword();", " }", " " ] } ] }, { "file": "java/engine/org/apache/derby/iapi/types/SQLChar.java", "hunks": [ { "added": [ " if ( val == null )", " {", " value = null;", " }", " else", " {", " int length = val.length;", " char[] localCopy = new char[ length ];", " System.arraycopy( val, 0, localCopy, 0, length );", " ", " copyState", " (", " null,", " localCopy,", " length,", " null,", " null,", " null,", " null", " );", " }" ], "header": "@@ -235,7 +235,27 @@ public class SQLChar", "removed": [ " setAndZeroOldValue( val );" ] }, { "added": [ " if ( rawData == null ) { return null; }", " int length = rawData.length;", " System.arraycopy( rawData, 0, retval, 0, length );", " return retval;" ], "header": "@@ -269,55 +289,16 @@ public class SQLChar", "removed": [ " throws StandardException", " if ( isNull() ) { return null; }", " char[] sourceValue = (rawData == null) ? getCharArray() : rawData;", "", " int length = sourceValue.length;", " System.arraycopy( sourceValue, 0, retval, 0, length );", "", " Arrays.fill( sourceValue, (char) 0 );", " setAndZeroOldValue( sourceValue );", "", " return retval;", " }", "", " /**", " * <p>", " * This is a special setter for forcing this SQLChar to carry a password.", " * See the discussion of passwords on DERBY-866. This zeroes the old", " * character array and pokes in the new value.", " * </p>", " */", " public void setAndZeroOldValue( char[] val )", " {", " if ( val == null )", " {", " value = null;", " }", " else", " {", " int length = val.length;", " char[] localCopy = new char[ length ];", " System.arraycopy( val, 0, localCopy, 0, length );", " ", " copyState", " (", " null,", " localCopy,", " length,", " null,", " null,", " null,", " null", " );", " }" ] }, { "added": [ " public DataValueDescriptor cloneHolder() {" ], "header": "@@ -1417,8 +1398,7 @@ readingLoop:", "removed": [ " public DataValueDescriptor cloneHolder() throws StandardException", " {" ] } ] }, { "file": "java/engine/org/apache/derby/iapi/types/TypeId.java", "hunks": [ { "added": [], "header": "@@ -150,7 +150,6 @@ public final class TypeId", "removed": [ " public static final String PASSWORD_NAME = \"PASSWORD\";" ] }, { "added": [], "header": "@@ -211,7 +210,6 @@ public final class TypeId", "removed": [ " public static final int PASSWORD_PRECEDENCE = 200;" ] }, { "added": [], "header": "@@ -247,8 +245,6 @@ public final class TypeId", "removed": [ " public static final TypeId PASSWORD_ID = create(", " StoredFormatIds.PASSWORD_TYPE_ID, StoredFormatIds.PASSWORD_TYPE_ID_IMPL);" ] }, { "added": [], "header": "@@ -645,12 +641,6 @@ public final class TypeId", "removed": [ "", " if ( tdi.getTypeId().getTypeFormatId() == StoredFormatIds.PASSWORD_TYPE_ID_IMPL )", " {", " return PASSWORD_ID;", " }", " " ] }, { "added": [], "header": "@@ -685,7 +675,6 @@ public final class TypeId", "removed": [ " private boolean isPasswordTypeId;" ] }, { "added": [], "header": "@@ -922,15 +911,6 @@ public final class TypeId", "removed": [ " case StoredFormatIds.PASSWORD_TYPE_ID:", " typePrecedence = PASSWORD_PRECEDENCE;", " javaTypeName = \"char[]\";", " maxMaxWidth = TypeId.VARCHAR_MAXWIDTH;", " isStringTypeId = true;", " isPasswordTypeId = true;", " isConcatableTypeId = true;", " break;", "" ] }, { "added": [], "header": "@@ -1047,16 +1027,6 @@ public final class TypeId", "removed": [ " /**", " * Does this TypeId represent a TypeId for a PASSWORD.", " *", " * @return Whether or not this TypeId represents a TypeId for a PASSWORD.", " */", " public boolean isPasswordTypeId()", " {", " return isPasswordTypeId;", " }", "" ] } ] }, { "file": "java/engine/org/apache/derby/iapi/types/XML.java", "hunks": [ { "added": [ " boolean materialize) {" ], "header": "@@ -163,9 +163,7 @@ public class XML", "removed": [ " boolean materialize)", " throws StandardException", " {" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/GenericParameterValueSet.java", "hunks": [ { "added": [], "header": "@@ -79,7 +79,6 @@ final class GenericParameterValueSet implements ParameterValueSet", "removed": [ " throws StandardException" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java", "hunks": [ { "added": [ " DataTypeDescriptor.getCatalogType( Types.VARCHAR, 32672 )" ], "header": "@@ -13048,7 +13048,7 @@ public final class\tDataDictionaryImpl", "removed": [ " DataTypeDescriptor.getPasswordDataTypeDescriptor( false )" ] }, { "added": [ " DataTypeDescriptor.getCatalogType( Types.VARCHAR, 32672 )" ], "header": "@@ -13079,7 +13079,7 @@ public final class\tDataDictionaryImpl", "removed": [ " DataTypeDescriptor.getPasswordDataTypeDescriptor( false )" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/TypeCompilerFactoryImpl.java", "hunks": [ { "added": [], "header": "@@ -45,7 +45,6 @@ public class TypeCompilerFactoryImpl implements TypeCompilerFactory", "removed": [ " static TypeCompiler passwordTypeCompiler;" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/IndexValueRow.java", "hunks": [ { "added": [ "\tpublic DataValueDescriptor[] getRowArrayClone() " ], "header": "@@ -69,8 +69,7 @@ class IndexValueRow implements ExecIndexRow {", "removed": [ "\tpublic DataValueDescriptor[] getRowArrayClone()", " throws StandardException" ] }, { "added": [ "\tpublic ExecRow getClone() {", "\tpublic ExecRow getClone(FormatableBitSet clonedCols) {" ], "header": "@@ -94,11 +93,11 @@ class IndexValueRow implements ExecIndexRow {", "removed": [ "\tpublic ExecRow getClone() throws StandardException {", "\tpublic ExecRow getClone(FormatableBitSet clonedCols) throws StandardException {" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/ValueRow.java", "hunks": [ { "added": [], "header": "@@ -21,7 +21,6 @@", "removed": [ "import org.apache.derby.iapi.error.StandardException;" ] }, { "added": [ "\tpublic ExecRow getClone() " ], "header": "@@ -103,13 +102,12 @@ public class ValueRow implements ExecRow", "removed": [ "\tpublic ExecRow getClone() throws StandardException", " throws StandardException" ] }, { "added": [], "header": "@@ -170,7 +168,6 @@ public class ValueRow implements ExecRow", "removed": [ " throws StandardException" ] } ] }, { "file": "java/testing/org/apache/derbyTesting/unitTests/store/T_AccessRow.java", "hunks": [ { "added": [ "\tpublic DataValueDescriptor[] getRowArrayClone() {" ], "header": "@@ -126,9 +126,7 @@ public class T_AccessRow", "removed": [ "\tpublic DataValueDescriptor[] getRowArrayClone()", " throws StandardException", " {" ] } ] } ]
derby-DERBY-866-9efa6492
DERBY-866: Add new upgrade test for NATIVE authentication and improve error raised when trying to read credentials in a database which hasn't been hard-upgraded to 10.9. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1236340 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-866-a3d7a74e
DERBY-866: Prevent authentication service from booting if NATIVE::LOCAL is specified at the system level. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1241479 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-866-a84fc267
DERBY-866: Wire the new NATIVE password-management procedures to the recently checked-in password hashing improvements. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1227150 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/catalog/SystemProcedures.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.sql.dictionary.PasswordHasher;" ], "header": "@@ -66,6 +66,7 @@ import org.apache.derby.iapi.sql.dictionary.CatalogRowFactory;", "removed": [] }, { "added": [ " UserDescriptor userDescriptor = makeUserDescriptor( lcc, userName, password );" ], "header": "@@ -2066,7 +2067,7 @@ public class SystemProcedures {", "removed": [ " UserDescriptor userDescriptor = makeUserDescriptor( lcc, userName, password.toCharArray() );" ] }, { "added": [ " String password", " PasswordHasher hasher = dd.makePasswordHasher( lcc.getTransactionExecute().getProperties() );", "", " if ( hasher == null )", " {", " throw StandardException.newException( SQLState.WEAK_AUTHENTICATION );", " }", " String hashingScheme = hasher.encodeHashingScheme();", " String hashedPassword = hasher.hashPasswordIntoString( userName, password );", " ( userName, hashingScheme, hashedPassword.toCharArray(), currentTimestamp );" ], "header": "@@ -2076,24 +2077,26 @@ public class SystemProcedures {", "removed": [ " char[] password", " //", " // FIXME: DERBY-866 Proper values need to be computed for the", " // following variables once Knut is done reworking builtin hashing.", " //", " String hashingScheme = \"???????\";", " char[] hashedPassword = password;", " ( userName, hashingScheme, hashedPassword, currentTimestamp );" ] } ] }, { "file": "java/engine/org/apache/derby/iapi/sql/dictionary/DataDictionary.java", "hunks": [ { "added": [ "import java.util.Dictionary;" ], "header": "@@ -41,6 +41,7 @@ import org.apache.derby.catalog.UUID;", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/jdbc/authentication/AuthenticationServiceBase.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.sql.dictionary.PasswordHasher;" ], "header": "@@ -49,6 +49,7 @@ import org.apache.derby.iapi.util.StringUtil;", "removed": [] }, { "added": [ " * {@link PasswordHasher#ID_PATTERN_SHA1_SCHEME}. Passwords that are stored using the", " * {@link PasswordHasher#ID_PATTERN_CONFIGURABLE_HASH_SCHEME} and suffixed with the name of" ], "header": "@@ -112,9 +113,9 @@ import org.apache.derby.iapi.reference.SQLState;", "removed": [ " * {@link #ID_PATTERN_SHA1_SCHEME}. Passwords that are stored using the", " * {@link #ID_PATTERN_CONFIGURABLE_HASH_SCHEME} and suffixed with the name of" ] }, { "added": [], "header": "@@ -132,46 +133,11 @@ public abstract class AuthenticationServiceBase", "removed": [ " /**", " * Pattern that is prefixed to the stored password in the SHA-1", " * authentication scheme.", " */", " public static final String ID_PATTERN_SHA1_SCHEME = \"3b60\";", "", " /**", " * Pattern that is prefixed to the stored password in the configurable", " * hash authentication scheme.", " */", " public static final String ID_PATTERN_CONFIGURABLE_HASH_SCHEME = \"3b61\";", "", " /**", " * Pattern that is prefixed to the stored password in the configurable", " * hash authentication scheme if key stretching has been applied. This", " * scheme extends the configurable hash scheme by adding a random salt and", " * applying the hash function multiple times when generating the hashed", " * token.", " */", " public static final String", " ID_PATTERN_CONFIGURABLE_STRETCHED_SCHEME = \"3b62\";", "", " /**", " * The encoding to use when converting the credentials to a byte array", " * that can be passed to the hash function in the configurable hash scheme.", " */", " private static final String ENCODING = \"UTF-8\";", "", " /**", " * Character that separates the hash value from the name of the hash", " * algorithm in the stored password generated by the configurable hash", " * authentication scheme.", " */", " static final char SEPARATOR_CHAR = ':';", "" ] }, { "added": [ " String hexString = PasswordHasher.ID_PATTERN_SHA1_SCHEME +" ], "header": "@@ -482,7 +448,7 @@ public abstract class AuthenticationServiceBase", "removed": [ " String hexString = ID_PATTERN_SHA1_SCHEME +" ] }, { "added": [], "header": "@@ -529,90 +495,6 @@ public abstract class AuthenticationServiceBase", "removed": [ " /**", " * <p>", " * Hash credentials using the specified hash algorithm, possibly performing", " * key stretching by adding random salt and applying the hash function", " * multiple times.", " * </p>", " *", " * <p>", " * The algorithm must be supported by one of the registered security", " * providers in the JVM.", " * </p>", " *", " * <p>", " * This method is only used by the configurable hash authentication scheme.", " * </p>", " *", " * @param user the user whose password to encrypt", " * @param password the plain text password", " * @param algorithm the hash algorithm to use", " * @param salt random salt to add to the credentials (possibly {@code null})", " * @param iterations the number of times to apply the hash function", " * @return a digest of the user name and password formatted as a string,", " * or {@code null} if {@code password} is {@code null}", " * @throws StandardException if the specified algorithm is not supported", " */", " String encryptPasswordConfigurableScheme(", " String user, String password, String algorithm,", " byte[] salt, int iterations)", " throws StandardException", " {", " if (password == null) {", " return null;", " }", "", " byte[] userBytes;", " byte[] passwordBytes;", " try {", " userBytes = user.getBytes(ENCODING);", " passwordBytes = password.getBytes(ENCODING);", " } catch (UnsupportedEncodingException uee) {", " // UTF-8 should always be available, so this should never happen.", " throw StandardException.plainWrapException(uee);", " }", "", " MessageDigest md;", " try {", " md = MessageDigest.getInstance(algorithm);", " } catch (NoSuchAlgorithmException nsae) {", " throw StandardException.newException(", " SQLState.DIGEST_NO_SUCH_ALGORITHM, nsae, algorithm);", " }", "", " byte[] digest = null;", " for (int i = 0; i < iterations; i++) {", " md.reset();", " if (digest != null) {", " md.update(digest);", " }", " md.update(userBytes);", " md.update(passwordBytes);", " if (salt != null) {", " md.update(salt);", " }", " digest = md.digest();", " }", "", " if ((salt == null || salt.length == 0) && iterations == 1) {", " // No salt was used, and only a single iteration, which is", " // identical to the default hashing scheme in 10.6-10.8. Generate", " // a token on a format compatible with those old versions.", " return ID_PATTERN_CONFIGURABLE_HASH_SCHEME +", " StringUtil.toHexString(digest, 0, digest.length) +", " SEPARATOR_CHAR + algorithm;", " } else {", " // Salt and/or multiple iterations was used, so we need to add", " // those parameters to the token in order to verify the credentials", " // later.", " return ID_PATTERN_CONFIGURABLE_STRETCHED_SCHEME +", " StringUtil.toHexString(digest, 0, digest.length) +", " SEPARATOR_CHAR + StringUtil.toHexString(salt, 0, salt.length) +", " SEPARATOR_CHAR + iterations + SEPARATOR_CHAR + algorithm;", " }", " }", "" ] }, { "added": [ " throws StandardException", " {", " if ( password == null ) { return null; }", " PasswordHasher hasher = getDataDictionary().makePasswordHasher( props );", " if ( hasher != null ) { return hasher.hashAndEncode( user, password ); }", " else { return encryptPasswordSHA1Scheme(password); }" ], "header": "@@ -639,100 +521,14 @@ public abstract class AuthenticationServiceBase", "removed": [ " throws StandardException {", " DataDictionary dd = getDataDictionary();", "", " // Support for configurable hash algorithm was added in Derby 10.6, so", " // we don't want to store a hash using the new scheme if the database", " // is running in soft upgrade and may be used with an older version", " // later.", " boolean supportConfigurableHash =", " dd.checkVersion(DataDictionary.DD_VERSION_DERBY_10_6, null);", "", " // Support for key stretching was added in Derby 10.9, so don't use it", " // if the database may still be used with an older version.", " boolean supportKeyStretching =", " dd.checkVersion(DataDictionary.DD_VERSION_DERBY_10_9, null);", "", " if (supportConfigurableHash) {", " String algorithm = (String)", " PropertyUtil.getPropertyFromSet(", " props,", " Property.AUTHENTICATION_BUILTIN_ALGORITHM);", "", " if (algorithm != null && algorithm.length() > 0) {", " byte[] salt = null;", " int iterations = 1;", "", " if (supportKeyStretching) {", " salt = generateRandomSalt(props);", " iterations = getIntProperty(", " props,", " Property.AUTHENTICATION_BUILTIN_ITERATIONS,", " Property.AUTHENTICATION_BUILTIN_ITERATIONS_DEFAULT,", " 1, Integer.MAX_VALUE);", " }", "", " return encryptPasswordConfigurableScheme(", " user, password, algorithm, salt, iterations);", " }", " }", "", " return encryptPasswordSHA1Scheme(password);", " }", "", " /**", " * Get the value of an integer property.", " *", " * @param props database properties", " * @param key the key of the property", " * @param defaultValue which value to return if the property is not set,", " * or if the property value is not in the valid range", " * @param minValue lowest property value to accept", " * @param maxValue highest property value to accept", " * @return the value of the property", " */", " private int getIntProperty(", " Dictionary props, String key,", " int defaultValue, int minValue, int maxValue) {", "", " String sVal = (String) PropertyUtil.getPropertyFromSet(props, key);", "", " if (sVal != null) {", " try {", " int i = Integer.parseInt(sVal);", " if (i >= minValue && i <= maxValue) {", " return i;", " }", " } catch (NumberFormatException nfe) {", " // By convention, Derby ignores property values that cannot be", " // parsed. Use the default value instead.", " }", " }", " return defaultValue;", " }", " /**", " * Generate an array of random bytes to use as salt when hashing", " * credentials.", " *", " * @param props database properties that possibly specify the desired", " * length of the salt", " * @return random bytes", " */", " private byte[] generateRandomSalt(Dictionary props) {", " int saltLength = getIntProperty(", " props,", " Property.AUTHENTICATION_BUILTIN_SALT_LENGTH,", " Property.AUTHENTICATION_BUILTIN_SALT_LENGTH_DEFAULT,", " 0, Integer.MAX_VALUE);", "", " SecureRandom random = new SecureRandom();", " byte[] salt = new byte[saltLength];", " random.nextBytes(salt);", "", " return salt;" ] }, { "added": [ " * SHA-1 authentication scheme ({@link PasswordHasher#ID_PATTERN_SHA1_SCHEME}), so in", " * hash authentication scheme {@link PasswordHasher#ID_PATTERN_CONFIGURABLE_HASH_SCHEME}" ], "header": "@@ -761,10 +557,10 @@ public abstract class AuthenticationServiceBase", "removed": [ " * SHA-1 authentication scheme ({@link #ID_PATTERN_SHA1_SCHEME}), so in", " * hash authentication scheme {@link #ID_PATTERN_CONFIGURABLE_HASH_SCHEME}" ] } ] }, { "file": "java/engine/org/apache/derby/impl/jdbc/authentication/BasicAuthenticationServiceImpl.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.sql.dictionary.PasswordHasher;" ], "header": "@@ -21,6 +21,7 @@", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.sql.dictionary.PasswordHasher;" ], "header": "@@ -46,6 +46,7 @@ import org.apache.derby.iapi.sql.dictionary.DefaultDescriptor;", "removed": [] }, { "added": [ "import java.security.SecureRandom;", "", "import java.util.Dictionary;" ], "header": "@@ -153,10 +154,13 @@ import org.apache.derby.iapi.services.locks.ShExLockable;", "removed": [] } ] }, { "file": "java/storeless/org/apache/derby/impl/storeless/EmptyDictionary.java", "hunks": [ { "added": [ "import java.util.Dictionary;" ], "header": "@@ -20,6 +20,7 @@", "removed": [] }, { "added": [ "import org.apache.derby.iapi.sql.dictionary.PasswordHasher;" ], "header": "@@ -47,6 +48,7 @@ import org.apache.derby.iapi.sql.dictionary.DataDictionary;", "removed": [] } ] } ]
derby-DERBY-866-aa1dc7a9
DERBY-866: Prevent anyone other than the DBO from turning on NATIVE authentication. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1328431 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/catalog/SystemProcedures.java", "hunks": [ { "added": [ " // the first credentials must be those of the DBO and only the DBO", " // can add them" ], "header": "@@ -2054,7 +2054,8 @@ public class SystemProcedures {", "removed": [ " // the first credentials must be those of the DBO" ] } ] } ]
derby-DERBY-866-aa609d54
DERBY-866: Add SYSUSERS table. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1212562 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/types/SQLChar.java", "hunks": [ { "added": [ "import java.util.Arrays;" ], "header": "@@ -72,6 +72,7 @@ import java.sql.Time;", "removed": [] }, { "added": [ " /**", " * <p>", " * This is a special constructor used when we need to represent a password", " * as a VARCHAR (see DERBY-866). If you need a general-purpose constructor", " * for char[] values and you want to re-use this constructor, make sure to", " * keep track of the following:", " * </p>", " *", " * <ul>", " * <li>A password should never be turned into a String. This is because Java", " * garbage collection makes it easy to sniff memory for String passwords. For", " * more information, see", " * <a href=\"http://securesoftware.blogspot.com/2009/01/java-security-why-not-to-use-string.html\">this blog</a>.</li>", " * <li>It must be possible to 0 out the char[] array wrapped inside this SQLChar. This", " * reduces the vulnerability that someone could sniff the char[] password after Derby", " * has processed it.</li>", " * </ul>", " */", " public SQLChar( char[] val )", " {", " if ( val == null )", " {", " value = null;", " }", " else", " {", " int length = val.length;", " char[] localCopy = new char[ length ];", " System.arraycopy( val, 0, localCopy, 0, length );", " ", " copyState", " (", " null,", " localCopy,", " length,", " null,", " null,", " null,", " null", " );", " }", " }", "" ], "header": "@@ -214,6 +215,49 @@ public class SQLChar", "removed": [] }, { "added": [ " /**", " * <p>", " * This is a special accessor used when we wrap passwords in VARCHARs.", " * This accessor copies the wrapped char[] and then fills it with 0s so that", " * the password can't be memory-sniffed. For more information, see the comment", " * on the SQLChar( char[] ) constructor.", " * </p>", " */", " public char[] getRawDataAndZeroIt()", " {", " if ( rawData == null ) { return null; }", "", " int length = rawData.length;", " char[] retval = new char[ length ];", " System.arraycopy( rawData, 0, retval, 0, length );", "", " zeroRawData();", "", " return retval;", " }", "", " /**", " * <p>", " * Zero out the wrapped char[] so that it can't be memory-sniffed.", " * This helps us protect passwords. See", " * the comment on the SQLChar( char[] ) constructor.", " * </p>", " */", " public void zeroRawData()", " {", " if ( rawData == null ) { return; }", "", " Arrays.fill( rawData, (char) 0 );", " }", "" ], "header": "@@ -236,6 +280,41 @@ public class SQLChar", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java", "hunks": [ { "added": [ "\t// as the non-core table numbers in DataDictionary." ], "header": "@@ -294,7 +294,7 @@ public final class\tDataDictionaryImpl", "removed": [ "\t// as the non-core table numbers, above." ] }, { "added": [ " \"SYSPERMS\",", " \"SYSUSERS\"" ], "header": "@@ -313,7 +313,8 @@ public final class\tDataDictionaryImpl", "removed": [ " \"SYSPERMS\"" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/FromBaseTable.java", "hunks": [ { "added": [ "import org.apache.derby.impl.sql.catalog.SYSUSERSRowFactory;" ], "header": "@@ -79,7 +79,7 @@ import org.apache.derby.iapi.store.access.TransactionController;", "removed": [ "" ] }, { "added": [ " // true if we are running with sql authorization and this is the SYSUSERS table", " private boolean authorizeSYSUSERS;", "" ], "header": "@@ -196,6 +196,9 @@ public class FromBaseTable extends FromTable", "removed": [] }, { "added": [ " //", " // Only the DBO can select from SYS.SYSUSERS.", " //", " authorizeSYSUSERS =", " dataDictionary.usesSqlAuthorization() &&", " tableDescriptor.getUUID().toString().equals( SYSUSERSRowFactory.SYSUSERS_UUID );", " if ( authorizeSYSUSERS )", " {", " String databaseOwner = dataDictionary.getAuthorizationDatabaseOwner();", " String currentUser = getLanguageConnectionContext().getStatementContext().getSQLSessionContext().getCurrentUser();", "", " if ( !databaseOwner.equals( currentUser ) )", " {", " throw StandardException.newException( SQLState.DBO_ONLY );", " }", " }", "" ], "header": "@@ -2382,6 +2385,23 @@ public class FromBaseTable extends FromTable", "removed": [] }, { "added": [ " return genProjectRestrict(numTables);" ], "header": "@@ -2709,7 +2729,7 @@ public class FromBaseTable extends FromTable", "removed": [ "\t\treturn genProjectRestrict(numTables);" ] } ] } ]
derby-DERBY-866-ae21afbc
DERBY-866: Add tests for system-wide authentication using a credentials db accessed via the jar and classpath protocols. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1245126 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-866-c0399dce
DERBY-866: Prevent illegal changes to the on-disk version of derby.authentication.provider. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1235750 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/services/property/PropertyUtil.java", "hunks": [ { "added": [ " //", " // Once NATIVE authentication has been set in the database, it cannot", " // be overridden.", " //", " if ( Property.AUTHENTICATION_PROVIDER_PARAMETER.equals( key ) )", " {", " String dbValue = PropertyUtil.getPropertyFromSet( true, set, key );", "", " if ( nativeAuthenticationEnabled( dbValue ) ) { return dbValue; }", " }", "" ], "header": "@@ -206,6 +206,17 @@ public class PropertyUtil {", "removed": [] }, { "added": [ " *Return true if NATIVE authentication has been enabled in the passed-in properties.", " */" ], "header": "@@ -563,8 +574,8 @@ public class PropertyUtil {", "removed": [ "\t\tReturn true if NATIVE authentication has been enabled in the passed-in properties.", "\t*/" ] } ] }, { "file": "java/engine/org/apache/derby/impl/jdbc/authentication/AuthenticationServiceBase.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.sql.dictionary.UserDescriptor;" ], "header": "@@ -50,6 +50,7 @@ import org.apache.derby.iapi.util.StringUtil;", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java", "hunks": [ { "added": [ " boolean nativeAuthenticationEnabled = PropertyUtil.nativeAuthenticationEnabled( startParams );", "" ], "header": "@@ -777,6 +777,8 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ "\t\t\t\tif ( PropertyUtil.getSystemBoolean(Property.SQL_AUTHORIZATION_PROPERTY) )", "\t\t\t\t}", "\t\t\t\tif ( PropertyUtil.getSystemBoolean(Property.SQL_AUTHORIZATION_PROPERTY) || nativeAuthenticationEnabled )", "\t\t\t\t{" ], "header": "@@ -807,17 +809,18 @@ public final class\tDataDictionaryImpl", "removed": [ " boolean nativeAuthenticationEnabled = PropertyUtil.nativeAuthenticationEnabled( startParams );", "", "\t\t\t\tif (PropertyUtil.getSystemBoolean(Property.SQL_AUTHORIZATION_PROPERTY) || nativeAuthenticationEnabled)" ] }, { "added": [ "\t\t\t\t\t\tusesSqlAuthorization = Boolean.valueOf(sqlAuth).booleanValue() || nativeAuthenticationEnabled;", "\t\t\t\t\tif (Boolean.valueOf(sqlAuth).booleanValue() || nativeAuthenticationEnabled) {" ], "header": "@@ -889,11 +892,10 @@ public final class\tDataDictionaryImpl", "removed": [ "\t\t\t\t\t\tusesSqlAuthorization = Boolean.valueOf(sqlAuth).", "\t\t\t\t\t\t\tbooleanValue();", "\t\t\t\t\tif (Boolean.valueOf(sqlAuth).booleanValue()) {" ] }, { "added": [ "\tpublic UserDescriptor getUser( String userName )" ], "header": "@@ -7926,7 +7928,7 @@ public final class\tDataDictionaryImpl", "removed": [ "\tpublic UserDescriptor getUser( String userName, TransactionController tc )" ] } ] }, { "file": "java/testing/org/apache/derbyTesting/junit/DatabaseChangeSetup.java", "hunks": [ { "added": [ "", " private TestConfiguration _myTestConfiguration;" ], "header": "@@ -31,6 +31,8 @@ public final class DatabaseChangeSetup extends ChangeConfigurationSetup {", "removed": [] } ] }, { "file": "java/testing/org/apache/derbyTesting/junit/TestConfiguration.java", "hunks": [ { "added": [ " {", " return additionalDatabaseDecoratorNoShutdown( test, logicalDbName, false );", " }", "", " /**", " * Similar to additionalDatabaseDecorator except the database will", " * not be shutdown, only deleted. It is the responsibility of the", " * test to shut it down.", " *", " * @param test Test to be decorated", " * @param logicalDbName The logical database name. This name is", " * used to identify the database in", " * openConnection(String logicalDatabaseName)", " * method calls.", " * @param defaultDB True if the database should store its own name in its TestConfiguration.", " * @return decorated test.", " */", " public static DatabaseChangeSetup additionalDatabaseDecoratorNoShutdown", " (", " Test test,", " String logicalDbName,", " boolean defaultDB", " )" ], "header": "@@ -789,6 +789,29 @@ public final class TestConfiguration {", "removed": [] }, { "added": [ " defaultDB);" ], "header": "@@ -800,7 +823,7 @@ public final class TestConfiguration {", "removed": [ " false);" ] } ] } ]
derby-DERBY-866-c1152a40
DERBY-866: Adjust RolesTest to account for new tuple in SYSROUTINEPERMS. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1221434 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-866-c5b9acbe
DERBY-866: Mark a database as a credentials DB iff the DBO's credentials are stored in SYS.SYSUSERS. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1302868 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/catalog/SystemProcedures.java", "hunks": [ { "added": [ " // the first credentials must be those of the DBO", " try {", " DataDictionary dd = lcc.getDataDictionary();", " String dbo = dd.getAuthorizationDatabaseOwner();", "", " if ( !dbo.equals( userName ) )", " {", " if ( dd.getUser( dbo ) == null )", " {", " throw StandardException.newException( SQLState.DBO_FIRST );", " }", " }", " } catch (StandardException se) { throw PublicAPI.wrapStandardException(se); }", "" ], "header": "@@ -2054,6 +2054,20 @@ public class SystemProcedures {", "removed": [] } ] }, { "file": "java/shared/org/apache/derby/shared/common/reference/SQLState.java", "hunks": [ { "added": [ "\tString DBO_FIRST = \"4251K\";" ], "header": "@@ -786,6 +786,7 @@ public interface SQLState {", "removed": [] } ] } ]
derby-DERBY-866-dc9cd0fe
DERBY-866: Add test for database restoration using NATIVE authentication. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1240152 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java", "hunks": [ { "added": [ "" ], "header": "@@ -459,7 +459,7 @@ final public class NetworkServerTestSetup extends BaseTestSetup {", "removed": [ " " ] }, { "added": [ " !(failedShutdown instanceof SQLException)" ], "header": "@@ -468,8 +468,7 @@ final public class NetworkServerTestSetup extends BaseTestSetup {", "removed": [ " !(failedShutdown instanceof SQLException) ||", " !( \"4251I\".equals( ((SQLException) failedShutdown).getSQLState() ) )" ] } ] } ]
derby-DERBY-876-97b7bcee
DERBY-876: DatabaseMetaData.getSchemas() is not JDBC 3.0 compliant Added missing column to the result set returned by EmbedDatabaseMetaData.getSchemas(). git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@395878 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/jdbc/EmbedDatabaseMetaData.java", "hunks": [ { "added": [ " * <P>The schema columns are:", " * <li><strong>TABLE_SCHEM</strong> String =&gt; schema name</li>", " * <li><strong>TABLE_CATALOG</strong> String =&gt; catalog name", " * (may be <code>null</code>)</li>", " * @return ResultSet - each row is a schema description", "\t\treturn getSchemas(null, null);" ], "header": "@@ -1733,17 +1733,18 @@ public class EmbedDatabaseMetaData extends ConnectionChild", "removed": [ " * <P>The schema column is:", " *\t<LI><B>TABLE_SCHEM</B> String => schema name", " * @return ResultSet - each row has a single String column that is a", " * schema name", "\t\treturn getSimpleQuery(\"getSchemas\");" ] } ] } ]
derby-DERBY-877-491c5b6e
DERBY-877 zOS - with DerbyClient getDate(#) fails with IllegalArgumentException - unsupported date format - resultset.java The patch fixes issues with getString, getTimeStamp, getDate and getTime on TIMESTAMP, DATE and TIME columns when the client JVM encoding does not match the server encoding for the characters being evaluated in DateTime.java methods - Changes the following methods in DateTime.java to take encoding parameter and create string based on encoding. dateBytesToDate, timeBytesToTime, timeBytesToTimeStamp, dateBytesToTimeStamp, timestampBytesToDate, timestampBytesToTime - Changes calling code to pass column encoding and throw SQLExceptions for UnsupportedEncoding exceptions if thrown from the methods above. Tests: derbyall passed as did the repro attached to this issue on Windows with Sun JDK 1.5 . Verified on zOS git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@374271 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/client/org/apache/derby/client/am/Cursor.java", "hunks": [ { "added": [ "import java.io.UnsupportedEncodingException;" ], "header": "@@ -19,10 +19,10 @@", "removed": [ "" ] } ] }, { "file": "java/client/org/apache/derby/client/am/DateTime.java", "hunks": [ { "added": [ "import java.io.UnsupportedEncodingException;", "" ], "header": "@@ -19,6 +19,8 @@", "removed": [] }, { "added": [ " * Expected character representation is DERBY string representation of a date, ", " * which is in JIS format: <code> yyyy-mm-dd </code>", " * ", " * @param buffer ", " * @param offset ", " * @param recyclableDate", " * @param encoding encoding of buffer data", " * @return", " * @throws UnsupportedEncodingException", " java.sql.Date recyclableDate, ", " String encoding) ", " throws UnsupportedEncodingException {", " String date = new String(buffer, offset, ", " DateTime.dateRepresentationLength,encoding);" ], "header": "@@ -44,15 +46,25 @@ public class DateTime {", "removed": [ " * Expected character representation is DERBY string representation of a date, which is in one of the following", " * format.", " java.sql.Date recyclableDate) {", " String date = new String(buffer, offset, DateTime.dateRepresentationLength);" ] }, { "added": [ " ", " * Expected character representation is DERBY string representation of time,", " * which is in the format: <code> hh.mm.ss </code>", " * @param buffer", " * @param offset", " * @param recyclableTime", " * @param encoding encoding of buffer", " * @return", " * @throws UnsupportedEncodingException", " java.sql.Time recyclableTime,", " String encoding) ", " throws UnsupportedEncodingException {", " String time = new String(buffer, offset, ", " DateTime.timeRepresentationLength, encoding);" ], "header": "@@ -90,16 +102,26 @@ public class DateTime {", "removed": [ " * Expected character representation is DERBY string representation of a time, which is in one of the following", " * format: hh.mm.ss.", " java.sql.Time recyclableTime) {", " String time = new String(buffer, offset, DateTime.timeRepresentationLength);" ] }, { "added": [ " * ", " * @param buffer", " * @param offset", " * @param recyclableTimestamp", " * @param encoding encoding of buffer", " * @return", " * @throws UnsupportedEncodingException", " java.sql.Timestamp recyclableTimestamp, ", " String encoding) ", " throws UnsupportedEncodingException", " {", " String timestamp = new String(buffer, offset, ", " DateTime.timestampRepresentationLength,encoding);", " " ], "header": "@@ -128,13 +150,24 @@ public class DateTime {", "removed": [ " java.sql.Timestamp recyclableTimestamp) {", "", " String timestamp = new String(buffer, offset, DateTime.timestampRepresentationLength);" ] }, { "added": [ " ", " * Expected character representation is DERBY string representation of a date", " * which is in JIS format: <code> yyyy-mm-dd </code>", " * ", " * @param buffer", " * @param offset", " * @param recyclableTimestamp", " * @param encoding encoding of buffer", " * @return", " * @throws UnsupportedEncodingException", " java.sql.Timestamp recyclableTimestamp,", " String encoding) ", " throws UnsupportedEncodingException {", " String date = new String(buffer, offset, DateTime.dateRepresentationLength,", " encoding);" ], "header": "@@ -301,16 +334,27 @@ public class DateTime {", "removed": [ " * Expected character representation is DERBY string representation of a date, which is in one of the following", " * format.", " java.sql.Timestamp recyclableTimestamp) {", " String date = new String(buffer, offset, DateTime.dateRepresentationLength);" ] }, { "added": [ " ", " * Expected character representation is DERBY string representation of time", " * which is in the format: <code> hh.mm.ss </code>", " * ", " * @param buffer", " * @param offset", " * @param recyclableTimestamp", " * @param encoding encoding of buffer", " * @return ", " * @throws UnsupportedEncodingException", " * ", " java.sql.Timestamp recyclableTimestamp, ", " String encoding)", " throws UnsupportedEncodingException {", " String time = new String(buffer, offset, ", " DateTime.timeRepresentationLength, encoding);" ], "header": "@@ -348,16 +392,28 @@ public class DateTime {", "removed": [ " * Expected character representation is DERBY string representation of a time, which is in one of the following", " * format.", " java.sql.Timestamp recyclableTimestamp) {", " String time = new String(buffer, offset, DateTime.timeRepresentationLength);" ] }, { "added": [ " ", " ", " * ", " * @param buffer", " * @param offset", " * @param recyclableDate", " * @param encoding encoding of buffer", " * @return", " * @throws UnsupportedEncodingException", " java.sql.Date recyclableDate, ", " String encoding) ", " throws UnsupportedEncodingException ", " {", " String timestamp = new String(buffer, offset, ", " DateTime.timestampRepresentationLength, encoding);" ], "header": "@@ -386,17 +442,29 @@ public class DateTime {", "removed": [ "", " java.sql.Date recyclableDate) {", " String timestamp = new String(buffer, offset, DateTime.timestampRepresentationLength);" ] }, { "added": [ " ", " * ", " * @param buffer", " * @param offset", " * @param recyclableTime", " * @param encoding encoding of buffer", " * @return", " * @throws UnsupportedEncodingException", " java.sql.Time recyclableTime, ", " String encoding) ", " throws UnsupportedEncodingException {", " String timestamp = new String(buffer, offset, ", " DateTime.timestampRepresentationLength, encoding);" ], "header": "@@ -423,16 +491,27 @@ public class DateTime {", "removed": [ " java.sql.Time recyclableTime) {", " String timestamp = new String(buffer, offset, DateTime.timestampRepresentationLength);" ] } ] } ]
derby-DERBY-877-b69e1e8f
DERBY-877 second patch to fix javadoc warnings git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@374585 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/client/org/apache/derby/client/am/DateTime.java", "hunks": [ { "added": [ " * @return Date translated from buffer with specified encoding" ], "header": "@@ -53,7 +53,7 @@ public class DateTime {", "removed": [ " * @return" ] }, { "added": [ " * @return Time translated from buffer with specified encoding" ], "header": "@@ -110,7 +110,7 @@ public class DateTime {", "removed": [ " * @return" ] }, { "added": [ " * @return TimeStamp translated from buffer with specified encoding" ], "header": "@@ -155,7 +155,7 @@ public class DateTime {", "removed": [ " * @return" ] }, { "added": [ " * @return Timestamp translated from buffer with specified encoding" ], "header": "@@ -343,7 +343,7 @@ public class DateTime {", "removed": [ " * @return" ] }, { "added": [ " * @return Timestamp translated from buffer with specified encoding " ], "header": "@@ -401,7 +401,7 @@ public class DateTime {", "removed": [ " * @return " ] }, { "added": [ " * @return Date translated from buffer with specified encoding" ], "header": "@@ -452,7 +452,7 @@ public class DateTime {", "removed": [ " * @return" ] }, { "added": [ " * @return Time translated from buffer with specified Encoding" ], "header": "@@ -500,7 +500,7 @@ public class DateTime {", "removed": [ " * @return" ] } ] } ]
derby-DERBY-885-9082f658
DERBY-1785 contributed by Myrna van Lunteren patch: DERBY-1785_20061007.diff Attaching a band-aid patch for this issue. I chose to comment out the method rather than remove as a way to document the quirky behavior. Having the method setSecurityProps overload the one in jvm.java causes problems when running the junit tests - they *do* successfully run with securityManager. Foundation class tests actually run ok with security manager - except when useprocess is false. This is caused by a bug in the jvm. See also DERBY-885. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@462607 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/functionTests/harness/j9_foundation.java", "hunks": [ { "added": [ "// Having the following method overload the one in jvm.java causes problems when running", "// the junit tests - they *do* successfully run with securityManager.", "// Foundation class tests actually run ok with security manager - except when useprocess", "// is false. This is caused by a bug in the jvm. See also DERBY-885 and DERBY-1785.", "//\tprotected void setSecurityProps()", "//\t{", "//\t\tSystem.out.println(\"Note: J9 (foundation) tests do not run with security manager\");\t\t", "//\t}" ], "header": "@@ -128,9 +128,13 @@ public class j9_foundation extends jvm {", "removed": [ "\tprotected void setSecurityProps()", "\t{", "\t\tSystem.out.println(\"Note: J9 (foundation) tests do not run with security manager\");\t\t", "\t}" ] } ] } ]
derby-DERBY-885-fec6b7be
DERBY-885 Disable running with the security manager for useProcess=false for j9 vms. Causes some unexpected execption that needs to be investigated and halts test runs. This is a workaround that will cause dml160 to fail with j9 vms, as it checks to see a security manager is installed. Will be investigating, but this will allow derbyall runs to complete. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@373011 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-887-07d11082
DERBY-887: Remove implicit and explicit casting between BOOLEANs and datatypes other than BOOLEAN and strings. This conforms Derby behavior to the SQL Standard. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@827505 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/build/org/apache/derbyBuild/ODBCMetadataGenerator.java", "hunks": [ { "added": [ "\t// Used for casting BOOLEANS to INTEGERS", "\tprivate\tstatic\tfinal\tString\tBOOLEAN_COLUMNS[] =", "\t{", "\t\t\"CASE_SENSITIVE\",", "\t\t\"FIXED_PREC_SCALE\",", "\t\t\"UNSIGNED_ATTRIBUTE\",", "\t\t\"AUTO_UNIQUE_VAL\",", " \"NON_UNIQUE\",", "\t};", " " ], "header": "@@ -112,6 +112,16 @@ public class ODBCMetadataGenerator {", "removed": [] }, { "added": [], "header": "@@ -561,7 +571,6 @@ public class ODBCMetadataGenerator {", "removed": [ "" ] }, { "added": [ " //", " // Special logic to turn booleans into integers. This is necessary", " // because you cannot cast a boolean to an integer, according to the", " // sql standard.", " //", "\t\t\tif ( isBoolean( colName ) ) { newQueryText.append( \" ( CASE WHEN \" ); }", " //", " // Really special logic to force the AUTO_UNIQUE_VAL and", " // UNSIGNED_ATTRIBUTE columns to", " // be nullable. This appears to be something that the ODBC spec", " // requires.", " //", " if ( \"AUTO_UNIQUE_VAL\".equals( colName ) || \"UNSIGNED_ATTRIBUTE\".equals( colName ) )", " {", " newQueryText.append( \" IS NULL THEN CAST( NULL AS INTEGER ) WHEN \" );", " newQueryText.append(SUBQUERY_NAME);", " newQueryText.append(\".\");", " newQueryText.append(colName);", " }", "\t\t\tif ( isBoolean( colName ) ) { newQueryText.append( \" THEN 1 ELSE 0 END ) \" ); }" ], "header": "@@ -585,9 +594,29 @@ public class ODBCMetadataGenerator {", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/iapi/types/DataTypeDescriptor.java", "hunks": [ { "added": [ " \t//Numeric types are comparable to numeric types", " \t\treturn (compareWithTypeID.isNumericTypeId());" ], "header": "@@ -1311,11 +1311,9 @@ public final class DataTypeDescriptor implements Formatable", "removed": [ " \t//Numeric types are comparable to numeric types, boolean types and to ", "\t\t//comparable user types", " \t\treturn (compareWithTypeID.isNumericTypeId() || ", " \t\tcompareWithTypeID.isBooleanTypeId());" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/BaseTypeCompiler.java", "hunks": [ { "added": [], "header": "@@ -283,7 +283,6 @@ abstract class BaseTypeCompiler implements TypeCompiler", "removed": [ "\t\t\t\t\t\t (otherType.isBooleanTypeId()) ||" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/CLOBTypeCompiler.java", "hunks": [ { "added": [ " return (otherType.isStringTypeId() || otherType.isBooleanTypeId()) ;" ], "header": "@@ -52,7 +52,7 @@ public class CLOBTypeCompiler extends BaseTypeCompiler", "removed": [ " return (otherType.isStringTypeId()) ;" ] } ] } ]
derby-DERBY-888-0380d9cb
DERBY-888 initial partial checkin of allocation improvement. This checkin changes the default of the system to not sync on allocation. All tests pass, and hand testing of allocation encountering bad pages during redo worked. Also adds back in development only path to be able to turn on and off various sync options under an insane build, to compare affect of log sync, vs. allocation sync, vs. checkpoint sync. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@375583 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/services/cache/CacheManager.java", "hunks": [ { "added": [ "\t\tin the cache at the time of the call are placed in the clean state ", " sometime during this call. Objects that are added to the cache during ", " this call or objects that are dirtied during this call (by other ", " callers) are not guaranteed to be clean once this call returns." ], "header": "@@ -199,10 +199,10 @@ public interface CacheManager {", "removed": [ "\t\tin the cache at the time of the call are placed in the clean state sometime", "\t\tduring this call. Objects that are added to the cache during this call or", "\t\tobjects that are dirtied during this call (by other callers) are not guaranteed", "\t\tto be clean once this call returns." ] } ] }, { "file": "java/engine/org/apache/derby/impl/store/raw/data/BaseDataFileFactory.java", "hunks": [ { "added": [ " // disable syncing of data during page allocation. DERBY-888 changes", " // the system to not require data syncing at allocation. ", " boolean dataNotSyncedAtAllocation = true;" ], "header": "@@ -180,8 +180,9 @@ public final class BaseDataFileFactory", "removed": [ " // disable syncing of data during page allocation.", " boolean dataNotSyncedAtAllocation = false;" ] }, { "added": [], "header": "@@ -420,9 +421,6 @@ public final class BaseDataFileFactory", "removed": [ " // - disable syncing of data during page allocation.", " dataNotSyncedAtAllocation = true;", "" ] }, { "added": [ " else if (Performance.MEASURE)", " {", " // development build only feature, must by hand set the ", " // Performance.MEASURE variable and rebuild. Useful during", " // development to compare/contrast effect of syncing, release", " // users can use the above relaxed durability option to disable", " // all syncing. ", "", " // debug only flag - disable syncing of data during checkpoint.", " dataNotSyncedAtCheckpoint = ", " PropertyUtil.getSystemBoolean(", " Property.STORAGE_DATA_NOT_SYNCED_AT_CHECKPOINT);", "", " if (dataNotSyncedAtCheckpoint)", " Monitor.logMessage(", " \"Warning: \" + ", " Property.STORAGE_DATA_NOT_SYNCED_AT_CHECKPOINT +", " \"set to true.\");", "\t\t}" ], "header": "@@ -431,6 +429,25 @@ public final class BaseDataFileFactory", "removed": [] } ] }, { "file": "java/shared/org/apache/derby/shared/common/reference/SQLState.java", "hunks": [ { "added": [ "\tString FILE_NEW_PAGE_DURING_RECOVERY = \"XSDFI.S\";", "" ], "header": "@@ -503,6 +503,8 @@ public interface SQLState {", "removed": [] } ] } ]
derby-DERBY-888-f57b07d2
DERBY-888 Add specific errors for failure while doing initpage redo recovery attempt. Remove "loadTran" references, that term isn't really useful to current code. All cases now apply to redo recovery. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@376502 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/store/raw/data/BaseContainerHandle.java", "hunks": [ { "added": [ " /**", " * ReCreate a page for rollforward recovery. ", " * <p>", " * During redo recovery it is possible for the system to try to redo", " * the creation of a page (ie. going from non-existence to version 0).", " * It first trys to read the page from disk, but a few different types", " * of errors can occur:", " * o the page does not exist at all on disk, this can happen during", " * rollforward recovery applied to a backup where the file was", " * copied and the page was added to the file during the time frame", " * of the backup but after the physical file was copied.", " * o space in the file exists, but it was never initalized. This", " * can happen if you happen to crash at just the right moment during", " * the allocation process. Also", " * on some OS's it is possible to read from a part of the file that", " * was not ever written - resulting in garbage from the store's ", " * point of view (often the result is all 0's). ", " *", " * All these errors are easy to recover from as the system can easily ", " * create a version 0 from scratch and write it to disk.", " *", " * Because the system does not sync allocation of data pages, it is also", " * possible at this point that whlie writing the version 0 to disk to ", " * create it we may encounter an out of disk space error (caught in this", " * routine as a StandardException from the create() call. We can't ", " * recovery from this without help from outside, so the caught exception", " * is nested and a new exception thrown which the recovery system will", " * output to the user asking them to check their disk for space/errors.", " *", "\t * @exception StandardException Standard exception policy.", " **/", "\tpublic Page reCreatePageForRedoRecovery(" ], "header": "@@ -590,11 +590,38 @@ public class BaseContainerHandle extends Observable", "removed": [ "\t/**", "\t\tRe-create this page for load tran. Called by recovery redo ONLY", "\t\t@exception StandardException Cloudscape Standard error policy", "\t */", "\tpublic Page reCreatePageForLoadTran(" ] } ] }, { "file": "java/engine/org/apache/derby/impl/store/raw/data/ContainerBasicOperation.java", "hunks": [ { "added": [ " {", " {", "\t\t\t\t\t\tSanityManager.DEBUG_PRINT(", " \"Trace\", ", " \"cannot find container \" + containerId + ", " \", now attempt last ditch effort\");", " }", " }", "\t\t\t\tcontainerHdl = findContainerForRedoRecovery(rtran);", " {", " {", " \" findContainerForRedoRecovery, got container=\" + ", " (containerHdl != null));", " }", " }" ], "header": "@@ -152,18 +152,28 @@ public abstract class ContainerBasicOperation implements Loggable", "removed": [ "\t\t\t\t\t\tSanityManager.DEBUG_PRINT(\"Trace\", \"cannot find container \" + containerId + ", "\t\t\t\t\t\t\t\t\t\t\t\t \", now attempt last ditch effort\");", "\t\t\t\tcontainerHdl = findContainerForLoadTran(rtran);", "\t\t\t\t\t\t\t\t\t\t\t\t \" findContainerForLoadTran, got container=\" +", "\t\t\t\t\t\t\t\t\t\t\t\t (containerHdl != null));" ] } ] }, { "file": "java/engine/org/apache/derby/impl/store/raw/data/ContainerOperation.java", "hunks": [ { "added": [ "\t * override ContainerBasicOperation's findContainerForRedoRecovery" ], "header": "@@ -141,7 +141,7 @@ public class ContainerOperation extends ContainerBasicOperation implements Undoa", "removed": [ "\t * override ContainerBasicOperation's findContainerForLoadTran" ] }, { "added": [ "\tprotected RawContainerHandle findContainerForRedoRecovery(", " RawTransaction xact)" ], "header": "@@ -151,7 +151,8 @@ public class ContainerOperation extends ContainerBasicOperation implements Undoa", "removed": [ "\tprotected RawContainerHandle findContainerForLoadTran(RawTransaction xact)" ] } ] }, { "file": "java/engine/org/apache/derby/impl/store/raw/data/FileContainer.java", "hunks": [ { "added": [ "\t\t\t if (!noIO && ", " (bulkIncreaseContainerSize ||", "\t\t\t\t\t (pageNumber > lastPreallocPage && ", " pageNumber > PreAllocThreshold)))", "\t\t\t\t allocPage.preAllocatePage(", " this, PreAllocThreshold, PreAllocSize);" ], "header": "@@ -1715,12 +1715,13 @@ abstract class FileContainer", "removed": [ "\t\t\t if (!noIO && (bulkIncreaseContainerSize ||", "\t\t\t\t\t\t (pageNumber > lastPreallocPage &&", "\t\t\t\t\t\t pageNumber > PreAllocThreshold)))", "\t\t\t\t allocPage.preAllocatePage(this, PreAllocThreshold,", "\t\t\t\t \t\t\t\t\t\t PreAllocSize);" ] }, { "added": [ "\t\t// 4'th element is number of bytes to reserve for the container header", "\t\t// and load statement or this new alloc page is in a temporary ", " // container." ], "header": "@@ -2177,12 +2178,13 @@ abstract class FileContainer", "removed": [ "\t\t// 4'th element is the number of bytes to reserve for the container header", "\t\t// and load statement or this new alloc page is in a temporary container." ] }, { "added": [ "\t\tcreateAllocPageArgs[3] = 0;\t\t// allocation page has no need for spare" ], "header": "@@ -2195,7 +2197,7 @@ abstract class FileContainer", "removed": [ "\t\tcreateAllocPageArgs[3] = 0;\t\t// allocation page have no need for spare" ] }, { "added": [ " /**", " * ReCreate a page for rollforward recovery. ", " * <p>", " * During redo recovery it is possible for the system to try to redo", " * the creation of a page (ie. going from non-existence to version 0).", " * It first trys to read the page from disk, but a few different types", " * of errors can occur:", " * o the page does not exist at all on disk, this can happen during", " * rollforward recovery applied to a backup where the file was", " * copied and the page was added to the file during the time frame", " * of the backup but after the physical file was copied.", " * o space in the file exists, but it was never initalized. This", " * can happen if you happen to crash at just the right moment during", " * the allocation process. Also", " * on some OS's it is possible to read from a part of the file that", " * was not ever written - resulting in garbage from the store's ", " * point of view (often the result is all 0's). ", " *", " * All these errors are easy to recover from as the system can easily ", " * create a version 0 from scratch and write it to disk.", " *", " * Because the system does not sync allocation of data pages, it is also", " * possible at this point that whlie writing the version 0 to disk to ", " * create it we may encounter an out of disk space error (caught in this", " * routine as a StandardException from the create() call. We can't ", " * recovery from this without help from outside, so the caught exception", " * is nested and a new exception thrown which the recovery system will", " * output to the user asking them to check their disk for space/errors.", " *", "\t * @exception StandardException Standard exception policy.", " **/", "\tprotected BasePage reCreatePageForRedoRecovery(", " BaseContainerHandle handle,", " int pageFormat,", " long pageNumber,", " long pageOffset)", "\t\t// recreating a page should be done only if are in the middle of ", " // rollforward recovery or if derby.storage.patchInitPageRecoverError ", " // is set to true.", "" ], "header": "@@ -2463,24 +2465,52 @@ abstract class FileContainer", "removed": [ "\t/**", "\t\tReCreate a page for load tran/rollforward recovery. ", "\t\tOnly called during recovery redo", "", "\t\t@exception StandardException Cloudscape Standard error policy", "\t*/", "\tprotected BasePage reCreatePageForLoadTran(BaseContainerHandle handle,", "\t\t\t\t\t\t\t\t\t\t\t int pageFormat,", "\t\t\t\t\t\t\t\t\t\t\t long pageNumber,", "\t\t\t\t\t\t\t\t\t\t\t long pageOffset)", "\t\t// recreating a page should be done only if are in the middle of rollforward recovery or", "\t\t// if derby.storage.patchInitPageRecoverError is set to true." ] }, { "added": [ "\t\t\treCreatePageArgs[3] = 0; // allocation page has no need for spare" ], "header": "@@ -2523,7 +2553,7 @@ abstract class FileContainer", "removed": [ "\t\t\treCreatePageArgs[3] = 0;\t\t// allocation page have no need for spare" ] }, { "added": [ " {", "\t\t\tif (SanityManager.DEBUG_ON(\"LoadTran\"))", "\t\t\t\tSanityManager.DEBUG_PRINT(", " \"Trace\", \"recreating page \" + pkey + \" for load tran\");", " }", "", " try", " // a brand new page, initialize a new page in cache", " page = (BasePage) pageCache.create(pkey, reCreatePageArgs);", " }", " catch (StandardException se)", " {", " throw StandardException.newException(", " SQLState.FILE_NEW_PAGE_DURING_RECOVERY, se, pkey);", " if (page != null)", " {", " releasePage = false;", " page = latchPage(handle, page, false /* never need to wait */);", " if (page == null)", " {", " throw StandardException.newException(", " SQLState.FILE_NEW_PAGE_NOT_LATCHED, pkey);", " }", " }", " else", " throw StandardException.newException(", " SQLState.FILE_NEW_PAGE_DURING_RECOVERY, pkey);" ], "header": "@@ -2534,33 +2564,46 @@ abstract class FileContainer", "removed": [ "\t\t\tif(SanityManager.DEBUG_ON(\"LoadTran\"))", "\t\t\t\tSanityManager.DEBUG_PRINT(\"Trace\", \"recreating page \" + pkey + \" for load tran\");", "\t\t\t// a brand new page, initialize and a new page in cache", "\t\t\tpage = (BasePage) pageCache.create(pkey, reCreatePageArgs);", "", "\t\t\tif (SanityManager.DEBUG)", " if (page == null)", " SanityManager.THROWASSERT(", " \"reCreating page \" + pkey + \" failed\");", "\t\t\treleasePage = false;", "\t\t\tpage = latchPage(handle, page, false /* never need to wait */);", "\t\t\tif (page == null)", "\t\t\t\tthrow StandardException.newException(", " SQLState.FILE_NEW_PAGE_NOT_LATCHED, pkey);" ] } ] }, { "file": "java/engine/org/apache/derby/impl/store/raw/data/InitPageOperation.java", "hunks": [ { "added": [ "\t * Override PageBasicOperation's getPageForRedoRecovery" ], "header": "@@ -155,7 +155,7 @@ public final class InitPageOperation extends PhysicalPageOperation", "removed": [ "\t * Override PageBasicOperation's getPageForLoadTran" ] } ] }, { "file": "java/engine/org/apache/derby/impl/store/raw/data/PageBasicOperation.java", "hunks": [ { "added": [ "\t\t\t\tpage = getPageForRedoRecovery(xact);" ], "header": "@@ -312,7 +312,7 @@ public abstract class PageBasicOperation implements Loggable, RePreparable", "removed": [ "\t\t\t\tpage = getPageForLoadTran(xact);" ] }, { "added": [ " \"Trace\", \"got null page \" + pageId + ", " \" and getPageException, attempt last ditch effort\");", "\t\t\t\tpage = getPageForRedoRecovery(xact);", " \"Trace\",\" getPageForRedoRecovery, got page=\" + ", " (page != null));" ], "header": "@@ -328,16 +328,16 @@ public abstract class PageBasicOperation implements Loggable, RePreparable", "removed": [ "\t\t\t\t\t\t\t\t\t\t\t \"Trace\", \"got null page \" + pageId + ", "\t\t\t\t\t\t\t\t\t\t\t \" and getPageException, now attempt last ditch effort\");", "\t\t\t\tpage = getPageForLoadTran(xact);", "\t\t\t\t\t\t\t\t\t\t\t \"Trace\",\" getPageForLoadTran, got page=\" + ", "\t\t\t\t\t\t\t\t\t\t\t (page != null));" ] } ] }, { "file": "java/engine/org/apache/derby/impl/store/raw/xact/Xact.java", "hunks": [ { "added": [ "\t\tRecreate a container during redo recovery.", "", " Used only during redo recovery while processing log records which", " are trying to create a container, and no valid container is found", " in the database.", "\t\t@see RawTransaction#reCreateContainerForRedoRecovery", "\tpublic void reCreateContainerForRedoRecovery", "\t\tdataFactory.reCreateContainerForRedoRecovery(" ], "header": "@@ -1365,18 +1365,22 @@ public class Xact extends RawTransaction implements Limit {", "removed": [ "\t\tRecreate a container during load tran - use only by media recovery.", "\t\t@see RawTransaction#reCreateContainerForLoadTran", "\tpublic void reCreateContainerForLoadTran", "\t\tdataFactory.reCreateContainerForLoadTran(" ] } ] } ]
derby-DERBY-889-bde12207
DERBY-889 with client getTimestamp on a TIME column will print the date 1900-01-01 instead of the current date Committed Bryan's fix unchanged and enabled test cases in TimeHandlingTest Contributed by Bryan Pendleton git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@537252 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-892-ee43510e
DERBY-892: Allow for test-specific additions to the derby_tests.policy file. Committed for Myrna Van Lunteren <m.v.lunteren@gmail.com> git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@407642 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-896-c1a0ff21
DERBY-896: Allow casts from DATE and TIME to TIMESTAMP git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1568924 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-898-6f5654cc
DERBY-898 setAutoCommit(false) is not working properly with connections objtained with ClientXADataSource. - Changes server side connection for network server XA to autocommit false. Even when the client has autocommit on, the server side connection should be autocommit false and let the client drive the commits. - Adds connections obtained from an XADataSource to the savepointJdbc30_XA test to verify that autocommit is being set properly and also verify that DERBY-899 (a dup of this issue) is fixed. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@376296 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-899-6f5654cc
DERBY-898 setAutoCommit(false) is not working properly with connections objtained with ClientXADataSource. - Changes server side connection for network server XA to autocommit false. Even when the client has autocommit on, the server side connection should be autocommit false and let the client drive the commits. - Adds connections obtained from an XADataSource to the savepointJdbc30_XA test to verify that autocommit is being set properly and also verify that DERBY-899 (a dup of this issue) is fixed. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@376296 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-900-99683a9c
DERBY-900 - Remove use of String(byte[]) and String(byte[], int, int) constructors in network client leading to non-portable behaviour Decided earlier to break up the derby900.p2.diff.txt, so I am attaching now a patch with the cleanup changes separately in derby900_p2_cleanup.diff.txt. Changes are: -- remove unnecessary conversion from sqlstate string to bytes and back to string , in parseSQLDCGRP(Sqlca[] rowsetSqlca, int lastRow) in NetConnectionReply. This has been done by adding a constructor in NetSqlca to take in the sqlstate as string. -- cleanup method getSqlState() in Sqlca. -- cleanup of ccsid_ in Sqlca as it is not used. Please note, the parseSQLDCGRP method in the diff shows more changes because of change in indentation because of removal of the try block. -- ran derbynetclientmats on ibm142/linux OK. Contributed by Sunitha Kambhampati git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@406120 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/client/org/apache/derby/client/am/Sqlca.java", "hunks": [ { "added": [ " " ], "header": "@@ -42,9 +42,7 @@ public abstract class Sqlca {", "removed": [ " protected byte[] sqlStateBytes_;", "", " protected int ccsid_;" ] }, { "added": [ " return sqlState_;" ], "header": "@@ -167,23 +165,7 @@ public abstract class Sqlca {", "removed": [ " if (sqlState_ != null) {", " return sqlState_;", " }", "", " if (sqlStateBytes_ == null) {", " return null;", " }", "", " try {", " sqlState_ = bytes2String(sqlStateBytes_,", " 0,", " sqlStateBytes_.length);", " return sqlState_;", " } catch (java.io.UnsupportedEncodingException e) {", " // leave sqlState as null.", " return null;", " }" ] }, { "added": [ " protected String bytes2String(byte[] bytes, int offset, int length)" ], "header": "@@ -373,7 +355,7 @@ public abstract class Sqlca {", "removed": [ " private String bytes2String(byte[] bytes, int offset, int length)" ] } ] }, { "file": "java/client/org/apache/derby/client/net/NetConnectionReply.java", "hunks": [ { "added": [ " NetSqlca netSqlca = null;", " ", " try", " {", " netSqlca = new NetSqlca(netAgent_.netConnection_,", " sqlcode,", " sqlstate,", " sqlerrproc);", " }", " catch(SqlException sqle)", " {", " throw new DisconnectException(netAgent_,sqle);", " }" ], "header": "@@ -2580,12 +2580,19 @@ public class NetConnectionReply extends Reply", "removed": [ " NetSqlca netSqlca = new NetSqlca(netAgent_.netConnection_,", " sqlcode,", " sqlstate,", " sqlerrproc,", " netAgent_.targetTypdef_.getCcsidSbc());", "" ] } ] }, { "file": "java/client/org/apache/derby/client/net/NetSqlca.java", "hunks": [ { "added": [ "import org.apache.derby.shared.common.reference.SQLState;", "import org.apache.derby.client.am.ClientMessageId;", "import org.apache.derby.client.am.SqlException;", "import java.io.UnsupportedEncodingException;" ], "header": "@@ -21,6 +21,10 @@", "removed": [] }, { "added": [ " String sqlState,", " byte[] sqlErrpBytes) {", " sqlState_ = sqlState;", " NetSqlca(org.apache.derby.client.am.Connection connection,", " int sqlCode,", " byte[] sqlState,", " byte[] sqlErrpBytes) throws SqlException {", " super(connection);", " sqlCode_ = sqlCode;", " try", " {", " sqlState_ = bytes2String(sqlState,0,sqlState.length);", " }catch(UnsupportedEncodingException uee)", " {", " throw new SqlException(null, ", " new ClientMessageId(SQLState.UNSUPPORTED_ENCODING),", " \"sqlstate bytes\", \"SQLSTATE\",uee);", " }", " sqlErrpBytes_ = sqlErrpBytes;", " }" ], "header": "@@ -28,16 +32,31 @@ public class NetSqlca extends Sqlca {", "removed": [ " byte[] sqlStateBytes,", " byte[] sqlErrpBytes,", " int ccsid) {", " sqlStateBytes_ = sqlStateBytes;", " ccsid_ = ccsid;" ] } ] } ]
derby-DERBY-900-eb7b240b
DERBY-900 Remove use of String(byte[]) and String(byte[], int, int) constructors in network client leading to non-portable behaviour This patch derby900.p2_encodingChange.diff.txt makes the encoding related change to remove the non portable String.getBytes() method. Additonal patch for cleanup will follow Contributed by Sunitha Kambhampati -- use correct encoding UTF8 for sqlstate in NetConnectionReply.::parseSQLDCGRP(Sqlca[] rowsetSqlca, int lastRow) git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@398944 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/client/org/apache/derby/client/net/NetConnectionReply.java", "hunks": [ { "added": [ "import java.io.UnsupportedEncodingException;" ], "header": "@@ -28,6 +28,7 @@ import org.apache.derby.client.am.DisconnectException;", "removed": [] }, { "added": [ " String sqldcState = readFastString(5, Typdef.UTF8ENCODING); // SQLSTATE", " try", " {", " // save +20237 in the 0th entry of the rowsetSqlca's.", " // this info is going to be used when a subsequent fetch prior is issued, and if already", " // received a +20237 then we've gone beyond the first row and there is no need to", " // flow another fetch to the server.", " if (sqldcCode == 20237) {", " rowsetSqlca[0] = new NetSqlca(netAgent_.netConnection_,", " sqldcState.getBytes(Typdef.UTF8ENCODING),", " if (rowsetSqlca[sqldcRown] != null) {", " rowsetSqlca[sqldcRown].resetRowsetSqlca(netAgent_.netConnection_,", " sqldcCode,", " sqldcState.getBytes(Typdef.UTF8ENCODING),", " null,", " netAgent_.targetTypdef_.getCcsidSbc());", " } else {", " rowsetSqlca[sqldcRown] = new NetSqlca(netAgent_.netConnection_,", " sqldcCode,", " sqldcState.getBytes(Typdef.UTF8ENCODING),", " null,", " netAgent_.targetTypdef_.getCcsidSbc());", " }", " catch(UnsupportedEncodingException uee)", " {", " throw new DisconnectException(uee,netAgent_); ", " }" ], "header": "@@ -3122,36 +3123,43 @@ public class NetConnectionReply extends Reply", "removed": [ " String sqldcState = readFastString(5, netAgent_.targetTypdef_.getCcsidSbcEncoding()); // SQLSTATE", " // save +20237 in the 0th entry of the rowsetSqlca's.", " // this info is going to be used when a subsequent fetch prior is issued, and if already", " // received a +20237 then we've gone beyond the first row and there is no need to", " // flow another fetch to the server.", " if (sqldcCode == 20237) {", " rowsetSqlca[0] = new NetSqlca(netAgent_.netConnection_,", " sqldcCode,", " sqldcState.getBytes(),", " null,", " netAgent_.targetTypdef_.getCcsidSbc());", " } else {", " if (rowsetSqlca[sqldcRown] != null) {", " rowsetSqlca[sqldcRown].resetRowsetSqlca(netAgent_.netConnection_,", " sqldcState.getBytes(),", " rowsetSqlca[sqldcRown] = new NetSqlca(netAgent_.netConnection_,", " sqldcCode,", " sqldcState.getBytes(),", " null,", " netAgent_.targetTypdef_.getCcsidSbc());" ] } ] } ]
derby-DERBY-901-66bdd78e
DERBY-901 encoding test for client messages. Contributed by Sunitha Kamhampati git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@395430 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-901-a2be028f
DERBY-901 Remove use of String(byte[]) constructors in network server leading to non-portable behaviour Contributed by Sunitha Kambhampati I am attaching the patch ( derby901.p2.diff.txt, derby901.p2.stat.txt) to fix the remaining places that the String(byte[]) constructor is used in Network Server. remove use of default String(byte[]) constructor in -- trace method in DRDAConnThread.readAndSetParams to print out the hex string of the bytes . -- use SQLERRMC_TOKEN_DELIMITER in SQLDIAGCI . some cleanup -- define the SQLERRMC_MESSAGE_DELIMITER in SystemProcedures and use that in DRDAConnThread. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@395416 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/drda/org/apache/derby/impl/drda/DRDAConnThread.java", "hunks": [ { "added": [ "import org.apache.derby.catalog.SystemProcedures;" ], "header": "@@ -44,6 +44,7 @@ import java.util.Date;", "removed": [] }, { "added": [ "\t\t\t\t\ttrace(\"fix bytes parameter value is: \"+ convertToHexString(paramVal));" ], "header": "@@ -4206,7 +4207,7 @@ class DRDAConnThread extends Thread {", "removed": [ "\t\t\t\t\ttrace(\"fix bytes parameter value is: \"+new String(paramVal));" ] }, { "added": [], "header": "@@ -5327,15 +5328,6 @@ class DRDAConnThread extends Thread {", "removed": [ " ", " // This token delimiter value is used to separate the tokens for multiple ", " // error messages. This is used in SystemProcedures.SQLCAMESSAGE.", " /**", "\t * <code>SQLERRMC_MESSAGE_DELIMITER</code> When message argument tokes are sent,", "\t * this value separates the tokens for mulitiple error messages ", "\t */", "\tprivate static String SQLERRMC_MESSAGE_DELIMITER = new String(new char[] {(char)20,(char)20,(char)20});", "\t" ] }, { "added": [ "\t * Multiple messages are separated by SystemProcedures.SQLERRMC_MESSAGE_DELIMITER" ], "header": "@@ -5424,7 +5416,7 @@ class DRDAConnThread extends Thread {", "removed": [ "\t * Multiple messages are separated by SQLERRMC_MESSAGE_DELIMITER" ] }, { "added": [ "\t\t\t\tsqlerrmc += SystemProcedures.SQLERRMC_MESSAGE_DELIMITER + se.getSQLState() + \":\";\t\t\t\t" ], "header": "@@ -5443,7 +5435,7 @@ class DRDAConnThread extends Thread {", "removed": [ "\t\t\t\tsqlerrmc += SQLERRMC_MESSAGE_DELIMITER + se.getSQLState() + \":\";\t\t\t\t" ] } ] }, { "file": "java/engine/org/apache/derby/catalog/SystemProcedures.java", "hunks": [ { "added": [ " // This token delimiter value is used to separate the tokens for multiple ", " // error messages. This is used in DRDAConnThread", " /**", " * <code>SQLERRMC_MESSAGE_DELIMITER</code> When message argument tokes are sent,", " * this value separates the tokens for mulitiple error messages ", " */", " public static String SQLERRMC_MESSAGE_DELIMITER = new String(new char[] {(char)20,(char)20,(char)20});", "" ], "header": "@@ -67,6 +67,14 @@ public class SystemProcedures {", "removed": [] }, { "added": [ "\t\t\tif (sqlerrmc.indexOf(SQLERRMC_MESSAGE_DELIMITER, index) == -1)", "\t\t\tindex = sqlerrmc.indexOf(SQLERRMC_MESSAGE_DELIMITER, index) + ", " SQLERRMC_MESSAGE_DELIMITER.length();" ], "header": "@@ -97,18 +105,15 @@ public class SystemProcedures {", "removed": [ " // This corresponds to the DRDAConnThread.SQLERRMC_MESSAGE_DELIMITER", " // delimiter for multiple messages that are set in sqlerrmc.", "\t\tchar[] b = {(char)20, (char)20, (char)20};", "\t\tString errSeparator = new String(b);", "\t\t\tif (sqlerrmc.indexOf(errSeparator, index) == -1)", "\t\t\tindex = sqlerrmc.indexOf(errSeparator, index) + errSeparator.length();" ] }, { "added": [ "\t\t\t\tendIdx = sqlerrmc.indexOf(SQLERRMC_MESSAGE_DELIMITER, startIdx);" ], "header": "@@ -124,7 +129,7 @@ public class SystemProcedures {", "removed": [ "\t\t\t\tendIdx = sqlerrmc.indexOf(errSeparator, startIdx);" ] }, { "added": [ "\t\t\t\tstartIdx = endIdx + SQLERRMC_MESSAGE_DELIMITER.length();" ], "header": "@@ -147,7 +152,7 @@ public class SystemProcedures {", "removed": [ "\t\t\t\tstartIdx = endIdx + errSeparator.length();" ] } ] } ]
derby-DERBY-901-b001c685
DERBY-901 Remove use of String(byte[]) constructors in network server leading to non-portable behaviour Contributed by Sunitha Kambhampati patch1 - Remove use of String(byte[]) constructors in network server leading to non-portable behaviour This fixes - SQLERRMC_TOKEN_DELIMITER, SQLERRMC_MESSAGE_DELIMITER and the corresponding usage of it in SystemProcedures to not use the default string constructors that are non portable. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@394205 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/drda/org/apache/derby/impl/drda/DRDAConnThread.java", "hunks": [ { "added": [ " // The token delimiter value will be used to parse the MessageId from the ", "\t// SQLERRMC in MessageService.getLocalizedMessage and the MessageId will be", " // used to retrive the localized message. If this delimiter value is changed", " // please make sure to make appropriate changes in", " // MessageService.getLocalizedMessage that gets called from ", " // SystemProcedures.SQLCAMESSAGE", "\tprivate static String SQLERRMC_TOKEN_DELIMITER = new String(new char[] {(char)20});", "", " ", " // This token delimiter value is used to separate the tokens for multiple ", " // error messages. This is used in SystemProcedures.SQLCAMESSAGE.", " /**", "\tprivate static String SQLERRMC_MESSAGE_DELIMITER = new String(new char[] {(char)20,(char)20,(char)20});" ], "header": "@@ -5288,17 +5288,25 @@ class DRDAConnThread extends Thread {", "removed": [ "\t", "\tprivate static String SQLERRMC_TOKEN_DELIMITER = new String(new byte[] {20});", "\t", "\t/**", "\tprivate static String SQLERRMC_MESSAGE_DELIMITER = new String(new byte[] {20,20,20});" ] } ] }, { "file": "java/engine/org/apache/derby/catalog/SystemProcedures.java", "hunks": [ { "added": [ " ", " // This corresponds to the DRDAConnThread.SQLERRMC_MESSAGE_DELIMITER", " // delimiter for multiple messages that are set in sqlerrmc.", "\t\tchar[] b = {(char)20, (char)20, (char)20};" ], "header": "@@ -96,7 +96,10 @@ public class SystemProcedures {", "removed": [ "\t\tbyte[] b = {20, 20, 20};" ] } ] } ]
derby-DERBY-903-9adc0223
DERBY-903: Followup patch to remove use of String(byte[]) in two tests and print an error message instead. Committed for Myrna Van Lunteren <m.v.lunteren@gmail.com> git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@379643 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-903-bb5e9caf
DERBY-903: Remove use of String(byte[]) constructors in tests. Also, fix casing of previously committed errorCode master Committed for Myrna Van Lunteren <m.v.lunteren@gmail.com> git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@378337 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-907-c12c97d6
DERBY-907 regression test failure in RecoveryAfterBackup on wssd5.6 ibm jvm (j2me) * Modifies app_properties files to add ij.dataSource properties. Also changed 'database' to 'ij.database' property. Removed usedefaults to avoid conflict with default property. * Adds a method getConnection to TestUtil to get connection using different set of attributes than what is specified in _app.properties file. * Changes the test store/RecoveryAfterBackup to use the above method to shutdown and get connection. I'll change other tests to use the new method in a later patch. With the patch, I ran the RecoveryAfterBackup tests with Sun JDK1.4.2, j9 and j9 foundation vm. Contributed by Deepa Remesh git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@376804 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/functionTests/util/TestUtil.java", "hunks": [ { "added": [ " ", " /**", " * Get connection to given database using the connection attributes. This", " * method is used by tests to get a secondary connection with ", " * different set of attributes. It does not use what is specified in ", " * app_properties file or system properties. This method uses DataSource ", " * class for CDC/Foundation Profile environments, which are based on ", " * JSR169. Using DataSource will not work with other j9 profiles. So", " * DriverManager is used for non-JSR169. The method is used as a wrapper to", " * hide this difference in getting connections in different environments.", " * ", " * @param databaseName", " * @param connAttrs", " * @return Connection to database ", " * @throws SQLException on failure to connect.", " * @throws ClassNotFoundException on failure to load driver.", " * @throws InstantiationException on failure to load driver.", " * @throws IllegalAccessException on failure to load driver.", " */", " public static Connection getConnection(String databaseName, ", " \t\t\t\t\t\t\t\t\t String connAttrs) ", " \tthrows SQLException, ClassNotFoundException, ", "\t\t\t\tInstantiationException, IllegalAccessException {", " \t", " \tConnection conn;", " \tif(TestUtil.HAVE_DRIVER_CLASS) {", " \t\tString driver = \"org.apache.derby.jdbc.EmbeddedDriver\";", " \t\tClass.forName(driver).newInstance();", " \t\tconn = DriverManager.getConnection(\"jdbc:derby:\" + databaseName ", "\t\t\t\t\t\t\t\t\t\t\t\t+ \";\" + connAttrs );", " \t}", " \telse {", " \t\t//Use DataSource for JSR169", "\t \tProperties prop = new Properties();", "\t prop.setProperty(\"databaseName\", databaseName);", "\t prop.setProperty(\"connectionAttributes\", connAttrs);", "\t conn = getDataSourceConnection(prop);", " \t}", " return conn;", " }", " ", " public static Connection getDataSourceConnection (Properties prop) throws SQLException {" ], "header": "@@ -694,8 +694,48 @@ public class TestUtil {", "removed": [ "\t", "\tpublic static Connection getDataSourceConnection (Properties prop) throws SQLException {" ] } ] } ]
derby-DERBY-918-bc508402
DERBY-918: Introduce new "junit" test type DERBY-934: Create a set of JUnit tests for scrollable updatable cursors. I also added these tests to the jdbcapi and derbynetclientmats suites (except for ConcurrencyTest, which takes too long to run currently) DERBY-797: After calling ResultSet.relative(0) the cursor loses its position These are all submitted together because of interdependencies. All contributed by Andreas Kornelliusen NOTE: This may cause test failures on the IBM JDK; I did not test it with this JDK, nor did I exclude these tests from running on this JDK, as I couldn't say whether they work or not (I don't have the IBM JDK). I did exclude running these tests on DerbyNet, because they have a hard failure saying "null user not supported." Ran these tests on JDK 1.4, JDK 1.3, with both embedded and network client drivers. Note that the SURTest.out has failures; this is because (a) the scrollable updatable result set work is not yet finished and (b) there are differences between network client and embedded client which need to be resolved. -------- DERBY-797 files: M java/engine/org/apache/derby/impl/sql/execute/ScrollInsensitiveResultSet.java DERBY-918 files: M java/testing/org/apache/derbyTesting/functionTests/util/TestUtil.java M java/testing/org/apache/derbyTesting/functionTests/harness/testtypes.properties M java/testing/org/apache/derbyTesting/functionTests/harness/RunTest.java DERBY-934 files: AM java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ConcurrencyTest_app.properties AM java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/SURBaseTest.java AM java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/SURQueryMixTest.java AM java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/SURQueryMixTest_app.properties AM java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ConcurrencyTest.java AM java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/SURDataModelSetup.java AM java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/SURTest.java AM java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/SURTest_app.properties A java/testing/org/apache/derbyTesting/functionTests/master/SURTest.out A java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/SURTest.out M java/testing/org/apache/derbyTesting/functionTests/suites/jdbcapi.runall M java/testing/org/apache/derbyTesting/functionTests/suites/derbynetclientmats.runall M java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNet.exclude git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@378045 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/functionTests/util/TestUtil.java", "hunks": [ { "added": [ "import java.security.AccessController;", "import java.security.PrivilegedAction;", "import java.security.PrivilegedExceptionAction;", "import java.security.PrivilegedActionException;" ], "header": "@@ -30,7 +30,10 @@ import java.util.Locale;", "removed": [ "" ] }, { "added": [ " String frameworkString = (String) AccessController.doPrivileged", " (new PrivilegedAction() {", " public Object run() {", " return System.getProperty(\"framework\");", " }", " }", " ); " ], "header": "@@ -165,7 +168,13 @@ public class TestUtil {", "removed": [ "\t\tString frameworkString = System.getProperty(\"framework\");" ] }, { "added": [ " String hostName = (String) AccessController.doPrivileged", " (new PrivilegedAction() {", " public Object run() {", " return System.getProperty(\"hostName\");", " }", " }", " ); " ], "header": "@@ -199,7 +208,13 @@ public class TestUtil {", "removed": [ " String hostName = (System.getProperty(\"hostName\"));" ] }, { "added": [ " final String driverName;" ], "header": "@@ -243,7 +258,7 @@ public class TestUtil {", "removed": [ "\t\tString driverName = null;" ] }, { "added": [ " default: ", " driverName= \"org.apache.derby.jdbc.EmbeddedDriver\";", " break;", " ", " try {", " AccessController.doPrivileged", " (new PrivilegedExceptionAction() {", " public Object run() throws Exception {", " return Class.forName(driverName).newInstance();", " }", " }", " );", " } catch (PrivilegedActionException e) {", " throw e.getException();", " }", " }" ], "header": "@@ -258,9 +273,23 @@ public class TestUtil {", "removed": [ "\t\tClass.forName(driverName).newInstance();", "\t}" ] } ] } ]
derby-DERBY-924-0223b95e
DERBY-924: new JDBC4 metadata API getFunctions() needs to be implemented Implementation of DatabaseMetaData.getFunctions() in the client driver. Added tests for getFunctions() in the metadata test and the upgrade test. Patch contributed by Dyre Tjeldvoll <Dyre.Tjeldvoll@Sun.COM>. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@393304 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-924-178ae9d0
Partial patch for DERBY-924, DERBY-925 and DERBY-970. New method added: DatabaseMetaData.checkServerJdbcVersionX() - checks whether the server supports a given JDBC version. Throws an exception if it doesn't. Contributed by Dyre Tjeldvoll <Dyre.Tjeldvoll@Sun.COM>. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@393164 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/client/org/apache/derby/client/am/DatabaseMetaData.java", "hunks": [ { "added": [ " /** The JDBC major version supported by the server. */", " private final int serverJdbcMajorVersion;", " /** The JDBC minor version supported by the server. */", " private final int serverJdbcMinorVersion;", "" ], "header": "@@ -63,6 +63,11 @@ public abstract class DatabaseMetaData implements java.sql.DatabaseMetaData {", "removed": [] }, { "added": [ " if (productLevel_.lessThan(10, 2, 0)) {", " serverJdbcMajorVersion = 3;", " serverJdbcMinorVersion = 0;", " } else {", " serverJdbcMajorVersion = 4;", " serverJdbcMinorVersion = 0;", " }" ], "header": "@@ -91,6 +96,13 @@ public abstract class DatabaseMetaData implements java.sql.DatabaseMetaData {", "removed": [] } ] }, { "file": "java/shared/org/apache/derby/shared/common/reference/SQLState.java", "hunks": [ { "added": [ " String JDBC_METHOD_NOT_SUPPORTED_BY_SERVER = \"0A000.S.2\";" ], "header": "@@ -1351,6 +1351,7 @@ public interface SQLState {", "removed": [] } ] } ]
derby-DERBY-924-502d6677
Dyre's patch for DERBY-924: Implementing new JDBC4 method for embedded case, DatabaseMetadata.getFunctions() git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@382379 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-924-89d3ce53
DERBY-968: Added new metadata methods to embedded client. This revision returns EMPTY RESULT SETS for the new methods getFunctions() and getFunctionParameters(). DERBY-924 and DERBY-925 have been opened for these, and linked to this issue. I also fixed some existing metadata calls that throw a not-implemented exception when they should have been returning empty result sets. I also fixed a bug in Driver40 where it did not override newEmbedDatabaseMetaData(), so EmbedDatabaseMetaData40 was not being used. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@377503 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/jdbc/EmbedDatabaseMetaData.java", "hunks": [ { "added": [ " " ], "header": "@@ -98,7 +98,7 @@ public class EmbedDatabaseMetaData extends ConnectionChild", "removed": [ "" ] }, { "added": [ "\t\treturn false;" ], "header": "@@ -3026,7 +3026,7 @@ public class EmbedDatabaseMetaData extends ConnectionChild", "removed": [ "\t\tthrow Util.notImplemented();" ] }, { "added": [ "\t\treturn getSimpleQuery(\"getSuperTypes\");" ], "header": "@@ -3046,7 +3046,7 @@ public class EmbedDatabaseMetaData extends ConnectionChild", "removed": [ "\t\tthrow Util.notImplemented();" ] }, { "added": [ " * @exception SQLException if a database access error occurs", "\t\treturn getSimpleQuery(\"getSuperTables\");" ], "header": "@@ -3060,12 +3060,12 @@ public class EmbedDatabaseMetaData extends ConnectionChild", "removed": [ " * @exception SQLException Feature not implemented for now.", "\t\tthrow Util.notImplemented();" ] }, { "added": [ " * @exception SQLException if a database access error occurs.", " return getSimpleQuery(\"getAttributes\");" ], "header": "@@ -3084,13 +3084,13 @@ public class EmbedDatabaseMetaData extends ConnectionChild", "removed": [ " * @exception SQLException Feature not implemented for now.", "\t\tthrow Util.notImplemented();" ] }, { "added": [ "\tprotected ResultSet getSimpleQuery(String nameKey) throws SQLException" ], "header": "@@ -3103,7 +3103,7 @@ public class EmbedDatabaseMetaData extends ConnectionChild", "removed": [ "\tprivate ResultSet getSimpleQuery(String nameKey) throws SQLException" ] }, { "added": [ " throw Util.notImplemented(nameKey);" ], "header": "@@ -3124,9 +3124,8 @@ public class EmbedDatabaseMetaData extends ConnectionChild", "removed": [ "\t\t\t\t\tthrow Util.notImplemented(nameKey);", "" ] } ] }, { "file": "java/engine/org/apache/derby/impl/jdbc/EmbedDatabaseMetaData40.java", "hunks": [ { "added": [ "import java.sql.DatabaseMetaData;", "import java.sql.PreparedStatement;" ], "header": "@@ -22,7 +22,9 @@ package org.apache.derby.impl.jdbc;", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/jdbc/Driver40.java", "hunks": [ { "added": [ "import java.sql.DatabaseMetaData;" ], "header": "@@ -20,6 +20,7 @@", "removed": [] }, { "added": [ "import org.apache.derby.impl.jdbc.EmbedDatabaseMetaData40;" ], "header": "@@ -33,6 +34,7 @@ import org.apache.derby.impl.jdbc.EmbedRowId;", "removed": [] } ] } ]
derby-DERBY-925-178ae9d0
Partial patch for DERBY-924, DERBY-925 and DERBY-970. New method added: DatabaseMetaData.checkServerJdbcVersionX() - checks whether the server supports a given JDBC version. Throws an exception if it doesn't. Contributed by Dyre Tjeldvoll <Dyre.Tjeldvoll@Sun.COM>. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@393164 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/client/org/apache/derby/client/am/DatabaseMetaData.java", "hunks": [ { "added": [ " /** The JDBC major version supported by the server. */", " private final int serverJdbcMajorVersion;", " /** The JDBC minor version supported by the server. */", " private final int serverJdbcMinorVersion;", "" ], "header": "@@ -63,6 +63,11 @@ public abstract class DatabaseMetaData implements java.sql.DatabaseMetaData {", "removed": [] }, { "added": [ " if (productLevel_.lessThan(10, 2, 0)) {", " serverJdbcMajorVersion = 3;", " serverJdbcMinorVersion = 0;", " } else {", " serverJdbcMajorVersion = 4;", " serverJdbcMinorVersion = 0;", " }" ], "header": "@@ -91,6 +96,13 @@ public abstract class DatabaseMetaData implements java.sql.DatabaseMetaData {", "removed": [] } ] }, { "file": "java/shared/org/apache/derby/shared/common/reference/SQLState.java", "hunks": [ { "added": [ " String JDBC_METHOD_NOT_SUPPORTED_BY_SERVER = \"0A000.S.2\";" ], "header": "@@ -1351,6 +1351,7 @@ public interface SQLState {", "removed": [] } ] } ]
derby-DERBY-925-89d3ce53
DERBY-968: Added new metadata methods to embedded client. This revision returns EMPTY RESULT SETS for the new methods getFunctions() and getFunctionParameters(). DERBY-924 and DERBY-925 have been opened for these, and linked to this issue. I also fixed some existing metadata calls that throw a not-implemented exception when they should have been returning empty result sets. I also fixed a bug in Driver40 where it did not override newEmbedDatabaseMetaData(), so EmbedDatabaseMetaData40 was not being used. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@377503 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/jdbc/EmbedDatabaseMetaData.java", "hunks": [ { "added": [ " " ], "header": "@@ -98,7 +98,7 @@ public class EmbedDatabaseMetaData extends ConnectionChild", "removed": [ "" ] }, { "added": [ "\t\treturn false;" ], "header": "@@ -3026,7 +3026,7 @@ public class EmbedDatabaseMetaData extends ConnectionChild", "removed": [ "\t\tthrow Util.notImplemented();" ] }, { "added": [ "\t\treturn getSimpleQuery(\"getSuperTypes\");" ], "header": "@@ -3046,7 +3046,7 @@ public class EmbedDatabaseMetaData extends ConnectionChild", "removed": [ "\t\tthrow Util.notImplemented();" ] }, { "added": [ " * @exception SQLException if a database access error occurs", "\t\treturn getSimpleQuery(\"getSuperTables\");" ], "header": "@@ -3060,12 +3060,12 @@ public class EmbedDatabaseMetaData extends ConnectionChild", "removed": [ " * @exception SQLException Feature not implemented for now.", "\t\tthrow Util.notImplemented();" ] }, { "added": [ " * @exception SQLException if a database access error occurs.", " return getSimpleQuery(\"getAttributes\");" ], "header": "@@ -3084,13 +3084,13 @@ public class EmbedDatabaseMetaData extends ConnectionChild", "removed": [ " * @exception SQLException Feature not implemented for now.", "\t\tthrow Util.notImplemented();" ] }, { "added": [ "\tprotected ResultSet getSimpleQuery(String nameKey) throws SQLException" ], "header": "@@ -3103,7 +3103,7 @@ public class EmbedDatabaseMetaData extends ConnectionChild", "removed": [ "\tprivate ResultSet getSimpleQuery(String nameKey) throws SQLException" ] }, { "added": [ " throw Util.notImplemented(nameKey);" ], "header": "@@ -3124,9 +3124,8 @@ public class EmbedDatabaseMetaData extends ConnectionChild", "removed": [ "\t\t\t\t\tthrow Util.notImplemented(nameKey);", "" ] } ] }, { "file": "java/engine/org/apache/derby/impl/jdbc/EmbedDatabaseMetaData40.java", "hunks": [ { "added": [ "import java.sql.DatabaseMetaData;", "import java.sql.PreparedStatement;" ], "header": "@@ -22,7 +22,9 @@ package org.apache.derby.impl.jdbc;", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/jdbc/Driver40.java", "hunks": [ { "added": [ "import java.sql.DatabaseMetaData;" ], "header": "@@ -20,6 +20,7 @@", "removed": [] }, { "added": [ "import org.apache.derby.impl.jdbc.EmbedDatabaseMetaData40;" ], "header": "@@ -33,6 +34,7 @@ import org.apache.derby.impl.jdbc.EmbedRowId;", "removed": [] } ] } ]
derby-DERBY-925-e4233337
DERBY-925: Dyre's derby-925.v1.diff patch enabling new JDBC4 getFunctionParamaters() metadata method. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@395414 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/client/org/apache/derby/client/am/DatabaseMetaData.java", "hunks": [ { "added": [], "header": "@@ -1100,7 +1100,6 @@ public abstract class DatabaseMetaData implements java.sql.DatabaseMetaData {", "removed": [ "" ] } ] }, { "file": "java/engine/org/apache/derby/catalog/GetProcedureColumns.java", "hunks": [ { "added": [ "import java.sql.DatabaseMetaData;" ], "header": "@@ -24,6 +24,7 @@ import java.sql.Types;", "removed": [] }, { "added": [ "import org.apache.derby.shared.common.reference.JDBC40Translation;" ], "header": "@@ -32,6 +33,7 @@ import org.apache.derby.iapi.sql.ResultColumnDescriptor;", "removed": [] }, { "added": [ "\tprivate boolean isFunction;", "\tprivate int translate(int val) {", "\t\tif (!isFunction) { return val; }", "\t\tswitch (val) {", "\t\tcase DatabaseMetaData.procedureColumnUnknown:", "\t\t\treturn JDBC40Translation.FUNCTION_PARAMETER_UNKNOWN;\t", "\t\tcase DatabaseMetaData.procedureColumnIn:", "\t\t\treturn JDBC40Translation.FUNCTION_PARAMETER_IN;", "\t\tcase DatabaseMetaData.procedureColumnInOut:", "\t\t\treturn JDBC40Translation.FUNCTION_PARAMETER_INOUT;\t", "\t\tcase DatabaseMetaData.procedureColumnOut:", "\t\t\treturn JDBC40Translation.FUNCTION_PARAMETER_OUT;", "\t\tcase DatabaseMetaData.procedureColumnReturn:", "\t\t\treturn JDBC40Translation.FUNCTION_RETURN;", "\t\tdefault:", "\t\t\treturn JDBC40Translation.FUNCTION_PARAMETER_UNKNOWN;\t", "\t\t}", " }", "\tprivate int paramCursor;", " private String columnName;", " private short columnType;", " private final short nullable;" ], "header": "@@ -81,15 +83,36 @@ import org.apache.derby.catalog.types.RoutineAliasInfo;", "removed": [ "\tprivate int paramCursor = -1;" ] }, { "added": [ "\t\t\tisFunction = aliasType.equals(\"F\");", "\t\tif (aliasType == null) { ", "\t\t\tnullable = 0;", "\t\t\treturn;", "\t\t}", "", "\t\tif (isFunction) {", "\t\t\tnullable = (short) JDBC40Translation.FUNCTION_NULLABLE;", "\t\t\tsqlType = procedure.getReturnType();", "\t\t\tcolumnName = \"\"; // COLUMN_NAME is VARCHAR NOT NULL", "\t\t\tcolumnType = (short) JDBC40Translation.FUNCTION_RETURN;", "\t\t\tparamCursor = -2;", "\t\t\treturn;", "\t\t}", "\t\tnullable = (short) DatabaseMetaData.procedureNullable;", "", "\t\tparamCursor = -1;", "\t\tif (paramCursor > -1) {", "\t\t\tsqlType = procedure.getParameterTypes()[paramCursor];", "\t\t\tcolumnName = procedure.getParameterNames()[paramCursor];", "\t\t\tcolumnType = ", "\t\t\t\t(short)translate(procedure.getParameterModes()[paramCursor]);", "\t\t}" ], "header": "@@ -106,23 +129,41 @@ public class GetProcedureColumns extends org.apache.derby.vti.VTITemplate", "removed": [ "", "\t\tsqlType = procedure.getParameterTypes()[paramCursor];", "", "", "" ] }, { "added": [ "\t\t\treturn columnName;" ], "header": "@@ -136,7 +177,7 @@ public class GetProcedureColumns extends org.apache.derby.vti.VTITemplate", "removed": [ "\t\t\t\treturn procedure.getParameterNames()[paramCursor];" ] }, { "added": [ "\t\t\treturn columnType;" ], "header": "@@ -198,7 +239,7 @@ public class GetProcedureColumns extends org.apache.derby.vti.VTITemplate", "removed": [ "\t\t\treturn (short) (procedure.getParameterModes()[paramCursor]);" ] } ] } ]
derby-DERBY-927-00978657
DERBY-927 (partial) Clarify purpose of stripping derby.* properties from the set of JDBC attributes passed into a connection request. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@376034 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java", "hunks": [ { "added": [ "\t/**", "\t * Filter out properties from the passed in set of JDBC attributes", "\t * to remove any derby.* properties. This is to ensure that setting", "\t * derby.* properties does not work this way, it's not a defined way", "\t * to set such properties and could be a secuirty hole in allowing", "\t * remote connections to override system, application or database settings.", "\t * ", "\t * @return a new Properties set copied from the parameter but with no", "\t * derby.* properties.", "\t */" ], "header": "@@ -1643,6 +1643,16 @@ public class EmbedConnection implements java.sql.Connection", "removed": [] } ] } ]
derby-DERBY-927-00c5b52d
DERBY-927 (partial) Remove the (unused) code path that incorrectly seemed to allow service providers (implementations for a service, e.g. a database) and storage factory implementations to be set from the Properties object passed into a connection. This would be a security hole as it would allow remote users to possibly change the implementation used to access the database, thus changing the security environment. The code could not be exercised as the embedded driver correctly stripped out derby.* properties from the JDBC attributes passed in with a connection request. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@376897 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/services/monitor/ModuleFactory.java", "hunks": [ { "added": [ " public PersistentService getServiceProvider(String subSubProtocol) throws StandardException;" ], "header": "@@ -103,7 +103,7 @@ public interface ModuleFactory", "removed": [ " public PersistentService getServiceProvider( Properties startParams, String subSubProtocol) throws StandardException;" ] } ] }, { "file": "java/engine/org/apache/derby/impl/services/monitor/BaseMonitor.java", "hunks": [ { "added": [ "\t\t\t\t\t\t\tfindProviderAndStartService(name, properties, true);" ], "header": "@@ -961,7 +961,7 @@ abstract class BaseMonitor", "removed": [ "\t\t\t\t\t\t\tstartPersistentService(name, properties, true);" ] }, { "added": [ "\tpublic final boolean startPersistentService(String name, Properties properties)", "\t\treturn findProviderAndStartService(name, properties, false);" ], "header": "@@ -984,20 +984,13 @@ abstract class BaseMonitor", "removed": [ "\tpublic boolean startPersistentService(String name, Properties properties)", "\t\treturn startPersistentService(name, properties, false);", "\tprotected boolean startPersistentService(String name, ", "\t\t\t\t Properties properties, boolean bootTime)", "\t\tthrows StandardException {", "", "\t\treturn findProviderAndStartService(name, properties, bootTime);", "\t}", "" ] }, { "added": [ "\t\tPersistentService provider = findProviderForCreate(name);", " /**", " * Removes a PersistentService.", " * Could be used for drop database.", " */", "\t\tprovider = findProviderForCreate(name);" ], "header": "@@ -1012,24 +1005,24 @@ abstract class BaseMonitor", "removed": [ "\t\tPersistentService provider = findProviderForCreate(properties, name);", " /* Removes a PersistentService", " Note : Currently needed by dropPublisher. But this can be used to", " remove any PersistentService.", "\t*/", "\t\tprovider = findProviderForCreate(null, name);" ] }, { "added": [ "\tprivate boolean findProviderAndStartService(String name, " ], "header": "@@ -1503,7 +1496,7 @@ nextModule:", "removed": [ "\tprotected boolean findProviderAndStartService(String name, " ] }, { "added": [ "\t\t\tactualProvider = findProviderFromName(name, colon);" ], "header": "@@ -1515,7 +1508,7 @@ nextModule:", "removed": [ "\t\t\tactualProvider = findProviderFromName(properties, name, colon);" ] }, { "added": [ "\tprotected PersistentService findProviderForCreate(String name) throws StandardException {", "\t\treturn (PersistentService) findProviderFromName(name, name.indexOf(':'));", "\t\tie. is of the form 'type:name'. If type is less than 3 characters", "\tprivate PersistentService findProviderFromName(String name, int colon) throws StandardException" ], "header": "@@ -1593,25 +1586,17 @@ nextModule:", "removed": [ "\tprotected PersistentService findProvider() throws StandardException", "\t{", "\t\t// This is a hack. This is called when we want to re-write ", "\t\t// services.properties, and need the provider for the database", "\t\t// directory.", "\t\treturn findProviderForCreate(null, \"\");", "\t}", "", "\tprotected PersistentService findProviderForCreate(Properties startParams, String name) throws StandardException {", "\t\treturn (PersistentService) findProviderFromName( startParams, name, name.indexOf(':'));", "\t\tie. is of the form 'type:name'. If type is less than 3 chanacters", "\tprivate PersistentService findProviderFromName(Properties startParams, String name, int colon) throws StandardException" ] }, { "added": [ "\t\treturn getServiceProvider(serviceType);", " public PersistentService getServiceProvider(String subSubProtocol) throws StandardException" ], "header": "@@ -1624,10 +1609,10 @@ nextModule:", "removed": [ "\t\treturn getServiceProvider( startParams, serviceType);", " public PersistentService getServiceProvider( Properties startParams, String subSubProtocol) throws StandardException" ] }, { "added": [ " return getPersistentService(subSubProtocol);", " ", " /**", " * Return a PersistentService implementation to handle the subSubProtocol.", " * @return Valid PersistentService or null if the protocol is not handled.", " */", " private PersistentService getPersistentService(String subSubProtocol)", " String className = getStorageFactoryClassName(subSubProtocol);" ], "header": "@@ -1637,13 +1622,18 @@ nextModule:", "removed": [ " return getPersistentService( startParams, subSubProtocol);", " private PersistentService getPersistentService( Properties properties, String subSubProtocol)", " String className = getStorageFactoryClassName( properties, subSubProtocol);" ] }, { "added": [ " /**", " * Find the StorageFactory class name that handles the subSub protocol.", " * Looks in the system property set and the set defined during boot.", " ", " * @return Valid class name, or null if no StorageFactory handles the protocol.", " */", " private String getStorageFactoryClassName(String subSubProtocol)", " String className = PropertyUtil.getSystemProperty( propertyName);" ], "header": "@@ -1665,14 +1655,16 @@ nextModule:", "removed": [ " private String getStorageFactoryClassName( Properties properties, String subSubProtocol)", " String className = null;", " if( properties != null)", " className = properties.getProperty( propertyName);", " if( className == null)", " className = PropertyUtil.getSystemProperty( propertyName);" ] } ] }, { "file": "java/engine/org/apache/derby/impl/store/raw/data/BaseDataFileFactory.java", "hunks": [ { "added": [ "\t\tif (!handleServiceType(serviceType))" ], "header": "@@ -250,7 +250,7 @@ public final class BaseDataFileFactory", "removed": [ "\t\tif (!handleServiceType(startParams, serviceType))" ] }, { "added": [ " Monitor.getMonitor().getServiceProvider(type);" ], "header": "@@ -1770,13 +1770,12 @@ public final class BaseDataFileFactory", "removed": [ " Properties startParams, ", " Monitor.getMonitor().getServiceProvider( startParams, type);" ] } ] } ]
derby-DERBY-927-0767f34d
DERBY-927 (partial) Clean up code related to serviceProviders to aid progress towards merging services and storage factories in the monitor. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@475780 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/services/monitor/BaseMonitor.java", "hunks": [ { "added": [ "import java.util.Collections;", "import java.util.Iterator;", "import java.util.Map;" ], "header": "@@ -75,8 +75,11 @@ import java.io.InputStreamReader;", "removed": [] }, { "added": [ "\t\tHash table of objects that implement PersistentService keyed by their getType() method.", "\tprivate HashMap serviceProviders = new HashMap();" ], "header": "@@ -107,9 +110,9 @@ abstract class BaseMonitor", "removed": [ "\t\tHashtable of objects that implement PersistentService keyed by their getType() method.", "\tHashtable serviceProviders;" ] }, { "added": [ "\t\tdetermineSupportedServiceProviders();" ], "header": "@@ -390,7 +393,7 @@ abstract class BaseMonitor", "removed": [ "\t\tbootServiceProviders();" ] }, { "added": [], "header": "@@ -1230,8 +1233,6 @@ nextModule:", "removed": [ " if (serviceProviders == null)", " serviceProviders = new Hashtable(3, (float) 1.0);" ] }, { "added": [ "\t** are checked to see if they run in the current environment.", " * Determine which of the set of service providers (PersistentService objects)", " * are supported in the current environment. If a PersistentService", " * implementation does not implement ModuleControl then it is assumed", " * it does support the current environment. Otherwise the canSupport()", " * method makes the determination. Any providers that are not supported", " * are removed from the list.", "\tprivate void determineSupportedServiceProviders() {", "\t\tfor (Iterator i = serviceProviders.values().iterator(); i.hasNext(); ) {", "\t\t\tObject provider = i.next();", "\t\t\t\ti.remove();" ], "header": "@@ -1400,30 +1401,26 @@ nextModule:", "removed": [ "\t** are booted. If they fail to boot then they aare discarded.", "\t** E.g. a marimba service provider may detect that its not in", "\t** a channel so it refuses to boot.", "\t\tBoot all the service providers, ie. any module that implemented", "\t\tPersistentService. Upon entry to this call is the hashtable has", "\t\tPersistentService objects that have been created but not booted.", "\tprotected void bootServiceProviders() {", "\t\tif (serviceProviders == null) {", "\t\t\treturn;", "\t\t}", "", "\t\tfor (Enumeration e = serviceProviders.keys(); e.hasMoreElements(); ) {", "\t\t\tString serviceType = (String) e.nextElement();", "\t\t\tObject provider = serviceProviders.get(serviceType);", "\t\t\t\tserviceProviders.remove(serviceType);" ] }, { "added": [ "\tprivate void bootPersistentServices() {" ], "header": "@@ -1436,7 +1433,7 @@ nextModule:", "removed": [ "\tprotected void bootPersistentServices() {" ] }, { "added": [ " private Enumeration serviceProvidersKeys = (serviceProviders == null) ? null :", " Collections.enumeration(serviceProviders.keySet());" ], "header": "@@ -2102,7 +2099,8 @@ nextModule:", "removed": [ " private Enumeration serviceProvidersKeys = (serviceProviders == null) ? null : serviceProviders.keys();" ] } ] } ]
derby-DERBY-927-e30b79b3
DERBY-927 (partial) Load sub-sub protocol implementations (derby.subSubProtocol.*) from implementation locations using the same mechanism as modules (derby.module.*). This allows sub-sub protocols to utilize the environment requirement variables derby.env.jdk.* and derby.env.classes.* to control their booting. Move some constants into Property.java with detailed comments. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@377272 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/reference/Property.java", "hunks": [ { "added": [ " ", " /**", " * derby.module.modulename", " * <P>", " * Defines a new module. Modulename is a name used when loading the definition", " * of a module, it provides the linkage to other properties used to define the", " * module, derby.env.jdk.modulename and derby.env.classes.modulename.", " * ", " * The value is a Java class name that implements functionality required by", " * the other parts of a Derby system or database. The class can optionally implement", " * these classes to control its use and startup.", " * <UL>", " * <LI> org.apache.derby.iapi.services.monitor.ModuleControl", " * <LI> org.apache.derby.iapi.services.monitor.ModuleSupportable", " * </UL>", " */", " String MODULE_PREFIX = \"derby.module.\";" ], "header": "@@ -486,6 +486,23 @@ public interface Property {", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/services/monitor/BaseMonitor.java", "hunks": [ { "added": [ " ", " // module tagged name in the modules.properties file.", " // used as the tag for dependent properties.", " String tag;", " ", " // Dynamically loaded code is defined by a property of", " // the form:", " // derby.module.<modulename>=<class name>", " // or", " // derby.subSubProtocol.<modulename>=<classname>", " ", "\t\t\tif (key.startsWith(Property.MODULE_PREFIX)) {", "\t\t\t\ttag = key.substring(Property.MODULE_PREFIX.length());", " } else if (key.startsWith(Property.SUB_SUB_PROTOCOL_PREFIX)) {", " tag = key.substring(Property.MODULE_PREFIX.length());", " } else {", " continue nextModule;", " }", " ", "", "\t\t\t// Check to see if it has any environment requirements", "", "\t\t\t// derby.env.jdk.<modulename> - Any JDK requirements.", "\t\t\tString envKey = Property.MODULE_ENV_JDK_PREFIX.concat(tag);", "\t\t\tString envJDK = moduleList.getProperty(envKey);", "\t\t\tint envJDKId = 0;", "\t\t\t", "\t\t\tif (envJDK != null) {", "\t\t\t\tenvJDKId = Integer.parseInt(envJDK.trim());", "\t\t\t\tif (envJDKId > theJDKId) {", "\t\t\t\t\tcontinue nextModule;", "\t\t\t}", "\t\t\t// derby.env.classes.<tag> - Any class requirements", "\t\t\tenvKey = Property.MODULE_ENV_CLASSES_PREFIX.concat(tag);", "\t\t\tString envClasses = moduleList.getProperty(envKey);", "\t\t\tif (envClasses != null) {", "", "\t\t\t\tStringTokenizer st = new StringTokenizer(envClasses, \",\");", "\t\t\t\tfor (; st.hasMoreTokens(); ) {", "\t\t\t\t\ttry {", "\t\t\t\t\t\tClass.forName(st.nextToken().trim());", "\t\t\t\t\t} catch (ClassNotFoundException cnfe) {", "\t\t\t\t\t\tcontinue nextModule;", "\t\t\t\t\t} catch (LinkageError le) {", "\t\t\t\t\t\tcontinue nextModule;", "\t\t\t}", "\t\t\t// Try to load the class", "\t\t\t// if we can't load the class or create an instance then", "\t\t\t// we don't use this calls as a valid module implementation", "\t\t\tString className = moduleList.getProperty(key);", "\t\t\tif (SanityManager.DEBUG && reportOn) {", "\t\t\t\treport(\"Accessing module \" + className + \" to run initializers at boot time\");", "\t\t\t}", "\t\t\ttry {", "\t\t\t\tClass possibleModule = Class.forName(className);", "", "\t\t\t\t// Look for the monitors special modules, PersistentService ones.", "\t\t\t\tif (getPersistentServiceImplementation(possibleModule))", " continue;", " ", " ", " if( StorageFactory.class.isAssignableFrom(possibleModule)) {", " storageFactories.put(tag, className);", " continue;", " }", "\t\t\t\t// If this is a specific JDK version (environment) module", "\t\t\t\t// then it must be ordered in the implementation list by envJDKId.", "\t\t\t\t// Those with a higher number are at the front, e.g.", "\t\t\t\t//", "\t\t\t\t//\tJDK 1.4 modules (envJDKId == 4)", "\t\t\t\t// JDK 1.2/1.3 modules (envJDKId == 2)", "\t\t\t\t// JDK 1.1 modules (envJDKId == 1)", "\t\t\t\t// generic modules (envJDKId == 0 (not set in modules.properties)", "\t\t\t\t//", "\t\t\t\t// Note modules with envJDKId > theJDKId do not get here", "\t\t\t\tif (envJDKId != 0) {", "\t\t\t\t\t// total how many modules with a higher envJDKId are ahead of us", "\t\t\t\t\tint offset = 0;", "\t\t\t\t\tfor (int eji = theJDKId; eji > envJDKId; eji--) {", "\t\t\t\t\t\toffset += envModuleCount[eji];", "\t\t\t\t\timplementations.insertElementAt(possibleModule, offset);", "\t\t\t\t\tenvModuleCount[envJDKId]++;", "\t\t\t\telse {", "\t\t\t\t\t// just add to the end of the vector", "\t\t\t\t\timplementations.addElement(possibleModule);", "", "\t\t\t\t// Since ModuleControl and ModuleSupportable are not called directly", "\t\t\t\t// check that if the have the methods then the class implements the", "\t\t\t\t// interface.", "\t\t\t\tif (SanityManager.DEBUG) {", "\t\t\t\t\t// ModuleSupportable", "\t\t\t\t\tClass[] csParams = { new java.util.Properties().getClass()};", "\t\t\t\t\ttry {", "\t\t\t\t\t\tpossibleModule.getMethod(\"canSupport\", csParams);", "\t\t\t\t\t\tif (!ModuleSupportable.class.isAssignableFrom(possibleModule)) {", "\t\t\t\t\t\t\tSanityManager.THROWASSERT(\"Module does not implement ModuleSupportable but has canSupport() - \" + className);", "\t\t\t\t\t\t}", "\t\t\t\t\t} catch (NoSuchMethodException nsme){/* ok*/}", "", "\t\t\t\t\t// ModuleControl", "\t\t\t\t\tboolean eitherMethod = false;", "", "\t\t\t\t\tClass[] bootParams = {Boolean.TYPE, new java.util.Properties().getClass()};", "\t\t\t\t\ttry {", "\t\t\t\t\t\tpossibleModule.getMethod(\"boot\", bootParams);", "\t\t\t\t\t\teitherMethod = true;", "\t\t\t\t\t} catch (NoSuchMethodException nsme){/*ok*/}", "", "\t\t\t\t\tClass[] stopParams = {};", "\t\t\t\t\ttry {", "\t\t\t\t\t\tpossibleModule.getMethod(\"stop\", stopParams);", "\t\t\t\t\t\teitherMethod = true;", "\t\t\t\t\t} catch (NoSuchMethodException nsme){/*ok*/}", "", "\t\t\t\t\tif (eitherMethod) {", "\t\t\t\t\t\tif (!ModuleControl.class.isAssignableFrom(possibleModule)) {", "\t\t\t\t\t\t\tSanityManager.THROWASSERT(\"Module does not implement ModuleControl but has its methods - \" + className);", "\t\t\t\t\t\t}", "\t\t\t\t\t}", "\t\t\t}", "\t\t\tcatch (ClassNotFoundException cnfe) {", "\t\t\t\treport(\"Class \" + className + \" \" + cnfe.toString() + \", module ignored.\");", "\t\t\t}", "\t\t\tcatch (LinkageError le) {", "\t\t\t\treport(\"Class \" + className + \" \" + le.toString() + \", module ignored.\");", "\t\t\t}", "\t\t}", " " ], "header": "@@ -1065,162 +1065,154 @@ nextModule:", "removed": [ "\t\t\tif (key.startsWith(\"derby.module.\")) {", "\t\t\t\tint keylength = \"derby.module.\".length();", "\t\t\t\tString tag = key.substring(keylength);", "", "\t\t\t\t// Check to see if it has any environment requirements", "", "\t\t\t\t// derby.env.jdk.<tag> - Any JDK requirements.", "\t\t\t\tString envKey = \"derby.env.jdk.\".concat(tag);", "\t\t\t\tString envJDK = moduleList.getProperty(envKey);", "\t\t\t\tint envJDKId = 0;", "\t\t\t\t", "\t\t\t\tif (envJDK != null) {", "\t\t\t\t\tenvJDKId = Integer.parseInt(envJDK.trim());", "\t\t\t\t\tif (envJDKId > theJDKId) {", "\t\t\t\t\t\tcontinue nextModule;", "\t\t\t\t\t}", "\t\t\t\t// derby.env.classes.<tag> - Any class requirements", "\t\t\t\tenvKey = \"derby.env.classes.\".concat(tag);", "\t\t\t\tString envClasses = moduleList.getProperty(envKey);", "\t\t\t\tif (envClasses != null) {", "", "\t\t\t\t\tStringTokenizer st = new StringTokenizer(envClasses, \",\");", "\t\t\t\t\tfor (; st.hasMoreTokens(); ) {", "\t\t\t\t\t\ttry {", "\t\t\t\t\t\t\tClass.forName(st.nextToken().trim());", "\t\t\t\t\t\t} catch (ClassNotFoundException cnfe) {", "\t\t\t\t\t\t\tcontinue nextModule;", "\t\t\t\t\t\t} catch (LinkageError le) {", "\t\t\t\t\t\t\tcontinue nextModule;", "\t\t\t\t\t\t}", "\t\t\t\t// we load the class and run its registerFormatC", "\t\t\t\t// if we can't load the class or create an instance then", "\t\t\t\t// we don't use this calls as a valid module implementation", "\t\t\t\tString className = moduleList.getProperty(key);", "\t\t\t\tif (SanityManager.DEBUG && reportOn) {", "\t\t\t\t\treport(\"Accessing module \" + className + \" to run initializers at boot time\");", "\t\t\t\t}", "\t\t\t\ttry {", "\t\t\t\t\tClass possibleModule = Class.forName(className);", "", "\t\t\t\t\t// Look for the monitors special modules, PersistentService ones.", "\t\t\t\t\tif (getPersistentServiceImplementation(possibleModule))", " continue;", "", "\t\t\t\t\t// If this is a specific JDK version (environment) module", "\t\t\t\t\t// then it must be ordered in the implementation list by envJDKId.", "\t\t\t\t\t// Those with a higher number are at the front, e.g.", "\t\t\t\t\t//", "\t\t\t\t\t//\tJDK 1.4 modules (envJDKId == 4)", "\t\t\t\t\t// JDK 1.2/1.3 modules (envJDKId == 2)", "\t\t\t\t\t// JDK 1.1 modules (envJDKId == 1)", "\t\t\t\t\t// generic modules (envJDKId == 0 (not set in modules.properties)", "\t\t\t\t\t//", "\t\t\t\t\t// Note modules with envJDKId > theJDKId do not get here", "", "\t\t\t\t\tif (envJDKId != 0) {", "", "\t\t\t\t\t\t// total how many modules with a higher envJDKId are ahead of us", "\t\t\t\t\t\tint offset = 0;", "\t\t\t\t\t\tfor (int eji = theJDKId; eji > envJDKId; eji--) {", "\t\t\t\t\t\t\toffset += envModuleCount[eji];", "\t\t\t\t\t\t}", "\t\t\t\t\t\timplementations.insertElementAt(possibleModule, offset);", "\t\t\t\t\t\tenvModuleCount[envJDKId]++;", "\t\t\t\t\t}", "\t\t\t\t\telse {", "\t\t\t\t\t\t// just add to the end of the vector", "\t\t\t\t\t\timplementations.addElement(possibleModule);", "\t\t\t\t\t}", "", "\t\t\t\t\t// Since ModuleControl and ModuleSupportable are not called directly", "\t\t\t\t\t// check that if the have the methods then the class implements the", "\t\t\t\t\t// interface.", "\t\t\t\t\tif (SanityManager.DEBUG) {", "\t\t\t\t\t\t// ModuleSupportable", "\t\t\t\t\t\tClass[] csParams = { new java.util.Properties().getClass()};", "\t\t\t\t\t\ttry {", "\t\t\t\t\t\t\tpossibleModule.getMethod(\"canSupport\", csParams);", "\t\t\t\t\t\t\tif (!ModuleSupportable.class.isAssignableFrom(possibleModule)) {", "\t\t\t\t\t\t\t\tSanityManager.THROWASSERT(\"Module does not implement ModuleSupportable but has canSupport() - \" + className);", "\t\t\t\t\t\t\t}", "\t\t\t\t\t\t} catch (NoSuchMethodException nsme){/* ok*/}", "", "\t\t\t\t\t\t// ModuleControl", "\t\t\t\t\t\tboolean eitherMethod = false;", "", "\t\t\t\t\t\tClass[] bootParams = {Boolean.TYPE, new java.util.Properties().getClass()};", "\t\t\t\t\t\ttry {", "\t\t\t\t\t\t\tpossibleModule.getMethod(\"boot\", bootParams);", "\t\t\t\t\t\t\teitherMethod = true;", "\t\t\t\t\t\t} catch (NoSuchMethodException nsme){/*ok*/}", "", "\t\t\t\t\t\tClass[] stopParams = {};", "\t\t\t\t\t\ttry {", "\t\t\t\t\t\t\tpossibleModule.getMethod(\"stop\", stopParams);", "\t\t\t\t\t\t\teitherMethod = true;", "\t\t\t\t\t\t} catch (NoSuchMethodException nsme){/*ok*/}", "", "\t\t\t\t\t\tif (eitherMethod) {", "\t\t\t\t\t\t\tif (!ModuleControl.class.isAssignableFrom(possibleModule)) {", "\t\t\t\t\t\t\t\tSanityManager.THROWASSERT(\"Module does not implement ModuleControl but has its methods - \" + className);", "\t\t\t\t\t\t\t}", "\t\t\t\t\t\t}", "\t\t\t\t\t\t", "\t\t\t\t}", "\t\t\t\tcatch (ClassNotFoundException cnfe) {", "\t\t\t\t\treport(\"Class \" + className + \" \" + cnfe.toString() + \", module ignored.\");", "\t\t\t\t}", "\t\t\t\tcatch (LinkageError le) {", "\t\t\t\t\treport(\"Class \" + className + \" \" + le.toString() + \", module ignored.\");", "\t\t\t\t}", "\t\t\t}", " else if( key.startsWith( Property.SUB_SUB_PROTOCOL_PREFIX)) {", " String subSubProtocol = key.substring( Property.SUB_SUB_PROTOCOL_PREFIX.length());", " String className = moduleList.getProperty(key);", "\t\t\t\tif (SanityManager.DEBUG && reportOn) {", "\t\t\t\t\treport(\"Accessing module \" + className + \" to run initializers at boot time\");", " try {", " Class possibleImplementation = Class.forName(className);", "\t\t\t\t\t// Look for the monitors special classes, PersistentService and StorageFactory ones.", " if( getPersistentServiceImplementation( possibleImplementation))", " continue;", " if( StorageFactory.class.isAssignableFrom( possibleImplementation)) {", " if( newInstance( possibleImplementation) == null)", " report(\"Class \" + className + \" cannot create instance, StorageFactory ignored.\");", " else", " storageFactories.put( subSubProtocol, className);", " continue;", " }", " }", "\t\t\t\tcatch (ClassNotFoundException cnfe) {", "\t\t\t\t\treport(\"Class \" + className + \" \" + cnfe.toString() + \", module ignored.\");", "\t\t\t\tcatch (LinkageError le) {", "\t\t\t\t\treport(\"Class \" + className + \" \" + le.toString() + \", module ignored.\");", " }", " }" ] } ] } ]
derby-DERBY-928-cf3c4cb4
DERBY-928 Add ability to network server to accept connections with a certain security mechanism. Add derby.drda.securityMechanism property to restrict securityMechanisms accepted from client Detailed description of patch in bug https://issues.apache.org/jira/browse/DERBY-928#action_12366294 Contrbuted by Sunitha Kambhampati git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@382019 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/drda/org/apache/derby/impl/drda/DRDAConnThread.java", "hunks": [ { "added": [ " ", " // if Property.DRDA_PROP_SECURITYMECHANISM has been set, then", " // network server only accepts connections which use that", " // security mechanism. No other types of connections ", " // are accepted.", " // Make check to see if this property has been set.", " // if set, and if the client requested security mechanism ", " // is not the same, then return a security check code ", " // that the server does not support/allow this security ", " // mechanism", " if ( (server.getSecurityMechanism() != ", " NetworkServerControlImpl.INVALID_OR_NOTSET_SECURITYMECHANISM)", " && securityMechanism != server.getSecurityMechanism())", " securityCheckCode = CodePoint.SECCHKCD_NOTSUPPORTED;", " else", " {", " // for plain text userid,password USRIDPWD, and USRIDONL", " // no need of decryptionManager", " if (securityMechanism != CodePoint.SECMEC_USRIDPWD &&", " securityMechanism != CodePoint.SECMEC_USRIDONL)", " {", " //this is the only other one we understand", " if (securityMechanism != CodePoint.SECMEC_EUSRIDPWD) ", " securityCheckCode = CodePoint.SECCHKCD_NOTSUPPORTED;", " else", " {", " try {", " if (decryptionManager == null)", " decryptionManager = new DecryptionManager();", " myPublicKey = decryptionManager.obtainPublicKey();", " } catch (SQLException e) {", " println2Log(null, session.drdaID, e.getMessage());", " // Local security service non-retryable error.", " securityCheckCode = CodePoint.SECCHKCD_0A;", " }", " }", " }", " }" ], "header": "@@ -1571,27 +1571,44 @@ class DRDAConnThread extends Thread {", "removed": [ "\t\t\t\t\t// for plain text userid,password USRIDPWD, and USRIDONL", "\t\t\t\t // no need of decryptionManager", "\t\t\t\t\tif (securityMechanism != CodePoint.SECMEC_USRIDPWD &&", "\t\t\t\t\t securityMechanism != CodePoint.SECMEC_USRIDONL)", "\t\t\t\t\t{", "\t\t\t\t\t\t//this is the only other one we understand", "\t\t\t\t\t\tif (securityMechanism != CodePoint.SECMEC_EUSRIDPWD) ", "\t\t\t\t\t\t\tsecurityCheckCode = CodePoint.SECCHKCD_NOTSUPPORTED;", "\t\t\t\t\t\telse", "\t\t\t\t\t\t{", "\t\t\t\t\t\t\ttry {", "\t\t\t\t\t\t\t\tif (decryptionManager == null)", "\t\t\t\t\t\t\t\t\tdecryptionManager = new DecryptionManager();", "\t\t\t\t\t\t\t\tmyPublicKey = decryptionManager.obtainPublicKey();", "\t\t\t\t\t\t\t} catch (SQLException e) {", "\t\t\t\t\t\t\t\tprintln2Log(null, session.drdaID, e.getMessage());", "\t\t\t\t\t\t\t\t// Local security service non-retryable error.", "\t\t\t\t\t\t\t\tsecurityCheckCode = CodePoint.SECCHKCD_0A;", "\t\t\t\t\t\t\t}", "\t\t\t\t\t\t}", "\t\t\t\t\t}" ] } ] }, { "file": "java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java", "hunks": [ { "added": [ " protected final static int INVALID_OR_NOTSET_SECURITYMECHANISM = -1; ", " // variable to store value set to derby.drda.securityMechanism", " // default value is -1 which indicates that this property isnt set or", " // the value is invalid", " private int allowOnlySecurityMechanism = INVALID_OR_NOTSET_SECURITYMECHANISM;" ], "header": "@@ -243,6 +243,11 @@ public final class NetworkServerControlImpl {", "removed": [] }, { "added": [ " propval = PropertyUtil.getSystemProperty( ", " Property.DRDA_PROP_SECURITYMECHANISM);", " if (propval != null){", " setSecurityMechanism(propval);", " }", "", " /**", " * Retrieve the SECMEC integer value from the", " * user friendly security mechanism name", " * @param s security mechanism name", " * @return integer value , return the SECMEC value for ", " * the security mechanism as defined by DRDA spec", " * or INVALID_OR_NOTSET_SECURITYMECHANISM if 's'", " * passed is invalid or not supported security ", " * mechanism", " */", " private int getSecMecValue(String s)", " {", " int secmec = INVALID_OR_NOTSET_SECURITYMECHANISM;", " if( StringUtil.SQLEqualsIgnoreCase(s,\"USER_ONLY_SECURITY\"))", " secmec = CodePoint.SECMEC_USRIDONL;", " else if( StringUtil.SQLEqualsIgnoreCase(s,\"CLEAR_TEXT_PASSWORD_SECURITY\"))", " secmec = CodePoint.SECMEC_USRIDPWD;", " else if( StringUtil.SQLEqualsIgnoreCase(s,\"ENCRYPTED_USER_AND_PASSWORD_SECURITY\"))", " secmec = CodePoint.SECMEC_EUSRIDPWD;", " ", " return secmec;", " }", "", " /**", " * Retrieve the string name for the integer", " * secmec value", " * @param secmecVal secmec value", " * @return String - return the string name corresponding ", " * to the secmec value if recognized else returns null", " */", " private String getStringValueForSecMec(int secmecVal)", " {", " switch(secmecVal)", " {", " case CodePoint.SECMEC_USRIDONL:", " return \"USER_ONLY_SECURITY\";", " ", " case CodePoint.SECMEC_USRIDPWD:", " return \"CLEAR_TEXT_PASSWORD_SECURITY\";", " ", " case CodePoint.SECMEC_EUSRIDPWD:", " return \"ENCRYPTED_USER_AND_PASSWORD_SECURITY\";", " }", " return null;", " }", " " ], "header": "@@ -2484,8 +2489,60 @@ public final class NetworkServerControlImpl {", "removed": [] }, { "added": [ " * Set the security mechanism for derby.drda.securityMechanism", " * If this property is set, server will only allow connections", " * from client with this security mechanism.", " * This method will map the user friendly string representing ", " * the security mechanism to the corresponding drda secmec value", "\t * @param s security mechanism string value", "\t * @throws Exception if value to set is invalid", " * @see Property#DRDA_PROP_SECURITYMECHANISM ", "\t */", " private void setSecurityMechanism(String s)", " throws Exception", " {", " allowOnlySecurityMechanism = getSecMecValue(s);", " ", " if (allowOnlySecurityMechanism == INVALID_OR_NOTSET_SECURITYMECHANISM)", " consolePropertyMessage(\"DRDA_InvalidValue.U\", new String [] ", " {s, Property.DRDA_PROP_SECURITYMECHANISM});", " }", " ", " /**", " * get the security mechanism (secmec value) that the server", " * will accept connections from.", " * @return the securitymechanism value. It is value that ", " * the derby.drda.securityMechanism was set to, if it is not set, then", " * it is equal to INVALID_OR_NOTSET_SECURITYMECHANISM", " * @see Property#DRDA_PROP_SECURITYMECHANISM ", " */", " protected int getSecurityMechanism()", " {", " return allowOnlySecurityMechanism;", " }", "\t/**" ], "header": "@@ -2819,6 +2876,38 @@ public final class NetworkServerControlImpl {", "removed": [] }, { "added": [ " ", "" ], "header": "@@ -2991,6 +3080,8 @@ public final class NetworkServerControlImpl {", "removed": [] } ] } ]
derby-DERBY-930-f4e03230
DERBY-930: Enable autoloading of client drivers now that build 81 of jdk1.6 fixes a problem with autoloading under the SecurityManager. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@396638 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/functionTests/util/TestConfiguration.java", "hunks": [ { "added": [ "import java.security.*;", "import org.apache.derby.iapi.services.info.JVMInfo;", "" ], "header": "@@ -19,10 +19,11 @@", "removed": [ "import java.security.AccessController;", "import java.security.PrivilegedAction;" ] }, { "added": [ "\t\tsystemStartupProperties = props;" ], "header": "@@ -41,6 +42,7 @@ public class TestConfiguration {", "removed": [] }, { "added": [ " /**", " * Get the given system property as specified at startup.", " */", "\tpublic\tString\tgetSystemStartupProperty( String key )", "\t{", "\t\treturn systemStartupProperties.getProperty( key );", "\t}", "" ], "header": "@@ -72,6 +74,14 @@ public class TestConfiguration {", "removed": [] }, { "added": [ " /**", " * Set the verbosity, i.e., whether debug statements print.", " */", " public void\tsetVerbosity( boolean isChatty )\t{ isVerbose = isChatty; }", " " ], "header": "@@ -175,6 +185,11 @@ public class TestConfiguration {", "removed": [] }, { "added": [ " \t/**", " \t * <p>", "\t * Return true if the client supports JDBC4, i.e., if the VM level is at", "\t * least 1.6.", "\t * </p>", "\t */", "\tpublic\tboolean\tsupportsJDBC4()", "\t{", "\t\tif ( JVMInfo.JDK_ID >= JVMInfo.J2SE_16 ) { return true; }", "\t\telse { return false; }", "\t}", "", "\t/**", "\t * <p>", "\t * Return true if we classes are being loaded from jar files. For the time", "\t * being, this simply tests that the JVMInfo class (common to the client and", "\t * the server) comes out of a jar file.", "\t * </p>", "\t */", "\tpublic\tboolean\tloadingFromJars()", "\t{", "\t\t//", "\t\t// jvm.java sets this property to the build jar directory", "\t\t// if we are using derbyTesting.jar.", "\t\t//", "\t\t", "\t\treturn ( !UNUSED.equals( getSystemStartupProperty( \"derbyTesting.codejar\" ) ) );", "\t}", "", "\tprivate\tfinal Properties systemStartupProperties;" ], "header": "@@ -184,9 +199,39 @@ public class TestConfiguration {", "removed": [] }, { "added": [ " private boolean isVerbose;" ], "header": "@@ -194,7 +239,7 @@ public class TestConfiguration {", "removed": [ " private final boolean isVerbose;" ] }, { "added": [ " /**", " * Possible values of system properties.", " */", " private final static String UNUSED = \"file://unused/\";", "" ], "header": "@@ -217,4 +262,9 @@ public class TestConfiguration {", "removed": [] } ] } ]
derby-DERBY-937-ffb23e9b
DERBY-937, committing change by Andreas Korneliussen. notes by Andreas: I was able to reproduce this problem on every run on a very fast laptop (it was not reproducible on any other Windows lab machine I have tried). This laptop happens to be the same kind as Ole uses for the nightly tests. Adding a 10 second sleeping period after the population of the tables, did not have any effect. I therefore tried to do run a compress on the tables (based on the assumption that statistics is updated on compress), and now the test does not fail for me anymore. Attached is the patch which makes this test stop failing. The patch does not seem to have any sideeffects on other platforms (Solaris) tested, however the test will use more time. note by mike: I ran this change 20 times and it worked on my laptop, it would always fail a few times out of 20 before the fix. I am not sure why this fix works as the test seems to already create indexes after tables so statistics should already be up to date. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@418108 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-938-a50c94c0
DERBY-938 Optimize ContextManager Use an unsynchronized collection for the manager since it is owned by a single thread, provide optimized access to a set of contexts with the same identifier. Contributed by Dyre Tjeldvoll Dyre.Tjeldvoll@sun.com git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@379265 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/services/context/ContextManager.java", "hunks": [ { "added": [ "import java.util.HashMap;", "import java.util.ArrayList;", "import java.util.List;", "import java.util.Collections;" ], "header": "@@ -37,9 +37,10 @@ import org.apache.derby.iapi.reference.SQLState;", "removed": [ "import java.util.Hashtable;", "import java.util.Stack;", "import java.util.Vector;" ] }, { "added": [ "\t/**", "\t * The CtxStack implement a stack on top of an ArrayList (to avoid", "\t * the inherent overhead associated with java.util.Stack which is", "\t * built on top of java.util.Vector, which is fully", "\t * synchronized).", "\t */", "\tprivate static final class CtxStack {", "\t\tprivate ArrayList stack_ = new ArrayList();", "", "\t\t// Keeping a reference to the top element on the stack", "\t\t// optimizes the frequent accesses to this element. The", "\t\t// tradeoff is that pushing and popping becomes more", "\t\t// expensive, but those operations are infrequent.", "\t\tprivate Context top_ = null;", "", "\t\tvoid push(Context context) { ", "\t\t\tstack_.add(context); ", "\t\t\ttop_ = context; ", "\t\t}", "\t\tvoid pop() {", "\t\t\tstack_.remove(stack_.size()-1);", "\t\t\ttop_ = stack_.isEmpty() ? ", "\t\t\t\tnull : (Context) stack_.get(stack_.size()-1); ", "\t\t}", "\t\tvoid remove(Context context) {", "\t\t\tif (context == top_) {", "\t\t\t\tpop();", "\t\t\t\treturn;", "\t\t\t}", "\t\t\tstack_.remove(stack_.lastIndexOf(context)); ", "\t\t}", "\t\tContext top() { ", "\t\t\treturn top_; ", "\t\t}", "\t\tboolean isEmpty() { return stack_.isEmpty(); }", "\t\tList getUnmodifiableList() { ", "\t\t return Collections.unmodifiableList(stack_); ", "\t\t}", "\t}", "\t/**", "\t * Empty ArrayList to use as void value", "\t */", "\t//private final ArrayList voidArrayList_ = new ArrayList(0);", "\t/**", "\t * HashMap that holds the Context objects. The Contexts are stored", "\t * with a String key.", "\t * @see ContextManager#pushContext(Context)", "\t */", "\tprivate final HashMap ctxTable = new HashMap();", "\t/**", "\t * List of all Contexts", "\tprivate final ArrayList holder = new ArrayList();", "\t/**", "\t * Add a Context object to the ContextManager. The object is added", "\t * both to the holder list and to a stack for the specific type of", "\t * Context.", "\t * @param newContext the new Context object", "\t */", "\t\tfinal String contextId = newContext.getIdName();", "\t\tCtxStack idStack = (CtxStack) ctxTable.get(contextId);", "\t\tif (idStack == null) {", "\t\t\tidStack = new CtxStack();", "\t\t\tctxTable.put(contextId, idStack);", "\t\tholder.add(newContext);", "\t", "\t * Obtain the last pushed Context object of the type indicated by", "\t * the contextId argument.", "\t * @param contextId a String identifying the type of Context", "\t * @return The Context object with the corresponding contextId, or null if not found", "\tpublic Context getContext(String contextId) {", "\t\t", "\t\tfinal CtxStack idStack = (CtxStack) ctxTable.get(contextId);", "\t\t\tSanityManager.ASSERT( idStack == null ||", "\t\t\t\t\t\t\t\t idStack.isEmpty() ||", "\t\t\t\t\t\t\t\t idStack.top().getIdName() == contextId);", "\t\treturn (idStack==null?null:idStack.top());", "\t * Remove the last pushed Context object, regardless of type. If", "\t * there are no Context objects, no action is taken.", "\t\tif (holder.isEmpty()) {", "\t\tContext theContext = (Context) holder.remove(holder.size()-1);", "\t\tfinal String contextId = theContext.getIdName();", "\t\tfinal CtxStack idStack = (CtxStack) ctxTable.get(contextId);", "\t\tif (SanityManager.DEBUG) {", "\t\t\tSanityManager.ASSERT( idStack != null &&", "\t\t\t\t\t\t\t\t (! idStack.isEmpty()) &&", "\t\t\t\t\t\t\t\t idStack.top().getIdName() == contextId);", "\t\t}", "\t/**", "\t * Removes the specified Context object. If", "\t * the specified Context object does not exist, the call will fail.", "\t * @param theContext the Context object to remove.", "\t */", "\t\t\tSanityManager.ASSERT(!holder.isEmpty());", "\t\tholder.remove(holder.lastIndexOf(theContext));", "", "\t\tfinal String contextId = theContext.getIdName();", "\t\tfinal CtxStack idStack = (CtxStack) ctxTable.get(contextId);", "\t\tidStack.remove(theContext);", "\t}", "\t", "\t/**", "\t * Return an unmodifiable list reference to the ArrayList backing", "\t * CtxStack object for this type of Contexts. This method allows", "\t * fast traversal of all Contexts on that stack. The first element", "\t * in the List corresponds to the bottom of the stack. The", "\t * assumption is that the Stack will not be modified while it is", "\t * being traversed.", "\t * @param contextId the type of Context stack to return.", "\t * @return an unmodifiable \"view\" of the ArrayList backing the stack", "\t * @see org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext#resetSavepoints()", "\t * @see org.apache.derby.iapi.sql.conn.StatementContext#resetSavePoint()", "\t */", "\tpublic final List getContextStack(String contextId) {", "\t\tfinal CtxStack cs = (CtxStack) ctxTable.get(contextId);", "\t\treturn (cs==null?Collections.EMPTY_LIST:cs.getUnmodifiableList());", "" ], "header": "@@ -58,122 +59,172 @@ import java.util.Locale;", "removed": [ "", "\tprivate final Stack holder;", "\t/*", "\t * ContextManager interface", "", "\t\tString contextId = newContext.getIdName();", "", "\t\tStack idStack = (Stack) ctxTable.get(contextId);", "\t\tif (idStack == null)", "\t\t{", "\t\t\tidStack = new Stack();", "\t\t\tctxTable.put(contextId,idStack);", "\t\tholder.push(newContext);", "", "\t * @see org.apache.derby.iapi.services.context.ContextManager#getContext", "\tpublic Context getContext(String contextId)", "\t{", "", "\t\tStack idStack = (Stack)ctxTable.get(contextId);", "", "\t\tSanityManager.ASSERT( idStack == null ||", "\t\t\tidStack.empty() ||", "\t\t\t((Context)idStack.peek()).getIdName().equals(contextId));", "", "\t\tif (idStack == null ||", "\t\t idStack.empty())", "\t\t{", "\t\t\treturn null;", "\t\t}", "", "", "", "\t\treturn (Context) idStack.peek();", "\t * @see org.apache.derby.iapi.services.context.ContextManager#popContext", "", "\t\tContext theContext;", "\t\tString contextId;", "\t\tStack idStack;", "", "\t\tif (holder.empty())", "\t\t{", "\t\ttheContext = (Context) holder.pop();", "\t\tcontextId = theContext.getIdName();", "\t\tidStack = (Stack)ctxTable.get(contextId);", "", "\t\tif (SanityManager.DEBUG)", "\t\tSanityManager.ASSERT( idStack != null &&", "\t\t\t(! idStack.empty()) &&", "\t\t\t((Context)idStack.peek()).getIdName() == contextId);", "", "\t\tStack idStack;", "", "\t\tSanityManager.ASSERT(!holder.empty());", "\t\t// to do this we treat it like its vector supertype.", "\t\tint index = holder.lastIndexOf(theContext);", "\t\tif (index != -1)", "\t\t\tholder.removeElementAt(index);", "\t\telse if (SanityManager.DEBUG) {", "\t\t\t//SanityManager.THROWASSERT(\"Popped non-existent context by id \" + theContext + \" type \" + theContext.getIdName());", "\t\t}", "\t\tidStack = (Stack) ctxTable.get(theContext.getIdName());", "\t\tboolean wasThere = idStack.removeElement(theContext);", "\t\tif (SanityManager.DEBUG) {", "\t\t\t//if (!wasThere)", "\t\t\t//\tSanityManager.THROWASSERT(\"Popped non-existent stack by id \" + theContext + \" type \" + theContext.getIdName());", "\t\t}" ] }, { "added": [ "\t\t\t\t\tContext ctx = ((Context) holder.get(index));" ], "header": "@@ -264,7 +315,7 @@ cleanup:\tfor (int index = holder.size() - 1; index >= 0; index--) {", "removed": [ "\t\t\t\t\tContext ctx = ((Context) holder.elementAt(index));" ] }, { "added": [ "\t * Constructs a new instance. No CtxStacks are inserted into the", "\t * hashMap as they will be allocated on demand.", "\t * @param csf the ContextService owning this ContextManager", "\t * @param stream error stream for reporting errors" ], "header": "@@ -443,23 +494,20 @@ cleanup:\tfor (int index = holder.size() - 1; index >= 0; index--) {", "removed": [ "\t * constructor specifying the hash table size and load", "\t * factor for the hashed-by-id context stacks.", "\t\tctxTable = new Hashtable();", "", "\t\tholder = new Stack();", "\tprivate final Hashtable ctxTable;", "" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java", "hunks": [ { "added": [ "import java.util.List;" ], "header": "@@ -82,6 +82,7 @@ import org.apache.derby.iapi.sql.execute.RunTimeStatistics;", "removed": [] }, { "added": [ "\t\t\tresetSavepoints();" ], "header": "@@ -1141,7 +1142,7 @@ public class GenericLanguageConnectionContext", "removed": [ "\t\t\tresetSavepoints(statementContext);" ] }, { "added": [ "\t\t\tresetSavepoints();", "\t/**", "\t * Reset all statement savepoints. Traverses the StatementContext", "\t * stack from bottom to top, calling resetSavePoint()", "\t * on each element.", "\t *", "\t * @exception StandardException thrown if something goes wrong", "\t */", "\tprivate void resetSavepoints() throws StandardException ", "\t\tfinal ContextManager cm = getContextManager();", "\t\tfinal List stmts = cm.getContextStack(org.apache.derby.", "\t\t\t\t\t\t\t\t\t\t\t iapi.reference.", "\t\t\t\t\t\t\t\t\t\t\t ContextId.LANG_STATEMENT);", "\t\tfinal int end = stmts.size();", "\t\tfor (int i = 0; i < end; ++i) {", "\t\t\t((StatementContext)stmts.get(i)).resetSavePoint();" ], "header": "@@ -1317,40 +1318,26 @@ public class GenericLanguageConnectionContext", "removed": [ "\t\t\tresetSavepoints(statementContext);", "\t/*", "\t** Reset all statement savepoints. ", "\t*/", "\tprivate void resetSavepoints(StatementContext statementContext)", "\t\t throws StandardException ", "\t\tif (statementContext == null)", "\t\t\treturn;", "", "\t\tContextManager cm = getContextManager();", "\t\tStack stack = new Stack();", "", "\t\t// build up a stack with all the statement", "\t\t// contexts.", "\t\tdo", "\t\t{", "\t\t\tstack.push(statementContext);", "\t\t\tstatementContext.popMe();", "\t\t}", "\t\twhile ((statementContext = ((StatementContext)cm.getContext(org.apache.derby.iapi.reference.ContextId.LANG_STATEMENT))) != null);", "", "\t\twhile (!stack.empty())", "\t\t{", "\t\t\tstatementContext = ((StatementContext)stack.pop());", "", "\t\t\t// reset the savepoints to the new spot", "\t\t\tstatementContext.resetSavePoint();", "", "\t\t\t// replace the contexts that we removed above", "\t\t\tstatementContext.pushMe();" ] } ] } ]
derby-DERBY-939-6f2391f7
DERBY-939: NullPointerException at ResultSet.close() time for simple query using UNION and INTERSECT. Contributed by Yip Ng. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@427899 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/execute/RealResultSetStatisticsFactory.java", "hunks": [ { "added": [ "import org.apache.derby.impl.sql.execute.SetOpResultSet;" ], "header": "@@ -62,6 +62,7 @@ import org.apache.derby.impl.sql.execute.ProjectRestrictResultSet;", "removed": [] }, { "added": [ "import org.apache.derby.impl.sql.execute.rts.RealSetOpResultSetStatistics;" ], "header": "@@ -96,6 +97,7 @@ import org.apache.derby.impl.sql.execute.rts.RealProjectRestrictStatistics;", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/SetOpResultSet.java", "hunks": [ { "added": [ " Copyright 2004, 2006 The Apache Software Foundation or its licensors, as applicable." ], "header": "@@ -2,7 +2,7 @@", "removed": [ " Copyright 2004 The Apache Software Foundation or its licensors, as applicable." ] }, { "added": [ " /* Run time statistics variables */", " private int rowsSeenLeft;", " private int rowsSeenRight;", " private int rowsReturned;", "" ], "header": "@@ -64,6 +64,11 @@ public class SetOpResultSet extends NoPutResultSetImpl", "removed": [] }, { "added": [ "\t \tSanityManager.ASSERT( ! isOpen, \"SetOpResultSet already open\");", " if (rightInputRow != null)", " {", " rowsSeenRight++;", " }", "" ], "header": "@@ -99,12 +104,17 @@ public class SetOpResultSet extends NoPutResultSetImpl", "removed": [ "\t \tSanityManager.ASSERT( ! isOpen, \"SetOpProjectRestrictResultSet already open\");" ] }, { "added": [ " rowsSeenLeft++;", "" ], "header": "@@ -121,6 +131,8 @@ public class SetOpResultSet extends NoPutResultSetImpl", "removed": [] }, { "added": [ " while ( rightInputRow != null && (compare = compare(leftColumns, rightInputRow.getRowArray())) > 0)", " {", " if (rightInputRow != null)", " {", " rowsSeenRight++;", " }", " }", "" ], "header": "@@ -130,9 +142,15 @@ public class SetOpResultSet extends NoPutResultSetImpl", "removed": [ " while( rightInputRow != null && (compare = compare( leftColumns, rightInputRow.getRowArray())) > 0)", " " ] }, { "added": [ " \"Intersect/Except execution has gotten confused.\");", " if ( all)", " {", " if (rightInputRow != null)", " {", " rowsSeenRight++;", " }", " }", "" ], "header": "@@ -145,10 +163,17 @@ public class SetOpResultSet extends NoPutResultSetImpl", "removed": [ " \"Insert/Except execution has gotten confused.\");", " if( all)" ] }, { "added": [ " setCurrentRow( currentRow );", "", " if (currentRow != null) {", " rowsReturned++;", " }", "" ], "header": "@@ -160,7 +185,12 @@ public class SetOpResultSet extends NoPutResultSetImpl", "removed": [ " setCurrentRow( currentRow);" ] }, { "added": [ " while ((rightInputRow = rightSource.getNextRowCore()) != null)", " {", " rowsSeenRight++;", "", " if (compare(leftColumns, rightInputRow.getRowArray()) == 0) ", " continue;", " }" ], "header": "@@ -168,9 +198,13 @@ public class SetOpResultSet extends NoPutResultSetImpl", "removed": [ " while((rightInputRow = rightSource.getNextRowCore()) != null", " && compare( leftColumns, rightInputRow.getRowArray()) == 0)", " ;" ] }, { "added": [ "\t\t\t\tSanityManager.DEBUG(\"CloseRepeatInfo\",\"Close of SetOpResultSet repeated\");" ], "header": "@@ -237,7 +271,7 @@ public class SetOpResultSet extends NoPutResultSetImpl", "removed": [ "\t\t\t\tSanityManager.DEBUG(\"CloseRepeatInfo\",\"Close of UnionResultSet repeated\");" ] } ] } ]
derby-DERBY-941-448ecb0e
DERBY-941: Commit Narayanan's statementeventlisteners_embedded_v2.diff patch, implementing embedded support for JDBC4 statement event listening. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@394788 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/jdbc/EmbedPreparedStatement.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.jdbc.BrokeredConnectionControl;" ], "header": "@@ -68,6 +68,7 @@ import java.io.EOFException;", "removed": [] }, { "added": [ " ", " private BrokeredConnectionControl bcc=null;" ], "header": "@@ -94,6 +95,8 @@ public abstract class EmbedPreparedStatement", "removed": [] }, { "added": [ " if (bcc!=null)", " bcc.onStatementClose(this);" ], "header": "@@ -208,6 +211,8 @@ public abstract class EmbedPreparedStatement", "removed": [] }, { "added": [ " try {", " executeStatement(activation, true, false);", " } catch(SQLException sqle) {", " checkStatementValidity(sqle);", " }", " ", " if (SanityManager.DEBUG) {", " if (results == null)", " SanityManager.THROWASSERT(\"no results returned on executeQuery()\");", " }", " ", " return results;", " }" ], "header": "@@ -246,15 +251,19 @@ public abstract class EmbedPreparedStatement", "removed": [ "\t\texecuteStatement(activation, true, false);", "", "\t\tif (SanityManager.DEBUG) {", "\t\t\tif (results == null)", "\t\t\t\tSanityManager.THROWASSERT(\"no results returned on executeQuery()\");", "\t\t}", "", "\t\treturn results;", "\t}" ] }, { "added": [ " public final int executeUpdate() throws SQLException {", " try {", " executeStatement(activation, false, true);", " } catch(SQLException sqle) {", " checkStatementValidity(sqle);", " }", " return updateCount;", " }" ], "header": "@@ -265,10 +274,14 @@ public abstract class EmbedPreparedStatement", "removed": [ "\tpublic final int executeUpdate() throws SQLException {", "\t\texecuteStatement(activation, false, true);", "\t\treturn updateCount;", "\t}" ] }, { "added": [ " public final boolean execute() throws SQLException {", " boolean ret=false;", " try{", " ret = executeStatement(activation, false, false);", " } catch(SQLException sqle) {", " checkStatementValidity(sqle);", " }", " return ret;", " }" ], "header": "@@ -1107,9 +1120,15 @@ public abstract class EmbedPreparedStatement", "removed": [ " public final boolean execute() throws SQLException {", "\t\treturn executeStatement(activation, false, false);", "\t}" ] }, { "added": [ " /*", " * This method is used to initialize the BrokeredConnectionControl ", " * variable with its implementation. This method will be called in the ", " * BrokeredConnectionControl class ", " *", " * @param control used to call the onStatementClose and ", " * onStatementErrorOccurred methods that have logic to ", " * raise StatementEvents for the close and error events", " * on the PreparedStatement", " *", " */", " public void setBrokeredConnectionControl(BrokeredConnectionControl control) {", " bcc = control;", " }", " ", " /*", " * Method calls onStatementError occurred on the ", " * BrokeredConnectionControl class after checking the ", " * SQLState of the SQLException thrown.", " */", " ", " private void checkStatementValidity(SQLException sqle) throws SQLException {", " /*", " * The subclass of SQLException thrown when the SQLState class value is", " * '42'. This indicates that the in-progress query has violated SQL", " * syntax rules.", " *", " * Check if the exception has occurred because the connection", " * associated with the PreparedStatement has been closed", " *", " * This exception has the SQLState of 08003 which is represented", " * by the constant SQLState.ERROR_CLOSE", " */", " if(bcc != null && (sqle.getSQLState().equals(\"08003\")", " || sqle.getSQLState().startsWith(SQLState.LSE_COMPILATION_PREFIX)) ) {", " //call the BrokeredConnectionControl interface method", " //onStatementErrorOccurred", " bcc.onStatementErrorOccurred(this,sqle);", " }", " throw sqle;", " }", " ", " " ], "header": "@@ -1433,7 +1452,49 @@ public abstract class EmbedPreparedStatement", "removed": [ "" ] } ] }, { "file": "java/engine/org/apache/derby/jdbc/EmbedPooledConnection.java", "hunks": [ { "added": [ "import org.apache.derby.impl.jdbc.EmbedPreparedStatement;", "import org.apache.derby.impl.jdbc.EmbedCallableStatement;" ], "header": "@@ -31,6 +31,8 @@ import org.apache.derby.impl.jdbc.EmbedConnection;", "removed": [] }, { "added": [ "\tprotected boolean isActive;" ], "header": "@@ -88,7 +90,7 @@ class EmbedPooledConnection implements javax.sql.PooledConnection, BrokeredConne", "removed": [ "\tprivate boolean isActive;" ] }, { "added": [ " * Call the setBrokeredConnectionControl method inside the ", " * EmbedPreparedStatement class to set the BrokeredConnectionControl ", " * variable to this instance of EmbedPooledConnection", " * This will then be used to call the onStatementErrorOccurred", " * and onStatementClose events when the corresponding events", " * occur on the PreparedStatement", " *", " * @param ps PreparedStatment to be wrapped", " * @param sql String", " * @param generatedKeys Object", " * @return returns the wrapped PreparedStatement", " * @throws java.sql.SQLException", "\t */", " /*", " ", " */", " EmbedPreparedStatement ps_ = (EmbedPreparedStatement)ps;", " ps_.setBrokeredConnectionControl(this);", "\t\treturn (PreparedStatement)ps_;", " ", " /**", " * Call the setBrokeredConnectionControl method inside the ", " * EmbedCallableStatement class to set the BrokeredConnectionControl ", " * variable to this instance of EmbedPooledConnection", " * This will then be used to call the onStatementErrorOccurred", " * and onStatementClose events when the corresponding events", " * occur on the CallableStatement", " *", " * @param cs CallableStatment to be wrapped", " * @param sql String", " * @return returns the wrapped CallableStatement", " * @throws java.sql.SQLException", "\t */", " EmbedCallableStatement cs_ = (EmbedCallableStatement)cs;", " cs_.setBrokeredConnectionControl(this);", "\t\treturn (CallableStatement)cs_;" ], "header": "@@ -428,16 +430,45 @@ class EmbedPooledConnection implements javax.sql.PooledConnection, BrokeredConne", "removed": [ "\t\tNo need to wrap statements for PooledConnections.", "\t*/", "\t\treturn ps;", "\t/**", "\t\tNo need to wrap statements for PooledConnections.", "\t*/", "\t\treturn cs;" ] } ] }, { "file": "java/engine/org/apache/derby/jdbc/EmbedPooledConnection40.java", "hunks": [ { "added": [ "import java.util.Enumeration;", "import java.util.Vector;", "import java.sql.PreparedStatement;", "import javax.sql.StatementEvent;" ], "header": "@@ -23,6 +23,10 @@ package org.apache.derby.jdbc;", "removed": [] }, { "added": [ " ", " //using generics to avoid casting problems", " protected final Vector<StatementEventListener> statementEventListeners =", " new Vector<StatementEventListener>();", " " ], "header": "@@ -37,6 +41,11 @@ import javax.sql.StatementEventListener;", "removed": [] }, { "added": [ " if (listener == null)", " return;", " statementEventListeners.removeElement(listener);" ], "header": "@@ -55,8 +64,9 @@ class EmbedPooledConnection40 extends EmbedPooledConnection {", "removed": [ " throw new UnsupportedOperationException (", " \"addStatementEventListener(StatementEventListener listener)\");" ] } ] }, { "file": "java/engine/org/apache/derby/jdbc/EmbedXAConnection.java", "hunks": [ { "added": [ " ps = super.wrapStatement(ps,sql,generatedKeys);" ], "header": "@@ -165,6 +165,7 @@ class EmbedXAConnection extends EmbedPooledConnection", "removed": [] } ] }, { "file": "java/testing/org/apache/derbyTesting/functionTests/util/TestUtil.java", "hunks": [ { "added": [ "\t\t\tclassname = checkForJDBC40Implementation(classname);" ], "header": "@@ -307,16 +307,7 @@ public class TestUtil {", "removed": [ "\t\t\t// The JDBC 4.0 implementation of the DataSource interface", "\t\t\t// is suffixed with \"40\". Use it if it is available and", "\t\t\t// the JVM version is at least 1.6.", "\t\t\tif (JVMInfo.JDK_ID >= JVMInfo.J2SE_16) {", "\t\t\t\tString classname40 = classname + \"40\";", "\t\t\t\ttry {", "\t\t\t\t\tClass.forName(classname40);", "\t\t\t\t\tclassname = classname40;", "\t\t\t\t} catch (ClassNotFoundException e) {}", "\t\t\t}" ] }, { "added": [ " classname = checkForJDBC40Implementation(classname);", " ", " /**", " * returns the class name for the JDBC40 implementation", " * if present. otherwise returns the class name of the class", " * written for the lower jdk versions", " * @param classname String", " * @return String containing the name of the appropriate ", " * implementation", " */", " public static String checkForJDBC40Implementation(String classname) {", " String classname_ = classname;", " // The JDBC 4.0 implementation of the ", " // interface is suffixed with \"40\". Use it if it is available ", " // and the JVM version is at least 1.6.", " if (JVMInfo.JDK_ID >= JVMInfo.J2SE_16) {", " String classname40 = classname_ + \"40\";", " try {", " Class.forName(classname40);", " classname_ = classname40;", " } catch (ClassNotFoundException e) {}", " }", " return classname_;", " }" ], "header": "@@ -357,8 +348,32 @@ public class TestUtil {", "removed": [] } ] } ]
derby-DERBY-941-712b41b8
DERBY-941 (partial): Add JDBC4 support for Statement Events a) provide the imlementation for StatementEventListener methods in EmbedXAConnection40 b) Modify TestUtil.java to return EmbedXADataSource40 when running with mustang c) remove testing for LSE_COMPILATION_PREFIX as the prefix for the SQLState when throwing the Statement Error Occurred events. Patch contributed by V. Narayanan <V.Narayanan@Sun.COM>. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@396859 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/jdbc/EmbedPreparedStatement.java", "hunks": [ { "added": [ "\t * Additional close to close our activation.", "\t * In the case that a XAConnection is involved in the creation of this", "\t * PreparedStatement for e.g in the following case", "\t *", "\t * <code>", "\t * XAConnection xaconn = xadatasource.getXAConnection();//where xadatasource is an object of XADataSource", "\t * Connection conn = xaconnection.getConnection();", "\t * PreparedStatement ps = conn.preparedStatement(\"values 1\");", "\t * </code>", "\t *", "\t * In the above case the PreparedStatement will actually be a ", "\t * BrokeredPreparedStatement40 object. Hence when we call ", "\t * bcc.onStatementClose and pass the PreparedStatement that caused it", "\t * applicationStatement will be the appropriate choice since it will ", "\t * contain the appropriate instance of PreparedStatement in each case", "\t *", "\t * @throws SQLException upon failure", "\t *", "\t\tif (bcc!=null) {", "\t\t\tjava.sql.PreparedStatement ps_app = ", "\t\t\t\t(java.sql.PreparedStatement)applicationStatement;", "\t\t\tbcc.onStatementClose(ps_app);", "\t\t}" ], "header": "@@ -205,14 +205,32 @@ public abstract class EmbedPreparedStatement", "removed": [ "\t\tAdditional close to close our activation.", "", "\t\t@exception SQLException\tthrown on failure", " if (bcc!=null)", " bcc.onStatementClose(this);" ] } ] }, { "file": "java/engine/org/apache/derby/jdbc/EmbedXAConnection40.java", "hunks": [ { "added": [ "import java.util.Vector;", "import java.sql.PreparedStatement;", "import javax.sql.StatementEvent;" ], "header": "@@ -20,7 +20,10 @@", "removed": [] }, { "added": [ " //using generics to avoid casting problems", " protected final Vector<StatementEventListener> statementEventListeners =", " new Vector<StatementEventListener>();", " " ], "header": "@@ -31,6 +34,10 @@ import org.apache.derby.iapi.jdbc.ResourceAdapter;", "removed": [] }, { "added": [ " if (listener == null)", " return;", " statementEventListeners.removeElement(listener);" ], "header": "@@ -57,8 +64,9 @@ final class EmbedXAConnection40 extends EmbedXAConnection", "removed": [ " throw new UnsupportedOperationException (", " \"addStatementEventListener(StatementEventListener listener)\");" ] } ] }, { "file": "java/testing/org/apache/derbyTesting/functionTests/util/TestUtil.java", "hunks": [ { "added": [ "\t\tclassname = checkForJDBC40Implementation(classname);" ], "header": "@@ -333,6 +333,7 @@ public class TestUtil {", "removed": [] } ] } ]
derby-DERBY-942-94057f1e
DERBY-942: Commit Kristian's derby-942-connectiontest-rewrite.diff, which generalizes the connection test to run under XA also. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@410945 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-944-c0119bde
Commit Kristian's patch for DERBY-944: raising appropriate exceptions for RowID calls. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@389571 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-947-8c78a280
DERBY-947: Miscellaneous PreparedStatement methods added by JDBC4 As described in the JDBC 4 spec sections 13.2 and 3.1. This involves building support for JDBC4 methods added to PreparedStatement and not addressed by other JIRAs: isPoolable() and setPoolable(). Patch contributed by Francois Orsini. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@384753 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/client/org/apache/derby/client/am/PreparedStatement40.java", "hunks": [ { "added": [ " // By default a PreparedStatement is poolable when it is created", " private boolean isPoolable = true;", "" ], "header": "@@ -29,6 +29,9 @@ import java.io.InputStream;", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/jdbc/EmbedPreparedStatement40.java", "hunks": [ { "added": [ "public class EmbedPreparedStatement40 extends EmbedPreparedStatement30 {", "", " // By default a PreparedStatement is poolable when it is created", " private boolean isPoolable = true;" ], "header": "@@ -30,7 +30,10 @@ import java.sql.Types;", "removed": [ "public class EmbedPreparedStatement40 extends EmbedPreparedStatement30{" ] } ] } ]
derby-DERBY-948-c6390ccc
DERBY-948: Miscellaneous ResultSet methods added by JDBC 4 Implemented new methods defined by the JDBC 4 spec: * ResultSet.getHoldability() * ResultSet.isClosed() git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@382710 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/jdbc/EmbedResultSet40.java", "hunks": [ { "added": [ "import java.sql.Statement;", "/**", " * Implementation of JDBC 4 specific ResultSet methods.", " */" ], "header": "@@ -25,7 +25,11 @@ import java.sql.RowId;", "removed": [] } ] } ]