id
stringlengths
22
25
commit_message
stringlengths
137
6.96k
diffs
listlengths
0
63
derby-DERBY-6629-aba4ea11
DERBY-6629: Restrict privileged operation in CreateXMLFile Remove the privileged operation in the CreateXMLFile class. Instead, let the caller do the privileged operation and pass in a Writer object that CreateXMLFile can write the file to. Make the tests invoke the plan exporter tool via its main class instead of calling the internal API. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1605021 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/tools/org/apache/derby/impl/tools/planexporter/CreateXMLFile.java", "hunks": [ { "added": [], "header": "@@ -21,14 +21,8 @@", "removed": [ "import java.io.BufferedWriter;", "import java.io.FileOutputStream;", "import java.io.OutputStreamWriter;", "import java.security.AccessController;", "import java.security.PrivilegedActionException;", "import java.security.PrivilegedExceptionAction;" ] }, { "added": [ " * @param out where to write the XML file", " Writer out, String xsl_sheet_name)" ], "header": "@@ -46,15 +40,12 @@ public class CreateXMLFile {", "removed": [ " * @param data large xml data string array", " * @param file_name name of the file to be written", " * @throws PrivilegedActionException", " * @throws PrivilegedActionException", " TreeNode[] data, final String file_name, String xsl_sheet_name)" ] }, { "added": [], "header": "@@ -68,20 +59,6 @@ public class CreateXMLFile {", "removed": [ " FileOutputStream fos;", " try {", " fos = AccessController.doPrivileged(", " new PrivilegedExceptionAction<FileOutputStream>() {", " public FileOutputStream run() throws IOException {", " return new FileOutputStream(file_name);", " }", " });", " } catch (PrivilegedActionException pae) {", " throw (IOException) pae.getCause();", " }", "", " Writer out = new BufferedWriter(new OutputStreamWriter(fos, \"UTF-8\"));", "" ] } ] }, { "file": "java/tools/org/apache/derby/tools/PlanExporter.java", "hunks": [ { "added": [ "import java.io.FileOutputStream;", "import java.io.IOException;", "import java.io.OutputStreamWriter;", "import java.io.Writer;", "import java.security.PrivilegedActionException;", "import java.security.PrivilegedExceptionAction;" ], "header": "@@ -22,7 +22,13 @@", "removed": [] }, { "added": [ " * @throws IOException if an error occurs when writing the XML file", " String arg, String stmt, String time, String xsl)", " throws IOException {", " final String fileName = arg.toUpperCase().endsWith(\".XML\")", " ? arg : (arg + \".xml\");", "", " Writer out;", " try {", " out = AccessController.doPrivileged(", " new PrivilegedExceptionAction<Writer>() {", " @Override", " public Writer run() throws IOException {", " return new OutputStreamWriter(", " new FileOutputStream(fileName), \"UTF-8\");", " }", " });", " } catch (PrivilegedActionException pae) {", " throw (IOException) pae.getCause();", "", " try {", " xmlFile.writeTheXMLFile(stmt, time, out, xsl);", " } finally {", " out.close();" ], "header": "@@ -225,22 +231,34 @@ public class PlanExporter {", "removed": [ " * @throws Exception", " String arg, String stmt, String time, String xsl) throws Exception{", " if(arg.toUpperCase().endsWith(\".XML\")){", " xmlFile.writeTheXMLFile(stmt, time,", " access.getData(),", " arg, xsl);", " else{", " xmlFile.writeTheXMLFile(stmt, time,", " access.getData(),", " arg.concat(\".xml\"),", " xsl);" ] } ] } ]
derby-DERBY-6630-b1008f38
DERBY-6630: Reduce visibility of JCECipherFactory and protect it with the usederbyinternals permission; tests passed cleanly on derby-6630-01-aa-usederbyinternals.diff. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1628206 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/services/jce/JCECipherFactory.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.security.SecurityUtil;" ], "header": "@@ -21,6 +21,7 @@", "removed": [] }, { "added": [ "final class JCECipherFactory implements CipherFactory" ], "header": "@@ -60,7 +61,7 @@ import org.apache.derby.io.StorageRandomAccessFile;", "removed": [ "public final class JCECipherFactory implements CipherFactory" ] } ] } ]
derby-DERBY-6631-e7deac45
DERBY-6631: FileMonitor can be used to elevate an application's privileges Don't elevate privileges in the setThreadPriority() method. Instead, let the callers use doPrivileges() themselves. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1620534 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/services/daemon/BasicDaemon.java", "hunks": [ { "added": [ "import java.security.AccessController;", "import java.security.PrivilegedAction;" ], "header": "@@ -31,6 +31,8 @@ import org.apache.derby.shared.common.sanity.SanityManager;", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/services/monitor/FileMonitor.java", "hunks": [ { "added": [], "header": "@@ -38,7 +38,6 @@ import org.apache.derby.iapi.services.info.ProductGenusNames;", "removed": [ "import org.apache.derby.shared.common.sanity.SanityManager;" ] }, { "added": [], "header": "@@ -298,15 +297,6 @@ public final class FileMonitor extends BaseMonitor", "removed": [ "\tpublic final void setThreadPriority(final int priority) {", " AccessController.doPrivileged(new PrivilegedAction<Object>() {", " public Object run() {", " FileMonitor.super.setThreadPriority(priority);", " return null;", " }", " });", "\t}", "" ] } ] } ]
derby-DERBY-6634-7139f7c7
DERBY-6634: Improve test coverage of SqlXmlUtil.java Remove impossible code paths so that they don't show up as untested code. In particular: - Remove some unnecessary null tests. The callers already make sure that the arguments cannot be null, so it's better to skip the checks so that potential future bugs get reported as NPEs instead of being silently ignored. - Remove code that serializes lists of atomic values. Derby only supports queries that return single atomic values. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1607017 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/types/SqlXmlUtil.java", "hunks": [ { "added": [ "import java.io.StringWriter;" ], "header": "@@ -33,6 +33,7 @@ import java.util.List;", "removed": [] }, { "added": [ " Document doc;" ], "header": "@@ -298,7 +299,7 @@ public class SqlXmlUtil", "removed": [ " ArrayList<Document> aList = new ArrayList<Document>();" ] }, { "added": [ " doc = java.security.AccessController.doPrivileged(", " });" ], "header": "@@ -311,14 +312,14 @@ public class SqlXmlUtil", "removed": [ " aList.add(java.security.AccessController.doPrivileged(", " }));" ] }, { "added": [ " return serializeToString(Collections.singletonList(doc), null);" ], "header": "@@ -342,7 +343,7 @@ public class SqlXmlUtil", "removed": [ " return serializeToString(aList, null);" ] }, { "added": [ " * @param items List of items to serialize. It should either be", " * a list of a single string value (in case it's the result of", " * an XMLQUERY operation that returns an atomic value), or a list", " * of zero or more Node objects." ], "header": "@@ -360,7 +361,10 @@ public class SqlXmlUtil", "removed": [ " * @param items List of items to serialize" ] }, { "added": [ " // If we have an empty sequence, return an empty value immediately.", " if (items.isEmpty()) {", " // If it contains a single string, just return that string.", " if (items.size() == 1 && items.get(0) instanceof String) {", " return (String) items.get(0);", " }", "", " // Otherwise, it's a non-empty list of Node objects.", "", " StringWriter sWriter = new StringWriter();" ], "header": "@@ -372,12 +376,19 @@ public class SqlXmlUtil", "removed": [ " if ((items == null) || items.isEmpty()) {", " // nothing to do; return empty sequence.", " java.io.StringWriter sWriter = new java.io.StringWriter();" ] }, { "added": [ " if (obj instanceof Attr)" ], "header": "@@ -386,45 +397,10 @@ public class SqlXmlUtil", "removed": [ " /* Step 1: Empty sequence. If we have an empty sequence then we", " * won't ever enter the for loop and the call to sWriter.toString()", " * at the end of this method will return an empty string, as", " * required. Otherwise, for a non-empty sequence our \"items\"", " * list already corresponds to \"S1\".", " */", "", " boolean lastItemWasString = false;", " // if it's a string, then this corresponds to some atomic", " // value, so just echo the string as it is.", " if (obj instanceof String)", " {", " /* Step 2: Atomic values. If \"obj\" is a string then it", " * corresponds to some atomic value whose \"lexical", " * representation\" is obj. So we just take that.", " */", "", " if (lastItemWasString)", " {", " /* Step 3: Adjacent strings. If we have multiple adjacent", " * strings then concatenate them with a single space", " * between them.", " */", " sWriter.write(\" \");", " }", "", " /* Step 4: Create a Text node from the adjacent strings.", " * Since we're just going to serialize the Text node back", " * into a string, we short-cut this step by skipping the", " * creation of the Text node and just writing the string", " * out directly to our serialized stream.", " */", " sWriter.write((String)obj);", " lastItemWasString = true;", " }", " else if (obj instanceof Attr)" ] }, { "added": [ " xmlVal.markAsHavingTopLevelAttr();" ], "header": "@@ -453,11 +429,9 @@ public class SqlXmlUtil", "removed": [ " if (xmlVal != null)", " xmlVal.markAsHavingTopLevelAttr();", " lastItemWasString = false;" ] }, { "added": [], "header": "@@ -493,8 +467,6 @@ public class SqlXmlUtil", "removed": [ "", " lastItemWasString = false;" ] } ] } ]
derby-DERBY-6634-cc2990dc
DERBY-6634: Improve test coverage of SqlXmlUtil.java Add missing test cases for: - XMLQUERY that returns an atomic boolean - XMLEXISTS where the query returns an atomic value git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1605287 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-6634-ed7f8b90
DERBY-6634: Improve test coverage of SqlXmlUtil.java Remove dead code from the time when SqlXmlUtil implemented the Formatable interface (before DERBY-3870). git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1605285 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/types/SqlXmlUtil.java", "hunks": [ { "added": [], "header": "@@ -128,12 +128,6 @@ public class SqlXmlUtil", "removed": [ " // Used to recompile the XPath expression when this formatable", " // object is reconstructed. e.g.: SPS ", " private String queryExpr;", " private String opName;", " private boolean recompileQuery;", "" ] }, { "added": [], "header": "@@ -266,10 +260,6 @@ public class SqlXmlUtil", "removed": [ " this.queryExpr = queryExpr;", " this.opName = opName;", " this.recompileQuery = false;", "" ] }, { "added": [], "header": "@@ -552,12 +542,6 @@ public class SqlXmlUtil", "removed": [ " // if this object is in an SPS, we need to recompile the query", " if (recompileQuery)", " {", " \tcompileXQExpr(queryExpr, opName);", " }", "" ] } ] } ]
derby-DERBY-6635-c670aa44
DERBY-6635: Prevent the optimizerTracing optional tool from writing its output over an existing file; commit derby-6635-01-ab-noOverwrite.diff. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1629192 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/compile/OptimizerTracer.java", "hunks": [ { "added": [ "import java.io.File;", "import java.security.PrivilegedExceptionAction;", "import org.apache.derby.iapi.error.PublicAPI;", "import org.apache.derby.iapi.error.StandardException;" ], "header": "@@ -21,12 +21,16 @@", "removed": [] }, { "added": [ " new PrivilegedExceptionAction<PrintWriter>()", " public PrintWriter run() throws SQLException", " String fileName = configurationParameters[ 0 ];", " File outputFile = new File( fileName );", "", " if ( outputFile.exists() )", " {", " throw PublicAPI.wrapStandardException", " (", " StandardException.newException( SQLState.DATA_FILE_EXISTS, fileName )", " );", " }", " ", " return new PrintWriter( outputFile );" ], "header": "@@ -152,12 +156,23 @@ public\tclass OptimizerTracer implements OptionalTool", "removed": [ " new PrivilegedAction<PrintWriter>()", " public PrintWriter run()", " return new PrintWriter( configurationParameters[ 0 ] );" ] } ] }, { "file": "java/testing/org/apache/derbyTesting/junit/SupportFilesSetup.java", "hunks": [ { "added": [ " deleteFile( new File(fileName) );", " }", "", " public static void deleteFile(final File file ) ", " {", " if (PrivilegedFileOpsForTests.exists(file)) {", " assertTrue(PrivilegedFileOpsForTests.delete(file));" ], "header": "@@ -298,9 +298,13 @@ public class SupportFilesSetup extends TestSetup {", "removed": [ " File f = new File(fileName);", " if (PrivilegedFileOpsForTests.exists(f)) {", " assertTrue(PrivilegedFileOpsForTests.delete(f));" ] } ] } ]
derby-DERBY-6636-d7a318a4
DERBY-6636: Prevent blackhats from creating a BaseDataFileFactory; tests passed cleanly for me on derby-6636-01-aa-usederbyinternals.diff. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1628256 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/store/raw/data/BaseDataFileFactory.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.security.SecurityUtil;" ], "header": "@@ -23,7 +23,7 @@ package org.apache.derby.impl.store.raw.data;", "removed": [ "" ] } ] } ]
derby-DERBY-6638-a516dd2c
DERBY-6638 Remove unnecessary use of reflection in SignatureChecker Remove the reflection + some missing javadocs and IDE warning fixes. Removes unused argument from method "checkSignature", and changes all StringBuilder usage to avoid concatenation. I tested the tool manually for a simple case, but see DERBY-6639. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1605738 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/tools/org/apache/derby/tools/SignatureChecker.java", "hunks": [ { "added": [ "import java.sql.DriverManager;" ], "header": "@@ -21,14 +21,13 @@", "removed": [ "import java.lang.reflect.Method;", "" ] }, { "added": [ " private final ParsedArgs _parsedArgs;", " private final ArrayList<SQLRoutine> _procedures = new ArrayList<SQLRoutine>();", " private final ArrayList<SQLRoutine> _functions = new ArrayList<SQLRoutine>();", " private final boolean _debugging = false;" ], "header": "@@ -79,12 +78,12 @@ public class SignatureChecker", "removed": [ " private ParsedArgs _parsedArgs;", " private ArrayList<SQLRoutine> _procedures = new ArrayList<SQLRoutine>();", " private ArrayList<SQLRoutine> _functions = new ArrayList<SQLRoutine>();", " private boolean _debugging = false;" ] }, { "added": [], "header": "@@ -142,7 +141,6 @@ public class SignatureChecker", "removed": [ " return;" ] }, { "added": [ " } catch (SQLException t) { printThrowable( t ); }", " * @param conn This connection", " * @throws java.sql.SQLException" ], "header": "@@ -151,13 +149,15 @@ public class SignatureChecker", "removed": [ " } catch (Throwable t) { printThrowable( t ); }" ] }, { "added": [ " * @param conn The connection to use to access the database", " * @throws java.sql.SQLException" ], "header": "@@ -170,6 +170,8 @@ public class SignatureChecker", "removed": [] }, { "added": [ " StringBuilder buffer = new StringBuilder();" ], "header": "@@ -190,7 +192,7 @@ public class SignatureChecker", "removed": [ " StringBuffer buffer = new StringBuffer();" ] }, { "added": [ " checkSignature( conn, buffer.toString(), makeReadableSignature( procedure ) );" ], "header": "@@ -203,7 +205,7 @@ public class SignatureChecker", "removed": [ " checkSignature( conn, procedure, buffer.toString(), makeReadableSignature( procedure ) );" ] }, { "added": [ " * @param conn The connection to use to access the database", " * @throws java.sql.SQLException" ], "header": "@@ -211,6 +213,8 @@ public class SignatureChecker", "removed": [] }, { "added": [ " StringBuilder query = new StringBuilder();" ], "header": "@@ -231,7 +235,7 @@ public class SignatureChecker", "removed": [ " StringBuffer query = new StringBuffer();" ] }, { "added": [ " checkSignature( conn, query.toString(), makeReadableSignature( function ) );" ], "header": "@@ -247,7 +251,7 @@ public class SignatureChecker", "removed": [ " checkSignature( conn, function, query.toString(), makeReadableSignature( function ) );" ] }, { "added": [ " * @param routine the routine for which we want a signature", " * @return human readable string", " StringBuilder signature = new StringBuilder();" ], "header": "@@ -256,10 +260,12 @@ public class SignatureChecker", "removed": [ " StringBuffer signature = new StringBuffer();" ] }, { "added": [ " signature.append( \" \" );", " signature.append( routine.getArgType( k ) );", " signature.append( \" \" );" ], "header": "@@ -267,7 +273,9 @@ public class SignatureChecker", "removed": [ " signature.append( \" \" + routine.getArgType( k ) + \" \" );" ] }, { "added": [ " * @param dbmd the database metadata of the database", " * @throws java.sql.SQLException" ], "header": "@@ -278,6 +286,8 @@ public class SignatureChecker", "removed": [] }, { "added": [ " * Count up the arguments to the user-coded procedures in", " * {@link #_procedures} and update that data structure accordingly", " * @param dbmd the database metadata of the database", " * @throws java.sql.SQLException" ], "header": "@@ -298,8 +308,11 @@ public class SignatureChecker", "removed": [ " * Count up the arguments to the user-coded procedures." ] }, { "added": [ " * the JSR169 api for DatabaseMetaData. Update {@link #_functions}.", " * @param dbmd the database metadata of the database", " * @throws java.sql.SQLException", " ResultSet rs = dbmd.getFunctions(null, null, WILDCARD);" ], "header": "@@ -323,17 +336,16 @@ public class SignatureChecker", "removed": [ " * the JSR169 api for DatabaseMetaData.", " Method getFunctionsMethod = dbmd.getClass().getMethod", " ( \"getFunctions\", new Class[] { String.class, String.class, String.class } );", " ResultSet rs = (ResultSet) getFunctionsMethod.invoke", " ( dbmd, new Object[] { null, null, WILDCARD } );" ] }, { "added": [ " boolean isTableFunction =", " functionType == DatabaseMetaData.functionReturnsTable;", " } catch (SQLException e) { throw new SQLException( e.getMessage() ); }" ], "header": "@@ -343,16 +355,15 @@ public class SignatureChecker", "removed": [ " boolean isTableFunction;", " if ( functionType == DatabaseMetaData.functionReturnsTable ) { isTableFunction = true; }", " else { isTableFunction = false; }", " } catch (Exception e) { throw new SQLException( e.getMessage() ); }" ] }, { "added": [ " * Update {@link #_functions}.", " * @param dbmd the database metadata of the database", " * @throws java.sql.SQLException", " int count = _functions.size();", " for ( int i = 0; i < count; i++ )", " {", " SQLRoutine function = getFunction( i );", " ResultSet rs = dbmd.getFunctionColumns(", " null, function.getSchema(), function.getName(), WILDCARD);", " while( rs.next() )", " short columnType = rs.getShort( 5 );", "", " //", " // Skip the return value if this is a table function.", " // Skip all columns in the returned result set if this is a", " // table function.", " //", " if ( columnType == DatabaseMetaData.functionReturn ) { continue; }", " if ( columnType == DatabaseMetaData.functionColumnResult ) { continue; }", "", " function.addArg( rs.getString( 7 ) );", " rs.close();", " }", " * @param conn The connection to the database", " * @param query The SQL to prepare", " * @param readableSignature the signature: printed if prepare fails", " private void checkSignature( Connection conn, String query, String readableSignature )" ], "header": "@@ -360,49 +371,48 @@ public class SignatureChecker", "removed": [ " try {", " Method getFunctionColumnsMethod = dbmd.getClass().getMethod", " ( \"getFunctionColumns\", new Class[] { String.class, String.class, String.class, String.class } );", " int count = _functions.size();", " for ( int i = 0; i < count; i++ )", " SQLRoutine function = getFunction( i );", "", " ResultSet rs = (ResultSet) getFunctionColumnsMethod.invoke", " ( dbmd, new Object[] { null, function.getSchema(), function.getName(), WILDCARD } );", "", " while( rs.next() )", " {", " short columnType = rs.getShort( 5 );", "", " //", " // Skip the return value if this is a table function.", " // Skip all columns in the returned result set if this is a", " // table function.", " //", " if ( columnType == DatabaseMetaData.functionReturn ) { continue; }", " if ( columnType == DatabaseMetaData.functionColumnResult ) { continue; }", " ", " function.addArg( rs.getString( 7 ) );", " }", " rs.close();", " } catch (Exception e) { throw new SQLException( e.getMessage() ); }", " ", " private void checkSignature( Connection conn, SQLRoutine routine, String query, String readableSignature )" ] }, { "added": [ " *", " * @return a connection to the database", " * @throws java.sql.SQLException" ], "header": "@@ -427,6 +437,9 @@ public class SignatureChecker", "removed": [] }, { "added": [ " Class.forName( \"java.sql.DriverManager\" );", " } catch (ClassNotFoundException t) {}", " return DriverManager.getConnection(", " _parsedArgs.getJ2seConnectionUrl() );", " } catch (SQLException t)" ], "header": "@@ -434,17 +447,15 @@ public class SignatureChecker", "removed": [ " } catch (Throwable t) {}", " Class<?> driverManagerClass = Class.forName( \"java.sql.DriverManager\" );", " Method getConnectionMethod = driverManagerClass.getDeclaredMethod", " ( \"getConnection\", String.class );", " return (Connection) getConnectionMethod.invoke", " ( null, new Object[] { _parsedArgs.getJ2seConnectionUrl() } );", " } catch (Throwable t)" ] }, { "added": [ " @SuppressWarnings(\"CallToPrintStackTrace\")" ], "header": "@@ -464,6 +475,7 @@ public class SignatureChecker", "removed": [] }, { "added": [ " * @param schema the schema to check", " * @return {@code true} if the schema is a system schema" ], "header": "@@ -476,6 +488,8 @@ public class SignatureChecker", "removed": [] }, { "added": [ " * Store a procedure descriptor. Updates {@link #_procedures}.", " * @param schema schema of the procedure", " * @param name of a procedure" ], "header": "@@ -490,7 +504,9 @@ public class SignatureChecker", "removed": [ " * Store a procedure descriptor." ] }, { "added": [ " * Get a procedure descriptor from {@link #_procedures}.", " * @param idx The index of the procedure in {@link #_procedures}.", " * @return a procedure descriptor" ], "header": "@@ -498,7 +514,9 @@ public class SignatureChecker", "removed": [ " * Get a procedure descriptor." ] }, { "added": [ " * Store a function descriptor. Updates {@link #_functions}.", " *", " * @param schema The schema of the function", " * @param name The name of the function", " * @param isTableFunction {@code true} iff the function is a table function" ], "header": "@@ -506,7 +524,11 @@ public class SignatureChecker", "removed": [ " * Store a function descriptor." ] }, { "added": [ " * Get a function descriptor from {@link #_functions}", " * .", " * @param idx The index of the procedure in {@link #_functions}.", " * @return a function descriptor" ], "header": "@@ -514,7 +536,10 @@ public class SignatureChecker", "removed": [ " * Get a functon descriptor." ] }, { "added": [ " *", " * @param key The message key by which we located the localized text", " * @param args Any arguments to the localized text to be filled in", " * @return A localized message" ], "header": "@@ -523,6 +548,10 @@ public class SignatureChecker", "removed": [] }, { "added": [ " *", " * @return localized resource" ], "header": "@@ -531,6 +560,8 @@ public class SignatureChecker", "removed": [] }, { "added": [ " private final String _schema;", " private final String _name;", " private final boolean _isTableFunction;", " private final ArrayList<String> _argList = new ArrayList<String>();" ], "header": "@@ -576,10 +607,10 @@ public class SignatureChecker", "removed": [ " private String _schema;", " private String _name;", " private boolean _isTableFunction;", " private ArrayList<String> _argList = new ArrayList<String>();" ] }, { "added": [ " @Override", " StringBuilder buffer = new StringBuilder();", " buffer.append( _schema );", " buffer.append( \", \" );", " buffer.append( _name );", " buffer.append( \", \" );", " buffer.append( \"isTableFunction = \" );", " buffer.append( _isTableFunction );", " buffer.append( \", \" );", " buffer.append( \" argCount = \" );", " buffer.append( getArgCount() );" ], "header": "@@ -596,15 +627,21 @@ public class SignatureChecker", "removed": [ " StringBuffer buffer = new StringBuffer();", " buffer.append( _schema + \", \" );", " buffer.append( _name + \", \" );", " buffer.append( \"isTableFunction = \" + _isTableFunction + \", \" );", " buffer.append( \" argCount = \" + getArgCount() );" ] } ] } ]
derby-DERBY-6639-a516dd2c
DERBY-6638 Remove unnecessary use of reflection in SignatureChecker Remove the reflection + some missing javadocs and IDE warning fixes. Removes unused argument from method "checkSignature", and changes all StringBuilder usage to avoid concatenation. I tested the tool manually for a simple case, but see DERBY-6639. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1605738 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/tools/org/apache/derby/tools/SignatureChecker.java", "hunks": [ { "added": [ "import java.sql.DriverManager;" ], "header": "@@ -21,14 +21,13 @@", "removed": [ "import java.lang.reflect.Method;", "" ] }, { "added": [ " private final ParsedArgs _parsedArgs;", " private final ArrayList<SQLRoutine> _procedures = new ArrayList<SQLRoutine>();", " private final ArrayList<SQLRoutine> _functions = new ArrayList<SQLRoutine>();", " private final boolean _debugging = false;" ], "header": "@@ -79,12 +78,12 @@ public class SignatureChecker", "removed": [ " private ParsedArgs _parsedArgs;", " private ArrayList<SQLRoutine> _procedures = new ArrayList<SQLRoutine>();", " private ArrayList<SQLRoutine> _functions = new ArrayList<SQLRoutine>();", " private boolean _debugging = false;" ] }, { "added": [], "header": "@@ -142,7 +141,6 @@ public class SignatureChecker", "removed": [ " return;" ] }, { "added": [ " } catch (SQLException t) { printThrowable( t ); }", " * @param conn This connection", " * @throws java.sql.SQLException" ], "header": "@@ -151,13 +149,15 @@ public class SignatureChecker", "removed": [ " } catch (Throwable t) { printThrowable( t ); }" ] }, { "added": [ " * @param conn The connection to use to access the database", " * @throws java.sql.SQLException" ], "header": "@@ -170,6 +170,8 @@ public class SignatureChecker", "removed": [] }, { "added": [ " StringBuilder buffer = new StringBuilder();" ], "header": "@@ -190,7 +192,7 @@ public class SignatureChecker", "removed": [ " StringBuffer buffer = new StringBuffer();" ] }, { "added": [ " checkSignature( conn, buffer.toString(), makeReadableSignature( procedure ) );" ], "header": "@@ -203,7 +205,7 @@ public class SignatureChecker", "removed": [ " checkSignature( conn, procedure, buffer.toString(), makeReadableSignature( procedure ) );" ] }, { "added": [ " * @param conn The connection to use to access the database", " * @throws java.sql.SQLException" ], "header": "@@ -211,6 +213,8 @@ public class SignatureChecker", "removed": [] }, { "added": [ " StringBuilder query = new StringBuilder();" ], "header": "@@ -231,7 +235,7 @@ public class SignatureChecker", "removed": [ " StringBuffer query = new StringBuffer();" ] }, { "added": [ " checkSignature( conn, query.toString(), makeReadableSignature( function ) );" ], "header": "@@ -247,7 +251,7 @@ public class SignatureChecker", "removed": [ " checkSignature( conn, function, query.toString(), makeReadableSignature( function ) );" ] }, { "added": [ " * @param routine the routine for which we want a signature", " * @return human readable string", " StringBuilder signature = new StringBuilder();" ], "header": "@@ -256,10 +260,12 @@ public class SignatureChecker", "removed": [ " StringBuffer signature = new StringBuffer();" ] }, { "added": [ " signature.append( \" \" );", " signature.append( routine.getArgType( k ) );", " signature.append( \" \" );" ], "header": "@@ -267,7 +273,9 @@ public class SignatureChecker", "removed": [ " signature.append( \" \" + routine.getArgType( k ) + \" \" );" ] }, { "added": [ " * @param dbmd the database metadata of the database", " * @throws java.sql.SQLException" ], "header": "@@ -278,6 +286,8 @@ public class SignatureChecker", "removed": [] }, { "added": [ " * Count up the arguments to the user-coded procedures in", " * {@link #_procedures} and update that data structure accordingly", " * @param dbmd the database metadata of the database", " * @throws java.sql.SQLException" ], "header": "@@ -298,8 +308,11 @@ public class SignatureChecker", "removed": [ " * Count up the arguments to the user-coded procedures." ] }, { "added": [ " * the JSR169 api for DatabaseMetaData. Update {@link #_functions}.", " * @param dbmd the database metadata of the database", " * @throws java.sql.SQLException", " ResultSet rs = dbmd.getFunctions(null, null, WILDCARD);" ], "header": "@@ -323,17 +336,16 @@ public class SignatureChecker", "removed": [ " * the JSR169 api for DatabaseMetaData.", " Method getFunctionsMethod = dbmd.getClass().getMethod", " ( \"getFunctions\", new Class[] { String.class, String.class, String.class } );", " ResultSet rs = (ResultSet) getFunctionsMethod.invoke", " ( dbmd, new Object[] { null, null, WILDCARD } );" ] }, { "added": [ " boolean isTableFunction =", " functionType == DatabaseMetaData.functionReturnsTable;", " } catch (SQLException e) { throw new SQLException( e.getMessage() ); }" ], "header": "@@ -343,16 +355,15 @@ public class SignatureChecker", "removed": [ " boolean isTableFunction;", " if ( functionType == DatabaseMetaData.functionReturnsTable ) { isTableFunction = true; }", " else { isTableFunction = false; }", " } catch (Exception e) { throw new SQLException( e.getMessage() ); }" ] }, { "added": [ " * Update {@link #_functions}.", " * @param dbmd the database metadata of the database", " * @throws java.sql.SQLException", " int count = _functions.size();", " for ( int i = 0; i < count; i++ )", " {", " SQLRoutine function = getFunction( i );", " ResultSet rs = dbmd.getFunctionColumns(", " null, function.getSchema(), function.getName(), WILDCARD);", " while( rs.next() )", " short columnType = rs.getShort( 5 );", "", " //", " // Skip the return value if this is a table function.", " // Skip all columns in the returned result set if this is a", " // table function.", " //", " if ( columnType == DatabaseMetaData.functionReturn ) { continue; }", " if ( columnType == DatabaseMetaData.functionColumnResult ) { continue; }", "", " function.addArg( rs.getString( 7 ) );", " rs.close();", " }", " * @param conn The connection to the database", " * @param query The SQL to prepare", " * @param readableSignature the signature: printed if prepare fails", " private void checkSignature( Connection conn, String query, String readableSignature )" ], "header": "@@ -360,49 +371,48 @@ public class SignatureChecker", "removed": [ " try {", " Method getFunctionColumnsMethod = dbmd.getClass().getMethod", " ( \"getFunctionColumns\", new Class[] { String.class, String.class, String.class, String.class } );", " int count = _functions.size();", " for ( int i = 0; i < count; i++ )", " SQLRoutine function = getFunction( i );", "", " ResultSet rs = (ResultSet) getFunctionColumnsMethod.invoke", " ( dbmd, new Object[] { null, function.getSchema(), function.getName(), WILDCARD } );", "", " while( rs.next() )", " {", " short columnType = rs.getShort( 5 );", "", " //", " // Skip the return value if this is a table function.", " // Skip all columns in the returned result set if this is a", " // table function.", " //", " if ( columnType == DatabaseMetaData.functionReturn ) { continue; }", " if ( columnType == DatabaseMetaData.functionColumnResult ) { continue; }", " ", " function.addArg( rs.getString( 7 ) );", " }", " rs.close();", " } catch (Exception e) { throw new SQLException( e.getMessage() ); }", " ", " private void checkSignature( Connection conn, SQLRoutine routine, String query, String readableSignature )" ] }, { "added": [ " *", " * @return a connection to the database", " * @throws java.sql.SQLException" ], "header": "@@ -427,6 +437,9 @@ public class SignatureChecker", "removed": [] }, { "added": [ " Class.forName( \"java.sql.DriverManager\" );", " } catch (ClassNotFoundException t) {}", " return DriverManager.getConnection(", " _parsedArgs.getJ2seConnectionUrl() );", " } catch (SQLException t)" ], "header": "@@ -434,17 +447,15 @@ public class SignatureChecker", "removed": [ " } catch (Throwable t) {}", " Class<?> driverManagerClass = Class.forName( \"java.sql.DriverManager\" );", " Method getConnectionMethod = driverManagerClass.getDeclaredMethod", " ( \"getConnection\", String.class );", " return (Connection) getConnectionMethod.invoke", " ( null, new Object[] { _parsedArgs.getJ2seConnectionUrl() } );", " } catch (Throwable t)" ] }, { "added": [ " @SuppressWarnings(\"CallToPrintStackTrace\")" ], "header": "@@ -464,6 +475,7 @@ public class SignatureChecker", "removed": [] }, { "added": [ " * @param schema the schema to check", " * @return {@code true} if the schema is a system schema" ], "header": "@@ -476,6 +488,8 @@ public class SignatureChecker", "removed": [] }, { "added": [ " * Store a procedure descriptor. Updates {@link #_procedures}.", " * @param schema schema of the procedure", " * @param name of a procedure" ], "header": "@@ -490,7 +504,9 @@ public class SignatureChecker", "removed": [ " * Store a procedure descriptor." ] }, { "added": [ " * Get a procedure descriptor from {@link #_procedures}.", " * @param idx The index of the procedure in {@link #_procedures}.", " * @return a procedure descriptor" ], "header": "@@ -498,7 +514,9 @@ public class SignatureChecker", "removed": [ " * Get a procedure descriptor." ] }, { "added": [ " * Store a function descriptor. Updates {@link #_functions}.", " *", " * @param schema The schema of the function", " * @param name The name of the function", " * @param isTableFunction {@code true} iff the function is a table function" ], "header": "@@ -506,7 +524,11 @@ public class SignatureChecker", "removed": [ " * Store a function descriptor." ] }, { "added": [ " * Get a function descriptor from {@link #_functions}", " * .", " * @param idx The index of the procedure in {@link #_functions}.", " * @return a function descriptor" ], "header": "@@ -514,7 +536,10 @@ public class SignatureChecker", "removed": [ " * Get a functon descriptor." ] }, { "added": [ " *", " * @param key The message key by which we located the localized text", " * @param args Any arguments to the localized text to be filled in", " * @return A localized message" ], "header": "@@ -523,6 +548,10 @@ public class SignatureChecker", "removed": [] }, { "added": [ " *", " * @return localized resource" ], "header": "@@ -531,6 +560,8 @@ public class SignatureChecker", "removed": [] }, { "added": [ " private final String _schema;", " private final String _name;", " private final boolean _isTableFunction;", " private final ArrayList<String> _argList = new ArrayList<String>();" ], "header": "@@ -576,10 +607,10 @@ public class SignatureChecker", "removed": [ " private String _schema;", " private String _name;", " private boolean _isTableFunction;", " private ArrayList<String> _argList = new ArrayList<String>();" ] }, { "added": [ " @Override", " StringBuilder buffer = new StringBuilder();", " buffer.append( _schema );", " buffer.append( \", \" );", " buffer.append( _name );", " buffer.append( \", \" );", " buffer.append( \"isTableFunction = \" );", " buffer.append( _isTableFunction );", " buffer.append( \", \" );", " buffer.append( \" argCount = \" );", " buffer.append( getArgCount() );" ], "header": "@@ -596,15 +627,21 @@ public class SignatureChecker", "removed": [ " StringBuffer buffer = new StringBuffer();", " buffer.append( _schema + \", \" );", " buffer.append( _name + \", \" );", " buffer.append( \"isTableFunction = \" + _isTableFunction + \", \" );", " buffer.append( \" argCount = \" + getArgCount() );" ] } ] } ]
derby-DERBY-6642-8ee4fdfa
DERBY-6642 Make the JUnit result set assertion methods dump the actual rs when assertion fails Patch derby-6642b. The patch works by always collecting columns and rows as they are read. The method JDBC#addRsToReport takes these collections and what's left of the result set and formats a dump of the result set and adds it to the text of already existing assertion failure. This is then (re)thrown. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1607069 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/junit/JDBC.java", "hunks": [ { "added": [ "import junit.framework.AssertionFailedError;" ], "header": "@@ -31,6 +31,7 @@ import java.util.ListIterator;", "removed": [] }, { "added": [ " List<List<String>> seen = new ArrayList<List<String>>();", " List<String> seenRow = new ArrayList<String>();", " seenRow.add(s);", " assertResultColumnNullable(rs, seen, seenRow, col);", " seen.add(new ArrayList<String>(seenRow));", " seenRow.clear();", " if (expectedRows >= 0) {", " try {", " Assert.assertEquals(\"Unexpected row count:\", expectedRows, rows);", " } catch (AssertionFailedError e) {", " throw addRsToReport(e, rsmd, seen, seenRow, rs);", " }", " }" ], "header": "@@ -761,22 +762,32 @@ public class JDBC {", "removed": [ " assertResultColumnNullable(rsmd, col);", "\t\tif (expectedRows >= 0)", "\t\t\tAssert.assertEquals(\"Unexpected row count:\", expectedRows, rows);" ] }, { "added": [ " * @param rs the resultSet", " * @param seen The set of entirely read rows so far", " * @param seenRow The set of read columns in the current row so far", " private static void assertResultColumnNullable(", " ResultSet rs,", " List<List<String>> seen,", " List<String> seenRow,", " int col)", " final ResultSetMetaData rsmd = rs.getMetaData();", "", " try {", " Assert.assertFalse(rsmd.isNullable(col) == ResultSetMetaData.columnNoNulls);", " } catch (AssertionFailedError e) {", " throw addRsToReport(e, rsmd, seen, seenRow, rs);", " }" ], "header": "@@ -787,14 +798,26 @@ public class JDBC {", "removed": [ " * @param rsmd Metadata of the ResultSet", " private static void assertResultColumnNullable(ResultSetMetaData rsmd, int col)", " Assert.assertFalse(rsmd.isNullable(col) == ResultSetMetaData.columnNoNulls); " ] }, { "added": [ " List<List<String>> seen = new ArrayList<List<String>>();", " List<String> seenRow = new ArrayList<String>();", "", " try {", " Assert.assertEquals(\"Unexpected column count:\",", " expectedRows[0].length, rsmd.getColumnCount());", " } catch (AssertionFailedError e) {", " throw addRsToReport(e, rsmd, seen, seenRow, rs);", " }" ], "header": "@@ -1064,12 +1087,19 @@ public class JDBC {", "removed": [ " Assert.assertEquals(\"Unexpected column count:\",", " expectedRows[0].length, rsmd.getColumnCount());" ] }, { "added": [ " try {", " Assert.assertEquals(", " \"Warning assertion error on row \" + (rows+1),", " warnings[rows],", " wstr);", " } catch (AssertionFailedError e) {", " throw addRsToReport(e, rsmd, seen, seenRow, rs);", " }" ], "header": "@@ -1087,10 +1117,14 @@ public class JDBC {", "removed": [ " Assert.assertEquals(", " \"Warning assertion error on row \" + (rows+1),", " warnings[rows],", " wstr);" ] }, { "added": [ " // dumps itself in any assertion seem", " assertRowInResultSet(rs, seen, seenRow, rows + 1,", "", " seen.add(new ArrayList<String>(seenRow));", " seenRow.clear();", " try {", " Assert.assertEquals(\"Unexpected row count:\", expectedRows.length, rows);", " } catch (AssertionFailedError e) {", " throw addRsToReport(e, rsmd, seen, seenRow, rs);", " }" ], "header": "@@ -1099,15 +1133,23 @@ public class JDBC {", "removed": [ " assertRowInResultSet(rs, rows + 1,", " Assert.assertEquals(\"Unexpected row count:\", expectedRows.length, rows);" ] }, { "added": [ " final List<List<String>> seen = new ArrayList<List<String>>();", " final List<String> seenRow = new ArrayList<String>();", " final ResultSetMetaData rsmd = rs.getMetaData();" ], "header": "@@ -1146,6 +1188,9 @@ public class JDBC {", "removed": [] }, { "added": [ " assertRowInResultSet(rs, seen, seenRow, rows + 1,", " seen.add(new ArrayList<String>(seenRow));", " seenRow.clear();", " try {", " Assert.assertEquals(\"Unexpected row count:\", expectedRows.length, rows);", " } catch (AssertionFailedError e) {", " throw addRsToReport(e, rsmd, seen, seenRow, rs);", " }" ], "header": "@@ -1163,15 +1208,21 @@ public class JDBC {", "removed": [ " assertRowInResultSet(rs, rows + 1,", " Assert.assertEquals(\"Unexpected row count:\", expectedRows.length, rows);" ] }, { "added": [ " * @param seen The set of entirely read rows so far (IN semantics)", " * @param seenRow The set of read columns in the current row so far", " * (OUT semantics)" ], "header": "@@ -1193,6 +1244,9 @@ public class JDBC {", "removed": [] }, { "added": [ " * @throws java.sql.SQLException", " private static void assertRowInResultSet(", " ResultSet rs,", " List<List<String>> seen,", " List<String> seenRow,", " int rowNum,", " Object [] expectedRow,", " boolean asTrimmedStrings) throws SQLException", " rs, seen, seenRow, rowNum, expectedRow, asTrimmedStrings, (BitSet)null);" ], "header": "@@ -1208,12 +1262,18 @@ public class JDBC {", "removed": [ " private static void assertRowInResultSet(ResultSet rs, int rowNum,", " Object [] expectedRow, boolean asTrimmedStrings) throws SQLException", " rs, rowNum, expectedRow, asTrimmedStrings, (BitSet)null);" ] }, { "added": [ " private static void assertRowInResultSet(", " ResultSet rs,", " List<List<String>> seen,", " List<String> seenRow,", " int rowNum,", " Object [] expectedRow,", " boolean asTrimmedStrings,", " BitSet colsToCheck) throws SQLException" ], "header": "@@ -1233,9 +1293,14 @@ public class JDBC {", "removed": [ " private static void assertRowInResultSet(ResultSet rs,", " int rowNum, Object [] expectedRow, boolean asTrimmedStrings,", " BitSet colsToCheck) throws SQLException" ] }, { "added": [], "header": "@@ -1269,7 +1334,6 @@ public class JDBC {", "removed": [ " " ] }, { "added": [ " else {", " }", "", " seenRow.add(obj == null ? \"null\" : obj.toString());" ], "header": "@@ -1282,8 +1346,11 @@ public class JDBC {", "removed": [ " else" ] }, { "added": [ "", " try {", " Assert.fail(\"Column value mismatch @ column '\" +", " rsmd.getColumnName(cPos) + \"', row \" + rowNum +", " \":\\n Expected: >\" + expected +", " \"<\\n Found: >\" + found + \"<\");", " } catch (AssertionFailedError e) {", " throw addRsToReport(e, rsmd, seen, seenRow, rs);", " }", " if (rs.wasNull()) {", " assertResultColumnNullable(rs, seen, seenRow, cPos);", " }" ], "header": "@@ -1300,15 +1367,20 @@ public class JDBC {", "removed": [ " Assert.fail(\"Column value mismatch @ column '\" +", " rsmd.getColumnName(cPos) + \"', row \" + rowNum +", " \":\\n Expected: >\" + expected +", " \"<\\n Found: >\" + found + \"<\");", " if (rs.wasNull())", " assertResultColumnNullable(rsmd, cPos);", "" ] }, { "added": [ " List<List<String>> seen = new ArrayList<List<String>>();", " List<String> seenRow = new ArrayList<String>();", "", " try {", " Assert.assertEquals(\"Unexpected column count\",", " expectedRows[0].length, rsmd.getColumnCount());", " } catch (AssertionFailedError e) {", " throw addRsToReport(e, rsmd, seen, seenRow, rs);", " }" ], "header": "@@ -1436,8 +1508,15 @@ public class JDBC {", "removed": [ " Assert.assertEquals(\"Unexpected column count\",", " expectedRows[0].length, rsmd.getColumnCount());" ] }, { "added": [ " seenRow.add(s);", " if (rs.wasNull()) {", " assertResultColumnNullable(rs, seen, seenRow, i);", " }", " seen.add(new ArrayList<String>(seenRow));", " seenRow.clear();", " try {", " if (rowCountsMustMatch) {", " String message = \"Unexpected row count, expected: \" +", " expectedRows.length + \", actual: \" + actual.size() + \"\\n\" +", " \"\\t expected rows: \\n\\t\\t\" + expected +", " \"\\n\\t actual result: \\n\\t\\t\" + actual + \"\\n\";", " Assert.assertEquals(message,", " expectedRows.length, actual.size());", " }", " if ( !actual.containsAll(expected) )", " {", " expected.removeAll( actual );", " BaseTestCase.println", " ( \"These expected rows don't appear in the actual result: \" + expected );", " String message = \"Missing rows in ResultSet; \\n\\t expected rows: \\n\\t\\t\"", " + expected + \"\\n\\t actual result: \\n\\t\\t\" + actual;", " Assert.fail( message );", " }", " } catch (AssertionFailedError e) {", " throw addRsToReport(e, rsmd, seen, seenRow, rs);" ], "header": "@@ -1461,34 +1540,42 @@ public class JDBC {", "removed": [ " if (rs.wasNull())", " assertResultColumnNullable(rsmd, i);", " if (rowCountsMustMatch) {", " String message = \"Unexpected row count, expected: \" +", " expectedRows.length + \", actual: \" + actual.size() + \"\\n\" +", " \"\\t expected rows: \\n\\t\\t\" + expected + ", " \"\\n\\t actual result: \\n\\t\\t\" + actual + \"\\n\";", " Assert.assertEquals(message,", " expectedRows.length, actual.size());", " }", " if ( !actual.containsAll(expected) )", " {", " expected.removeAll( actual );", " BaseTestCase.println", " ( \"These expected rows don't appear in the actual result: \" + expected );", " String message = \"Missing rows in ResultSet; \\n\\t expected rows: \\n\\t\\t\" ", " + expected + \"\\n\\t actual result: \\n\\t\\t\" + actual;", " Assert.fail( message );" ] }, { "added": [ " private static AssertionFailedError addRsToReport(", " AssertionFailedError afe,", " ResultSetMetaData rsmd,", " List<List<String>> seen,", " List<String> seenRow,", " ResultSet rs) throws SQLException {", "", " if (rs == null) {", " return new AssertionFailedError(afe.getMessage() + \"\\n<NULL>\");", " }", "", " final int c = rsmd.getColumnCount();", " StringBuilder heading = new StringBuilder(\" \");", " StringBuilder underline = new StringBuilder(\" \");", "", " // Display column headings", " for (int i=1; i<= c; i++) {", " if (i > 1) {", " heading.append(\",\");", " underline.append(\" \");", " }", "", " int len = heading.length();", " heading.append(rsmd.getColumnLabel(i));", " len = heading.length() - len;", "", " for (int j = len; j > 0; j--) {", " underline.append(\"-\");", " }", " }", "", " heading.append(\"\\n\");", " underline.append(\"\\n\");", "", " StringBuilder rowImg = new StringBuilder();", " rowImg.append(afe.getMessage()).", " append(\"\\n\\n\").", " append(heading.toString()).", " append(underline.toString());", "", " if (!rs.isClosed()) {", " final int s = seenRow.size();", "", " // Get any rest of columns of current row", " for (int i=0; i < c - s; i++) {", " String column = null;", "", " try {", " column = rs.getString(s + i + 1);", " } catch (SQLException e) {", " // We may not yet have called next?", " if (e.getSQLState().equals(\"24000\")) {", " if (rs.next()) {", " column = rs.getString(s + i + 1);", " } else {", " break;", " }", " }", " }", " seenRow.add(column);", " }", "", " if (seenRow.size() > 0) {", " seen.add(new ArrayList<String>(seenRow));", " seenRow.clear();", " }", "", " // Get any remaining rows", " while (rs.next()) {", " for (int i = 0; i < c; i++) {", " seenRow.add(rs.getString(i + 1));", " }", " seen.add(new ArrayList<String>(seenRow));", " seenRow.clear();", " }", " }", "", " // Display data", " for (List<String> row : seen) {", " rowImg.append(\" \").", " append(row.toString()).", " append(\"\\n\");", " }", "", " return new AssertionFailedError(rowImg.toString());", " }", "" ], "header": "@@ -1702,4 +1789,91 @@ public class JDBC {", "removed": [] } ] } ]
derby-DERBY-6644-497ce7bd
DERBY-6644: Support standard syntax for altering column nullability Implement SQL:2011 syntax for altering nullability: ALTER TABLE t ALTER COLUMN c SET NOT NULL ALTER TABLE t ALTER COLUMN c DROP NOT NULL git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1607559 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-6648-a0dbbd72
DERBY-6648: Prevent user code from calling the public static entry points in ContextService; commit derby-6648-01-ae-regressionTests.diff. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1625960 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/catalog/Java5SystemProcedures.java", "hunks": [ { "added": [ "import java.security.AccessController;", "import java.security.PrivilegedAction;", "import org.apache.derby.iapi.services.context.Context;" ], "header": "@@ -21,12 +21,15 @@", "removed": [] }, { "added": [ "\t\t\tClassFactoryContext cfc = (ClassFactoryContext) getContext( ClassFactoryContext.CONTEXT_ID );" ], "header": "@@ -93,7 +96,7 @@ public class Java5SystemProcedures", "removed": [ "\t\t\tClassFactoryContext cfc = (ClassFactoryContext) ContextService.getContext( ClassFactoryContext.CONTEXT_ID );" ] } ] }, { "file": "java/engine/org/apache/derby/diag/DiagUtil.java", "hunks": [ { "added": [ "import java.security.AccessController;", "import java.security.PrivilegedAction;", "", "import org.apache.derby.iapi.services.context.Context;" ], "header": "@@ -21,8 +21,12 @@", "removed": [] }, { "added": [ " getContextOrNull(LanguageConnectionContext.CONTEXT_ID);" ], "header": "@@ -41,7 +45,7 @@ abstract class DiagUtil", "removed": [ " ContextService.getContextOrNull(LanguageConnectionContext.CONTEXT_ID);" ] } ] }, { "file": "java/engine/org/apache/derby/diag/StatementCache.java", "hunks": [ { "added": [ "import java.security.PrivilegedAction;", "import java.security.AccessController;" ], "header": "@@ -21,6 +21,8 @@", "removed": [] }, { "added": [ "import org.apache.derby.iapi.services.context.Context;" ], "header": "@@ -31,6 +33,7 @@ import java.util.Vector;", "removed": [] }, { "added": [ " getContextOrNull(LanguageConnectionContext.CONTEXT_ID);" ], "header": "@@ -78,7 +81,7 @@ public final class StatementCache extends VTITemplate {", "removed": [ " ContextService.getContextOrNull(LanguageConnectionContext.CONTEXT_ID);" ] } ] }, { "file": "java/engine/org/apache/derby/iapi/security/SecurityUtil.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.services.context.Context;" ], "header": "@@ -38,6 +38,7 @@ import javax.security.auth.Subject;", "removed": [] }, { "added": [ "import org.apache.derby.security.SystemPermission;", " /**", " * Permission to access Derby contexts (permissions are immutable).", " */", " private final static SystemPermission USE_DERBY_INTERNALS = new SystemPermission", " ( SystemPermission.ENGINE, SystemPermission.USE_DERBY_INTERNALS );", "" ], "header": "@@ -46,12 +47,19 @@ import org.apache.derby.iapi.sql.dictionary.DataDictionary;", "removed": [] }, { "added": [ "\t\t\t\tgetContextOrNull( LanguageConnectionContext.CONTEXT_ID );" ], "header": "@@ -181,7 +189,7 @@ public class SecurityUtil {", "removed": [ "\t\t\t\tContextService.getContextOrNull( LanguageConnectionContext.CONTEXT_ID );" ] } ] }, { "file": "java/engine/org/apache/derby/iapi/services/context/ContextService.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.security.SecurityUtil;" ], "header": "@@ -27,6 +27,7 @@ import java.util.HashSet;", "removed": [] }, { "added": [ "\tpublic static void stop()", " {", " // Verify that we have permission to execute this method.", " SecurityUtil.checkDerbyInternalsPrivilege();", " " ], "header": "@@ -189,7 +190,11 @@ public final class ContextService //OLD extends Hashtable", "removed": [ "\tpublic static void stop() {" ] }, { "added": [ "\tpublic static ContextService getFactory()", " {", " // Verify that we have permission to execute this method.", " SecurityUtil.checkDerbyInternalsPrivilege();", " " ], "header": "@@ -203,7 +208,11 @@ public final class ContextService //OLD extends Hashtable", "removed": [ "\tpublic static ContextService getFactory() {" ] }, { "added": [ "\tpublic static Context getContext(String contextId)", " {", " // Verify that we have permission to execute this method.", " SecurityUtil.checkDerbyInternalsPrivilege();", " " ], "header": "@@ -216,8 +225,11 @@ public final class ContextService //OLD extends Hashtable", "removed": [ "\tpublic static Context getContext(String contextId) {", "" ] } ] }, { "file": "java/engine/org/apache/derby/iapi/services/io/FormatIdInputStream.java", "hunks": [ { "added": [ "import java.security.PrivilegedAction;", "import java.security.AccessController;", "import org.apache.derby.iapi.services.context.Context;" ], "header": "@@ -26,12 +26,15 @@ import java.io.IOException;", "removed": [] }, { "added": [ "\t\t\t\t(ClassFactoryContext) getContextOrNull" ], "header": "@@ -201,7 +204,7 @@ public final class FormatIdInputStream extends DataInputStream", "removed": [ "\t\t\t\t(ClassFactoryContext) ContextService.getContextOrNull" ] } ] }, { "file": "java/engine/org/apache/derby/iapi/sql/conn/ConnectionUtil.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.services.context.Context;", "import java.security.PrivilegedAction;", "import java.security.AccessController;" ], "header": "@@ -21,12 +21,15 @@", "removed": [] }, { "added": [ "\t\t\t\tgetContextOrNull(LanguageConnectionContext.CONTEXT_ID);" ], "header": "@@ -42,7 +45,7 @@ public class ConnectionUtil {", "removed": [ "\t\t\t\tContextService.getContextOrNull(LanguageConnectionContext.CONTEXT_ID);" ] } ] }, { "file": "java/engine/org/apache/derby/iapi/sql/dictionary/IndexRowGenerator.java", "hunks": [ { "added": [ "import java.security.AccessController;", "import java.security.PrivilegedAction;", "import org.apache.derby.iapi.services.context.Context;" ], "header": "@@ -24,10 +24,13 @@ package org.apache.derby.iapi.sql.dictionary;", "removed": [] }, { "added": [ "\t\t\t\t\tgetContext(ExecutionContext.CONTEXT_ID);" ], "header": "@@ -394,7 +397,7 @@ public class IndexRowGenerator implements IndexDescriptor, Formatable", "removed": [ "\t\t\t\t\tContextService.getContext(ExecutionContext.CONTEXT_ID);" ] } ] }, { "file": "java/engine/org/apache/derby/iapi/sql/dictionary/SPSDescriptor.java", "hunks": [ { "added": [ "import java.security.PrivilegedAction;", "import java.security.AccessController;", "import java.security.AccessControlException;", "import java.security.AccessControlContext;" ], "header": "@@ -21,6 +21,10 @@", "removed": [] }, { "added": [ "\t\t\tContextManager cm = getContextService().getCurrentContextManager();" ], "header": "@@ -683,7 +687,7 @@ public class SPSDescriptor extends UniqueSQLObjectDescriptor", "removed": [ "\t\t\tContextManager cm = ContextService.getFactory().getCurrentContextManager();" ] } ] }, { "file": "java/engine/org/apache/derby/iapi/sql/dictionary/TableDescriptor.java", "hunks": [ { "added": [ "import java.security.PrivilegedAction;", "import java.security.AccessController;" ], "header": "@@ -21,6 +21,8 @@", "removed": [] }, { "added": [ "import org.apache.derby.iapi.services.context.Context;" ], "header": "@@ -32,6 +34,7 @@ import org.apache.derby.iapi.reference.SQLState;", "removed": [] }, { "added": [ " (LanguageConnectionContext)getContextOrNull(" ], "header": "@@ -169,7 +172,7 @@ public class TableDescriptor extends UniqueSQLObjectDescriptor", "removed": [ " (LanguageConnectionContext)ContextService.getContextOrNull(" ] }, { "added": [ " (LanguageConnectionContext)getContextOrNull(" ], "header": "@@ -184,7 +187,7 @@ public class TableDescriptor extends UniqueSQLObjectDescriptor", "removed": [ " (LanguageConnectionContext)ContextService.getContextOrNull(" ] } ] }, { "file": "java/engine/org/apache/derby/iapi/sql/dictionary/TriggerDescriptor.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.services.context.Context;" ], "header": "@@ -39,6 +39,7 @@ import org.apache.derby.iapi.services.io.StoredFormatIds;", "removed": [] }, { "added": [ "import java.security.AccessController;", "import java.security.PrivilegedAction;" ], "header": "@@ -48,6 +49,8 @@ import org.apache.derby.iapi.sql.compile.Visitable;", "removed": [] }, { "added": [ "\t\t\t\tgetContext(LanguageConnectionContext.CONTEXT_ID);" ], "header": "@@ -956,7 +959,7 @@ public class TriggerDescriptor extends UniqueSQLObjectDescriptor", "removed": [ "\t\t\t\tContextService.getContext(LanguageConnectionContext.CONTEXT_ID);" ] } ] }, { "file": "java/engine/org/apache/derby/iapi/store/access/DiskHashtable.java", "hunks": [ { "added": [ "import java.security.AccessController;", "import java.security.PrivilegedAction;" ], "header": "@@ -20,6 +20,8 @@", "removed": [] }, { "added": [ "import org.apache.derby.iapi.services.context.Context;" ], "header": "@@ -32,6 +34,7 @@ import org.apache.derby.iapi.types.SQLInteger;", "removed": [] }, { "added": [ " getContextOrNull(" ], "header": "@@ -93,7 +96,7 @@ public class DiskHashtable", "removed": [ " ContextService.getContextOrNull(" ] } ] }, { "file": "java/engine/org/apache/derby/iapi/types/ClobStreamHeaderGenerator.java", "hunks": [ { "added": [ "import java.security.AccessController;", "import java.security.PrivilegedAction;", "", "import org.apache.derby.iapi.services.context.Context;" ], "header": "@@ -20,10 +20,14 @@", "removed": [] }, { "added": [ " getContext(DatabaseContext.CONTEXT_ID);" ], "header": "@@ -255,7 +259,7 @@ public final class ClobStreamHeaderGenerator", "removed": [ " ContextService.getContext(DatabaseContext.CONTEXT_ID);" ] } ] }, { "file": "java/engine/org/apache/derby/iapi/types/DataValueFactoryImpl.java", "hunks": [ { "added": [ "import java.security.AccessController;", "import java.security.PrivilegedAction;", "" ], "header": "@@ -34,6 +34,9 @@ import org.apache.derby.iapi.services.monitor.Monitor;", "removed": [] }, { "added": [ "import org.apache.derby.iapi.services.context.Context;" ], "header": "@@ -47,6 +50,7 @@ import java.util.Properties;", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/iapi/types/NumberDataType.java", "hunks": [ { "added": [ "import java.security.AccessController;", "import java.security.PrivilegedAction;", "import org.apache.derby.iapi.services.context.Context;" ], "header": "@@ -22,8 +22,11 @@", "removed": [] }, { "added": [ " (LanguageConnectionContext)getContextOrNull(" ], "header": "@@ -568,7 +571,7 @@ public abstract class NumberDataType extends DataType", "removed": [ " (LanguageConnectionContext)ContextService.getContextOrNull(" ] } ] }, { "file": "java/engine/org/apache/derby/iapi/types/SQLChar.java", "hunks": [ { "added": [ " DataValueFactoryImpl.getContext(ContextId.LANG_STATEMENT);" ], "header": "@@ -1944,7 +1944,7 @@ readingLoop:", "removed": [ " ContextService.getContext(ContextId.LANG_STATEMENT);" ] } ] }, { "file": "java/engine/org/apache/derby/iapi/util/InterruptStatus.java", "hunks": [ { "added": [ "import java.security.AccessController;", "import java.security.PrivilegedAction;", "", "import org.apache.derby.iapi.services.context.Context;" ], "header": "@@ -21,10 +21,14 @@", "removed": [] }, { "added": [ " lcc = (LanguageConnectionContext)getContextOrNull(" ], "header": "@@ -77,7 +81,7 @@ public class InterruptStatus {", "removed": [ " lcc = (LanguageConnectionContext)ContextService.getContextOrNull(" ] }, { "added": [ " (LanguageConnectionContext)getContextOrNull(" ], "header": "@@ -188,7 +192,7 @@ public class InterruptStatus {", "removed": [ " (LanguageConnectionContext)ContextService.getContextOrNull(" ] }, { "added": [ " ctxLcc = (LanguageConnectionContext)" ], "header": "@@ -235,7 +239,7 @@ public class InterruptStatus {", "removed": [ " ctxLcc = (LanguageConnectionContext)ContextService." ] } ] }, { "file": "java/engine/org/apache/derby/impl/db/BasicDatabase.java", "hunks": [ { "added": [ "import java.security.PrivilegedAction;" ], "header": "@@ -74,6 +74,7 @@ import java.io.File;", "removed": [] }, { "added": [ "\t\t\t\tgetContextService().getCurrentContextManager());" ], "header": "@@ -584,7 +585,7 @@ public class BasicDatabase implements ModuleControl, ModuleSupportable, Property", "removed": [ "\t\t\t\tContextService.getFactory().getCurrentContextManager());" ] }, { "added": [ " getContextService().getCurrentContextManager());" ], "header": "@@ -784,7 +785,7 @@ public class BasicDatabase implements ModuleControl, ModuleSupportable, Property", "removed": [ " ContextService.getFactory().getCurrentContextManager());" ] }, { "added": [ " ContextManager cm = getContextService().getCurrentContextManager();" ], "header": "@@ -834,7 +835,7 @@ public class BasicDatabase implements ModuleControl, ModuleSupportable, Property", "removed": [ " ContextManager cm = ContextService.getFactory().getCurrentContextManager();" ] } ] }, { "file": "java/engine/org/apache/derby/impl/db/DatabaseContextImpl.java", "hunks": [ { "added": [ "import java.security.PrivilegedAction;", "import java.security.AccessController;" ], "header": "@@ -31,6 +31,8 @@ import org.apache.derby.iapi.db.DatabaseContext;", "removed": [] }, { "added": [ "\t\t getContextService().notifyAllActiveThreads(this);" ], "header": "@@ -71,7 +73,7 @@ final class DatabaseContextImpl extends ContextImpl implements DatabaseContext", "removed": [ "\t\t ContextService.getFactory().notifyAllActiveThreads(this);" ] } ] }, { "file": "java/engine/org/apache/derby/impl/db/SlaveDatabase.java", "hunks": [ { "added": [ "import java.security.PrivilegedAction;", "import java.security.AccessController;", "" ], "header": "@@ -35,6 +35,9 @@ import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;", "removed": [] }, { "added": [ " pushDbContext(getContextService()." ], "header": "@@ -222,7 +225,7 @@ public class SlaveDatabase extends BasicDatabase {", "removed": [ " pushDbContext(ContextService.getFactory()." ] }, { "added": [ " bootThreadCm = getContextService().newContextManager();", " getContextService()." ], "header": "@@ -308,8 +311,8 @@ public class SlaveDatabase extends BasicDatabase {", "removed": [ " bootThreadCm = ContextService.getFactory().newContextManager();", " ContextService.getFactory()." ] }, { "added": [ " getContextService()." ], "header": "@@ -319,7 +322,7 @@ public class SlaveDatabase extends BasicDatabase {", "removed": [ " ContextService.getFactory()." ] } ] }, { "file": "java/engine/org/apache/derby/impl/jdbc/authentication/AuthenticationServiceBase.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.services.context.Context;" ], "header": "@@ -29,6 +29,7 @@ import org.apache.derby.iapi.reference.Limits;", "removed": [] }, { "added": [ "import java.security.PrivilegedAction;", "import java.security.AccessController;" ], "header": "@@ -54,6 +55,8 @@ import org.apache.derby.iapi.sql.dictionary.UserDescriptor;", "removed": [] }, { "added": [ " return store.getTransaction( getContextService().getCurrentContextManager() );" ], "header": "@@ -300,7 +303,7 @@ public abstract class AuthenticationServiceBase", "removed": [ " return store.getTransaction( ContextService.getFactory().getCurrentContextManager() );" ] }, { "added": [ " getContextService().getCurrentContextManager());" ], "header": "@@ -344,7 +347,7 @@ public abstract class AuthenticationServiceBase", "removed": [ " ContextService.getFactory().getCurrentContextManager());" ] }, { "added": [ " getContext(LanguageConnectionContext.CONTEXT_ID);" ], "header": "@@ -667,7 +670,7 @@ public abstract class AuthenticationServiceBase", "removed": [ " ContextService.getContext(LanguageConnectionContext.CONTEXT_ID);" ] } ] }, { "file": "java/engine/org/apache/derby/impl/services/daemon/IndexStatisticsDaemonImpl.java", "hunks": [ { "added": [ "import java.security.PrivilegedAction;", "import java.security.AccessController;" ], "header": "@@ -21,6 +21,8 @@", "removed": [] }, { "added": [ " this.ctxMgr = getContextService().newContextManager();" ], "header": "@@ -227,7 +229,7 @@ public class IndexStatisticsDaemonImpl", "removed": [ " this.ctxMgr = ContextService.getFactory().newContextManager();" ] }, { "added": [ " ctxService = getContextService();" ], "header": "@@ -843,7 +845,7 @@ public class IndexStatisticsDaemonImpl", "removed": [ " ctxService = ContextService.getFactory();" ] } ] }, { "file": "java/engine/org/apache/derby/impl/services/daemon/SingleThreadDaemonFactory.java", "hunks": [ { "added": [ "\t\tcontextService = getContextService();" ], "header": "@@ -37,7 +37,7 @@ public class SingleThreadDaemonFactory implements DaemonFactory", "removed": [ "\t\tcontextService = ContextService.getFactory();" ] } ] }, { "file": "java/engine/org/apache/derby/impl/services/locks/Deadlock.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.services.context.Context;", "import java.security.AccessController;", "import java.security.PrivilegedAction;" ], "header": "@@ -27,10 +27,13 @@ import org.apache.derby.iapi.error.StandardException;", "removed": [] }, { "added": [ "\t\t\tgetContext(LanguageConnectionContext.CONTEXT_ID);" ], "header": "@@ -444,7 +447,7 @@ inner:\t\tfor (;;) {", "removed": [ "\t\t\tContextService.getContext(LanguageConnectionContext.CONTEXT_ID);" ] } ] }, { "file": "java/engine/org/apache/derby/impl/services/monitor/BaseMonitor.java", "hunks": [ { "added": [ "import java.security.PrivilegedAction;", "import java.security.AccessController;" ], "header": "@@ -31,6 +31,8 @@ import java.io.PrintWriter;", "removed": [] }, { "added": [ "\t\tstopContextService();" ], "header": "@@ -198,7 +200,7 @@ abstract class BaseMonitor", "removed": [ "\t\tContextService.stop();" ] }, { "added": [ "\t\t\tcm = getContextService().getCurrentContextManager();" ], "header": "@@ -2053,7 +2055,7 @@ nextModule:", "removed": [ "\t\t\tcm = ContextService.getFactory().getCurrentContextManager();" ] } ] }, { "file": "java/engine/org/apache/derby/impl/services/reflect/UpdateLoader.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.services.context.Context;" ], "header": "@@ -21,6 +21,7 @@", "removed": [] }, { "added": [ "import java.security.PrivilegedAction;" ], "header": "@@ -40,6 +41,7 @@ import org.apache.derby.iapi.reference.Property;", "removed": [] }, { "added": [ "\t\tClassFactoryContext cfc = (ClassFactoryContext) getContextOrNull(ClassFactoryContext.CONTEXT_ID);" ], "header": "@@ -307,7 +309,7 @@ final class UpdateLoader implements LockOwner {", "removed": [ "\t\tClassFactoryContext cfc = (ClassFactoryContext) ContextService.getContextOrNull(ClassFactoryContext.CONTEXT_ID);" ] }, { "added": [ "\t\tClassFactoryContext cfc = (ClassFactoryContext) getContextOrNull(ClassFactoryContext.CONTEXT_ID);" ], "header": "@@ -379,7 +381,7 @@ final class UpdateLoader implements LockOwner {", "removed": [ "\t\tClassFactoryContext cfc = (ClassFactoryContext) ContextService.getContextOrNull(ClassFactoryContext.CONTEXT_ID);" ] }, { "added": [ "\t\t\tClassFactoryContext cfc = (ClassFactoryContext) getContextOrNull(ClassFactoryContext.CONTEXT_ID);" ], "header": "@@ -398,7 +400,7 @@ final class UpdateLoader implements LockOwner {", "removed": [ "\t\t\tClassFactoryContext cfc = (ClassFactoryContext) ContextService.getContextOrNull(ClassFactoryContext.CONTEXT_ID);" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/GenericPreparedStatement.java", "hunks": [ { "added": [ "import java.security.PrivilegedAction;", "import java.security.AccessController;" ], "header": "@@ -21,6 +21,8 @@", "removed": [] }, { "added": [ "\t\t\tContextManager cm = getContextService().getCurrentContextManager();" ], "header": "@@ -1237,7 +1239,7 @@ recompileOutOfDatePlan:", "removed": [ "\t\t\tContextManager cm = ContextService.getFactory().getCurrentContextManager();" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/GenericStorablePreparedStatement.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.services.context.Context;" ], "header": "@@ -49,6 +49,7 @@ import org.apache.derby.iapi.reference.SQLState;", "removed": [] }, { "added": [ "import java.security.AccessController;", "import java.security.PrivilegedAction;" ], "header": "@@ -58,6 +59,8 @@ import org.apache.derby.iapi.services.io.Formatable;", "removed": [] }, { "added": [ "\t\t\t(LanguageConnectionContext) getContext" ], "header": "@@ -152,7 +155,7 @@ public class GenericStorablePreparedStatement", "removed": [ "\t\t\t(LanguageConnectionContext) ContextService.getContext" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/LanguageDbPropertySetter.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.services.context.Context;", "import java.security.AccessController;", "import java.security.PrivilegedAction;" ], "header": "@@ -27,11 +27,14 @@ import org.apache.derby.iapi.reference.Property;", "removed": [] }, { "added": [ "\t\t\t\t\tgetContext(LanguageConnectionContext.CONTEXT_ID);" ], "header": "@@ -63,7 +66,7 @@ public class LanguageDbPropertySetter implements PropertySetCallback", "removed": [ "\t\t\t\t\tContextService.getContext(LanguageConnectionContext.CONTEXT_ID);" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java", "hunks": [ { "added": [ "import java.security.PrivilegedAction;", "import java.security.AccessController;" ], "header": "@@ -24,6 +24,8 @@ package org.apache.derby.impl.sql.catalog;", "removed": [] }, { "added": [ "import org.apache.derby.iapi.services.context.Context;" ], "header": "@@ -63,6 +65,7 @@ import org.apache.derby.iapi.services.cache.CacheManager;", "removed": [] }, { "added": [ "\t\tContextService csf = getContextService();" ], "header": "@@ -701,7 +704,7 @@ public final class\tDataDictionaryImpl", "removed": [ "\t\tContextService csf = ContextService.getFactory();" ] }, { "added": [ "\t\t\tgetContext(LanguageConnectionContext.CONTEXT_ID);" ], "header": "@@ -4501,7 +4504,7 @@ public final class\tDataDictionaryImpl", "removed": [ "\t\t\tContextService.getContext(LanguageConnectionContext.CONTEXT_ID);" ] }, { "added": [ " getContext(LanguageConnectionContext.CONTEXT_ID);" ], "header": "@@ -9523,7 +9526,7 @@ public final class\tDataDictionaryImpl", "removed": [ " ContextService.getContext(LanguageConnectionContext.CONTEXT_ID);" ] }, { "added": [ "\t\t\t\t\tgetContextOrNull(LanguageConnectionContext.CONTEXT_ID);" ], "header": "@@ -10508,7 +10511,7 @@ public final class\tDataDictionaryImpl", "removed": [ "\t\t\t\t\tContextService.getContextOrNull(LanguageConnectionContext.CONTEXT_ID);" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/catalog/SequenceUpdater.java", "hunks": [ { "added": [ "import java.security.AccessController;", "import java.security.PrivilegedAction;" ], "header": "@@ -20,6 +20,8 @@", "removed": [] }, { "added": [ "import org.apache.derby.iapi.services.context.Context;" ], "header": "@@ -30,6 +32,7 @@ import org.apache.derby.iapi.reference.SQLState;", "removed": [] }, { "added": [ " ContextService csf = getContextService();" ], "header": "@@ -469,7 +472,7 @@ public abstract class SequenceUpdater implements Cacheable", "removed": [ " ContextService csf = ContextService.getFactory();" ] }, { "added": [ "\t\t\t\t\tgetContextOrNull(LanguageConnectionContext.CONTEXT_ID);" ], "header": "@@ -592,7 +595,7 @@ public abstract class SequenceUpdater implements Cacheable", "removed": [ "\t\t\t\t\tContextService.getContextOrNull(LanguageConnectionContext.CONTEXT_ID);" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/MaxMinAggregateDefinition.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.services.context.Context;" ], "header": "@@ -22,6 +22,7 @@", "removed": [] }, { "added": [ "\t\t\tQueryTreeNode.getContext(LanguageConnectionContext.CONTEXT_ID);" ], "header": "@@ -59,7 +60,7 @@ class MaxMinAggregateDefinition", "removed": [ "\t\t\tContextService.getContext(LanguageConnectionContext.CONTEXT_ID);" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/OptimizerTracer.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.services.context.Context;" ], "header": "@@ -28,6 +28,7 @@ import java.security.PrivilegedAction;", "removed": [] }, { "added": [ " ClassFactoryContext cfc = (ClassFactoryContext) getContext( ClassFactoryContext.CONTEXT_ID );" ], "header": "@@ -107,7 +108,7 @@ public\tclass OptimizerTracer implements OptionalTool", "removed": [ " ClassFactoryContext cfc = (ClassFactoryContext) ContextService.getContext( ClassFactoryContext.CONTEXT_ID );" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/QueryTreeNode.java", "hunks": [ { "added": [ "import java.security.AccessController;", "import java.security.PrivilegedAction;" ], "header": "@@ -21,6 +21,8 @@", "removed": [] }, { "added": [ "import org.apache.derby.iapi.services.context.Context;", "import org.apache.derby.iapi.services.context.ContextService;" ], "header": "@@ -37,6 +39,8 @@ import org.apache.derby.iapi.reference.SQLState;", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/GenericConstantActionFactory.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.services.context.Context;" ], "header": "@@ -23,6 +23,7 @@ package org.apache.derby.impl.sql.execute;", "removed": [] }, { "added": [ "import java.security.AccessController;", "import java.security.PrivilegedAction;" ], "header": "@@ -52,6 +53,8 @@ import org.apache.derby.impl.sql.compile.TableName;", "removed": [] }, { "added": [ "\t\t\tgetContext(LanguageConnectionContext.CONTEXT_ID);" ], "header": "@@ -1005,7 +1008,7 @@ public class GenericConstantActionFactory", "removed": [ "\t\t\tContextService.getContext(LanguageConnectionContext.CONTEXT_ID);" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/JarUtil.java", "hunks": [ { "added": [ "import java.security.PrivilegedAction;" ], "header": "@@ -28,6 +28,7 @@ import java.io.InputStream;", "removed": [] }, { "added": [ "import org.apache.derby.iapi.services.context.Context;" ], "header": "@@ -39,6 +40,7 @@ import org.apache.derby.iapi.reference.Property;", "removed": [] }, { "added": [ " (LanguageConnectionContext)getContextOrNull(" ], "header": "@@ -438,7 +440,7 @@ public class JarUtil", "removed": [ " (LanguageConnectionContext)ContextService.getContextOrNull(" ] } ] }, { "file": "java/engine/org/apache/derby/impl/store/access/RAMAccessManager.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.services.context.Context;" ], "header": "@@ -30,6 +30,7 @@ import org.apache.derby.iapi.services.cache.CacheFactory;", "removed": [] }, { "added": [ "import java.security.PrivilegedAction;", "import java.security.AccessController;" ], "header": "@@ -66,6 +67,8 @@ import org.apache.derby.catalog.UUID;", "removed": [] }, { "added": [ " (RAMTransactionContext) getContext(", " rtc = (RAMTransactionContext) getContext(", " rtc = (RAMTransactionContext) getContext(" ], "header": "@@ -548,16 +551,16 @@ public abstract class RAMAccessManager", "removed": [ " (RAMTransactionContext) ContextService.getContext(", " rtc = (RAMTransactionContext) ContextService.getContext(", " rtc = (RAMTransactionContext) ContextService.getContext(" ] }, { "added": [ " getContextService().getCurrentContextManager()," ], "header": "@@ -1053,7 +1056,7 @@ public abstract class RAMAccessManager", "removed": [ " ContextService.getFactory().getCurrentContextManager()," ] } ] }, { "file": "java/engine/org/apache/derby/impl/store/raw/RawStore.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.services.context.Context;" ], "header": "@@ -24,6 +24,7 @@ package org.apache.derby.impl.store.raw;", "removed": [] }, { "added": [ "import java.security.PrivilegedAction;" ], "header": "@@ -67,6 +68,7 @@ import org.apache.derby.iapi.reference.MessageId;", "removed": [] }, { "added": [ " getContextService().getCurrentContextManager(), " ], "header": "@@ -508,7 +510,7 @@ public final class RawStore implements RawStoreFactory, ModuleControl, ModuleSup", "removed": [ " ContextService.getFactory().getCurrentContextManager(), " ] }, { "added": [ " getContextService().getCurrentContextManager(), " ], "header": "@@ -629,7 +631,7 @@ public final class RawStore implements RawStoreFactory, ModuleControl, ModuleSup", "removed": [ " ContextService.getFactory().getCurrentContextManager(), " ] }, { "added": [ " (LanguageConnectionContext)getContextOrNull(" ], "header": "@@ -809,7 +811,7 @@ public final class RawStore implements RawStoreFactory, ModuleControl, ModuleSup", "removed": [ " (LanguageConnectionContext)ContextService.getContextOrNull(" ] }, { "added": [ " getContextService().getCurrentContextManager()," ], "header": "@@ -1655,7 +1657,7 @@ public final class RawStore implements RawStoreFactory, ModuleControl, ModuleSup", "removed": [ " ContextService.getFactory().getCurrentContextManager()," ] } ] }, { "file": "java/engine/org/apache/derby/impl/store/raw/data/D_DiagnosticUtil.java", "hunks": [ { "added": [ " FileContainer.getContextService().getCurrentContextManager());" ], "header": "@@ -193,7 +193,7 @@ public class D_DiagnosticUtil", "removed": [ " ContextService.getFactory().getCurrentContextManager());" ] }, { "added": [ "\t\t\txact = store_module.startInternalTransaction", " (FileContainer.getContextService().getCurrentContextManager());" ], "header": "@@ -243,7 +243,8 @@ public class D_DiagnosticUtil", "removed": [ "\t\t\txact = store_module.startInternalTransaction(ContextService.getFactory().getCurrentContextManager());" ] }, { "added": [ " FileContainer.getContextService().getCurrentContextManager());" ], "header": "@@ -332,7 +333,7 @@ public class D_DiagnosticUtil", "removed": [ " ContextService.getFactory().getCurrentContextManager());" ] } ] }, { "file": "java/engine/org/apache/derby/impl/store/raw/data/FileContainer.java", "hunks": [ { "added": [ "import java.security.PrivilegedAction;", "import java.security.AccessController;", "" ], "header": "@@ -62,6 +62,9 @@ import org.apache.derby.iapi.util.ByteArray;", "removed": [] }, { "added": [ " getContextService().getCurrentContextManager());" ], "header": "@@ -1157,7 +1160,7 @@ abstract class FileContainer", "removed": [ " ContextService.getFactory().getCurrentContextManager());" ] } ] }, { "file": "java/engine/org/apache/derby/impl/store/raw/data/RFResource.java", "hunks": [ { "added": [ " FileContainer.getContextService().getCurrentContextManager();" ], "header": "@@ -73,7 +73,7 @@ class RFResource implements FileResource {", "removed": [ " ContextService.getFactory().getCurrentContextManager();" ] }, { "added": [ " FileContainer.getContextService().getCurrentContextManager();" ], "header": "@@ -156,7 +156,7 @@ class RFResource implements FileResource {", "removed": [ " ContextService.getFactory().getCurrentContextManager();" ] } ] }, { "file": "java/engine/org/apache/derby/impl/store/raw/data/StreamFileContainer.java", "hunks": [ { "added": [ "import java.security.PrivilegedAction;" ], "header": "@@ -68,6 +68,7 @@ import java.io.IOException;", "removed": [] }, { "added": [ " getContextService().getCurrentContextManager());" ], "header": "@@ -409,7 +410,7 @@ class StreamFileContainer implements TypedFormat, PrivilegedExceptionAction<Obje", "removed": [ " ContextService.getFactory().getCurrentContextManager());" ] } ] }, { "file": "java/engine/org/apache/derby/impl/store/raw/log/LogToFile.java", "hunks": [ { "added": [ "import java.security.PrivilegedAction;" ], "header": "@@ -89,6 +89,7 @@ import java.io.FileNotFoundException;", "removed": [] }, { "added": [ " getContextService().getCurrentContextManager()," ], "header": "@@ -884,7 +885,7 @@ public final class LogToFile implements LogFactory, ModuleControl, ModuleSupport", "removed": [ " ContextService.getFactory().getCurrentContextManager()," ] }, { "added": [ "\t\t\t\tgetContextService().getCurrentContextManager());" ], "header": "@@ -1671,7 +1672,7 @@ public final class LogToFile implements LogFactory, ModuleControl, ModuleSupport", "removed": [ "\t\t\t\tContextService.getFactory().getCurrentContextManager());" ] }, { "added": [ " getContextService().getCurrentContextManager());" ], "header": "@@ -4956,7 +4957,7 @@ public final class LogToFile implements LogFactory, ModuleControl, ModuleSupport", "removed": [ " ContextService.getFactory().getCurrentContextManager());" ] }, { "added": [ "\t\t\ttc = af.getTransaction(getContextService().getCurrentContextManager());" ], "header": "@@ -4970,7 +4971,7 @@ public final class LogToFile implements LogFactory, ModuleControl, ModuleSupport", "removed": [ "\t\t\ttc = af.getTransaction(ContextService.getFactory().getCurrentContextManager());" ] } ] }, { "file": "java/engine/org/apache/derby/impl/store/raw/xact/XactFactory.java", "hunks": [ { "added": [ "import java.security.PrivilegedAction;", "import java.security.AccessController;" ], "header": "@@ -60,6 +60,8 @@ import org.apache.derby.iapi.error.StandardException;", "removed": [] }, { "added": [ "\t\tcontextFactory = getContextService();" ], "header": "@@ -138,7 +140,7 @@ public class XactFactory implements TransactionFactory, ModuleControl, ModuleSup", "removed": [ "\t\tcontextFactory = ContextService.getFactory();" ] } ] }, { "file": "java/engine/org/apache/derby/jdbc/EmbedXAResource.java", "hunks": [ { "added": [ "import java.security.PrivilegedAction;", "import java.security.AccessController;" ], "header": "@@ -21,6 +21,8 @@", "removed": [] }, { "added": [ " ContextService csf = getContextService();" ], "header": "@@ -94,7 +96,7 @@ class EmbedXAResource implements XAResource {", "removed": [ " ContextService csf = ContextService.getFactory();" ] }, { "added": [ " ContextService csf = getContextService();" ], "header": "@@ -406,7 +408,7 @@ class EmbedXAResource implements XAResource {", "removed": [ " ContextService csf = ContextService.getFactory();" ] }, { "added": [ " ContextService csf = getContextService();" ], "header": "@@ -456,7 +458,7 @@ class EmbedXAResource implements XAResource {", "removed": [ " ContextService csf = ContextService.getFactory();" ] } ] }, { "file": "java/engine/org/apache/derby/jdbc/EmbeddedDriver.java", "hunks": [ { "added": [], "header": "@@ -91,7 +91,6 @@ import org.apache.derby.impl.jdbc.Util;", "removed": [ "" ] } ] }, { "file": "java/engine/org/apache/derby/jdbc/InternalDriver.java", "hunks": [ { "added": [ "import java.security.AccessController;", "import java.security.PrivilegedAction;" ], "header": "@@ -22,8 +22,10 @@", "removed": [] }, { "added": [ "\t\tcontextServiceFactory = getContextService();" ], "header": "@@ -122,7 +124,7 @@ public class InternalDriver implements ModuleControl, Driver {", "removed": [ "\t\tcontextServiceFactory = ContextService.getFactory();" ] } ] }, { "file": "java/engine/org/apache/derby/security/SystemPermission.java", "hunks": [ { "added": [ " /**", " * Action (<code>\"useDerbyInternals\"</code>) by the engine to lookup Derby contexts.", " */", " public static final String USE_DERBY_INTERNALS = \"usederbyinternals\";", "" ], "header": "@@ -95,6 +95,11 @@ final public class SystemPermission extends BasicPermission {", "removed": [] }, { "added": [ " LEGAL_ACTIONS.add( USE_DERBY_INTERNALS );" ], "header": "@@ -115,6 +120,7 @@ final public class SystemPermission extends BasicPermission {", "removed": [] }, { "added": [ " super( name );" ], "header": "@@ -141,7 +147,7 @@ final public class SystemPermission extends BasicPermission {", "removed": [ " super(name);" ] }, { "added": [ "" ], "header": "@@ -191,6 +197,7 @@ final public class SystemPermission extends BasicPermission {", "removed": [] } ] }, { "file": "java/testing/org/apache/derbyTesting/functionTests/util/PropertyUtil.java", "hunks": [ { "added": [ "", "import java.security.AccessController;", "import java.security.PrivilegedAction;", "", "import org.apache.derby.iapi.services.context.Context;" ], "header": "@@ -20,6 +20,11 @@", "removed": [] } ] }, { "file": "java/testing/org/apache/derbyTesting/functionTests/util/T_ConsistencyChecker.java", "hunks": [ { "added": [ "import java.security.AccessController;", "import java.security.PrivilegedAction;", "import org.apache.derby.iapi.services.context.Context;" ], "header": "@@ -21,9 +21,12 @@", "removed": [] }, { "added": [ "\t\t\tgetContext(LanguageConnectionContext.CONTEXT_ID);" ], "header": "@@ -239,7 +242,7 @@ public class T_ConsistencyChecker", "removed": [ "\t\t\tContextService.getContext(LanguageConnectionContext.CONTEXT_ID);" ] }, { "added": [ " getContext(LanguageConnectionContext.CONTEXT_ID);" ], "header": "@@ -455,7 +458,7 @@ public class T_ConsistencyChecker", "removed": [ " ContextService.getContext(LanguageConnectionContext.CONTEXT_ID);" ] }, { "added": [ " getContext(LanguageConnectionContext.CONTEXT_ID);" ], "header": "@@ -489,7 +492,7 @@ public class T_ConsistencyChecker", "removed": [ " ContextService.getContext(LanguageConnectionContext.CONTEXT_ID);" ] } ] }, { "file": "java/testing/org/apache/derbyTesting/unitTests/harness/BasicUnitTestManager.java", "hunks": [ { "added": [ "import java.security.PrivilegedAction;", "import java.security.AccessController;" ], "header": "@@ -28,6 +28,8 @@ import org.apache.derby.iapi.error.StandardException;", "removed": [] }, { "added": [ "\t\tcontextService = getContextService();" ], "header": "@@ -70,7 +72,7 @@ public class BasicUnitTestManager implements UnitTestManager, ModuleControl", "removed": [ "\t\tcontextService = ContextService.getFactory();" ] } ] }, { "file": "java/testing/org/apache/derbyTesting/unitTests/harness/T_Bomb.java", "hunks": [ { "added": [ "import java.security.PrivilegedAction;", "import java.security.AccessController;" ], "header": "@@ -26,6 +26,8 @@ import org.apache.derby.iapi.services.context.ContextService;", "removed": [] }, { "added": [ "\t\t\tContextService csf = getContextService();" ], "header": "@@ -115,7 +117,7 @@ public class T_Bomb implements Runnable {", "removed": [ "\t\t\tContextService csf = ContextService.getFactory();" ] } ] }, { "file": "java/testing/org/apache/derbyTesting/unitTests/store/T_AccessFactory.java", "hunks": [ { "added": [ "import java.security.PrivilegedAction;", "import java.security.AccessController;" ], "header": "@@ -46,6 +46,8 @@ import org.apache.derby.iapi.reference.Property;", "removed": [] }, { "added": [ " getContextService().getCurrentContextManager();" ], "header": "@@ -119,7 +121,7 @@ public class T_AccessFactory extends T_Generic", "removed": [ " ContextService.getFactory().getCurrentContextManager();" ] }, { "added": [ " getContextService().getCurrentContextManager());" ], "header": "@@ -2980,7 +2982,7 @@ public class T_AccessFactory extends T_Generic", "removed": [ " ContextService.getFactory().getCurrentContextManager());" ] }, { "added": [ " getContextService().getCurrentContextManager());" ], "header": "@@ -2988,7 +2990,7 @@ public class T_AccessFactory extends T_Generic", "removed": [ " ContextService.getFactory().getCurrentContextManager());" ] }, { "added": [ "\t\tContextManager cm2 = getContextService().newContextManager();", "\t\tgetContextService().setCurrentContextManager(cm2);" ], "header": "@@ -3337,9 +3339,9 @@ public class T_AccessFactory extends T_Generic", "removed": [ "\t\tContextManager cm2 = ContextService.getFactory().newContextManager();", "\t\tContextService.getFactory().setCurrentContextManager(cm2);" ] }, { "added": [ "\t\t\tgetContextService().resetCurrentContextManager(cm2);" ], "header": "@@ -3368,7 +3370,7 @@ public class T_AccessFactory extends T_Generic", "removed": [ "\t\t\tContextService.getFactory().resetCurrentContextManager(cm2);" ] }, { "added": [ "\t\tgetContextService().setCurrentContextManager(cm2);" ], "header": "@@ -3382,7 +3384,7 @@ public class T_AccessFactory extends T_Generic", "removed": [ "\t\tContextService.getFactory().setCurrentContextManager(cm2);" ] }, { "added": [ "\t\t\tgetContextService().resetCurrentContextManager(cm2);" ], "header": "@@ -3391,7 +3393,7 @@ public class T_AccessFactory extends T_Generic", "removed": [ "\t\t\tContextService.getFactory().resetCurrentContextManager(cm2);" ] } ] }, { "file": "java/testing/org/apache/derbyTesting/unitTests/store/T_FileSystemData.java", "hunks": [ { "added": [ "import java.security.PrivilegedAction;", "import java.security.AccessController;" ], "header": "@@ -44,6 +44,8 @@ import org.apache.derby.iapi.store.access.conglomerate.LogicalUndo;", "removed": [] }, { "added": [ "\t\tcontextService = getContextService();" ], "header": "@@ -87,7 +89,7 @@ public class T_FileSystemData extends T_MultiThreadedIterations {", "removed": [ "\t\tcontextService = ContextService.getFactory();" ] } ] }, { "file": "java/testing/org/apache/derbyTesting/unitTests/store/T_Heap.java", "hunks": [ { "added": [ "import java.security.PrivilegedAction;", "import java.security.AccessController;" ], "header": "@@ -46,6 +46,8 @@ import org.apache.derby.iapi.store.access.TransactionController;", "removed": [] }, { "added": [ " getContextService().getCurrentContextManager());" ], "header": "@@ -96,7 +98,7 @@ public class T_Heap extends T_Generic", "removed": [ " ContextService.getFactory().getCurrentContextManager());" ] } ] }, { "file": "java/testing/org/apache/derbyTesting/unitTests/store/T_RawStoreFactory.java", "hunks": [ { "added": [ "import java.security.PrivilegedAction;", "import java.security.AccessController;" ], "header": "@@ -59,6 +59,8 @@ import org.apache.derby.iapi.reference.Property;", "removed": [] }, { "added": [ "\t\tcontextService = getContextService();" ], "header": "@@ -120,7 +122,7 @@ public class T_RawStoreFactory extends T_MultiThreadedIterations {", "removed": [ "\t\tcontextService = ContextService.getFactory();" ] } ] }, { "file": "java/testing/org/apache/derbyTesting/unitTests/store/T_RecoverBadLog.java", "hunks": [ { "added": [ "import java.security.PrivilegedAction;", "import java.security.AccessController;" ], "header": "@@ -51,6 +51,8 @@ import org.apache.derby.iapi.store.access.Qualifier;", "removed": [] }, { "added": [ "\t\t\tcontextService = getContextService();" ], "header": "@@ -226,7 +228,7 @@ public class T_RecoverBadLog extends T_Generic {", "removed": [ "\t\t\tcontextService = ContextService.getFactory();" ] } ] }, { "file": "java/testing/org/apache/derbyTesting/unitTests/store/T_RecoverFullLog.java", "hunks": [ { "added": [ "import java.security.PrivilegedAction;", "import java.security.AccessController;" ], "header": "@@ -51,6 +51,8 @@ import org.apache.derby.iapi.store.access.conglomerate.LogicalUndo;", "removed": [] }, { "added": [ "\t\t\tcontextService = getContextService();" ], "header": "@@ -165,7 +167,7 @@ public class T_RecoverFullLog extends T_Generic {", "removed": [ "\t\t\tcontextService = ContextService.getFactory();" ] } ] }, { "file": "java/testing/org/apache/derbyTesting/unitTests/store/T_Recovery.java", "hunks": [ { "added": [ "import java.security.PrivilegedAction;", "import java.security.AccessController;" ], "header": "@@ -59,6 +59,8 @@ import org.apache.derby.iapi.reference.Attribute;", "removed": [] }, { "added": [ "\t\t\tcontextService = getContextService();" ], "header": "@@ -174,7 +176,7 @@ public class T_Recovery extends T_Generic {", "removed": [ "\t\t\tcontextService = ContextService.getFactory();" ] } ] }, { "file": "java/testing/org/apache/derbyTesting/unitTests/store/T_SortController.java", "hunks": [ { "added": [ " getContextService().getCurrentContextManager());" ], "header": "@@ -144,7 +144,7 @@ public class T_SortController extends T_Generic", "removed": [ " ContextService.getFactory().getCurrentContextManager());" ] } ] }, { "file": "java/testing/org/apache/derbyTesting/unitTests/store/T_StreamFile.java", "hunks": [ { "added": [ "import java.security.PrivilegedAction;", "import java.security.AccessController;" ], "header": "@@ -50,6 +50,8 @@ import org.apache.derby.iapi.services.io.FormatableBitSet;", "removed": [] }, { "added": [ "\t\tcontextService = getContextService();" ], "header": "@@ -92,7 +94,7 @@ public class T_StreamFile extends T_MultiThreadedIterations {", "removed": [ "\t\tcontextService = ContextService.getFactory();" ] } ] }, { "file": "java/testing/org/apache/derbyTesting/unitTests/store/T_XA.java", "hunks": [ { "added": [ "import java.security.PrivilegedAction;", "import java.security.AccessController;" ], "header": "@@ -42,6 +42,8 @@ import org.apache.derby.iapi.services.io.FormatIdUtil;", "removed": [] }, { "added": [ " getContextService().getCurrentContextManager();" ], "header": "@@ -179,7 +181,7 @@ public class T_XA extends T_Generic", "removed": [ " ContextService.getFactory().getCurrentContextManager();" ] }, { "added": [ " getContextService().getCurrentContextManager();" ], "header": "@@ -272,7 +274,7 @@ public class T_XA extends T_Generic", "removed": [ " ContextService.getFactory().getCurrentContextManager();" ] }, { "added": [ " getContextService().getCurrentContextManager();" ], "header": "@@ -437,7 +439,7 @@ public class T_XA extends T_Generic", "removed": [ " ContextService.getFactory().getCurrentContextManager();" ] }, { "added": [ " getContextService().getCurrentContextManager();" ], "header": "@@ -557,7 +559,7 @@ public class T_XA extends T_Generic", "removed": [ " ContextService.getFactory().getCurrentContextManager();" ] }, { "added": [ " getContextService().getCurrentContextManager();" ], "header": "@@ -827,7 +829,7 @@ public class T_XA extends T_Generic", "removed": [ " ContextService.getFactory().getCurrentContextManager();" ] }, { "added": [ " getContextService().getCurrentContextManager();" ], "header": "@@ -1068,7 +1070,7 @@ public class T_XA extends T_Generic", "removed": [ " ContextService.getFactory().getCurrentContextManager();" ] }, { "added": [ " ", " /**", " * Privileged lookup of the ContextService. Package protected so that user code", " * can't call this entry point.", " */", " static ContextService getContextService()", " {", " if ( System.getSecurityManager() == null )", " {", " return ContextService.getFactory();", " }", " else", " {", " return AccessController.doPrivileged", " (", " new PrivilegedAction<ContextService>()", " {", " public ContextService run()", " {", " return ContextService.getFactory();", " }", " }", " );", " }", " }", "" ], "header": "@@ -1180,6 +1182,32 @@ public class T_XA extends T_Generic", "removed": [] }, { "added": [ " T_XA.getContextService().getCurrentContextManager(),", " T_XA.getContextService().getCurrentContextManager());" ], "header": "@@ -1230,10 +1258,10 @@ class commit_method", "removed": [ " ContextService.getFactory().getCurrentContextManager(),", " ContextService.getFactory().getCurrentContextManager());" ] } ] }, { "file": "java/testing/org/apache/derbyTesting/unitTests/store/T_b2i.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.services.context.Context;" ], "header": "@@ -39,6 +39,7 @@ import org.apache.derby.iapi.services.monitor.Monitor;", "removed": [] }, { "added": [ "import java.security.PrivilegedAction;", "import java.security.AccessController;" ], "header": "@@ -68,6 +69,8 @@ import org.apache.derby.impl.store.access.conglomerate.TemplateRow;", "removed": [] }, { "added": [ "\t\t\tcontextService = getContextService();" ], "header": "@@ -111,7 +114,7 @@ public class T_b2i extends T_MultiIterations", "removed": [ "\t\t\tcontextService = ContextService.getFactory();" ] }, { "added": [ " ContextService contextFactory = getContextService();" ], "header": "@@ -855,7 +858,7 @@ public class T_b2i extends T_MultiIterations", "removed": [ " ContextService contextFactory = ContextService.getFactory();" ] }, { "added": [ " getContextService();" ], "header": "@@ -3261,7 +3264,7 @@ public class T_b2i extends T_MultiIterations", "removed": [ " ContextService.getFactory();" ] }, { "added": [ " LanguageConnectionContext lcc = (LanguageConnectionContext)", " getContextOrNull(LanguageConnectionContext.CONTEXT_ID);", " ", " /**", " * Privileged lookup of the ContextService. Must be private so that user code", " * can't call this entry point.", " */", " private static ContextService getContextService()", " {", " if ( System.getSecurityManager() == null )", " {", " return ContextService.getFactory();", " }", " else", " {", " return AccessController.doPrivileged", " (", " new PrivilegedAction<ContextService>()", " {", " public ContextService run()", " {", " return ContextService.getFactory();", " }", " }", " );", " }", " }", " ", " /**", " * Privileged lookup of a Context. Must be private so that user code", " * can't call this entry point.", " */", " private static Context getContextOrNull( final String contextID )", " {", " if ( System.getSecurityManager() == null )", " {", " return ContextService.getContextOrNull( contextID );", " }", " else", " {", " return AccessController.doPrivileged", " (", " new PrivilegedAction<Context>()", " {", " public Context run()", " {", " return ContextService.getContextOrNull( contextID );", " }", " }", " );", " }", " }", "", "" ], "header": "@@ -5096,12 +5099,64 @@ public class T_b2i extends T_MultiIterations", "removed": [ " LanguageConnectionContext lcc = (LanguageConnectionContext) ContextService", " .getContextOrNull(LanguageConnectionContext.CONTEXT_ID);" ] } ] } ]
derby-DERBY-665-ffd4e9bd
Fix for DERBY-665, committed on behalf of Suresh Thalamati. Comments from submitter: This patch removes the unused backup functions with File as parameter, git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@372263 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/database/Database.java", "hunks": [ { "added": [], "header": "@@ -85,18 +85,6 @@ public interface Database", "removed": [ "\t/**", "\t * Backup the database to a backup directory. See online documentation", "\t * for more detail about how to use this feature.", "\t *", "\t * @param backupDir the directory where the database backup should", "\t * go. This directory will be created if not it does not exist.", "\t *", "\t * @exception SQLException Thrown on error", "\t */", "\tpublic void backup(File backupDir) throws SQLException;", "", "" ] } ] }, { "file": "java/engine/org/apache/derby/iapi/store/access/AccessFactory.java", "hunks": [ { "added": [], "header": "@@ -243,15 +243,6 @@ public interface AccessFactory", "removed": [ "\t/**", "\t * Backup the database to backupDir. ", "\t * <P>Please see cloudscape on line documentation on backup and restore.", "\t *", "\t * @param backupDir the directory where the backup should be stored.", "\t *", "\t * @exception StandardException Thrown on error", "\t */", "\tpublic void backup(File backupDir) throws StandardException;" ] } ] }, { "file": "java/engine/org/apache/derby/iapi/store/raw/RawStoreFactory.java", "hunks": [ { "added": [], "header": "@@ -657,17 +657,6 @@ public interface RawStoreFactory extends Corruptable {", "removed": [ "\t/**", "\t * Backup the database to backupDir. ", "\t * <P>Please see cloudscape on line documentation on backup and restore.", "\t *", "\t * @param backupDir the directory where the backup should be stored.", "\t *", "\t * @exception StandardException Thrown on error", "\t */", "\tpublic void backup(File backupDir) throws StandardException;", "", "" ] } ] }, { "file": "java/engine/org/apache/derby/impl/db/BasicDatabase.java", "hunks": [ { "added": [], "header": "@@ -338,16 +338,6 @@ public class BasicDatabase implements ModuleControl, ModuleSupportable, Property", "removed": [ "\tpublic void backup(File backupDir) throws SQLException", "\t{", "\t\ttry {", "\t\t\taf.backup(backupDir);", "\t\t} catch (StandardException se) {", "\t\t\tthrow PublicAPI.wrapStandardException(se);", "\t\t}", "\t}", "", "" ] } ] }, { "file": "java/engine/org/apache/derby/impl/store/access/RAMAccessManager.java", "hunks": [ { "added": [], "header": "@@ -934,11 +934,6 @@ public abstract class RAMAccessManager", "removed": [ "\tpublic void backup(File backupDir) throws StandardException", "\t{", "\t\trawstore.backup(backupDir);", "\t}", "" ] } ] }, { "file": "java/engine/org/apache/derby/impl/store/raw/RawStore.java", "hunks": [ { "added": [], "header": "@@ -538,11 +538,6 @@ public final class RawStore implements RawStoreFactory, ModuleControl, ModuleSup", "removed": [ "\tpublic void backup(File backupDir) throws StandardException", "\t{", "\t\tbackup(backupDir);", "\t}", "" ] }, { "added": [], "header": "@@ -860,22 +855,6 @@ public final class RawStore implements RawStoreFactory, ModuleControl, ModuleSup", "removed": [ "\tpublic void backupAndEnableLogArchiveMode(File backupDir,boolean", "\t\t\t\t\t\t\t\t\t\t\t deleteOnlineArchivedLogFiles) ", "\t\tthrows StandardException", "\t{", "\t\tlogFactory.enableLogArchiveMode();", "\t\tbackup(backupDir);", "\t\t//After successful backup delete the archived log files", "\t\t//that are not necessary to do a roll-forward recovery", "\t\t//from this backup if requested.", "\t\tif(deleteOnlineArchivedLogFiles)", "\t\t{", "\t\t\tlogFactory.deleteOnlineArchivedLogFiles();", "\t\t}", "\t}", "", "" ] } ] } ]
derby-DERBY-6650-a69ff90a
DERBY-6650: Lucene tests fail on compact profile 2 Implement the IndexInput.slice() method required by Lucene 4.9. Lucene 4.9 works on compact profile 2. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1609655 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/optional/org/apache/derby/optional/lucene/DerbyIndexInput.java", "hunks": [ { "added": [ "import java.io.EOFException;" ], "header": "@@ -21,6 +21,7 @@", "removed": [] }, { "added": [ " private final ArrayList<IndexInput> _slices = new ArrayList<IndexInput>();", " private final long _offset;", " private final long _length;" ], "header": "@@ -56,7 +57,9 @@ class DerbyIndexInput extends IndexInput", "removed": [ " private final ArrayList<DerbyIndexInput> _clones = new ArrayList<DerbyIndexInput>();" ] }, { "added": [ " this(file, file.getPath(), 0L, null);", " }", "", " /**", " * Create a DerbyIndexInput that reads data from a StorageFile.", " *", " * @param file the file to read from", " * @param description a description of the file (will be returned", " * from {@code toString()})", " * @param offset where to start reading in the file", " * @param length how much of the file to read, {@code null} means", " * read till end of file", " * @throws IOException if an I/O error occurs", " */", " private DerbyIndexInput(StorageFile file, String description,", " long offset, Long length)", " throws IOException", " {", " super(description);", "", " _offset = offset;", " if (length == null) {", " _length = _sraf.length() - offset;", " } else {", " _length = length;", " }", "" ], "header": "@@ -71,9 +74,35 @@ class DerbyIndexInput extends IndexInput", "removed": [ " super( file.getPath() );" ] }, { "added": [ " // A clone is a slice that covers the entire range of this", " // index input instance.", " IndexInput clone = slice(_file.getPath(), 0L, _length);" ], "header": "@@ -107,11 +136,10 @@ class DerbyIndexInput extends IndexInput", "removed": [ " checkIfClosed();", " ", " DerbyIndexInput clone = new DerbyIndexInput( _file );", " _clones.add( clone );" ] }, { "added": [ " public IndexInput slice(String sliceDescription, long offset, long length)", " throws IOException", " {", " checkIfClosed();", "", " if (offset < 0 || length < 0 || offset > _length - length) {", " throw new IllegalArgumentException();", " }", "", " DerbyIndexInput slice = new DerbyIndexInput(", " _file, sliceDescription, _offset + offset, length);", " _slices.add(slice);", " slice.seek(0L);", " return slice;", " }", "" ], "header": "@@ -120,6 +148,22 @@ class DerbyIndexInput extends IndexInput", "removed": [] }, { "added": [ " for ( IndexInput slice : _slices ) { slice.close(); }", " _slices.clear();" ], "header": "@@ -127,8 +171,8 @@ class DerbyIndexInput extends IndexInput", "removed": [ " for ( DerbyIndexInput clone : _clones ) { clone.close(); }", " _clones.clear();" ] }, { "added": [ " return _sraf.getFilePointer() - _offset;" ], "header": "@@ -140,7 +184,7 @@ class DerbyIndexInput extends IndexInput", "removed": [ " return _sraf.getFilePointer();" ] }, { "added": [ " return _length;", " _sraf.seek( _offset + pos );" ], "header": "@@ -148,17 +192,13 @@ class DerbyIndexInput extends IndexInput", "removed": [ "", " try {", " return _sraf.length();", " }", " catch (IOException ioe) { throw wrap( ioe ); }", " _sraf.seek( pos );" ] }, { "added": [ " checkEndOfFile(1);", " checkEndOfFile(len);" ], "header": "@@ -169,14 +209,14 @@ class DerbyIndexInput extends IndexInput", "removed": [ " checkIfClosed();", " checkIfClosed();" ] }, { "added": [ " /**", " * Verify that we can read {@code length} bytes without hitting end", " * of file (or end of the slice represented by this instance).", " *", " * @param length the number of bytes we need", " * @throws EOFException if the requested number of bytes is not available", " * @throws AlreadyClosedException if this object has been closed", " */", " private void checkEndOfFile(int length) throws EOFException {", " // getFilePointer() calls checkIfClosed(), so no need to call it", " // explicitly here.", " long available = _length - getFilePointer();", " if (length > available) {", " throw new EOFException();", " }", " }", "" ], "header": "@@ -194,6 +234,23 @@ class DerbyIndexInput extends IndexInput", "removed": [] }, { "added": [], "header": "@@ -209,10 +266,4 @@ class DerbyIndexInput extends IndexInput", "removed": [ " /** Wrap an exception in an IOException */", " private IOException wrapWithIOException( Throwable t )", " {", " return new IOException( t.getMessage(), t );", " }", " " ] } ] } ]
derby-DERBY-6650-d1c479d2
DERBY-6650: Lucene tests fail on compact profile 2 Disable LuceneSuite on platforms that don't support JMX if the Lucene version is lower than 4.8. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1609686 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-6650-d3f7a7c1
DERBY-6650: Lucene tests fail on compact profile 2 Implement IndexOutput.getChecksum() which is required by Lucene 4.8. Lucene 4.8 works on compact profile 2. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1609428 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/optional/org/apache/derby/optional/lucene/DerbyIndexOutput.java", "hunks": [ { "added": [ "import java.util.zip.CRC32;" ], "header": "@@ -22,9 +22,8 @@", "removed": [ "import java.util.ArrayList;", "import org.apache.lucene.store.AlreadyClosedException;" ] }, { "added": [ " private final CRC32 _crc = new CRC32();" ], "header": "@@ -54,6 +53,7 @@ class DerbyIndexOutput extends IndexOutput", "removed": [] }, { "added": [ " // IndexOutput METHODS" ], "header": "@@ -72,7 +72,7 @@ class DerbyIndexOutput extends IndexOutput", "removed": [ " // IndexInput METHODS" ] }, { "added": [ " public long getChecksum()", " {", " return _crc.getValue();", " }", "", " // DataOutput METHODS", " _crc.update(b);", " _crc.update(b, offset, length);" ], "header": "@@ -110,21 +110,28 @@ class DerbyIndexOutput extends IndexOutput", "removed": [ " // DataInput METHODS" ] } ] } ]
derby-DERBY-6652-57f53e3e
DERBY-6652: Disable the use of views as the source data sets of MERGE statements; tests passed cleanly for me on derby-6652-01-aa-disableSourceViews.diff. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1609450 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/compile/MergeNode.java", "hunks": [ { "added": [ " throw StandardException.newException( SQLState.LANG_SOURCE_NOT_BASE_OR_VTI );" ], "header": "@@ -346,7 +346,7 @@ public final class MergeNode extends DMLModStatementNode", "removed": [ " throw StandardException.newException( SQLState.LANG_SOURCE_NOT_BASE_VIEW_OR_VTI );" ] }, { "added": [ " private boolean sourceIsBase_or_VTI() throws StandardException" ], "header": "@@ -473,7 +473,7 @@ public final class MergeNode extends DMLModStatementNode", "removed": [ " private boolean sourceIsBase_View_or_VTI() throws StandardException" ] }, { "added": [], "header": "@@ -487,7 +487,6 @@ public final class MergeNode extends DMLModStatementNode", "removed": [ " case TableDescriptor.VIEW_TYPE:" ] }, { "added": [ " if ( !sourceIsBase_or_VTI() )", " throw StandardException.newException( SQLState.LANG_SOURCE_NOT_BASE_OR_VTI );" ], "header": "@@ -533,9 +532,9 @@ public final class MergeNode extends DMLModStatementNode", "removed": [ " if ( !sourceIsBase_View_or_VTI() )", " throw StandardException.newException( SQLState.LANG_SOURCE_NOT_BASE_VIEW_OR_VTI );" ] } ] } ]
derby-DERBY-6654-35b010b5
DERBY-6654: Commit ClassLoadingTest with derby-6654-02-aa-ClassLoadingTest.diff. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1626807 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-6660-c9398289
DERBY-6660: ResultSet assertion methods fail in upgrade tests If an error happens in addRsToReport(), don't let it shadow the original error. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1610412 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/junit/JDBC.java", "hunks": [ { "added": [ " try {", " if (rs == null) {", " return BaseTestCase.newAssertionFailedError(", " afe.getMessage() + \"\\n<NULL>\", afe);", " final int c = rsmd.getColumnCount();", " StringBuilder heading = new StringBuilder(\" \");", " StringBuilder underline = new StringBuilder(\" \");", " // Display column headings", " for (int i=1; i<= c; i++) {", " if (i > 1) {", " heading.append(\",\");", " underline.append(\" \");", " }", " int len = heading.length();", " heading.append(rsmd.getColumnLabel(i));", " len = heading.length() - len;", " for (int j = len; j > 0; j--) {", " underline.append(\"-\");", " }", " }", " heading.append(\"\\n\");", " underline.append(\"\\n\");", "", " StringBuilder rowImg = new StringBuilder();", " rowImg.append(afe.getMessage()).", " append(\"\\n\\n\").", " append(heading.toString()).", " append(underline.toString());", "", " if (!rs.isClosed()) {", " final int s = seenRow.size();", "", " // Get any rest of columns of current row", " for (int i=0; i < c - s; i++) {", " String column = null;", "", " try {", " column = rs.getString(s + i + 1);", " } catch (SQLException e) {", " // We may not yet have called next?", " if (e.getSQLState().equals(\"24000\")) {", " if (rs.next()) {", " column = rs.getString(s + i + 1);", " } else {", " break;", " }", " }", " }", " seenRow.add(column);", " }", " if (seenRow.size() > 0) {", " seen.add(new ArrayList<String>(seenRow));", " seenRow.clear();", " }", " // Get any remaining rows", " while (rs.next()) {", " for (int i = 0; i < c; i++) {", " seenRow.add(rs.getString(i + 1));", " seen.add(new ArrayList<String>(seenRow));", " seenRow.clear();", " // Display data", " for (List<String> row : seen) {", " rowImg.append(\" \").", " append(row.toString()).", " append(\"\\n\");", " return BaseTestCase.newAssertionFailedError(rowImg.toString(), afe);", " } catch (Throwable t) {", " // Something went wrong when adding the ResultSet to the error", " // message. Don't return this error, as it would shadow the", " // original error. Print it to help debugging.", " BaseTestCase.printStackTrace(t);", " // Return the original error.", " return afe;", " }" ], "header": "@@ -1796,84 +1796,95 @@ public class JDBC {", "removed": [ " if (rs == null) {", " return new AssertionFailedError(afe.getMessage() + \"\\n<NULL>\");", " }", "", " final int c = rsmd.getColumnCount();", " StringBuilder heading = new StringBuilder(\" \");", " StringBuilder underline = new StringBuilder(\" \");", "", " // Display column headings", " for (int i=1; i<= c; i++) {", " if (i > 1) {", " heading.append(\",\");", " underline.append(\" \");", " int len = heading.length();", " heading.append(rsmd.getColumnLabel(i));", " len = heading.length() - len;", " for (int j = len; j > 0; j--) {", " underline.append(\"-\");", " }", " }", " heading.append(\"\\n\");", " underline.append(\"\\n\");", " StringBuilder rowImg = new StringBuilder();", " rowImg.append(afe.getMessage()).", " append(\"\\n\\n\").", " append(heading.toString()).", " append(underline.toString());", " if (!rs.isClosed()) {", " final int s = seenRow.size();", " // Get any rest of columns of current row", " for (int i=0; i < c - s; i++) {", " String column = null;", " try {", " column = rs.getString(s + i + 1);", " } catch (SQLException e) {", " // We may not yet have called next?", " if (e.getSQLState().equals(\"24000\")) {", " if (rs.next()) {", " column = rs.getString(s + i + 1);", " } else {", " break;", " }", " seenRow.add(column);", " if (seenRow.size() > 0) {", " seen.add(new ArrayList<String>(seenRow));", " seenRow.clear();", " // Get any remaining rows", " while (rs.next()) {", " for (int i = 0; i < c; i++) {", " seenRow.add(rs.getString(i + 1));", " }", " seen.add(new ArrayList<String>(seenRow));", " seenRow.clear();", " }", " }", " // Display data", " for (List<String> row : seen) {", " rowImg.append(\" \").", " append(row.toString()).", " append(\"\\n\");", " }", " return new AssertionFailedError(rowImg.toString());", "" ] } ] } ]
derby-DERBY-6661-3130800a
DERBY-6661: Make dblook recognize deferrable constraints; tests passed cleanly on derby-6661-01-aa-recreateDeferrableConstraints.diff. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1610858 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/tools/org/apache/derby/impl/tools/dblook/DB_Check.java", "hunks": [ { "added": [ "\t\t\t\"CS.TABLEID, CS.SCHEMAID, CS.STATE, CK.CHECKDEFINITION FROM SYS.SYSCONSTRAINTS CS, \" +" ], "header": "@@ -49,7 +49,7 @@ public class DB_Check {", "removed": [ "\t\t\t\"CS.TABLEID, CS.SCHEMAID, CK.CHECKDEFINITION FROM SYS.SYSCONSTRAINTS CS, \" +" ] }, { "added": [ "", " DB_Key.makeDeferredClauses( chkString, rs, 4 );", " " ], "header": "@@ -69,6 +69,9 @@ public class DB_Check {", "removed": [] } ] }, { "file": "java/tools/org/apache/derby/impl/tools/dblook/DB_Key.java", "hunks": [ { "added": [ "\t\t\t\"CS.TABLEID, CS.CONSTRAINTID, CS.SCHEMAID, CS.STATE, CG.DESCRIPTOR, CG.ISCONSTRAINT \" +" ], "header": "@@ -60,7 +60,7 @@ public class DB_Key {", "removed": [ "\t\t\t\"CS.TABLEID, CS.CONSTRAINTID, CS.SCHEMAID, CG.DESCRIPTOR, CG.ISCONSTRAINT \" +" ] }, { "added": [ "\t\t\t\"CS.CONSTRAINTID, CS.SCHEMAID, CS.STATE, CG.DESCRIPTOR, CG.ISCONSTRAINT, \" +" ], "header": "@@ -68,7 +68,7 @@ public class DB_Key {", "removed": [ "\t\t\t\"CS.CONSTRAINTID, CS.SCHEMAID, CG.DESCRIPTOR, CG.ISCONSTRAINT, \" +" ] }, { "added": [ "\t\t\tif (!rs.getBoolean(8))" ], "header": "@@ -99,7 +99,7 @@ public class DB_Key {", "removed": [ "\t\t\tif (!rs.getBoolean(7))" ] }, { "added": [ "\t\t\t\tkString.append(makeFKReferenceClause(rs.getString(11),", "\t\t\t\t\trs.getString(9).charAt(0), rs.getString(10).charAt(0)));", " makeDeferredClauses( kString, rs, 6 );", "" ], "header": "@@ -121,10 +121,12 @@ public class DB_Key {", "removed": [ "\t\t\t\tkString.append(makeFKReferenceClause(rs.getString(10),", "\t\t\t\t\trs.getString(8).charAt(0), rs.getString(9).charAt(0)));" ] }, { "added": [ "\t\t\ttableId, aKey.getString(7)));" ], "header": "@@ -163,7 +165,7 @@ public class DB_Key {", "removed": [ "\t\t\ttableId, aKey.getString(6)));" ] }, { "added": [ "\t/* ************************************************", "\t * Generate the clauses for deferred constraints.", "\t * @param buffer Evolving buffer where we write additional clauses.", "\t * @param aKey Info on the key to generate.", "\t * @param stateColumn 1-based position of the STATE column in the result set", "\t * @return DDL for the specified key is returned as", "\t * a string.", "\t ****/", "", "\tstatic void makeDeferredClauses", " ( StringBuffer buffer, ResultSet constraint, int stateColumn )", "\t\tthrows SQLException", "\t{", " String state = constraint.getString( stateColumn );", "\t\tString constraintName =", " dblook.addQuotes( dblook.expandDoubleQuotes( constraint.getString( 1 ) ) );", " boolean deferrable = false;", " boolean initiallyDeferred = false;", " boolean enforced = true;", "", " // cloned from SYSCONSTRAINTSRowFactory.buildDescriptor()", "\t\tswitch ( state.charAt( 0 ) )", "\t\t{", " case 'E': ", " deferrable = false;", " initiallyDeferred = false;", " enforced = true;", " break;", " case 'D':", " deferrable = false;", " initiallyDeferred = false;", " enforced = false;", " break;", " case 'e':", " deferrable = true;", " initiallyDeferred = true;", " enforced = true;", " break;", " case 'd':", " deferrable = true;", " initiallyDeferred = true;", " enforced = false;", " break;", " case 'i':", " deferrable = true;", " initiallyDeferred = false;", " enforced = true;", " break;", " case 'j':", " deferrable = true;", " initiallyDeferred = false;", " enforced = false;", " break;", " default: ", " Logs.debug", " (", " \"INTERNAL ERROR: Invalid state value '\" + state + \"' for constraint \" + constraintName,", " (String) null", " );", " }", "", " if ( deferrable )", " {", " buffer.append( \" DEFERRABLE \" );", " if ( initiallyDeferred )", " {", " buffer.append( \" INITIALLY DEFERRED \" );", " }", " }", " }", "", "" ], "header": "@@ -252,6 +254,78 @@ public class DB_Key {", "removed": [] } ] } ]
derby-DERBY-6662-f0d43cea
DERBY-6662; DatabaseMetaData.usesLocalFiles() returns true for in-memory databases Adding a test case using the metadata optional tool. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1627851 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-6663-b08f4211
DERBY-6663: NPE when a trigger tries to insert into a table with a foreign key Make sure FKInfo serializes its fkIds field so that the information is available in stored prepared plans too. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1610711 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/execute/FKInfo.java", "hunks": [ { "added": [ " ArrayUtil.writeArray(out, fkIds);" ], "header": "@@ -291,6 +291,7 @@ public class FKInfo implements Formatable", "removed": [] } ] } ]
derby-DERBY-6664-f65be8f9
DERBY-6664: Schema 'null' does not exist when trigger inserts into table with deferred foreign key Make sure the FKInfo class stores its schemaName field. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1610836 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/execute/FKInfo.java", "hunks": [ { "added": [ " out.writeObject(schemaName);" ], "header": "@@ -277,6 +277,7 @@ public class FKInfo implements Formatable", "removed": [] } ] } ]
derby-DERBY-6665-2db96c55
DERBY-6665 Violation of deferred constraints not detected when conglomerates are shared Patch (derby-6665-dhw-dont-share) to fix missing logic to exclude deferrable foreign key constrants form sharing supporting index. Adds repro tests to ForeignKeysDeferrableTest. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1614327 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/compile/TableElementList.java", "hunks": [ { "added": [ " cChars[0],", " cChars[1]," ], "header": "@@ -1061,12 +1061,8 @@ class TableElementList extends QueryTreeNodeVector<TableElementNode>", "removed": [ " cChars[0] & // deferrable ?", " (constraintType !=", " DataDictionary.FOREIGNKEY_CONSTRAINT),", " cChars[1] & // initiallyDeferred ?", " (constraintType !=", " DataDictionary.FOREIGNKEY_CONSTRAINT)," ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/CreateIndexConstantAction.java", "hunks": [ { "added": [ " /**", " * The constraint type, see ", " * {@link org.apache.derby.iapi.sql.dictionary.DataDictionary} ", " * definition of constants.", " */", " private final int constraintType;", " " ], "header": "@@ -100,6 +100,13 @@ class CreateIndexConstantAction extends IndexConstantAction", "removed": [] }, { "added": [ " int constraintType," ], "header": "@@ -171,6 +178,7 @@ class CreateIndexConstantAction extends IndexConstantAction", "removed": [] }, { "added": [ " this.constraintType = constraintType;" ], "header": "@@ -189,6 +197,7 @@ class CreateIndexConstantAction extends IndexConstantAction", "removed": [] }, { "added": [ " this.constraintType = -1; // N/A" ], "header": "@@ -243,6 +252,7 @@ class CreateIndexConstantAction extends IndexConstantAction", "removed": [] }, { "added": [ " indexType, ", " unique, ", " uniqueWithDuplicateNulls,", " uniqueDeferrable,", " (hasDeferrableChecking && ", " constraintType != DataDictionary.FOREIGNKEY_CONSTRAINT),", " baseColumnPositions,", " isAscending,", " baseColumnPositions.length);" ], "header": "@@ -661,14 +671,15 @@ class CreateIndexConstantAction extends IndexConstantAction", "removed": [ " indexType, ", " unique, ", " uniqueWithDuplicateNulls,", " uniqueDeferrable,", " hasDeferrableChecking,", " baseColumnPositions,", " isAscending,", " baseColumnPositions.length);" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/GenericConstantActionFactory.java", "hunks": [ { "added": [ " * @param constraintType The constraint type" ], "header": "@@ -230,6 +230,7 @@ public class GenericConstantActionFactory", "removed": [] }, { "added": [ " int constraintType," ], "header": "@@ -248,6 +249,7 @@ public class GenericConstantActionFactory", "removed": [] } ] } ]
derby-DERBY-6666-bde481bd
DERBY-6666 Deferred constraint validation fails with "dead statement" when query plan logging is enabled Patch derby-6666c. It removes this issue by adding push and push of the statement context to the lcc before we execute the internal query to check for check constraint violation. We had neglected to do this, which caused a problem for the logging since the statement context should always be properly initialized during execution. This patch also adds a new test, derby6666 to ConstraintCharacteristicsTest which fails without the fix in this patch (equivalent to repro). git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1614796 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/execute/DeferredConstraintsMemory.java", "hunks": [ { "added": [ "import java.sql.ResultSet;" ], "header": "@@ -20,6 +20,7 @@", "removed": [] }, { "added": [ "import org.apache.derby.iapi.sql.conn.StatementContext;" ], "header": "@@ -33,6 +34,7 @@ import org.apache.derby.iapi.sql.Activation;", "removed": [] }, { "added": [ " ", "", " StatementContext statementContext = null;", " ", " statementContext =", " lcc.pushStatementContext(true,", " true,", " checkStmt.toString(),", " null,", " false, 0L);" ], "header": "@@ -624,20 +626,29 @@ final public class DeferredConstraintsMemory", "removed": [ "" ] } ] } ]
derby-DERBY-6668-64b63085
DERBY-6668: Forbid TRUNCATE on tables referenced by deferred foreign keys; commit derby-6668-01-ab-disallowTruncateOnReferencedTable.diff. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1611342 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-6672-f80e3cee
DERBY-6672: Allow the renaming of referenced tables; commit derby-6672-01-ab-addTests.diff. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1614681 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/sql/dictionary/ConstraintDescriptor.java", "hunks": [ { "added": [ "\t\t case DependencyManager.RENAME:" ], "header": "@@ -547,6 +547,7 @@ public abstract class ConstraintDescriptor", "removed": [] } ] } ]
derby-DERBY-6674-a42c32ea
DERBY-6674 Cleanup brittle code in ValidateCheckConstraintResultSet Patch derby-6674. Refactors the code by reusing getNextRowCore (to avoid the redundancy) for ValidateCheckConstraintResultSet but abstracting out the loop control, which is overridden by ValidateCheckConstraintResultSet. fix git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1614963 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/execute/TableScanResultSet.java", "hunks": [ { "added": [ "", " boolean loopControl(boolean moreRows) throws StandardException {", " return scanController.fetchNext(candidate.getRowArray());", " }", "" ], "header": "@@ -446,6 +446,11 @@ class TableScanResultSet extends ScanResultSet", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/ValidateCheckConstraintResultSet.java", "hunks": [ { "added": [], "header": "@@ -27,11 +27,8 @@ import org.apache.derby.iapi.reference.SQLState;", "removed": [ "import org.apache.derby.iapi.sql.execute.ExecRow;", "import org.apache.derby.iapi.types.RowLocation;", "import org.apache.derby.shared.common.sanity.SanityManager;" ] }, { "added": [ " boolean loopControl(boolean moreRows) throws StandardException {", " try {", " scanController.fetch(candidate.getRowArray());", " } catch (StandardException e) {", " // Offending rows may have been deleted in the", " // transaction. As for compress, we won't even get here", " // since we use a normal SELECT query then.", " if (e.getSQLState().equals(", " ExceptionUtil.getSQLStateFromIdentifier(", " SQLState.AM_RECORD_NOT_FOUND))) {", " moreRows = false;", " } else {", " throw e;", " }", " }", " return moreRows;" ], "header": "@@ -97,120 +94,22 @@ final class ValidateCheckConstraintResultSet extends TableScanResultSet", "removed": [ " /**", " * Return the current row (if any) from the base table scan, positioned", " * correctly by our caller (ProjectRestrictNode). It overrides", " * getNextRowCore from TableSCanResultSet, by using \"fetch\" instead of", " * \"fetchNext\" on the underlying controller, otherwise it's identical.", " * (This means it's probably over-general for the usage we have of it,", " * but it felt safer to keep the code as similar as possible.)", " * @return the row retrieved", " * @exception StandardException thrown on failure to get next row", " */", " public ExecRow getNextRowCore() throws StandardException {", " if (isXplainOnlyMode()) {", " return null;", " }", "", " checkCancellationFlag();", "", " if (SanityManager.DEBUG) {", " SanityManager.ASSERT(scanRepositioned);", " }", "", " if (currentRow == null || scanRepositioned) {", " currentRow = getCompactRow(candidate, accessedCols, isKeyed);", " }", "", " beginTime = getCurrentTimeMillis();", "", " ExecRow result = null;", "", " if (isOpen && !nextDone) {", " // Only need to do 1 next per scan for 1 row scans.", " nextDone = oneRowScan;", "", " if ( scanControllerOpened) {", " boolean moreRows = true;", "", " while (moreRows) {", " try {", " scanController.fetch(candidate.getRowArray());", " } catch (StandardException e) {", " // Offending rows may have been deleted in the", " // transaction. As for compress, we won't even get here", " // since we use a normal SELECT query then.", " if (e.getSQLState().equals(", " ExceptionUtil.getSQLStateFromIdentifier(", " SQLState.AM_RECORD_NOT_FOUND))) {", " moreRows = false;", " break;", " } else {", " throw e;", " }", " }", "", " rowsSeen++;", " rowsThisScan++;", "", " /*", " ** Skip rows where there are start or stop positioners", " ** that do not implement ordered null semantics and", " ** there are columns in those positions that contain", " ** null.", " ** No need to check if start and stop positions are the", " ** same, since all predicates in both will be ='s,", " ** and hence evaluated in the store.", " */", " if ((! sameStartStopPosition) && skipRow(candidate)) {", " rowsFiltered++;", " continue;", " }", "", " /* beetle 3865, updateable cursor use index. If we have a", " * hash table that holds updated records, and we hit it", " * again, skip it, and remove it from hash since we can't", " * hit it again, and we have a space in hash, so can stop", " * scanning forward.", " */", " if (past2FutureTbl != null) {", " RowLocation rowLoc = (RowLocation)currentRow.getColumn(", " currentRow.nColumns());", " if (past2FutureTbl.remove(rowLoc) != null) {", " continue;", " }", " }", "", " result = currentRow;", " break;", " }", "", " /*", " ** If we just finished a full scan of the heap, update", " ** the number of rows in the scan controller.", " **", " ** NOTE: It would be more efficient to only update the", " ** scan controller if the optimizer's estimated number of", " ** rows were wrong by more than some threshold (like 10%).", " ** This would require a little more work than I have the", " ** time for now, however, as the row estimate that is given", " ** to this result set is the total number of rows for all", " ** scans, not the number of rows per scan.", " */", " if (! moreRows) {", " setRowCountIfPossible(rowsThisScan);", " currentRow = null;", " }", " }", " }", "", " setCurrentRow(result);", " currentRowIsValid = true;", " scanRepositioned = false;", " qualify = true;", "", " nextTime += getElapsedMillis(beginTime);", " return result;" ] } ] } ]
derby-DERBY-668-aeb4b102
DERBY-668: SysInfo does not print the right info in class loader scenarios This change modifies the sysinfo tool to print additional information about the classes and jars that it examines. For each class that sysinfo examines, it now calls getProtectionDomain().getCodeSource() to retrieve information about the source of that file, which might be: an entry in the application classpath, an entry in a class loader location list, a jar fetched due to being listed in the manifest entry of another jar, a standard extension in the JRE's extensions directory, a jar installed into the application server, or any of various other possibilities. The additional information about the class's origin is displayed in the sysinfo output. Note that when sysinfo runs under a Java security manager, it may need special permissions to access this additional information, including the permission to read the java.class.path property, and the permission to call getProtectionDomain on a class. If sysinfo is not granted these permissions, it will display an error message about the security problem in place of displaying the class origin information. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@387599 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/tools/org/apache/derby/impl/tools/sysinfo/Main.java", "hunks": [ { "added": [ "import java.net.URL;", "import java.security.ProtectionDomain;", "import java.security.CodeSource;", "import java.security.PrivilegedAction;", "import java.security.AccessController;" ], "header": "@@ -39,6 +39,11 @@ import java.io.FileInputStream;", "removed": [] }, { "added": [ " localAW.println(", " Main.getTextMessage (\"SIF01.U\", se.getMessage()));" ], "header": "@@ -195,6 +200,8 @@ public static void getMainInfo (java.io.PrintWriter aw, boolean pause) {", "removed": [] }, { "added": [ "\t\t\tClass c = Class.forName(cn);", " String loc = getFileWhichLoadedClass(c);", " successes.append(found(cn, library, loc));" ], "header": "@@ -573,8 +580,9 @@ public static void getMainInfo (java.io.PrintWriter aw, boolean pause) {", "removed": [ "\t\t\tClass.forName(cn);", "\t\t\tsuccesses.append(found(cn, library));" ] }, { "added": [ " String loc = getFileWhichLoadedClass(cn.getClass());", "\t\t\tsuccesses.append(found(cn, library, loc));" ], "header": "@@ -591,7 +599,8 @@ public static void getMainInfo (java.io.PrintWriter aw, boolean pause) {", "removed": [ "\t\t\tsuccesses.append(found(cn, library));" ] }, { "added": [ "\tprivate static String found(String cn, String library, String loc) {", " if (loc != null)", " temp.append(\" \").append(loc).append(crLf());" ], "header": "@@ -601,10 +610,12 @@ public static void getMainInfo (java.io.PrintWriter aw, boolean pause) {", "removed": [ "\tprivate static String found(String cn, String library) {" ] }, { "added": [ " String loc = getFileWhichLoadedClass(c);", " // For db2jcc.jar, report the actual file from which DB2Driver", " // was loaded, if we can determine it. For db2jcc_license_c,", " // report the filename from the classpath, and the version ", " // info from the DB2Driver that we loaded. This is slightly", " // misleading, since db2jcc_license_c.jar doesn't really have", " // a \"version\", but the two jars are usually linked.", " if (loc != null && filename.indexOf(\"license_c\") < 0)", " zip.setLocation(loc);", " else" ], "header": "@@ -885,6 +896,16 @@ public static void getMainInfo (java.io.PrintWriter aw, boolean pause) {", "removed": [] } ] } ]
derby-DERBY-6680-953afd70
DERBY-6680 Other jar files may need to be granted permission to read derby.ui.* properties derby-6680-2. This patch moves the reading of the two system properties up into NetworkServerControlImpl. Other usage of LocalizedResource is unaffected and might still try to read those system properties, i.e. as called from ij. Removes the note about LocalizedResource in the policy template file. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1620378 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/drda/org/apache/derby/drda/NetServlet.java", "hunks": [ { "added": [ " LocalizedResource langUtil = new LocalizedResource(SERVLET_PROP_MESSAGES);" ], "header": "@@ -122,7 +122,7 @@ public class NetServlet extends HttpServlet {", "removed": [ " LocalizedResource langUtil = new LocalizedResource(null,null,SERVLET_PROP_MESSAGES);" ] } ] }, { "file": "java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java", "hunks": [ { "added": [ " final String codeSet = ", " PropertyUtil.getSystemProperty(LocalizedResource.ENV_CODESET);", " final String locale = ", " PropertyUtil.getSystemProperty(LocalizedResource.ENV_LOCALE);", " langUtil = new LocalizedResource(codeSet, locale, DRDA_PROP_MESSAGES);" ], "header": "@@ -464,8 +464,12 @@ public final class NetworkServerControlImpl {", "removed": [ " langUtil = new LocalizedResource(null,null,DRDA_PROP_MESSAGES);" ] } ] }, { "file": "java/tools/org/apache/derby/iapi/tools/i18n/LocalizedResource.java", "hunks": [ { "added": [ "import java.sql.Timestamp;", "import java.text.DateFormat;", "import java.text.DecimalFormat;", "import java.text.FieldPosition;", "import java.text.MessageFormat;", "import java.text.NumberFormat;", "import java.text.ParseException;", "import java.util.Date;", "import java.util.Locale;", "import java.util.ResourceBundle;", "import java.util.StringTokenizer;" ], "header": "@@ -23,24 +23,21 @@ package org.apache.derby.iapi.tools.i18n;", "removed": [ "", "import java.util.ResourceBundle;", "import java.util.Date;", "import java.util.Locale;", "import java.util.StringTokenizer;", "", "import java.text.MessageFormat;", "import java.text.NumberFormat;", "import java.text.DecimalFormat;", "import java.text.DateFormat;", "import java.text.ParseException;", "import java.text.FieldPosition;", "", "import java.sql.Timestamp;" ] }, { "added": [ " public final static String ENV_CODESET = \"derby.ui.codeset\";", " public final static String ENV_LOCALE = \"derby.ui.locale\";" ], "header": "@@ -49,8 +46,8 @@ public final class LocalizedResource implements java.security.PrivilegedAction<", "removed": [ "\tprivate final static String ENV_CODESET = \"derby.ui.codeset\";", "\tprivate final static String ENV_LOCALE = \"derby.ui.locale\";" ] }, { "added": [ "", " private LocalizedResource(){", " public LocalizedResource(String msgF){", " init(null, null, msgF, true);", "", " /**", " * This overload version does <b>not</b> check the environment for values of", " * encoding via {@link #ENV_CODESET} and locale via {@link #ENV_LOCALE}.", " * The others do if value of either is null. DERBY-6680.", " * @param encStr encoding", " * @param locStr locale", " * @param msgF message file", " */", " public LocalizedResource(String encStr, String locStr, String msgF){", " init(encStr,locStr,msgF, false);", " }", "", " public static LocalizedResource getInstance(){" ], "header": "@@ -65,13 +62,27 @@ public final class LocalizedResource implements java.security.PrivilegedAction<", "removed": [ "\tpublic LocalizedResource(){", "\tpublic LocalizedResource(String encStr, String locStr, String msgF){", "\t\tinit(encStr,locStr,msgF);", "\tpublic static LocalizedResource getInstance(){" ] }, { "added": [ "", "", " public void init (String encStr, String locStr, String msgF) {", " init(encStr, locStr, msgF, true);", " }", "", " private void init (String encStr, String locStr, String msgF, boolean readEnv){", " if (encode == null && readEnv) {" ], "header": "@@ -88,12 +99,18 @@ public final class LocalizedResource implements java.security.PrivilegedAction<", "removed": [ "\tpublic void init (String encStr, String locStr, String msgF){", "\t\tif (encode == null) {" ] } ] }, { "file": "java/tools/org/apache/derby/impl/tools/sysinfo/Main.java", "hunks": [ { "added": [ " new LocalizedResource(MESSAGE_FILE);" ], "header": "@@ -106,7 +106,7 @@ public final class Main {", "removed": [ " new LocalizedResource(null, null, MESSAGE_FILE);" ] } ] } ]
derby-DERBY-6684-dd7698b8
DERBY-6684(Failure in testDERBY5120NumRowsInSydependsForTrigger when upgrading from 10.11.1.0 to trunk) We ran into DERBY-6684 after the fix for DERBY-2041 went into 10.11 The failure is the expected behavior since when dropping a table, we should detect any dependent triggers defined on other tables and drop table should fail if such dependencies exist. To fix the test failure, we just need to switch the order of drop table DERBY-2041(Trigger should register a dependency on tables and columns used in its body) Drop ATDC_TAB1 before ATDC_BKUP1 because ATDC_TAB1 has a trigger on it which references ATDC_BKUP1. If we try dropping ATDC_BKUP1 without first dropping ATDC_TAB1, there will be an error message that trigger ATDC_TAB1_TRG1 depends on ATDC_BKUP1 git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1617641 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-6688-e9ac8241
DERBY-6688 NPE (or sane: ASSERT failure) with ROW_NUMBER in some subqueries In FromSubquery (used in the OK subquery) the phasing is different than in SubqueryNode (used in the failing query): the order by list is pushed down too late in the SubqueryNode (after the SelectNode#preprocess), so that the fact that the order by carries an implicit window definition isn't recorded, causing the "windows" field to be null, leading to missing rewriting in the getProjectRestrict phase, hence the error. In FromSubquery, the order by list is pushed down into the child select node just before calling its preprocess method, i.e. the order by list is present what that happens. The patch (derby-6688-b) moves the pushing down of the order by list in SubqueryNode#preprocess to the resultSet (the SelectNode) to just before the call to preprocess of the resultSet, so the rest of the windows rewriting machinery kicks in. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1616332 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/compile/SubqueryNode.java", "hunks": [ { "added": [ " final boolean haveOrderBy; // need to remember for flattening decision", "", " // Push the order by list down to the ResultSet", " if (orderByList != null) {", " haveOrderBy = true;", " // If we have more than 1 ORDERBY columns, we may be able to", " // remove duplicate columns, e.g., \"ORDER BY 1, 1, 2\".", " if (orderByList.size() > 1)", " {", " orderByList.removeDupColumns();", " }", "", " resultSet.pushOrderByList(orderByList);", " orderByList = null;", " } else {", " haveOrderBy = false;", " }", "", " resultSet = resultSet.preprocess(numTables, null, (FromList) null);" ], "header": "@@ -622,7 +622,25 @@ class SubqueryNode extends ValueNode", "removed": [ "\t\tresultSet = resultSet.preprocess(numTables, null, (FromList) null);" ] }, { "added": [ " !haveOrderBy &&" ], "header": "@@ -684,7 +702,7 @@ class SubqueryNode extends ValueNode", "removed": [ " orderByList == null &&" ] }, { "added": [ " !haveOrderBy &&" ], "header": "@@ -756,7 +774,7 @@ class SubqueryNode extends ValueNode", "removed": [ " orderByList == null &&" ] } ] } ]
derby-DERBY-6690-b737f16b
DERBY-6690 ROW_NUMBER should not be allowed in generation clause Patch *derby-6690* makes this illegal by adding a check in TableElementList#bindAndValidateGeneration. I had to add an acceptChildren method to GenerationClauseNode for the visitor to reach down into the generation clause. Added a test to OLAPTest#testBasicOperations for both CREATE TABLE and ALTER TABLE ADD COLUMN. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1616365 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/compile/GenerationClauseNode.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.sql.compile.Visitor;" ], "header": "@@ -26,6 +26,7 @@ import org.apache.derby.iapi.error.StandardException;", "removed": [] } ] } ]
derby-DERBY-6691-5b0cb063
DERBY-6691 ROW_NUMBER should not be allowed as argument in a procedure call Patch *derby-6691* makes this usage throw 42ZC2 and adds a test to OLAPTest#testBasicOperations. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1616335 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-6692-4222fe98
DERBY-6692: Fix self-deadlock regression in soft-upgraded database; commit derby-6692-01-ab-withTests.diff. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1616299 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-6693-843145a2
DERBY-6693 Assert failure/ArrayIndexOutOfBoundsException when using COUNT in MERGE matching clause Patch derby-6693 which forbids aggregates in the matching clauses, and adds a test case to MergeStatementTest, but: the checked in code using assertCompileError instead of assertStatementError for more precision (in MergeStatementTest). git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1616523 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-6697-3be84645
DERBY-6697: Failures when running tests with JaCoCo Add permissions needed by JaCoCo to MissingPermissionTest's custom policy file. Make BaseTestCase.execJavaCmd() propagate the empty jacoco.active property to sub-processes if the tests are running with JaCoCo. Adjust dummy arguments given to procedures in DBOAccessTest so that they fail with an error that is not affected by the broader permissions granted when running with JaCoCo. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1617240 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-6699-5c2ad716
DERBY-6699 Error in PredicatePushdownTest.test_predicatePushdown Patch derby-6699-diagnostics makes the sane build print information about the contents of the two stacks when the ASSERT fails. Since this error is intermittent it may help debug the issue. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1616807 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/services/bytecode/Type.java", "hunks": [ { "added": [ " @Override", " public String toString() {", " StringBuilder sb = new StringBuilder();", " sb.append(\"[\");", " sb.append(javaName);", " sb.append(\", \");", " sb.append(vmType);", " sb.append(\", \");", " sb.append(vmName);", " sb.append(\", \");", " sb.append(vmNameSimple);", " sb.append(\"]\");", " ", " return sb.toString();", " }" ], "header": "@@ -47,6 +47,21 @@ final class Type {", "removed": [] } ] } ]
derby-DERBY-670-0ce6b779
DERBY-670 - improve automatic space reclamation of long rows and long columns. This patch provides a non-upgrade solution to the problem. It uses existing row and column format information to determine at delete time if the row or column is "long". If so it schedules a post commit reclamation immediately rather than waiting for all rows on a page to be deleted. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@383663 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/store/raw/Page.java", "hunks": [ { "added": [], "header": "@@ -317,10 +317,6 @@ public interface Page", "removed": [ "\t/**", "\t\tUpdate the complete record identified by the record handle.", "", "\t*/" ] }, { "added": [], "header": "@@ -548,10 +544,6 @@ public interface Page", "removed": [ "\t/**", "\t\tInsert a record at the specified slot. ", "\t\t<P>", "\t */" ] }, { "added": [], "header": "@@ -618,10 +610,6 @@ public interface Page", "removed": [ "\t/**", "\t\tValues for insertFlag:", "\t\t", "\t*/" ] }, { "added": [ "\tstatic final byte INSERT_INITIAL = (byte) 0x00;\t// init the flag", "\tstatic final byte INSERT_DEFAULT = (byte) 0x01;\t// default flag", "\tstatic final byte INSERT_CONDITIONAL = (byte) 0x04;\t// conditional ", "\tstatic final byte INSERT_OVERFLOW = (byte) 0x08;\t// insert with ", "\tstatic final byte INSERT_FOR_SPLIT = (byte) 0x10;\t// rawstore only" ], "header": "@@ -661,14 +649,14 @@ public interface Page", "removed": [ "\tstatic final byte INSERT_INITIAL =\t\t (byte) 0x00;\t// init the flag", "\tstatic final byte INSERT_DEFAULT =\t\t (byte) 0x01;\t// default flag", "\tstatic final byte INSERT_CONDITIONAL = (byte) 0x04;\t// conditional ", "\tstatic final byte INSERT_OVERFLOW =\t\t (byte) 0x08;\t// insert with ", "\tstatic final byte INSERT_FOR_SPLIT =\t (byte) 0x10;\t// rawstore only" ] } ] } ]
derby-DERBY-6701-086dc6d3
DERBY-6701: Instability in RuntimeInfoTest.x_testRuntimeInfoAfterConnClose Keep calling getRuntimeInfo() for up to a minute until it gives the expected response. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1619776 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-6702-dac3aab9
DERBY-6702; test failure in NSSecurityMechanismTest; The expected SQL state must be five characters long Working around this intermittent error condition; when it happens we'll see 'ALARM', but no test failure. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1624064 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-6704-8ad67d3b
DERBY-6704 Hang in AutoloadTest.spawnProcess:JDBCDriversEmbeddedTest on Mac/jdk7,8 Patch derby-6704b: it collects std out and err for the spawned subprocesses, and also forward the debug options "derby.tests.debug" and "derby.tests.trace" to the subprocesses. If any of those are set, we collect the std err and std out and print them interleaved with that of the top process. The patch will also try to get a jstack status of a hanging subprocess before killing it (only works on Unixen) - hopefully this would work also on MacOs; it uses a little dirty reflection to access a private PID field in the underlying Process class object before trying a jstack. For this to work, the test must also run using an Oracle JDK, a JRE doesn't have a jstack. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1618088 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/junit/SpawnedProcess.java", "hunks": [ { "added": [ "import java.io.File;", "import java.lang.reflect.Field;", "import java.security.AccessController;", "import java.security.PrivilegedActionException;", "import java.security.PrivilegedExceptionAction;", "import static junit.framework.Assert.assertTrue;", "import static org.apache.derbyTesting.junit.BaseTestCase.execJavaCmd;", "import static org.apache.derbyTesting.junit.BaseTestCase.getJavaExecutableName;", "import static org.apache.derbyTesting.junit.BaseTestCase.isIBMJVM;", "import static org.apache.derbyTesting.junit.BaseTestCase.isWindowsPlatform;" ], "header": "@@ -20,13 +20,23 @@", "removed": [] }, { "added": [ "", " /**", " * Return {@code true} if the subprocess {@code p} has exited within {@code", " * patience} milliseconds. Sleep {@code sleepInterval} between each check}.", " * Note: you still need to call one of the {@link #complete} overloads even", " * if using this method (which is optional). It can be used before trying", " * a {@link #jstack} call.", " *", " * @param patience the maximum milliseconds we want to wait for", " * @param sleepInterval sleep for this amount of milliseconds before trying", " * testing again if not already exited the first time", " * we check. If patience &lt;= sleepInterval we only", " * check once.", " * @return true if the process exited before our patience is up.", " * @throws java.lang.InterruptedException", " */", " @SuppressWarnings(\"SleepWhileInLoop\")", " public boolean waitForExit(long patience, long sleepInterval)", " throws InterruptedException {", " boolean completed = false;", " while (!completed && patience > 0) {", " try {", " try {", " javaProcess.exitValue();", " completed = true;", " } catch (IllegalThreadStateException e) {", " // try again after sleeping", " Thread.sleep(sleepInterval);", " patience = patience - sleepInterval;", " }", " } catch (InterruptedException e) {", " throw e;", " }", " }", " return completed;", " }", "", "", " /**", " * Return the jstack(1) dump of the process if possible.", " * It will only work if we are running with a full JDK, not a simple JRE.", " * It will not work on Windows, and just return an empty string.", " * @return jstack dump if possible", " * @throws PrivilegedActionException", " * @throws InterruptedException", " */", " public String jstack()", " throws PrivilegedActionException, InterruptedException{", "", " String output = \"\";", "", " if (!isWindowsPlatform() && !isIBMJVM()) {", " // Get the pid of the subprocess using reflection. Dirty,", " // for Unix there is a private field pid in the implementing", " // class.", " final int pid = getPid();", " final String execName = getJavaExecutableName().replace(", " \"jre\" + File.separator + \"bin\" + File.separator + \"java\",", " \"bin\" + File.separator + \"jstack\");", " final String[] arguments =", " new String[]{Integer.toString(pid)};", " try {", " final Process p2 =", " execJavaCmd(execName, null, arguments, null, false);", " final SpawnedProcess spawn2 = new SpawnedProcess(p2, \"jstack\");", " spawn2.suppressOutputOnComplete();", " // Close stdin of the process so that it stops", " // any waiting for it and exits (shouldn't matter for this test)", " p2.getOutputStream().close();", " final int exitCode2 = spawn2.complete(30000); // 30 seconds", " assertTrue(spawn2.getFailMessage(\"jstack failed: \"),", " exitCode2 == 0);", " output = spawn2.getFullServerOutput();", " } catch (IOException e) {", " output = \"Tried to catch jstack of hanging subprocess but it \"", " + \"failed (using JDK or JRE?): \" + e;", " }", " }", "", " return output;", " }", "", " /**", " * Return the pid if on Unixen, or -1 on Windows (can't be obtained).", " * @return pid", " * @throws PrivilegedActionException", " */", " public int getPid() throws PrivilegedActionException {", " if (!isWindowsPlatform() && !isIBMJVM()) {", " return AccessController.doPrivileged(", " new PrivilegedExceptionAction<Integer>() {", " @Override", " public Integer run() throws IllegalAccessException,", " NoSuchFieldException {", " final Field f = javaProcess.getClass().", " getDeclaredField(\"pid\");", " f.setAccessible(true);", "", " return f.getInt(javaProcess);", " }", " });", " } else {", " return -1;", " }", " }", "" ], "header": "@@ -504,4 +514,110 @@ public final class SpawnedProcess {", "removed": [] } ] } ]
derby-DERBY-6704-bc39f0ed
DERBY-6704 Hang in AutoloadTest.spawnProcess:JDBCDriversEmbeddedTest on Mac/jdk7,8 Diagnostic patch to print the output of stderr and stdout from the subprocesses if one of "derby.tests.{trace,debug}" is true. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1617825 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-6705-d043e29f
DERBY-6705: Triggers should not allow MERGE statements that reference temporary tables git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1618544 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/compile/MergeNode.java", "hunks": [ { "added": [ " private QueryTreeNodeVector<MatchingClauseNode> _matchingClauses;" ], "header": "@@ -183,7 +183,7 @@ public final class MergeNode extends DMLModStatementNode", "removed": [ " private ArrayList<MatchingClauseNode> _matchingClauses;" ] }, { "added": [ " QueryTreeNodeVector<MatchingClauseNode> matchingClauses," ], "header": "@@ -214,7 +214,7 @@ public final class MergeNode extends DMLModStatementNode", "removed": [ " ArrayList<MatchingClauseNode> matchingClauses," ] }, { "added": [ " @Override", " public boolean referencesSessionSchema() throws StandardException {", " return _sourceTable.referencesSessionSchema()", " || _targetTable.referencesSessionSchema()", " || _searchCondition.referencesSessionSchema()", " || _matchingClauses.referencesSessionSchema();", " }", "" ], "header": "@@ -424,6 +424,14 @@ public final class MergeNode extends DMLModStatementNode", "removed": [] } ] } ]
derby-DERBY-6708-b21afa1f
DERBY-6708 OOME when running ConstraintCharacteristicsTest with smaller heap Patch derby-6708. Reduces the number of rows of the fixture testManySimilarDuplicates from 40K to 4K. Removes the use of in-memory database for all fixtures that use it. In my setup (Ubuntu 12.04 64 bits, JDK 8u20) the test now runs fine with -Xmx128M, in ca. 70 seconds with "derby.system.durability=test". git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1619456 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-6709-43bb9d46
DERBY-6709: Convert the storetests suite to JUnit git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1619376 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-6714-4f1dcde0
DERBY-6714: RuntimeInfoTest failed with insufficient data from server Tighten up checks for sessions being closed while reading runtime info from them, in order to protect against NullPointerExceptions on the server. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1620608 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/drda/org/apache/derby/impl/drda/Session.java", "hunks": [ { "added": [ "", " // DERBY-6714: database can be null if the session gets closed", " // while we construct the runtime info.", " Database db = database;", " if (db != null) {", " s += db.buildRuntimeInfo(indent, localLangUtil);", " s += \"\\n\";", " }", "" ], "header": "@@ -286,10 +286,15 @@ class Session", "removed": [ " if (database == null)", " return s;", " s += database.buildRuntimeInfo(indent,localLangUtil);", " s += \"\\n\";" ] } ] } ]
derby-DERBY-6717-281f9033
DERBY-6717: Policies with multiple SystemPermissions are not handled well Override newPermissionCollection() and return an instance that is able to distinguish between SystemPermissions with the same name and different actions. The default implementation in BasicPermission only considers the name of the permission. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1621257 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/security/SystemPermission.java", "hunks": [ { "added": [ "import java.io.ObjectOutputStream;", "import java.security.PermissionCollection;", "import java.util.Collections;", "import java.util.Enumeration;", "import java.util.HashMap;" ], "header": "@@ -23,9 +23,14 @@ package org.apache.derby.security;", "removed": [] }, { "added": [ "", " /**", " * Bit mask representing the actions. It is not serialized, and has", " * to be recalculated when the object is deserialized.", " */", " private transient int actionMask;" ], "header": "@@ -116,6 +121,12 @@ final public class SystemPermission extends BasicPermission {", "removed": [] }, { "added": [ " * Check if name and actions are valid, normalize the actions string,", " * and calculate the actions mask." ], "header": "@@ -131,8 +142,8 @@ final public class SystemPermission extends BasicPermission {", "removed": [ " * Check if name and actions are valid, and normalize the actions", " * string." ] }, { "added": [ " this.actions = getCanonicalForm(actions);", " this.actionMask = getActionMask(this.actions);" ], "header": "@@ -147,7 +158,8 @@ final public class SystemPermission extends BasicPermission {", "removed": [ " this.actions = getCanonicalForm(actions); " ] }, { "added": [ "", " // DERBY-6717: Must override newPermissionCollection() since", " // BasicPermission's implementation ignores actions.", " @Override", " public PermissionCollection newPermissionCollection() {", " return new SystemPermissionCollection();", " }" ], "header": "@@ -156,6 +168,13 @@ final public class SystemPermission extends BasicPermission {", "removed": [] }, { "added": [ " // Check if the types and names match.", "", " // Check if the actions match.", " return actionMask == osp.actionMask;" ], "header": "@@ -214,12 +233,13 @@ final public class SystemPermission extends BasicPermission {", "removed": [ " ", " ", " return getActions().equals(osp.getActions());" ] }, { "added": [ " // Check if the types and names match.", "", " // Check if the actions match.", " int myActionMask = actionMask;", " int permissionMask = ((SystemPermission) permission).actionMask;" ], "header": "@@ -232,11 +252,13 @@ final public class SystemPermission extends BasicPermission {", "removed": [ " ", " int myActionMask = getActionMask(getActions());", " int permissionMask = getActionMask(permission.getActions());" ] } ] } ]
derby-DERBY-6717-d09cda8f
DERBY-6717: Policies with multiple SystemPermissions are not handled well Extra test cases to improve test coverage. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1621260 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-672-0acf7976
DERBY-672: Allow aggregates on user defined types. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1391034 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/compile/CreateAliasNode.java", "hunks": [ { "added": [ " TypeDescriptor aggForType = bindUserCatalogType( (TypeDescriptor) aggElements[ AGG_FOR_TYPE ] );", " TypeDescriptor aggReturnType = bindUserCatalogType( (TypeDescriptor) aggElements[ AGG_RETURN_TYPE ] );" ], "header": "@@ -147,8 +147,8 @@ public class CreateAliasNode extends DDLStatementNode", "removed": [ " TypeDescriptor aggForType = (TypeDescriptor) aggElements[ AGG_FOR_TYPE ];", " TypeDescriptor aggReturnType = (TypeDescriptor) aggElements[ AGG_RETURN_TYPE ];" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/QueryTreeNode.java", "hunks": [ { "added": [ " /** Bind user defined types as necessary */", " public TypeDescriptor bindUserCatalogType( TypeDescriptor td )", " throws StandardException", " {", " // if this is a user defined type, resolve the Java class name", " if ( !td.isUserDefinedType() ) { return td; }", " else", " {", " DataTypeDescriptor dtd = DataTypeDescriptor.getType( td );", "", " dtd = bindUserType( dtd );", " return dtd.getCatalogType();", " }", " }", "" ], "header": "@@ -1651,6 +1651,21 @@ public abstract class QueryTreeNode implements Node, Visitable", "removed": [] } ] } ]
derby-DERBY-672-0ad97c9a
DERBY-672: Tighten up the bounds checking for input and return types of user-defined aggregates. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1400984 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/services/loader/Java5ClassInspector.java", "hunks": [ { "added": [ " // PUBLIC BEHAVIOR" ], "header": "@@ -62,7 +62,7 @@ public class Java5ClassInspector extends ClassInspector", "removed": [ " // BEHAVIOR" ] }, { "added": [ " @Override", " public Class[] getGenericParameterTypes( Class parameterizedType, Class implementation )", " throws StandardException", "\t{", " // 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; }", "", " Class[] result = new Class[ parameterTypes.size() ];", " parameterTypes.toArray( result );", "", " return result;", " }", "", " ///////////////////////////////////////////////////////////////////////////////////", " //", " // MINIONS FOR getTypeBounds()", " //", " ///////////////////////////////////////////////////////////////////////////////////", "" ], "header": "@@ -101,6 +101,36 @@ public class Java5ClassInspector extends ClassInspector", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/UserAggregateDefinition.java", "hunks": [ { "added": [ " Class[] genericParameterTypes = classFactory.getClassInspector().getGenericParameterTypes", " ( derbyAggregatorInterface, userAggregatorClass );", " if ( genericParameterTypes == null ) { genericParameterTypes = new Class[ AGGREGATOR_PARAM_COUNT ]; }", "" ], "header": "@@ -136,6 +136,10 @@ public class UserAggregateDefinition implements AggregateDefinition", "removed": [] }, { "added": [ " vetCompatibility", " ( inputBounds[ i ], expectedInputClass, SQLState.LANG_UDA_WRONG_INPUT_TYPE );", " }", " if ( genericParameterTypes[ INPUT_TYPE ] != null )", " {", " vetCompatibility", " ( genericParameterTypes[ INPUT_TYPE ], expectedInputClass, SQLState.LANG_UDA_WRONG_INPUT_TYPE );" ], "header": "@@ -153,19 +157,13 @@ public class UserAggregateDefinition implements AggregateDefinition", "removed": [ " Class inputBound = inputBounds[ i ];", " ", " if ( !inputBound.isAssignableFrom( expectedInputClass ) )", " {", " throw StandardException.newException", " (", " SQLState.LANG_UDA_WRONG_INPUT_TYPE,", " _alias.getSchemaName(),", " _alias.getName(),", " expectedInputClass.toString(),", " inputBound.toString()", " );", " }" ] }, { "added": [ " vetCompatibility", " ( returnBounds[ i ], expectedReturnClass, SQLState.LANG_UDA_WRONG_RETURN_TYPE );", " }", " if ( genericParameterTypes[ RETURN_TYPE ] != null )", " {", " vetCompatibility", " ( genericParameterTypes[ RETURN_TYPE ], expectedReturnClass, SQLState.LANG_UDA_WRONG_RETURN_TYPE );" ], "header": "@@ -175,19 +173,13 @@ public class UserAggregateDefinition implements AggregateDefinition", "removed": [ " Class returnBound = returnBounds[ i ];", " ", " if ( !returnBound.isAssignableFrom( expectedReturnClass ) )", " {", " throw StandardException.newException", " (", " SQLState.LANG_UDA_WRONG_RETURN_TYPE,", " _alias.getSchemaName(),", " _alias.getName(),", " expectedReturnClass.toString(),", " returnBound.toString()", " );", " }" ] } ] } ]
derby-DERBY-672-0e07b2e9
DERBY-672: Improve the javadoc for the merge method of Aggregator so that implementors can figure out how to test their code. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1459837 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/agg/Aggregator.java", "hunks": [ { "added": [ " * <p>", " * the partial results together. This method can be called when", " * performing a grouped aggregation with a large number of groups.", " * While processing such a query, Derby may write intermediate grouped", " * results to disk. The intermediate results may be retrieved and merged", " * with later results if Derby encounters later rows which belong to groups", " * whose intermediate results have been written to disk. This situation can", " * occur with a query like the following:", " * </p>", " *", " * <pre>", " * select a, mode( b ) from mode_inputs group by a order by a", " * </pre>" ], "header": "@@ -39,10 +39,22 @@ public interface Aggregator<V,R,A extends Aggregator<V,R,A>> extends Serializ", "removed": [ " * the partial results together." ] } ] } ]
derby-DERBY-672-1cb558f1
DERBY-672: Attempt to fix broken test case for user defined aggregates on jsr169 platforms. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1379519 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-672-2cf546d5
DERBY-672: Add implicit casts and handle string truncation for user-defined aggregates. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1398352 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/compile/AggregateNode.java", "hunks": [ { "added": [ " if ( isUserDefinedAggregate() )" ], "header": "@@ -319,7 +319,7 @@ public class AggregateNode extends UnaryOperatorNode", "removed": [ " if ( (uad != null) && (uad instanceof UserAggregateDefinition) )" ] }, { "added": [ " // For user-defined aggregates, the input operand may need to be", " // coerced to the expected input type of the aggregator.", " if ( isUserDefinedAggregate() )", " {", " ValueNode castNode = ((UserAggregateDefinition) uad).castInputValue", " ( operand, getNodeFactory(), getContextManager() );", "", " if ( castNode != null )", " {", " operand = castNode.bindExpression( fromList, subqueryList, aggregateVector );", " }", " }", "" ], "header": "@@ -423,6 +423,19 @@ public class AggregateNode extends UnaryOperatorNode", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/StaticMethodCallNode.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.services.context.ContextManager;", "import org.apache.derby.iapi.sql.compile.NodeFactory;" ], "header": "@@ -22,11 +22,13 @@", "removed": [] }, { "added": [ "\t\t\t\t\tValueNode castNode = makeCast", " (", " sqlParamNode,", " paramdtd,", " getNodeFactory(),", " getContextManager()", " );" ], "header": "@@ -627,18 +629,13 @@ public class StaticMethodCallNode extends MethodCallNode", "removed": [ "\t\t\t\t\tValueNode castNode = (ValueNode) getNodeFactory().getNode(", "\t\t\t\t\t\tC_NodeTypes.CAST_NODE,", "\t\t\t\t\t\tsqlParamNode, ", "\t\t\t\t\t\tparamdtd,", "\t\t\t\t\t\tgetContextManager());", "", " // Argument type has the same semantics as assignment:", " // Section 9.2 (Store assignment). There, General Rule ", " // 2.b.v.2 says that the database should raise an exception", " // if truncation occurs when stuffing a string value into a", " // VARCHAR, so make sure CAST doesn't issue warning only.", " ((CastNode)castNode).setAssignmentSemantics();" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/UserAggregateDefinition.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.services.context.ContextManager;" ], "header": "@@ -25,6 +25,7 @@ import java.lang.reflect.Method;", "removed": [] }, { "added": [ "import org.apache.derby.iapi.sql.compile.NodeFactory;", "import org.apache.derby.iapi.sql.compile.TypeCompilerFactory;" ], "header": "@@ -36,7 +37,9 @@ import org.apache.derby.iapi.types.JSQLType;", "removed": [] }, { "added": [ " TypeCompilerFactory tcf = cc.getTypeCompilerFactory();" ], "header": "@@ -109,6 +112,7 @@ public class UserAggregateDefinition implements AggregateDefinition", "removed": [] }, { "added": [ " // the input operand must be coercible to the expected input type of the aggregate", " if ( !tcf.getTypeCompiler( expectedInputType.getTypeId() ).storable( inputType.getTypeId(), classFactory ) )", " { return null; }" ], "header": "@@ -138,8 +142,9 @@ public class UserAggregateDefinition implements AggregateDefinition", "removed": [ " // the input operand must be the expected input type of the aggregate", " if ( !inputType.getTypeId().equals( expectedInputType.getTypeId() ) ) { return null; }" ] }, { "added": [ "\t/**", "\t * Wrap the input operand in an implicit CAST node as necessary in order to", " * coerce it the correct type for the aggregator. Return null if no cast is necessary.", "\t */", "\tpublic final ValueNode\tcastInputValue", " ( ValueNode inputValue, NodeFactory nodeFactory, ContextManager cm )", " throws StandardException", "\t{", " AggregateAliasInfo aai = (AggregateAliasInfo) _alias.getAliasInfo();", " DataTypeDescriptor expectedInputType = DataTypeDescriptor.getType( aai.getForType() );", " DataTypeDescriptor actualInputType = inputValue.getTypeServices();", "", " // no cast needed if the types match exactly", " if ( expectedInputType.isExactTypeAndLengthMatch( actualInputType ) ) { return null; }", " else", " {", " return StaticMethodCallNode.makeCast( inputValue, expectedInputType, nodeFactory, cm );", " }", " }", " " ], "header": "@@ -192,6 +197,26 @@ public class UserAggregateDefinition implements AggregateDefinition", "removed": [] } ] } ]
derby-DERBY-672-2f535f8a
DERBY-672: Run user-defined aggregate tests with collation turned off and turned on. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1398934 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-672-3d1bc57e
DERBY-672: Remove unneeded exceptions and a redundant null check git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1401250 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/sql/dictionary/AliasDescriptor.java", "hunks": [ { "added": [ "\tpublic String getSchemaName()" ], "header": "@@ -182,7 +182,7 @@ public final class AliasDescriptor", "removed": [ "\tpublic String\tgetSchemaName() throws StandardException" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/AggregateNode.java", "hunks": [ { "added": [ " return ((UserAggregateDefinition) uad).", " getAliasDescriptor().getQualifiedName();" ], "header": "@@ -725,20 +725,8 @@ public class AggregateNode extends UnaryOperatorNode", "removed": [ " //", " // In theory, we could incur a StandardException while looking up the schema", " // descriptor. In practice that would mean a seriously corrupted database and", " // we would expect the schema resolution problem to have surfaced long before", " // we got to this code. But, just in case, if we can't find the schema, we will return", " // a different handle for the user-defined aggregate, in order to give the user", " // some information.", " //", " try {", " return ((UserAggregateDefinition) uad).getAliasDescriptor().getQualifiedName();", " } catch (StandardException se)", " {", " return aggregateName;", " }" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/UserAggregateDefinition.java", "hunks": [ { "added": [], "header": "@@ -251,7 +251,6 @@ public class UserAggregateDefinition implements AggregateDefinition", "removed": [ " throws StandardException" ] } ] } ]
derby-DERBY-672-61bb5d0a
DERBY-672: Attempt to fix test order problem on Java 7 on Sol32. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1379527 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-672-63e09107
DERBY-672: Forbid user-defined aggregates in GROUP BY clauses just as builtin aggregates are illegal there. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1399364 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/compile/StaticMethodCallNode.java", "hunks": [ { "added": [ " private boolean appearsInGroupBy = false;", "" ], "header": "@@ -133,6 +133,8 @@ public class StaticMethodCallNode extends MethodCallNode", "removed": [] }, { "added": [ "", " /** Flag that this function invocation appears in a GROUP BY clause */", " public void setAppearsInGroupBy() { appearsInGroupBy = true; }" ], "header": "@@ -156,6 +158,9 @@ public class StaticMethodCallNode extends MethodCallNode", "removed": [] } ] } ]
derby-DERBY-672-aad60576
DERBY-672: Add support and tests for dependencies between user-defined types and aggregates. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1401303 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/execute/DDLConstantAction.java", "hunks": [ { "added": [ "import org.apache.derby.catalog.types.AggregateAliasInfo;" ], "header": "@@ -30,6 +30,7 @@ import org.apache.derby.catalog.AliasInfo;", "removed": [] }, { "added": [ " RoutineAliasInfo routineInfo = null;", " AggregateAliasInfo aggInfo = null;", " ", "\t\tcase AliasInfo.ALIAS_TYPE_AGGREGATE_AS_CHAR:", " aggInfo = (AggregateAliasInfo) ad.getAliasInfo();", " break;", "", " routineInfo = (RoutineAliasInfo) ad.getAliasInfo();", " TypeDescriptor rawReturnType = aggInfo != null ?", " aggInfo.getReturnType() : routineInfo.getReturnType();" ], "header": "@@ -988,22 +989,30 @@ abstract class DDLConstantAction implements ConstantAction", "removed": [ " RoutineAliasInfo aliasInfo = (RoutineAliasInfo) ad.getAliasInfo();", " TypeDescriptor rawReturnType = aliasInfo.getReturnType();" ] } ] } ]
derby-DERBY-672-b215dfd0
DERBY-672: Add tests for precision mismatches when using user-defined aggregates. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1400208 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-672-c8603c40
DERBY-672: Wire in bind and execute logic for non-distinct user-defined aggregates in the SELECT list. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1378639 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/services/loader/ClassInspector.java", "hunks": [ { "added": [ "public class ClassInspector" ], "header": "@@ -35,7 +35,7 @@ import java.lang.reflect.*;", "removed": [ "public final class ClassInspector" ] } ] }, { "file": "java/engine/org/apache/derby/iapi/sql/execute/ExecAggregator.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.types.DataTypeDescriptor;", "import org.apache.derby.iapi.services.loader.ClassFactory;" ], "header": "@@ -21,9 +21,11 @@", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/services/reflect/DatabaseClasses.java", "hunks": [ { "added": [ "\t\tclassInspector = makeClassInspector( this );" ], "header": "@@ -107,7 +107,7 @@ abstract class DatabaseClasses", "removed": [ "\t\tclassInspector = new ClassInspector(this);" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/AggregateDefinition.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.error.StandardException;" ], "header": "@@ -23,6 +23,7 @@ package\torg.apache.derby.impl.sql.compile;", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/AggregateNode.java", "hunks": [ { "added": [ "\t\tif (uadClass instanceof AggregateDefinition)", "\t\t\tthis.uad = (AggregateDefinition) uadClass;", "\t\t\tthis.aggregateDefinitionClass = uad.getClass();" ], "header": "@@ -108,16 +108,15 @@ public class AggregateNode extends UnaryOperatorNode", "removed": [ "\t\tif (uadClass instanceof String)", "\t\t\tthis.aggregateDefinitionClassName = (String) uadClass;", "\t\t\tthis.aggregateDefinitionClassName =", "\t\t\t\t\t\t\t\t\t\taggregateDefinitionClass.getName();" ] }, { "added": [ " ", " this.aggregateDefinitionClassName = aggregateDefinitionClass.getName();" ], "header": "@@ -125,6 +124,8 @@ public class AggregateNode extends UnaryOperatorNode", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/MethodCallNode.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.sql.compile.TypeCompilerFactory;" ], "header": "@@ -39,6 +39,7 @@ import org.apache.derby.iapi.sql.compile.CompilerContext;", "removed": [] }, { "added": [ " TypeCompilerFactory tcf = (routineInfo == null ) ? null : getCompilerContext().getTypeCompilerFactory();", "", "\t\tfor ( int i = 0; i < count; i++ ) { parmTypeNames[i] = getObjectTypeName( signature[ i ], tcf ); }" ], "header": "@@ -1041,7 +1042,9 @@ abstract class MethodCallNode extends JavaValueNode", "removed": [ "\t\tfor ( int i = 0; i < count; i++ ) { parmTypeNames[i] = getObjectTypeName( signature[ i ] ); }" ] }, { "added": [ "\tstatic String\tgetObjectTypeName( JSQLType jsqlType, TypeCompilerFactory tcf )" ], "header": "@@ -1077,7 +1080,7 @@ abstract class MethodCallNode extends JavaValueNode", "removed": [ "\tprivate\tString\tgetObjectTypeName( JSQLType jsqlType )" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/StaticMethodCallNode.java", "hunks": [ { "added": [ " private AggregateNode resolvedAggregate;", "" ], "header": "@@ -129,6 +129,8 @@ public class StaticMethodCallNode extends MethodCallNode", "removed": [] }, { "added": [ " /**", " * Get the aggregate, if any, which this method call resolves to.", " */", " public AggregateNode getResolvedAggregate() { return resolvedAggregate; }", " " ], "header": "@@ -148,6 +150,11 @@ public class StaticMethodCallNode extends MethodCallNode", "removed": [] }, { "added": [ " if ( (ad != null) && (ad.getAliasType() == AliasInfo.ALIAS_TYPE_AGGREGATE_AS_CHAR) )", " {", " resolvedAggregate = (AggregateNode) getNodeFactory().getNode", " (", " C_NodeTypes.AGGREGATE_NODE,", " ((SQLToJavaValueNode) methodParms[ 0 ]).getSQLValueNode(),", " new UserAggregateDefinition( ad ), ", " Boolean.FALSE,", " ad.getJavaClassName(),", " getContextManager()", " );", "", " return this;", " }", "" ], "header": "@@ -195,6 +202,21 @@ public class StaticMethodCallNode extends MethodCallNode", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/CountAggregator.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.types.DataTypeDescriptor;", "import org.apache.derby.iapi.services.loader.ClassFactory;" ], "header": "@@ -21,7 +21,9 @@", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/MaxMinAggregator.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.types.DataTypeDescriptor;", "import org.apache.derby.iapi.services.loader.ClassFactory;" ], "header": "@@ -22,11 +22,13 @@", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/OrderableAggregator.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.services.loader.ClassFactory;", "import org.apache.derby.iapi.types.DataTypeDescriptor;" ], "header": "@@ -26,8 +26,10 @@ import java.io.ObjectInput;", "removed": [] } ] }, { "file": "java/shared/org/apache/derby/shared/common/reference/SQLState.java", "hunks": [ { "added": [ "\tString VM_LEVEL_TOO_LOW\t= \"XBCM5.S\";" ], "header": "@@ -213,6 +213,7 @@ public interface SQLState {", "removed": [] } ] } ]
derby-DERBY-672-cb25c656
DERBY-672: More negative tests for illegal placement of user-defined aggregates in various statements. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1400083 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/compile/AggregateNode.java", "hunks": [ { "added": [ "\t\t\t\tthrow StandardException.newException", " (", " SQLState.LANG_USER_AGGREGATE_CONTAINS_AGGREGATE, ", " getSQLName()", " );" ], "header": "@@ -354,8 +354,11 @@ public class AggregateNode extends UnaryOperatorNode", "removed": [ "\t\t\t\tthrow StandardException.newException(SQLState.LANG_USER_AGGREGATE_CONTAINS_AGGREGATE, ", "\t\t\t\t\t\taggregateName);" ] }, { "added": [ "\t\t\t\tthrow StandardException.newException", " (SQLState.LANG_USER_AGGREGATE_BAD_TYPE_NULL, getSQLName());" ], "header": "@@ -402,7 +405,8 @@ public class AggregateNode extends UnaryOperatorNode", "removed": [ "\t\t\t\tthrow StandardException.newException(SQLState.LANG_USER_AGGREGATE_BAD_TYPE_NULL, aggregateName);" ] }, { "added": [ "\t\t\t\t\t\t\t\t\t\t\t\t\tgetSQLName()," ], "header": "@@ -469,7 +473,7 @@ public class AggregateNode extends UnaryOperatorNode", "removed": [ "\t\t\t\t\t\t\t\t\t\t\t\t\taggregateName," ] }, { "added": [ "\t\t\treturn \"aggregateName: \" + getSQLName() + \"\\n\" +" ], "header": "@@ -696,7 +700,7 @@ public class AggregateNode extends UnaryOperatorNode", "removed": [ "\t\t\treturn \"aggregateName: \" + aggregateName + \"\\n\" +" ] } ] } ]
derby-DERBY-672-d389f7d5
DERBY-672: Add support for DISTINCT user defined aggregates in the SELECT list. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1379505 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/compile/AggregateNode.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.sql.dictionary.AliasDescriptor;", "import org.apache.derby.iapi.sql.dictionary.SchemaDescriptor;" ], "header": "@@ -29,7 +29,9 @@ import org.apache.derby.iapi.services.loader.ClassFactory;", "removed": [] }, { "added": [ "import java.util.List;" ], "header": "@@ -54,6 +56,7 @@ import org.apache.derby.impl.sql.compile.CountAggregateDefinition;", "removed": [] }, { "added": [ " private TableName userAggregateName;" ], "header": "@@ -67,6 +70,7 @@ public class AggregateNode extends UnaryOperatorNode", "removed": [] }, { "added": [ "\t\tif ( uadClass instanceof UserAggregateDefinition )", " setUserDefinedAggregate( (UserAggregateDefinition) uadClass );", "\t\t\tthis.distinct = ((Boolean) distinct).booleanValue();", "\t\t}", "\t\telse if ( uadClass instanceof TableName )", "\t\t{", "\t\t\tthis.userAggregateName = (TableName) uadClass;" ], "header": "@@ -108,10 +112,14 @@ public class AggregateNode extends UnaryOperatorNode", "removed": [ "\t\tif (uadClass instanceof AggregateDefinition)", "\t\t\tthis.uad = (AggregateDefinition) uadClass;", "\t\t\tthis.aggregateDefinitionClass = uad.getClass();" ] }, { "added": [ "", " this.aggregateDefinitionClassName = aggregateDefinitionClass.getName();", " /** initialize fields for user defined aggregate */", " private void setUserDefinedAggregate( UserAggregateDefinition userAgg )", " {", " this.uad = userAgg;", " this.aggregateDefinitionClass = uad.getClass();", " this.aggregateDefinitionClassName = aggregateDefinitionClass.getName();", " }" ], "header": "@@ -123,10 +131,18 @@ public class AggregateNode extends UnaryOperatorNode", "removed": [ " this.aggregateDefinitionClassName = aggregateDefinitionClass.getName();" ] }, { "added": [ " DataDictionary dd = getDataDictionary();", " if ( userAggregateName != null )", " {", " userAggregateName.bind( dd );", "", " AliasDescriptor ad = resolveAggregate", " (", " dd,", " getSchemaDescriptor( userAggregateName.getSchemaName(), true ),", " userAggregateName.getTableName()", " );", "", " if ( ad == null )", " {", " throw StandardException.newException", " (", " SQLState.LANG_OBJECT_NOT_FOUND,", " AliasDescriptor.getAliasType( AliasInfo.ALIAS_TYPE_AGGREGATE_AS_CHAR ),", " userAggregateName.getTableName()", " );", " }", " ", " setUserDefinedAggregate( new UserAggregateDefinition( ad ) );", " aggregateName = ad.getJavaClassName();", " }", "" ], "header": "@@ -268,12 +284,38 @@ public class AggregateNode extends UnaryOperatorNode", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/StaticMethodCallNode.java", "hunks": [ { "added": [ "\t\t\tresolveRoutine( fromList, subqueryList, aggregateVector, sd );" ], "header": "@@ -200,7 +200,7 @@ public class StaticMethodCallNode extends MethodCallNode", "removed": [ "\t\t\tresolveRoutine(fromList, subqueryList, aggregateVector, sd);" ] } ] } ]
derby-DERBY-672-d861c230
DERBY-672: Allow binding of user-defined aggregates to generic classes. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1392307 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/compile/AggregateNode.java", "hunks": [ { "added": [ "\t\t\tthrow StandardException.newException", " (", " SQLState.LANG_USER_AGGREGATE_BAD_TYPE, ", " getSQLName(), ", " operand.getTypeId().getSQLTypeName()", " );" ], "header": "@@ -415,9 +415,12 @@ public class AggregateNode extends UnaryOperatorNode", "removed": [ "\t\t\tthrow StandardException.newException(SQLState.LANG_USER_AGGREGATE_BAD_TYPE, ", "\t\t\t\t\t\taggregateName, ", "\t\t\t\t\t\toperand.getTypeId().getSQLTypeName());" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/UserAggregateDefinition.java", "hunks": [ { "added": [], "header": "@@ -35,9 +35,6 @@ import org.apache.derby.iapi.types.TypeId;", "removed": [ "import org.apache.derby.iapi.sql.compile.TypeCompiler;", "import org.apache.derby.iapi.sql.compile.TypeCompilerFactory;", "" ] } ] } ]
derby-DERBY-672-f3c62175
DERBY-672: Adding GRANT/REVOKE support for user-defined aggregates. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1380202 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/compile/PrivilegeNode.java", "hunks": [ { "added": [ " public static final int AGGREGATE_PRIVILEGES = 4;" ], "header": "@@ -49,6 +49,7 @@ public class PrivilegeNode extends QueryTreeNode", "removed": [] }, { "added": [ " case AGGREGATE_PRIVILEGES:", " ", " dependencyProvider = getDataDictionary().getAliasDescriptor", " ( sd.getUUID().toString(), objectName.getTableName(), AliasInfo.ALIAS_NAME_SPACE_AGGREGATE_AS_CHAR );", " if ( dependencyProvider == null )", " {", " throw StandardException.newException", " (SQLState.LANG_OBJECT_NOT_FOUND, \"DERBY AGGREGATE\", objectName.getFullTableName());", " }", " break;", " " ], "header": "@@ -260,6 +261,17 @@ public class PrivilegeNode extends QueryTreeNode", "removed": [] } ] }, { "file": "java/tools/org/apache/derby/impl/tools/dblook/DB_GrantRevoke.java", "hunks": [ { "added": [ " ", " // Generate aggregate privilege statements", " rs = stmt.executeQuery(\"SELECT P.GRANTEE, S.SCHEMANAME, A.ALIAS, P.PERMISSION, P.OBJECTTYPE FROM \" +", " \"SYS.SYSPERMS P, SYS.SYSALIASES A, SYS.SYSSCHEMAS S WHERE A.SCHEMAID = \" +", " \"S.SCHEMAID AND P.OBJECTID = A.ALIASID AND A.ALIASTYPE='G'\");", " generateAggregatePrivs(rs);" ], "header": "@@ -59,6 +59,12 @@ public class DB_GrantRevoke {", "removed": [] } ] } ]
derby-DERBY-672-f798a41a
DERBY-672: Add tests of user-defined aggregates on all builtin Derby types except for XML. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1396589 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/compile/CreateAliasNode.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.reference.JDBC40Translation;" ], "header": "@@ -30,6 +30,7 @@ import org.apache.derby.catalog.types.RoutineAliasInfo;", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/UserAggregateDefinition.java", "hunks": [ { "added": [ " private static final String DERBY_BYTE_ARRAY_NAME = \"byte[]\";", "" ], "header": "@@ -59,6 +59,8 @@ public class UserAggregateDefinition implements AggregateDefinition", "removed": [] }, { "added": [ " Class expectedInputClass = getJavaClass( classFactory, expectedInputType );", " Class expectedReturnClass = getJavaClass( classFactory, expectedReturnType );" ], "header": "@@ -133,8 +135,8 @@ public class UserAggregateDefinition implements AggregateDefinition", "removed": [ " Class expectedInputClass = getJavaClass( expectedInputType );", " Class expectedReturnClass = getJavaClass( expectedReturnType );" ] } ] } ]
derby-DERBY-6724-8bef59d4
DERBY-6724: NPE if insert statement needs recompilation after having fired a trigger Allow InternalTriggerExecutionContext.cleanup() to be called more than once. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1622631 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/execute/InternalTriggerExecutionContext.java", "hunks": [ { "added": [], "header": "@@ -23,7 +23,6 @@ package org.apache.derby.impl.sql.execute;", "removed": [ "import java.util.Enumeration;" ] } ] } ]
derby-DERBY-6725-314a19ac
DERBY-6725(Add a system function which returns the name of the database.) git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1651284 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/catalog/DD_Version.java", "hunks": [ { "added": [ " // On upgrade from versions before 10.6, create system procedures" ], "header": "@@ -404,7 +404,7 @@ public\tclass DD_Version implements\tFormatable", "removed": [ " // On ugrade from versions before 10.6, create system procedures" ] }, { "added": [ " // On upgrade from versions before 10.2, create system procedures" ], "header": "@@ -419,7 +419,7 @@ public\tclass DD_Version implements\tFormatable", "removed": [ " // On ugrade from versions before 10.2, create system procedures" ] }, { "added": [ " // On upgrade from versions before 10.3, create system procedures" ], "header": "@@ -447,7 +447,7 @@ public\tclass DD_Version implements\tFormatable", "removed": [ " // On ugrade from versions before 10.3, create system procedures" ] }, { "added": [ " // On upgrade from versions before 10.9, create system procedures" ], "header": "@@ -490,7 +490,7 @@ public\tclass DD_Version implements\tFormatable", "removed": [ " // On ugrade from versions before 10.9, create system procedures" ] }, { "added": [ " // On upgrade from versions before 10.10, create system procedures" ], "header": "@@ -508,7 +508,7 @@ public\tclass DD_Version implements\tFormatable", "removed": [ " // On ugrade from versions before 10.10, create system procedures" ] }, { "added": [ " // On upgrade from versions before 10.11, create system procedures" ], "header": "@@ -522,7 +522,7 @@ public\tclass DD_Version implements\tFormatable", "removed": [ " // On ugrade from versions before 10.11, create system procedures" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java", "hunks": [ { "added": [ "\t\t\t\t\t\t\t\t\t\t\t\t\"SYSCS_GET_DATABASE_NAME\"," ], "header": "@@ -463,6 +463,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " // add 10.12 specific system procedures", " create_10_12_system_procedures( tc, newlyCreatedRoutines );" ], "header": "@@ -11444,6 +11445,8 @@ public final class\tDataDictionaryImpl", "removed": [] } ] } ]
derby-DERBY-6725-3967d8be
DERBY-6725: Canonicalize the database names returned by syscs_get_database_name(); comit derby-6725-02-aa-canonicalize.diff. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1717646 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/catalog/SystemProcedures.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.services.monitor.ModuleFactory;", "import org.apache.derby.iapi.services.monitor.Monitor;" ], "header": "@@ -47,6 +47,8 @@ import org.apache.derby.iapi.security.Securable;", "removed": [] }, { "added": [ " throws SQLException", " try {", " return( getMonitor().getCanonicalServiceName( lcc.getDbname() ) );", " } catch (StandardException se) { throw PublicAPI.wrapStandardException(se); }" ], "header": "@@ -2489,11 +2491,13 @@ public class SystemProcedures {", "removed": [ " throws SQLException", " return(lcc.getDbname());" ] } ] } ]
derby-DERBY-6726-617d55ab
DERBY-6726: NPE from trigger When there are multiple triggers on the same table, it is crucial that the TriggerDescriptor class always uses the getTableDescriptor() getter method to access its 'td' member field, so that the field can be lazy-initialized if it has not yet been set. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1763024 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/sql/dictionary/TriggerDescriptor.java", "hunks": [ { "added": [ "\t\t\t\t\tgetTableDescriptor()," ], "header": "@@ -411,7 +411,7 @@ public class TriggerDescriptor extends UniqueSQLObjectDescriptor", "removed": [ "\t\t\t\t\ttd," ] } ] } ]
derby-DERBY-6727-947a7233
DERBY-6727; test behavior of open XA transactions when the database is crashed (not just shutdown) Adding further test cases to Derby5165Test git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1625093 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-673-57f2b05c
DERBY-673: Get rid of the NodeFactory Followup fix to patch derby-673-typesafe-lists-2. The patch introduced an issue causing ConcurrentModificationException. Roll back that change. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1497742 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/compile/PredicateList.java", "hunks": [ { "added": [ "\t\tint size = size();", "\t\tfor (int index = 0; index < size; index++)", "\t\t\tAndNode\t\t\tandNode;", "\t\t\tPredicate\t\tpredicate;", "\t\t\tpredicate = elementAt(index);", "", " andNode = predicate.getAndNode();", "" ], "header": "@@ -2155,9 +2155,15 @@ class PredicateList extends QueryTreeNodeVector<Predicate>", "removed": [ " for (Predicate predicate : this)", "\t\t\tAndNode\t\t\tandNode = predicate.getAndNode();" ] }, { "added": [ "\t\tfor (int scIndex = 0; scIndex < searchClauses.size(); scIndex++)", "\t\t\tRelationalOperator ro = (RelationalOperator)", " (searchClauses.elementAt(scIndex).", " getAndNode()).getLeftOperand();" ], "header": "@@ -2230,12 +2236,13 @@ class PredicateList extends QueryTreeNodeVector<Predicate>", "removed": [ " for (Predicate searchClause : searchClauses)", " RelationalOperator ro =", " (RelationalOperator)(searchClause.getAndNode()).getLeftOperand();" ] } ] } ]
derby-DERBY-6730-19ca71c1
DERBY-6730: Allow spaces in the names of key names used by Lucene indexes; commit derby-6730-02-ab-spacesInKeyName.diff. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1624507 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/optional/org/apache/derby/optional/lucene/LuceneSupport.java", "hunks": [ { "added": [ " vetColumnName( derbyIdentifier( textcol ) );" ], "header": "@@ -462,7 +462,7 @@ public class LuceneSupport implements OptionalTool", "removed": [ " vetColumnName( textcol );" ] } ] } ]
derby-DERBY-6730-3240e21f
DERBY-6730: Allow case-sensitive names for key columns when creating Lucene indexes; commit derby-6730-01-aa-correctCasing.diff. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1623782 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/optional/org/apache/derby/optional/lucene/LuceneQueryVTI.java", "hunks": [ { "added": [ "", " String delimitedColumnName = LuceneSupport.delimitID( _column );", " DerbyLuceneDir derbyLuceneDir = LuceneSupport.getDerbyLuceneDir( _connection, _schema, _table, delimitedColumnName );" ], "header": "@@ -456,8 +456,9 @@ class LuceneQueryVTI extends StringColumnVTI", "removed": [ " ", " DerbyLuceneDir derbyLuceneDir = LuceneSupport.getDerbyLuceneDir( _connection, _schema, _table, _column );" ] } ] }, { "file": "java/optional/org/apache/derby/optional/lucene/LuceneSupport.java", "hunks": [ { "added": [ " String keyName = delimitID( keyDesc.columnName );" ], "header": "@@ -518,7 +518,7 @@ public class LuceneSupport implements OptionalTool", "removed": [ " String keyName = derbyIdentifier( keyDesc.columnName );" ] }, { "added": [ " query.append( delimitID( derbyIdentifier( textcol ) ) );" ], "header": "@@ -540,7 +540,7 @@ public class LuceneSupport implements OptionalTool", "removed": [ " query.append( derbyIdentifier( textcol ) );" ] }, { "added": [ " /** Double quote an identifier in order to preserver casing */", " static String delimitID( String id )", " {", " return IdUtil.normalToDelimited( id );", " }", "" ], "header": "@@ -1420,6 +1420,12 @@ public class LuceneSupport implements OptionalTool", "removed": [] } ] } ]
derby-DERBY-6733-0c12cdea
DERBY-6733: Implement an MBean for monitoring caches Add test that verifies that a SecurityException is raised if the MBean is accessed by code that hasn't been granted permission to monitor the engine. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1626682 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-6733-6da88fc6
DERBY-6733: Implement an MBean for monitoring caches Add an MBean for the statement cache. Fix the values returned from getAllocatedEntries() and getUsedEntries(). The first patch got them mixed up. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1624974 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/services/cache/ConcurrentCache.java", "hunks": [ { "added": [ " deregisterMBean();" ], "header": "@@ -625,14 +625,7 @@ final class ConcurrentCache implements CacheManager {", "removed": [ "", " if (mbean != null) {", " ManagementService managementService =", " (ManagementService) Monitor.getSystemModule(Module.JMX);", " if (managementService != null) {", " managementService.unregisterMBean(mbean);", " }", " }" ] }, { "added": [ " @Override", " public void deregisterMBean() {", " if (mbean != null) {", " ManagementService managementService =", " (ManagementService) Monitor.getSystemModule(Module.JMX);", " if (managementService != null) {", " managementService.unregisterMBean(mbean);", " }", " mbean = null;", " }", " }", "" ], "header": "@@ -734,6 +727,18 @@ final class ConcurrentCache implements CacheManager {", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionFactory.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.store.raw.data.DataFactory;" ], "header": "@@ -74,6 +74,7 @@ import java.util.Dictionary;", "removed": [] } ] } ]
derby-DERBY-6733-86ee0a0d
DERBY-6733: Implement an MBean for monitoring caches Add a new MBean called CacheManagerMBean, which provides information about a CacheManager instance. Create CacheManagerMBean instances for the page cache and the container cache when a database is booted. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1624469 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/services/jmx/ManagementService.java", "hunks": [ { "added": [], "header": "@@ -22,10 +22,8 @@", "removed": [ "import org.apache.derby.iapi.reference.Module;", "" ] }, { "added": [ " * @return An identifier that can later be used to unregister the mbean." ], "header": "@@ -60,7 +58,7 @@ public interface ManagementService extends ManagementMBean {", "removed": [ " * @return An idenitifier that can later be used to unregister the mbean." ] } ] }, { "file": "java/engine/org/apache/derby/impl/services/cache/ConcurrentCache.java", "hunks": [ { "added": [ "import java.util.concurrent.atomic.AtomicLong;", "import org.apache.derby.iapi.reference.Module;", "import org.apache.derby.iapi.services.jmx.ManagementService;", "import org.apache.derby.iapi.services.monitor.Monitor;", "import org.apache.derby.mbeans.CacheManagerMBean;" ], "header": "@@ -24,14 +24,19 @@ package org.apache.derby.impl.services.cache;", "removed": [] }, { "added": [ " // Fields used by the MBean that monitors this instance.", "", " /** The identifier of the MBean that allows monitoring of this instance. */", " private Object mbean;", " /** Flag that tells if hit/miss/eviction counts should be collected. */", " private volatile boolean collectAccessCounts;", " /** The number of cache hits. */", " private final AtomicLong hits = new AtomicLong();", " /** The number of cache misses. */", " private final AtomicLong misses = new AtomicLong();", " /** The number of evictions from the cache. */", " private final AtomicLong evictions = new AtomicLong();", "" ], "header": "@@ -62,6 +67,19 @@ final class ConcurrentCache implements CacheManager {", "removed": [] }, { "added": [ " countEviction();" ], "header": "@@ -187,6 +205,7 @@ final class ConcurrentCache implements CacheManager {", "removed": [] }, { "added": [ " countHit();", " countMiss();" ], "header": "@@ -277,11 +296,13 @@ final class ConcurrentCache implements CacheManager {", "removed": [] }, { "added": [ " countMiss();" ], "header": "@@ -322,6 +343,7 @@ final class ConcurrentCache implements CacheManager {", "removed": [] }, { "added": [ "", " countHit();", " } else {", " countMiss();" ], "header": "@@ -332,11 +354,15 @@ final class ConcurrentCache implements CacheManager {", "removed": [] }, { "added": [ "", " if (mbean != null) {", " ManagementService managementService =", " (ManagementService) Monitor.getSystemModule(Module.JMX);", " if (managementService != null) {", " managementService.unregisterMBean(mbean);", " }", " }" ], "header": "@@ -599,6 +625,14 @@ final class ConcurrentCache implements CacheManager {", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/services/jmxnone/NoManagementService.java", "hunks": [ { "added": [ " * JMX, such as Java SE compact profile 2." ], "header": "@@ -25,7 +25,7 @@ import org.apache.derby.iapi.services.jmx.ManagementService;", "removed": [ " * JMX, such as JDK 1.4 and J2ME." ] } ] } ]
derby-DERBY-6737-012a4edf
DERBY-6737: CLOB retrieve exceptions after moving cursor around Always fetch the row again from the server when moving the position of a scrollable result set that contains LOB columns. Without this fix, if one of the absolute positioning methods is used (first(), last() or absolute(int)), and the old position is the same as the new position, the result set will use the values it already has for the row on that position. Any locators will have been released, though, so accessing LOBs in the row will fail with 'invalid locator'. By fetching the row again from the server, we get a fresh and valid locator for the LOB columns in that row. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1625904 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-674-c3c7251e
DERBY-674(analyze impact of poodle security alert on Derby client - server ssl support) Changes based on Knut's feedback. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1636668 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/client/org/apache/derby/client/net/OpenSocketAction.java", "hunks": [ { "added": [ " \t//If SSLv3 and/or SSLv2Hello is one of the enabled protocols, ", " \t// then we want to remove it from the list of enabled protocols ", " //If SSLv3 and/or SSLv2Hello is one of the enabled protocols, ", " // then remove it from the list of enabled protocols because of ", " // its security breach.", " enabledProtocols[i].toUpperCase().contains(\"SSLV2HELLO\")) {" ], "header": "@@ -81,21 +81,22 @@ class OpenSocketAction implements PrivilegedExceptionAction<Socket> {", "removed": [ " \t//If SSLv3 or SSLv2Hello is one of the enabled protocols, then ", " \t// we want to remove it from the list of enabled protocols ", " //If SSLv3 is one of the enabled protocols, then remove it from the", " // list of enabled protocols because of its security breach.", " enabledProtocols[i].toUpperCase().contains(\"SSLv2Hello\")) {" ] } ] }, { "file": "java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java", "hunks": [ { "added": [ " \tenabledProtocols[i].toUpperCase().contains(\"SSLV2HELLO\")) {" ], "header": "@@ -2715,7 +2715,7 @@ public final class NetworkServerControlImpl {", "removed": [ " \tenabledProtocols[i].toUpperCase().contains(\"SSLv2Hello\")) {" ] }, { "added": [ " removedProtocolsCount);" ], "header": "@@ -2731,7 +2731,7 @@ public final class NetworkServerControlImpl {", "removed": [ " (removeTwoProtocols.length)-1);" ] } ] } ]
derby-DERBY-6741-b6a45f5e
DERBY-6741: Add a privilege barrier to prevent users from getting a ContextManager from an embedded connection object; tests passed cleanly on derby-6741-01-aa-usederbyinternals.diff. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1626274 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.security.SecurityUtil;" ], "header": "@@ -37,6 +37,7 @@ import org.apache.derby.iapi.services.property.PropertyUtil;", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/jdbc/EmbedXAResource.java", "hunks": [ { "added": [ " tranState = new XATransactionState", " (", " getContextManager( con.realConnection ),", " con.realConnection, this, xid_im", " );" ], "header": "@@ -672,9 +672,11 @@ class EmbedXAResource implements XAResource {", "removed": [ " tranState = new XATransactionState(", " con.realConnection.getContextManager(),", " con.realConnection, this, xid_im);" ] } ] } ]
derby-DERBY-6742-21044de3
DERBY-6880: Update failing with java.sql.SQLDataException This change reverts part of the changes made by revision 1628596 for DERBY-6742. Specifically, the section of code added to UpdateResultSet.collectAffectedRows is removed. That code caused problems with certain SQL UPDATE statements which were compiled with Statement.RETURN_GENERATED_KEYS. The new test cases added by this change include several examples of such SQL statements. The JDBC documentation for the intended behavior of UPDATE statements with the RETURN_GENERATED_KEYS option is unclear; the intended behavior is much clearer with INSERT statements. Given that I don't understand the intended behavior, it seems safer to me to return Derby to the previous state for UPDATE statements; namely, that no attempt is made to compute the set of generated keys for an UPDATE statement. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1741380 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-6742-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-6742-aa302c30
DERBY-6742(For update statement, collect generated keys if Statement.RETURN_GENERATED_KEYS flag is supplied to the JDBC call.) This commit now allows JDBC statement to receive a resultset for auto generated keys for an UPDATE statement updating the generated values with DEFAULT clause. Such a resultset will be generated only if the UPDATE statement updated a single row and there were generated columns involved in the update. This functionality already exists for INSERT statement. It is currently implemented for INSERT statement by calling VALUES IDENTITY_VAL_LOCAL() from EmbedStatement.getGeneratedKeys(). I have used this existing mechanism to collect generated values resultset for UPDATE too. This means that the scope of IDENTITY_VAL_LOCAL() function has grown from INSERT statement to also include UPDATE statement. This will require us to update the documentation for IDENTITY_VAL_LOCAL(). I have created DERBY-6753(Docs for IDENTITY_VAL_LOCAL needs to be updated to indicate that the return value will be impacted by single row UPDATE of identity column) for the documentation task. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1628596 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/client/org/apache/derby/client/am/ClientPreparedStatement.java", "hunks": [ { "added": [ " boolean chainOpenQueryForAutoGeneratedKeys = ", " \t\t((sqlUpdateMode_ == isInsertSql__ || sqlUpdateMode_ == isUpdateSql__) ", " \t\t\t\t&& autoGeneratedKeys_ == RETURN_GENERATED_KEYS);" ], "header": "@@ -2044,7 +2044,9 @@ public class ClientPreparedStatement extends ClientStatement", "removed": [ " boolean chainOpenQueryForAutoGeneratedKeys = (sqlUpdateMode_ == isInsertSql__ && autoGeneratedKeys_ == RETURN_GENERATED_KEYS);" ] } ] }, { "file": "java/client/org/apache/derby/client/am/ClientStatement.java", "hunks": [ { "added": [ " \t\tif ((sqlUpdateMode_ == isInsertSql__ || sqlUpdateMode_ == isUpdateSql__) ", " \t\t\t\t&& autoGeneratedKeys_ == RETURN_GENERATED_KEYS) {" ], "header": "@@ -2325,7 +2325,8 @@ public class ClientStatement implements Statement, StatementCallbackInterface{", "removed": [ " if (sqlUpdateMode_ == isInsertSql__ && autoGeneratedKeys_ == RETURN_GENERATED_KEYS) {" ] } ] }, { "file": "java/engine/org/apache/derby/impl/jdbc/EmbedStatement.java", "hunks": [ { "added": [ " * statement is not an INSERT/UPDATE statement. For use with" ], "header": "@@ -244,7 +244,7 @@ public class EmbedStatement extends ConnectionChild", "removed": [ " * statement is not an INSERT statement. For use with" ] }, { "added": [ " * statement is not an INSERT/UPDATE statement. For use with" ], "header": "@@ -285,7 +285,7 @@ public class EmbedStatement extends ConnectionChild", "removed": [ " * statement is not an INSERT statement. For use with" ] }, { "added": [ " * this signal if the SQL statement is not an INSERT/UPDATE statement." ], "header": "@@ -714,7 +714,7 @@ public class EmbedStatement extends ConnectionChild", "removed": [ " * this signal if the SQL statement is not an INSERT statement." ] }, { "added": [ " * INSERT/UPDATE statement.", " * inserted/updated row that should be made available for retrieval by a", " * call to the method getGeneratedKeys" ], "header": "@@ -739,12 +739,12 @@ public class EmbedStatement extends ConnectionChild", "removed": [ " * INSERT statement.", " * inserted row that should be made available for retrieval by a call to", " * the method getGeneratedKeys" ] }, { "added": [ " * INSERT/UPDATE statement.", " * inserted/updated row that should be made available for retrieval by a", " * call to the method getGeneratedKeys" ], "header": "@@ -768,12 +768,12 @@ public class EmbedStatement extends ConnectionChild", "removed": [ " * INSERT statement.", " * inserted row that should be made available for retrieval by a call to", " * the method getGeneratedKeys" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/DMLWriteGeneratedColumnsResultSet.java", "hunks": [ { "added": [ "import java.util.Arrays;", "import java.util.Properties;", "import org.apache.derby.iapi.reference.SQLState;", "import org.apache.derby.iapi.sql.ResultDescription;", "import org.apache.derby.iapi.sql.ResultSet;", "import org.apache.derby.iapi.sql.dictionary.ColumnDescriptor;", "import org.apache.derby.iapi.sql.dictionary.TableDescriptor;", "import org.apache.derby.iapi.sql.execute.ExecRow;", "import org.apache.derby.catalog.UUID;", "import org.apache.derby.iapi.sql.execute.RowChanger;" ], "header": "@@ -21,19 +21,24 @@", "removed": [ "", "", "import org.apache.derby.catalog.UUID;", "import org.apache.derby.iapi.sql.ResultColumnDescriptor;", "import org.apache.derby.iapi.types.RowLocation;" ] }, { "added": [ "\t//following is for jdbc3.0 feature auto generated keys resultset", "\tprotected ResultSet\t\t\tautoGeneratedKeysResultSet;", "\tprotected TemporaryRowHolderImpl\tautoGeneratedKeysRowsHolder;", "\tprotected int[] autoGeneratedKeysColumnIndexes;", "\t/**", "\t * If set to true, implies that Derby has generated autoincrement ", "\t * values for this (rep)resultset. During refresh for example, the ", "\t * autoincrement values are not generated but sent from the source ", "\t * to target or vice-versa.", "\t */", "\tprotected boolean autoincrementGenerated;", "\tprotected long\t identityVal; //support of IDENTITY_LOCAL_VAL function", "\tprotected boolean setIdentity;", "" ], "header": "@@ -51,6 +56,20 @@ abstract public class DMLWriteGeneratedColumnsResultSet extends DMLWriteResultSe", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/InsertResultSet.java", "hunks": [ { "added": [], "header": "@@ -24,7 +24,6 @@ package org.apache.derby.impl.sql.execute;", "removed": [ "import java.util.HashMap;" ] }, { "added": [], "header": "@@ -41,7 +40,6 @@ import org.apache.derby.iapi.services.loader.GeneratedMethod;", "removed": [ "import org.apache.derby.iapi.sql.ResultDescription;" ] }, { "added": [], "header": "@@ -50,10 +48,8 @@ import org.apache.derby.iapi.sql.dictionary.BulkInsertCounter;", "removed": [ "import org.apache.derby.iapi.sql.dictionary.ConstraintDescriptorList;", "import org.apache.derby.iapi.sql.dictionary.ReferencedKeyConstraintDescriptor;" ] }, { "added": [ "\t// RESOLVE. Embarrassingly large public state. If we could move the ", "\t// Replication code into the same package, then these variables ", "\t// could be protected. " ], "header": "@@ -91,9 +87,9 @@ import org.apache.derby.shared.common.sanity.SanityManager;", "removed": [ "\t// RESOLVE. Embarassingly large public state. If we could move the Replication", "\t// code into the same package, then these variables could be protected.", "" ] }, { "added": [], "header": "@@ -102,11 +98,6 @@ class InsertResultSet extends DMLWriteGeneratedColumnsResultSet implements Targe", "removed": [ "\t//following is for jdbc3.0 feature auto generated keys resultset", "\tprivate ResultSet\t\t\tautoGeneratedKeysResultSet;", "\tprivate\tTemporaryRowHolderImpl\tautoGeneratedKeysRowsHolder;", " private int[] autoGeneratedKeysColumnIndexes;", "" ] }, { "added": [], "header": "@@ -165,15 +156,6 @@ class InsertResultSet extends DMLWriteGeneratedColumnsResultSet implements Targe", "removed": [ "\t/**", "\t * If set to true, implies that this (rep)insertresultset has generated", "\t * autoincrement values. During refresh for example, the autoincrement", "\t * values are not generated but sent from the source to target or ", "\t * vice-versa.", "\t */", "\tprotected boolean \t\t\t\tautoincrementGenerated;", "\tprivate long\t\t\t\t\tidentityVal; //support of IDENTITY_LOCAL_VAL function", "\tprivate boolean\t\t\t\t\tsetIdentity;" ] }, { "added": [ "\t\tverifyAutoGeneratedRScolumnsList(constants.targetUUID);", "" ], "header": "@@ -410,22 +392,8 @@ class InsertResultSet extends DMLWriteGeneratedColumnsResultSet implements Targe", "removed": [ "\t\t/*", "\t\t** verify the auto-generated key columns list(ie there are no invalid column", "\t\t** names or positions). This is done at at execution time because for a precompiled", "\t\t** insert statement, user can specify different column selections for", "\t\t** auto-generated keys.", "\t\t*/", "\t\tif(activation.getAutoGeneratedKeysResultsetMode())", "\t\t{", " int[] agi = activation.getAutoGeneratedKeysColumnIndexes();", " if ( agi != null ) { verifyAutoGeneratedColumnsIndexes( agi ); }", " else", " {", " String[] agc = activation.getAutoGeneratedKeysColumnNames();", " if ( agc != null ) { verifyAutoGeneratedColumnsNames( agc ); }", " }", "\t\t}" ] }, { "added": [], "header": "@@ -491,13 +459,6 @@ class InsertResultSet extends DMLWriteGeneratedColumnsResultSet implements Targe", "removed": [ "\t\t/* autoGeneratedResultset for JDBC3. Nulled after statement execution is over", "\t\t(ie after it is saved off in LocalSatement object) */", "\t\tif (activation.getAutoGeneratedKeysResultsetMode())", "\t\t\tautoGeneratedKeysResultSet = autoGeneratedKeysRowsHolder.getResultSet();", "\t\telse", "\t\t\tautoGeneratedKeysResultSet = null;", "" ] }, { "added": [], "header": "@@ -516,29 +477,6 @@ class InsertResultSet extends DMLWriteGeneratedColumnsResultSet implements Targe", "removed": [ "\t/**", "\t * Verify that the auto-generated columns list (by position) has valid", "\t * column positions for the table.", "\t */", "\tprivate void verifyAutoGeneratedColumnsIndexes(int[] columnIndexes)", "\t\tthrows StandardException", "\t{", "\t\tint size = columnIndexes.length;", " TableDescriptor tabDesc = dd.getTableDescriptor(constants.targetUUID);", "", "\t\t// all 1-based column ids.", "\t\tfor (int i = 0; i < size; i++)", "\t\t{", " ColumnDescriptor cd = tabDesc.getColumnDescriptor(columnIndexes[i]);", "\t\t\tif (!verifyAutoGenColumn(cd))", "\t\t\t{", "\t\t\t\tthrow StandardException.newException(", "\t\t\t\t\tSQLState.LANG_INVALID_AUTOGEN_COLUMN_POSITION,", " new Integer(columnIndexes[i]), tabDesc.getName());", "\t\t\t}", "\t\t}", "\t}", "" ] }, { "added": [], "header": "@@ -575,106 +513,6 @@ class InsertResultSet extends DMLWriteGeneratedColumnsResultSet implements Targe", "removed": [ "\t/**", "\t * Remove duplicate columns from the array. Then use this array to generate a sub-set", "\t * of insert resultset to be returned for JDBC3.0 getGeneratedKeys() call.", "\t */", "\tprivate int[] uniqueColumnPositionArray(int[] columnIndexes)", "\t\tthrows StandardException", "\t{", "\t\tint size = columnIndexes.length;", " TableDescriptor tabDesc = dd.getTableDescriptor(constants.targetUUID);", "", "\t\t//create an array of integer (the array size = number of columns in table)", "\t\t// valid column positions are 1...getMaxColumnID()", " int[] uniqueColumnIndexes = new int[tabDesc.getMaxColumnID()];", "", "\t\tint uniqueColumnNumbers = 0;", "", "", "\t\t//At the end of following loop, the uniqueColumnIndexes elements will not be 0 for user", "\t\t//selected auto-generated columns.", "\t\tfor (int i=0; i<size; i++) {", "\t\t\tif (uniqueColumnIndexes[columnIndexes[i] - 1] == 0) {", "\t\t\t\tuniqueColumnNumbers++;", "\t\t\t\tuniqueColumnIndexes[columnIndexes[i] - 1] = columnIndexes[i];", "\t\t\t}", "\t\t}", "\t\tint[] returnUniqueColumnIndexes = new int[uniqueColumnNumbers];", "", "\t\t//return just the column positions which are not marked 0 in the uniqueColumnIndexes array", "\t\tfor (int i=0, j=0; i<uniqueColumnIndexes.length; i++) {", "\t\t\tif (uniqueColumnIndexes[i] != 0)", "\t\t\t\treturnUniqueColumnIndexes[j++] = uniqueColumnIndexes[i];", "\t\t}", "", "\t\treturn returnUniqueColumnIndexes;", "\t}", "", "\t/**", "\t * Verify that the auto-generated columns list (by name) has valid", "\t * column names for the table. If all the column names are valid,", "\t * convert column names array to corresponding column positions array", "\t * Save that column positions array in activation. We do this to simplify the", "\t * rest of the logic(it only has to deal with column positions here after).", "\t *", "\t * @exception StandardException\t\tThrown on error if invalid column", " * name in the list.", "\t */", "\tprivate void verifyAutoGeneratedColumnsNames(String[] columnNames)", "\t\tthrows StandardException", "\t{", "\t\tint size = columnNames.length;", "\t\tint columnPositions[] = new int[size];", "", " TableDescriptor tabDesc = dd.getTableDescriptor(constants.targetUUID);", "\t\tColumnDescriptor cd;", "", "\t\tfor (int i = 0; i < size; i++)", "\t\t{", "\t\t\tif (columnNames[i] == null)", "\t\t\t{", "\t\t\t\tthrow StandardException.newException(", "\t\t\t\t\tSQLState.LANG_INVALID_AUTOGEN_COLUMN_NAME,", " columnNames[i], tabDesc.getName());", "\t\t\t}", "", " cd = tabDesc.getColumnDescriptor(columnNames[i]);", "\t\t\tif (!verifyAutoGenColumn(cd))", "\t\t\t{", "\t\t\t\tthrow StandardException.newException(", "\t\t\t\t\tSQLState.LANG_INVALID_AUTOGEN_COLUMN_NAME,", " columnNames[i], tabDesc.getName());", "\t\t\t}", "", "\t\t\tcolumnPositions[i] = cd.getPosition();", "\t\t}", "\t\tactivation.setAutoGeneratedKeysResultsetInfo(columnPositions, null);", "\t}", "", "\t/**", "\t * Check that the received ColumnDescriptor corresponds to a column", "\t * for which it is possible to fetch auto-generated keys.", "\t */", "\tprivate boolean verifyAutoGenColumn(ColumnDescriptor cd)", "\t{", "\t\t/* Derby currently gets generated keys by calling the", "\t\t * IDENTITY_VAL_LOCAL() function (see \"getGeneratedKeys()\"", "\t\t * as defined on EmbedStatement). That function only", "\t\t * considers autoincrement columns. So if the column", "\t\t * specified by the user is not autoincrement, we return", "\t\t * false.", "\t\t */", "\t\treturn ((cd != null) && cd.isAutoincrement());", "\t}", "", " @Override", "\tpublic ResultSet getAutoGeneratedKeysResultset()", "\t{", "\t\treturn autoGeneratedKeysResultSet;", "\t}", "", "" ] }, { "added": [ "\t\tfirstExecuteSpecialHandlingAutoGen(firstExecute, rowChanger, constants.targetUUID);" ], "header": "@@ -984,33 +822,7 @@ class InsertResultSet extends DMLWriteGeneratedColumnsResultSet implements Targe", "removed": [ "\t\tif (firstExecute && activation.getAutoGeneratedKeysResultsetMode())", "\t\t{", "\t\t\tResultDescription rd;", "\t\t\tProperties properties = new Properties();", " autoGeneratedKeysColumnIndexes =", " activation.getAutoGeneratedKeysColumnIndexes();", "", "\t\t\t// Get the properties on the old heap", "\t\t\trowChanger.getHeapConglomerateController().getInternalTablePropertySet(properties);", "", " if (autoGeneratedKeysColumnIndexes != null) {", " // Use user-provided column positions array.", " autoGeneratedKeysColumnIndexes =", " uniqueColumnPositionArray(autoGeneratedKeysColumnIndexes);", " } else {", " // Prepare array of auto-generated keys for the table since", " // user didn't provide any.", " autoGeneratedKeysColumnIndexes =", " generatedColumnPositionsArray();", " }", "", " rd = lcc.getLanguageFactory().getResultDescription(", " resultDescription, autoGeneratedKeysColumnIndexes);", "\t\t\tautoGeneratedKeysRowsHolder =", "\t\t\t\tnew TemporaryRowHolderImpl(activation, properties, rd);", "\t\t}", "" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/UpdateResultSet.java", "hunks": [ { "added": [ "import java.util.Arrays;" ], "header": "@@ -22,6 +22,7 @@", "removed": [] }, { "added": [ "import org.apache.derby.iapi.sql.dictionary.ColumnDescriptor;", "import org.apache.derby.iapi.sql.dictionary.TableDescriptor;" ], "header": "@@ -53,7 +54,9 @@ import org.apache.derby.iapi.types.SQLBoolean;", "removed": [] }, { "added": [ "\t\tautoincrementGenerated = false;" ], "header": "@@ -265,6 +268,7 @@ class UpdateResultSet extends DMLWriteGeneratedColumnsResultSet", "removed": [] }, { "added": [ "\t\tverifyAutoGeneratedRScolumnsList(constants.targetUUID);" ], "header": "@@ -340,6 +344,7 @@ class UpdateResultSet extends DMLWriteGeneratedColumnsResultSet", "removed": [] }, { "added": [ "\t\tfirstExecuteSpecialHandlingAutoGen(firstOpen, rowChanger, constants.targetUUID);" ], "header": "@@ -409,6 +414,7 @@ class UpdateResultSet extends DMLWriteGeneratedColumnsResultSet", "removed": [] }, { "added": [ " // Collect auto-generated keys if requested.", " // DERBY-5823: No need to collect them if there are no", " // auto-generated key columns.", " if (activation.getAutoGeneratedKeysResultsetMode() &&", " autoGeneratedKeysColumnIndexes.length > 0) {", " autoGeneratedKeysRowsHolder.insert(", " getCompactRow(row, autoGeneratedKeysColumnIndexes));", " /*", " * find the value of the identity column. This could either", " * have been generated by Derby or supplied by user(user's", " * can supply value for \"generated by default as identity\").", " * In both cases, the value can be found in the row. Save", " * that value in identityVal. This locally saved value", " * is made available to JDBC Statement.RETURN_GENERATED_KEYS ", " * or IDENTITY_LOCAL_VAL function only if the UPDATE statement", " * has updated only one row. This implementation is as per the", " * JDBC spec", " */", " TableDescriptor td = lcc.getDataDictionary().getTableDescriptor(constants.targetUUID);", " \t\t", " int maxColumns = td.getMaxColumnID();", " int col;", " ", " for(col=1;col<=maxColumns;col++)", " {", " ColumnDescriptor cd = td.getColumnDescriptor(col);", " if(cd.isAutoincrement())", " {", " break;", " }", " }", " ", " if(col <= maxColumns)", " {", " DataValueDescriptor dvd = row.cloneColumn(col);", " identityVal = dvd.getLong();", " }", " }" ], "header": "@@ -490,6 +496,44 @@ class UpdateResultSet extends DMLWriteGeneratedColumnsResultSet", "removed": [] }, { "added": [ " ", " if(rowCount==1 && constants.hasAutoincrement()) ", "\t\t\tlcc.setIdentityValue(identityVal);" ], "header": "@@ -650,6 +694,9 @@ class UpdateResultSet extends DMLWriteGeneratedColumnsResultSet", "removed": [] } ] } ]
derby-DERBY-6743-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-675-4a8e892a
DERBY-675: The "readLine" method in ODBCMetadataGenerator.java was treating single backslashes as "end-of-line" markers and hence was not recognizing escaped sequences like "\n". It turns out that the check for backslashes in that method is unnecessary, so this patch removes it. I ran the metadata.java and odbc_metadata.java tests with this patch and they ran okay, so I think it should be safe. I still want to run some more tests tonight, just to be sure, but I thought I'd post the patch now since it is affecting another developer's current work (Mamta's). Submitted by Army Brown (qozinx@sbcglobal.net) git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@330672 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/build/org/apache/derbyBuild/ODBCMetadataGenerator.java", "hunks": [ { "added": [ "import java.io.LineNumberReader;" ], "header": "@@ -23,6 +23,7 @@ package org.apache.derbyBuild;", "removed": [] }, { "added": [ "\t\t// Note: We use ISO-8859-1 because property files are", "\t\t// defined to be that encoding.", "\t\tLineNumberReader reader =", "\t\t\tnew LineNumberReader(new InputStreamReader(is, \"ISO-8859-1\"));", "\t\tString line = null;", "\t\tfor (line = reader.readLine(); line != null;", "\t\t\tline = reader.readLine())", "\t\t\tif (line.length() == 0)", "\t\t\telse if (line.charAt(0) == '#') {", "\t\t\t\todbcMetaFile.write(line);", "\t\t\t// Write the line, then add an end-of-line to maintain", "\t\t\t// readability.", "\t\t\tquery.append(line);", "\t\t\tquery.append(\"\\n\");", "\t\t\t// Check to see if this is the last line of the query.", "\t\t\tboolean done = true;", "\t\t\tfor (int lastNonWS = line.length() - 1;", "\t\t\t\tlastNonWS >= 0; lastNonWS--)", "\t\t\t{", "\t\t\t\tchar ch = line.charAt(lastNonWS);", "\t\t\t\tif (!Character.isWhitespace(ch)) {", "\t\t\t\t// this is the last non-whitespace character; if it's", "\t\t\t\t// a backslash, then we continue building the query", "\t\t\t\t// by reading the next line.", "\t\t\t\t\tif (ch == '\\\\') {", "\t\t\t\t\t// then continue building the query.", "\t\t\t\t\t\tdone = false;", "\t\t\t\t\t}", "\t\t\t\t\tbreak;", "\t\t\t\t}", "\t\t\t}", "\t\t\tif (!done)", "\t\t\t// read next line and append it to current query." ], "header": "@@ -230,39 +231,51 @@ public class ODBCMetadataGenerator {", "removed": [ "\t\t// We assume no single line/query is greater than 1K in", "\t\t// length, and we'll fail if this isn't the case. The", "\t\t// limit of 1K was just picked arbitrarily; this can be", "\t\t// increased if needed at a later time.", "\t\tchar [] line = new char[1024];", "\t\tfor (int count = readLine(is, line);", "\t\t \tcount != -1; count = readLine(is, line))", "\t\t\tif (count == 0)", "\t\t\telse if (line[0] == '#') {", "\t\t\t\todbcMetaFile.write(line, 0, count);", "\t\t\t// Verify that we haven't passed our limit.", "\t\t\tif (count >= line.length) {", "\t\t\t\tthrow new IOException(", "\t\t\t\t\t\"Encountered line longer than expected when reading metadata \" +", "\t\t\t\t\t\"file; either shorten the line, or increase the limit...\");", "\t\t\t}", "\t\t\t// \"+1\" in next line because we added a \"\\n\" at the end and", "\t\t\t// we want to include that, for sake of easier reading.", "\t\t\tquery.append(line, 0, count+1);", "\t\t\tif (line[count-1] == '\\\\')", "\t\t\t// then continue building the query." ] }, { "added": [], "header": "@@ -1058,56 +1071,6 @@ public class ODBCMetadataGenerator {", "removed": [ "\t/* ****", "\t * readLine", "\t * Reads a line from the received input stream and stores it", "\t * into the received character array. In this method, we", "\t * consider the end of the line to be either 1) \"\\n\" char, or", "\t * 2) a single backslash \"\\\", which is used in metadata", "\t * queries to indicate line continuation. After reading", "\t * a line, we append an EOL to it for formatting purposes,", "\t * but that last EOL is NOT included in the count of", "\t * characters.", "\t * @param is The input stream from which we're reading.", "\t * @param line The char array into which we're reading.", "\t * @return the number of characters read from the", "\t *\tstream; -1 if we reached end of the stream.", "\t */", "\tprivate int readLine(InputStream is, char [] line)", "\t\tthrows IOException", "\t{", "", "\t\tint count = 0;", "\t\tboolean atLeastOneNonWSChar = false;", "", "\t\tchar ch;", "\t\tint byteRead;", "\t\tfor (byteRead = is.read();", "\t\t\t(byteRead != -1) && (count < line.length);", "\t\t\tbyteRead = is.read())", "\t\t{", "\t\t\tch = (char)byteRead;", "\t\t\tline[count++] = ch;", "\t\t\tatLeastOneNonWSChar = true;", "\t\t\tif ((ch == '\\\\') || (ch == '\\n'))", "\t\t\t\tbreak;", "\t\t}", "", "\t\tif ((byteRead == -1) && (count == 0))", "\t\t// end of file.", "\t\t\treturn -1;", "", "\t\t// Take off trailing whitespace.", "\t\twhile ((count > 0) && Character.isWhitespace(line[count-1]))", "\t\t\tcount--;", "", "\t\t// Add an EOL for ease of reading, but don't include it in", "\t\t// \"count\" total.", "\t\tline[count] = '\\n';", "\t\treturn count;", "", "\t}", "" ] } ] } ]
derby-DERBY-6751-1ae0d7dc
DERBY-6751: Prevent user code from getting a LanguageConnectionContext out of an EmbedConnection; tests passed cleanly on derby-6751-01-ad-usederbyinternals.diff. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1628855 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/jdbc/ConnectionChild.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;", "import java.security.AccessController;", "import java.security.PrivilegedAction;" ], "header": "@@ -22,8 +22,11 @@", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java", "hunks": [ { "added": [ " privilegedGetLCC().usesSqlAuthorization()) {" ], "header": "@@ -473,7 +473,7 @@ public class EmbedConnection implements EngineConnection", "removed": [ " getLanguageConnection().usesSqlAuthorization()) {" ] }, { "added": [ "\t\t\t\t\t\tprivilegedGetLCC().usesSqlAuthorization()) {" ], "header": "@@ -498,7 +498,7 @@ public class EmbedConnection implements EngineConnection", "removed": [ "\t\t\t\t\t\tgetLanguageConnection().usesSqlAuthorization()) {" ] }, { "added": [ "\t\t\t\t\t\tprivilegedGetLCC().usesSqlAuthorization()) {" ], "header": "@@ -590,7 +590,7 @@ public class EmbedConnection implements EngineConnection", "removed": [ "\t\t\t\t\t\tgetLanguageConnection().usesSqlAuthorization()) {" ] }, { "added": [ " privilegedGetLCC().usesSqlAuthorization()) {" ], "header": "@@ -601,7 +601,7 @@ public class EmbedConnection implements EngineConnection", "removed": [ " getLanguageConnection().usesSqlAuthorization()) {" ] }, { "added": [ "\t\t\tif (usingNoneAuth && privilegedGetLCC().usesSqlAuthorization())", " InterruptStatus.restoreIntrFlagIfSeen(privilegedGetLCC());" ], "header": "@@ -632,9 +632,9 @@ public class EmbedConnection implements EngineConnection", "removed": [ "\t\t\tif (usingNoneAuth && getLanguageConnection().usesSqlAuthorization())", " InterruptStatus.restoreIntrFlagIfSeen(getLanguageConnection());" ] }, { "added": [ " privilegedGetLCC().usesSqlAuthorization()) {" ], "header": "@@ -934,7 +934,7 @@ public class EmbedConnection implements EngineConnection", "removed": [ " getLanguageConnection().usesSqlAuthorization()) {" ] }, { "added": [ " privilegedGetLCC().usesSqlAuthorization()) {" ], "header": "@@ -978,7 +978,7 @@ public class EmbedConnection implements EngineConnection", "removed": [ " getLanguageConnection().usesSqlAuthorization()) {" ] }, { "added": [ " privilegedGetLCC().usesSqlAuthorization()) {" ], "header": "@@ -1103,7 +1103,7 @@ public class EmbedConnection implements EngineConnection", "removed": [ " getLanguageConnection().usesSqlAuthorization()) {" ] }, { "added": [ "\t\tfinal LanguageConnectionContext lcc = privilegedGetLCC();" ], "header": "@@ -1420,7 +1420,7 @@ public class EmbedConnection implements EngineConnection", "removed": [ "\t\tfinal LanguageConnectionContext lcc = getLanguageConnection();" ] }, { "added": [ " InterruptStatus.restoreIntrFlagIfSeen(privilegedGetLCC());" ], "header": "@@ -1925,7 +1925,7 @@ public class EmbedConnection implements EngineConnection", "removed": [ " InterruptStatus.restoreIntrFlagIfSeen(getLanguageConnection());" ] }, { "added": [ " InterruptStatus.restoreIntrFlagIfSeen(privilegedGetLCC());" ], "header": "@@ -1962,7 +1962,7 @@ public class EmbedConnection implements EngineConnection", "removed": [ " InterruptStatus.restoreIntrFlagIfSeen(getLanguageConnection());" ] }, { "added": [ " LanguageConnectionContext lcc = privilegedGetLCC();" ], "header": "@@ -2154,7 +2154,7 @@ public class EmbedConnection implements EngineConnection", "removed": [ " LanguageConnectionContext lcc = getLanguageConnection();" ] }, { "added": [ "\t\treturn privilegedGetLCC().isReadOnly();" ], "header": "@@ -2174,7 +2174,7 @@ public class EmbedConnection implements EngineConnection", "removed": [ "\t\treturn getLanguageConnection().isReadOnly();" ] }, { "added": [ " LanguageConnectionContext lcc = privilegedGetLCC();" ], "header": "@@ -2250,7 +2250,7 @@ public class EmbedConnection implements EngineConnection", "removed": [ " LanguageConnectionContext lcc = getLanguageConnection();" ] }, { "added": [ "\t\treturn TransactionControl.jdbcIsolationLevel( privilegedGetLCC().getCurrentIsolationLevel() );" ], "header": "@@ -2270,7 +2270,7 @@ public class EmbedConnection implements EngineConnection", "removed": [ "\t\treturn TransactionControl.jdbcIsolationLevel( getLanguageConnection().getCurrentIsolationLevel() );" ] }, { "added": [ " // Verify that we have permission to execute this method.", " SecurityUtil.checkDerbyInternalsPrivilege();", "", "\t\treturn privilegedGetLCC();" ], "header": "@@ -2361,10 +2361,13 @@ public class EmbedConnection implements EngineConnection", "removed": [ "\t\treturn getTR().getLcc();" ] }, { "added": [ " InterruptStatus.restoreIntrFlagIfSeen(privilegedGetLCC());" ], "header": "@@ -2525,7 +2528,7 @@ public class EmbedConnection implements EngineConnection", "removed": [ " InterruptStatus.restoreIntrFlagIfSeen(getLanguageConnection());" ] }, { "added": [ " InterruptStatus.restoreIntrFlagIfSeen(privilegedGetLCC());" ], "header": "@@ -2558,7 +2561,7 @@ public class EmbedConnection implements EngineConnection", "removed": [ " InterruptStatus.restoreIntrFlagIfSeen(getLanguageConnection());" ] }, { "added": [ " restoreIntrFlagIfSeen(privilegedGetLCC());" ], "header": "@@ -2878,7 +2881,7 @@ public class EmbedConnection implements EngineConnection", "removed": [ " restoreIntrFlagIfSeen(getLanguageConnection());" ] }, { "added": [ "\t\tprivilegedGetLCC().setDrdaID(drdaID);" ], "header": "@@ -2965,7 +2968,7 @@ public class EmbedConnection implements EngineConnection", "removed": [ "\t\tgetLanguageConnection().setDrdaID(drdaID);" ] }, { "added": [ " LanguageConnectionContext lcc = privilegedGetLCC();" ], "header": "@@ -2986,7 +2989,7 @@ public class EmbedConnection implements EngineConnection", "removed": [ " LanguageConnectionContext lcc = getLanguageConnection();" ] }, { "added": [ " LanguageConnectionContext lcc = privilegedGetLCC();" ], "header": "@@ -3028,7 +3031,7 @@ public class EmbedConnection implements EngineConnection", "removed": [ " LanguageConnectionContext lcc = getLanguageConnection();" ] }, { "added": [ " LanguageConnectionContext lcc = privilegedGetLCC();" ], "header": "@@ -3080,7 +3083,7 @@ public class EmbedConnection implements EngineConnection", "removed": [ " LanguageConnectionContext lcc = getLanguageConnection();" ] }, { "added": [ " LanguageConnectionContext lcc = privilegedGetLCC();" ], "header": "@@ -3106,7 +3109,7 @@ public class EmbedConnection implements EngineConnection", "removed": [ " LanguageConnectionContext lcc = getLanguageConnection();" ] }, { "added": [ "\t\t\tprivilegedGetLCC().setPrepareIsolationLevel(level);" ], "header": "@@ -3176,7 +3179,7 @@ public class EmbedConnection implements EngineConnection", "removed": [ "\t\t\tgetLanguageConnection().setPrepareIsolationLevel(level);" ] }, { "added": [ "\t\treturn privilegedGetLCC().getPrepareIsolationLevel();" ], "header": "@@ -3185,7 +3188,7 @@ public class EmbedConnection implements EngineConnection", "removed": [ "\t\treturn getLanguageConnection().getPrepareIsolationLevel();" ] }, { "added": [ " LanguageConnectionContext lcc = privilegedGetLCC();" ], "header": "@@ -3232,7 +3235,7 @@ public class EmbedConnection implements EngineConnection", "removed": [ " LanguageConnectionContext lcc = getLanguageConnection();" ] }, { "added": [ " privilegedGetLCC().getStatementContext().cancel();" ], "header": "@@ -3415,7 +3418,7 @@ public class EmbedConnection implements EngineConnection", "removed": [ " getLanguageConnection().getStatementContext().cancel();" ] }, { "added": [ " return privilegedGetLCC().getCurrentSchemaName();" ], "header": "@@ -3426,7 +3429,7 @@ public class EmbedConnection implements EngineConnection", "removed": [ " return getLanguageConnection().getCurrentSchemaName();" ] }, { "added": [ " privilegedGetLCC().internalRollbackToSavepoint(" ], "header": "@@ -3565,7 +3568,7 @@ public class EmbedConnection implements EngineConnection", "removed": [ " getLanguageConnection().internalRollbackToSavepoint(" ] }, { "added": [ " privilegedGetLCC().releaseSavePoint(" ], "header": "@@ -3596,7 +3599,7 @@ public class EmbedConnection implements EngineConnection", "removed": [ " getLanguageConnection().releaseSavePoint(" ] }, { "added": [ " privilegedGetLCC().getStatementContext();" ], "header": "@@ -3615,7 +3618,7 @@ public class EmbedConnection implements EngineConnection", "removed": [ " getLanguageConnection().getStatementContext();" ] }, { "added": [ " LanguageConnectionContext lcc = privilegedGetLCC();" ], "header": "@@ -3656,7 +3659,7 @@ public class EmbedConnection implements EngineConnection", "removed": [ " LanguageConnectionContext lcc = getLanguageConnection();" ] } ] }, { "file": "java/engine/org/apache/derby/impl/jdbc/EmbedConnectionContext.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;", "import java.security.AccessController;", "import java.security.PrivilegedAction;" ], "header": "@@ -29,8 +29,11 @@ import org.apache.derby.iapi.sql.conn.StatementContext;", "removed": [] }, { "added": [ "\t\t\tStatementContext sc = privilegedGetLCC( conn ).getStatementContext();" ], "header": "@@ -108,7 +111,7 @@ class EmbedConnectionContext extends ContextImpl", "removed": [ "\t\t\tStatementContext sc = conn.getLanguageConnection().getStatementContext();" ] } ] }, { "file": "java/engine/org/apache/derby/impl/jdbc/EmbedDatabaseMetaData.java", "hunks": [ { "added": [ "import java.security.AccessController;", "import java.security.PrivilegedAction;" ], "header": "@@ -42,6 +42,8 @@ import org.apache.derby.iapi.reference.Limits;", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java", "hunks": [ { "added": [ "import java.security.AccessController;", "import java.security.PrivilegedAction;", "" ], "header": "@@ -79,6 +79,9 @@ import java.sql.Ref;", "removed": [] }, { "added": [ " final ExecutionFactory factory = getLanguageConnectionContext( conn )." ], "header": "@@ -273,7 +276,7 @@ public class EmbedResultSet extends ConnectionChild", "removed": [ " final ExecutionFactory factory = conn.getLanguageConnection()." ] }, { "added": [ "\t\t\t\tLanguageConnectionContext lcc = getLanguageConnectionContext( getEmbedConnection() );" ], "header": "@@ -418,7 +421,7 @@ public class EmbedResultSet extends ConnectionChild", "removed": [ "\t\t\t\tLanguageConnectionContext lcc = getEmbedConnection().getLanguageConnection();" ] }, { "added": [ " getLanguageConnectionContext( getEmbedConnection() );" ], "header": "@@ -588,7 +591,7 @@ public class EmbedResultSet extends ConnectionChild", "removed": [ " getEmbedConnection().getLanguageConnection();" ] }, { "added": [ " LanguageConnectionContext lcc = getLanguageConnectionContext( getEmbedConnection() );" ], "header": "@@ -3843,7 +3846,7 @@ public class EmbedResultSet extends ConnectionChild", "removed": [ " LanguageConnectionContext lcc = getEmbedConnection().getLanguageConnection();" ] }, { "added": [ " LanguageConnectionContext lcc = getLanguageConnectionContext( getEmbedConnection() );" ], "header": "@@ -3963,7 +3966,7 @@ public class EmbedResultSet extends ConnectionChild", "removed": [ " LanguageConnectionContext lcc = getEmbedConnection().getLanguageConnection();" ] }, { "added": [ " LanguageConnectionContext lcc = getLanguageConnectionContext( getEmbedConnection() );" ], "header": "@@ -4066,7 +4069,7 @@ public class EmbedResultSet extends ConnectionChild", "removed": [ " LanguageConnectionContext lcc = getEmbedConnection().getLanguageConnection();" ] }, { "added": [ " InterruptStatus.restoreIntrFlagIfSeen", " ( getLanguageConnectionContext( getEmbedConnection() ) );" ], "header": "@@ -4221,8 +4224,8 @@ public class EmbedResultSet extends ConnectionChild", "removed": [ " InterruptStatus.restoreIntrFlagIfSeen(", " getEmbedConnection().getLanguageConnection());" ] }, { "added": [ " LanguageConnectionContext lcc = getLanguageConnectionContext( ec );" ], "header": "@@ -4355,7 +4358,7 @@ public class EmbedResultSet extends ConnectionChild", "removed": [ " LanguageConnectionContext lcc = ec.getLanguageConnection();" ] } ] }, { "file": "java/engine/org/apache/derby/impl/jdbc/EmbedSavepoint.java", "hunks": [ { "added": [ "import java.security.AccessController;", "import java.security.PrivilegedAction;", "import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;" ], "header": "@@ -21,10 +21,13 @@", "removed": [] }, { "added": [ " //Generating a unique internal name for unnamed savepoints", " savepointName = \"i.\" + getLanguageConnectionContext( conn ).getUniqueSavepointName();", " savepointID = getLanguageConnectionContext( conn ).getUniqueSavepointID();", " \t\tgetLanguageConnectionContext( conn ).languageSetSavePoint(savepointName, this);" ], "header": "@@ -65,15 +68,15 @@ final class EmbedSavepoint extends ConnectionChild", "removed": [ "\t\t\t\t//Generating a unique internal name for unnamed savepoints", "\t\t\t\tsavepointName = \"i.\" + conn.getLanguageConnection().getUniqueSavepointName();", "\t\t\t\tsavepointID = conn.getLanguageConnection().getUniqueSavepointID();", " \t\tconn.getLanguageConnection().languageSetSavePoint(savepointName, this);" ] } ] }, { "file": "java/engine/org/apache/derby/impl/jdbc/EmbedStatement.java", "hunks": [ { "added": [ "import java.security.AccessController;", "import java.security.PrivilegedAction;" ], "header": "@@ -33,6 +33,8 @@ import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/jdbc/EmbedPooledConnection.java", "hunks": [ { "added": [ "import java.security.AccessController;", "import java.security.PrivilegedAction;" ], "header": "@@ -37,6 +37,8 @@ import org.apache.derby.impl.jdbc.EmbedCallableStatement;", "removed": [] }, { "added": [ "\t\t\treturn getLanguageConnectionContext( realConnection ).isIsolationLevelSetUsingSQLorJDBC();" ], "header": "@@ -402,7 +404,7 @@ class EmbedPooledConnection implements javax.sql.PooledConnection, BrokeredConne", "removed": [ "\t\t\treturn realConnection.getLanguageConnection().isIsolationLevelSetUsingSQLorJDBC();" ] }, { "added": [ "\t\tgetLanguageConnectionContext( realConnection ).resetIsolationLevelFlagUsedForSQLandJDBC();" ], "header": "@@ -414,7 +416,7 @@ class EmbedPooledConnection implements javax.sql.PooledConnection, BrokeredConne", "removed": [ "\t\trealConnection.getLanguageConnection().resetIsolationLevelFlagUsedForSQLandJDBC();" ] } ] }, { "file": "java/engine/org/apache/derby/jdbc/EmbedXAResource.java", "hunks": [ { "added": [ "import java.security.PrivilegedExceptionAction;", "import java.security.PrivilegedActionException;" ], "header": "@@ -21,6 +21,8 @@", "removed": [] }, { "added": [ "import org.apache.derby.impl.jdbc.Util;" ], "header": "@@ -46,6 +48,7 @@ import org.apache.derby.iapi.store.access.xa.XAResourceManager;", "removed": [] }, { "added": [ " LanguageConnectionContext lcc = getLanguageConnectionContext( con );" ], "header": "@@ -545,7 +548,7 @@ class EmbedXAResource implements XAResource {", "removed": [ " LanguageConnectionContext lcc = con.getLanguageConnection();" ] }, { "added": [ " getLanguageConnectionContext( con.realConnection )." ], "header": "@@ -658,7 +661,7 @@ class EmbedXAResource implements XAResource {", "removed": [ " con.realConnection.getLanguageConnection()." ] } ] }, { "file": "java/engine/org/apache/derby/jdbc/InternalDriver.java", "hunks": [ { "added": [ "import java.security.PrivilegedExceptionAction;", "import java.security.PrivilegedActionException;" ], "header": "@@ -24,6 +24,8 @@ package org.apache.derby.jdbc;", "removed": [] } ] } ]
derby-DERBY-6751-a57220c2
DERBY-6751: Improve performance of ResultSet.next() by caching the lcc in ConnectionChild; tests passed cleanly on derby-6751-02-ab-cacheLCC.diff. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1629866 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/jdbc/ConnectionChild.java", "hunks": [ { "added": [ " /** Cached LanguageConnectionContext */", " private LanguageConnectionContext lcc;", "" ], "header": "@@ -42,6 +42,9 @@ abstract class ConnectionChild {", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/jdbc/EmbedXAResource.java", "hunks": [ { "added": [ "", " private LanguageConnectionContext lcc;" ], "header": "@@ -63,6 +63,8 @@ class EmbedXAResource implements XAResource {", "removed": [] }, { "added": [ " if ( lcc == null )", " {", " try {", " lcc = AccessController.doPrivileged", " (", " new PrivilegedExceptionAction<LanguageConnectionContext>()", " public LanguageConnectionContext run()", " throws SQLException", " {", " return conn.getLanguageConnection();", " }", " );", " } catch (PrivilegedActionException pae)", " {", " throw Util.javaException( pae );", " }", "", " return lcc;" ], "header": "@@ -997,22 +999,27 @@ class EmbedXAResource implements XAResource {", "removed": [ " try {", " return AccessController.doPrivileged", " (", " new PrivilegedExceptionAction<LanguageConnectionContext>()", " {", " public LanguageConnectionContext run()", " throws SQLException", " return conn.getLanguageConnection();", " }", " );", " } catch (PrivilegedActionException pae)", " {", " throw Util.javaException( pae );" ] } ] } ]
derby-DERBY-6755-cf8e7ff4
DERBY-6755: Adjust MathTrigFunctionsTest to account for discrepancy introduced by Java 9; commit derby-6755-01-aa-java9diff.diff. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1629251 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-6764-383bfd5f
DERBY-6764(analyze impact of poodle security alert on Derby client - server ssl support) Fixed problem with array counter. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1636798 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java", "hunks": [ { "added": [ " String[] supportedProtocols = new String[enabledProtocols.length];", " int supportedProtocolsCount = 0;", " if (!(enabledProtocols[i].toUpperCase().contains(\"SSLV3\") ||", " \tenabledProtocols[i].toUpperCase().contains(\"SSLV2HELLO\"))) {", " \tsupportedProtocols[supportedProtocolsCount] = enabledProtocols[i];", " \tsupportedProtocolsCount++;", " if(supportedProtocolsCount < enabledProtocols.length) {", " String[] newEnabledProtocolsList = null;", " new String[supportedProtocolsCount];", " System.arraycopy(supportedProtocols, 0, ", " supportedProtocolsCount);" ], "header": "@@ -2709,29 +2709,26 @@ public final class NetworkServerControlImpl {", "removed": [ " String[] removeTwoProtocols = new String[enabledProtocols.length];", " int removedProtocolsCount = 0;", " boolean foundProtocolToRemove=false;", " if (enabledProtocols[i].toUpperCase().contains(\"SSLV3\") ||", " \tenabledProtocols[i].toUpperCase().contains(\"SSLV2HELLO\")) {", " \tfoundProtocolToRemove=true;", " } else {", " \tremoveTwoProtocols[removedProtocolsCount] = enabledProtocols[i];", " \tremovedProtocolsCount++;", " String[] newEnabledProtocolsList = null;", " if(foundProtocolToRemove) {", " new String[(removeTwoProtocols.length)-1];", " System.arraycopy(removeTwoProtocols, 0, ", " removedProtocolsCount);" ] } ] } ]
derby-DERBY-6764-f78eb01c
DERBY-6764(analyze impact of poodle security alert on Derby client - server ssl support) Removed SSLv3 and SSLv2Hello from list of enabled protocols on the client and server side to avoid poodle security breach. Also, changed NaiveTrustManager to use TLS as the default protocol rather than SSL. If NaiveTrustManager used SSL, then it won't find any enabled protocols for SSL after the removal of SSLv3 and SSLv2Hello. Changing it to TLS makes TLS protocols available for communication. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1636509 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/client/org/apache/derby/client/net/OpenSocketAction.java", "hunks": [ { "added": [ "" ], "header": "@@ -22,6 +22,7 @@", "removed": [] }, { "added": [ "import javax.net.ssl.SSLSocket;" ], "header": "@@ -32,6 +33,7 @@ import java.security.PrivilegedExceptionAction;", "removed": [] } ] }, { "file": "java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java", "hunks": [ { "added": [ " SSLServerSocket sss1= ", " (SSLServerSocket)ssf.createServerSocket(portNumber,", " 0,", " hostAddress);", " //DERBY-6764(analyze impact of poodle security alert on ", " // Derby client - server ssl support)", " String[] removeTwoProtocols = ", " \t\tremoveSSLv3andSSLv2Hello(", " sss1.getEnabledProtocols());", " sss1.setEnabledProtocols(removeTwoProtocols);", " return sss1;" ], "header": "@@ -724,9 +724,17 @@ public final class NetworkServerControlImpl {", "removed": [ " return (SSLServerSocket)ssf.createServerSocket(portNumber,", " 0,", " hostAddress);" ] }, { "added": [ " //DERBY-6764(analyze impact of poodle security alert on ", " // Derby client - server ssl support)", " removeTwoProtocols = ", " \t\tremoveSSLv3andSSLv2Hello(", " sss2.getEnabledProtocols());", " sss2.setEnabledProtocols(removeTwoProtocols);" ], "header": "@@ -734,6 +742,12 @@ public final class NetworkServerControlImpl {", "removed": [] }, { "added": [ " //DERBY-6764(analyze impact of poodle security alert on ", " // Derby client - server ssl support)", " String[] removeTwoProtocols = ", " \t\tremoveSSLv3andSSLv2Hello(s1.getEnabledProtocols());", " s1.setEnabledProtocols(", " \t\tremoveTwoProtocols);" ], "header": "@@ -2628,6 +2642,12 @@ public final class NetworkServerControlImpl {", "removed": [] }, { "added": [ " //DERBY-6764(analyze impact of poodle security alert on ", " // Derby client - server ssl support)", " removeTwoProtocols = ", " \t\tremoveSSLv3andSSLv2Hello(s2.getEnabledProtocols());", " s2.setEnabledProtocols(", " \t\tremoveTwoProtocols);" ], "header": "@@ -2635,6 +2655,12 @@ public final class NetworkServerControlImpl {", "removed": [] }, { "added": [ " //DERBY-6764(analyze impact of poodle security alert on ", " // Derby client - server ssl support)", " //Remove SSLv3 and SSLv2Hello protocols from list of enabled protocols", " private String[] removeSSLv3andSSLv2Hello(String[] enabledProtocols) {", " //If SSLv3 and SSLv2Hello are one of the enabled protocols, then ", " // remove them from the list of enabled protocols because of the ", " // possible security breach.", " String[] removeTwoProtocols = new String[enabledProtocols.length];", " int removedProtocolsCount = 0;", " boolean foundProtocolToRemove=false;", " for ( int i = 0; i < enabledProtocols.length; i++ )", " {", " if (enabledProtocols[i].toUpperCase().contains(\"SSLV3\") ||", " \tenabledProtocols[i].toUpperCase().contains(\"SSLv2Hello\")) {", " \tfoundProtocolToRemove=true;", " } else {", " \tremoveTwoProtocols[removedProtocolsCount] = enabledProtocols[i];", " \tremovedProtocolsCount++;", " }", " }", " String[] newEnabledProtocolsList = null;", " if(foundProtocolToRemove) {", " //We found SSLv3 and/or SSLv2Hello as one of the enabled ", " // protocols for this jvm. Following code will remove them from ", " // enabled list.", " newEnabledProtocolsList = ", " new String[(removeTwoProtocols.length)-1];", " System.arraycopy(removeTwoProtocols, 0, ", " newEnabledProtocolsList, 0, ", " (removeTwoProtocols.length)-1);", " return(newEnabledProtocolsList);", " } else ", " return(enabledProtocols);", " }", "" ], "header": "@@ -2676,7 +2702,41 @@ public final class NetworkServerControlImpl {", "removed": [ " " ] } ] } ]
derby-DERBY-6768-99d48baf
DERBY-6768(List the enabled protocols in derby.log for network server configuration) With this change, we will now print the enabled protocols list in the log file when the server starts up. A sample new line in the log will look as follows Wed Nov 12 21:32:21 PST 2014 : Apache Derby Network Server - 10.12.0.0 alpha - (1636020M) Enabled Protocols are SSLv3, TLSv1, TLSv1.1, TLSv1.2 git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1639804 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java", "hunks": [ { "added": [ " /*", " * DERBY-6768(List the enabled protocols in derby.log for network ", " * server configuration)", " * Get the enabled protocols so we can list them in the log file", " */", " private String getEnabledProtocols(SSLServerSocket sslServerSocket) {", " \t//Converting the String array of enabled protocols to a String", " \tStringBuffer sbf = new StringBuffer();", " String[] enabledProtocols = sslServerSocket.getEnabledProtocols();", " if(enabledProtocols.length > 0){", " ", " sbf.append(enabledProtocols[0]);", " for(int i=1; i < enabledProtocols.length; i++){", " sbf.append(\", \").append(enabledProtocols[i]);", " }", " ", " }", " return sbf.toString();", " }" ], "header": "@@ -753,6 +753,25 @@ public final class NetworkServerControlImpl {", "removed": [] }, { "added": [ " {Integer.toString(portNumber), att_srvclsnm, versionString});", " consolePropertyMessage(\"DRDA_EnabledProtocols.I\", new String [] ", " {getEnabledProtocols((SSLServerSocket) serverSocket), ", " \t\tatt_srvclsnm, versionString});", " consolePropertyMessage(\"DRDA_EnabledProtocols.I\", new String [] ", " {getEnabledProtocols((SSLServerSocket) serverSocket), ", " \t\tatt_srvclsnm, versionString});" ], "header": "@@ -822,11 +841,17 @@ public final class NetworkServerControlImpl {", "removed": [ " {Integer.toString(portNumber), att_srvclsnm, versionString});" ] } ] } ]
derby-DERBY-6773-d02bb72f
DERBY-6773: Derby throws plain SQLIntegrityConstraintViolationException This patch includes contributions from Abhinav Gupta (abhinavgupta2004 at gmail dot com) This patch enables use of the new Derby-specific subclass of SQLIntegrityConstraintViolationException in both the embedded and client-server configurations of the SQLExceptionFactory. In addition, a number of new tests are added to verify that the new exception is thrown and can be caught as we expect, and that the accessor methods on the new exception allow applications to determine which table name and constraint name were responsible for the exception. We still have a couple cleanup tasks before DERBY-6773 is fully complete, but as of this patch the new behavior is in effect. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1696690 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/jdbc/SQLExceptionFactory.java", "hunks": [ { "added": [ "import org.apache.derby.shared.common.error.DerbySQLIntegrityConstraintViolationException;" ], "header": "@@ -34,6 +34,7 @@ import org.apache.derby.iapi.error.StandardException;", "removed": [] } ] }, { "file": "java/shared/org/apache/derby/shared/common/error/DerbySQLIntegrityConstraintViolationException.java", "hunks": [ { "added": [ "\t\ttableName = argsTwo.toString();", "\t\tconstraintName = argsOne.toString();" ], "header": "@@ -31,8 +31,8 @@ public class DerbySQLIntegrityConstraintViolationException", "removed": [ "\t\ttableName = argsOne.toString();", "\t\tconstraintName = argsTwo.toString();" ] } ] } ]
derby-DERBY-6774-dbde907f
DERBY-6774 org.apache.derbyTesting.functionTests.tests.lang.AlterTableTest.testAddIdentityColumn failed with assert in nightlys Temporarily removing assert that is failing, looks like code should handle the condition anyway. Will renable after figuring out what is going on, hoping this will allow for clean runs from others while I work on this issue. My current theory is that there is a long time problem with alter table and the conglomerate cache that has been uncovered by this relatively new test and the new background work introduced by DERBY-4057. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1641753 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/store/access/heap/Heap.java", "hunks": [ { "added": [ " // DERBY-6774 - temp disabling this ASSERT while working on", " // why it is firing in trunk. The hope is that trunk tests", " // will pass for others while I work on fixing DERBY-6774.", " //", " // The code always adds the column after the last field even", " // if there is a mismatch with what is requested. The store", " // only supports adding a column at the end anyway.", " //", " // I believe the issue is some sort of timing with background", " // threads and alter table and the conglomerate cache. The", " // conglomerate cache was created assuming the data was static,", " // but in the case of alter table add and drop column this is", " // not true. There are some attempts in the access layer to", " // invalidate the cache after an abort of a alter table, but", " // I think there is still a race condition.", "", " /*" ], "header": "@@ -416,6 +416,23 @@ public class Heap", "removed": [] }, { "added": [ " */" ], "header": "@@ -430,6 +447,7 @@ public class Heap", "removed": [] } ] } ]
derby-DERBY-6775-2678c360
DERBY-4057 Removing one check in test that is failing across platforms. Separate work under DERBY-6775 will improve the test in this area. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1643463 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-6775-a48aa44d
DERBY-6775 add to testBlobLinkedListReclamationOnRollback() test to check that free space is used on subsequent inserts increasing wait time, hoping to make test stable on slow machine in oracle nightly testing. Making it retry at least twice and increasing second retry time. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1647844 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-6783-54844c3a
DERBY-6783: WHEN clause in CREATE TRIGGER for UPDATE is not working. This patch was contributed by Abhinav Gupta (abhinavgupta2004 at gmail dot com) The main challenge raised by this issue involved the analysis of which columns are referenced by the trigger. Trigger statements can reference columns in a number of ways, including the "AFTER UPDATE OF" clause, the trigger's action statement, and the trigger's "WHEN" clause. When the WHEN clause support was introduced, this added a new way in which a TRIGGER could reference columns, and the compiler code which translated the trigger's logic into specific column references at runtime wasn't getting the right set of columns. The intent of this patch is to successfully run sql queries in Derby that trigger updates in a table, affecting only a certain rows of data that is determined by the when clause. This patch tries to cover a wide range of possible ways in which rows are conditionally updated after an event. Before this patch such trigger commands failed to execute correctly and left the data in an inconsistent state. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1688062 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/sql/dictionary/DataDictionary.java", "hunks": [ { "added": [ "\tpublic int[] examineTriggerNodeAndCols(", "\t\t\tVisitable actionStmt,", "\t\t\tString oldReferencingName,", "\t\t\tString newReferencingName,", "\t\t\tString triggerDefinition,", "\t\t\tint[] referencedCols,", "\t\t\tint[] referencedColsInTriggerAction,", "\t\t\tint actionOffset,", "\t\t\tTableDescriptor triggerTableDescriptor,", "\t\t\tint triggerEventMask,", " boolean createTriggerTime,", " List<int[]> replacements", "\t\t\t) throws StandardException;", "\t", "" ], "header": "@@ -1203,6 +1203,21 @@ public interface DataDictionary", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/iapi/sql/dictionary/TriggerDescriptor.java", "hunks": [ { "added": [ " int[] cols;", " cols = dd.examineTriggerNodeAndCols(stmtnode,", "\t\t\t\t\toldReferencingName,", "\t\t\t\t\tnewReferencingName,", "\t\t\t\t\toriginalSQL,", "\t\t\t\t\treferencedCols,", "\t\t\t\t\treferencedColsInTriggerAction,", " 0,", "\t\t\t\t\ttd,", "\t\t\t\t\t-1,", " false,", " null);" ], "header": "@@ -403,6 +403,18 @@ public class TriggerDescriptor extends UniqueSQLObjectDescriptor", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java", "hunks": [ { "added": [ "import java.util.Arrays;" ], "header": "@@ -33,6 +33,7 @@ import java.security.NoSuchAlgorithmException;", "removed": [] }, { "added": [ "\tpublic int[] examineTriggerNodeAndCols(" ], "header": "@@ -4743,7 +4744,7 @@ public final class\tDataDictionaryImpl", "removed": [ "\tpublic String getTriggerActionString(" ] }, { "added": [ "\t\t/**", "\t\t * It identifies all the trigger action columns and is initialized to -1.", "\t\t */", "\t\t", "\t\tint[] triggerActionColsOnly = new int[numberOfColsInTriggerTable];", "\t\tjava.util.Arrays.fill(triggerActionColsOnly, -1);", "" ], "header": "@@ -4793,6 +4794,13 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ "\t\tif (referencedColsInTriggerAction != null) {", "\t\t\tfor (int i=0; i < referencedColsInTriggerAction.length; i++){", "\t\t\t\tif( referencedColsInTriggerAction[i] > 0 )", "\t\t\t\ttriggerColsAndTriggerActionCols[referencedColsInTriggerAction[i]-1] = referencedColsInTriggerAction[i];", "\t\t\t}", "\t\t}" ], "header": "@@ -4823,6 +4831,12 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [], "header": "@@ -4850,8 +4864,6 @@ public final class\tDataDictionaryImpl", "removed": [ "\t\t\tint[] triggerActionColsOnly = new int[numberOfColsInTriggerTable];", "\t\t\tjava.util.Arrays.fill(triggerActionColsOnly, -1);" ] }, { "added": [ "\tArrays.sort( triggerColsAndTriggerActionCols );", "" ], "header": "@@ -4934,6 +4946,8 @@ public final class\tDataDictionaryImpl", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/CreateTriggerNode.java", "hunks": [ { "added": [ "", "\t\t\tint[] cols;", "", "\t\t\tcols = getDataDictionary().examineTriggerNodeAndCols(actionNode,", "\t\t\t\t\toldTableName,", "\t\t\t\t\tnewTableName,", "\t\t\t\t\toriginalActionText,", "\t\t\t\t\treferencedColInts,", "\t\t\t\t\treferencedColsInTriggerAction,", " actionNode.getBeginOffset(),", "\t\t\t\t\ttriggerTableDescriptor,", "\t\t\t\t\ttriggerEventMask,", " true,", " actionTransformations);", "", " \t\tif (whenClause != null)", " \t\t{", " \t\tcols = getDataDictionary().examineTriggerNodeAndCols(whenClause,", " \t\t\toldTableName,", "\t\t\t\t\tnewTableName,", "\t\t\t\t\toriginalActionText,", "\t\t\t\t\treferencedColInts,", "\t\t\t\t\treferencedColsInTriggerAction,", " actionNode.getBeginOffset(),", "\t\t\t\t\ttriggerTableDescriptor,", "\t\t\t\t\ttriggerEventMask,", " true,", " actionTransformations);", " \t\t}", "", "" ], "header": "@@ -626,6 +626,37 @@ class CreateTriggerNode extends DDLStatementNode", "removed": [] }, { "added": [ " actionTransformations, cols);" ], "header": "@@ -639,7 +670,7 @@ class CreateTriggerNode extends DDLStatementNode", "removed": [ " actionTransformations);" ] } ] }, { "file": "java/storeless/org/apache/derby/impl/storeless/EmptyDictionary.java", "hunks": [ { "added": [ "\tpublic int[] examineTriggerNodeAndCols(", "\t\t\tVisitable actionStmt,", "\t\t\tString oldReferencingName,", "\t\t\tString newReferencingName,", "\t\t\tString triggerDefinition,", "\t\t\tint[] referencedCols,", "\t\t\tint[] referencedColsInTriggerAction,", "\t\t\tint actionOffset,", "\t\t\tTableDescriptor triggerTableDescriptor,", "\t\t\tint triggerEventMask,", " boolean createTriggerTime,", " List<int[]> replacements", "\t\t\t) throws StandardException", "\t{", "\t\treturn null;", "\t}", "" ], "header": "@@ -508,6 +508,23 @@ public class EmptyDictionary implements DataDictionary, ModuleSupportable {", "removed": [] } ] } ]
derby-DERBY-6786-2302f2a5
DERBY-6786(NullPointerException in INSERT INTO statement with multiple subselects) Adding test casee for DERBY-6786. One test case(zztestDerby6786InsertIntoSelectCase3) which will result into NPE has been disabled. Once DERBY-6786 is fixed, we should enable that test by removing the zz in front of the test name. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1651707 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-6786-36dd3e20
DERBY-6788(Wrong value inserted by INSERT INTO with multiple subselects) Adding a junit test case for DERBY-6788. This bug might be related to DERBY-6786(NullPointerException in INSERT INTO statement with multiple subselects) git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1653986 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-6788-36dd3e20
DERBY-6788(Wrong value inserted by INSERT INTO with multiple subselects) Adding a junit test case for DERBY-6788. This bug might be related to DERBY-6786(NullPointerException in INSERT INTO statement with multiple subselects) git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1653986 13f79535-47bb-0310-9956-ffa450edef68
[]