id
stringlengths 22
25
| commit_message
stringlengths 137
6.96k
| diffs
listlengths 0
63
|
|---|---|---|
derby-DERBY-6228-4c9b831a
|
DERBY-6228: Add parsing of SQLCARD warnings after next(). Don't commit tx when calling getWarnings(). Fix various locator-release errors when navigating SURs.
Patch file derby-6228-a.diff. (+ typo fix mentioned in review)
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1537881 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/client/org/apache/derby/client/am/ClientResultSet.java",
"hunks": [
{
"added": [
" private boolean savedIsValidCursorPosition_ = false;"
],
"header": "@@ -139,6 +139,7 @@ public abstract class ClientResultSet implements ResultSet,",
"removed": []
},
{
"added": [],
"header": "@@ -378,7 +379,6 @@ public abstract class ClientResultSet implements ResultSet,",
"removed": [
""
]
},
{
"added": [
" ",
" // Note that even though we navigate \"away\" from the current row",
" // we do not clean up the current row (i.e. release locators), so",
" // locators will still be valid when returning to the current row.",
" // See DERBY-6228.",
"",
" // It is possible to navigate from a row for which ",
" // isValidCursorPosition_==false to the insert row. By",
" // saving the old value here we can restore it when leaving",
" // the insert row. This is important since attempting to ",
" // release locators for a non-valid cursor position will trigger ",
" // an error on the server. See DERBY-6228.",
" savedIsValidCursorPosition_ = isValidCursorPosition_;"
],
"header": "@@ -3802,9 +3802,21 @@ public abstract class ClientResultSet implements ResultSet,",
"removed": [
""
]
},
{
"added": [
" // Restore the old value when leaving the insert row. See DERBY-6228.",
" isValidCursorPosition_ = savedIsValidCursorPosition_;"
],
"header": "@@ -3847,7 +3859,8 @@ public abstract class ClientResultSet implements ResultSet,",
"removed": [
" isValidCursorPosition_ = true;"
]
}
]
}
] |
derby-DERBY-6230-af88ec8d
|
DERBY-6230: Use the JVM's cache of Number instances in ReuseFactory
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1487773 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/iapi/util/ReuseFactory.java",
"hunks": [
{
"added": [
" return Integer.valueOf(i);",
" return Short.valueOf(i);",
" return Byte.valueOf(i);",
" return Long.valueOf(i);",
" return Boolean.valueOf(b);"
],
"header": "@@ -33,91 +33,29 @@ public class ReuseFactory {",
"removed": [
"\tprivate static final Integer[] staticInts =",
"\t\t{new Integer(0), new Integer(1), new Integer(2), new Integer(3),",
"\t\t new Integer(4), new Integer(5), new Integer(6), new Integer(7),",
"\t\t new Integer(8), new Integer(9), new Integer(10), new Integer(11),",
"\t\t new Integer(12), new Integer(13), new Integer(14), new Integer(15),",
"\t\t new Integer(16), new Integer(17), new Integer(18)};",
"\tprivate static final Integer FIFTY_TWO = new Integer(52);",
"\tprivate static final Integer TWENTY_THREE = new Integer(23);",
"\tprivate static final Integer MAXINT = new Integer(Integer.MAX_VALUE);",
"\tprivate static final Integer MINUS_ONE = new Integer(-1);",
"",
"\t\tif (i >= 0 && i < staticInts.length)",
"\t\t{",
"\t\t\treturn staticInts[i];",
"\t\t}",
"\t\telse",
"\t\t{",
"\t\t\t// Look for other common values",
"\t\t\tswitch (i)",
"\t\t\t{",
"\t\t\t case 23:",
"\t\t\t\treturn TWENTY_THREE;\t// precision of Int",
"",
"\t\t\t case 52:",
"\t\t\t\treturn FIFTY_TWO;\t// precision of Double",
"",
"\t\t\t case Integer.MAX_VALUE:",
"\t\t\t\treturn MAXINT;",
"",
"\t\t\t case -1:",
"\t\t\t\treturn MINUS_ONE;",
"",
"\t\t\t default:",
"\t\t\t\treturn new Integer(i);",
"\t\t\t}",
"\t\t}",
"\tprivate static final Short[] staticShorts =",
"\t\t{new Short((short) 0), new Short((short) 1), new Short((short) 2),",
"\t\t new Short((short) 3), new Short((short) 4), new Short((short) 5),",
"\t\t new Short((short) 6), new Short((short) 7), new Short((short) 8),",
"\t\t new Short((short) 9), new Short((short) 10)};",
"",
"\t\tif (i >= 0 && i < staticShorts.length)",
"\t\t\treturn staticShorts[i];",
"\t\telse",
"\t\t\treturn new Short(i);",
"\tprivate static final Byte[] staticBytes =",
"\t\t{new Byte((byte) 0), new Byte((byte) 1), new Byte((byte) 2),",
"\t\t new Byte((byte) 3), new Byte((byte) 4), new Byte((byte) 5),",
"\t\t new Byte((byte) 6), new Byte((byte) 7), new Byte((byte) 8),",
"\t\t new Byte((byte) 9), new Byte((byte) 10)};",
"",
"\t\tif (i >= 0 && i < staticBytes.length)",
"\t\t\treturn staticBytes[i];",
"\t\telse",
"\t\t\treturn new Byte(i);",
"\tprivate static final Long[] staticLongs =",
"\t\t{new Long(0), new Long(1), new Long(2),",
"\t\t new Long(3), new Long(4), new Long(5),",
"\t\t new Long(6), new Long(7), new Long(8),",
"\t\t new Long(9), new Long(10)};",
"",
"\t\tif (i >= 0 && i < staticLongs.length)",
"\t\t\treturn staticLongs[(int) i];",
"\t\telse",
"\t\t\treturn new Long(i);",
" return b ? Boolean.TRUE : Boolean.FALSE;"
]
}
]
}
] |
derby-DERBY-6233-3983f42f
|
DERBY-6233: XMLBindingTest fails on latest JDK 8 EA
Set the system property javax.xml.accessExternalDTD in the test to
allow the XML parser to access the DTD.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1488116 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/testing/org/apache/derbyTesting/junit/SystemPropertyTestSetup.java",
"hunks": [
{
"added": [
"",
" /**",
" * Decorate a test so that it sets a single system property in",
" * {@code setUp()} and resets it in {@code tearDown()}. The engine is",
" * not shut down after the property is set.",
" */",
" public static Test singleProperty(Test test, String property, String value)",
" {",
" return singleProperty(test, property, value, false);",
" }",
"",
" /**",
" * Decorate a test so that it sets a single system property in",
" * {@code setUp()} and resets it in {@code tearDown()}. The engine is",
" * shut down after the property is set if {@code staticProperty} is",
" * {@code true}.",
" */",
" public static Test singleProperty(Test test, String property, String value,",
" boolean staticProperty)",
" {",
" Properties properties = new Properties();",
" properties.setProperty(property, value);",
" return new SystemPropertyTestSetup(test, properties, staticProperty);",
" }",
""
],
"header": "@@ -68,6 +68,31 @@ public class SystemPropertyTestSetup extends TestSetup {",
"removed": []
}
]
}
] |
derby-DERBY-6237-a22130db
|
DERBY-6237(PreparedStatement.execute() fails starting 10.2 when multiple rows are updated and PreparedStatement.setCharacterStream(int, Reader, int) is used)
This commit tests setCharacterStream on CLOB and VARCHAR columns as 2 separate tests. This way failure of one data type will not mask the behavior of the other data type.
I found through these tests that in trunk,
1)setCharacterStream on VARCHAR columns work fine(just like 10.1 through 10.10 releases) for both one row and multi-row update through prepared statement.
2)But setCharacterStream on CLOB column when update touches more than one row(both for embedded and network server) fails in trunk.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1489246 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-6238-1fec7db8
|
DERBY-6238: Lock timeout in GrantRevokeTest.testGrantRollbackAndCommit
Improve error reporting to help debugging:
- Check that all exceptions are as expected
- Provide stack trace for all unexpected exceptions
- Dump lock table on lock timeouts
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1488896 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-6242-a809756d
|
DERBY-6242: Merge ConcurrentXactFactory into XactFactory
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1488905 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/store/raw/xact/TransactionTable.java",
"hunks": [
{
"added": [
"import java.util.concurrent.ConcurrentHashMap;"
],
"header": "@@ -35,13 +35,11 @@ import org.apache.derby.iapi.store.raw.log.LogInstant;",
"removed": [
"import org.apache.derby.impl.store.raw.xact.TransactionTableEntry;",
"import java.util.Iterator;",
"import java.util.Map;"
]
},
{
"added": [
" <P>Methods that are only called during"
],
"header": "@@ -81,12 +79,7 @@ import java.io.IOException;",
"removed": [
"\t<P><B> This class depends on Hashtable synchronization!! </B>",
" To allow thread-safe iteration over the values in the Hashtable, callers",
" must synchronize on the Hashtable while iterating. The method {@link",
" #visitEntries(EntryVisitor)} abstracts the synchronization and iteration",
" so that the callers don't need to synchronize explicitly when they go",
" through the contents of the table. Methods that are only called during"
]
},
{
"added": [
" private final ConcurrentHashMap<TransactionId, TransactionTableEntry> trans;"
],
"header": "@@ -98,8 +91,7 @@ public class TransactionTable implements Formatable",
"removed": [
" private final TransactionMapFactory mapFactory;",
"\tprivate final Map<TransactionId,TransactionTableEntry> trans;"
]
},
{
"added": [
" trans = new ConcurrentHashMap<TransactionId, TransactionTableEntry>();"
],
"header": "@@ -108,8 +100,7 @@ public class TransactionTable implements Formatable",
"removed": [
" mapFactory = XactFactory.getMapFactory();",
" trans = mapFactory.newMap();"
]
},
{
"added": [
" for (Object entry : trans.values()) {",
" if (!visitor.visit((TransactionTableEntry) entry)) {",
" // The visitor returned false, meaning that it's done with",
" // all of its work and we can stop the scan.",
" break;",
" }",
" }"
],
"header": "@@ -177,7 +168,13 @@ public class TransactionTable implements Formatable",
"removed": [
" mapFactory.visitEntries(trans, visitor);"
]
},
{
"added": [
" for (TransactionTableEntry entry : trans.values()) {",
" GlobalTransactionId entry_gid = entry.getGid();",
" if (entry_gid != null && entry_gid.equals(global_id)) {",
" return entry.getXact().getContextManager();",
" }",
" return null;"
],
"header": "@@ -380,19 +377,14 @@ public class TransactionTable implements Formatable",
"removed": [
" final ContextManager[] cm = new ContextManager[1];",
"",
" visitEntries(new EntryVisitor() {",
" public boolean visit(TransactionTableEntry entry) {",
" GlobalTransactionId entry_gid = entry.getGid();",
" if (entry_gid != null && entry_gid.equals(global_id)) {",
" cm[0] = entry.getXact().getContextManager();",
" }",
" return cm[0] == null; // continue until context is found",
" });",
" return cm[0];"
]
},
{
"added": [
" for (TransactionTableEntry entry : trans.values()) {",
" if (entry.isUpdate()) {",
" return true;",
" }",
" return false;"
],
"header": "@@ -411,56 +403,14 @@ public class TransactionTable implements Formatable",
"removed": [
" UpdateTransactionCounter counter =",
" new UpdateTransactionCounter(true);",
" visitEntries(counter);",
" return counter.getCount() > 0;",
"\t\t}",
"\t}",
"",
" /**",
" * Visitor class that counts update transactions. Note that update",
" * transactions may be added or removed concurrently unless the caller",
" * synchronizes on \"this\" (the {@code TransactionTable} instance) while",
" * applying the visitor.",
" */",
" private static class UpdateTransactionCounter implements EntryVisitor",
" {",
" private final boolean stopOnFirst;",
" private int count;",
"",
" /**",
" * Create an instance of this visitor.",
" *",
" * @param stopOnFirst if {@code true}, stop the scan as soon as we",
" * have found one update transaction (useful if all we care about is",
" * whether or not the transaction table contains an update transaction);",
" * otherwise, scan the entire transaction table",
" */",
" UpdateTransactionCounter(boolean stopOnFirst) {",
" this.stopOnFirst = stopOnFirst;",
" }",
"",
" /**",
" * Check if the entry represents an update transaction, and update",
" * the counter accordingly.",
" */",
" public boolean visit(TransactionTableEntry entry) {",
" if (entry.isUpdate()) {",
" count++;",
" // Continue the scan if a full scan was requested, or if no update",
" // transactions have been found yet.",
" return !stopOnFirst || (count == 0);",
" /**",
" * Get the number of update transactions seen by this visitor",
" * @return number of update transactions",
" */",
" int getCount() {",
" return count;",
" }"
]
},
{
"added": [
" int count = 0;",
" for (TransactionTableEntry entry : trans.values()) {",
" if (entry.isUpdate()) {",
" count++;",
" }",
" }"
],
"header": "@@ -490,11 +440,12 @@ public class TransactionTable implements Formatable",
"removed": [
" UpdateTransactionCounter counter =",
" new UpdateTransactionCounter(false);",
" visitEntries(counter);",
"",
" int count = counter.getCount();"
]
},
{
"added": [
" int writeCount = 0;",
"",
" for (TransactionTableEntry entry : trans.values()) {",
" if (entry.isUpdate()) {",
" // only write out update transactions",
" out.writeObject(entry);",
" if (SanityManager.DEBUG) {",
" writeCount++;",
" SanityManager.ASSERT(count == writeCount);"
],
"header": "@@ -502,36 +453,21 @@ public class TransactionTable implements Formatable",
"removed": [
" final int[] writeCount =",
" SanityManager.DEBUG ? new int[1] : null;",
"",
" final IOException[] thrownException = new IOException[1];",
"",
" visitEntries(new EntryVisitor() {",
" public boolean visit(TransactionTableEntry entry) {",
" try {",
" if (entry.isUpdate()) {",
" // only write out update transactions",
" out.writeObject(entry);",
" if (SanityManager.DEBUG) {",
" writeCount[0]++;",
" }",
" }",
" } catch (IOException ioe) {",
" thrownException[0] = ioe;",
" return false; // stop on error",
" return true; // go through entire table",
" });",
"",
" if (thrownException[0] != null) {",
" throw thrownException[0];",
" SanityManager.ASSERT(count == writeCount[0]);"
]
},
{
"added": [
" for (TransactionTableEntry ent : trans.values())"
],
"header": "@@ -597,10 +533,8 @@ public class TransactionTable implements Formatable",
"removed": [
"\t\tfor (Iterator<TransactionTableEntry> it = trans.values().iterator(); it.hasNext(); )",
"\t\t\tTransactionTableEntry ent = it.next();",
""
]
},
{
"added": [
" for (TransactionTableEntry ent : trans.values())"
],
"header": "@@ -649,10 +583,8 @@ public class TransactionTable implements Formatable",
"removed": [
" for (Iterator<TransactionTableEntry> it = trans.values().iterator(); it.hasNext(); )",
" TransactionTableEntry ent = it.next();",
""
]
},
{
"added": [
" for (TransactionTableEntry ent : trans.values())"
],
"header": "@@ -691,10 +623,8 @@ public class TransactionTable implements Formatable",
"removed": [
"\t\tfor (Iterator<TransactionTableEntry> it = trans.values().iterator(); it.hasNext(); )",
"\t\t\tTransactionTableEntry ent = it.next();",
""
]
},
{
"added": [
" for (TransactionTableEntry ent : trans.values())"
],
"header": "@@ -745,10 +675,8 @@ public class TransactionTable implements Formatable",
"removed": [
"\t\t\tfor (Iterator<TransactionTableEntry> it = trans.values().iterator(); it.hasNext() ; )",
"\t\t\t\tTransactionTableEntry ent = it.next();",
""
]
},
{
"added": [
" for (TransactionTableEntry ent : trans.values())"
],
"header": "@@ -784,10 +712,8 @@ public class TransactionTable implements Formatable",
"removed": [
" for (Iterator<TransactionTableEntry> it = trans.values().iterator(); it.hasNext();)",
" TransactionTableEntry ent =",
" it.next();"
]
},
{
"added": [
" for (TransactionTableEntry ent : trans.values())"
],
"header": "@@ -840,12 +766,9 @@ public class TransactionTable implements Formatable",
"removed": [
" TransactionTableEntry ent;",
"\t\t\tfor (Iterator<TransactionTableEntry> it = trans.values().iterator(); it.hasNext(); )",
"\t\t\t\tent = it.next();",
""
]
},
{
"added": [
" for (TransactionTableEntry ent : trans.values())"
],
"header": "@@ -867,10 +790,8 @@ public class TransactionTable implements Formatable",
"removed": [
" for (Iterator<TransactionTableEntry> it = trans.values().iterator(); it.hasNext();)",
" ent = it.next();",
""
]
},
{
"added": [
" LogInstant logInstant = null;",
" for (TransactionTableEntry entry : trans.values()) {",
" if (entry.isUpdate()) {",
" if (logInstant == null ||",
" entry.getFirstLog().lessThan(logInstant)) {",
" logInstant = entry.getFirstLog();",
" }",
" }",
" return logInstant;"
],
"header": "@@ -921,27 +842,17 @@ public class TransactionTable implements Formatable",
"removed": [
"\t\tif (trans.isEmpty())",
" {",
"\t\t\treturn null;",
" }",
"\t\telse",
"\t\t{",
" final LogInstant[] logInstant = new LogInstant[1];",
" visitEntries(new EntryVisitor() {",
" public boolean visit(TransactionTableEntry entry) {",
" if (entry.isUpdate()) {",
" if ((logInstant[0] == null) ||",
" entry.getFirstLog().lessThan(logInstant[0])) {",
" logInstant[0] = entry.getFirstLog();",
" }",
" }",
" return true; // scan entire transaction table",
" });",
" return logInstant[0];",
"\t\t}"
]
},
{
"added": [
" for (TransactionTableEntry entry : trans.values()) {",
" tinfo.add((TransactionTableEntry) entry.clone());",
" }",
" return tinfo.toArray(new TransactionTableEntry[tinfo.size()]);"
],
"header": "@@ -1002,15 +913,11 @@ public class TransactionTable implements Formatable",
"removed": [
" visitEntries(new EntryVisitor() {",
" public boolean visit(TransactionTableEntry entry) {",
" tinfo.add( (TransactionTableEntry) entry.clone());",
" return true; // scan entire transaction table",
" }",
" });",
" return (TransactionTableEntry[])",
" tinfo.toArray(new TransactionTableEntry[tinfo.size()]);"
]
}
]
}
] |
derby-DERBY-6243-4e5e9650
|
DERBY-6243: Fold Java5ClassFactory into ReflectClassesJava2
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1489314 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/iapi/services/loader/ClassInspector.java",
"hunks": [
{
"added": [
"import java.util.ArrayList;",
"import java.util.HashMap;"
],
"header": "@@ -28,6 +28,8 @@ import org.apache.derby.iapi.error.StandardException;",
"removed": []
},
{
"added": [
" * the bounds on the type variables. May return null if type resolution",
" * fails.",
" if ( implementation == null ) { return null; }",
"",
" Type[] genericInterfaces = implementation.getGenericInterfaces();",
" for ( Type genericInterface : genericInterfaces )",
" {",
" //",
" // Look for the generic interface whose raw type is the",
" // parameterized interface we're interested in.",
" //",
" if ( genericInterface instanceof ParameterizedType )",
" {",
" ParameterizedType pt = (ParameterizedType) genericInterface;",
" Type rawType = pt.getRawType();",
"",
" // found it!",
" if ( parameterizedInterface == rawType )",
" {",
" return findTypeBounds( pt );",
" }",
" }",
" }",
"",
" // couldn't find the interface we're looking for. check our superclass.",
" return getTypeBounds( parameterizedInterface, implementation.getSuperclass() );",
"",
" if (member instanceof Method) {",
" return ((Method) member).isVarArgs();",
" } else if (member instanceof Constructor) {",
" return ((Constructor) member).isVarArgs();",
" } else {",
" return false;",
" }",
"",
" * the actual types of the interface type variables.",
" * May return null or an array of nulls if type resolution fails.",
" // construct the inheritance chain stretching from the parameterized",
" // type down to the concrete implemention",
" ArrayList<Class<?>> chain =",
" getTypeChain(parameterizedType, implementation);",
"",
" // walk the chain, filling in a map of generic types to their",
" // resolved types",
" HashMap<Type, Type> resolvedTypes = getResolvedTypes(chain);",
"",
" // compose the resolved types together in order to compute the actual",
" // classes which are plugged into the variables of the parameterized",
" // type",
" ArrayList<Class<?>> parameterTypes =",
" getParameterTypes(parameterizedType, resolvedTypes);",
"",
" // turn the list into an array",
" if (parameterTypes == null) {",
" return null;",
" }",
"",
" return parameterTypes.toArray(new Class[parameterTypes.size()]);",
""
],
"header": "@@ -501,36 +503,83 @@ public class ClassInspector",
"removed": [
" * the bounds on the type variables. This method raises an exception if the",
" * JVM does not support generics. May return null if type resolution fails.",
"\t\tthrow StandardException.newException( SQLState.VM_LEVEL_TOO_LOW, \"Java 5\" );",
" ",
" // Varargs were introduced by Java 5. So this 1.4 ClassInspector always",
" // return false;",
" return false;",
" ",
" * the actual types of the interface type variables. This method raises an exception if the",
" * JVM does not support generics. May return null or an array of nulls if type resolution fails.",
"\t\tthrow StandardException.newException( SQLState.VM_LEVEL_TOO_LOW, \"Java 5\" );",
" "
]
},
{
"added": [],
"header": "@@ -904,31 +953,6 @@ nextMethod:\tfor (int i = 0; i < methods.length; i++) {",
"removed": [
"",
"\t/**",
"\t\tIs method/constructor T more or equally specific than method U.",
"",
"\t\tSee the Java Language Specification section 15.11.2.2.",
"\t*/",
"\tprivate boolean isMethodMoreSpecificOrEqual(Member T, Member U, boolean[] isParam) {",
"",
"\t\tClass[] TC;",
"\t\tClass[] UC;",
"",
"\t\tif (T instanceof Method) {",
"\t\t\tif (!classConvertableFromTo(T.getDeclaringClass(), U.getDeclaringClass(), true))",
"\t\t\t\treturn false;",
"",
"\t\t\tTC = ((Method) T).getParameterTypes();",
"\t\t\tUC = ((Method) U).getParameterTypes();",
"\t\t} else {",
"\t\t\tTC = ((Constructor) T).getParameterTypes();",
"\t\t\tUC = ((Constructor) U).getParameterTypes();",
"\t\t}",
"",
"\t\treturn signatureConvertableFromTo(TC, null, UC, isParam, true);",
"\t}",
""
]
}
]
}
] |
derby-DERBY-6247-0fb596b0
|
DERBY-6247; updatelocksJDBC30 test failing in nightly regression tests
addressing the issue by merging the test into junit test UdateLocksTest.java
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1629099 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-6250-6e6ee8d9
|
DERBY-6250; nightly regression test failure: jdbc4.LoginTimeoutTest testBasic client/server java.sql.SQLTimeoutException: XBDA0, Login timeout Exceeded and junit.framework.AssertionFailedError: Should not have been able to connect!
attempt to add more time for failing situations, and add more details to error message on failure.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1575065 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-6253-aa5c5de5
|
DERBY-6253: Collapse SQLException factories
- Move functionality from SQLExceptionFactory40 to SQLExceptionFactory
- Move logic for retrieving the exception factory from Util to
ExceptionFactory in order to reduce compile-time dependencies on
impl classes from iapi classes
- Use varargs in Util's helper methods in order to reduce the number
of methods
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1493701 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/drda/org/apache/derby/impl/drda/DRDAConnThread.java",
"hunks": [
{
"added": [
" SQLException se = StandardException.getArgumentFerry(sqlException);"
],
"header": "@@ -1380,8 +1380,7 @@ class DRDAConnThread extends Thread {",
"removed": [
" SQLException se = Util.getExceptionFactory().",
" getArgumentFerry(sqlException);"
]
}
]
},
{
"file": "java/engine/org/apache/derby/iapi/jdbc/BrokeredConnection.java",
"hunks": [
{
"added": [],
"header": "@@ -47,9 +47,6 @@ public abstract class BrokeredConnection implements EngineConnection",
"removed": [
" /** Exception factory for the underlying connection. */",
" private final ExceptionFactory exceptionFactory;",
""
]
},
{
"added": [],
"header": "@@ -68,8 +65,6 @@ public abstract class BrokeredConnection implements EngineConnection",
"removed": [
" this.exceptionFactory =",
" control.getRealConnection().getExceptionFactory();"
]
},
{
"added": [
" return ExceptionFactory.getInstance().getSQLException("
],
"header": "@@ -505,7 +500,7 @@ public abstract class BrokeredConnection implements EngineConnection",
"removed": [
" return exceptionFactory.getSQLException("
]
}
]
},
{
"file": "java/engine/org/apache/derby/iapi/jdbc/BrokeredStatement.java",
"hunks": [
{
"added": [
" throw ExceptionFactory.getInstance().getSQLException("
],
"header": "@@ -582,7 +582,7 @@ public abstract class BrokeredStatement implements EngineStatement",
"removed": [
" throw control.getExceptionFactory().getSQLException("
]
}
]
},
{
"file": "java/engine/org/apache/derby/iapi/jdbc/EngineConnection.java",
"hunks": [
{
"added": [],
"header": "@@ -21,7 +21,6 @@",
"removed": [
"import java.sql.PreparedStatement;"
]
}
]
},
{
"file": "java/engine/org/apache/derby/iapi/jdbc/ExceptionFactory.java",
"hunks": [
{
"added": [
"public abstract class ExceptionFactory {",
"",
" /** The singleton ExceptionFactory instance. */",
" private static final ExceptionFactory INSTANCE;",
" static {",
" // Initialize the singleton instance. Use reflection so that there",
" // is no compile-time dependency on implementation classes from iapi.",
" // Currently, there is only one implementation. There used to be two;",
" // one for JDBC 3.0 and lower, and one for JDBC 4.0 and higher. If",
" // the need for more than one implementation ever arises again, the",
" // code below should be changed to load the correct factory for the",
" // run-time platform.",
" String impl = \"org.apache.derby.impl.jdbc.SQLExceptionFactory\";",
" ExceptionFactory factory = null;",
" try {",
" factory = (ExceptionFactory) Class.forName(impl).newInstance();",
" } catch (Exception e) {",
" throw new ExceptionInInitializerError(e);",
" }",
" INSTANCE = factory;",
" }",
" * Get the singleton exception factory instance.",
" * @return an {@code ExceptionFactory} instance",
" public static ExceptionFactory getInstance() {",
" return INSTANCE;",
" }"
],
"header": "@@ -26,20 +26,35 @@ import java.sql.SQLException;",
"removed": [
"public interface ExceptionFactory {",
" * Unpack a SQL exception, looking for an EmbedSQLException which carries",
" * the Derby messageID and args which we will serialize across DRDA so",
" * that the client can reconstitute a SQLException with appropriate text.",
" * If we are running JDBC 3, then we hope that the passed-in",
" * exception is already an EmbedSQLException, which carries all the",
" * information we need.",
" *",
" * @param se the exception to unpack",
" * @return the argument ferry for the exception",
" SQLException getArgumentFerry(SQLException se);"
]
},
{
"added": [
" public abstract SQLException getSQLException(String message, String messageId,",
" SQLException next, int severity, Throwable cause, Object... args);"
],
"header": "@@ -53,8 +68,8 @@ public interface ExceptionFactory {",
"removed": [
" SQLException getSQLException(String message, String messageId,",
" SQLException next, int severity, Throwable cause, Object[] args);"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java",
"hunks": [
{
"added": [],
"header": "@@ -88,7 +88,6 @@ import java.util.Iterator;",
"removed": [
"import org.apache.derby.iapi.jdbc.ExceptionFactory;"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/jdbc/Util.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.jdbc.ExceptionFactory;"
],
"header": "@@ -23,6 +23,7 @@ package org.apache.derby.impl.jdbc;",
"removed": []
},
{
"added": [],
"header": "@@ -70,11 +71,6 @@ import java.io.IOException;",
"removed": [
"",
" private static SQLExceptionFactory exceptionFactory = ",
" new SQLExceptionFactory ();",
"",
""
]
},
{
"added": [
" return ExceptionFactory.getInstance().getSQLException("
],
"header": "@@ -143,7 +139,7 @@ public abstract class Util {",
"removed": [
" return exceptionFactory.getSQLException ("
]
},
{
"added": [
" public static SQLException generateCsSQLException(",
" String error, Object... args) {",
" args,"
],
"header": "@@ -279,41 +275,13 @@ public abstract class Util {",
"removed": [
"\t/* 3 arguments */",
"\tstatic SQLException newException(String messageID, Object a1,",
"\t\t\tObject a2, Object a3) {",
"\t\treturn newEmbedSQLException(messageID, new Object[] {a1, a2, a3},",
" \t\tStandardException.getSeverityFromIdentifier(messageID));",
"\t}",
"",
"",
"\tpublic static SQLException generateCsSQLException(String error) {",
"\tpublic static SQLException generateCsSQLException(String error, Object arg1) {",
"\t\treturn newEmbedSQLException(error,",
"\t\t\tnew Object[] {arg1},",
" StandardException.getSeverityFromIdentifier(error));",
"\t}",
"",
"\tpublic static SQLException generateCsSQLException(",
" String error, Object arg1, Object arg2){",
"\t\treturn newEmbedSQLException(error,",
"\t\t\tnew Object[] {arg1, arg2},",
" StandardException.getSeverityFromIdentifier(error));",
"\t}",
"",
"\tpublic static SQLException generateCsSQLException(",
"\t\tString error, Object arg1, Object arg2, Object arg3) {",
"",
"\t\treturn newEmbedSQLException(error,",
"\t\t\tnew Object[] {arg1, arg2, arg3},",
" StandardException.getSeverityFromIdentifier(error));",
"\t}",
"",
""
]
},
{
"added": [
" return ExceptionFactory.getInstance().getSQLException("
],
"header": "@@ -322,7 +290,7 @@ public abstract class Util {",
"removed": [
" return exceptionFactory.getSQLException("
]
}
]
},
{
"file": "java/engine/org/apache/derby/jdbc/AutoloadedDriver40.java",
"hunks": [
{
"added": [],
"header": "@@ -24,7 +24,6 @@ package org.apache.derby.jdbc;",
"removed": [
"import org.apache.derby.impl.jdbc.SQLExceptionFactory40;"
]
}
]
},
{
"file": "java/engine/org/apache/derby/jdbc/Driver40.java",
"hunks": [
{
"added": [],
"header": "@@ -26,7 +26,6 @@ import org.apache.derby.iapi.jdbc.BrokeredConnection;",
"removed": [
"import org.apache.derby.iapi.error.StandardException;"
]
},
{
"added": [],
"header": "@@ -35,7 +34,6 @@ import org.apache.derby.impl.jdbc.EmbedResultSet;",
"removed": [
"import org.apache.derby.impl.jdbc.SQLExceptionFactory40;"
]
}
]
},
{
"file": "java/engine/org/apache/derby/jdbc/XAStatementControl.java",
"hunks": [
{
"added": [],
"header": "@@ -26,7 +26,6 @@ import org.apache.derby.iapi.jdbc.BrokeredStatementControl;",
"removed": [
"import org.apache.derby.iapi.jdbc.ExceptionFactory;"
]
}
]
}
] |
derby-DERBY-6254-97f7c7af
|
DERBY-6254: Reduce number of factory methods in StandardException
Generalize the factory methods by using varargs.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1491366 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/iapi/error/StandardException.java",
"hunks": [
{
"added": [],
"header": "@@ -71,11 +71,6 @@ public class StandardException extends Exception",
"removed": [
"\tprotected StandardException(String messageID, Object[] args)",
"\t{",
"\t\tthis(messageID, (Throwable) null, args);",
"\t}",
""
]
},
{
"added": [
" public static StandardException",
" newException(String messageId, Object... args) {",
" return newException(messageId, (Throwable) null, args);",
" }",
" public static StandardException",
" newException(String messageId, Throwable t, Object... args) {",
" return new StandardException(messageId, t, args);",
" }"
],
"header": "@@ -260,39 +255,18 @@ public class StandardException extends Exception",
"removed": [
"\t/* 0 arguments */",
"",
"\tpublic static StandardException newException(String messageID) {",
"\t\treturn new StandardException(messageID);",
"\t}",
"\tpublic static StandardException newException(String messageID, Throwable t) {",
"\t\treturn new StandardException(messageID, t, (Object[]) null);",
"\t}",
"",
"\t/* 1 argument */",
"",
"\tpublic static StandardException newException(String messageID, Object a1) {",
"\t\tObject[] oa = new Object[] {a1};",
"\t\treturn new StandardException(messageID, oa);",
"\t}",
"",
"\tpublic static StandardException newException(String messageID,",
"\t\t\t\t\t\t\t\t\t\t\t\t Object[] a1) {",
"\t\treturn new StandardException(messageID, a1);",
"\t}",
"\tpublic static StandardException newException(String messageID, Throwable t, Object a1) {",
"\t\tObject[] oa = new Object[] {a1};",
"\t\treturn new StandardException(messageID, t, oa);",
"\t}",
"\tpublic static StandardException newException(String messageID, Object a1, Object a2) {",
"\t\tObject[] oa = new Object[] {a1, a2};",
"\t\treturn new StandardException(messageID, oa);",
"\t}",
""
]
},
{
"added": [],
"header": "@@ -321,18 +295,8 @@ public class StandardException extends Exception",
"removed": [
"\tpublic static StandardException newException(String messageID, Throwable t, Object a1, Object a2) {",
"\t\tObject[] oa = new Object[] {a1, a2};",
"\t\treturn new StandardException(messageID, t, oa);",
"\t}",
"",
"\tpublic static StandardException newException(String messageID, Object a1, Object a2, Object a3) {",
"\t\tObject[] oa = new Object[] {a1, a2, a3};",
"\t\treturn new StandardException(messageID, oa);",
"\t}",
" "
]
},
{
"added": [],
"header": "@@ -351,62 +315,6 @@ public class StandardException extends Exception",
"removed": [
"\tpublic static StandardException newException(String messageID, Throwable t, Object a1, Object a2, Object a3) {",
"\t\tObject[] oa = new Object[] {a1, a2, a3};",
"\t\treturn new StandardException(messageID, t, oa);",
"\t}",
"",
"\t/* 4 arguments */",
"",
"\tpublic static StandardException newException(String messageID, Object a1, Object a2, Object a3, Object a4) {",
"\t\tObject[] oa = new Object[] {a1, a2, a3, a4};",
"\t\treturn new StandardException(messageID, oa);",
"\t}",
"\tpublic static StandardException newException(String messageID, Throwable t, Object a1, Object a2, Object a3, Object a4) {",
"\t\tObject[] oa = new Object[] {a1, a2, a3, a4};",
"\t\treturn new StandardException(messageID, t, oa);",
"\t}",
" ",
"\t/* 5 arguments */",
"\tpublic static StandardException newException(String messageID, Object a1, Object a2, Object a3, Object a4, Object a5) {",
"\t\tObject[] oa = new Object[] {a1, a2, a3, a4, a5};",
"\t\treturn new StandardException(messageID, oa);",
"\t}",
"\tpublic static StandardException newException(String messageID, Throwable t, Object a1, Object a2, Object a3, Object a4, Object a5) {",
"\t\tObject[] oa = new Object[] {a1, a2, a3, a4, a5};",
"\t\treturn new StandardException(messageID, t, oa);",
"\t}",
"",
"\t/* 6 arguments */",
"\tpublic static StandardException newException(String messageID, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6) {",
"\t\tObject[] oa = new Object[] {a1, a2, a3, a4, a5, a6};",
"\t\treturn new StandardException(messageID, oa);",
"\t}",
"\tpublic static StandardException newException(String messageID, Throwable t, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6) {",
"\t\tObject[] oa = new Object[] {a1, a2, a3, a4, a5, a6};",
"\t\treturn new StandardException(messageID, t, oa);",
"\t}",
"",
"\t/* 7 arguments */",
"\tpublic static StandardException newException(String messageID, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7) {",
"\t\tObject[] oa = new Object[] {a1, a2, a3, a4, a5, a6, a7};",
"\t\treturn new StandardException(messageID, oa);",
"\t}",
"\tpublic static StandardException newException(String messageID, Throwable t, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7) {",
"\t\tObject[] oa = new Object[] {a1, a2, a3, a4, a5, a6, a7};",
"\t\treturn new StandardException(messageID, t, oa);",
"\t}",
"",
"\t/* 8 arguments */",
"\tpublic static StandardException newException(String messageID, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8) {",
"\t\tObject[] oa = new Object[] {a1, a2, a3, a4, a5, a6, a7, a8};",
"\t\treturn new StandardException(messageID, oa);",
"\t}",
"\tpublic static StandardException newException(String messageID, Throwable t, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8) {",
"\t\tObject[] oa = new Object[] {a1, a2, a3, a4, a5, a6, a7, a8};",
"\t\treturn new StandardException(messageID, t, oa);",
"\t}",
""
]
},
{
"added": [
" public static SQLWarning newWarning(String messageId, Object... oa)"
],
"header": "@@ -693,27 +601,7 @@ public class StandardException extends Exception",
"removed": [
"\tpublic static SQLWarning newWarning(String messageId) {",
"",
"\t\treturn newWarningCommon( messageId, (Object[]) null );",
"",
"\t}",
"",
"\tpublic static SQLWarning newWarning(String messageId, Object a1) {",
"",
"\t\tObject[] oa = new Object[] {a1};",
"",
"\t\treturn newWarningCommon( messageId, oa );",
"\t}",
"",
"\tpublic static SQLWarning newWarning(String messageId, Object a1, Object a2) {",
"",
"\t\tObject[] oa = new Object[] {a1, a2};",
"",
"\t\treturn newWarningCommon( messageId, oa );",
"\t}",
"",
"\tprivate\tstatic\tSQLWarning\tnewWarningCommon( String messageId, Object[] oa )"
]
}
]
}
] |
derby-DERBY-6256-23643e8a
|
DERBY-6256: Commit derby-6256-02-aa-allowParentTags.diff, allowing XmlVTIs to inherit columns from outer xml elements in which the primary row element is nested.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1491490 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/vti/XmlVTI.java",
"hunks": [
{
"added": [
"import java.io.InputStream;",
"import java.sql.ResultSetMetaData;",
"import java.sql.SQLException;",
"import java.util.ArrayList;",
"import javax.xml.parsers.DocumentBuilder;",
"import javax.xml.parsers.DocumentBuilderFactory;",
"import org.w3c.dom.Document;",
"import org.w3c.dom.Element;",
"import org.w3c.dom.Node;",
"import org.w3c.dom.NodeList;",
" * One form of this VTI takes the following arguments. This form is useful when",
" * all of the columns in the row can be constructed from data nested INSIDE the row Element."
],
"header": "@@ -21,19 +21,25 @@ limitations under the License.",
"removed": [
"import java.io.*;",
"import java.lang.reflect.*;",
"import java.sql.*;",
"import javax.xml.parsers.*;",
"import org.w3c.dom.*;",
" * This VTI takes the following arguments:"
]
},
{
"added": [
" * Here is a sample declaration of this first form of the XmlVTI:"
],
"header": "@@ -43,7 +49,7 @@ import org.w3c.dom.*;",
"removed": [
" * Here is a sample declaration:"
]
},
{
"added": [
" *",
" * <p>",
" * A second form of this VTI takes the following arguments. This form is useful when",
" * some of the columns in the row are \"inherited\" from outer elements inside which the",
" * row element nests:",
" * </p>",
" *",
" * <ul>",
" * <li>xmlResourceName - An URL identifying an xml resource.</li>",
" * <li>rowTag - The tag of the element which contains the row-structured content.</li>",
" * <li>parentTags - Attributes and elements (to be treated as columns) from outer elements in which the rowTag is nested.</li>",
" * <li>childTags - Attributes and elements (to be treated as columns) inside the row element.</li>",
" * </ul>",
" *",
" *",
" * <p>",
" * Here is a sample declaration of this second form of the XmlVTI. Using the second form",
" * involves declaring an ArrayList type and a factory method too:",
" * </p>",
" *",
" * <pre>",
" * create type ArrayList external name 'java.util.ArrayList' language java;",
" * ",
" * create function asList( cell varchar( 32672 ) ... ) returns ArrayList",
" * language java parameter style derby no sql",
" * external name 'org.apache.derby.vti.XmlVTI.asList';",
" * ",
" * create function optTrace",
" * (",
" * xmlResourceName varchar( 32672 ),",
" * rowTag varchar( 32672 ),",
" * parentTags ArrayList,",
" * childTags ArrayList",
" * )",
" * returns table",
" * (",
" * stmtID int,",
" * queryID int,",
" * complete boolean,",
" * summary varchar( 32672 ),",
" * type varchar( 50 ),",
" * estimatedCost double,",
" * estimatedRowCount int",
" * )",
" * language java parameter style derby_jdbc_result_set no sql",
" * external name 'org.apache.derby.vti.XmlVTI.xmlVTI';",
" * ",
" * create view optTrace as",
" * select *",
" * from table",
" * (",
" * optTrace",
" * (",
" * 'file:///Users/me/derby/mainline/z.xml',",
" * 'planCost',",
" * asList( 'stmtID', 'queryID', 'complete' ),",
" * asList( 'summary', 'type', 'estimatedCost', 'estimatedRowCount' )",
" * )",
" * ) v",
" * ;",
" * ",
" * select * from optTrace",
" * where stmtID = 6 and complete",
" * order by estimatedCost * </pre>"
],
"header": "@@ -76,6 +82,70 @@ import org.w3c.dom.*;",
"removed": []
},
{
"added": [
" //",
" // The first n column names are attribute/element tags from parent",
" // elements. The trailing column names are attribute/element tags from",
" // the row element or its children.",
" //",
" private int _firstChildTagIdx; // first attribute/element to be found in the row or below",
""
],
"header": "@@ -101,6 +171,13 @@ public class XmlVTI extends StringColumnVTI",
"removed": []
},
{
"added": [
" public XmlVTI( String xmlResourceName, String rowTag, int firstChildTagIdx, String... columnTags )",
" super( columnTags );",
" _firstChildTagIdx = firstChildTagIdx;",
" // ENTRY POINTS (SQL FUNCTIONS)",
" /** This is the static method for creating functions with only child tags */",
" return new XmlVTI( xmlResourceName, rowTag, 0, childTags );",
" }",
" ",
" /** This is the static method for creating functions with both parent and child tags */",
" public static XmlVTI xmlVTI",
" ( String xmlResourceName, String rowTag, ArrayList<String> parentTags, ArrayList<String> childTags )",
" {",
" String[] allTags = new String[ parentTags.size() + childTags.size() ];",
" int idx = 0;",
" for ( String tag : parentTags ) { allTags[ idx++ ] = tag; }",
" for ( String tag : childTags ) { allTags[ idx++ ] = tag; }",
" ",
" return new XmlVTI( xmlResourceName, rowTag, parentTags.size(), allTags );",
" }",
"",
" /** Factory method to create an ArrayList<String> */",
" public static ArrayList<String> asList( String... cells )",
" {",
" ArrayList<String> retval = new ArrayList<String>();",
" for ( String cell : cells ) { retval.add( cell ); }",
" ",
" return retval;"
],
"header": "@@ -113,24 +190,46 @@ public class XmlVTI extends StringColumnVTI",
"removed": [
" public XmlVTI( String xmlResourceName, String rowTag, String... childTags )",
" super( childTags );",
" // ENTRY POINT (SQL FUNCTION)",
" /** This is the static method bound to the function */",
" return new XmlVTI( xmlResourceName, rowTag, childTags );"
]
},
{
"added": [
" private void readRows() throws Exception"
],
"header": "@@ -203,7 +302,7 @@ public class XmlVTI extends StringColumnVTI",
"removed": [
" private void readRows() throws Exception"
]
},
{
"added": [
" private void parseRow( int rowNumber ) throws Exception"
],
"header": "@@ -225,7 +324,7 @@ public class XmlVTI extends StringColumnVTI",
"removed": [
" private void parseRow( int rowNumber ) throws Exception"
]
},
{
"added": [
" _currentRow[ i ] = findColumnValue( rawRow, i );",
" }",
" }",
"",
" /**",
" * <p>",
" * Find the value of a column inside an element. The columnNumber is 0-based.",
" * </p>",
" */",
" private String findColumnValue( Element rawRow, int columnNumber )",
" throws Exception",
" {",
" // handle tags which are supposed to come from outer elements",
" boolean inParent = (columnNumber < _firstChildTagIdx);",
" if ( inParent )",
" {",
" Node parent = rawRow.getParentNode();",
" if ( (parent == null ) || !( parent instanceof Element) ) { return null; }",
" else { rawRow = (Element) parent; }",
" }",
" ",
" // first look for an attribute by the column name",
" String columnName = getColumnName( columnNumber + 1 );",
" String contents = rawRow.getAttribute( columnName );",
"",
" // missing attributes turn up as empty strings. make them null instead",
" if ( \"\".equals( contents ) ) { contents = null; }",
"",
" // if there is not attribute by that name, then look for descendent elements by",
" // that name. concatenate them all.",
" if ( contents == null )",
" {",
" NodeList children = rawRow.getElementsByTagName( columnName );",
" if ( (children != null) && (children.getLength() > 0) )",
" int childCount = children.getLength();",
" StringBuilder buffer = new StringBuilder();",
" for ( int j = 0; j < childCount; j++ )",
" Element child = (Element) children.item( j );",
" // separate values with spaces.",
" if (j != 0){ buffer.append(\" \"); }",
" buffer.append( squeezeText( child ) );",
" contents = buffer.toString();",
"",
" // recurse if looking in parent element",
" if ( inParent && (contents == null) ) { return findColumnValue( rawRow, columnNumber ); }",
" else { return contents; }"
],
"header": "@@ -234,35 +333,59 @@ public class XmlVTI extends StringColumnVTI",
"removed": [
" // first look for an attribute by the column name",
" String columnName = getColumnName( i + 1 );",
" String contents = rawRow.getAttribute( columnName );",
" // if there is not attribute by that name, then look for descendent elements by",
" // that name. concatenate them all.",
" if ( (contents == null) || \"\".equals( contents ) )",
" NodeList children = rawRow.getElementsByTagName( columnName );",
" if ( (children != null) && (children.getLength() > 0) )",
" int childCount = children.getLength();",
" StringBuffer buffer = new StringBuffer();",
"",
" for ( int j = 0; j < childCount; j++ )",
" {",
" Element child = (Element) children.item( j );",
" // separate values with spaces.",
" if (j != 0)",
" buffer.append(\" \");",
" buffer.append( squeezeText( child ) );",
" }",
" contents = buffer.toString();",
"",
" _currentRow[ i ] = contents;"
]
}
]
}
] |
derby-DERBY-6256-3397f9f0
|
DERBY-6256: Make XmlVTI take a file name argument rather than a file URL argument; commit derby-6256-03-aa-useFileNotURL.diff.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1499484 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/vti/XmlVTI.java",
"hunks": [
{
"added": [
"import java.io.File;",
"import java.io.FileInputStream;"
],
"header": "@@ -21,8 +21,8 @@ limitations under the License.",
"removed": [
"import java.io.InputStream;",
"import java.net.URL;"
]
},
{
"added": [
" * <li>xmlResourceName - The name of an xml file.</li>"
],
"header": "@@ -43,7 +43,7 @@ import org.w3c.dom.NodeList;",
"removed": [
" * <li>xmlResourceName - An URL identifying an xml resource.</li>"
]
},
{
"added": [
" * 'findbugs.xml',"
],
"header": "@@ -74,7 +74,7 @@ import org.w3c.dom.NodeList;",
"removed": [
" * 'file:///Users/me/static-analysis/findbugs.xml',"
]
},
{
"added": [
" * <li>xmlResourceName - The name of an xml file.</li>"
],
"header": "@@ -90,7 +90,7 @@ import org.w3c.dom.NodeList;",
"removed": [
" * <li>xmlResourceName - An URL identifying an xml resource.</li>"
]
},
{
"added": [
" * '/Users/me/derby/mainline/z.xml',"
],
"header": "@@ -135,7 +135,7 @@ import org.w3c.dom.NodeList;",
"removed": [
" * 'file:///Users/me/derby/mainline/z.xml',"
]
},
{
"added": [
" File file = new File( _xmlResourceName );",
" FileInputStream is = new FileInputStream( file );"
],
"header": "@@ -308,8 +308,8 @@ public class XmlVTI extends StringColumnVTI",
"removed": [
" URL url = new URL( _xmlResourceName );",
" InputStream is = url.openStream();"
]
}
]
}
] |
derby-DERBY-6256-d08ab9b8
|
DERBY-6256: Add basic tests for XmlVTIs, including a new way to create XmlVTIs from url strings; tests passed cleanly on derby-6256-04-aa-addURLFactoryMethodAndTests.diff.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1500706 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/vti/XmlVTI.java",
"hunks": [
{
"added": [
"import java.io.InputStream;",
"import java.net.URL;"
],
"header": "@@ -23,7 +23,9 @@ package org.apache.derby.vti;",
"removed": []
},
{
"added": [
" private InputStream _xmlResource;"
],
"header": "@@ -166,7 +168,7 @@ public class XmlVTI extends StringColumnVTI",
"removed": [
" private String _xmlResourceName;"
]
},
{
"added": [
" * Build a XmlVTI given an xml resource stream, the tag of the row",
" public XmlVTI( InputStream xmlResource, String rowTag, int firstChildTagIdx, String... columnTags )",
" _xmlResource = xmlResource;"
],
"header": "@@ -190,15 +192,15 @@ public class XmlVTI extends StringColumnVTI",
"removed": [
" * Build a XmlVTI given the name of an xml resource, the tag of the row",
" public XmlVTI( String xmlResourceName, String rowTag, int firstChildTagIdx, String... columnTags )",
" _xmlResourceName = xmlResourceName;"
]
},
{
"added": [
" /** This is the static method for creating functions from a file name and child tags */",
" public static XmlVTI xmlVTI( String fileName, String rowTag, String... childTags )",
" throws Exception",
" {",
" return xmlVTI( fileName, rowTag, null, asList( childTags ) );",
" }",
" ",
" /** This is the static method for creating functions from an url and child tags */",
" public static XmlVTI xmlVTIFromURL( String urlString, String rowTag, String... childTags )",
" throws Exception",
" return xmlVTIFromURL( urlString, rowTag, null, asList( childTags ) );",
" /** This is the static method for creating functions from a file name and both parent and child tags */",
" ( final String fileName, String rowTag, ArrayList<String> parentTags, ArrayList<String> childTags )",
" throws Exception",
" {",
" FileInputStream fis = AccessController.doPrivileged",
" (",
" new PrivilegedAction<FileInputStream>()",
" {",
" public FileInputStream run()",
" {",
" try {",
" return new FileInputStream( new File( fileName ) );",
" }",
" catch (IOException ioe) { throw new IllegalArgumentException( ioe.getMessage(), ioe ); }",
" } ",
" }",
" );",
" return xmlVTI( fis, rowTag, parentTags, childTags );",
" }",
"",
" /** This is the static method for creating functions from an URL and both parent and child tags */",
" public static XmlVTI xmlVTIFromURL",
" ( final String urlString, String rowTag, ArrayList<String> parentTags, ArrayList<String> childTags )",
" throws Exception",
" InputStream is = AccessController.doPrivileged",
" (",
" new PrivilegedAction<InputStream>()",
" {",
" public InputStream run()",
" {",
" try {",
" return (new URL( urlString )).openStream();",
" }",
" catch (IOException ioe) { throw new IllegalArgumentException( ioe.getMessage(), ioe ); }",
" } ",
" }",
" );",
" return xmlVTI( is, rowTag, parentTags, childTags );",
" }",
"",
" /** This is the static method for creating functions from an URL and both parent and child tags */",
" private static XmlVTI xmlVTI",
" ( InputStream xmlResource, String rowTag, ArrayList<String> parentTags, ArrayList<String> childTags )",
" throws Exception",
" {",
" if ( parentTags == null ) { parentTags = new ArrayList<String>(); }",
" if ( childTags == null ) { childTags = new ArrayList<String>(); }",
" ",
" return new XmlVTI( xmlResource, rowTag, parentTags.size(), allTags );"
],
"header": "@@ -209,22 +211,76 @@ public class XmlVTI extends StringColumnVTI",
"removed": [
" /** This is the static method for creating functions with only child tags */",
" public static XmlVTI xmlVTI( String xmlResourceName, String rowTag, String... childTags )",
" return new XmlVTI( xmlResourceName, rowTag, 0, childTags );",
" /** This is the static method for creating functions with both parent and child tags */",
" ( String xmlResourceName, String rowTag, ArrayList<String> parentTags, ArrayList<String> childTags )",
" return new XmlVTI( xmlResourceName, rowTag, parentTags.size(), allTags );"
]
}
]
}
] |
derby-DERBY-6258-29435de7
|
DERBY-6258: Restrict permissions on BACKUP.HISTORY
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1492110 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/io/DirFile4.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.services.io.FileUtil;"
],
"header": "@@ -37,6 +37,7 @@ import java.nio.channels.FileChannel;",
"removed": []
}
]
}
] |
derby-DERBY-6259-2ae1afef
|
DERBY-6259: Commit derby-6259-01-aa-collapseOptimizers.diff, eliminating the level 2 optimizer.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1492641 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/sql/compile/OptimizerFactoryImpl.java",
"hunks": [
{
"added": [
"\t\treturn true;"
],
"header": "@@ -181,7 +181,7 @@ public class OptimizerFactoryImpl",
"removed": [
"\t\treturn false;"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/OptimizerImpl.java",
"hunks": [
{
"added": [],
"header": "@@ -53,12 +53,6 @@ import org.apache.derby.iapi.util.StringUtil;",
"removed": [
" * This will be the Level 1 Optimizer.",
" * RESOLVE - it's a level 0 optimizer right now.",
" * Current State:",
" *\to No costing services",
" *\to We can only cost a derived table with a join once.",
" * "
]
},
{
"added": [
" int numTablesInQuery,",
" LanguageConnectionContext lcc )"
],
"header": "@@ -210,7 +204,8 @@ public class OptimizerImpl implements Optimizer",
"removed": [
"\t\t\t\t int numTablesInQuery)"
]
},
{
"added": [
" this.lcc = lcc;"
],
"header": "@@ -256,6 +251,7 @@ public class OptimizerImpl implements Optimizer",
"removed": []
},
{
"added": [
"",
"\t\t// Optimization started",
"\t\tif (tracingIsOn()) { tracer().traceStart( timeOptimizationStarted, hashCode(), optimizableList ); }"
],
"header": "@@ -281,6 +277,9 @@ public class OptimizerImpl implements Optimizer",
"removed": []
}
]
},
{
"file": "java/testing/org/apache/derbyTesting/functionTests/harness/Sed.java",
"hunks": [
{
"added": [
" searchStrings.addElement(\"CostEstimateImpl: .*\");"
],
"header": "@@ -153,7 +153,7 @@ public class Sed",
"removed": [
" searchStrings.addElement(\"Level2CostEstimateImpl: .*\");"
]
},
{
"added": [
" subStrings.addElement(\"CostEstimateImpl: xxXXxxFILTERED-INFORMATIONxxXXxx\");"
],
"header": "@@ -224,7 +224,7 @@ public class Sed",
"removed": [
" subStrings.addElement(\"Level2CostEstimateImpl: xxXXxxFILTERED-INFORMATIONxxXXxx\");"
]
}
]
}
] |
derby-DERBY-6259-7f6b163b
|
DERBY-6259: Make optimizer fields private: tests passed cleanly on derby-6259-02-aa-increasePrivacy.diff.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1492766 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/sql/compile/OptimizerImpl.java",
"hunks": [
{
"added": [
"class OptimizerImpl implements Optimizer ",
"\tprivate LanguageConnectionContext lcc;",
"\tprivate DataDictionary\t\t\t dDictionary;",
"\tprivate int\t\t\t\t\t\t numTablesInQuery;",
"\tprivate int\t\t\t\t\t\t numOptimizables;",
"\tprivate JBitSet\t\t assignedTableMap;",
"\tprivate OptimizableList optimizableList;",
"\tprivate OptimizablePredicateList predicateList;",
"\tprivate JBitSet\t\t\t\t\t nonCorrelatedTableMap;",
"\tprivate int[]\t\t\t proposedJoinOrder;",
"\tprivate int[]\t\t\t\t\t bestJoinOrder;",
"\tprivate int\t\t\t joinPosition;",
"\tprivate boolean\t\t\t\t\t desiredJoinOrderFound;"
],
"header": "@@ -64,30 +64,30 @@ import java.util.HashMap;",
"removed": [
"public class OptimizerImpl implements Optimizer ",
"\tprotected LanguageConnectionContext lcc;",
"\tDataDictionary\t\t\t dDictionary;",
"\tint\t\t\t\t\t\t numTablesInQuery;",
"\tint\t\t\t\t\t\t numOptimizables;",
"\tprotected JBitSet\t\t assignedTableMap;",
"\tprotected OptimizableList optimizableList;",
"\tOptimizablePredicateList predicateList;",
"\tJBitSet\t\t\t\t\t nonCorrelatedTableMap;",
"\tprotected int[]\t\t\t proposedJoinOrder;",
"\tprotected int[]\t\t\t\t\t bestJoinOrder;",
"\tprotected int\t\t\t joinPosition;",
"\tboolean\t\t\t\t\t desiredJoinOrderFound;"
]
},
{
"added": [
"\tprivate CostEstimateImpl currentCost;",
"\tprivate CostEstimateImpl currentSortAvoidanceCost;",
"\tprivate CostEstimateImpl bestCost;",
"\tprivate long\t\t\t timeOptimizationStarted;",
"\tprivate long\t\t\t currentTime;",
"\tprivate boolean\t\t timeExceeded;",
"\tprivate RequiredRowOrdering\trequiredRowOrdering;",
"\tprivate CostEstimate sortCost;"
],
"header": "@@ -107,24 +107,24 @@ public class OptimizerImpl implements Optimizer",
"removed": [
"\tprotected CostEstimateImpl currentCost;",
"\tprotected CostEstimateImpl currentSortAvoidanceCost;",
"\tprotected CostEstimateImpl bestCost;",
"\tprotected long\t\t\t timeOptimizationStarted;",
"\tprotected long\t\t\t currentTime;",
"\tprotected boolean\t\t timeExceeded;",
"\tprotected RequiredRowOrdering\trequiredRowOrdering;",
"\tprotected CostEstimate sortCost;"
]
},
{
"added": [
"\tprivate int maxMemoryPerTable;"
],
"header": "@@ -132,7 +132,7 @@ public class OptimizerImpl implements Optimizer",
"removed": [
"\tprotected int maxMemoryPerTable;"
]
},
{
"added": [
"\tprivate double timeLimit;",
"\tprivate CostEstimate finalCostEstimate;"
],
"header": "@@ -170,11 +170,11 @@ public class OptimizerImpl implements Optimizer",
"removed": [
"\tprotected double timeLimit;",
"\tCostEstimate finalCostEstimate;"
]
},
{
"added": [
"\tOptimizerImpl(OptimizableList optimizableList, "
],
"header": "@@ -194,7 +194,7 @@ public class OptimizerImpl implements Optimizer",
"removed": [
"\tprotected OptimizerImpl(OptimizableList optimizableList, "
]
},
{
"added": [
"\tpublic void updateBestPlanMaps(short action,"
],
"header": "@@ -2640,7 +2640,7 @@ public class OptimizerImpl implements Optimizer",
"removed": [
"\tprotected void updateBestPlanMaps(short action,"
]
},
{
"added": [
"\t *",
"\t * This method should be in the Optimizer interface, but it relies",
" * on an argument type (PredicateList) which lives in an impl package.",
"\tvoid addScopedPredicatesToList(PredicateList pList)"
],
"header": "@@ -2723,11 +2723,14 @@ public class OptimizerImpl implements Optimizer",
"removed": [
"\tprotected void addScopedPredicatesToList(PredicateList pList)"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/TableOperatorNode.java",
"hunks": [
{
"added": [
"\t\t\t\t\tleftOptimizer.getOptimizable(0);"
],
"header": "@@ -126,8 +126,7 @@ abstract class TableOperatorNode extends FromTable",
"removed": [
"\t\t\t\t\t((OptimizerImpl)leftOptimizer)",
"\t\t\t\t\t\t.optimizableList.getOptimizable(0);"
]
},
{
"added": [
"\t\t\t\t\trightOptimizer.getOptimizable(0);"
],
"header": "@@ -153,8 +152,7 @@ abstract class TableOperatorNode extends FromTable",
"removed": [
"\t\t\t\t\t((OptimizerImpl)rightOptimizer)",
"\t\t\t\t\t\t.optimizableList.getOptimizable(0);"
]
},
{
"added": [
"\t\t\t\t\tleftOptimizer.getOptimizable(0);"
],
"header": "@@ -747,8 +745,7 @@ abstract class TableOperatorNode extends FromTable",
"removed": [
"\t\t\t\t\t((OptimizerImpl)leftOptimizer)",
"\t\t\t\t\t\t.optimizableList.getOptimizable(0);"
]
},
{
"added": [
"\t\t\t\t\trightOptimizer.getOptimizable(0);"
],
"header": "@@ -778,8 +775,7 @@ abstract class TableOperatorNode extends FromTable",
"removed": [
"\t\t\t\t\t((OptimizerImpl)rightOptimizer)",
"\t\t\t\t\t\t.optimizableList.getOptimizable(0);"
]
}
]
}
] |
derby-DERBY-626-3d61c1cc
|
DERBY-626 Re-work code to ensure that obtaining the enumeration of modules.properties
files as well as opening them is in a priviledge block. Removes the requirement for
read permission on derby.jar to be granted all the way up the stack when running with the
security manager.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@326727 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/services/monitor/BaseMonitor.java",
"hunks": [
{
"added": [
"\tprivate Vector getImplementations(Properties moduleList, boolean actualModuleList) {"
],
"header": "@@ -1056,7 +1056,7 @@ abstract class BaseMonitor",
"removed": [
"\tprotected Vector getImplementations(Properties moduleList, boolean actualModuleList) {"
]
},
{
"added": [
"\tprivate Vector getDefaultImplementations() {",
"\t\tProperties moduleList = getDefaultModuleProperties();",
"",
"\t\treturn getImplementations(moduleList, true);",
"\t} // end of getDefaultImplementations",
"\t",
"\t/**",
"\t * Get the complete set of module properties by",
"\t * loading in contents of all the org/apache/derby/modules.properties",
"\t * files. This must be executed in a privileged block otherwise",
"\t * when running in a security manager environment no properties will",
"\t * be returned.",
"\t * @return",
"\t */",
"\tProperties getDefaultModuleProperties()",
"\t{",
"\t\t// SECURITY PERMISSION - IP1 for modules in this jar",
"\t\t// or other jars shipped with the Derby release.",
" ClassLoader cl = getClass().getClassLoader();",
" for( Enumeration e = cl.getResources(\"org/apache/derby/modules.properties\");",
" is = modulesPropertiesURL.openStream();"
],
"header": "@@ -1251,19 +1251,36 @@ nextModule:",
"removed": [
"\tprotected Vector getDefaultImplementations() {",
" ClassLoader cl = getClass().getClassLoader();",
" for( Enumeration e = cl.getResources( \"org/apache/derby/modules.properties\");",
" is = loadModuleDefinitions( modulesPropertiesURL);"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/services/monitor/FileMonitor.java",
"hunks": [
{
"added": [
"import java.util.Enumeration;",
"import java.util.Properties;"
],
"header": "@@ -33,6 +33,8 @@ import java.io.IOException;",
"removed": []
},
{
"added": [],
"header": "@@ -165,7 +167,6 @@ public final class FileMonitor extends BaseMonitor implements java.security.Priv",
"removed": [
" private URL propertyFileURL;"
]
},
{
"added": [
"\tsynchronized final Properties getDefaultModuleProperties() {",
" \t\ttry {",
"\t\t\treturn (Properties) java.security.AccessController.doPrivileged(this);",
" throw (RuntimeException) pae.getException();"
],
"header": "@@ -182,18 +183,12 @@ public final class FileMonitor extends BaseMonitor implements java.security.Priv",
"removed": [
"\tsynchronized final InputStream loadModuleDefinitions(URL propertyFileURL) throws IOException {",
" this.propertyFileURL = propertyFileURL;",
"\t\ttry {",
"\t\t\treturn (InputStream) java.security.AccessController.doPrivileged(this);",
" Exception e = pae.getException();",
" if( e instanceof IOException)",
" throw (IOException) e;",
" throw (RuntimeException) e;",
" } finally {",
" this.propertyFileURL = null;"
]
},
{
"added": [
"\tpublic synchronized final Object run() throws IOException {"
],
"header": "@@ -257,7 +252,7 @@ public final class FileMonitor extends BaseMonitor implements java.security.Priv",
"removed": [
"\tpublic final Object run() throws IOException {"
]
},
{
"added": [
"\t\t\treturn super.getDefaultModuleProperties();"
],
"header": "@@ -265,7 +260,7 @@ public final class FileMonitor extends BaseMonitor implements java.security.Priv",
"removed": [
"\t\t\treturn super.loadModuleDefinitions( propertyFileURL);"
]
}
]
}
] |
derby-DERBY-6261-80f5d3cd
|
DERBY-6261; test getCurConnJdbc20.sql is no longer useful and can be removed.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1492870 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-6262-1f18dc31
|
DERBY-6262: Simplify message-generating methods using varargs
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1493714 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/client/org/apache/derby/client/am/SqlException.java",
"hunks": [
{
"added": [
" * using initCause()."
],
"header": "@@ -158,9 +158,7 @@ public class SqlException extends Exception implements Diagnosable {",
"removed": [
" * using initCause(). On JDK 1.3, since initCause() does not exist,",
" * a non-SQL exception can not be chained. Instead, the exception class",
" * and message text is appended to the message for this exception."
]
},
{
"added": [
" public SqlException(LogWriter logwriter,",
" ClientMessageId msgid,",
" Object... args)",
""
],
"header": "@@ -211,23 +209,13 @@ public class SqlException extends Exception implements Diagnosable {",
"removed": [
" private SqlException(LogWriter logwriter,",
" ClientMessageId msgid,",
" Object[] args)",
" ",
" public SqlException (LogWriter logwriter, ClientMessageId msgid)",
" {",
" this(logwriter, msgid, (Object[])null);",
" }",
" ",
" public SqlException(LogWriter logwriter, ClientMessageId msgid, Object arg1)",
" {",
" this(logwriter, msgid, new Object[] { arg1 });",
" }",
" "
]
}
]
},
{
"file": "java/engine/org/apache/derby/iapi/error/SQLWarningFactory.java",
"hunks": [
{
"added": [],
"header": "@@ -36,52 +36,6 @@ import org.apache.derby.shared.common.reference.SQLState;",
"removed": [
"\t/**",
"\t * Generates a SQLWarning instance based on the supplied messageId. It looks",
"\t * up the messageId to generate a localised warning message. Also, SQLState",
"\t * is set correctly based on the messageId.",
"\t * ",
"\t * @param messageId A Derby messageId as defined in{@link SQLState org.apache.derby.shared.common.reference.SQLState}.",
"\t * @return Properly initialized SQLWarning instance.",
"\t * @see org.apache.derby.shared.common.reference.SQLState",
"\t */",
"\tpublic static SQLWarning newSQLWarning( String messageId )",
" {",
"\t\treturn newSQLWarning(messageId, new Object[] {} );",
"\t}",
"",
"\t/**",
"\t * Generates a SQLWarning instance based on the supplied messageId and",
"\t * argument. It looks up the messageId to generate a localised warning",
"\t * message. Also, SQLState is set correctly based on the messageId.",
"\t * ",
"\t * @param messageId A Derby messageId as defined in {@link SQLState org.apache.derby.shared.common.reference.SQLState}.",
"\t * @param arg1 An argument for the warning message",
"\t * @return Properly initialized SQLWarning instance.",
"\t * @see org.apache.derby.shared.common.reference.SQLState",
"\t */",
"\tpublic static SQLWarning newSQLWarning( String messageId, Object arg1 )",
" {",
" return newSQLWarning( messageId, new Object[] { arg1 } );",
"\t}",
"",
"\t/**",
"\t * Generates a SQLWarning instance based on the supplied messageId and",
"\t * arguments. It looks up the messageId to generate a localised warning",
"\t * message. Also, SQLState is set correctly based on the messageId.",
"\t * ",
"\t * @param messageId",
"\t * A Derby messageId as defined in {@link SQLState org.apache.derby.shared.common.reference.SQLState}.",
"\t * @param arg1 First argument for the warning message",
"\t * @param arg2 Second argument for the warning message",
"\t * @return Properly initialized SQLWarning instance.",
"\t * @see org.apache.derby.shared.common.reference.SQLState",
"\t */",
"\tpublic static SQLWarning newSQLWarning( String messageId, Object arg1, Object arg2 )",
" {",
" return newSQLWarning( messageId, new Object[] { arg1, arg2 } );",
"\t}",
""
]
}
]
},
{
"file": "java/engine/org/apache/derby/iapi/error/StandardException.java",
"hunks": [
{
"added": [
" if (textMessage == null) {",
" textMessage = MessageService.getTextMessage(",
" getMessageId(), getArguments());",
" }"
],
"header": "@@ -551,8 +551,10 @@ public class StandardException extends Exception",
"removed": [
"\t\tif (textMessage == null)",
"\t\t\ttextMessage = MessageService.getCompleteMessage(getMessageId(), getArguments());"
]
}
]
},
{
"file": "java/engine/org/apache/derby/iapi/services/i18n/MessageService.java",
"hunks": [
{
"added": [],
"header": "@@ -61,26 +61,6 @@ public final class MessageService {",
"removed": [
"\tpublic static String getTextMessage(String messageID) {",
"\t\treturn getCompleteMessage(messageID, (Object[]) null);",
"\t}",
"\tpublic static String getTextMessage(String messageID, Object a1) {",
"",
"\t\treturn getCompleteMessage(messageID, new Object[]{a1});",
"\t}",
"\tpublic static String getTextMessage(String messageID, Object a1, Object a2) {",
"\t\treturn getCompleteMessage(messageID, new Object[]{a1, a2});",
"\t}",
"\tpublic static String getTextMessage(String messageID, Object a1, Object a2, Object a3) {",
"\t\treturn getCompleteMessage(messageID, new Object[]{a1, a2, a3});",
"\t}",
"\tpublic static String getTextMessage(String messageID, Object a1, Object a2, Object a3, Object a4) {",
"\t\treturn getCompleteMessage(messageID, new Object[]{a1, a2, a3, a4});",
"\t}",
" public static String getTextMessage(String messageID, Object a1, Object a2, Object a3, Object a4, Object a5) {",
" return getCompleteMessage(messageID, new Object[]{a1, a2, a3, a4, a5});",
" }",
""
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/jdbc/EmbedClob.java",
"hunks": [
{
"added": [
" SQLState.BLOB_POSITION_TOO_LARGE, eofe, pos);"
],
"header": "@@ -215,7 +215,7 @@ final class EmbedClob extends ConnectionChild implements Clob, EngineLOB",
"removed": [
" SQLState.BLOB_POSITION_TOO_LARGE, new Long(pos), eofe);"
]
},
{
"added": [
" SQLState.BLOB_POSITION_TOO_LARGE, eofe, start);"
],
"header": "@@ -401,7 +401,7 @@ final class EmbedClob extends ConnectionChild implements Clob, EngineLOB",
"removed": [
" SQLState.BLOB_POSITION_TOO_LARGE, eofe);"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/jdbc/Util.java",
"hunks": [
{
"added": [
" String message = MessageService.getTextMessage(messageId, args);"
],
"header": "@@ -137,8 +137,7 @@ public abstract class Util {",
"removed": [
" String message = MessageService.getCompleteMessage",
" (messageId, args);"
]
},
{
"added": [
" static SQLException generateCsSQLException(",
" String error, Throwable t, Object... args) {",
" args,"
],
"header": "@@ -282,10 +281,10 @@ public abstract class Util {",
"removed": [
"\tstatic SQLException generateCsSQLException(",
" String error, Object arg1, Throwable t) {",
"\t\t\tnew Object[] {arg1},"
]
}
]
},
{
"file": "java/shared/org/apache/derby/shared/common/i18n/MessageUtil.java",
"hunks": [
{
"added": [
" /**",
" * Get a message with default locale.",
" */",
" public String getTextMessage(String messageID, Object... args) {",
" return getCompleteMessage(messageID, args);"
],
"header": "@@ -54,36 +54,11 @@ public class MessageUtil",
"removed": [
" /** Get a message with default locale - no arguments */",
" public String getTextMessage(String messageID) ",
" {",
" return getCompleteMessage(messageID, (Object[]) null);",
" }",
" ",
" /** Get a message with default locale - one argument */",
" public String getTextMessage(String messageID, Object a1) ",
" {",
" return getCompleteMessage(messageID, new Object[]{a1});",
" }",
" ",
" /** Get a message with default locale - two arguments */",
" public String getTextMessage(String messageID, Object a1, Object a2) ",
" {",
" return getCompleteMessage(messageID, new Object[]{a1, a2});",
" }",
" ",
" /** Get a message with default locale - three arguments */",
" public String getTextMessage(String messageID, Object a1, Object a2, ",
" Object a3) ",
" {",
" return getCompleteMessage(messageID, new Object[]{a1, a2, a3});",
" }",
" ",
" /** Get a message with default locale - four arguments */",
" public String getTextMessage(String messageID, Object a1, Object a2, ",
" Object a3, Object a4) ",
" {",
" return getCompleteMessage(messageID, new Object[]{a1, a2, a3, a4});"
]
}
]
}
] |
derby-DERBY-6262-434e1655
|
DERBY-6262: Simplify message-generating methods using varargs
Use varargs in EmbedConnection.newSQLException() and
ConnectionChild.newSQLException().
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1496449 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java",
"hunks": [
{
"added": [
" newSQLException(SQLState.LOGIN_FAILED, \"java.lang.OutOfMemoryError\");"
],
"header": "@@ -137,7 +137,7 @@ public class EmbedConnection implements EngineConnection",
"removed": [
" Util.generateCsSQLException(SQLState.LOGIN_FAILED, \"java.lang.OutOfMemoryError\");"
]
},
{
"added": [
" throw newSQLException(SQLState.INVALID_API_PARAMETER, map, \"map\",",
" \"java.sql.Connection.setTypeMap\");"
],
"header": "@@ -2311,8 +2311,8 @@ public class EmbedConnection implements EngineConnection",
"removed": [
" throw Util.generateCsSQLException(SQLState.INVALID_API_PARAMETER,map,\"map\",",
" \"java.sql.Connection.setTypeMap\");"
]
},
{
"added": [
" throw newSQLException(",
" throw newSQLException(",
" throw newSQLException("
],
"header": "@@ -2704,15 +2704,15 @@ public class EmbedConnection implements EngineConnection",
"removed": [
" throw Util.generateCsSQLException(",
" throw Util.generateCsSQLException(",
" throw Util.generateCsSQLException("
]
},
{
"added": [
" throw newSQLException(",
" SQLState.UNIMPLEMENTED_ISOLATION_LEVEL, level);"
],
"header": "@@ -3150,8 +3150,8 @@ public class EmbedConnection implements EngineConnection",
"removed": [
"\t\t\t\tthrow Util.generateCsSQLException(",
"\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t SQLState.UNIMPLEMENTED_ISOLATION_LEVEL, new Integer(level));"
]
},
{
"added": [
" static SQLException newSQLException(String messageId, Object... args) {",
" return Util.generateCsSQLException(messageId, args);",
" }"
],
"header": "@@ -3183,18 +3183,9 @@ public class EmbedConnection implements EngineConnection",
"removed": [
"\tprotected static SQLException newSQLException(String messageId) {",
"\t\treturn Util.generateCsSQLException(messageId);",
"\t}",
"\tprotected static SQLException newSQLException(String messageId, Object arg1) {",
"\t\treturn Util.generateCsSQLException(messageId, arg1);",
"\t}",
"\tprotected static SQLException newSQLException(String messageId, Object arg1, Object arg2) {",
"\t\treturn Util.generateCsSQLException(messageId, arg1, arg2);",
"\t}",
"\tprotected static SQLException newSQLException(String messageId, Object arg1, Object arg2, Object arg3) {",
"\t\treturn Util.generateCsSQLException(messageId, arg1, arg2, arg3);",
"\t}"
]
},
{
"added": [
" throw newSQLException("
],
"header": "@@ -3616,7 +3607,7 @@ public class EmbedConnection implements EngineConnection",
"removed": [
" throw Util.generateCsSQLException("
]
},
{
"added": [
" throw newSQLException(SQLState.INVALID_API_PARAMETER, timeout,",
" \"timeout\", \"java.sql.Connection.isValid\");"
],
"header": "@@ -3740,9 +3731,8 @@ public class EmbedConnection implements EngineConnection",
"removed": [
" throw Util.generateCsSQLException(SQLState.INVALID_API_PARAMETER,",
" new Integer(timeout), \"timeout\",",
" \"java.sql.Connection.isValid\");"
]
}
]
}
] |
derby-DERBY-6262-b5a921a8
|
DERBY-6262: Simplify message-generating methods using varargs
Reduce number of trace methods in LogWriter using varargs and
auto-boxing.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1496410 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/client/org/apache/derby/client/am/LogWriter.java",
"hunks": [
{
"added": [
" // --------------------------- method entry tracing --------------------------",
" public void traceEntry(Object instance, String methodName, Object... args) {",
" traceEntryAllArgs(instance, methodName, false, args);",
" public void traceDeprecatedEntry(",
" Object instance, String methodName, Object... args) {",
" traceEntryAllArgs(instance, methodName, true, args);",
" private void traceEntryAllArgs(Object instance, String methodName,",
" boolean deprecated, Object[] args) {",
" if (deprecated) {",
" traceExternalDeprecatedMethod(instance, className, methodName);",
" } else {",
" traceExternalMethod(instance, className, methodName);",
" }",
" printWriter_.print(\" (\");",
" for (int i = 0; i < args.length; i++) {",
" if (i > 0) {",
" printWriter_.print(\", \");",
" }",
" printWriter_.print(toPrintableString(args[i]));",
" }",
" printWriter_.println(\") called\");",
" private static String toPrintableString(Object o) {",
" if (o instanceof byte[]) {",
" return Utils.getStringFromBytes((byte[]) o);",
" } else if (o instanceof Byte) {",
" return \"0x\" + Integer.toHexString(((Byte) o) & 0xff);",
" return String.valueOf(o);"
],
"header": "@@ -301,337 +301,49 @@ public class LogWriter {",
"removed": [
" public void traceExit(Object instance, String methodName, int returnValue) {",
" traceExit(instance, methodName, String.valueOf(returnValue));",
" }",
"",
" public void traceExit(Object instance, String methodName, boolean returnValue) {",
" traceExit(instance, methodName, String.valueOf(returnValue));",
" }",
"",
" void traceExit(Object instance, String methodName, long returnValue) {",
" traceExit(instance, methodName, String.valueOf(returnValue));",
" }",
" void traceExit(Object instance, String methodName, float returnValue) {",
" traceExit(instance, methodName, String.valueOf(returnValue));",
" void traceExit(Object instance, String methodName, double returnValue) {",
" traceExit(instance, methodName, String.valueOf(returnValue));",
" // --------------------------- method entry tracing --------------------------",
"",
" private void traceEntryAllArgs(Object instance, String methodName, String argList) {",
" traceExternalMethod(instance, className, methodName);",
" printWriter_.println(\" \" + argList + \" called\");",
" private void traceDeprecatedEntryAllArgs(Object instance, String methodName, String argList) {",
" String className = getClassNameOfInstanceIfTraced(instance);",
" if (className == null) {",
" return;",
" }",
" synchronized (printWriter_) {",
" traceExternalDeprecatedMethod(instance, className, methodName);",
" printWriter_.println(\" \" + argList + \" called\");",
" printWriter_.flush();",
" }",
"",
" // ---------------------- trace entry of methods w/ no args ------------------",
"",
" public void traceEntry(Object instance, String methodName) {",
" traceEntryAllArgs(instance, methodName, \"()\");",
" }",
"",
" // ---------------------- trace entry of methods w/ 1 arg --------------------",
"",
" public void traceEntry(Object instance, String methodName, Object argument) {",
" traceEntryAllArgs(instance, methodName,",
" \"(\" + argument + \")\");",
" }",
"",
" void traceEntry(Object instance, String methodName, boolean argument) {",
" traceEntryAllArgs(instance, methodName,",
" \"(\" + argument + \")\");",
" }",
"",
" public void traceEntry(Object instance, String methodName, int argument) {",
" traceEntryAllArgs(instance, methodName,",
" \"(\" + argument + \")\");",
" }",
"",
" void traceDeprecatedEntry(",
" Object instance,",
" String methodName,",
" int argument) {",
"",
" traceDeprecatedEntryAllArgs(instance, methodName,",
" \"(\" + argument + \")\");",
" }",
"",
" void traceDeprecatedEntry(",
" Object instance,",
" String methodName,",
" Object argument) {",
"",
" traceDeprecatedEntryAllArgs(instance, methodName,",
" \"(\" + argument + \")\");",
" }",
"",
" // ---------------------- trace entry of methods w/ 2 args -------------------",
"",
" public void traceEntry(Object instance, String methodName, Object arg1, Object arg2) {",
" traceEntryAllArgs(instance, methodName,",
" \"(\" + arg1 + \", \" + arg2 + \")\");",
" }",
"",
" void traceEntry(Object instance, String methodName, int arg1, Object arg2) {",
" traceEntryAllArgs(instance, methodName,",
" \"(\" + arg1 + \", \" + arg2 + \")\");",
" }",
"",
" void traceEntry(Object instance, String methodName, int arg1, byte[] arg2) {",
" traceEntryAllArgs(instance, methodName,",
" \"(\" + arg1 + \", \" + Utils.getStringFromBytes(arg2) + \")\");",
" }",
"",
" void traceDeprecatedEntry(",
" Object instance,",
" String methodName,",
" int arg1,",
" int arg2) {",
"",
" traceDeprecatedEntryAllArgs(instance, methodName,",
" \"(\" + arg1 + \", \" + arg2 + \")\");",
" }",
"",
" void traceDeprecatedEntry(",
" Object instance,",
" String methodName,",
" Object arg1,",
" int arg2) {",
"",
" traceDeprecatedEntryAllArgs(instance, methodName,",
" \"(\" + arg1 + \", \" + arg2 + \")\");",
" }",
"",
" void traceEntry(",
" Object instance,",
" String methodName,",
" int arg1,",
" boolean arg2) {",
"",
" traceEntryAllArgs(instance, methodName,",
" \"(\" + arg1 + \", \" + arg2 + \")\");",
" }",
"",
" void traceEntry(Object instance, String methodName, int arg1, byte arg2) {",
" traceEntryAllArgs(instance, methodName,",
" \"(\" + arg1 + \", 0x\" + Integer.toHexString(arg2 & 0xff) + \")\");",
" }",
"",
" void traceEntry(Object instance, String methodName, int arg1, short arg2) {",
" traceEntryAllArgs(instance, methodName,",
" \"(\" + arg1 + \", \" + arg2 + \")\");",
" }",
"",
" void traceEntry(Object instance, String methodName, int arg1, int arg2) {",
" traceEntryAllArgs(instance, methodName,",
" \"(\" + arg1 + \", \" + arg2 + \")\");",
" }",
"",
" void traceEntry(Object instance, String methodName, int arg1, long arg2) {",
" traceEntryAllArgs(instance, methodName,",
" \"(\" + arg1 + \", \" + arg2 + \")\");",
" }",
"",
" void traceEntry(Object instance, String methodName, int arg1, float arg2) {",
" traceEntryAllArgs(instance, methodName,",
" \"(\" + arg1 + \", \" + arg2 + \")\");",
" }",
"",
" void traceEntry(Object instance, String methodName, int arg1, double arg2) {",
" traceEntryAllArgs(instance, methodName,",
" \"(\" + arg1 + \", \" + arg2 + \")\");",
" }",
"",
" public void traceEntry(",
" Object instance,",
" String methodName,",
" Object arg1,",
" boolean arg2) {",
"",
" traceEntryAllArgs(instance, methodName,",
" \"(\" + arg1 + \", \" + arg2 + \")\");",
" }",
"",
" void traceEntry(",
" Object instance,",
" String methodName,",
" Object arg1,",
" byte arg2) {",
"",
" traceEntryAllArgs(instance, methodName,",
" \"(\" + arg1 + \", 0x\" + Integer.toHexString(arg2 & 0xff) + \")\");",
" }",
"",
" void traceEntry(",
" Object instance,",
" String methodName,",
" Object arg1,",
" short arg2) {",
"",
" traceEntryAllArgs(instance, methodName,",
" \"(\" + arg1 + \", \" + arg2 + \")\");",
" }",
"",
" public void traceEntry(Object instance, String methodName, Object arg1, int arg2) {",
" traceEntryAllArgs(instance, methodName,",
" \"(\" + arg1 + \", \" + arg2 + \")\");",
" }",
"",
" void traceEntry(",
" Object instance,",
" String methodName,",
" Object arg1,",
" long arg2) {",
"",
" traceEntryAllArgs(instance, methodName,",
" \"(\" + arg1 + \", \" + arg2 + \")\");",
" }",
"",
" void traceEntry(",
" Object instance,",
" String methodName,",
" Object arg1,",
" float arg2) {",
"",
" traceEntryAllArgs(instance, methodName,",
" \"(\" + arg1 + \", \" + arg2 + \")\");",
" }",
"",
" void traceEntry(",
" Object instance,",
" String methodName,",
" Object arg1,",
" double arg2) {",
"",
" traceEntryAllArgs(instance, methodName,",
" \"(\" + arg1 + \", \" + arg2 + \")\");",
" }",
"",
" // ---------------------- trace entry of methods w/ 3 args -------------------",
"",
" void traceEntry(Object instance, String methodName,",
" Object arg1, Object arg2, Object arg3) {",
" traceEntryAllArgs(instance, methodName,",
" \"(\" + arg1 + \", \" + arg2 + \", \" + arg3 + \")\");",
" }",
"",
" void traceEntry(Object instance, String methodName,",
" int arg1, Object arg2, Object arg3) {",
" traceEntryAllArgs(instance, methodName,",
" \"(\" + arg1 + \", \" + arg2 + \", \" + arg3 + \")\");",
" }",
"",
" void traceEntry(Object instance, String methodName,",
" Object arg1, Object arg2, int arg3) {",
" traceEntryAllArgs(instance, methodName,",
" \"(\" + arg1 + \", \" + arg2 + \", \" + arg3 + \")\");",
" }",
"",
" void traceEntry(Object instance, String methodName,",
" int arg1, Object arg2, int arg3) {",
" traceEntryAllArgs(instance, methodName,",
" \"(\" + arg1 + \", \" + arg2 + \", \" + arg3 + \")\");",
" }",
"",
" void traceDeprecatedEntry(Object instance, String methodName,",
" int arg1, Object arg2, int arg3) {",
" traceEntryAllArgs(instance, methodName,",
" \"(\" + arg1 + \", \" + arg2 + \", \" + arg3 + \")\");",
" }",
"",
" void traceEntry(Object instance, String methodName,",
" int arg1, int arg2, Object arg3) {",
" traceEntryAllArgs(instance, methodName,",
" \"(\" + arg1 + \", \" + arg2 + \", \" + arg3 + \")\");",
" }",
"",
" void traceEntry(Object instance, String methodName,",
" int arg1, int arg2, int arg3) {",
" traceEntryAllArgs(instance, methodName,",
" \"(\" + arg1 + \", \" + arg2 + \", \" + arg3 + \")\");",
" }",
"",
" void traceEntry(Object instance, String methodName,",
" Object arg1, int arg2, int arg3) {",
" traceEntryAllArgs(instance, methodName,",
" \"(\" + arg1 + \", \" + arg2 + \", \" + arg3 + \")\");",
" }",
"",
" void traceEntry(Object instance, String methodName,",
" Object arg1, int arg2, Object arg3) {",
" traceEntryAllArgs(instance, methodName,",
" \"(\" + arg1 + \", \" + arg2 + \", \" + arg3 + \")\");",
" }",
"",
" // ---------------------- trace entry of methods w/ 4 args -------------------",
"",
" void traceEntry(Object instance, String methodName,",
" Object arg1, Object arg2, Object arg3, Object arg4) {",
" traceEntryAllArgs(instance, methodName,",
" \"(\" + arg1 + \", \" + arg2 + \", \" + arg3 + \", \" + arg4 + \")\");",
" }",
"",
" void traceEntry(Object instance, String methodName,",
" int arg1, Object arg2, int arg3, int arg4) {",
" traceEntryAllArgs(instance, methodName,",
" \"(\" + arg1 + \", \" + arg2 + \", \" + arg3 + \", \" + arg4 + \")\");",
" }",
"",
" void traceEntry(Object instance, String methodName,",
" Object arg1, int arg2, int arg3, int arg4) {",
" traceEntryAllArgs(instance, methodName,",
" \"(\" + arg1 + \", \" + arg2 + \", \" + arg3 + \", \" + arg4 + \")\");",
" }",
"",
" void traceEntry(Object instance, String methodName,",
" Object arg1, Object arg2, int arg3, int arg4) {",
" traceEntryAllArgs(instance, methodName,",
" \"(\" + arg1 + \", \" + arg2 + \", \" + arg3 + \", \" + arg4 + \")\");",
" }",
"",
" // ---------------------- trace entry of methods w/ 5 args -------------------",
"",
" void traceEntry(Object instance, String methodName,",
" Object arg1, Object arg2, Object arg3, int arg4, boolean arg5) {",
" traceEntryAllArgs(instance, methodName,",
" \"(\" + arg1 + \", \" + arg2 + \", \" + arg3 + \", \" + arg4 + \", \" + arg5 + \")\");",
" }",
"",
" void traceEntry(Object instance, String methodName,",
" Object arg1, Object arg2, Object arg3, boolean arg4, boolean arg5) {",
" traceEntryAllArgs(instance, methodName,",
" \"(\" + arg1 + \", \" + arg2 + \", \" + arg3 + \", \" + arg4 + \", \" + arg5 + \")\");",
" }",
"",
" // ---------------------- trace entry of methods w/ 6 args -------------------",
" void traceEntry(Object instance, String methodName,",
" Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6) {",
" traceEntryAllArgs(instance, methodName,",
" \"(\" + arg1 + \", \" + arg2 + \", \" + arg3 + \", \" + arg4 + \", \" + arg5 + \", \" + arg6 + \")\");"
]
}
]
}
] |
derby-DERBY-6262-c465481d
|
DERBY-6262: Simplify message-generating methods using varargs
Reduce number of methods that format messages in tools classes.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1495023 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java",
"hunks": [
{
"added": [
" Object[] argMsg = null;",
"",
" argMsg = new String[args.length];"
],
"header": "@@ -3496,11 +3496,12 @@ public final class NetworkServerControlImpl {",
"removed": [
" String locMsg = null;",
" String [] argMsg = new String[args.length];"
]
}
]
},
{
"file": "java/tools/org/apache/derby/iapi/tools/i18n/LocalizedResource.java",
"hunks": [
{
"added": [],
"header": "@@ -269,25 +269,6 @@ public final class LocalizedResource implements java.security.PrivilegedAction<",
"removed": [
"\tpublic String getTextMessage(String key ) {",
" return getTextMessage(key, new Object[0]);",
"\t}",
"\tpublic String getTextMessage(String key, Object o){",
"\t\t\tObject [] att=new Object[] {o};",
"\t\t\treturn getTextMessage(key,att);",
"\t}",
"\tpublic String getTextMessage(String key, Object o1, Object o2){",
"\t\t\tObject [] att=new Object[] {o1,o2};",
"\t\t\treturn getTextMessage(key,att);",
"\t}",
"\tpublic String getTextMessage(String key, Object o1, Object o2, Object o3){",
"\t\t\tObject [] att=new Object[] {o1,o2,o3};",
"\t\t\treturn getTextMessage(key,att);",
"\t}",
"\tpublic String getTextMessage(String key, Object o1, Object o2, Object o3, Object o4){",
"\t\t\tObject [] att=new Object[] {o1,o2,o3,o4};",
"\t\t\treturn getTextMessage(key,att);",
"\t}"
]
},
{
"added": [
" public String getTextMessage(String key, Object... objectArr) {"
],
"header": "@@ -306,7 +287,7 @@ public final class LocalizedResource implements java.security.PrivilegedAction<",
"removed": [
"\tpublic String getTextMessage(String key, Object [] objectArr) {"
]
}
]
},
{
"file": "java/tools/org/apache/derby/tools/SignatureChecker.java",
"hunks": [
{
"added": [
" * Format a localizable message.",
" private static String formatMessage(String key, Object... args)",
" return getMessageFormatter().getTextMessage(key, args);"
],
"header": "@@ -522,27 +522,11 @@ public class SignatureChecker",
"removed": [
" * Format a localizable message with 0 args.",
" private static String formatMessage( String key )",
" return getMessageFormatter().getTextMessage( key );",
" }",
" ",
" /**",
" * Format a localizable message with 1 arg.",
" */",
" private static String formatMessage( String key, String arg0 )",
" {",
" return getMessageFormatter().getTextMessage( key, arg0 );",
" }",
" ",
" /**",
" * Format a localizable message with 2 args.",
" */",
" private static String formatMessage( String key, String arg0, String arg1 )",
" {",
" return getMessageFormatter().getTextMessage( key, arg0, arg1 );"
]
}
]
}
] |
derby-DERBY-6262-e1a79c33
|
DERBY-6262: Simplify message-generating methods using varargs
Use varargs in more constructors in SqlException and
DisconnectException. Since the message arguments in some of those
methods were not the last arguments, some reordering of arguments in
the callers was needed.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1494541 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/client/org/apache/derby/client/am/ClientResultSet.java",
"hunks": [
{
"added": [
" ioe, \"java.io.IOException\", ioe.getMessage());"
],
"header": "@@ -5515,7 +5515,7 @@ public abstract class ClientResultSet implements ResultSet,",
"removed": [
" \"java.io.IOException\", ioe.getMessage(), ioe);"
]
}
]
},
{
"file": "java/client/org/apache/derby/client/am/CrossConverters.java",
"hunks": [
{
"added": [
" e,",
" ClientTypes.getTypeString(targetDriverType));"
],
"header": "@@ -706,8 +706,8 @@ final class CrossConverters {",
"removed": [
" ClientTypes.getTypeString(targetDriverType),",
" e); "
]
},
{
"added": [
" e, e.getClass().getName(), e.getMessage());"
],
"header": "@@ -851,7 +851,7 @@ final class CrossConverters {",
"removed": [
" e.getClass().getName(), e.getMessage(), e);"
]
},
{
"added": [
" (SQLState.LANG_FORMAT_EXCEPTION), e, \"byte\");"
],
"header": "@@ -1109,7 +1109,7 @@ final class CrossConverters {",
"removed": [
" (SQLState.LANG_FORMAT_EXCEPTION), \"byte\", e);"
]
},
{
"added": [
" e, \"short\");"
],
"header": "@@ -1166,7 +1166,7 @@ final class CrossConverters {",
"removed": [
" \"short\", e);"
]
},
{
"added": [
" e, \"int\");"
],
"header": "@@ -1212,7 +1212,7 @@ final class CrossConverters {",
"removed": [
" \"int\", e);"
]
},
{
"added": [
" e, \"long\");"
],
"header": "@@ -1248,7 +1248,7 @@ final class CrossConverters {",
"removed": [
" \"long\", e);"
]
},
{
"added": [
" e, \"float\");"
],
"header": "@@ -1274,7 +1274,7 @@ final class CrossConverters {",
"removed": [
" \"float\", e);"
]
},
{
"added": [
" e, \"double\");"
],
"header": "@@ -1290,7 +1290,7 @@ final class CrossConverters {",
"removed": [
" \"double\", e);"
]
}
]
},
{
"file": "java/client/org/apache/derby/client/am/Cursor.java",
"hunks": [
{
"added": [
" e, \"double\");"
],
"header": "@@ -394,7 +394,7 @@ public abstract class Cursor {",
"removed": [
" \"double\", e);"
]
},
{
"added": [
" e, targetType);",
" e, targetType);"
],
"header": "@@ -409,11 +409,11 @@ public abstract class Cursor {",
"removed": [
" targetType, e);",
" targetType, e);"
]
}
]
},
{
"file": "java/client/org/apache/derby/client/am/Decimal.java",
"hunks": [
{
"added": [
" new SqlCode(-405), \"packed decimal\");"
],
"header": "@@ -372,7 +372,7 @@ public class Decimal {",
"removed": [
" \"packed decimal\", new SqlCode(-405));"
]
}
]
},
{
"file": "java/client/org/apache/derby/client/am/SqlException.java",
"hunks": [
{
"added": [
" public SqlException(LogWriter logWriter, ClientMessageId msgid,",
" SqlCode sqlcode, Object... args) {",
"",
"",
" public SqlException(LogWriter logWriter, ClientMessageId msgid,",
" Throwable cause, Object... args) {",
" this(logWriter, msgid, args, cause);"
],
"header": "@@ -181,32 +181,19 @@ public class SqlException extends Exception implements Diagnosable {",
"removed": [
" private SqlException(",
" LogWriter logWriter,",
" ClientMessageId msgid,",
" Object[] args,",
" SqlCode sqlcode) {",
"",
" ",
" SqlException(LogWriter logWriter, ClientMessageId msgid, Object arg1,",
" SqlCode sqlcode) {",
" this(logWriter, msgid, new Object[] {arg1}, sqlcode);",
" }",
" ",
" public SqlException(LogWriter logWriter, ClientMessageId msgid, Object arg1,",
" Object arg2, SqlCode sqlcode) {",
" this(logWriter, msgid, new Object[] {arg1, arg2}, sqlcode);",
" }",
" ",
" public SqlException (LogWriter logwriter, ",
" ClientMessageId msgid, Throwable cause) {",
" this (logwriter, msgid, (Object[])null, cause);"
]
}
]
},
{
"file": "java/client/org/apache/derby/client/net/NetAgent.java",
"hunks": [
{
"added": [
" e.getException(),",
" e.getException().getClass().getName(), server, port,",
" e.getException().getMessage());"
],
"header": "@@ -142,9 +142,9 @@ public class NetAgent extends Agent {",
"removed": [
" new Object[] { e.getException().getClass().getName(), server, ",
" Integer.toString(port), e.getException().getMessage() },",
" e.getException());"
]
},
{
"added": [
" e, e.getMessage());"
],
"header": "@@ -161,7 +161,7 @@ public class NetAgent extends Agent {",
"removed": [
" e.getMessage(), e);"
]
},
{
"added": [
" e, e.getMessage());"
],
"header": "@@ -176,7 +176,7 @@ public class NetAgent extends Agent {",
"removed": [
" e.getMessage(), e);"
]
},
{
"added": [
" e, e.getMessage());"
],
"header": "@@ -257,7 +257,7 @@ public class NetAgent extends Agent {",
"removed": [
" e.getMessage(), e);"
]
},
{
"added": [
" e, e.getMessage());"
],
"header": "@@ -295,7 +295,7 @@ public class NetAgent extends Agent {",
"removed": [
" e.getMessage(), e);"
]
},
{
"added": [
" e, e.getMessage());"
],
"header": "@@ -311,7 +311,7 @@ public class NetAgent extends Agent {",
"removed": [
" e.getMessage(), e);"
]
},
{
"added": [
" e, e.getMessage());"
],
"header": "@@ -328,7 +328,7 @@ public class NetAgent extends Agent {",
"removed": [
" e.getMessage(), e);"
]
}
]
},
{
"file": "java/client/org/apache/derby/client/net/NetConnection.java",
"hunks": [
{
"added": [
" e, e.getClass().getName(), e.getMessage());"
],
"header": "@@ -425,7 +425,7 @@ public class NetConnection extends ClientConnection {",
"removed": [
" e.getClass().getName(), e.getMessage(), e);"
]
}
]
},
{
"file": "java/client/org/apache/derby/client/net/Request.java",
"hunks": [
{
"added": [
" e, parameterIndex, e.getMessage()));"
],
"header": "@@ -324,7 +324,7 @@ class Request {",
"removed": [
" parameterIndex, e.getMessage(), e));"
]
},
{
"added": [
" e, parameterIndex, e.getMessage()));"
],
"header": "@@ -365,7 +365,7 @@ class Request {",
"removed": [
" parameterIndex, e.getMessage(), e));"
]
},
{
"added": [
" e, parameterIndex, e.getMessage());"
],
"header": "@@ -467,7 +467,7 @@ class Request {",
"removed": [
" parameterIndex, e.getMessage(), e);"
]
}
]
},
{
"file": "java/client/org/apache/derby/jdbc/ClientBaseDataSourceRoot.java",
"hunks": [
{
"added": [
" e, attributeString);"
],
"header": "@@ -685,7 +685,7 @@ public abstract class ClientBaseDataSourceRoot implements",
"removed": [
" attributeString, e);"
]
}
]
},
{
"file": "java/client/org/apache/derby/jdbc/ClientDriver.java",
"hunks": [
{
"added": [
" e, url);"
],
"header": "@@ -122,7 +122,7 @@ public class ClientDriver implements Driver {",
"removed": [
" url, e);"
]
},
{
"added": [
" new ClientMessageId(SQLState.MALFORMED_URL), e, url);"
],
"header": "@@ -392,7 +392,7 @@ public class ClientDriver implements Driver {",
"removed": [
" new ClientMessageId(SQLState.MALFORMED_URL), url, e);"
]
},
{
"added": [
" new ClientMessageId(SQLState.MALFORMED_URL), e, url);"
],
"header": "@@ -406,7 +406,7 @@ public class ClientDriver implements Driver {",
"removed": [
" new ClientMessageId(SQLState.MALFORMED_URL), url, e);"
]
}
]
}
] |
derby-DERBY-6263-54d20ec0
|
DERBY-6263: Add missing clauses to Visitor logic of SelectNode; tests passed cleanly on derby-6263-02-aa-ignored-clauses-in-SelectNode.diff.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1493789 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/sql/compile/SelectNode.java",
"hunks": [
{
"added": [
"",
" // visiting these clauses was added as part of DERBY-6263. a better fix might be to fix the",
" // visitor rather than skip it.",
" if ( !(v instanceof HasCorrelatedCRsVisitor) )",
" {",
" if (selectSubquerys != null)",
" {",
" selectSubquerys = (SubqueryList) selectSubquerys.accept( v );",
" }",
"",
" if (whereSubquerys != null)",
" {",
" whereSubquerys = (SubqueryList) whereSubquerys.accept( v );",
" }",
"",
" if (groupByList != null) {",
" groupByList = (GroupByList) groupByList.accept( v );",
" }",
" ",
" if (orderByLists[0] != null) {",
" for (int i = 0; i < orderByLists.length; i++) {",
" orderByLists[i] = (OrderByList) orderByLists[ i ].accept( v );",
" }",
" }",
"",
" if (offset != null) {",
" offset = (ValueNode) offset.accept( v );",
" }",
" ",
" if (fetchFirst != null) {",
" fetchFirst = (ValueNode) fetchFirst.accept( v );",
" }",
" ",
" if (preJoinFL != null)",
" {",
" preJoinFL = (FromList) preJoinFL.accept( v );",
" }",
" ",
" if (windows != null)",
" {",
" windows = (WindowList) windows.accept( v );",
" }",
" }"
],
"header": "@@ -2533,6 +2533,49 @@ public class SelectNode extends ResultSetNode",
"removed": []
}
]
}
] |
derby-DERBY-6263-65ffd9b1
|
DERBY-6263: Add defensive code to Visitor support in SelectNode; tests passed cleanly on derby-6263-03-ab-defensiveNullChecking-in-SelectNode.diff.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1494220 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/sql/compile/SelectNode.java",
"hunks": [
{
"added": [
" if (orderByLists != null)",
" {",
" for (int i = 0; i < orderByLists.length; i++)",
" {",
" if ( orderByLists[i] != null )",
" {",
" printLabel(depth, \"orderByLists[\" + i + \"]:\");",
" orderByLists[i].treePrint(depth + 1);",
" }"
],
"header": "@@ -339,10 +339,15 @@ public class SelectNode extends ResultSetNode",
"removed": [
" if (orderByLists[0] != null) {",
" for (int i = 0; i < orderByLists.length; i++) {",
" printLabel(depth, \"orderByLists[\" + i + \"]:\");",
" orderByLists[i].treePrint(depth + 1);"
]
},
{
"added": [
" if (orderByLists != null)",
" {",
" for (int i = 0; i < orderByLists.length; i++)",
" {",
" if ( orderByLists[ i ] != null )",
" {",
" orderByLists[i] = (OrderByList) orderByLists[ i ].accept( v );",
" }"
],
"header": "@@ -2552,9 +2557,14 @@ public class SelectNode extends ResultSetNode",
"removed": [
" if (orderByLists[0] != null) {",
" for (int i = 0; i < orderByLists.length; i++) {",
" orderByLists[i] = (OrderByList) orderByLists[ i ].accept( v );"
]
}
]
}
] |
derby-DERBY-6263-91405aff
|
DERBY-6263: Make the Visitor logic inspect ORDER BY, FETCH, and OFFSET CLAUSES. Tests passed cleanly for me on derby-6263-01-aa-visit-ignored-clauses.diff.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1493123 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/sql/compile/CursorNode.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.sql.compile.Visitor;"
],
"header": "@@ -30,6 +30,7 @@ import org.apache.derby.iapi.reference.SQLState;",
"removed": []
},
{
"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{",
" super.acceptChildren(v);",
"",
" if (orderByList != null) { orderByList.acceptChildren( v ); }",
" if (offset != null) { offset.acceptChildren( v ); }",
" if (fetchFirst != null) { fetchFirst.acceptChildren( v ); }",
"\t}",
""
],
"header": "@@ -793,4 +794,22 @@ public class CursorNode extends DMLStatementNode",
"removed": []
}
]
}
] |
derby-DERBY-6266-b197ffaf
|
DERBY-6266: Add ability to print Derby execution ResultSet graph as xml.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1494115 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/iapi/sql/ResultSet.java",
"hunks": [
{
"added": [
"import org.w3c.dom.Element;"
],
"header": "@@ -29,6 +29,7 @@ import org.apache.derby.iapi.sql.Row;",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/execute/BasicNoPutResultSetImpl.java",
"hunks": [
{
"added": [
"import java.lang.reflect.Field;",
"import java.util.Arrays;",
"import java.util.ArrayList;",
"import java.util.Comparator;",
"import org.w3c.dom.Element;"
],
"header": "@@ -21,8 +21,13 @@",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/execute/DependentResultSet.java",
"hunks": [
{
"added": [
"import org.w3c.dom.Element;"
],
"header": "@@ -23,6 +23,7 @@ package org.apache.derby.impl.sql.execute;",
"removed": []
},
{
"added": [],
"header": "@@ -94,9 +95,7 @@ class DependentResultSet extends ScanResultSet implements CursorResultSet",
"removed": [
"\tpublic String tableName;",
"\tpublic String indexName;"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/execute/NoRowsResultSetImpl.java",
"hunks": [
{
"added": [
"import org.w3c.dom.Element;"
],
"header": "@@ -23,6 +23,7 @@ package org.apache.derby.impl.sql.execute;",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/execute/ScanResultSet.java",
"hunks": [
{
"added": [
"import org.w3c.dom.Element;",
""
],
"header": "@@ -19,6 +19,8 @@",
"removed": []
},
{
"added": [
"\tpublic String tableName;",
"\tpublic String indexName;",
""
],
"header": "@@ -88,6 +90,9 @@ abstract class ScanResultSet extends NoPutResultSetImpl {",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/execute/TemporaryRowHolderResultSet.java",
"hunks": [
{
"added": [
"import org.w3c.dom.Element;"
],
"header": "@@ -23,6 +23,7 @@ package org.apache.derby.impl.sql.execute;",
"removed": []
},
{
"added": [
" ",
" public Element toXML( Element parentNode, String tag ) throws Exception",
" {",
" return BasicNoPutResultSetImpl.childrenToXML( BasicNoPutResultSetImpl.toXML( parentNode, tag, this ), this );",
" }",
""
],
"header": "@@ -1349,4 +1350,10 @@ class TemporaryRowHolderResultSet implements CursorResultSet, NoPutResultSet, Cl",
"removed": []
}
]
}
] |
derby-DERBY-6267-8eb8753d
|
DERBY-6267: Add tests for compact optimizer overrides on queries with FETCH/OFFSET clauses; commit derby-6267-04-aa-fetchOffsetTest.diff.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1506054 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-6267-a56ecfa3
|
DERBY-6267: Add first rev of complete plan overrides; merged derby-6267-01-ae-compactSyntax.diff to head of trunk.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1499012 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/iapi/sql/StatementUtil.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.sql.compile.CompilerContext;",
"import org.apache.derby.iapi.sql.dictionary.DataDictionary;",
"import org.apache.derby.iapi.sql.dictionary.SchemaDescriptor;",
"import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;"
],
"header": "@@ -24,6 +24,10 @@ package org.apache.derby.iapi.sql;",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/iapi/sql/compile/OptimizerFactory.java",
"hunks": [
{
"added": [
"\t * @param overridingPlan (Optional) A complete plan specified by optimizer overrides. Must have been bound already."
],
"header": "@@ -48,6 +48,7 @@ public interface OptimizerFactory {",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/DeleteNode.java",
"hunks": [
{
"added": [
" null, /* optimizer override plan */"
],
"header": "@@ -758,6 +758,7 @@ class DeleteNode extends DMLModStatementNode",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/OptimizerFactoryImpl.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.sql.compile.OptimizerPlan;"
],
"header": "@@ -31,6 +31,7 @@ import org.apache.derby.iapi.sql.compile.OptimizableList;",
"removed": []
},
{
"added": [
"\t\t\t\t\t\t\t\t OptimizerPlan overridingPlan,"
],
"header": "@@ -141,6 +142,7 @@ public class OptimizerFactoryImpl",
"removed": []
},
{
"added": [
"\t\t\t\t\t\t\toverridingPlan,"
],
"header": "@@ -166,6 +168,7 @@ public class OptimizerFactoryImpl",
"removed": []
},
{
"added": [
"\t\t\t\t\t\t\t\t OptimizerPlan overridingPlan,"
],
"header": "@@ -199,6 +202,7 @@ public class OptimizerFactoryImpl",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/OptimizerImpl.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.sql.compile.OptimizerPlan;",
"import org.apache.derby.iapi.sql.dictionary.UniqueTupleDescriptor;"
],
"header": "@@ -36,12 +36,14 @@ import org.apache.derby.iapi.sql.compile.OptimizableList;",
"removed": []
},
{
"added": [
" private OptimizerPlan overridingPlan;",
" private OptimizerPlan currentPlan;"
],
"header": "@@ -74,6 +76,8 @@ class OptimizerImpl implements Optimizer",
"removed": []
},
{
"added": [
" OptimizerPlan overridingPlan,"
],
"header": "@@ -196,6 +200,7 @@ class OptimizerImpl implements Optimizer",
"removed": []
},
{
"added": [
"\t\tthis.overridingPlan = overridingPlan;"
],
"header": "@@ -233,6 +238,7 @@ class OptimizerImpl implements Optimizer",
"removed": []
},
{
"added": [
"",
" // make sure that optimizer overrides are bound and left-deep",
" if ( overridingPlan != null )",
" {",
" if ( !overridingPlan.isBound() )",
" {",
" throw StandardException.newException( SQLState.LANG_UNRESOLVED_ROW_SOURCE );",
" }",
" }"
],
"header": "@@ -271,6 +277,15 @@ class OptimizerImpl implements Optimizer",
"removed": []
},
{
"added": [
" while ( true )",
" {",
" /* Returns true until all access paths are exhausted */",
" retval = curOpt.nextAccessPath(this, (OptimizablePredicateList) null, currentRowOrdering);",
"",
" // if the user didn't specify an explicit plan, we're ok",
" if ( overridingPlan == null ) { break; }",
" if ( !retval ) { break; }",
"",
" // if we've already found the right access path for this location in",
" // the join order, then we move on to the next position",
" if ( currentPlan != null )",
" {",
" if ( currentPlan.countLeafNodes() == (joinPosition+1) )",
" {",
" retval = false;",
" break;",
" }",
" }",
"",
" // at this point, figure out if the plan so far is a prefix of the desired plan",
" OptimizerPlan candidate = OptimizerPlan.makeRowSource( getTupleDescriptor( curOpt ), dDictionary );",
" if ( candidate == null )",
" {",
" retval = false;",
" break;",
" }",
" if ( currentPlan != null )",
" {",
" candidate = new OptimizerPlan.Join",
" (",
" curOpt.getCurrentAccessPath().getJoinStrategy(),",
" currentPlan,",
" candidate",
" );",
" }",
"",
" if ( candidate.isLeftPrefixOf( overridingPlan ) )",
" {",
" currentPlan = candidate;",
" break;",
" }",
"",
" // well, that decoration didn't match up with the user-specified plan.",
" // try again",
" }"
],
"header": "@@ -1540,10 +1555,52 @@ class OptimizerImpl implements Optimizer",
"removed": [
"\t\t/* Returns true until all access paths are exhausted */",
"\t\tretval = curOpt.nextAccessPath(this,",
"\t\t\t\t\t\t\t\t\t\t(OptimizablePredicateList) null,",
"\t\t\t\t\t\t\t\t\t\tcurrentRowOrdering);"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/QueryTreeNode.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.sql.StatementUtil;"
],
"header": "@@ -39,6 +39,7 @@ import org.apache.derby.iapi.services.loader.ClassFactory;",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/ResultSetNode.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.sql.compile.OptimizerPlan;"
],
"header": "@@ -38,6 +38,7 @@ import org.apache.derby.iapi.sql.compile.OptimizableList;",
"removed": []
},
{
"added": [
"\t\t\t\t\t\t\tRequiredRowOrdering requiredRowOrdering,",
"\t\t\t\t\t\t\tOptimizerPlan overridingPlan)"
],
"header": "@@ -1483,7 +1484,8 @@ public abstract class ResultSetNode extends QueryTreeNode",
"removed": [
"\t\t\t\t\t\t\tRequiredRowOrdering requiredRowOrdering)"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/SelectNode.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.sql.compile.OptimizerPlan;"
],
"header": "@@ -34,6 +34,7 @@ import org.apache.derby.iapi.sql.compile.C_NodeTypes;",
"removed": []
},
{
"added": [
" /** Full plan for this SELECT as specified in an optimizer override */",
" OptimizerPlan overridingPlan;",
""
],
"header": "@@ -87,6 +88,9 @@ class SelectNode extends ResultSetNode",
"removed": []
},
{
"added": [
" OptimizerPlan overridingPlan,"
],
"header": "@@ -142,6 +146,7 @@ class SelectNode extends ResultSetNode",
"removed": []
},
{
"added": [
" this.overridingPlan = overridingPlan;",
" "
],
"header": "@@ -168,6 +173,8 @@ class SelectNode extends ResultSetNode",
"removed": []
},
{
"added": [
"",
" // if an explicit join plan is requested, bind it",
" if ( overridingPlan != null )",
" {",
" overridingPlan.bind( dataDictionary, getLanguageConnectionContext(), getCompilerContext(), fromList.size() );",
" }",
" "
],
"header": "@@ -516,6 +523,13 @@ class SelectNode extends ResultSetNode",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/TableOperatorNode.java",
"hunks": [
{
"added": [
" (RequiredRowOrdering) null,",
" null );"
],
"header": "@@ -694,7 +694,8 @@ abstract class TableOperatorNode extends FromTable",
"removed": [
" (RequiredRowOrdering) null);"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/XMLOptTrace.java",
"hunks": [
{
"added": [
" else if ( OptimizerImpl.isTableFunction( optimizable ) )"
],
"header": "@@ -499,7 +499,7 @@ class XMLOptTrace implements OptTrace",
"removed": [
" else if ( isTableFunction( optimizable ) )"
]
},
{
"added": [],
"header": "@@ -546,17 +546,6 @@ class XMLOptTrace implements OptTrace",
"removed": [
" /** Return true if the optimizable is a table function */",
" private boolean isTableFunction( Optimizable optimizable )",
" {",
" if ( !( optimizable instanceof ProjectRestrictNode ) ) { return false; }",
"",
" ResultSetNode rsn = ((ProjectRestrictNode) optimizable).getChildResult();",
" if ( !( rsn instanceof FromVTI ) ) { return false; }",
"",
" return ( ((FromVTI) rsn).getMethodCall() instanceof StaticMethodCallNode );",
" }",
""
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/execute/BasicNoPutResultSetImpl.java",
"hunks": [
{
"added": [
"import java.security.AccessController;",
"import java.security.PrivilegedAction;"
],
"header": "@@ -22,6 +22,8 @@",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/execute/VTIResultSet.java",
"hunks": [
{
"added": [
"import org.w3c.dom.Element;"
],
"header": "@@ -62,7 +62,7 @@ import java.sql.ResultSet;",
"removed": [
""
]
}
]
}
] |
derby-DERBY-6267-a80adcad
|
DERBY-6267: Add optimizer override tests for more kinds of subqueries; tests for derby-6267-03-aa-moreSubqueryTests.diff passed cleanly.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1501891 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-6267-bbb545ef
|
DERBY-6267: Count row sources in optimizer overrides at optimize() time rather than bind() time; add more tests for optimizer overrides; tests passed cleanly on derby-6267-02-aa-moreTests.diff.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1501411 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/iapi/sql/compile/OptimizerPlan.java",
"hunks": [
{
"added": [
" CompilerContext cc"
],
"header": "@@ -94,8 +94,7 @@ public abstract class OptimizerPlan",
"removed": [
" CompilerContext cc,",
" int fromListSize"
]
},
{
"added": [
" CompilerContext cc",
" leftChild.bind( dataDictionary, lcc, cc );",
" rightChild.bind( dataDictionary, lcc, cc );"
],
"header": "@@ -157,29 +156,18 @@ public abstract class OptimizerPlan",
"removed": [
" CompilerContext cc,",
" int fromListSize",
" if ( fromListSize > 0 )",
" {",
" int leafNodeCount = countLeafNodes();",
" if ( fromListSize != leafNodeCount )",
" {",
" throw StandardException.newException",
" ( SQLState.LANG_BAD_ROW_SOURCE_COUNT, leafNodeCount, fromListSize );",
" }",
" }",
"",
" leftChild.bind( dataDictionary, lcc, cc, (leftChild instanceof RowSource) ? 1 : -1 );",
" rightChild.bind( dataDictionary, lcc, cc, (rightChild instanceof RowSource) ? 1 : -1 );"
]
},
{
"added": [
" CompilerContext cc"
],
"header": "@@ -252,17 +240,10 @@ public abstract class OptimizerPlan",
"removed": [
" CompilerContext cc,",
" int fromListSize",
" if ( fromListSize != 1 )",
" {",
" throw StandardException.newException",
" ( SQLState.LANG_BAD_ROW_SOURCE_COUNT, 1, fromListSize );",
" }",
""
]
},
{
"added": [
" CompilerContext cc",
" super.bind( dataDictionary, lcc, cc );"
],
"header": "@@ -317,12 +298,11 @@ public abstract class OptimizerPlan",
"removed": [
" CompilerContext cc,",
" int fromListSize",
" super.bind( dataDictionary, lcc, cc, fromListSize );"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/execute/BasicNoPutResultSetImpl.java",
"hunks": [
{
"added": [
"import java.lang.reflect.Array;"
],
"header": "@@ -21,6 +21,7 @@",
"removed": []
},
{
"added": [
" result.setAttribute( \"type\", stripPackage( rs.getClass().getName() ) );",
" /** Strip the package location from a class name */",
" private static String stripPackage( String className )",
" {",
" return className.substring( className.lastIndexOf( \".\" ) + 1 );",
" }",
""
],
"header": "@@ -1064,15 +1065,19 @@ implements NoPutResultSet",
"removed": [
" String childClassName = rs.getClass().getName();",
" String typeAttribute = childClassName.substring( childClassName.lastIndexOf( \".\" ) + 1 );",
" result.setAttribute( \"type\", typeAttribute );"
]
},
{
"added": [
" Object fieldContents = field.get( outerRS );",
"",
" if ( fieldContents != null )",
" {",
" if ( field.getType().isArray() )",
" {",
" Element arrayNode = outerNode.getOwnerDocument().createElement( \"array\" );",
" arrayNode.setAttribute( \"arrayName\", field.getName() );",
" String typeName = stripPackage( field.getType().getComponentType().getName() ) + \"[]\";",
" arrayNode.setAttribute( \"type\", typeName );",
" outerNode.appendChild( arrayNode );",
"",
" int arrayLength = Array.getLength( fieldContents );",
" for ( int i = 0; i < arrayLength; i++ )",
" {",
" ResultSet cellRS = (ResultSet) Array.get( fieldContents, i );",
"",
" if ( cellRS != null )",
" {",
" Element cellNode = cellRS.toXML( arrayNode, \"cell\" );",
" cellNode.setAttribute( \"cellNumber\", Integer.toString( i ) );",
" }",
" }",
" }",
" else",
" {",
" ResultSet innerRS = (ResultSet) fieldContents;",
"",
" innerRS.toXML( outerNode, field.getName() );",
" }",
" } // end if fieldContents is not null",
" } // end loop through fields"
],
"header": "@@ -1096,10 +1101,38 @@ implements NoPutResultSet",
"removed": [
" ResultSet innerRS = (ResultSet) field.get( outerRS );",
"",
" if ( innerRS != null) { innerRS.toXML( outerNode, field.getName() ); }",
" }"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/execute/GenericAggregateResultSet.java",
"hunks": [
{
"added": [
"import org.w3c.dom.Element;",
"import org.w3c.dom.Node;",
"import org.w3c.dom.NodeList;"
],
"header": "@@ -22,6 +22,9 @@",
"removed": []
}
]
}
] |
derby-DERBY-6268-da3d219a
|
DERBY-6268: Run-time statistics not collected if query contains always false predicate
Make ProjectRestrictResultSet.close() call super.close() so that the
logic for dumping run-time statistics gets executed.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1495943 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-6272-ddca784d
|
DERBY-6272: LoginTimeoutTest fails if server is missing
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1496406 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-6273-cd5717c7
|
DERBY-6273: NullPointerException when using more than one parameter in COALESCE
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1496837 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-628-f225091f
|
DERBY-628: Allow setting a CLOB to NULL using any character types for setNull.
Submitted by Satheesh Bandaram(satheesh@sourcery.org)
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@375877 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-6280-29357110
|
DERBY-6280; test failure in SetQueryTimeoutTest ComparisonFailure: Output at line 16 expected:<Test[ing that PreparedStatement remembers timeout.]> but was:<Test[ SetQueryTimeoutTest FAILED]>
adding details to the failure messages for this case
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1571534 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-6283-a2f00b4a
|
DERBY-6283 indexStat daemon processing tables over and over even when there are no changes in the tables in soft upgraded database.
Changed system to always drop orphaned stats during update statistics call.
Without this change soft upgraded systems running on 10.8 or higher derby
software, that had an orphaned statistic would spin forever in the index
stat daemon due to the same problem fixed by DERBY-5680 for hard
upgraded databases.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1502319 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/services/daemon/IndexStatisticsDaemonImpl.java",
"hunks": [
{
"added": [
"",
" // can only properly identify disposable stats if cds == null, ",
" // which means we are processing all indexes on the conglomerate.",
" final boolean identifyDisposableStats = (cds == null);",
"",
"",
" long[] conglomerateNumber = new long[cds.length];",
" ExecIndexRow[] indexRow = new ExecIndexRow[cds.length];",
""
],
"header": "@@ -414,16 +414,20 @@ public class IndexStatisticsDaemonImpl",
"removed": [
" final boolean identifyDisposableStats =",
" (cds == null && skipDisposableStats);",
" long[] conglomerateNumber = new long[cds.length];",
" ExecIndexRow[] indexRow = new ExecIndexRow[cds.length];",
" UUID[] objectUUID = new UUID[cds.length];"
]
},
{
"added": [
"",
"",
" // create a list of indexes that should have statistics, by looking",
" // at all indexes on the conglomerate, and conditionally skipping",
" // unique single column indexes. This set is the \"non disposable",
" // stat list\".",
" UUID[] non_disposable_objectUUID = new UUID[cds.length];",
""
],
"header": "@@ -434,6 +438,14 @@ public class IndexStatisticsDaemonImpl",
"removed": []
},
{
"added": [
"",
""
],
"header": "@@ -444,7 +456,9 @@ public class IndexStatisticsDaemonImpl",
"removed": []
},
{
"added": [
" // at this point have found a stat for an existing",
" // index which is not a single column unique index, add it",
" // to the list of \"non disposable stats\"",
" conglomerateNumber[i] = cds[i].getConglomerateNumber();",
" non_disposable_objectUUID[i] = cds[i].getUUID();"
],
"header": "@@ -454,9 +468,11 @@ public class IndexStatisticsDaemonImpl",
"removed": [
" conglomerateNumber[i] = cds[i].getConglomerateNumber();",
"",
" objectUUID[i] = cds[i].getUUID();"
]
},
{
"added": [
" // Check for and drop disposable statistics if we have the required ",
" // information.",
" //",
" // The above loop has populated \"cds\" with only existing indexes that",
" // are not single column unique.",
"",
"",
" // Note this loop is not controlled by the skipDisposableStats ",
" // flag. The above loop controls if we drop single column unique",
" // index stats or not. In all cases we are going to drop ",
" // stats with no associated index (orphaned stats).",
" ",
"",
"",
" //",
" // This loop looks for statistic entries to delete. It deletes",
" // those entries that don't have a matching conglomerate in the",
" if (referencedIndex.equals(non_disposable_objectUUID[ci])) {"
],
"header": "@@ -468,23 +484,39 @@ public class IndexStatisticsDaemonImpl",
"removed": [
" // Check for disposable statistics if we have the required information.",
" if (referencedIndex.equals(objectUUID[ci])) {"
]
},
{
"added": [
" int sci = 0;"
],
"header": "@@ -518,7 +550,7 @@ public class IndexStatisticsDaemonImpl",
"removed": [
" int sci = 0;"
]
},
{
"added": [
"",
" int numCols = indexRow[indexNumber].nColumns() - 1;",
" long[] cardinality = new long[numCols];",
" KeyComparator cmp = new KeyComparator(indexRow[indexNumber]);"
],
"header": "@@ -535,10 +567,11 @@ public class IndexStatisticsDaemonImpl",
"removed": [
" int numCols = indexRow[indexNumber].nColumns() - 1;",
" long[] cardinality = new long[numCols];",
" KeyComparator cmp = new KeyComparator(indexRow[indexNumber]);"
]
}
]
}
] |
derby-DERBY-6285-daaa0466
|
DERBY-6285: Use factory method to create thread pool for timed login
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1499257 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/jdbc/InternalDriver.java",
"hunks": [
{
"added": [
"import java.util.concurrent.ExecutorService;",
"import java.util.concurrent.Executors;"
],
"header": "@@ -38,10 +38,10 @@ import java.util.Properties;",
"removed": [
"import java.util.concurrent.SynchronousQueue;",
"import java.util.concurrent.ThreadPoolExecutor;"
]
},
{
"added": [
" private static final ExecutorService _executorPool =",
" Executors.newCachedThreadPool(new DaemonThreadFactory());"
],
"header": "@@ -94,12 +94,8 @@ public class InternalDriver implements ModuleControl, Driver {",
"removed": [
" private static final ThreadPoolExecutor _executorPool =",
" new ThreadPoolExecutor(0, Integer.MAX_VALUE, 60L, TimeUnit.SECONDS,",
" new SynchronousQueue<Runnable>());",
" static {",
" _executorPool.setThreadFactory(new DaemonThreadFactory());",
" }"
]
}
]
}
] |
derby-DERBY-6287-edd6d3c8
|
DERBY-6287: Don't use reflection to call Java 6 methods in FileUtil
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1499317 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/iapi/services/io/FileUtil.java",
"hunks": [
{
"added": [],
"header": "@@ -594,13 +594,7 @@ nextFile:\tfor (int i = 0; i < list.length; i++) {",
"removed": [
" // Reflection helper objects for calling into Java >= 6",
" private static Method setWrite = null;",
" private static Method setRead = null;",
" private static Method setExec = null;",
"",
" private static Class<File> fileClz = File.class;"
]
},
{
"added": [],
"header": "@@ -621,10 +615,7 @@ nextFile:\tfor (int i = 0; i < list.length; i++) {",
"removed": [
" private static Method getAcl;",
" private static Method principal;",
" private static Method getName;"
]
},
{
"added": [
"",
" * Use when creating new files. If running on Unix,"
],
"header": "@@ -633,8 +624,9 @@ nextFile:\tfor (int i = 0; i < list.length; i++) {",
"removed": [
" * Use when creating new files. If running with Java 6 or higher on Unix,"
]
},
{
"added": [],
"header": "@@ -678,20 +670,6 @@ nextFile:\tfor (int i = 0; i < list.length; i++) {",
"removed": [
" // >= Java 6",
" try {",
" setWrite = fileClz.getMethod(",
" \"setWritable\",",
" new Class[]{Boolean.TYPE, Boolean.TYPE});",
" setRead = fileClz.getMethod(",
" \"setReadable\",",
" new Class[]{Boolean.TYPE, Boolean.TYPE});",
" setExec = fileClz.getMethod(",
" \"setExecutable\",",
" new Class[]{Boolean.TYPE, Boolean.TYPE});",
" } catch (NoSuchMethodException e) {",
" // not Java 6 or higher",
" }"
]
},
{
"added": [],
"header": "@@ -738,14 +716,8 @@ nextFile:\tfor (int i = 0; i < list.length; i++) {",
"removed": [
" getAcl = aclFileAttributeViewClz.",
" getMethod(\"getAcl\", new Class[]{});",
" principal = aclEntryClz.",
" getMethod(\"principal\", new Class[]{});",
" getName = userPrincipalClz.",
" getMethod(\"getName\", new Class[]{});"
]
},
{
"added": [
" //",
" // First switch off all write access",
" //",
" assertTrue(file.setWritable(false, false));",
" //",
" // Next, switch on write again, but for owner only",
" //",
" assertTrue(file.setWritable(true, true));",
" //",
" // First switch off all read access",
" //",
" assertTrue(file.setReadable(false, false));",
"",
" //",
" // Next, switch on read access again, but for owner only",
" //",
" assertTrue(file.setReadable(true, true));",
" if (file.isDirectory()) {",
" // First switch off all exec access",
" assertTrue(file.setExecutable(false, false));",
" // Next, switch on exec again, but for owner only",
" assertTrue(file.setExecutable(true, true));",
" private static void assertTrue(boolean b) {",
" if (!b) {"
],
"header": "@@ -772,88 +744,50 @@ nextFile:\tfor (int i = 0; i < list.length; i++) {",
"removed": [
" if (setWrite == null) {",
" // JVM level too low",
" return;",
" }",
"",
" try {",
" //",
" // First switch off all write access",
" //",
" Object r;",
" r = setWrite.invoke(",
" file,",
" new Object[]{Boolean.FALSE, Boolean.FALSE});",
" assertTrue(r);",
" //",
" // Next, switch on write again, but for owner only",
" //",
" r = setWrite.invoke(",
" file,",
" new Object[]{Boolean.TRUE, Boolean.TRUE});",
" assertTrue(r);",
" // First switch off all read access",
" r = setRead.invoke(",
" file,",
" new Object[]{Boolean.FALSE, Boolean.FALSE});",
" assertTrue(r);",
" // Next, switch on read access again, but for owner only",
" r = setRead.invoke(",
" file,",
" new Object[]{Boolean.TRUE, Boolean.TRUE});",
" assertTrue(r);",
"",
"",
" if (file.isDirectory()) {",
" //",
" // First switch off all exec access",
" //",
" r = setExec.invoke(",
" file,",
" new Object[]{Boolean.FALSE, Boolean.FALSE});",
" assertTrue(r);",
"",
" //",
" // Next, switch on read exec again, but for owner only",
" //",
" r = setExec.invoke(",
" file,",
" new Object[]{Boolean.TRUE, Boolean.TRUE});",
" assertTrue(r);",
" }",
" } catch (InvocationTargetException e) {",
" // setWritable/setReadable can throw SecurityException",
" throw (SecurityException)e.getCause();",
" } catch (IllegalAccessException e) {",
" // coding error",
" if (SanityManager.DEBUG) {",
" SanityManager.THROWASSERT(e);",
" }",
" private static void assertTrue(Object r){",
" Boolean b = (Boolean)r;",
"",
" if (!b.booleanValue()) {"
]
}
]
}
] |
derby-DERBY-6296-221abb6f
|
DERBY-6296: Simplify PropertyUtil using Properties.stringPropertyNames()
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1504809 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/iapi/util/PropertyUtil.java",
"hunks": [
{
"added": [
"import java.util.Arrays;",
"import java.util.Collections;",
"import java.util.Set;"
],
"header": "@@ -22,9 +22,11 @@",
"removed": [
"import java.util.Enumeration;"
]
},
{
"added": [
" // Get all property names, including any defaults.",
" Set<String> names = (list == null)",
" ? Collections.<String>emptySet()",
" : list.stringPropertyNames();",
" String[] array = names.toArray(new String[names.size()]);",
"",
" // now sort the array",
" Arrays.sort(array);",
" StringBuilder buffer = new StringBuilder();",
" for ( int ictr = 0; ictr < array.length; ictr++ )",
" String key = array[ ictr ];",
" String value = list.getProperty( key, \"MISSING_VALUE\" );"
],
"header": "@@ -68,56 +70,33 @@ public class PropertyUtil {",
"removed": [
"\t\tint\t\t\t\tsize = list == null ? 0 : list.size();",
"\t\tint\t\t\t\tcount = 0;",
"\t\tString[]\t\tarray = new String[size];",
"\t\tString\t\t\tkey;",
"\t\tString\t\t\tvalue;",
"\t\tStringBuffer\tbuffer;",
"",
"\t\t// Calculate the number of properties in the property list and",
"\t\t// build an array of all the property names.",
"\t\t// We need to go thru the enumeration because Properties has a",
"\t\t// recursive list of defaults.",
"\t\tif (list != null)",
"\t\t{",
"\t\t\tfor (Enumeration propertyNames = list.propertyNames();",
"\t\t\t\t propertyNames.hasMoreElements(); )",
"\t\t\t{",
"\t\t\t\tif (count == size)",
"\t\t\t\t{",
"\t\t\t\t\t// need to expand the array",
"\t\t\t\t\tsize = size*2;",
"\t\t\t\t\tString[] expandedArray = new String[size];",
"\t\t\t\t\tSystem.arraycopy(array, 0, expandedArray, 0, count);",
"\t\t\t\t\tarray = expandedArray;",
"\t\t\t\t}",
"\t\t\t\tkey = (String) propertyNames.nextElement();",
"\t\t\t\tarray[ count++ ] = key;",
"\t\t\t}",
"",
"\t\t\t// now sort the array",
"\t\t\tjava.util.Arrays.sort(array, 0, count);",
"\t\t}",
"\t\tbuffer = new StringBuffer();",
"\t\tfor ( int ictr = 0; ictr < count; ictr++ )",
"\t\t\tkey = array[ ictr ];",
"\t\t\tvalue = list.getProperty( key, \"MISSING_VALUE\" );"
]
},
{
"added": [
" for (String key : src_prop.stringPropertyNames())"
],
"header": "@@ -140,10 +119,8 @@ public class PropertyUtil {",
"removed": [
" for (Enumeration propertyNames = src_prop.propertyNames();",
" propertyNames.hasMoreElements(); )",
" Object key = propertyNames.nextElement();"
]
},
{
"added": [
" for (String tmpKey : p.stringPropertyNames()) {"
],
"header": "@@ -189,18 +166,14 @@ public class PropertyUtil {",
"removed": [
"\t\tfor (Enumeration propKeys = p.propertyNames();",
"\t\t propKeys.hasMoreElements();) {",
"\t\t\tString tmpKey = (String)propKeys.nextElement();",
"\t\treturn;",
""
]
}
]
}
] |
derby-DERBY-6297-643e68c9
|
DERBY-6297: Intermittent failures in XplainStatisticsTest.testSimpleXplainOnly
Make AccessDatabase.schemaExists() close the ResultSet.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1518111 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/tools/org/apache/derby/impl/tools/planexporter/AccessDatabase.java",
"hunks": [
{
"added": [
" try {",
" while (result.next()) {",
" if (result.getString(1).equals(schema)) {",
" // Found it!",
" return true;",
" }",
" }",
" } finally {",
" result.close();",
" }",
"",
" // Didn't find the schema.",
" return false;"
],
"header": "@@ -146,15 +146,20 @@ public class AccessDatabase {",
"removed": [
" \tboolean found=false;",
" \twhile(result.next()){",
" \t\tif(result.getString(1).equals(schema)){",
" \t\t\tfound=true;",
" \t\t\tbreak;",
" \t\t}",
" \t}\t",
" \treturn found;"
]
}
]
}
] |
derby-DERBY-630-16c8b880
|
DERBY-630: CREATE TRIGGER fails with null pointer exception
This patch was contributed by Yip Ng (yipng168@gmail.com)
The current implementation for CREATE TRIGGER needs to handle null compilation
schema. A compilation schema with null value indicates that the
trigger action statement text does not depend on the current schema. This means:
1. It is safe to compile this statement in any schema since there is no dependency with
the CURRENT SCHEMA. i.e.: All relevent fields are qualified with a specific schema.
2. The statement cache mechanism can utilize this piece of information to enable
better statement plan sharing across different schemas; thus, avoiding unnecessary
statement compilation.
So the proposal is:
a) Allow null compilation schema. The system catalog first needs to change the
compiliation schema id column of SYS.SYSSTATEMENTS and SYS.SYSVIEWS system
table's nullability to true. This would also require a soft upgrade for the
previous versions of Derby. This step will resolve the NPE problem of this jira.
b) Handle null compilation schema in statement preparation logic. This can be filed
as a separate jira as improvement. It may require some work on the SQL parser to
determine whether the compiled statement depends on the CURRENT SCHEMA or not, so
that the compilation schema can be properly set.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@464215 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/sql/catalog/DD_Version.java",
"hunks": [
{
"added": [
"\t\tcase DataDictionary.DD_VERSION_DERBY_10_3:",
"\t\t\treturn \"10.3\";"
],
"header": "@@ -148,6 +148,8 @@ public\tclass DD_Version implements\tFormatable",
"removed": []
},
{
"added": [
"\t\t/*",
"\t\t * Derby soft upgrade code",
"\t\t */",
"\t\tif (lastSoftUpgradeVersion <= DataDictionary.DD_VERSION_DERBY_10_2)",
"\t\t{",
"\t\t\tif (fromMajorVersionNumber <= DataDictionary.DD_VERSION_DERBY_10_2)",
"\t\t\t{",
"\t\t\t\tmodifySysTableNullability(tc,",
"\t\t\t\t\tDataDictionaryImpl.SYSSTATEMENTS_CATALOG_NUM);",
"\t\t\t",
"\t\t\t\tmodifySysTableNullability(tc,",
"\t\t\t\t\tDataDictionaryImpl.SYSVIEWS_CATALOG_NUM);",
"\t\t\t}",
"\t\t}",
"\t\t"
],
"header": "@@ -282,6 +284,21 @@ public\tclass DD_Version implements\tFormatable",
"removed": []
},
{
"added": [
"\t * ",
"\t * ",
"\t * OLD Cloudscape 5.1 upgrade code",
"\t * Derby upgrade code",
"\t * If this corresponds to SYSSTATEMENTS, then the nullability of",
"\t * the SYSSTATEMENTS.COMPILATION_SCHEMAID column will ",
"\t * be changed to true. If this corresponds to SYSVIEWS, the nullability",
"\t * of the SYSVIEWS.COMPILATION_SCHEMAID column will be changed to true.",
"\t * ",
"\t * @exception StandardException Thrown on error",
"\t\tthrows StandardException",
"\t{\t\t",
"\t\tTabInfoImpl ti = bootingDictionary.getNonCoreTIByNumber(catalogNum);",
"\t\t",
"\t\tif (catalogNum == DataDictionaryImpl.SYSSTATEMENTS_CATALOG_NUM)",
"\t\t{",
"\t\t\t// SYSSTATEMENTS table ==> SYSSTATEMENTS_COMPILATION_SCHEMAID needs ",
"\t\t\t// to be modified.",
"\t\t\tbootingDictionary.upgrade_setNullability(rowFactory,",
"\t\t\t\tSYSSTATEMENTSRowFactory.SYSSTATEMENTS_COMPILATION_SCHEMAID, ",
"\t\t\t\ttrue, tc);",
"\t\t}",
"\t\telse if (catalogNum == DataDictionaryImpl.SYSVIEWS_CATALOG_NUM)",
"\t\t{",
"\t\t\t// SYSVIEWS table ==> SYSVIEWS_COMPILATION_SCHEMAID needs ",
"\t\t\t// to be modified.",
"\t\t\tbootingDictionary.upgrade_setNullability(rowFactory,",
"\t\t\t\tSYSVIEWSRowFactory.SYSVIEWS_COMPILATION_SCHEMAID, ",
"\t\t\t\ttrue, tc);",
"\t\t}",
"\t\t",
"\t\t/* OLD Cloudscape 5.1 upgrade code. See applySafeChanges(). "
],
"header": "@@ -689,27 +706,50 @@ public\tclass DD_Version implements\tFormatable",
"removed": [
"\t * OLD Cloudscape 5.1 upgrade code",
"\t * @exception StandardException",
"",
"\t/* OLD Cloudscape 5.1 upgrade code. See applySafeChanges().",
"",
"\tthrows StandardException",
"\t{",
"",
"\t\tTabInfo ti = bootingDictionary.getNonCoreTIByNumber(catalogNum);"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/catalog/SYSSTATEMENTSRowFactory.java",
"hunks": [
{
"added": [
"\t\t\tcompUuidStr = (spsDescriptor.getCompSchemaId() != null)?",
"\t\t\t\t\tspsDescriptor.getCompSchemaId().toString():null;"
],
"header": "@@ -187,7 +187,8 @@ public class SYSSTATEMENTSRowFactory extends CatalogRowFactory",
"removed": [
"\t\t\tcompUuidStr = spsDescriptor.getCompSchemaId().toString();"
]
},
{
"added": [
"\t\tUUID\t\t\t\t\t\tcompUuid = null;"
],
"header": "@@ -263,7 +264,7 @@ public class SYSSTATEMENTSRowFactory extends CatalogRowFactory",
"removed": [
"\t\tUUID\t\t\t\t\t\tcompUuid;"
]
},
{
"added": [
"\t\tif (uuidStr != null)",
"\t\t\tcompUuid = getUUIDFactory().recreateUUID(uuidStr);"
],
"header": "@@ -328,7 +329,8 @@ public class SYSSTATEMENTSRowFactory extends CatalogRowFactory",
"removed": [
"\t\tcompUuid = getUUIDFactory().recreateUUID(uuidStr);"
]
}
]
}
] |
derby-DERBY-6306-9850fb9a
|
DERBY-6306: XplainStatisticsTest.testSimpleQuery: BEGIN_COMP_TIME unexpectedly NULL
Clear the statement cache between test cases so that statements from
earlier test cases don't affect the results.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1518533 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-6314-489530b1
|
DERBY-6314: Upgrade from 10.10 fails with ClassCastException
Make ExecRowBuilder implement the Formatable interface so that any
Formatable instances referenced from its fields are stored using
Formatable logic instead of Serializable logic.
Add type checking in FormatIdInputStream's error handlers to prevent
the underlying exception from being shadowed by a ClassCastException
under certain circumstances.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1517761 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/iapi/services/io/FormatIdInputStream.java",
"hunks": [
{
"added": [],
"header": "@@ -27,7 +27,6 @@ import java.io.InputStream;",
"removed": [
"import org.apache.derby.shared.common.sanity.SanityManager;"
]
},
{
"added": [
" @exception java.io.IOException An IO or serialization error occurred."
],
"header": "@@ -63,7 +62,7 @@ public final class FormatIdInputStream extends DataInputStream",
"removed": [
"\t @exception java.io.IOException An IO or serialization error occured."
]
},
{
"added": [
" throw handleReadError(ioe, ois);",
" throw handleReadError(cnfe, ois);",
" throw handleReadError(le, ois);",
" throw handleReadError(cce, ois);"
],
"header": "@@ -94,17 +93,13 @@ public final class FormatIdInputStream extends DataInputStream",
"removed": [
"\t\t\t\t\tsetErrorInfo((ErrorInfo) ois);",
"\t\t\t\t\tthrow ioe;",
"\t\t\t\t\tsetErrorInfo((ErrorInfo) ois);",
"\t\t\t\t\tthrow cnfe;",
"\t\t\t\t\tsetErrorInfo((ErrorInfo) ois);",
"\t\t\t\t\tthrow le;",
"\t\t\t\t\tsetErrorInfo((ErrorInfo) ois);",
"\t\t\t\t\tthrow cce;"
]
}
]
},
{
"file": "java/engine/org/apache/derby/iapi/sql/execute/ExecRowBuilder.java",
"hunks": [
{
"added": [
"import java.io.IOException;",
"import java.io.ObjectInput;",
"import java.io.ObjectOutput;",
"import org.apache.derby.iapi.services.io.ArrayUtil;",
"import org.apache.derby.iapi.services.io.Formatable;",
"import org.apache.derby.iapi.services.io.StoredFormatIds;",
" * <p>",
" * </p>",
" *",
" * <p>",
" * This class must be {@code Formatable} so that it can be stored in the",
" * database as part of a stored prepared statement generated for trigger",
" * actions or metadata queries. The stored format does not need to be stable",
" * across different versions, since the stored prepared statements are",
" * discarded on upgrade and will never be read by other Derby versions than",
" * the one that originally wrote them.",
" * </p>",
"public class ExecRowBuilder implements Formatable {",
" private boolean indexable;",
" private Object[] template;",
" private int[] columns;"
],
"header": "@@ -21,37 +21,47 @@",
"removed": [
"import java.io.Serializable;",
"public class ExecRowBuilder implements Serializable {",
"",
" /**",
" * Serial version produced by the serialver utility. Needed in order to",
" * make serialization work reliably across different compilers.",
" */",
" private static final long serialVersionUID = -1078823466492523202L;",
" private final boolean indexable;",
" private final Object[] template;",
" private final int[] columns;"
]
},
{
"added": [
" /**",
" * Public no-arg constructor required by the {@code Formatable} interface.",
" * Should not be called directly.",
" */",
" public ExecRowBuilder() {",
" }",
""
],
"header": "@@ -73,6 +83,13 @@ public class ExecRowBuilder implements Serializable {",
"removed": []
},
{
"added": [
"",
" // Methods required by the Formatable interface.",
"",
" @Override",
" public void writeExternal(ObjectOutput out) throws IOException {",
" out.writeBoolean(indexable);",
" ArrayUtil.writeArray(out, template);",
" out.writeObject(columns);",
" out.writeInt(count);",
" out.writeInt(maxColumnNumber);",
" }",
"",
" @Override",
" public void readExternal(ObjectInput in)",
" throws IOException, ClassNotFoundException {",
" indexable = in.readBoolean();",
" template = ArrayUtil.readObjectArray(in);",
" columns = (int[]) in.readObject();",
" count = in.readInt();",
" maxColumnNumber = in.readInt();",
" }",
"",
" @Override",
" public int getTypeFormatId() {",
" return StoredFormatIds.EXEC_ROW_BUILDER_ID;",
" }"
],
"header": "@@ -131,4 +148,30 @@ public class ExecRowBuilder implements Serializable {",
"removed": []
}
]
}
] |
derby-DERBY-6314-e6ea6446
|
DERBY-6314: Upgrade from 10.10 fails with ClassCastException
Make sure stored plans for metadata queries are cleared the same
way as trigger plans during upgrade, so that upgrade doesn't fail
if the format of the old metadata plans cannot be read by the new
version.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1517533 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/sql/catalog/DD_Version.java",
"hunks": [
{
"added": [
" // Make sure all stored plans are cleared, both for triggers and",
" // for metadata queries. The plans will be recompiled automatically",
" // on the first execution after upgrade. We clear the plans because",
" // the stored format may have changed between the versions, so it",
" // might not be possible to read or execute them in this version.",
" bootingDictionary.clearSPSPlans();",
""
],
"header": "@@ -530,6 +530,13 @@ public\tclass DD_Version implements\tFormatable",
"removed": []
}
]
}
] |
derby-DERBY-6317-b25e3a78
|
DERBY-6317 Optmizer can choose the wrong path when BTreeCostController.java returns an estimate cost and row count of 0.0
The Optimizer estimates do not handle well 0 row counts coming out of store.
These estimates end up getting multiplied by other estimates and the resulting
0 costs caused the incorrect plan to be picked in the repro included with
this fix. This fix changes store cost to always return at least a minimum
of one row when asked to estimate the number of rows in an exact range of
keys from an index. This minimum is consistent with the optimizer assumption
that an exact key match on a unique index will also return 1 row.
Thanks to Brett Bergquist for debugging and suggesting a fix and to mamta
satoor for providing a reproducible test case for the bug.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1521310 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/store/access/btree/BTreeCostController.java",
"hunks": [
{
"added": [
" // DERBY-6317",
" // In the case of unique indexes we always estimate a return of",
" // 1 row for a equality term. To be consistent always insure",
" // that this estimate at least returns at least 1 row, even",
" // though the reality may be that the row does not exist. In the",
" // case of DERBY-6317 a table with 43 million rows, the existing",
" // calculation for the search which in reality was exactly 1 row ",
" // was rounding down to 0 rows. This in turn led calling ",
" // optimizer to pick a full scan plan on the 43 million row which",
" // was discounted by multiplying the 0 row count, rather than ",
" // pick an obviously useful index.",
" if (estimated_row_count < 1)",
" estimated_row_count = 1;",
"",
""
],
"header": "@@ -593,6 +593,21 @@ public class BTreeCostController extends OpenBTree",
"removed": []
}
]
}
] |
derby-DERBY-6318-638cea5e
|
DERBY-6318: Simplify setting of possibly null parameters in XPLAIN descriptors
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1518534 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/sql/catalog/XPLAINResultSetTimingsDescriptor.java",
"hunks": [
{
"added": [],
"header": "@@ -26,7 +26,6 @@ import java.sql.SQLException;",
"removed": [
"import org.apache.derby.impl.sql.catalog.SystemColumnImpl;"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/catalog/XPLAINStatementTimingsDescriptor.java",
"hunks": [
{
"added": [],
"header": "@@ -28,7 +28,6 @@ import java.sql.Types;",
"removed": [
"import org.apache.derby.impl.sql.catalog.SystemColumnImpl;"
]
},
{
"added": [
" ps.setObject(2, parse_time, Types.BIGINT);",
" ps.setObject(3, bind_time, Types.BIGINT);",
" ps.setObject(4, optimize_time, Types.BIGINT);",
" ps.setObject(5, generate_time, Types.BIGINT);",
" ps.setObject(6, compile_time, Types.BIGINT);",
" ps.setObject(7, execute_time, Types.BIGINT);"
],
"header": "@@ -79,30 +78,12 @@ public class XPLAINStatementTimingsDescriptor extends XPLAINTableDescriptor",
"removed": [
" if (parse_time != null)",
" ps.setLong(2, parse_time.longValue());",
" else",
" ps.setNull(2, Types.BIGINT);",
" if (bind_time != null)",
" ps.setLong(3, bind_time.longValue());",
" else",
" ps.setNull(3, Types.BIGINT);",
" if (optimize_time != null)",
" ps.setLong(4, optimize_time.longValue());",
" else",
" ps.setNull(4, Types.BIGINT);",
" if (generate_time != null)",
" ps.setLong(5, generate_time.longValue());",
" else",
" ps.setNull(5, Types.BIGINT);",
" if (compile_time != null)",
" ps.setLong(6, compile_time.longValue());",
" else",
" ps.setNull(6, Types.BIGINT);",
" if (execute_time != null)",
" ps.setLong(7, execute_time.longValue());",
" else",
" ps.setNull(7, Types.BIGINT);"
]
}
]
}
] |
derby-DERBY-6320-e8e1864a
|
DERBY-6320 Log a page dump to derby.log if ERROR nospc: nospc.U is returned to the user
This patch adds the ability to dump a page in an insane build, and adds 2 calls to do so in 2 outstanding nospc error cases. In those two cases a new user
level error is thrown and nests the nospc.U error so that we still know the
original stack trace where the lowest error was thrown.
The patch passes all tests and the specific errors were hand tested, one of
them using the test case filed in DERBY-4923 and in the other case just by hand forcing the codepath.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1535075 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/store/raw/data/StoredPage.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.reference.MessageId;"
],
"header": "@@ -32,6 +32,7 @@ import java.util.Arrays;",
"removed": []
},
{
"added": [
"import org.apache.derby.iapi.services.i18n.MessageService;"
],
"header": "@@ -46,6 +47,7 @@ import org.apache.derby.iapi.services.io.FormatableBitSet;",
"removed": []
},
{
"added": [
" String getPageDumpString()",
" {",
" return(",
" MessageService.getTextMessage(",
" MessageId.STORE_PAGE_DUMP,",
" getIdentity(),",
" isOverflowPage,",
" getPageVersion(),",
" slotsInUse,",
" deletedRowCount,",
" getPageStatus(),",
" nextId,",
" firstFreeByte,",
" freeSpace,",
" totalSpace,",
" spareSpace,",
" minimumRecordSize,",
" getPageSize(),",
" pagedataToHexDump(pageData)));",
" }",
""
],
"header": "@@ -8185,6 +8187,27 @@ public class StoredPage extends CachedPage",
"removed": []
},
{
"added": [
" catch (NoSpaceOnPage nsop)",
" {",
" // DERBY-4923",
" //",
" // The actionUpdate() call should not generate a ",
" // NoSpaceOnPage error. ",
"",
" throw StandardException.newException(",
" SQLState.DATA_UNEXPECTED_NO_SPACE_ON_PAGE,",
" nsop,",
" ((PageKey) curPage.getIdentity()).toString(),",
" getPageDumpString(),",
" slot,",
" id,",
" validColumns.toString(),",
" realStartColumn,",
" 0,",
" headRowHandle);",
" }"
],
"header": "@@ -8773,6 +8796,25 @@ slotScan:",
"removed": []
}
]
},
{
"file": "java/shared/org/apache/derby/shared/common/reference/SQLState.java",
"hunks": [
{
"added": [
" String DATA_UNEXPECTED_NO_SPACE_ON_PAGE = \"XSDAP.S\";"
],
"header": "@@ -490,6 +490,7 @@ public interface SQLState {",
"removed": []
}
]
}
] |
derby-DERBY-6323-f668d94d
|
DERBY-6323: Fix incorrect @throws and @exception tags in javadoc
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1519954 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/client/org/apache/derby/client/am/ClientDatabaseMetaData.java",
"hunks": [
{
"added": [
" * @exception SQLException if a database error occurs"
],
"header": "@@ -1167,7 +1167,7 @@ public abstract class ClientDatabaseMetaData implements DatabaseMetaData {",
"removed": [
" * @exception SqlException if a database error occurs"
]
}
]
},
{
"file": "java/engine/org/apache/derby/catalog/SystemProcedures.java",
"hunks": [
{
"added": [
" * @exception SQLException if a database error occurs"
],
"header": "@@ -679,7 +679,7 @@ public class SystemProcedures {",
"removed": [
"\t * @exception StandardException Standard exception policy."
]
},
{
"added": [
" * @exception SQLException if a database error occurs"
],
"header": "@@ -696,7 +696,7 @@ public class SystemProcedures {",
"removed": [
"\t * @exception StandardException Standard exception policy."
]
},
{
"added": [
" * @exception SQLException if a database error occurs"
],
"header": "@@ -881,7 +881,7 @@ public class SystemProcedures {",
"removed": [
"\t * @exception StandardException Standard exception policy."
]
},
{
"added": [
" * @exception SQLException if a database error occurs"
],
"header": "@@ -909,7 +909,7 @@ public class SystemProcedures {",
"removed": [
"\t * @exception StandardException Standard exception policy."
]
},
{
"added": [
" * @exception SQLException if a database error occurs"
],
"header": "@@ -924,7 +924,7 @@ public class SystemProcedures {",
"removed": [
"\t * @exception StandardException Standard exception policy."
]
},
{
"added": [
" * @exception SQLException if a database error occurs"
],
"header": "@@ -953,7 +953,7 @@ public class SystemProcedures {",
"removed": [
" * @exception StandardException thrown on error"
]
},
{
"added": [
" * @exception SQLException if a database error occurs"
],
"header": "@@ -975,7 +975,7 @@ public class SystemProcedures {",
"removed": [
" * @exception StandardException thrown on error"
]
},
{
"added": [
" * @exception SQLException if a database error occurs"
],
"header": "@@ -1004,7 +1004,7 @@ public class SystemProcedures {",
"removed": [
" * @exception StandardException thrown on error."
]
},
{
"added": [
" * @exception SQLException if a database error occurs"
],
"header": "@@ -1040,7 +1040,7 @@ public class SystemProcedures {",
"removed": [
" * @exception StandardException thrown on error."
]
},
{
"added": [
" * @exception SQLException if a database error occurs"
],
"header": "@@ -1062,9 +1062,8 @@ public class SystemProcedures {",
"removed": [
"\t * @exception StandardException Thrown on error",
""
]
},
{
"added": [
" * @exception SQLException if a database error occurs"
],
"header": "@@ -1431,7 +1430,7 @@ public class SystemProcedures {",
"removed": [
"\t * @exception StandardException Standard exception policy."
]
},
{
"added": [
" * @exception SQLException if a database error occurs"
],
"header": "@@ -1460,7 +1459,7 @@ public class SystemProcedures {",
"removed": [
" * @exception StandardException Standard exception policy."
]
},
{
"added": [
" * @exception SQLException if a database error occurs"
],
"header": "@@ -1492,7 +1491,7 @@ public class SystemProcedures {",
"removed": [
"\t * @exception StandardException Standard exception policy."
]
},
{
"added": [
" * @exception SQLException if a database error occurs"
],
"header": "@@ -1523,7 +1522,7 @@ public class SystemProcedures {",
"removed": [
" * @exception StandardException Standard exception policy."
]
},
{
"added": [
" * @exception SQLException if a database error occurs"
],
"header": "@@ -1555,7 +1554,7 @@ public class SystemProcedures {",
"removed": [
"\t * @exception StandardException Standard exception policy."
]
},
{
"added": [
" * @exception SQLException if a database error occurs"
],
"header": "@@ -1605,7 +1604,7 @@ public class SystemProcedures {",
"removed": [
" * @exception StandardException Standard exception policy."
]
},
{
"added": [
" * @exception SQLException if a database error occurs"
],
"header": "@@ -1645,7 +1644,7 @@ public class SystemProcedures {",
"removed": [
"\t * @exception StandardException Standard exception policy."
]
},
{
"added": [
" * @exception SQLException if a database error occurs"
],
"header": "@@ -1691,7 +1690,7 @@ public class SystemProcedures {",
"removed": [
" * @exception StandardException Standard exception policy."
]
},
{
"added": [
" * @exception SQLException if a database error occurs"
],
"header": "@@ -1728,7 +1727,7 @@ public class SystemProcedures {",
"removed": [
"\t * @exception StandardException Standard exception policy."
]
}
]
},
{
"file": "java/engine/org/apache/derby/iapi/services/io/ArrayInputStream.java",
"hunks": [
{
"added": [
" * @exception IOException if an I/O error happens"
],
"header": "@@ -389,7 +389,7 @@ public final class ArrayInputStream extends InputStream implements LimitObjectIn",
"removed": [
"\t * @exception StandardException Standard exception policy."
]
}
]
},
{
"file": "java/engine/org/apache/derby/iapi/services/locks/LockFactory.java",
"hunks": [
{
"added": [
" @exception StandardException if a deadlock has occurred (message id",
" will be LockFactory.Deadlock), or if the wait for the lock timed",
" out (message id will be LockFactory.TimeOut), or if another thread",
" interrupted this thread while it was waiting for the lock (this will",
" be a StandardException with a nested InterruptedException, and the",
" message id will be LockFactory.InterruptedExceptionId), or if",
" any other error occurs when locking the object"
],
"header": "@@ -75,13 +75,13 @@ public interface LockFactory extends PropertySetCallback {",
"removed": [
"\t\t@exception org.apache.derby.iapi.error.StandardException A deadlock has occured (message id will be LockFactory.Deadlock)",
"\t\t@exception org.apache.derby.iapi.error.StandardException The wait for the lock timed out (message id will be LockFactory.TimeOut).",
"\t\t@exception org.apache.derby.iapi.error.StandardException Another thread interupted this thread while",
"\t\tit was waiting for the lock. This will be a StandardException with a nested java.lang.InterruptedException exception,",
"\t\t(message id will be LockFactory.InterruptedExceptionId)",
"\t\t@exception StandardException Standard Derby error policy.",
""
]
}
]
},
{
"file": "java/engine/org/apache/derby/iapi/sql/conn/LanguageConnectionContext.java",
"hunks": [
{
"added": [],
"header": "@@ -566,8 +566,6 @@ public interface LanguageConnectionContext extends Context {",
"removed": [
"\t *",
"\t * @exception StandardException thrown on failure"
]
},
{
"added": [],
"header": "@@ -579,8 +577,6 @@ public interface LanguageConnectionContext extends Context {",
"removed": [
"\t *",
"\t * @exception StandardException thrown on failure"
]
}
]
},
{
"file": "java/engine/org/apache/derby/iapi/store/access/conglomerate/Conglomerate.java",
"hunks": [
{
"added": [],
"header": "@@ -163,8 +163,6 @@ public interface Conglomerate extends Storable, DataValueDescriptor",
"removed": [
" *",
"\t * @exception StandardException Standard exception policy."
]
}
]
},
{
"file": "java/engine/org/apache/derby/iapi/store/raw/FetchDescriptor.java",
"hunks": [
{
"added": [],
"header": "@@ -114,8 +114,6 @@ public final class FetchDescriptor",
"removed": [
" *",
"\t * @exception StandardException Standard exception policy."
]
}
]
},
{
"file": "java/engine/org/apache/derby/iapi/store/raw/Page.java",
"hunks": [
{
"added": [],
"header": "@@ -133,8 +133,6 @@ public interface Page",
"removed": [
" *",
"\t * @exception StandardException Standard exception policy."
]
},
{
"added": [
" * @exception StandardException if the container was not opened in update",
" * mode, or if the row cannot fit on the page, or if the row is null"
],
"header": "@@ -268,9 +266,8 @@ public interface Page",
"removed": [
" * @exception StandardException\tStandard Derby error policy",
" * @exception StandardException The container was not opened in update mode.",
" * @exception StandardException Row cannot fit on the page or row is null."
]
},
{
"added": [
" * @exception StandardException if the container was not opened in update",
" * mode, or if the row cannot fit on the page"
],
"header": "@@ -485,9 +482,8 @@ public interface Page",
"removed": [
" * @exception StandardException\tStandard Derby error policy",
" * @exception StandardException The container was not opened in update mode.",
" * @exception StandardException The row cannot fit on the page"
]
},
{
"added": [
" does not exist, or if the container was",
" not opened in update mode."
],
"header": "@@ -723,10 +719,8 @@ public interface Page",
"removed": [
" does not exist.",
"",
"\t\t@exception StandardException ",
"\t\tThe container was not opened in update mode."
]
},
{
"added": [
" * @exception StandardException if the container was not opened in update",
" * mode, or if an attempt was made to delete an already deleted record or",
" * undelete a not deleted record, or if the slot is not on the page"
],
"header": "@@ -787,14 +781,9 @@ public interface Page",
"removed": [
" * @exception StandardException\tStandard Derby error policy",
" * @exception StandardException The container was not opened in update mode.",
" * @exception StandardException A statement level exception is thrown when ",
" * trying to delete an already deleted record,",
" * or undelete a not deleted record.",
" *",
" * @exception StandardException A statement level exception is thrown if ",
" * the slot is not on the page."
]
}
]
},
{
"file": "java/engine/org/apache/derby/iapi/store/raw/Transaction.java",
"hunks": [
{
"added": [
" Any exception more severe than a"
],
"header": "@@ -161,8 +161,7 @@ public interface Transaction {",
"removed": [
"",
"\t\t@exception StandardException Any exception more severe than a"
]
},
{
"added": [
" Any exception more severe than a"
],
"header": "@@ -186,8 +185,7 @@ public interface Transaction {",
"removed": [
"",
"\t\t@exception StandardException Any exception more severe than a"
]
},
{
"added": [],
"header": "@@ -215,7 +213,6 @@ public interface Transaction {",
"removed": [
"\t\t@exception StandardException Standard Derby error policy"
]
},
{
"added": [],
"header": "@@ -228,7 +225,6 @@ public interface Transaction {",
"removed": [
"\t\t@exception StandardException Standard Derby error policy"
]
},
{
"added": [],
"header": "@@ -251,7 +247,6 @@ public interface Transaction {",
"removed": [
"\t\t@exception StandardException Standard Derby exception policy"
]
},
{
"added": [],
"header": "@@ -272,7 +267,6 @@ public interface Transaction {",
"removed": [
"\t\t@exception StandardException Standard Derby exception policy"
]
}
]
},
{
"file": "java/engine/org/apache/derby/iapi/types/HarmonySerialBlob.java",
"hunks": [
{
"added": [
" * if an error is encountered during serialization, or"
],
"header": "@@ -57,8 +57,7 @@ public class HarmonySerialBlob implements Blob, Serializable, Cloneable {",
"removed": [
" * if an error is encountered during serialization",
" * @throws SQLException"
]
},
{
"added": [],
"header": "@@ -75,10 +74,6 @@ public class HarmonySerialBlob implements Blob, Serializable, Cloneable {",
"removed": [
" * @throws SQLException",
" * if an error is encountered during serialization",
" * @throws SQLException",
" * if a SQL error is encountered"
]
},
{
"added": [
" * if an error occurs accessing the Blob, or"
],
"header": "@@ -154,8 +149,7 @@ public class HarmonySerialBlob implements Blob, Serializable, Cloneable {",
"removed": [
" * if an error occurs accessing the Blob",
" * @throws SQLException"
]
}
]
},
{
"file": "java/engine/org/apache/derby/iapi/types/SQLDate.java",
"hunks": [
{
"added": [
" * @exception StandardException if the syntax is invalid or the value is",
" * out of range"
],
"header": "@@ -377,7 +377,8 @@ public final class SQLDate extends DataType",
"removed": [
" * @exception Standard exception if the syntax is invalid or the value is out of range."
]
}
]
},
{
"file": "java/engine/org/apache/derby/iapi/types/SQLLongint.java",
"hunks": [
{
"added": [],
"header": "@@ -328,8 +328,6 @@ public final class SQLLongint",
"removed": [
"\t *",
"\t * @exception StandardException\t\tThrown on error"
]
}
]
},
{
"file": "java/engine/org/apache/derby/iapi/types/SQLTime.java",
"hunks": [
{
"added": [
" * @exception StandardException if the syntax is invalid or the value is",
" * out of range"
],
"header": "@@ -384,7 +384,8 @@ public final class SQLTime extends DataType",
"removed": [
" * @exception Standard exception if the syntax is invalid or the value is out of range."
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/load/Export.java",
"hunks": [
{
"added": [
" * @exception SQLException on errors"
],
"header": "@@ -174,7 +174,7 @@ public class Export extends ExportAbstract{",
"removed": [
" \t * @exception SQL Exception on errors"
]
},
{
"added": [
" * @exception SQLException on errors"
],
"header": "@@ -211,7 +211,7 @@ public class Export extends ExportAbstract{",
"removed": [
" * @exception SQL Exception on errors"
]
},
{
"added": [
" * @exception SQLException on errors"
],
"header": "@@ -238,7 +238,7 @@ public class Export extends ExportAbstract{",
"removed": [
" \t * @exception SQL Exception on errors"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/load/Import.java",
"hunks": [
{
"added": [
" * @exception SQLException on error"
],
"header": "@@ -58,7 +58,7 @@ public class Import extends ImportAbstract{",
"removed": [
"\t * @exception Exception on error "
]
},
{
"added": [
" * @exception SQLException on errors"
],
"header": "@@ -112,7 +112,7 @@ public class Import extends ImportAbstract{",
"removed": [
" \t * @exception SQL Exception on errors"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/store/raw/data/AllocExtent.java",
"hunks": [
{
"added": [],
"header": "@@ -602,8 +602,6 @@ public class AllocExtent implements Externalizable",
"removed": [
" *",
"\t * @exception StandardException Standard exception policy."
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/store/raw/data/StoredPage.java",
"hunks": [
{
"added": [],
"header": "@@ -1374,8 +1374,6 @@ public class StoredPage extends CachedPage",
"removed": [
" *",
" * @exception StandardException Standard exception policy."
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/store/raw/xact/Xact.java",
"hunks": [
{
"added": [],
"header": "@@ -1125,12 +1125,9 @@ public class Xact extends RawTransaction implements Limit, LockOwner {",
"removed": [
"\t @exception StandardException Standard Derby exception policy",
"",
"\t\t@exception StandardException\tStandard Derby policy"
]
}
]
},
{
"file": "java/engine/org/apache/derby/io/StorageRandomAccessFile.java",
"hunks": [
{
"added": [
" * @exception java.io.SyncFailedException if a possibly recoverable error occurs."
],
"header": "@@ -99,7 +99,7 @@ public interface StorageRandomAccessFile extends DataInput, DataOutput",
"removed": [
" * @exception SyncFailedException if a possibly recoverable error occurs."
]
}
]
}
] |
derby-DERBY-6324-b6cdb88b
|
DERBY-6324; DatabaseMetaData.getJDBCMinorVersion() should return 2 now that we've implemented JDBC 4.2
Adding logic to JVMInfo to identify the supported JDBC level based on the
(currently supported) JVM versions, which then is used in the client and embedded drivers.
Tests are changed to reflect this.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1519785 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/client/org/apache/derby/client/am/ClientDatabaseMetaData.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.services.info.JVMInfo;"
],
"header": "@@ -29,6 +29,7 @@ import java.sql.SQLException;",
"removed": []
},
{
"added": [
" // this value is only used to check that we have at least 4.0; ",
" // higher is irrelevant"
],
"header": "@@ -124,6 +125,8 @@ public abstract class ClientDatabaseMetaData implements DatabaseMetaData {",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/iapi/services/info/JVMInfo.java",
"hunks": [
{
"added": [
" public static int jdbcMajorVersion()",
" { ",
" return 4; ",
" }",
"",
" public static int jdbcMinorVersion()",
" {",
" switch (JDK_ID)",
" { ",
" case J2SE_16: return 0; ",
" case J2SE_17: return 1; ",
" case J2SE_18: ",
" default: return 2; ",
" }",
" } ",
""
],
"header": "@@ -58,6 +58,22 @@ public abstract class JVMInfo",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/jdbc/EmbedDatabaseMetaData.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.services.info.JVMInfo;"
],
"header": "@@ -21,6 +21,7 @@",
"removed": []
}
]
}
] |
derby-DERBY-6337-47758e26
|
DERBY-6337(derbynet.ServerPropertiesTest.ttestSetPortPriority prints exception java.lang.Exception: DRDA_InvalidReplyTooShort.S:Invalid reply f rom network server: Insufficient data. but test passes)
Basically the issue is that sometimes when server is shutting down and a ping is sent to it around the same time, ping might be able to connect to server but before the ping hand shake can complete, the server might shutdown thus resulting in the ping client receiving a DRDA_InvalidReplyTooShort. This is probably why the test in this issue fails intermittently. To fix the issue, if ping does run into DRDA_InvalidReplyTooShort.S:Invalidreply, we will send another ping after waiting for a little time, and this time around we should get expected can't connect to server exception because server is down by now.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1594435 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java",
"hunks": [
{
"added": [
" //DERBY-6337(derbynet.ServerPropertiesTest.ttestSetPortPriority prints ",
" // exception java.lang.Exception: ",
" // DRDA_InvalidReplyTooShort.S:Invalidreply from network ",
" // server:Insufficent data. but test passes)",
" //Sometimes, when server is coming down and a ping is sent to it, ping",
" // may get DRDA_InvalidReplyTooShort.S:Invalidreply rather than server",
" // is down depending on the timing of the server shutdown. If we do run",
" // into DRDA_InvalidReplyTooShort.S:Invalidreply, we will now send ",
" // another ping after a little wait, and this time around we should ",
" // get expected server down exception.",
" //Following boolean will be set to true if we get reply too short",
" // during the ping and it will try to ping again. But if we get",
" // the reply too short on that ping attempt as well, we will just",
" // print the exception on the console and conclude that server is",
" // down.",
" boolean alreadyGotReplyTooShort=false;"
],
"header": "@@ -623,6 +623,22 @@ final public class NetworkServerTestSetup extends BaseTestSetup {",
"removed": []
},
{
"added": [
" if ( !alreadyGotReplyTooShort && ",
" (e.getMessage().startsWith( \"DRDA_InvalidReplyTooShort.S:\" ) ) ){",
" alreadyGotReplyTooShort = true;",
" Thread.sleep(SLEEP_TIME);",
" continue;",
" }"
],
"header": "@@ -647,8 +663,13 @@ final public class NetworkServerTestSetup extends BaseTestSetup {",
"removed": [
""
]
}
]
}
] |
derby-DERBY-634-f18825aa
|
DERBY-634: Prevent StackOverflow due to bad subquery optimization. Prevent cases of subquery optimization that can cause runtime stack overflow.
Submitted by Satheesh Bandaram (satheesh@gmail.com)
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@431293 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/sql/execute/BaseActivation.java",
"hunks": [
{
"added": [
"\t * Optimization implemented as part of Beetle: 4373 can cause severe stack overflow",
"\t * problems. See JIRA entry DERBY-634. With default MAX_MEMORY_PER_TABLE of 1MG, it is",
"\t * possible that this optimization could attempt to cache upto 250K rows as nested",
"\t * union results. At runtime, this would cause stack overflow.",
"\t *",
"\t * As Jeff mentioned in DERBY-634, right way to optimize original problem would have been",
"\t * to address subquery materialization during optimization phase, through hash joins.",
"\t * Recent Army's optimizer work through DEBRY-781 and related work introduced a way to",
"\t * materialize subquery results correctly and needs to be extended to cover this case.",
"\t * While his optimization needs to be made more generic and stable, I propose to avoid",
"\t * this regression by limiting size of the materialized resultset created here to be",
"\t * less than MAX_MEMORY_PER_TABLE and MAX_DYNAMIC_MATERIALIZED_ROWS.",
"\t *"
],
"header": "@@ -1409,6 +1409,19 @@ public abstract class BaseActivation implements CursorActivation, GeneratedByteC",
"removed": []
}
]
}
] |
derby-DERBY-6342-709b46ee
|
DERBY-6342: failure in ConglomerateSharingTest.testConstraintDrops
Accept different errors from statements that violate multiple
constraints, since it's not deterministic which constraint is checked
first.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1610373 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-6346-3249e773
|
DERBY-6346: Fix LEFT JOIN involving a table with a generated column; tests passed cleanly on derby-6346-02-aa-generateNullForLeftJoins.diff.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1524194 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-6348-1061fd20
|
DERBY-6348: NPE or assert failure in recursive trigger
Reset the activation in the statement context before setting up the
activation for the next trigger, so that the nested trigger activation
is a child of the top-level activation, and not a child of the
previous trigger's activation.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1537393 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-6349-37ad9f35
|
DERBY-6349 DaylightSavingTest - java.security.AccessControlException
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1524579 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/testing/org/apache/derbyTesting/junit/TimeZoneTestSetup.java",
"hunks": [
{
"added": [
"import java.security.AccessController;",
"import java.security.PrivilegedAction;"
],
"header": "@@ -19,6 +19,8 @@",
"removed": []
},
{
"added": [
" setDefault(requestedDefault);",
" setDefault(savedDefault);",
" ",
" private void setDefault(final TimeZone tz) throws SecurityException{",
" if (tz== null) {",
" throw new IllegalArgumentException(\"tz cannot be <null>\");",
" }",
" AccessController.doPrivileged(",
" new PrivilegedAction<Object>() {",
" public Object run() throws SecurityException {",
" TimeZone.setDefault(tz);",
" return null;",
" }});",
" }"
],
"header": "@@ -56,15 +58,27 @@ public class TimeZoneTestSetup extends BaseTestSetup {",
"removed": [
" TimeZone.setDefault(requestedDefault);",
" TimeZone.setDefault(savedDefault);"
]
}
]
}
] |
derby-DERBY-6350-24d620a6
|
DERBY-6350 (Provide a rolling file implementation of derby.log)
Committing patch submitted by Brett Bergquist
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1533320 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/iapi/reference/Property.java",
"hunks": [
{
"added": [
" ",
" /**",
"\t\tderby.stream.error.style=<b>The error stream error style.</b>",
" <b>rollingFile<b> is the only file currently supported.",
"\t\tTakes precendence over derby.stream.error.file.",
"\t\tTakes precendence over derby.stream.error.method.",
"\t\tTakes precendence over derby.stream.error.field",
"\t*/\t",
"\tString ERRORLOG_STYLE_PROPERTY = \"derby.stream.error.style\";",
""
],
"header": "@@ -95,6 +95,16 @@ public interface Property {",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/services/stream/SingleStream.java",
"hunks": [
{
"added": [
"\t\t getSystemProperty(Property.ERRORLOG_STYLE_PROPERTY);",
"\t\tif (target != null) {",
"\t\t\treturn makeStyleHPW(target, header);",
"\t\t}",
"",
"\t\ttarget = PropertyUtil."
],
"header": "@@ -151,6 +151,12 @@ implements InfoStreams, ModuleControl, java.security.PrivilegedAction<HeaderPrin",
"removed": []
},
{
"added": [
"\t\t\treturn makeMethodHPW(target, header, false);"
],
"header": "@@ -158,7 +164,7 @@ implements InfoStreams, ModuleControl, java.security.PrivilegedAction<HeaderPrin",
"removed": [
"\t\t\treturn makeMethodHPW(target, header);"
]
},
{
"added": [
"\t\t\t\t\t\t\t\t\t\t\tPrintWriterGetHeader header,",
" boolean canClose) {"
],
"header": "@@ -208,7 +214,8 @@ implements InfoStreams, ModuleControl, java.security.PrivilegedAction<HeaderPrin",
"removed": [
"\t\t\t\t\t\t\t\t\t\t\tPrintWriterGetHeader header) {"
]
},
{
"added": [
"\t\t\t\t\t\tnew Object[0]), header, methodInvocation, canClose);"
],
"header": "@@ -229,7 +236,7 @@ implements InfoStreams, ModuleControl, java.security.PrivilegedAction<HeaderPrin",
"removed": [
"\t\t\t\t\t\tnew Object[0]), header, methodInvocation);"
]
},
{
"added": [
"\tprivate HeaderPrintWriter makeStyleHPW(String style,",
"\t\t\t\t\t\t\t\t\t\t\tPrintWriterGetHeader header) {",
"\t\tHeaderPrintWriter res = null;",
"\t\tif (\"rollingFile\".equals(style)) {",
"\t\tString className = \"org.apache.derby.impl.services.stream.RollingFileStreamProvider.getOutputStream\";",
"\t\t\tres = makeMethodHPW(className, header, true);",
"\t\t} else { ",
"\t\t\ttry {",
"\t\t\t\tIllegalArgumentException ex = new IllegalArgumentException(\"unknown derby.stream.error.style: \" + style);",
" throw ex;",
"\t\t\t} catch (IllegalArgumentException t) {",
"\t\t\t\tres = useDefaultStream(header, t);",
"\t\t\t} catch (Exception t) {",
"\t\t\t\tres = useDefaultStream(header, t);",
"\t\t\t}",
"\t\t}",
"\t\treturn res;",
"\t}"
],
"header": "@@ -251,6 +258,24 @@ implements InfoStreams, ModuleControl, java.security.PrivilegedAction<HeaderPrin",
"removed": []
},
{
"added": [
"\t\t\t\t\t\theader, fieldAccess, false);"
],
"header": "@@ -275,7 +300,7 @@ implements InfoStreams, ModuleControl, java.security.PrivilegedAction<HeaderPrin",
"removed": [
"\t\t\t\t\t\theader, fieldAccess);"
]
}
]
}
] |
derby-DERBY-6351-29f83260
|
DERBY-6351: Syntax error on equal transition table name and correlation name in statement trigger
Change how CreateTriggerNode.bindReferencesClause() checks for the
lack of a correlation name. Instead of checking it indirectly (and
unreliably) by seeing if the table name matches the base table name,
check directly if the correlation name is null.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1526406 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/sql/compile/CreateTriggerNode.java",
"hunks": [
{
"added": [],
"header": "@@ -602,7 +602,6 @@ class CreateTriggerNode extends DDLStatementNode",
"removed": [
"\t\t\t\tString refTableName = fromTable.getTableName().getTableName();"
]
}
]
}
] |
derby-DERBY-6352-636f0a05
|
DERBY-6352; Access denied ("java.lang.RuntimePermission" "modifyThread") in store.RecoveryAfterBackup test
adding try/catch code to provide more information when this happens
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1531721 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/iapi/services/context/ContextService.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.services.info.JVMInfo;"
],
"header": "@@ -27,6 +27,7 @@ import java.util.HashSet;",
"removed": []
},
{
"added": [
" // DERBY-6352; in some cases a SecurityException is seen",
" // demanding an explicit granting of modifyThread ",
" // permission, which should not be needed for Derby, as we",
" // should not have any system threads.",
" try {",
" AccessController.doPrivileged(",
" new PrivilegedAction<Void>() {",
" public Void run() {",
" fActive.interrupt();",
" return null;",
" }",
" });",
" } catch (java.security.AccessControlException ace) {",
" // if sane, ASSERT and stop. The Assert will ",
" // cause info on all current threads to be printed to",
" // the console, and we're also adding details about ",
" // the thread causing the security exception.",
" // if insane, rethrow, and if an IBM JVM, do a jvmdump",
" if (SanityManager.DEBUG)",
" {",
" SanityManager.THROWASSERT(\"unexpectedly needing \" +",
" \"an extra permission, for thread: \" +",
" fActive.getName() + \" with state: \"+ ",
" fActive.getState());",
" ace.printStackTrace();",
" }",
" else {",
" if (JVMInfo.isIBMJVM()) {",
" JVMInfo.javaDump();",
" }",
" throw ace;",
" }",
" }"
],
"header": "@@ -555,13 +556,39 @@ public final class ContextService //OLD extends Hashtable",
"removed": [
" AccessController.doPrivileged(",
" new PrivilegedAction<Void>() {",
" public Void run() {",
" fActive.interrupt();",
" return null;",
" }",
" });"
]
}
]
}
] |
derby-DERBY-6352-770bedf7
|
DERBY-6352; Access denied ("java.lang.RuntimePermission" "modifyThread") highly intermittent, but e.g. in store.RecoveryAfterBackup test
When we see a AccessControlException during shutdown in the notifyAll call, do nothing, which lets the Thread finish on its own.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1590817 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/iapi/services/context/ContextService.java",
"hunks": [
{
"added": [],
"header": "@@ -27,7 +27,6 @@ import java.util.HashSet;",
"removed": [
"import org.apache.derby.iapi.services.info.JVMInfo;"
]
},
{
"added": [],
"header": "@@ -556,10 +555,6 @@ public final class ContextService //OLD extends Hashtable",
"removed": [
" // DERBY-6352; in some cases a SecurityException is seen",
" // demanding an explicit granting of modifyThread ",
" // permission, which should not be needed for Derby, as we",
" // should not have any system threads."
]
},
{
"added": [
" // DERBY-6352; if we see an exception here, just",
" // swallow it, leaving the thread to finish"
],
"header": "@@ -569,25 +564,8 @@ public final class ContextService //OLD extends Hashtable",
"removed": [
" // if sane, ASSERT and stop. The Assert will ",
" // cause info on all current threads to be printed to",
" // the console, and we're also adding details about ",
" // the thread causing the security exception.",
" // if insane, rethrow, and if an IBM JVM, do a jvmdump",
" if (SanityManager.DEBUG)",
" {",
" SanityManager.THROWASSERT(\"unexpectedly needing \" +",
" \"an extra permission, for thread: \" +",
" fActive.getName() + \" with state: \"+ ",
" fActive.getState());",
" ace.printStackTrace();",
" }",
" else {",
" if (JVMInfo.isIBMJVM()) {",
" JVMInfo.javaDump();",
" }",
" throw ace;",
" }"
]
}
]
}
] |
derby-DERBY-6356-9698d412
|
DERBY-6356; java.security.AccessControlException in i18n.LocalizedDisplayScriptTest
switching the test to use TimeZoneTestSetup which already has the required privilege blocks.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1527143 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-6357-1a58030d
|
DERBY-6357: CREATE TRIGGER doesn't detect all illegal references to SESSION schema
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1527963 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-6361-99aa2411
|
DERBY-6361: Valid statements rejected if Derby has not implicitly
created the current user's schema.
Make compilation of the generation clause accept that the original
compilation schema does not exist.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1532997 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-6362-69f8afa5
|
DERBY-6362: CHECK constraint uses wrong schema for unqualified routine invocations
Part 1: Make sure visitors descend into all TableName nodes.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1548127 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/sql/compile/AggregateNode.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.sql.compile.Visitor;"
],
"header": "@@ -31,6 +31,7 @@ import org.apache.derby.iapi.services.loader.ClassFactory;",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/AllResultColumn.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.sql.compile.Visitor;"
],
"header": "@@ -23,6 +23,7 @@ package\torg.apache.derby.impl.sql.compile;",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/BaseColumnNode.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.sql.compile.Visitor;"
],
"header": "@@ -25,6 +25,7 @@ import org.apache.derby.iapi.error.StandardException;",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/ColumnReference.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.sql.compile.Visitor;"
],
"header": "@@ -26,6 +26,7 @@ import org.apache.derby.iapi.error.StandardException;",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/ConstraintDefinitionNode.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.sql.compile.Visitor;"
],
"header": "@@ -29,6 +29,7 @@ import org.apache.derby.iapi.services.context.ContextManager;",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/CreateIndexNode.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.sql.compile.Visitor;"
],
"header": "@@ -30,6 +30,7 @@ import org.apache.derby.iapi.reference.Property;",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/CreateSequenceNode.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.sql.compile.Visitor;"
],
"header": "@@ -28,6 +28,7 @@ import org.apache.derby.iapi.sql.dictionary.SchemaDescriptor;",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/CreateTriggerNode.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.sql.compile.Visitor;"
],
"header": "@@ -34,6 +34,7 @@ import org.apache.derby.iapi.services.context.ContextManager;",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/CurrentOfNode.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.sql.compile.Visitor;"
],
"header": "@@ -34,8 +34,8 @@ import org.apache.derby.iapi.sql.compile.CostEstimate;",
"removed": [
"import org.apache.derby.iapi.sql.compile.RequiredRowOrdering;"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/DDLStatementNode.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.sql.compile.Visitor;"
],
"header": "@@ -30,6 +30,7 @@ import org.apache.derby.iapi.services.compiler.MethodBuilder;",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/DMLModStatementNode.java",
"hunks": [
{
"added": [],
"header": "@@ -22,7 +22,6 @@",
"removed": [
"import java.util.Iterator;"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/DropSequenceNode.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.sql.compile.Visitor;"
],
"header": "@@ -25,6 +25,7 @@ import org.apache.derby.iapi.sql.execute.ConstantAction;",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/ExecSPSNode.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.sql.compile.Visitor;"
],
"header": "@@ -27,6 +27,7 @@ import org.apache.derby.iapi.services.context.ContextManager;",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/FKConstraintDefinitionNode.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.sql.compile.Visitor;"
],
"header": "@@ -26,6 +26,7 @@ import org.apache.derby.iapi.reference.SQLState;",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/FromTable.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.sql.compile.Visitor;"
],
"header": "@@ -39,6 +39,7 @@ import org.apache.derby.iapi.sql.compile.OptimizablePredicate;",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/LockTableNode.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.sql.compile.Visitor;"
],
"header": "@@ -26,6 +26,7 @@ import org.apache.derby.iapi.reference.SQLState;",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/NextSequenceNode.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.sql.compile.Visitor;"
],
"header": "@@ -30,6 +30,7 @@ import org.apache.derby.iapi.services.compiler.MethodBuilder;",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/PrivilegeNode.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.sql.compile.Visitor;"
],
"header": "@@ -29,6 +29,7 @@ import org.apache.derby.catalog.types.RoutineAliasInfo;",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/RenameNode.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.sql.compile.Visitor;"
],
"header": "@@ -27,6 +27,7 @@ import org.apache.derby.iapi.services.context.ContextManager;",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/SetConstraintsNode.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.sql.compile.Visitor;"
],
"header": "@@ -25,6 +25,7 @@ import java.util.List;",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/StaticMethodCallNode.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.sql.compile.Visitor;"
],
"header": "@@ -37,6 +37,7 @@ import org.apache.derby.iapi.services.compiler.MethodBuilder;",
"removed": []
},
{
"added": [
"",
" @Override",
" void acceptChildren(Visitor v) throws StandardException {",
" super.acceptChildren(v);",
"",
" if (procedureName != null) {",
" procedureName = (TableName) procedureName.accept(v);",
" }",
" }"
],
"header": "@@ -1441,4 +1442,13 @@ class StaticMethodCallNode extends MethodCallNode",
"removed": []
}
]
}
] |
derby-DERBY-6362-9d9f6dd0
|
DERBY-6362: CHECK constraint uses wrong schema for unqualified routine invocations
Part 3:
- Refactor code that rewrites trigger actions so that it can be reused
for rewriting CHECK constraints.
- Rewrite CHECK constraints and make all identifiers schema qualified
before storing them in the dictionary.
- Make the parser preserve the TableName node for the target type in
CAST expressions for user-defined types, so that they get detected
by the rewrite logic.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1548132 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java",
"hunks": [
{
"added": [],
"header": "@@ -32,7 +32,6 @@ import java.sql.Types;",
"removed": [
"import java.util.Comparator;"
]
},
{
"added": [
"import java.util.SortedSet;"
],
"header": "@@ -44,6 +43,7 @@ import java.util.LinkedList;",
"removed": []
},
{
"added": [
"import org.apache.derby.impl.sql.compile.OffsetOrderVisitor;"
],
"header": "@@ -152,8 +152,8 @@ import org.apache.derby.iapi.types.UserType;",
"removed": [
"import org.apache.derby.impl.sql.compile.CollectNodesVisitor;"
]
},
{
"added": [],
"header": "@@ -4746,19 +4746,6 @@ public final class\tDataDictionaryImpl",
"removed": [
" /**",
" * Comparator that can be used for sorting lists of column references",
" * on the position they have in the SQL query string.",
" */",
" private static final Comparator<ColumnReference> OFFSET_COMPARATOR = new Comparator<ColumnReference>() {",
" public int compare(ColumnReference o1, ColumnReference o2) {",
" // Return negative int, zero, or positive int if the first column",
" // reference has an offset which is smaller than, equal to, or",
" // greater than the offset of the second column reference.",
" return o1.getBeginOffset() - o2.getBeginOffset();",
" }",
" };",
""
]
},
{
"added": [
" OffsetOrderVisitor<ColumnReference> visitor =",
" new OffsetOrderVisitor<ColumnReference>(ColumnReference.class,",
" actionOffset,",
" actionOffset + triggerDefinition.length());",
" actionStmt.accept(visitor);",
" SortedSet<ColumnReference> refs = visitor.getNodes();"
],
"header": "@@ -4888,12 +4875,14 @@ public final class\tDataDictionaryImpl",
"removed": [
"\t\tCollectNodesVisitor<ColumnReference> visitor = new CollectNodesVisitor<ColumnReference>(ColumnReference.class);",
"\t\tactionStmt.accept(visitor);",
"\t\tList<ColumnReference> refs = visitor.getList();",
"\t\tCollections.sort(refs, OFFSET_COMPARATOR);"
]
},
{
"added": [
" for (ColumnReference ref : refs)"
],
"header": "@@ -4951,33 +4940,8 @@ public final class\tDataDictionaryImpl",
"removed": [
"\t\t\tfor (int i = 0; i < refs.size(); i++)",
"\t\t\t\tColumnReference ref = (ColumnReference) refs.get(i);",
"\t\t\t\t/*",
"\t\t\t\t** Only occurrences of those OLD/NEW transition tables/variables ",
"\t\t\t\t** are of interest here. There may be intermediate nodes in the ",
"\t\t\t\t** parse tree that have its own RCL which contains copy of ",
"\t\t\t\t** column references(CR) from other nodes. e.g.: ",
"\t\t\t\t**",
"\t\t\t\t** CREATE TRIGGER tt ",
"\t\t\t\t** AFTER INSERT ON x",
"\t\t\t\t** REFERENCING NEW AS n ",
"\t\t\t\t** FOR EACH ROW",
"\t\t\t\t** INSERT INTO y VALUES (n.i), (999), (333);",
"\t\t\t\t** ",
"\t\t\t\t** The above trigger action will result in InsertNode that ",
"\t\t\t\t** contains a UnionNode of RowResultSetNodes. The UnionNode",
"\t\t\t\t** will have a copy of the CRs from its left child and those CRs ",
"\t\t\t\t** will not have its beginOffset set which indicates they are ",
"\t\t\t\t** not relevant for the conversion processing here, so we can ",
"\t\t\t\t** safely skip them. ",
"\t\t\t\t*/",
"\t\t\t\tif (ref.getBeginOffset() == -1) ",
"\t\t\t\t{",
"\t\t\t\t\tcontinue;",
"\t\t\t\t}",
""
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/CastNode.java",
"hunks": [
{
"added": [
" /**",
" * The name of the target type if it's a UDT. It is partly redundant, as",
" * the name can also be retrieved from the type descriptor. Additionally,",
" * it contains information about the location of the UDT name in the",
" * query text, which is useful if the query text needs to be rewritten.",
" * (Useful for example when rewriting a CHECK constraint definition to",
" * have fully qualified names before storing it in the dictionary.) This",
" * field is only set for <b>explicit</b> casts to a UDT.",
" */",
" private TableName udtTargetName;",
""
],
"header": "@@ -87,6 +87,17 @@ class CastNode extends ValueNode",
"removed": []
},
{
"added": [
" // Set the schema name of the UDT target type.",
" if (udtTargetName != null) {",
" udtTargetName.setSchemaName(",
" getTypeId().getBaseTypeId().getSchemaName());",
" }",
""
],
"header": "@@ -403,6 +414,12 @@ class CastNode extends ValueNode",
"removed": []
},
{
"added": [
"",
" if (udtTargetName != null)",
" {",
" udtTargetName = (TableName) udtTargetName.accept(v);",
" }"
],
"header": "@@ -1005,6 +1022,11 @@ class CastNode extends ValueNode",
"removed": []
}
]
}
] |
derby-DERBY-6363-2335e5c5
|
DERBY-6363: Incorrect evaluation of logical expressions in CASE
Skip conversion of OR nodes to IN lists if the OR node is not on
conjunctive normal form.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1529099 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/sql/compile/OrNode.java",
"hunks": [
{
"added": [
" *",
" * We only convert the OR chain to an IN list if it has been",
" * normalized to conjunctive normal form (CNF) first. That is, the",
" * shape of the chain must be something like this:",
" *",
" * OR",
" * / \\",
" * = OR",
" * / \\",
" * = OR",
" * / \\",
" * = FALSE",
" *",
" * Predicates in WHERE, HAVING and ON clauses will have been",
" * normalized by the time we get here. Boolean expressions other",
" * places in the query are not necessarily normalized, but they",
" * won't benefit from IN list conversion anyway, since they cannot",
" * be used as qualifiers in a multi-probe scan, so simply skip the",
" * conversion in those cases."
],
"header": "@@ -114,6 +114,25 @@ class OrNode extends BinaryLogicalOperatorNode",
"removed": []
},
{
"added": [
" ValueNode vn;",
" for (vn = this;",
" vn instanceof OrNode;",
" vn = ((OrNode) vn).getRightOperand())"
],
"header": "@@ -121,8 +140,11 @@ class OrNode extends BinaryLogicalOperatorNode",
"removed": [
"\t\t\tfor (ValueNode vn = this; vn instanceof OrNode; vn = ((OrNode) vn).getRightOperand())"
]
},
{
"added": [
" // DERBY-6363: An OR chain on conjunctive normal form should be",
" // terminated by a false BooleanConstantNode. If it is terminated",
" // by some other kind of node, it is not on CNF, and it should",
" // not be converted to an IN list.",
" convert = convert && vn.isBooleanFalse();",
"",
" for (vn = this;",
" vn instanceof OrNode;",
" vn = ((OrNode) vn).getRightOperand())"
],
"header": "@@ -209,12 +231,20 @@ class OrNode extends BinaryLogicalOperatorNode",
"removed": [
"\t\t\t\tfor (ValueNode vn = this; vn instanceof OrNode; vn = ((OrNode) vn).getRightOperand())"
]
}
]
}
] |
derby-DERBY-6370-0342a825
|
DERBY-6370: dblook doesn't schema-qualify identifiers in trigger actions
Remove no longer needed offset fields in CreateTriggerNode.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1592695 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/sql/compile/CreateTriggerNode.java",
"hunks": [
{
"added": [],
"header": "@@ -71,8 +71,6 @@ class CreateTriggerNode extends DDLStatementNode",
"removed": [
" private final int whenOffset;",
" private final int actionOffset;"
]
},
{
"added": [],
"header": "@@ -262,10 +260,8 @@ class CreateTriggerNode extends DDLStatementNode",
"removed": [
" * @param whenOffset offset of start of WHEN clause",
"\t * @param actionOffset\t\t\toffset of start of action clause"
]
},
{
"added": [],
"header": "@@ -282,10 +278,8 @@ class CreateTriggerNode extends DDLStatementNode",
"removed": [
" int whenOffset,",
" int actionOffset,"
]
},
{
"added": [],
"header": "@@ -302,11 +296,9 @@ class CreateTriggerNode extends DDLStatementNode",
"removed": [
" this.whenOffset = whenOffset;",
" this.actionOffset = actionOffset;"
]
},
{
"added": [
" actionNode.getBeginOffset(),"
],
"header": "@@ -643,7 +635,7 @@ class CreateTriggerNode extends DDLStatementNode",
"removed": [
"\t\t\t\t\tactionOffset,"
]
},
{
"added": [
" referencedColsInTriggerAction,",
" whenClause.getBeginOffset(),"
],
"header": "@@ -655,7 +647,8 @@ class CreateTriggerNode extends DDLStatementNode",
"removed": [
" referencedColsInTriggerAction, whenOffset,"
]
},
{
"added": [
" actionNode, originalActionText, actionTransformations);",
" whenClause, originalWhenText,"
],
"header": "@@ -672,11 +665,10 @@ class CreateTriggerNode extends DDLStatementNode",
"removed": [
" actionNode, originalActionText, actionOffset,",
" actionTransformations);",
" whenClause, originalWhenText, whenOffset,"
]
},
{
"added": [],
"header": "@@ -884,8 +876,6 @@ class CreateTriggerNode extends DDLStatementNode",
"removed": [
" * @param offset the offset of the WHEN clause or the triggered SQL",
" * statement within the CREATE TRIGGER statement"
]
}
]
}
] |
derby-DERBY-6370-0cefeda9
|
DERBY-6370: dblook doesn't schema-qualify identifiers in trigger actions
Rewrite the triggered SQL statement and the WHEN clause of a trigger
so that all identifiers are fully qualified, before they are stored in
SYS.SYSTRIGGERS and SYS.SYSSTATEMENTS. This way, dblook is able to use
the information in the system tables to produce DDL that is
independent of the schema in which it is executed.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1591216 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/iapi/sql/dictionary/DataDictionary.java",
"hunks": [
{
"added": [
" *",
" * @param replacements a list that will be populated with objects that",
" * describe how {@code triggerDefinition} has been transformed into",
" * the returned SQL text. Each element in the list will contain four",
" * integers. The first two describe the begin and end offset of the",
" * replaced text in the {@code triggerDefinition}. The last two describe",
" * the begin and end offset of the replacement text in the returned",
" * string. The begin offsets are inclusive, whereas the end offsets are",
" * exclusive. The list can be {@code null} if the caller does not care",
" * about this information."
],
"header": "@@ -1309,6 +1309,16 @@ public interface DataDictionary",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java",
"hunks": [
{
"added": [
"import org.apache.derby.impl.sql.compile.QueryTreeNode;"
],
"header": "@@ -153,7 +153,7 @@ import org.apache.derby.iapi.util.IdUtil;",
"removed": [
"import org.apache.derby.impl.sql.compile.OffsetOrderVisitor;"
]
},
{
"added": [
" boolean createTriggerTime,",
" List<int[]> replacements"
],
"header": "@@ -4742,7 +4742,8 @@ public final class\tDataDictionaryImpl",
"removed": [
"\t\t\tboolean createTriggerTime"
]
},
{
"added": [
"",
" StringBuilder newText = new StringBuilder();"
],
"header": "@@ -4751,8 +4752,8 @@ public final class\tDataDictionaryImpl",
"removed": [
"\t\t",
"\t\tStringBuffer newText = new StringBuffer();"
]
},
{
"added": [
" SortedSet<ColumnReference> refs = getTransitionVariables(",
" actionStmt, oldReferencingName, newReferencingName);",
""
],
"header": "@@ -4814,13 +4815,9 @@ public final class\tDataDictionaryImpl",
"removed": [
" OffsetOrderVisitor<ColumnReference> visitor =",
" new OffsetOrderVisitor<ColumnReference>(ColumnReference.class,",
" actionOffset,",
" actionOffset + triggerDefinition.length());",
" actionStmt.accept(visitor);",
" SortedSet<ColumnReference> refs = visitor.getNodes();",
"\t\t"
]
},
{
"added": [],
"header": "@@ -4880,16 +4877,6 @@ public final class\tDataDictionaryImpl",
"removed": [
" if (!isTransitionVariable(",
" tableName, oldReferencingName, newReferencingName))",
"\t\t\t\t{",
"\t\t\t\t\tcontinue;",
"\t\t\t\t}",
"",
"\t\t\t\tif (tableName.getBeginOffset() == -1)",
"\t\t\t\t{",
"\t\t\t\t\tcontinue;",
"\t\t\t\t}"
]
},
{
"added": [
" int tableBeginOffset = tableName.getBeginOffset() - actionOffset;",
" // Add whatever we've seen after the previous replacement.",
" newText.append(triggerDefinition, start, tableBeginOffset);",
""
],
"header": "@@ -4970,21 +4957,13 @@ public final class\tDataDictionaryImpl",
"removed": [
" if (!isTransitionVariable(",
" tableName, oldReferencingName, newReferencingName))",
"\t\t\t{",
"\t\t\t\tcontinue;",
"\t\t\t}",
"\t\t\t\t",
"\t\t\tint tokBeginOffset = tableName.getBeginOffset();",
"\t\t\tif (tokBeginOffset == -1)",
"\t\t\t{",
"\t\t\t\tcontinue;",
"\t\t\t}",
"\t\t\tnewText.append(triggerDefinition.substring(start, tokBeginOffset-actionOffset));"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/AggregateNode.java",
"hunks": [
{
"added": [
" * @param alias the name by which the aggregate was called"
],
"header": "@@ -70,6 +70,7 @@ class AggregateNode extends UnaryOperatorNode",
"removed": []
},
{
"added": [
" TableName alias,",
" this(operand, alias, distinct, aggregateName, cm);"
],
"header": "@@ -80,13 +81,12 @@ class AggregateNode extends UnaryOperatorNode",
"removed": [
" super(operand, cm);",
" this.aggregateName = aggregateName;",
" this.distinct = distinct;"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/CreateTriggerNode.java",
"hunks": [
{
"added": [
"import java.util.SortedSet;",
"import java.util.TreeSet;"
],
"header": "@@ -22,10 +22,11 @@",
"removed": [
"import java.util.Collections;"
]
},
{
"added": [
" private String originalWhenText;",
" private String originalActionText;"
],
"header": "@@ -68,8 +69,8 @@ class CreateTriggerNode extends DDLStatementNode",
"removed": [
" private final String originalWhenText;",
" private final String originalActionText;"
]
},
{
"added": [
" /**",
" * <p>",
" * A list that describes how the original SQL text of the trigger action",
" * statement was modified when transition tables and transition variables",
" * were replaced by VTI calls. Each element in the list contains four",
" * integers describing positions where modifications have happened. The",
" * first two integers are begin and end positions of a transition table",
" * or transition variable in {@link #originalActionText the original SQL",
" * text}. The last two integers are begin and end positions of the",
" * corresponding replacement in {@link #actionText the transformed SQL",
" * text}.",
" * </p>",
" *",
" * <p>",
" * Begin positions are inclusive and end positions are exclusive.",
" * </p>",
" */",
" private final ArrayList<int[]>",
" actionTransformations = new ArrayList<int[]>();",
"",
" /**",
" * Structure that has the same shape as {@code actionTransformations},",
" * except that it describes the transformations in the WHEN clause.",
" */",
" private final ArrayList<int[]>",
" whenClauseTransformations = new ArrayList<int[]>();"
],
"header": "@@ -220,6 +221,32 @@ class CreateTriggerNode extends DDLStatementNode",
"removed": []
},
{
"added": [
" // Get all the names of SQL objects referenced by the triggered",
" // SQL statement and the WHEN clause. Since some of the TableName",
" // nodes may be eliminated from the node tree during the bind phase,",
" // we collect the nodes before the nodes have been bound. The",
" // names will be used later when we normalize the trigger text",
" // that will be stored in the system tables.",
" SortedSet<TableName> actionNames =",
" actionNode.getOffsetOrderedNodes(TableName.class);",
" SortedSet<TableName> whenNames = (whenClause != null)",
" ? whenClause.getOffsetOrderedNodes(TableName.class)",
" : null;",
""
],
"header": "@@ -374,6 +401,18 @@ class CreateTriggerNode extends DDLStatementNode",
"removed": []
},
{
"added": [
" // Qualify identifiers before storing them (DERBY-5901/DERBY-6370).",
" qualifyNames(actionNames, whenNames);",
""
],
"header": "@@ -419,6 +458,9 @@ class CreateTriggerNode extends DDLStatementNode",
"removed": []
},
{
"added": [
" true,",
" actionTransformations);"
],
"header": "@@ -604,8 +646,8 @@ class CreateTriggerNode extends DDLStatementNode",
"removed": [
"\t\t\t\t\ttrue",
"\t\t\t\t\t);\t\t\t"
]
},
{
"added": [
" triggerTableDescriptor, triggerEventMask, true,",
" whenClauseTransformations);"
],
"header": "@@ -614,7 +656,8 @@ class CreateTriggerNode extends DDLStatementNode",
"removed": [
" triggerTableDescriptor, triggerEventMask, true);"
]
},
{
"added": [
" actionNode, originalActionText, actionOffset,",
" actionTransformations);",
" whenClause, originalWhenText, whenOffset,",
" whenClauseTransformations);"
],
"header": "@@ -629,10 +672,12 @@ class CreateTriggerNode extends DDLStatementNode",
"removed": [
" actionNode, originalActionText, actionOffset);",
" whenClause, originalWhenText, whenOffset);"
]
},
{
"added": [
" /**",
" * Make sure all references to SQL schema objects (such as tables and",
" * functions) in the SQL fragments that will be stored in the SPS and",
" * in the trigger descriptor, are fully qualified with a schema name.",
" *",
" * @param actionNames all the TableName nodes found in the triggered",
" * SQL statement",
" * @param whenNames all the Table Name nodes found in the WHEN clause",
" */",
" private void qualifyNames(SortedSet<TableName> actionNames,",
" SortedSet<TableName> whenNames)",
" throws StandardException {",
"",
" StringBuilder original = new StringBuilder();",
" StringBuilder transformed = new StringBuilder();",
"",
" // Qualify the names in the action text.",
" qualifyNames(actionNode, actionNames, originalActionText, actionText,",
" actionTransformations, original, transformed);",
" originalActionText = original.toString();",
" actionText = transformed.toString();",
"",
" // Do the same for the WHEN clause, if there is one.",
" if (whenClause != null) {",
" original.setLength(0);",
" transformed.setLength(0);",
" qualifyNames(whenClause, whenNames, originalWhenText, whenText,",
" whenClauseTransformations, original, transformed);",
" originalWhenText = original.toString();",
" whenText = transformed.toString();",
" }",
" }",
"",
" /**",
" * Qualify all names SQL object names in original and transformed SQL",
" * text for an action or a WHEN clause.",
" *",
" * @param node the query tree node for the transformed version of the",
" * SQL text, in a bound state",
" * @param tableNames all the TableName nodes in the transformed text,",
" * in the order in which they appear in the SQL text",
" * @param originalText the original SQL text",
" * @param transformedText the transformed SQL text (with VTI calls for",
" * transition tables or transition variables)",
" * @param replacements a data structure that describes how {@code",
" * originalText} was transformed into {@code transformedText}",
" * @param newOriginal where to store the normalized version of the",
" * original text",
" * @param newTransformed where to store the normalized version of the",
" * transformed text",
" */",
" private void qualifyNames(",
" QueryTreeNode node,",
" SortedSet<TableName> tableNames,",
" String originalText,",
" String transformedText,",
" List<int[]> replacements,",
" StringBuilder newOriginal,",
" StringBuilder newTransformed) throws StandardException {",
"",
" int originalPos = 0;",
" int transformedPos = 0;",
"",
" for (TableName name : tableNames) {",
"",
" String qualifiedName = name.getFullSQLName();",
"",
" int beginOffset = name.getBeginOffset() - node.getBeginOffset();",
" int tokenLength = name.getEndOffset() + 1 - name.getBeginOffset();",
"",
" // For the transformed text, use the positions from the node.",
" newTransformed.append(transformedText, transformedPos, beginOffset);",
" newTransformed.append(qualifiedName);",
" transformedPos = beginOffset + tokenLength;",
"",
" // For the original text, we need to adjust the positions to",
" // compensate for the changes in the transformed text.",
" Integer origBeginOffset =",
" getOriginalPosition(replacements, beginOffset);",
" if (origBeginOffset != null) {",
" newOriginal.append(originalText, originalPos, origBeginOffset);",
" newOriginal.append(qualifiedName);",
" originalPos = origBeginOffset + tokenLength;",
" }",
" }",
"",
" newTransformed.append(",
" transformedText, transformedPos, transformedText.length());",
" newOriginal.append(originalText, originalPos, originalText.length());",
" }",
"",
" /**",
" * Translate a position from the transformed trigger text",
" * ({@link #actionText} or {@link #whenText}) to the corresponding",
" * position in the original trigger text ({@link #originalActionText}",
" * or {@link #originalWhenText}).",
" *",
" * @param replacements a data structure that describes the relationship",
" * between positions in the original and the transformed text",
" * @param transformedPosition the position to translate",
" * @return the position in the original text, or {@code null} if there",
" * is no corresponding position in the original text (for example if",
" * it points to a token that was added to the transformed text and",
" * does not exist in the original text)",
" */",
" private static Integer getOriginalPosition(",
" List<int[]> replacements, int transformedPosition) {",
"",
" // Find the last change before the position we want to translate.",
" for (int i = replacements.size() - 1; i >= 0; i--) {",
" int[] offsets = replacements.get(i);",
"",
" // offset[0] is the begin offset of the replaced text",
" // offset[1] is the end offset of the replaced text",
" // offset[2] is the begin offset of the replacement text",
" // offset[3] is the end offset of the replacement text",
"",
" // Skip those changes that come after the position we",
" // want to translate.",
" if (transformedPosition >= offsets[2]) {",
" if (transformedPosition < offsets[3]) {",
" // The position points inside a changed portion of the",
" // SQL text, so there's no corresponding position in the",
" // original text. Return null.",
" return null;",
" } else {",
" // The position points after the end of the changed text,",
" // which means it's in a portion that's common to the",
" // original and the transformed text. Translate between",
" // the two.",
" return offsets[1] + (transformedPosition - offsets[3]);",
" }",
" }",
" }",
"",
" // The position is before any of the transformations, so the position",
" // is the same in the original and the transformed text.",
" return transformedPosition;",
" }",
""
],
"header": "@@ -661,6 +706,146 @@ class CreateTriggerNode extends DDLStatementNode",
"removed": []
},
{
"added": [
" * @param replacements list that will be populated with int arrays that",
" * describe how the original text was transformed. The int arrays",
" * contain the begin (inclusive) and end (exclusive) positions of the",
" * original text that got replaced and of the replacement text, so that",
" * positions in the transformed text can be mapped to positions in the",
" * original text.",
" Visitable node, String originalText, int offset,",
" List<int[]> replacements)"
],
"header": "@@ -701,13 +886,20 @@ class CreateTriggerNode extends DDLStatementNode",
"removed": [
" Visitable node, String originalText, int offset)"
]
},
{
"added": [
" for (FromBaseTable fromTable : getTransitionTables(node)) {",
" int nextTokenStart = tokEndOffset - offset + 1;",
" // The text up to the transition table name should be kept.",
"",
" // Replace the transition table name with a VTI.",
" final int replacementOffset = newText.length();"
],
"header": "@@ -716,31 +908,20 @@ class CreateTriggerNode extends DDLStatementNode",
"removed": [
" CollectNodesVisitor<FromBaseTable> visitor =",
" new CollectNodesVisitor<FromBaseTable>(FromBaseTable.class);",
" node.accept(visitor);",
" List<FromBaseTable> tabs = visitor.getList();",
" Collections.sort(tabs, OFFSET_COMPARATOR);",
" for (FromBaseTable fromTable : tabs) {",
" if (!isTransitionTable(fromTable)) {",
" // baseTableName is not the NEW or OLD table, so no need",
" // to do anything. Skip this table.",
" continue;",
" }",
"",
" if (tokBeginOffset == -1) {",
" // Unknown offset. Skip this table.",
" continue;",
" }",
" // Replace the transition table name with a VTI."
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/OffsetOrderVisitor.java",
"hunks": [
{
"added": [
"class OffsetOrderVisitor<T extends QueryTreeNode> implements Visitor {"
],
"header": "@@ -37,7 +37,7 @@ import org.apache.derby.shared.common.sanity.SanityManager;",
"removed": [
"public class OffsetOrderVisitor<T extends QueryTreeNode> implements Visitor {"
]
},
{
"added": [
" OffsetOrderVisitor(Class<T> nodeClass, int low, int high) {"
],
"header": "@@ -61,7 +61,7 @@ public class OffsetOrderVisitor<T extends QueryTreeNode> implements Visitor {",
"removed": [
" public OffsetOrderVisitor(Class<T> nodeClass, int low, int high) {"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/QueryTreeNode.java",
"hunks": [
{
"added": [
"import java.util.SortedSet;"
],
"header": "@@ -25,6 +25,7 @@ import java.sql.Types;",
"removed": []
}
]
}
] |
derby-DERBY-6370-eab88ec5
|
DERBY-6370: dblook doesn't schema-qualify identifiers in trigger actions
Remove unnecessary DataDictionary parameter from TableName.bind().
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1592726 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/sql/compile/CurrentOfNode.java",
"hunks": [
{
"added": [
" if (columnsTableName != null",
" && columnsTableName.getSchemaName() == null",
" && correlationName == null) {",
" columnsTableName.bind();",
" }"
],
"header": "@@ -295,9 +295,11 @@ public final class CurrentOfNode extends FromTable {",
"removed": [
" if(columnsTableName != null)",
" if(columnsTableName.getSchemaName() == null && correlationName == null)",
" columnsTableName.bind(this.getDataDictionary());"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/FromBaseTable.java",
"hunks": [
{
"added": [
" tableName.bind();"
],
"header": "@@ -2335,7 +2335,7 @@ class FromBaseTable extends FromTable",
"removed": [
" tableName.bind(dataDictionary);"
]
},
{
"added": [
" columnsTableName.bind();"
],
"header": "@@ -2793,7 +2793,7 @@ class FromBaseTable extends FromTable",
"removed": [
" columnsTableName.bind(this.getDataDictionary());"
]
},
{
"added": [
" if (exposedTableName.getSchemaName() == null",
" && correlationName == null) {",
" exposedTableName.bind();",
" }",
""
],
"header": "@@ -2802,8 +2802,11 @@ class FromBaseTable extends FromTable",
"removed": [
" if(exposedTableName.getSchemaName() == null && correlationName == null)",
" exposedTableName.bind(this.getDataDictionary());"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/MergeNode.java",
"hunks": [
{
"added": [],
"header": "@@ -38,7 +38,6 @@ import org.apache.derby.iapi.sql.compile.IgnoreFilter;",
"removed": [
"import org.apache.derby.iapi.sql.dictionary.ColumnDescriptorList;"
]
},
{
"added": [
" forbidSynonyms();"
],
"header": "@@ -360,7 +359,7 @@ public final class MergeNode extends DMLModStatementNode",
"removed": [
" forbidSynonyms( dd );"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/SetConstraintsNode.java",
"hunks": [
{
"added": [],
"header": "@@ -25,7 +25,6 @@ import java.util.List;",
"removed": [
"import org.apache.derby.iapi.sql.dictionary.DataDictionary;"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/TableName.java",
"hunks": [
{
"added": [],
"header": "@@ -22,11 +22,7 @@",
"removed": [
"import org.apache.derby.iapi.reference.Property;",
"import org.apache.derby.iapi.reference.SQLState;",
"import org.apache.derby.shared.common.sanity.SanityManager;",
"import org.apache.derby.iapi.sql.dictionary.DataDictionary;"
]
},
{
"added": [
" void bind() throws StandardException"
],
"header": "@@ -242,12 +238,9 @@ public class TableName extends QueryTreeNode",
"removed": [
"\t *\t@param\tdataDictionary\tData dictionary to bind against.",
"\t *",
" void bind( DataDictionary dataDictionary )",
"\t\t throws StandardException"
]
}
]
}
] |
derby-DERBY-6371-6c2e1b4a
|
DERBY-6371: DROP COLUMN looks in wrong schema when checking trigger dependencies
Use the same schema during dependency checking as during compilation
of the trigger action.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1530517 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/sql/execute/AlterTableConstantAction.java",
"hunks": [
{
"added": [],
"header": "@@ -22,7 +22,6 @@",
"removed": [
"import java.util.Iterator;"
]
},
{
"added": [
" SchemaDescriptor compSchema = dd.getSchemaDescriptor(",
" dd.getSPSDescriptor(trd.getActionId()).getCompSchemaId(),",
" null);"
],
"header": "@@ -1800,8 +1799,9 @@ class AlterTableConstantAction extends DDLSingleTableConstantAction",
"removed": [
"\t\tSchemaDescriptor compSchema;",
"\t\tcompSchema = dd.getSchemaDescriptor(trd.getSchemaDescriptor().getUUID(), null);"
]
}
]
}
] |
derby-DERBY-6373-d3fbd727
|
DERBY-6373: NPE in Statement.getWarnings()
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1534523 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-638-2ba89c55
|
DERBY-638 Network driver setTransactionIsolation() causes a commit, but does not complete it locally
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@474720 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-6380-1850f649
|
DERBY-6380; Rolling log files do not get copied in failed directory when a junit test fails
removing two 'fail' commands left over from debugging, and streamlining clean up in ErrorStreamTest
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1545957 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-6380-ccf120cb
|
DERBY-6380; Rolling log files do not get copied in failed directory when a junit test fails
adjusting ErrorStreamTest to copy files created in it on fail, and BaseTestCase to copy defaults on fail.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1545935 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-6383-10982582
|
DERBY-6383(Update trigger defined on one column fires on update of other columns)
Adding more junit tests for checking the affects of adding/dropping columns to the table with update triggers defined on it.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1541170 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-6383-374d58fe
|
DERBY-6383(Update trigger defined on one column fires on update of other columns).
This regression is caused by DERBY-4874(Trigger does not recognize new size of VARCHAR column expanded with ALTER TABLE. It fails with ERROR 22001: A truncation error was
encountered trying to shrink VARCHAR)
The regression is for Statement level triggers. The statement trigger gets fired incorrectly for any column update rather than just the column specified in the UPDATE of column clause. The fix is going to ensure that SYSTRIGGERS has the correct list of columns on which trigger should be fired. Row level triggers work fine. The only workaround at this point is to drop and recreate the statement triggers.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1537593 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/sql/compile/CreateTriggerNode.java",
"hunks": [
{
"added": [
"\t\t\t//then it means that a set of trigger columns are specified",
"\t\t\t//in the CREATE TRIGGER statement. This can only happen for",
"\t\t\t//an UPDATE trigger."
],
"header": "@@ -538,10 +538,9 @@ class CreateTriggerNode extends DDLStatementNode",
"removed": [
"\t\t\t//then it means that the trigger is defined at the row level",
"\t\t\t//and a set of trigger columns are specified in the CREATE",
"\t\t\t//TRIGGER statement. This can only happen for an UPDATE",
"\t\t\t//trigger."
]
}
]
}
] |
derby-DERBY-6396-d32b042d
|
DERBY-6396: NullPointerException in DirFile
Check that the array returned by File.list() is non-null before
attempting to iterate through it. Null is a valid return value.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1537394 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/io/DirFile.java",
"hunks": [
{
"added": [
" // Nothing to do if the file doesn't exist.",
" if (!exists()) {",
" }",
"",
" // If the file is a directory, delete its contents recursively.",
" // File.list() will return null if it is not a directory, or if the",
" // contents of the directory cannot be read. Skip the recursive step",
" // in both of those cases. If it turns out that the file in fact is a",
" // directory, and we couldn't delete its contents, the delete() call",
" // at the end of this method will return false to notify the caller",
" // that the directory could not be deleted.",
" String[] childList = super.list();",
" if (childList != null)"
],
"header": "@@ -402,11 +402,21 @@ class DirFile extends File implements StorageFile",
"removed": [
" if( !exists())",
" if( isDirectory())",
" String[] childList = super.list();"
]
}
]
}
] |
derby-DERBY-64-1453acc5
|
DERBY-64 (partial): Implement CREATE TABLE ... AS ... WITH NO DATA
functionality in accordance with SQL 2003 standards. In this patch:
- SQLState.java and messages.xml were modified to add three messages
to flag various errors. These error messages are similar to those
used by CREATE VIEW.
- sqlgrammer.jj was modified to support the following syntax:
CREATE TABLE new_table AS subquery WITH [NO] DATA
- CreateTableNode.java was modified to define a new init method to
take a result column list and a query expression. The bindStatement
method was modified to bind the quiery expression and create the
table element list from the result column list and the query
expression.
- A new JUnit test, CreateTableFromQueryTest, was added to the lang
suite.
The current patch does not implement the WITH DATA option.
Contributed by James F. Adams (derby@xemaps.com)
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@495750 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/sql/compile/CreateTableNode.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.sql.depend.ProviderList;",
"import org.apache.derby.iapi.sql.compile.CompilerContext;",
"import org.apache.derby.iapi.sql.conn.Authorizer;"
],
"header": "@@ -30,11 +30,14 @@ import org.apache.derby.iapi.services.sanity.SanityManager;",
"removed": []
},
{
"added": [
"\tprivate ResultColumnList\tresultColumns;",
"\tprivate ResultSetNode\t\tqueryExpression;"
],
"header": "@@ -58,6 +61,8 @@ public class CreateTableNode extends DDLStatementNode",
"removed": []
},
{
"added": [
"\t",
"\t/**",
"\t * Initializer for a CreateTableNode for a base table create from a query",
"\t * ",
"\t * @param newObjectName\t\tThe name of the new object being created",
"\t * \t (ie base table).",
"\t * @param resultColumns\t\tThe optional column list.",
"\t * @param queryExpression\tThe query expression for the table.",
"\t */",
"\tpublic void init(",
"\t\t\tObject newObjectName,",
"\t\t\tObject resultColumns,",
"\t\t\tObject queryExpression)",
"\t\tthrows StandardException",
"\t{",
"\t\ttableType = TableDescriptor.BASE_TABLE_TYPE;",
"\t\tlockGranularity = TableDescriptor.DEFAULT_LOCK_GRANULARITY;",
"\t\timplicitCreateSchema = true;",
"\t\tinitAndCheck(newObjectName);",
"\t\tthis.resultColumns = (ResultColumnList) resultColumns;",
"\t\tthis.queryExpression = (ResultSetNode) queryExpression;",
"\t}"
],
"header": "@@ -137,6 +142,28 @@ public class CreateTableNode extends DDLStatementNode",
"removed": []
}
]
},
{
"file": "java/shared/org/apache/derby/shared/common/reference/SQLState.java",
"hunks": [
{
"added": [
"\tString LANG_TABLE_REQUIRES_COLUMN_NAMES = \"42909\";"
],
"header": "@@ -747,6 +747,7 @@ public interface SQLState {",
"removed": []
},
{
"added": [
"\tString LANG_TABLE_DEFINITION_R_C_L_MISMATCH = \"42X70\";"
],
"header": "@@ -818,6 +819,7 @@ public interface SQLState {",
"removed": []
}
]
}
] |
derby-DERBY-6400-b2686e64
|
DERBY-6400; harness.NetServer method waitFor() is not reflecting timeout values
adding code to pass on a timeout value when specified on in the commandline
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1538692 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/testing/org/apache/derbyTesting/functionTests/harness/NetServer.java",
"hunks": [
{
"added": [
"\tint timeout=60;"
],
"header": "@@ -41,6 +41,7 @@ public class NetServer",
"removed": []
},
{
"added": [
"\t",
" if (jvmflags != null && jvmflags.length() > 0)",
" {",
" int start=jvmflags.indexOf(\"-Dtimeout\");",
" if (start >= 0) {",
" String timeoutStr = jvmflags.substring(start);",
" String[] tokens = timeoutStr.split(\" \");",
" timeoutStr = tokens[0];",
" timeoutStr = timeoutStr.substring(10);",
" timeout = Integer.parseInt(timeoutStr.trim());",
" }",
" }"
],
"header": "@@ -129,6 +130,18 @@ public class NetServer",
"removed": []
},
{
"added": [
"\t\ttp.waitFor(timeout);"
],
"header": "@@ -316,7 +329,7 @@ public class NetServer",
"removed": [
"\t\ttp.waitFor(60);"
]
}
]
}
] |
derby-DERBY-6401-68e06acc
|
DERBY-6401 Create a test option to stop running Junit tests after first failure or error
Adds test option. If run with -Dderby.tests.stopAfterFirstFail=true tests will stop after first failure or error
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1539729 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/testing/org/apache/derbyTesting/junit/TestConfiguration.java",
"hunks": [
{
"added": [
"",
" /**",
" * derby.tests.stopAfterFirstFail - debugging property to exit after ",
" * first failure. Can be useful for debugging cascading failures or errors",
" * that lead to hang scenario.",
" */",
" private final static String KEY_STOP_AFTER_FIRST_FAIL = \"derby.tests.stopAfterFirstFail\";"
],
"header": "@@ -119,6 +119,13 @@ public final class TestConfiguration {",
"removed": []
},
{
"added": [
" this.stopAfterFirstFail = Boolean.valueOf(",
" getSystemProperties().getProperty(KEY_STOP_AFTER_FIRST_FAIL)).",
" booleanValue();"
],
"header": "@@ -1128,7 +1135,9 @@ public final class TestConfiguration {",
"removed": [
" "
]
},
{
"added": [
" public boolean stopAfterFirstFail() {",
" return stopAfterFirstFail;",
" }"
],
"header": "@@ -1945,6 +1954,9 @@ public final class TestConfiguration {",
"removed": []
},
{
"added": [
" private boolean stopAfterFirstFail;"
],
"header": "@@ -2053,6 +2065,7 @@ public final class TestConfiguration {",
"removed": []
}
]
}
] |
derby-DERBY-6410-d27662da
|
DERBY-6410: ClassCastException when launching derby from windows subst drive
Avoid calling Files.getFileStore() since it fails when called on a
file that lives on a subst drive. (Because of a bug in the JVM:
JDK-8034057.)
It is used for checking if a specific FileAttributeView is supported
on the file system. The same information can be found by checking if
Files.getFileAttributeView() returns null, which we already do, so
skip the failing call.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1585407 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/iapi/services/io/FilePermissionServiceImpl.java",
"hunks": [
{
"added": [],
"header": "@@ -23,7 +23,6 @@ package org.apache.derby.iapi.services.io;",
"removed": [
"import java.nio.file.FileStore;"
]
}
]
}
] |
derby-DERBY-6411-e3720ab0
|
DERBY-6411: Minimal select privilege should be checked in subqueries
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1541461 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/sql/compile/CompilerContextImpl.java",
"hunks": [
{
"added": [
" // If we are here for MIN_SELECT_PRIV requirement, then first",
" // check if there is already a SELECT privilege requirement on any",
" // of the columns in the table, or on the table itself. If yes,",
" // then we do not need to add MIN_SELECT_PRIV requirement for the",
" // table because that requirement is already getting satisfied with",
" // the already existing SELECT privilege requirement.",
" if (requiredColumnPrivileges.containsKey(key) ||",
" requiredTablePrivileges.containsKey(key)) {",
" }"
],
"header": "@@ -745,18 +745,18 @@ public class CompilerContextImpl extends ContextImpl",
"removed": [
"\t\t\t//If we are here for MIN_SELECT_PRIV requirement, then first",
"\t\t\t//check if there is already a SELECT privilege requirement on any ",
"\t\t\t//of the columns in the table. If yes, then we do not need to add ",
"\t\t\t//MIN_SELECT_PRIV requirement for the table because that ",
"\t\t\t//requirement is already getting satisfied with the already",
"\t\t\t//existing SELECT privilege requirement",
"\t\t\tStatementColumnPermission tableColumnPrivileges",
"\t\t\t = requiredColumnPrivileges.get( key);",
"\t\t\tif( tableColumnPrivileges != null)"
]
},
{
"added": [
" requiredColumnPrivileges.remove(key);"
],
"header": "@@ -766,10 +766,7 @@ public class CompilerContextImpl extends ContextImpl",
"removed": [
"\t\t\tStatementColumnPermission tableColumnPrivileges",
"\t\t\t = requiredColumnPrivileges.get( key);",
"\t\t\tif( tableColumnPrivileges != null)",
"\t\t\t\trequiredColumnPrivileges.remove(key);"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/CursorNode.java",
"hunks": [
{
"added": [
" // Collect tables whose indexes we'll want to check for staleness.",
" collectTablesWithPossiblyStaleStats();",
""
],
"header": "@@ -290,24 +290,15 @@ public class CursorNode extends DMLStatementNode",
"removed": [
"\t\t\t",
"\t\t\t//DERBY-4191 Make sure that we have minimum select privilege on ",
"\t\t\t//each of the tables in the query.",
"\t\t\tgetCompilerContext().pushCurrentPrivType(Authorizer.MIN_SELECT_PRIV);",
"\t\t\tFromList resultSetFromList = resultSet.getFromList();",
"\t\t\tfor (int index = 0; index < resultSetFromList.size(); index++) {",
" Object fromTable = resultSetFromList.elementAt(index);",
" if (fromTable instanceof FromBaseTable) {",
" collectTablePrivsAndStats((FromBaseTable)fromTable);",
" }",
" }",
"\t\t\tgetCompilerContext().popCurrentPrivType();"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/FromList.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.sql.compile.CompilerContext;",
"import org.apache.derby.iapi.sql.conn.Authorizer;"
],
"header": "@@ -27,10 +27,12 @@ import java.util.Properties;",
"removed": []
}
]
}
] |
derby-DERBY-6414-a826375a
|
CERBY-6414(Incorrect handling when using an UPDATE to SET an identity column to DEFAULT)
I have created DERBY-6742 for JDBC part of this feature so we can generate auto generated resultset for an update statement updating generated columns. This implementation is supported through Statement.RETURN_GENERATED_KEYS flag.
Junit tests for this feature are in GeneratedColumnsTest.java. Upgrade tests are in Changes10_12.java. Upgrade test shows that a soft upgrade from pre-10.11 will not support update of generated columns using DEFAULT but 10.11 to trunk soft upgrade will allow it. This is because starting 10.11, we have started using sequence generator to create unique ids. If we want to support updating of idetity columns for pre-10.11 releases, we will need to maintain the code for old way of generating unique ids. In order to avoid that, this feature is available to only 10.11 db during soft upgrade.
For UPDATE of identity column to work in the MERGE sql, we need to make changes to MERGE code(DERBY-6743). MERGE already has required code for insert putting DEFAULT in generated columns. Implementation needs to be added for update putting DEFAULT in generated columns in case of MERGE. In the mean time, I have renamed existing junit test test_015_bug_6414 to atest_015_bug_6414 in MergeStatementTest.java so we do not run into failures.
Some detail about the part of the implementation that was tricky for DERBY-6414.
The existing code was originally written to handle inserting values in identity columns using DEFAULT. In case of insert, InsertResultSet uses ColumnDescriptors in resultDescription to find the type of the generated columns. This data structure holds the column descriptors of all the columns in the table. All the columns are in this data structure because even though INSERT statement may not explicitly assign a value to each and every column in the table, all the columns end up getting some value in them through an INSERT statement. The code in InsertResultSet.initializeAIcache method relies on availability of all the columns type information. But in case of Update, resultDescription does not include all the columns in the table. It only has the columns being touched by the Update statement(the rest of the columns in the table will retain their original values), and for each of those touched columns, it has a duplicate entry in resultDescription in order to have before and after values for the changed column values. This difference in array content of resultDescription requires us to have separate implementation of initializeAIcache method for insert and update.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1625884 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/sql/compile/InsertNode.java",
"hunks": [
{
"added": [],
"header": "@@ -41,13 +41,11 @@ import org.apache.derby.iapi.sql.dictionary.ColumnDescriptorList;",
"removed": [
"import org.apache.derby.iapi.sql.dictionary.SequenceDescriptor;",
"import org.apache.derby.iapi.types.RowLocation;"
]
},
{
"added": [
"public final class InsertNode extends DMLModGeneratedColumnsStatementNode"
],
"header": "@@ -74,7 +72,7 @@ import org.apache.derby.vti.DeferModification;",
"removed": [
"public final class InsertNode extends DMLModStatementNode"
]
},
{
"added": [],
"header": "@@ -88,10 +86,6 @@ public final class InsertNode extends DMLModStatementNode",
"removed": [
"",
"\tprotected RowLocation[] \t\tautoincRowLocation;",
"",
" private String identitySequenceUUIDString;"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/UpdateNode.java",
"hunks": [
{
"added": [
"public final class UpdateNode extends DMLModGeneratedColumnsStatementNode"
],
"header": "@@ -68,7 +68,7 @@ import org.apache.derby.vti.DeferModification;",
"removed": [
"public final class UpdateNode extends DMLModStatementNode"
]
},
{
"added": [
" //DERBY-6414(Incorrect handling when using an UPDATE to SET an ",
" // identity column to DEFAULT)",
" //The bug is fixed only for Derby 10.11 and higher. Starting 10.11,",
" // we have started using sequence generator to create unique ids",
" //If we fix this jira for prior releases, we will need to maintain",
" // the code for old way of generating unique ids.",
" if (dataDictionary.checkVersion( DataDictionary.DD_VERSION_DERBY_10_11, null )) {",
" //Replace any DEFAULTs with the associated tree for the default if",
" // allowed, otherwise throw an exception",
" resultSet.getResultColumns().replaceOrForbidDefaults(",
" \t\ttargetTableDescriptor, ",
" \t\tresultSet.getResultColumns(), true);",
" resultSet.getResultColumns().checkForInvalidDefaults();",
" resultSet.getResultColumns().forbidOverrides(resultSet.getResultColumns());",
" } else {",
" \t\tLanguageConnectionContext lcc = getLanguageConnectionContext();",
" \t\tif (lcc.getAutoincrementUpdate() == false)",
" \t\t\tresultSet.getResultColumns().forbidOverrides(null);",
" }"
],
"header": "@@ -371,9 +371,25 @@ public final class UpdateNode extends DMLModStatementNode",
"removed": [
"\t\tLanguageConnectionContext lcc = getLanguageConnectionContext();",
"\t\tif (lcc.getAutoincrementUpdate() == false)",
"\t\t\tresultSet.getResultColumns().forbidOverrides(null);"
]
},
{
"added": [
" TransactionController tc = ",
" getLanguageConnectionContext().getTransactionCompile();",
"",
" autoincRowLocation = ",
" dataDictionary.computeAutoincRowLocations(tc, targetTableDescriptor);",
"\t\tidentitySequenceUUIDString = getUUIDofSequenceGenerator();",
""
],
"header": "@@ -635,8 +651,15 @@ public final class UpdateNode extends DMLModStatementNode",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/execute/GenericConstantActionFactory.java",
"hunks": [
{
"added": [
"\t * @param autoincRowLocation array of row locations into syscolumns for",
"\t autoincrement columns",
"\t * @param identitySequenceUUIDString For 10.11 and higher, the handle on the sequence for the identity column"
],
"header": "@@ -941,7 +941,10 @@ public class GenericConstantActionFactory",
"removed": []
},
{
"added": [
"\t\t\t\t\t\t\t\tRowLocation[]\t\tautoincRowLocation,",
"\t\t\t\t\t\t\t\tboolean\t\t\t\tunderMerge,",
"\t\t\t\t\t\t\t\tString\t\tidentitySequenceUUIDString"
],
"header": "@@ -968,7 +971,9 @@ public class GenericConstantActionFactory",
"removed": [
"\t\t\t\t\t\t\t\tboolean\t\t\t\tunderMerge"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/execute/InsertResultSet.java",
"hunks": [
{
"added": [
"class InsertResultSet extends DMLWriteGeneratedColumnsResultSet implements TargetResultSet"
],
"header": "@@ -89,14 +89,13 @@ import org.apache.derby.shared.common.sanity.SanityManager;",
"removed": [
"class InsertResultSet extends DMLWriteResultSet implements TargetResultSet",
"\tprivate\tNoPutResultSet\t\t\tsourceResultSet;"
]
},
{
"added": [],
"header": "@@ -163,11 +162,6 @@ class InsertResultSet extends DMLWriteResultSet implements TargetResultSet",
"removed": [
"\t/**",
"\t * keeps track of autoincrement values that are generated by ",
"\t * getSetAutoincrementValues.",
"\t */",
"\tprivate DataValueDescriptor\t\t\t\taiCache[];"
]
},
{
"added": [],
"header": "@@ -181,8 +175,6 @@ class InsertResultSet extends DMLWriteResultSet implements TargetResultSet",
"removed": [
" private String identitySequenceUUIDString;",
""
]
},
{
"added": [
"\t\tinitializeAIcache(constants.getAutoincRowLocation());"
],
"header": "@@ -375,21 +367,7 @@ class InsertResultSet extends DMLWriteResultSet implements TargetResultSet",
"removed": [
" RowLocation[] rla;",
"",
"\t\tif ((rla = constants.getAutoincRowLocation()) != null)",
"\t\t{",
"\t\t\taiCache = new DataValueDescriptor[ rla.length ];",
"\t\t\tbulkInsertCounters = new BulkInsertCounter[ rla.length ];",
"\t\t\tfor (int i = 0; i < resultDescription.getColumnCount(); i++)",
"\t\t\t{",
"\t\t\t\tif (rla[i] == null)",
"\t\t\t\t\tcontinue;",
"\t\t\t\tResultColumnDescriptor rcd = ",
"\t\t\t\t\tresultDescription.getColumnDescriptor(i + 1);",
"\t\t\t\taiCache[i] = rcd.getType().getNull();",
"\t\t\t}",
"\t\t}"
]
},
{
"added": [
"\t\tsaveAIcacheInformation(constants.getSchemaName(), ",
"\t\t\tconstants.getTableName(), constants.getColumnNames());"
],
"header": "@@ -522,29 +500,8 @@ class InsertResultSet extends DMLWriteResultSet implements TargetResultSet",
"removed": [
"\t\tif (aiCache != null)",
"\t\t{",
"\t\t\tHashMap<String,Long> aiHashtable = new HashMap<String,Long>();",
"\t\t\tint numColumns = aiCache.length;",
"\t\t\t// this insert updated ai values, store them in some persistent",
"\t\t\t// place so that I can see these values.",
"\t\t\tfor (int i = 0; i < numColumns; i++)",
"\t\t\t{",
"\t\t\t\tif (aiCache[i] == null)",
"\t\t\t\t\tcontinue;",
"\t\t\t\taiHashtable.put(AutoincrementCounter.makeIdentity(",
"\t\t\t\t\t\t\t\t constants.getSchemaName(),",
"\t\t\t\t\t\t\t\t constants.getTableName(),",
"\t\t\t\t\t\t\t\t constants.getColumnName(i)),",
"\t\t\t\t\t\t\t\tnew Long(aiCache[i].getLong()));",
"\t\t\t}",
"\t\t\tInternalTriggerExecutionContext itec =",
"\t\t\t\t(InternalTriggerExecutionContext)lcc.getTriggerExecutionContext();",
"\t\t\tif (itec == null)",
"\t\t\t\tlcc.copyHashtableToAIHT(aiHashtable);",
"\t\t\telse",
"\t\t\t\titec.copyHashtableToAIHT(aiHashtable);",
"\t\t}\t"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/execute/UpdateConstantAction.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.types.RowLocation;"
],
"header": "@@ -39,6 +39,7 @@ import java.io.IOException;",
"removed": []
},
{
"added": [
" private String columnNames[];",
"",
" String identitySequenceUUIDString;",
"",
" /**",
" * An array of row location objects (0 based), one for each",
" * column in the table. If the column is an ",
" * autoincrement table then the array points to",
" * the row location of the column in SYSCOLUMNS.",
" * if not, then it contains null.",
" */",
" RowLocation[] autoincRowLocation;",
" private long[] autoincIncrement;"
],
"header": "@@ -69,6 +70,19 @@ public class UpdateConstantAction extends WriteCursorConstantAction",
"removed": []
},
{
"added": [
"\t * @param autoincRowLocation Array of rowlocations of autoincrement",
"\t * \t\t\t\t\t values in SYSCOLUMNS for each ai column.",
"\t * @param identitySequenceUUIDString For 10.11 and higher, the handle on the sequence for the identity column",
" StaticCompiledOpenConglomInfo heapSCOCI,",
" IndexRowGenerator[]\tirgs,",
" long[]\t\t\t\tindexCIDS,",
" StaticCompiledOpenConglomInfo[] indexSCOCIs,",
" String[]\t\t\tindexNames,",
" boolean\t\t\t\tdeferred,",
" UUID\t\t\t\ttargetUUID,",
" int\t\t\t\t\tlockMode,",
" int[]\t\t\t\tchangedColumnIds,",
" FKInfo[]\t\t\tfkInfo,",
" TriggerInfo\t\t\ttriggerInfo,",
" FormatableBitSet\t\t\t\tbaseRowReadList,",
" int[]\t\t\t\tbaseRowReadMap,",
" int[] streamStorableHeapColIds,",
" int\t\t\t\t\tnumColumns,",
" boolean\t\t\t\tpositionedUpdate,",
" boolean\t\t\t\tsingleRowSource,",
" RowLocation[]\t\tautoincRowLocation,",
" boolean underMerge,",
" String\t\tidentitySequenceUUIDString)"
],
"header": "@@ -102,28 +116,33 @@ public class UpdateConstantAction extends WriteCursorConstantAction",
"removed": [
"\t\t\t\t\t\t\t\tStaticCompiledOpenConglomInfo heapSCOCI,",
"\t\t\t\t\t\t\t\tIndexRowGenerator[]\tirgs,",
"\t\t\t\t\t\t\t\tlong[]\t\t\t\tindexCIDS,",
"\t\t\t\t\t\t\t\tStaticCompiledOpenConglomInfo[] indexSCOCIs,",
"\t\t\t\t\t\t\t\tString[]\t\t\tindexNames,",
"\t\t\t\t\t\t\t\tboolean\t\t\t\tdeferred,",
"\t\t\t\t\t\t\t\tUUID\t\t\t\ttargetUUID,",
"\t\t\t\t\t\t\t\tint\t\t\t\t\tlockMode,",
"\t\t\t\t\t\t\t\tint[]\t\t\t\tchangedColumnIds,",
"\t\t\t\t\t\t\t\tFKInfo[]\t\t\tfkInfo,",
"\t\t\t\t\t\t\t\tTriggerInfo\t\t\ttriggerInfo,",
"\t\t\t\t\t\t\t\tFormatableBitSet\t\t\t\tbaseRowReadList,",
"\t\t\t\t\t\t\t\tint[]\t\t\t\tbaseRowReadMap,",
"\t\t\t\t\t\t\t\tint[] streamStorableHeapColIds,",
"\t\t\t\t\t\t\t\tint\t\t\t\t\tnumColumns,",
"\t\t\t\t\t\t\t\tboolean\t\t\t\tpositionedUpdate,",
"\t\t\t\t\t\t\t\tboolean\t\t\t\tsingleRowSource,",
" boolean underMerge)"
]
},
{
"added": [
" this.columnNames = targetTableDesc.getColumnNamesArray();",
" this.autoincIncrement = targetTableDesc.getAutoincIncrementArray();",
" this.identitySequenceUUIDString = identitySequenceUUIDString;",
" this.autoincRowLocation = autoincRowLocation;",
"\t}",
"",
"\t/**",
"\t * Does the target table has autoincrement columns.",
"\t *",
"\t * @return \tTrue if the table has ai columns",
"\t */",
"\tpublic boolean hasAutoincrement()",
"\t{",
"\t\treturn (autoincRowLocation != null);",
"\t}",
"",
"\t/**",
"\t * gets the row location ",
"\t */",
"\tRowLocation[] getAutoincRowLocation()",
"\t{",
"\t\treturn autoincRowLocation;"
],
"header": "@@ -151,6 +170,28 @@ public class UpdateConstantAction extends WriteCursorConstantAction",
"removed": []
},
{
"added": [
"\t\tautoincIncrement = ArrayUtil.readLongArray(in);",
"\t\tidentitySequenceUUIDString = (String) in.readObject();"
],
"header": "@@ -170,6 +211,8 @@ public class UpdateConstantAction extends WriteCursorConstantAction",
"removed": []
},
{
"added": [
"\t\tArrayUtil.writeLongArray(out, autoincIncrement);",
"\t\tout.writeObject( identitySequenceUUIDString );"
],
"header": "@@ -184,6 +227,8 @@ public class UpdateConstantAction extends WriteCursorConstantAction",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/execute/UpdateResultSet.java",
"hunks": [
{
"added": [
"import java.util.Vector;",
""
],
"header": "@@ -24,6 +24,8 @@ package org.apache.derby.impl.sql.execute;",
"removed": []
},
{
"added": [
"import org.apache.derby.iapi.types.NumberDataValue;",
"import org.apache.derby.iapi.sql.dictionary.ColumnDescriptorList;"
],
"header": "@@ -42,16 +44,16 @@ import org.apache.derby.iapi.sql.execute.RowChanger;",
"removed": [
"import org.apache.derby.iapi.store.access.StaticCompiledOpenConglomInfo;",
""
]
},
{
"added": [
"class UpdateResultSet extends DMLWriteGeneratedColumnsResultSet"
],
"header": "@@ -59,7 +61,7 @@ import org.apache.derby.shared.common.sanity.SanityManager;",
"removed": [
"class UpdateResultSet extends DMLWriteResultSet"
]
},
{
"added": [],
"header": "@@ -67,7 +69,6 @@ class UpdateResultSet extends DMLWriteResultSet",
"removed": [
"\tprivate NoPutResultSet\t\t\tsource;"
]
},
{
"added": [
" this.sourceResultSet = source;"
],
"header": "@@ -181,7 +182,7 @@ class UpdateResultSet extends DMLWriteResultSet",
"removed": [
"\t\tthis.source = source;"
]
},
{
"added": [
" identitySequenceUUIDString = constants.identitySequenceUUIDString;",
" initializeAIcache(constants.getAutoincRowLocation());"
],
"header": "@@ -253,6 +254,8 @@ class UpdateResultSet extends DMLWriteResultSet",
"removed": []
},
{
"added": [
"\t\tsaveAIcacheInformation(constants.getSchemaName(), ",
"\t\t\tconstants.getTableName(), constants.getColumnNames());"
],
"header": "@@ -287,6 +290,8 @@ class UpdateResultSet extends DMLWriteResultSet",
"removed": []
},
{
"added": [
"\t\t\tsavedSource = sourceResultSet;"
],
"header": "@@ -310,7 +315,7 @@ class UpdateResultSet extends DMLWriteResultSet",
"removed": [
"\t\t\tsavedSource = source;"
]
},
{
"added": [
"\t\t\tsourceResultSet.openCore();",
"\t\t\tsourceResultSet.reopenCore();"
],
"header": "@@ -344,11 +349,11 @@ class UpdateResultSet extends DMLWriteResultSet",
"removed": [
"\t\t\tsource.openCore();",
"\t\t\tsource.reopenCore();"
]
},
{
"added": [
"\t\trow = getNextRowCore(sourceResultSet);"
],
"header": "@@ -465,7 +470,7 @@ class UpdateResultSet extends DMLWriteResultSet",
"removed": [
"\t\trow = getNextRowCore(source);"
]
},
{
"added": [
" evaluateGenerationClauses( generationClauses, activation, sourceResultSet, row, true );"
],
"header": "@@ -485,7 +490,7 @@ class UpdateResultSet extends DMLWriteResultSet",
"removed": [
" evaluateGenerationClauses( generationClauses, activation, source, row, true );"
]
},
{
"added": [
"\t\t\t\tsourceResultSet.updateRow(newBaseRow, rowChanger);"
],
"header": "@@ -624,7 +629,7 @@ class UpdateResultSet extends DMLWriteResultSet",
"removed": [
"\t\t\t\tsource.updateRow(newBaseRow, rowChanger);"
]
},
{
"added": [
"\t\t\t\trow = getNextRowCore(sourceResultSet);"
],
"header": "@@ -642,7 +647,7 @@ class UpdateResultSet extends DMLWriteResultSet",
"removed": [
"\t\t\t\trow = getNextRowCore(source);"
]
},
{
"added": [
"\t\t\t\tVector<AutoincrementCounter> v = null;",
"\t\t\t\tif (aiCache != null)",
"\t\t\t\t{",
"\t\t\t\t\tv = new Vector<AutoincrementCounter>();",
"\t\t\t\t\tfor (int i = 0; i < aiCache.length; i++)",
"\t\t\t\t\t{",
"\t\t\t\t\t\tString s, t, c;",
"\t\t\t\t\t\tif (aiCache[i] == null)",
"\t\t\t\t\t\t\tcontinue;",
"\t\t\t\t\t",
"\t\t\t\t\t\tLong initialValue = ",
"\t\t\t\t\t\t\tlcc.lastAutoincrementValue(",
"\t\t\t\t\t\t\t\t(s = constants.getSchemaName()),",
"\t\t\t\t\t\t\t\t(t = constants.getTableName()),",
"\t\t\t\t\t\t\t\t(c = constants.getColumnName(i)));",
"",
"\t\t\t\t\t\tAutoincrementCounter aic = ",
"\t\t\t\t\t\t\tnew AutoincrementCounter(",
"\t\t\t\t\t\t\t\t initialValue,",
"\t\t\t\t\t\t\t\t constants.getAutoincIncrement(i),",
"\t\t\t\t\t\t\t\t aiCache[i].getLong(),",
"\t\t\t\t\t\t\t\t s, t, c, i + 1);",
"\t\t\t\t\t\tv.addElement(aic);",
"\t\t\t\t\t}",
"\t\t\t\t}",
"\t\t\t\t\t\t\t\t\t\t\tactivation, v);"
],
"header": "@@ -799,13 +804,38 @@ class UpdateResultSet extends DMLWriteResultSet",
"removed": [
"\t\t\t\t\t\t\t\t\t\t\tactivation, null);"
]
},
{
"added": [
"\t\t\t\t\t\tsourceResultSet.setCurrentRow(deferredTempRow);"
],
"header": "@@ -877,7 +907,7 @@ class UpdateResultSet extends DMLWriteResultSet",
"removed": [
"\t\t\t\t\t\tsource.setCurrentRow(deferredTempRow);"
]
},
{
"added": [
"\t\t\t\tsourceResultSet.clearCurrentRow();"
],
"header": "@@ -928,7 +958,7 @@ class UpdateResultSet extends DMLWriteResultSet",
"removed": [
"\t\t\t\tsource.clearCurrentRow();"
]
},
{
"added": [
"\t\tif (sourceResultSet != null)",
"\t\t\tsourceResultSet.close();"
],
"header": "@@ -1116,9 +1146,9 @@ class UpdateResultSet extends DMLWriteResultSet",
"removed": [
"\t\tif (source != null)",
"\t\t\tsource.close();"
]
}
]
}
] |
derby-DERBY-642-20cc8ad0
|
DERBY-642: SELECT MAX doesn't use indices optimally
First attempt on a B-tree max scan that walks backwards. Includes some
test cases that test latch conflicts.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1071171 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/store/access/btree/BTreeMaxScan.java",
"hunks": [
{
"added": [],
"header": "@@ -27,11 +27,6 @@ import org.apache.derby.iapi.services.sanity.SanityManager;",
"removed": [
"import org.apache.derby.iapi.store.access.RowUtil;",
"import org.apache.derby.iapi.store.access.Qualifier;",
"import org.apache.derby.iapi.store.access.ScanController;",
"",
"import org.apache.derby.iapi.store.raw.FetchDescriptor;"
]
},
{
"added": [
"A BTreeScan implementation that provides the 95% solution to the max on"
],
"header": "@@ -56,7 +51,7 @@ import org.apache.derby.iapi.store.access.BackingStoreHashtable;",
"removed": [
"A BTreeScan implementation that provides the 90% solution to the max on"
]
},
{
"added": [
" as it does so, until it finds the first non-deleted, non-NULL row.",
"3) If it is not successful in this last page search it attempts to latch",
" the left sibling page, without waiting to avoid deadlocks with forward",
" scans, and continue the search on that page.",
"4) If the sibling page couldn't be latched without waiting, save the",
" current position, release all latches, and restart the scan from the",
" saved position."
],
"header": "@@ -72,13 +67,13 @@ To return the maximum row this implementation does the following:",
"removed": [
" as it does so, until it either finds the first non-deleted and locks",
" that row without having to wait and thus did not give up the latch on the ",
" page. If successful it returns that row.",
"3) If it is not successful in this last page search it faults over to ",
" the original implementation of max scan, which is simply a search from ",
" left to right at the leaf level for the last row in the table.",
""
]
},
{
"added": [
" * Move the current position to the page to the left of the current page,",
" * right after the last slot on that page. If we have to wait for a latch,",
" * give up the latch on the current leaf and give up. The caller will have",
" * to reposition and retry.",
" * @return true if the position was successfully moved, false if we had",
" * to wait for a latch",
" */",
" private boolean moveToLeftSibling() throws StandardException {",
" try {",
" positionAtPreviousPage();",
" return true;",
" } catch (WaitError we) {",
" // We couldn't get the latch without waiting. Let's save the",
" // position and let the caller retry.",
" //",
" // If the page is empty, there is no position to save. Since",
" // positionAtPreviousPage() skips empty pages mid-scan, we know",
" // that an empty page seen here must be the rightmost leaf. In",
" // that case, the caller can simply restart the scan, so there's",
" // no need to save the position.",
" if (isEmpty(scan_position.current_leaf.getPage())) {",
" scan_position.current_leaf.release();",
" scan_position.init();",
" } else {",
" // Save the leftmost record on the page. That's the record in",
" // slot 1, since slot 0 is the control row.",
" scan_position.current_slot = 1;",
" savePositionAndReleasePage();",
" }",
" return false;",
" }",
" }"
],
"header": "@@ -91,191 +86,41 @@ public class BTreeMaxScan extends BTreeScan",
"removed": [
" * Fetch the maximum non-deleted row from the table.",
" *",
" * Scan from left to right at the leaf level searching for the ",
" * rightmost non deleted row in the index.",
"\t * @exception StandardException Standard exception policy.",
" **/",
" private boolean fetchMaxRowFromBeginning(",
" DataValueDescriptor[] fetch_row)",
" throws StandardException",
"\t{",
" int ret_row_count = 0;",
" RecordHandle max_rh = null;",
"",
" // we need to scan until we hit the end of the table or until we",
" // run into a null. Use this template to probe the \"next\" row so",
" // that if we need to finish, fetch_row will have the right value.",
" DataValueDescriptor[] check_row_template = new DataValueDescriptor[1];",
" check_row_template[0] = fetch_row[0].cloneValue(false);",
" FetchDescriptor check_row_desc = RowUtil.getFetchDescriptorConstant(1);",
"",
" // reopen the scan for reading from the beginning of the table.",
" reopenScan(",
" (DataValueDescriptor[]) null,",
" ScanController.NA,",
" (Qualifier[][]) null,",
" (DataValueDescriptor[]) null,",
" ScanController.NA);",
"",
" BTreeRowPosition pos = scan_position;",
"",
" positionAtStartForForwardScan(pos);",
"",
" // At this point:",
" // current_page is latched. current_slot is the slot on current_page",
" // just before the \"next\" record this routine should process.",
"",
" // loop through successive leaf pages and successive slots on those",
" // leaf pages. Stop when either the last leaf is reached. At any",
" // time in the scan fetch_row will contain \"last\" non-deleted row",
" // seen.",
"",
" boolean nulls_not_reached = true;",
" leaf_loop:",
"\t\twhile ((pos.current_leaf != null) && nulls_not_reached)",
"\t\t{",
" slot_loop:",
"\t\t\twhile ((pos.current_slot + 1) < pos.current_leaf.page.recordCount())",
"\t\t\t{",
" // unlock the previous row if doing read.",
" if (pos.current_rh != null)",
" {",
" this.getLockingPolicy().unlockScanRecordAfterRead(",
" pos, init_forUpdate);",
"",
" // current_rh is used to track which row we need to unlock,",
" // at this point no row needs to be unlocked.",
" pos.current_rh = null;",
" }",
"",
" // move scan current position forward.",
" pos.current_slot++;",
" this.stat_numrows_visited++;",
"",
" // get current record handle for positioning but don't read",
" // data until we verify it is not deleted. rh is needed",
" // for repositioning if we lose the latch.",
" RecordHandle rh = ",
" pos.current_leaf.page.fetchFromSlot(",
" (RecordHandle) null,",
" pos.current_slot, ",
" check_row_template,",
" null,",
" true);",
"",
" // lock the row.",
" boolean latch_released =",
" !this.getLockingPolicy().lockScanRow(",
" this, this.getConglomerate(), pos,",
" init_lock_fetch_desc,",
" pos.current_lock_template,",
" pos.current_lock_row_loc,",
" false, init_forUpdate, lock_operation);",
"",
" // special test to see if latch release code works",
" if (SanityManager.DEBUG)",
" {",
" latch_released = ",
" test_errors(",
" this,",
" \"BTreeMaxScan_fetchNextGroup\", pos,",
" this.getLockingPolicy(),",
" pos.current_leaf, latch_released);",
" }",
"",
" // At this point we have successfully locked this record, so",
" // remember the record handle so that it can be unlocked if",
" // necessary. If the above lock deadlocks, we will not try",
" // to unlock a lock we never got in close(), because current_rh",
" // is null until after the lock is granted.",
" pos.current_rh = rh;",
"",
" if (latch_released)",
" {",
" // lost latch on page in order to wait for row lock.",
" // Call reposition() which will use the saved record",
" // handle to reposition to the same spot on the page.",
" // If the row is no longer on the page, reposition()",
" // will take care of searching the tree and position",
" // on the correct page.",
" if (!reposition(pos, false))",
" {",
" // Could not position on the exact same row that was",
" // saved, which means that it has been purged.",
" // Reposition on the row immediately to the left of",
" // the purged row instead.",
" if (!reposition(pos, true))",
" {",
" if (SanityManager.DEBUG)",
" {",
" SanityManager.THROWASSERT(",
" \"Cannot fail with 2nd param true\");",
" }",
" // reposition will set pos.current_leaf to null if",
" // it returns false, so if this ever does fail in",
" // delivered code, expect a NullPointerException at",
" // the top of this loop when we call recordCount().",
" }",
"",
" // Now we're positioned to the left of our saved",
" // position. Go to the top of the loop so that we move",
" // the scan to the next row and release the lock on",
" // the purged row.",
" continue slot_loop;",
" }",
" }",
"",
"",
" if (pos.current_leaf.page.isDeletedAtSlot(pos.current_slot))",
" {",
" this.stat_numdeleted_rows_visited++;",
"",
" if (check_row_template[0].isNull())",
" {",
" // nulls sort at high end and are not to be returned",
" // by max scan, so search is over, return whatever is",
" // in fetch_row.",
" nulls_not_reached = false;",
" break;",
" }",
" }",
" else if (check_row_template[0].isNull())",
" {",
" nulls_not_reached = false;",
" break;",
" }",
" else ",
" {",
"",
" pos.current_leaf.page.fetchFromSlot(",
" pos.current_rh,",
" pos.current_slot, fetch_row, init_fetchDesc,",
" true);",
"",
" stat_numrows_qualified++;",
" max_rh = pos.current_rh;",
" }",
"\t\t\t}",
"",
" // Move position of the scan to slot 0 of the next page. If there",
" // is no next page current_page will be null.",
" positionAtNextPage(pos);",
"",
" this.stat_numpages_visited++;",
"\t\t}",
"",
"",
" // Reached last leaf of tree.",
" positionAtDoneScan(pos);",
" // we need to decrement when we stop scan at the end of the table.",
" this.stat_numpages_visited--;",
" return(max_rh != null);",
"\t}"
]
},
{
"added": [
" * If no row found on last page, or could not find row without losing latch"
],
"header": "@@ -419,7 +264,7 @@ public class BTreeMaxScan extends BTreeScan",
"removed": [
" * If no row found on last page, or could not find row withou losing latch"
]
},
{
"added": [
" // In this case the \"next\" record is the last row on the rightmost"
],
"header": "@@ -478,7 +323,7 @@ public class BTreeMaxScan extends BTreeScan",
"removed": [
" // In this case teh \"next\" record is the last row on the rightmost"
]
},
{
"added": [
" leaf_loop:",
" while (!max_found && pos.current_leaf != null)",
" if (pos.current_slot <= 1)",
" {",
" // Reached beginning of this leaf page without finding a",
" // value, so move position to the end of the left sibling and",
" // resume the scan.",
" boolean latch_released = !moveToLeftSibling();",
"",
" if (latch_released)",
" {",
" // The previous page was latched by someone else, so we",
" // gave up the latch on this page to avoid running into a",
" // deadlock with someone scanning the leaves in the",
" // opposite direction.",
"",
" if (SanityManager.DEBUG)",
" {",
" SanityManager.DEBUG(",
" \"BTreeMaxScan.latchConflict\",",
" \"Couldn't get latch nowait, will retry\");",
" }",
"",
" if (pos.current_positionKey == null)",
" {",
" // We haven't seen any rows yet, so no position has",
" // been saved. See comment in moveToLeftSibling().",
" // Restart the scan from the rightmost leaf.",
" if (SanityManager.DEBUG)",
" {",
" SanityManager.DEBUG(",
" \"BTreeMaxScan.latchConflict\",",
" \"Restart scan from rightmost leaf\");",
" }",
" scan_state = SCAN_INIT;",
" positionAtStartPosition(pos);",
" }",
" else if (!reposition(pos, false))",
" {",
" if (SanityManager.DEBUG)",
" {",
" SanityManager.DEBUG(",
" \"BTreeMaxScan.latchConflict\",",
" \"Saved position is gone\");",
" }",
"",
" // The row on the saved position doesn't exist anymore,",
" // so it must have been purged. Move to the position",
" // immediately to the left of where the row should",
" // have been.",
" if (!reposition(pos, true))",
" {",
" if (SanityManager.DEBUG)",
" {",
" SanityManager.THROWASSERT(",
" \"Cannot fail with 2nd param true\");",
" }",
" }",
"",
" // reposition() will position to the left of the purged",
" // row, whereas we want to be on the right side of it",
" // since we're moving backwards.",
" pos.current_slot++;",
" }",
" }",
"",
" // We now have one of the following scenarios:",
" //",
" // 1) Current position is right after the last row on the left",
" // sibling page if we could move to the sibling page without",
" // waiting for a latch.",
" // 2) Current position is on the same row as the last one we",
" // looked at if we had to wait for a latch on the sibling",
" // page and the row hadn't been purged before we",
" // repositioned.",
" // 3) Current position is right after the position where we",
" // should have found the last row we looked at if we had",
" // to wait for a latch on the sibling page and the row was",
" // purged before we repositioned.",
" // 4) There is no current position if we already were at the",
" // leftmost leaf page.",
" //",
" // For scenarios 1-3, we're positioned immediately to the right",
" // of the next row we want to look at, so going to the top of",
" // the loop will make us move to the next interesting row. For",
" // scenario 4, we want to break out of the loop, which also",
" // is handled by going to the top of the loop and reevaluating",
" // the loop condition.",
" continue;",
" }",
""
],
"header": "@@ -487,8 +332,98 @@ public class BTreeMaxScan extends BTreeScan",
"removed": [
" if ((pos.current_slot - 1) > 0)"
]
},
{
"added": [
" // Had to wait on lock while not holding the latch, so now",
" // the current row may have been moved to another page and",
" // we need to reposition.",
" if (!reposition(pos, false))",
" {",
" // Could not position on the exact same row that was",
" // saved, which means that it has been purged.",
" // Reposition on the row immediately to the left of",
" // where the purged row should have been.",
" if (!reposition(pos, true))",
" {",
" if (SanityManager.DEBUG)",
" {",
" SanityManager.THROWASSERT(",
" \"Cannot fail with 2nd param true\");",
" }",
" }",
"",
" // Now we're positioned immediately to the left of our",
" // previous position. We want to be positioned to the",
" // right of that position so that we can restart the",
" // scan from where we were before we came to the row",
" // that disappeared for us. Adjust position one step",
" // to the right and continue from the top of the loop.",
" pos.current_slot++;",
" continue leaf_loop;",
" }"
],
"header": "@@ -524,10 +459,33 @@ public class BTreeMaxScan extends BTreeScan",
"removed": [
" // had to wait on lock while lost latch, now last page of",
" // index may have changed, give up on \"easy/fast\" max scan.",
" pos.current_leaf = null;",
" break;"
]
}
]
}
] |
derby-DERBY-642-9d9c1422
|
DERBY-642: SELECT MAX doesn't use indices optimally
Added test case to verify that serializable transactions will discover
that a new row with a higher value was inserted while the scan was
waiting for a lock.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1074196 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-642-e47817ab
|
DERBY-642: SELECT MAX doesn't use indices optimally
In the case of a WaitError, wait until the latch on the left sibling
has been released before repositioning. If the repositioning happens
earlier, it will just hit the same WaitError and the work will be
wasted.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1075248 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/store/access/btree/BTreeMaxScan.java",
"hunks": [
{
"added": [
" // position and let the caller retry. But first, let's save the",
" // page number of the left sibling so that we can try again to",
" // get the latch after we've saved the position.",
" long left = scan_position.current_leaf.getleftSiblingPageNumber();",
""
],
"header": "@@ -100,8 +100,11 @@ public class BTreeMaxScan extends BTreeScan",
"removed": [
" // position and let the caller retry.",
" //"
]
},
{
"added": [
" // There's no point in attempting to reposition too early, as we're",
" // likely to hit the same WaitError again (and again). So instead",
" // let's sleep here until the left sibling page has been released,",
" // and then return to let the caller reposition and retry.",
" Page leftPage = container.getPage(left);",
" if (leftPage != null) {",
" // Got the latch. Anything may have happened while we didn't",
" // hold any latches, so we don't know if we're still supposed",
" // to go to that page. Just release the latch and let the",
" // caller reposition to the right spot in the B-tree.",
" leftPage.unlatch();",
" leftPage = null;",
" }",
""
],
"header": "@@ -117,6 +120,20 @@ public class BTreeMaxScan extends BTreeScan",
"removed": []
}
]
}
] |
derby-DERBY-6421-35c061a6
|
DERBY-6421: Cast to UDT in CHECK constraint causes NPE or assert failure
Delay binding of target UDT in CastNode till bind time.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1548104 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/sql/compile/CastNode.java",
"hunks": [
{
"added": [
"",
" /** The original, unbound descriptor for the target type, if it is a UDT. */",
" private DataTypeDescriptor targetUDT;",
""
],
"header": "@@ -55,7 +55,10 @@ class CastNode extends ValueNode",
"removed": [
" "
]
},
{
"added": [
"",
" // DERBY-6421: setType() tries to bind user defined types. We don't",
" // want to do any binding here, since we could be called during",
" // parsing. If the target type is a UDT, just store it for now and",
" // do the binding later when bindExpression() or bindCastNodeOnly()",
" // is called.",
" if (castTarget.getTypeId().isUserDefinedTypeId()) {",
" targetUDT = castTarget;",
" } else {",
" setType(castTarget);",
" }"
],
"header": "@@ -99,7 +102,17 @@ class CastNode extends ValueNode",
"removed": [
" setType(castTarget);"
]
},
{
"added": [
" // Bind the target UDT.",
" if (targetUDT != null) {",
" setType(targetUDT);",
" }",
""
],
"header": "@@ -192,6 +205,11 @@ class CastNode extends ValueNode",
"removed": []
}
]
}
] |
derby-DERBY-6423-aaac214f
|
DERBY-6423: The expression syntax in CASE's THEN clause doesn't accept boolean value expression
Allow boolean value expressions in CASE and NULLIF expressions.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1592465 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-6429-070d37e3
|
DERBY-6429: Bring privilege checks on UPDATE statements into closer alignment with the SQL Standard; tests passed cleanly on derby-6429-01-af-privilegeFilters.diff.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1553197 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/iapi/sql/compile/Visitable.java",
"hunks": [
{
"added": [
"import java.util.List;",
""
],
"header": "@@ -21,6 +21,8 @@",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/iapi/sql/compile/VisitableFilter.java",
"hunks": [
{
"added": [
" Derby - Class org.apache.derby.iapi.sql.compile.VisitableFilter"
],
"header": "@@ -1,6 +1,6 @@",
"removed": [
" Derby - Class org.apache.derby.iapi.sql.compile.Visitable"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/CompilerContextImpl.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.sql.compile.Visitable;",
"import org.apache.derby.iapi.sql.compile.VisitableFilter;"
],
"header": "@@ -39,6 +39,8 @@ import org.apache.derby.shared.common.sanity.SanityManager;",
"removed": []
},
{
"added": [
" privilegeCheckFilters = null;"
],
"header": "@@ -140,6 +142,7 @@ public class CompilerContextImpl extends ContextImpl",
"removed": []
},
{
"added": [
" public void addPrivilegeFilter( VisitableFilter vf )",
" {",
" if ( privilegeCheckFilters == null ) { privilegeCheckFilters = new ArrayList<VisitableFilter>(); }",
" ",
" privilegeCheckFilters.add( vf );",
" }",
"",
" public void removePrivilegeFilter( VisitableFilter vf )",
" {",
" if ( (vf != null) && (privilegeCheckFilters != null) )",
" {",
" privilegeCheckFilters.remove( vf );",
" }",
" }",
"",
" public boolean passesPrivilegeFilters( Visitable visitable )",
" throws StandardException",
" {",
" // if there are no filters, then all QueryTreeNodes pass.",
" if ( privilegeCheckFilters == null ) { return true; }",
"",
" for ( VisitableFilter filter : privilegeCheckFilters )",
" {",
" if ( !filter.accept( visitable ) ) { return false; }",
" }",
"",
" return true;",
" }",
" "
],
"header": "@@ -969,6 +972,35 @@ public class CompilerContextImpl extends ContextImpl",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/FromBaseTable.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.sql.compile.TagFilter;"
],
"header": "@@ -49,6 +49,7 @@ import org.apache.derby.iapi.sql.compile.OptimizablePredicateList;",
"removed": []
},
{
"added": [
" if (isPrivilegeCollectionRequired()) {"
],
"header": "@@ -2386,7 +2387,7 @@ class FromBaseTable extends FromTable",
"removed": [
" if (rc.isPrivilegeCollectionRequired()) {"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/QueryTreeNode.java",
"hunks": [
{
"added": [
"import java.util.ArrayList;",
"import java.util.List;"
],
"header": "@@ -22,6 +22,8 @@",
"removed": []
},
{
"added": [
" private ArrayList<String> visitableTags;",
""
],
"header": "@@ -85,6 +87,8 @@ public abstract class QueryTreeNode implements Visitable",
"removed": []
},
{
"added": [
" throws StandardException",
" return",
" isPrivilegeCollectionRequired &&",
" getCompilerContext().passesPrivilegeFilters( this );"
],
"header": "@@ -572,8 +576,11 @@ public abstract class QueryTreeNode implements Visitable",
"removed": [
"\t\treturn(isPrivilegeCollectionRequired);"
]
},
{
"added": [
" public void addTag( String tag )",
" {",
" if ( visitableTags == null ) { visitableTags = new ArrayList<String>(); }",
" visitableTags.add( tag );",
" }",
"",
" public boolean taggedWith( String tag )",
" {",
" if ( visitableTags == null ) { return false; }",
" else { return visitableTags.contains( tag ); }",
" }",
"",
" /** Copy the tags from another QueryTreeNode */",
" protected void copyTagsFrom( QueryTreeNode that )",
" {",
" if ( that.visitableTags == null ) { return; }",
" else",
" {",
" for ( String tag : that.visitableTags ) { addTag( tag ); }",
" }",
" }",
" "
],
"header": "@@ -704,6 +711,28 @@ public abstract class QueryTreeNode implements Visitable",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/UpdateNode.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.sql.compile.CompilerContext;",
"import org.apache.derby.iapi.sql.compile.TagFilter;",
"import org.apache.derby.iapi.sql.dictionary.AliasDescriptor;"
],
"header": "@@ -37,8 +37,11 @@ import org.apache.derby.iapi.services.context.ContextManager;",
"removed": []
},
{
"added": [
"import org.apache.derby.iapi.types.DataTypeDescriptor;"
],
"header": "@@ -53,6 +56,7 @@ import org.apache.derby.iapi.sql.execute.ConstantAction;",
"removed": []
},
{
"added": [
" // collect lists of objects which will require privilege checks",
" ArrayList<String> explicitlySetColumns = getExplicitlySetColumns();",
" List<ValueNode> allValueNodes = collectAllValueNodes();",
" tagPrivilegedNodes();",
"",
" // tell the compiler to only add privilege checks for nodes which have been tagged",
" TagFilter tagFilter = new TagFilter( TagFilter.NEED_PRIVS_FOR_UPDATE_STMT );",
" getCompilerContext().addPrivilegeFilter( tagFilter );",
"\t\t"
],
"header": "@@ -191,6 +195,15 @@ public final class UpdateNode extends DMLModStatementNode",
"removed": []
},
{
"added": [
"",
" // add UPDATE_PRIV on all columns on the left side of SET operators",
" addUpdatePriv( explicitlySetColumns );",
""
],
"header": "@@ -257,7 +270,10 @@ public final class UpdateNode extends DMLModStatementNode",
"removed": [
"\t\t"
]
},
{
"added": [],
"header": "@@ -339,12 +355,10 @@ public final class UpdateNode extends DMLModStatementNode",
"removed": [
"\t\tgetCompilerContext().pushCurrentPrivType(getPrivType()); // Update privilege",
"\t\tgetCompilerContext().popCurrentPrivType();"
]
},
{
"added": [],
"header": "@@ -516,9 +530,7 @@ public final class UpdateNode extends DMLModStatementNode",
"removed": [
"\t\tgetCompilerContext().pushCurrentPrivType(getPrivType()); // Update privilege",
"\t\tgetCompilerContext().popCurrentPrivType();"
]
},
{
"added": [
"\t\tgetCompilerContext().popCurrentPrivType();",
"",
" // don't remove the privilege filter. additional binding may be",
" // done during the pre-processing phase",
"",
" addUDTUsagePriv( allValueNodes );"
],
"header": "@@ -603,7 +615,12 @@ public final class UpdateNode extends DMLModStatementNode",
"removed": [
"\t\tgetCompilerContext().popCurrentPrivType();\t\t"
]
}
]
}
] |
derby-DERBY-6432-dc3a0d79
|
DERBY-6434: Test case verifying that DERBY-6432 has been fixed; commit derby-6434-03-ac-testCaseForDerby-6432.diff.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1558398 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-6433-d1ad6c97
|
DERBY-6434: Don't make INSERT statements require USAGE privilege on the datatypes of generated columns; fix remaining problem described by DERBY-6433; commit derby-6434-04-aa-dontNeedPrivOnGeneratedColumnTypeForInsert.diff.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1558559 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/sql/compile/InsertNode.java",
"hunks": [
{
"added": [],
"header": "@@ -265,7 +265,6 @@ public final class InsertNode extends DMLModStatementNode",
"removed": [
" getCompilerContext().removePrivilegeFilter( ignorePermissions );"
]
}
]
}
] |
derby-DERBY-6434-3d2d88b7
|
DERBY-6434: Correct privileges required for INSERT statements; tests passed cleanly on derby-6434-01-ac-correctInsertPrivs.diff.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1556571 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/sql/compile/InsertNode.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.sql.compile.IgnoreFilter;"
],
"header": "@@ -33,6 +33,7 @@ import org.apache.derby.iapi.services.io.FormatableBitSet;",
"removed": []
},
{
"added": [
"\t\t** table or VTI. We don't bother adding any permission checks here",
" ** because they are assumed by INSERT permission on the table.",
" IgnoreFilter ignorePermissions = new IgnoreFilter();",
" getCompilerContext().addPrivilegeFilter( ignorePermissions );",
" getCompilerContext().removePrivilegeFilter( ignorePermissions );"
],
"header": "@@ -258,9 +259,13 @@ public final class InsertNode extends DMLModStatementNode",
"removed": [
"\t\t** table or VTI."
]
},
{
"added": [
"\t\t\t}\t",
" }"
],
"header": "@@ -286,9 +291,9 @@ public final class InsertNode extends DMLModStatementNode",
"removed": [
"\t\t\t}",
"\t\t}"
]
},
{
"added": [
" //",
" // At this point, we have added permissions checks for the driving query.",
" // Now add a check for INSERT privilege on the target table.",
" //",
" if (isPrivilegeCollectionRequired())",
" {",
" getCompilerContext().pushCurrentPrivType( getPrivType());",
" getCompilerContext().addRequiredTablePriv( targetTableDescriptor );",
" getCompilerContext().popCurrentPrivType();",
" }",
"",
" // Now stop adding permissions checks.",
" getCompilerContext().addPrivilegeFilter( ignorePermissions );",
""
],
"header": "@@ -332,6 +337,20 @@ public final class InsertNode extends DMLModStatementNode",
"removed": []
}
]
}
] |
derby-DERBY-6434-9a9d6589
|
DERBY-6434: Don't require privileges implicitly added by SELECT-driven INSERTS; tests passed cleanly on derby-6434-05-aa-selectDrivenInserts.diff.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1573686 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/sql/compile/SelectNode.java",
"hunks": [
{
"added": [
" //",
" // Don't add USAGE privilege on user-defined types.",
" //",
" boolean wasSkippingTypePrivileges = getCompilerContext().skipTypePrivileges( true );",
" "
],
"header": "@@ -517,6 +517,11 @@ class SelectNode extends ResultSetNode",
"removed": []
}
]
}
] |
derby-DERBY-6434-d1ad6c97
|
DERBY-6434: Don't make INSERT statements require USAGE privilege on the datatypes of generated columns; fix remaining problem described by DERBY-6433; commit derby-6434-04-aa-dontNeedPrivOnGeneratedColumnTypeForInsert.diff.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1558559 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/sql/compile/InsertNode.java",
"hunks": [
{
"added": [],
"header": "@@ -265,7 +265,6 @@ public final class InsertNode extends DMLModStatementNode",
"removed": [
" getCompilerContext().removePrivilegeFilter( ignorePermissions );"
]
}
]
}
] |
derby-DERBY-6434-dc3a0d79
|
DERBY-6434: Test case verifying that DERBY-6432 has been fixed; commit derby-6434-03-ac-testCaseForDerby-6432.diff.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1558398 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-6434-fc9fd0d2
|
DERBY-6434: Correct privilege checks for DELETE statements; commit derby-6434-02-ac-correctDeletePrivs.diff.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1558387 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/iapi/sql/compile/CompilerContext.java",
"hunks": [
{
"added": [
" public static final String WHERE_SCOPE = \"whereScope\";",
" "
],
"header": "@@ -132,6 +132,8 @@ public interface CompilerContext extends Context",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/CompilerContextImpl.java",
"hunks": [
{
"added": [
" private static final int SCOPE_CELL = 0;",
" "
],
"header": "@@ -78,6 +78,8 @@ import org.apache.derby.iapi.util.ReuseFactory;",
"removed": []
},
{
"added": [
" namedScopes = null;"
],
"header": "@@ -143,6 +145,7 @@ public class CompilerContextImpl extends ContextImpl",
"removed": []
},
{
"added": [
" public void beginScope( String scopeName )",
" {",
" if ( namedScopes == null ) { namedScopes = new HashMap<String,int[]>(); }",
" ",
" int[] scopeDepth = namedScopes.get( scopeName );",
" if ( scopeDepth == null )",
" {",
" scopeDepth = new int[ SCOPE_CELL + 1 ];",
" namedScopes.put( scopeName, scopeDepth );",
" }",
"",
" scopeDepth[ SCOPE_CELL ]++;",
" }",
" ",
" public void endScope( String scopeName )",
" {",
" if ( namedScopes == null ) { return; }",
"",
" int[] scopeDepth = namedScopes.get( scopeName );",
" if ( scopeDepth == null ) { return; }",
"",
" scopeDepth[ SCOPE_CELL ]--;",
"",
" if ( scopeDepth[ SCOPE_CELL ] <= 0 ) { namedScopes.remove( scopeName ); }",
" }",
"",
" public int scopeDepth( String scopeName )",
" {",
" if ( namedScopes == null ) { return 0; }",
"",
" int[] scopeDepth = namedScopes.get( scopeName );",
" if ( scopeDepth == null ) { return 0; }",
" else { return scopeDepth[ SCOPE_CELL ]; }",
" }",
"",
"",
"\t** Context state must be reset in resetContext()"
],
"header": "@@ -1001,8 +1004,44 @@ public class CompilerContextImpl extends ContextImpl",
"removed": [
"\t** Context state must be reset in restContext()"
]
},
{
"added": [
" private ArrayList<VisitableFilter> privilegeCheckFilters;",
" private HashMap<String,int[]> namedScopes;"
],
"header": "@@ -1024,6 +1063,8 @@ public class CompilerContextImpl extends ContextImpl",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/DeleteNode.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.sql.compile.CompilerContext;",
"import org.apache.derby.iapi.sql.compile.IgnoreFilter;",
"import org.apache.derby.iapi.sql.compile.ScopeFilter;"
],
"header": "@@ -40,6 +40,9 @@ import org.apache.derby.iapi.services.io.FormatableProperties;",
"removed": []
},
{
"added": [
" //",
" // Don't add privilege requirements for the UDT types of columns.",
" // The compiler will attempt to add these when generating the full column list during",
" // binding of the tables.",
" //",
" IgnoreFilter ignorePermissions = new IgnoreFilter();",
" getCompilerContext().addPrivilegeFilter( ignorePermissions );",
" "
],
"header": "@@ -137,6 +140,14 @@ class DeleteNode extends DMLModStatementNode",
"removed": []
},
{
"added": [
" // done excluding column types from privilege checking",
" getCompilerContext().removePrivilegeFilter( ignorePermissions );",
"",
"",
" // only add privileges when we're inside the WHERE clause",
" ScopeFilter scopeFilter = new ScopeFilter( getCompilerContext(), CompilerContext.WHERE_SCOPE, 1 );",
" getCompilerContext().addPrivilegeFilter( scopeFilter );",
" //",
" // Don't remove the WHERE scopeFilter. Pre-processing may try to",
" // add other privileges which we don't need.",
" //",
""
],
"header": "@@ -277,9 +288,21 @@ class DeleteNode extends DMLModStatementNode",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/SelectNode.java",
"hunks": [
{
"added": [
" cc.beginScope( CompilerContext.WHERE_SCOPE );"
],
"header": "@@ -590,6 +590,7 @@ class SelectNode extends ResultSetNode",
"removed": []
}
]
}
] |
derby-DERBY-6437-abd7a122
|
DERBY-6437; ConstraintCharachteristicsTest testLockingWithRollback or testLockingWithCommit failing on trunk with AssertionFailedError - isolation levels ...
adjusting the derby.locks.waitTimeout.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1563032 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-6440-b412f102
|
DERBY-6440: Drop connection to foreign database when foreignViews optional tool is unloaded.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1553269 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/tools/org/apache/derby/impl/tools/optional/ForeignDBViews.java",
"hunks": [
{
"added": [
"import org.apache.derby.vti.ForeignTableVTI;"
],
"header": "@@ -34,6 +34,7 @@ import org.apache.derby.iapi.sql.dictionary.OptionalTool;",
"removed": []
},
{
"added": [
"",
" // now drop the connection to the foreign database",
" ForeignTableVTI.dropConnection( foreignConnectionURL );"
],
"header": "@@ -171,6 +172,9 @@ public\tclass ForeignDBViews implements OptionalTool",
"removed": []
}
]
}
] |
derby-DERBY-6441-acbecbb9
|
DERBY-6441: Add ORDER BY clauses to a number of queries in GrantRevokeDDLTest in order to force deterministic results; checks in derby-6441-01-addOrderByClauses.diff.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1553280 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.