id
stringlengths
22
25
commit_message
stringlengths
137
6.96k
diffs
listlengths
0
63
derby-DERBY-1952-3ca3bd45
DERBY-1952 DERBY-2047 Remove the remaining code directly related to derbyTesting.xa.single. This functionality has been replaced with a decorator. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@473079 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/junit/TestConfiguration.java", "hunks": [ { "added": [], "header": "@@ -60,7 +60,6 @@ public class TestConfiguration {", "removed": [ " private final static String KEY_SINGLE_LEG_XA = \"derbyTesting.xa.single\";" ] }, { "added": [], "header": "@@ -114,10 +113,6 @@ public class TestConfiguration {", "removed": [ " ", " // If forced into single leg XA, assume harness", " if (DERBY_HARNESS_CONFIG.isSingleLegXA())", " assumeHarness = true;" ] }, { "added": [ " * and to start the network server at setUp.", " * The previous TestConfiguration is restored at tearDown and", " * the network server is shutdown." ], "header": "@@ -222,13 +217,13 @@ public class TestConfiguration {", "removed": [ " * and to start the network server at setUp if it is not", " * already started.", " * The previous TestConfiguration is restored at tearDown." ] }, { "added": [ " Test test = new NetworkServerTestSetup(suite, false);" ], "header": "@@ -243,7 +238,7 @@ public class TestConfiguration {", "removed": [ " Test test = new NetworkServerTestSetup(suite);" ] }, { "added": [], "header": "@@ -373,7 +368,6 @@ public class TestConfiguration {", "removed": [ " this.singleLegXA = false;" ] }, { "added": [], "header": "@@ -389,7 +383,6 @@ public class TestConfiguration {", "removed": [ " this.singleLegXA = copy.singleLegXA;" ] }, { "added": [], "header": "@@ -414,7 +407,6 @@ public class TestConfiguration {", "removed": [ " this.singleLegXA = copy.singleLegXA;" ] }, { "added": [], "header": "@@ -436,7 +428,6 @@ public class TestConfiguration {", "removed": [ " this.singleLegXA = copy.singleLegXA;" ] }, { "added": [], "header": "@@ -461,8 +452,6 @@ public class TestConfiguration {", "removed": [ " singleLegXA = Boolean.valueOf(props.getProperty(KEY_SINGLE_LEG_XA)", " ).booleanValue();" ] }, { "added": [ " String url;", " url = jdbcClient.getUrlBase();", " url = jdbcClient.getUrlBase() + hostName + \":\" + port + \"/\";", " return url.concat(name);" ], "header": "@@ -512,11 +501,13 @@ public class TestConfiguration {", "removed": [ " return jdbcClient.getUrlBase() + name;", " return jdbcClient.getUrlBase() + hostName + \":\" + port + \"/\" + name;" ] }, { "added": [ " {" ], "header": "@@ -660,19 +651,12 @@ public class TestConfiguration {", "removed": [ " if (!isSingleLegXA()) {", " else {", " Properties attrs = ", " \tgetDataSourcePropertiesForDatabase(databaseName, connAttrs);", " con = TestDataSourceFactory.getXADataSource(attrs).", " getXAConnection (getUserName(), ", " getUserPassword()).getConnection();", " }" ] }, { "added": [ " * This method can only be called when the engine", " * is running embedded in this JVM." ], "header": "@@ -699,6 +683,8 @@ public class TestConfiguration {", "removed": [] }, { "added": [], "header": "@@ -747,14 +733,6 @@ public class TestConfiguration {", "removed": [ "", " /**", " * Return if it has to run under single legged xa transaction", " * @return singleLegXA", " */", " public boolean isSingleLegXA () {", " return singleLegXA;", " }" ] }, { "added": [], "header": "@@ -822,7 +800,6 @@ public class TestConfiguration {", "removed": [ " private final boolean singleLegXA;" ] } ] } ]
derby-DERBY-1952-4f1a9939
DERBY-1952 (partial) Add a top-level encryption suite EncryptionSuite that runs a set of tests in encrypted databases with different algorithms. A replacement mechanism for the encrypted suite in the old harness. Only includes a single test at the moment, since that is the only converted test that run under the old harness with encrpytion. EncryptionSuite is not added to suites.All as I'd like to see some more testing on other platforms before enabling for all. Added the encryptedDatabase decorators to a new class junit.Decorator to stop TestConfiguration becoming clogged with decorators. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@502400 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/junit/Decorator.java", "hunks": [ { "added": [ "/*", "", " Derby - Class org.apache.derbyTesting.junit.Decorator", "", " Licensed to the Apache Software Foundation (ASF) under one or more", " contributor license agreements. See the NOTICE file distributed with", " this work for additional information regarding copyright ownership.", " The ASF licenses this file to you under the Apache License, Version 2.0", " (the \"License\"); you may not use this file except in compliance with", " the License. You may obtain a copy of the License at", "", " http://www.apache.org/licenses/LICENSE-2.0", "", " Unless required by applicable law or agreed to in writing, software", " distributed under the License is distributed on an \"AS IS\" BASIS,", " WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", " See the License for the specific language governing permissions and", " limitations under the License.", "", " */", "package org.apache.derbyTesting.junit;", "", "import java.sql.SQLException;", "import java.util.Random;", "", "import javax.sql.DataSource;", "", "import junit.extensions.TestSetup;", "import junit.framework.Test;", "", "/**", " * Utility class that provides static methods to decorate tests.", " * Used as a central collection point for decorators than cannot", " * be simply expressed as a TestSetup class. Typically the", " * decorators will be collections of other decorators", " */", "public class Decorator {", "", " private Decorator() {", " super();", " }", "", " /**", " * Decorate a set of tests to use an encrypted", " * single use database. This is to run tests", " * using encrpyption as a general test and", " * not specific tests of how encryption is handled.", " * E.g. tests of setting various URL attributes", " * would be handled in a specific test.", " * <BR>", " * The database will use the default encryption", " * algorithm.", " * <BR>", " * A boot password (phrase) is used with a random", " * set of characters and digits 16 characters long.", " * <BR>", " * The database is created during the setUp of the decorator.", " * ", " * @param test test to decorate", " * @return decorated tests", " */", " public static Test encryptedDatabase(Test test)", " {", " test = new TestSetup(test) {", " ", " /**", " * Create an encrypted database using a", " * JDBC data source.", " */", " protected void setUp() throws SQLException", " {", " String bootPhrase = getBootPhrase(16);", "", " DataSource ds = JDBCDataSource.getDataSource();", " ", " JDBCDataSource.setBeanProperty(ds,", " \"createDatabase\", \"create\");", " JDBCDataSource.setBeanProperty(ds,", " \"connectionAttributes\",", " \"dataEncryption=true;bootPassword=\" + bootPhrase);", " ", " ds.getConnection().close();", " }", " };", " ", " return TestConfiguration.singleUseDatabaseDecorator(test);", " }", " ", " /**", " * Decorate a set of tests to use an encrypted", " * single use database. This is to run tests", " * using encrpyption as a general test and", " * not specific tests of how encryption is handled.", " * E.g. tests of setting various URL attributes", " * would be handled in a specific test.", " * <BR>", " * The database will use the specified encryption", " * algorithm.", " * <BR>", " * A boot password (phrase) is used with a random", " * set of characters and digits 64 characters long.", " * <BR>", " * The database is created during the setUp of the decorator.", "", " * ", " * @param test test to decorate", " * @return decorated tests", " */", " public static Test encryptedDatabase(Test test, final String algorithm)", " {", " test = new TestSetup(test) {", " ", " /**", " * Create an encrypted database using a", " * JDBC data source.", " */", " protected void setUp() throws SQLException", " {", " String bootPhrase = getBootPhrase(64);", " DataSource ds = JDBCDataSource.getDataSource();", " ", " JDBCDataSource.setBeanProperty(ds,", " \"createDatabase\", \"create\");", " JDBCDataSource.setBeanProperty(ds,", " \"connectionAttributes\",", " \"dataEncryption=true;bootPassword=\" + bootPhrase +", " \";encryptionAlgorithm=\" + algorithm);", " ", " ds.getConnection().close();", " }", " };", " ", " return TestConfiguration.singleUseDatabaseDecorator(test);", " }", " ", " private static String getBootPhrase(int length)", " {", " Random rand = new Random();", " ", " char[] bp = new char[length];", " for (int i = 0; i < bp.length; ) {", " char c = (char) rand.nextInt();", " if (Character.isLetterOrDigit(c))", " {", " bp[i++] = c;", " }", " }", " ", " return new String(bp);", " }", "}" ], "header": "@@ -0,0 +1,151 @@", "removed": [] } ] } ]
derby-DERBY-1952-76da2f37
DERBY-1952 (partial) Add a test case to the AutoloadTest that sees if when auto-loading the embedded driver via jdbc.drivers the network server is booted correctly depending on the state of the property derby.drda.startNetworkServer. Make the ping network server method in NetworkServerSetup more useful by splitting it into two, one that pings for 60 seconds and returns if it made contact, and the previous version which 'fails' if contact could not be made. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@497549 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java", "hunks": [ { "added": [ " throws InterruptedException ", " {", " if (!pingForServerStart(networkServerController))", " fail(\"Timed out waiting for network server to start\");", " }", " ", " /**", " * Ping server for upto sixty seconds. If the server responds", " * in that time then return true, otherwise return false.", " * ", " */", " public static boolean pingForServerStart(NetworkServerControl networkServerController)", " throws InterruptedException", " {", " return true;", " return false;" ], "header": "@@ -166,17 +166,29 @@ final public class NetworkServerTestSetup extends TestSetup {", "removed": [ " throws InterruptedException {", " break;", " e.printStackTrace();", " fail(\"Timed out waiting for network server to start\");" ] } ] } ]
derby-DERBY-1952-81450898
DERBY-1952 (partial) Add some junit test cases that are wrappers around jdbcapi.autoloadTest that set jdbc.drivers as a System property before running jdbcapi.autoloadTest fixtures. These tests are intended only to be run standalone, ie a single run on one test class in a jvm, as they test autoloading of Derby's drivers by the DriverManager class. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@495704 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-1952-8c9e99ff
DERBY-1952 Remove the jdbc4/AutoloadBooting.test as the final JUnit test run as a '.junit' test through the old harness. Test has been replaced by the generic jdbcapi.AutoloadTest and its siblings. The variants of the autoload tests are run through the ant junit target as they require a clean jvm. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@545334 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-1952-985662bc
DERBY-1952 (partial) DERBY-1971 (partial) Change more of the tests run from jdbcapi._Suite to return suites that run in embedded and client as primary configurations. Name some of the TestSuites returned from TestConfiguration to make the hierarchy view in the Swing Test Runner more useful. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@464999 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/junit/TestConfiguration.java", "hunks": [ { "added": [ " final TestSuite suite = new TestSuite(suiteName(testClass));" ], "header": "@@ -169,7 +169,7 @@ public class TestConfiguration {", "removed": [ " final TestSuite suite = new TestSuite();" ] }, { "added": [ " /**", " * Generate a suite name from a class name, taking", " * only the last element of the fully qualified class name.", " */", " private static String suiteName(Class testClass)", " {", " int lastDot = testClass.getName().lastIndexOf('.');", " String suiteName = testClass.getName();", " if (lastDot != -1)", " suiteName = suiteName.substring(lastDot + 1, suiteName.length());", " ", " return suiteName;", " }", " " ], "header": "@@ -177,6 +177,20 @@ public class TestConfiguration {", "removed": [] }, { "added": [ " return new TestSuite(testClass,", " suiteName(testClass)+\":embedded\");" ], "header": "@@ -184,7 +198,8 @@ public class TestConfiguration {", "removed": [ " return new TestSuite(testClass);" ] }, { "added": [ " TestSuite suite = new TestSuite(testClass,", " suiteName(testClass)+\":client\");" ], "header": "@@ -196,7 +211,8 @@ public class TestConfiguration {", "removed": [ " TestSuite suite = new TestSuite(testClass);" ] } ] } ]
derby-DERBY-1952-987f4fd7
DERBY-1952 Add a check to the AutoloadTest that indicates in a somewhat non-internal way that Derby's embedded engine was actually booted in not. Will replace the use of internal apis and checking for a NPE in the jdbc4 version of the test. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@545332 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-1952-9f5c33fc
DERBY-1952 (partial) Refactor VerifySignatures to run as a single test case per configuration and thus not rely on the old test harness. Added the test to jdbc4._Suite and removed from the old jdbc40 harness suite. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@495318 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-1952-9f608bd0
DERBY-1952 (partial) Copy & refactor AutoloadTest as jdbcapi.AutoloadTest as it can be used on non-JDBC 4 environments as long as it is not compiled using Java SE 6. Split into a number of test cases including one to ensure the junit setup is not autoloading the test (thus potentially hiding real issues) when autoloading is not enabled. Test runs successfully without the old harness but not yet added to any ant target as it needs to set the property jdbc.drivers for effective testing. The jdbc4 version is not removed until this version is running as part of the ant targets. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@495364 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-1952-b1c5200c
DERBY-1952 DERBY-2047 Convert store/BootAllTest to run as a standard JUNit test and not within the harness. Added a store._Suite and hooked it into the suites.All and the ant junit-all target. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@473175 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/junit/DropDatabaseSetup.java", "hunks": [ { "added": [ "class DropDatabaseSetup extends BaseJDBCTestSetup {" ], "header": "@@ -30,7 +30,7 @@ import junit.framework.Test;", "removed": [ "class DropDatabaseSetup extends TestSetup {" ] }, { "added": [ " protected void tearDown() throws Exception {", " ", " // Ensure the database is booted", " // since that is what shutdownDatabase() requires.", " getConnection().close();" ], "header": "@@ -39,7 +39,11 @@ class DropDatabaseSetup extends TestSetup {", "removed": [ " protected void tearDown() throws Exception { " ] } ] } ]
derby-DERBY-1952-c40688b6
DERBY-1952 (partial) Setup methods in TestConfiguration to allow tests' suite() methods to add tests that run in the client/server configuration. Change TimeHandlingTest and LangScripts to use these methods so that by themselves they run embedded and network server tests. Remove the Client and Embedded top-level suites as that choice is now driven into a test itself. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@464607 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/junit/TestConfiguration.java", "hunks": [ { "added": [ "import junit.framework.TestSuite;" ], "header": "@@ -29,6 +29,7 @@ import java.util.Properties;", "removed": [] }, { "added": [ " // If forced into single leg XA, assume harness", " if (DERBY_HARNESS_CONFIG.isSingleLegXA())", " assumeHarness = true;" ], "header": "@@ -110,8 +111,9 @@ public class TestConfiguration {", "removed": [ " // for now always assume harness - still testing this code", " assumeHarness = true;" ] }, { "added": [ " public static Test derbyClientServerDecorator(Class suiteClass)", " { ", " return derbyClientServerDecorator(new TestSuite(suiteClass));", " }", " /**", " * Return a decorator for the passed in tests that sets the", " * configuration for the client to be Derby's JDBC client", " * and to start the network server at setUp if it is not", " * already started.", " * <BR>", " * The database configuration (name etc.) is based upon", " * the previous configuration.", " * <BR>", " * The previous TestConfiguration is restored at tearDown.", " * @param tests", " * @return", " */", " public static Test derbyClientServerDecorator(Test suite)", " if (JDBC.vmSupportsJSR169())", " return new TestSuite();", " ", " ", " Test test = new NetworkServerTestSetup(suite);" ], "header": "@@ -165,33 +167,40 @@ public class TestConfiguration {", "removed": [ " * @throws Exception ", " public static Test derbyClientServerDecorator(Class suite) throws Exception", " ", " TestConfiguration.setCurrent(derbyClientConfig);", " ", " Test test = addSuiteByReflection(suite);", " ", " TestConfiguration.setCurrent(config);", " ", " test = new NetworkServerTestSetup(test);", " private static Test addSuiteByReflection(Class clz) throws Exception", " {", " Method sm = clz.getMethod(\"suite\", null);", " ", " return (Test) sm.invoke(null, null);", " } " ] } ] } ]
derby-DERBY-1952-c7641f3c
DERBY-1952 (partial) Minor refactoring of jdbc4.VerifySignatures test to make the checks in the current MethodTestCase use a static method in the parent class. This is just to set up for the next step where checking will occur without a test case per method. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@495301 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-1952-eba07fcf
DERBY-1952 (partial) Add some utility methods in TestConfiguration to allow test classes to easily implement suite() methods that run in embedded and/or client server. Convert some tests to use these utility methods. Change NetworkServerTestSetup to create a server console output file in the logs folder in append mode. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@464785 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java", "hunks": [ { "added": [ "import java.io.File;" ], "header": "@@ -21,6 +21,7 @@ package org.apache.derbyTesting.junit;", "removed": [] }, { "added": [ " File logs = new File(\"logs\");", " logs.mkdir();", " File console = new File(logs, \"serverConsoleOutput.log\");", " fos = new FileOutputStream(console.getPath(), true);" ], "header": "@@ -58,18 +59,18 @@ final public class NetworkServerTestSetup extends TestSetup {", "removed": [ " if (!config.getJDBCClient().isEmbedded()) {", " String fileName = System.getProperty(\"derby.system.home\") + ", " \"serverConsoleOutput.log\";", " fos = (new FileOutputStream(fileName));" ] } ] }, { "file": "java/testing/org/apache/derbyTesting/junit/TestConfiguration.java", "hunks": [ { "added": [ " ", " ", " * Return a Test suite that contains all the text fixtures", " * for the passed in class running in embedded and the", " * default client server configuration.", " * The complete set of embedded and set of client server tests", " * is decorated with a CleanDatabaseTestSetup.", " * The client server configuration is setup using clientServerSuite", " public static Test defaultSuite(Class testClass)", " {", " final TestSuite suite = new TestSuite();", " ", " suite.addTest(embeddedSuite(testClass)); ", " suite.addTest(clientServerSuite(testClass));", " ", " return new CleanDatabaseTestSetup(suite);", " }", " ", " /**", " * Create a suite for the passed test class that includes", " * all the default fixtures from the class, wrapped", " * in a single CleanDatabaseTestSetup.", " */", " public static Test embeddedSuite(Class testClass)", " {", " return new TestSuite(testClass);", " }", " ", " /**", " * Create a suite for the passed test class that includes", " * all the default fixtures from the class, wrapped in", " * a derbyClientServerDecorator.", " * ", " * @param withCleanDB True if the ", " */", " public static Test clientServerSuite(Class testClass)", " TestSuite suite = new TestSuite(testClass);", " return clientServerDecorator(suite);" ], "header": "@@ -155,22 +155,49 @@ public class TestConfiguration {", "removed": [ " * Return a decorator for the passed in tests that sets the", " * configuration for the client to be Derby's JDBC client", " * and to start the network server at setUp and shut it", " * down at tearDown.", " * The database configuration (name etc.) is based upon", " * the previous configuration.", " * The previous TestConfiguration is restored at tearDown.", " * @param tests", " * @return", " public static Test derbyClientServerDecorator(Class suiteClass)", " return derbyClientServerDecorator(new TestSuite(suiteClass));" ] }, { "added": [ " public static Test clientServerDecorator(Test suite)" ], "header": "@@ -185,7 +212,7 @@ public class TestConfiguration {", "removed": [ " public static Test derbyClientServerDecorator(Test suite)" ] } ] } ]
derby-DERBY-1952-ee7f6684
DERBY-2047 DERBY-1952 (partial) Implement the ability to run with the default connction coming from an XADataSource as a decorator via the utility method TestConfiguration.connectionXADecorator. This will replace the functionality driven by the property derbyTesting.xa.single. Improved jdbc4.ConnectionTest and PreparedStatementTest to also run their test fixtures with this XA decorator. This will replace the old harness suite jdbcxa40 which does not seem to be part of derbyall but the new runs are part of jdbc4._Suite. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@472722 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/junit/TestConfiguration.java", "hunks": [ { "added": [ " /**", " * Return a decorator that changes the configuration to obtain", " * connections from an XADataSource using", " * <code>", " * getXAConnection().getConnection()", " * </code>", " * The connection is not connected to any global transaction,", " * thus it is in local connection mode.", " * The tearDown reverts the configuration to the previous", " * configuration.", " */", " public static Test connectionXADecorator(Test test)", " {", " // Copy the current configuration by creating one", " // with the same database name", " TestConfiguration config = TestConfiguration.getCurrent();", " TestConfiguration newConfig = ", " new TestConfiguration(config, config.getDatabaseName());", " ", " try {", " newConfig.connector = (Connector) Class.forName(", " \"org.apache.derbyTesting.junit.XADataSourceConnector\").newInstance();", " } catch (Exception e) {", " Assert.fail(e.getMessage());", " }", " ", " newConfig.connector.setConfiguration(newConfig);", " ", " return new ChangeConfigurationSetup(newConfig, test);", " }", " " ], "header": "@@ -332,6 +332,37 @@ public class TestConfiguration {", "removed": [] } ] }, { "file": "java/testing/org/apache/derbyTesting/junit/XADataSourceConnector.java", "hunks": [ { "added": [ "/*", " *", " * Derby - Class org.apache.derbyTesting.junit.XADataSourceConnector", " *", " * Licensed to the Apache Software Foundation (ASF) under one or more", " * contributor license agreements. See the NOTICE file distributed with", " * this work for additional information regarding copyright ownership.", " * The ASF licenses this file to You under the Apache License, Version 2.0", " * (the \"License\"); you may not use this file except in compliance with", " * the License. You may obtain a copy of the License at", " *", " * http://www.apache.org/licenses/LICENSE-2.0", " *", " * Unless required by applicable law or agreed to in writing, ", " * software distributed under the License is distributed on an ", " * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, ", " * either express or implied. See the License for the specific ", " * language governing permissions and limitations under the License.", " */", "package org.apache.derbyTesting.junit;", "", "import java.sql.Connection;", "import java.sql.SQLException;", "import java.util.HashMap;", "", "import javax.sql.XADataSource;", "", "import junit.framework.Assert;", "", "/**", " * Connection factory using javax.sql.XADataSource.", " * Returns a connection in local mode obtained from", " * getXAConnection().getConnection().", " *", " */", "public class XADataSourceConnector implements Connector {", " ", " private TestConfiguration config;", " /**", " * DataSource that maps to the database for the", " * configuration. The no-arg getXAConnection() method", " * maps to the default user and password for the", " * configuration.", " */", " private XADataSource ds;", "", " public void setConfiguration(TestConfiguration config) {", " ", " this.config = config;", " ds = J2EEDataSource.getXADataSource(config, (HashMap) null);", " }", "", " public Connection openConnection() throws SQLException {", " try {", " return ds.getXAConnection().getConnection();", " } catch (SQLException e) {", " // Expected state for database not found.", " // For the client the generic 08004 is returned,", " // will just retry on that.", " String expectedState = ", " config.getJDBCClient().isEmbedded() ? \"XJ004\" : \"08004\";", "", " // If there is a database not found exception", " // then retry the connection request with", " // a new DataSource with the createDtabase property set.", " if (!expectedState.equals(e.getSQLState()))", " throw e;", " return singleUseDS(\"createDatabase\", \"create\").", " getXAConnection().getConnection(); ", " }", " }", "", " public Connection openConnection(String user, String password)", " throws SQLException {", " try {", " return ds.getXAConnection(user, password).getConnection();", " } catch (SQLException e) {", " // If there is a database not found exception", " // then retry the connection request with", " // a new DataSource with the createDatabase property set.", " if (!\"XJ004\".equals(e.getSQLState()))", " throw e;", " return singleUseDS(\"createDatabase\", \"create\").", " getXAConnection(user, password).getConnection(); ", " }", " }", "", " public void shutDatabase() throws SQLException {", " singleUseDS(\"shutdownDatabase\", \"shutdown\").getXAConnection().getConnection(); ", " }", "", " public void shutEngine() throws SQLException {", " Assert.fail(\"shutdown engine not implemened\");", " }", " ", " /**", " * Get a connection from a single use XADataSource configured", " * from the configuration but with the passed in property set.", " */", " private XADataSource singleUseDS(String property, String value)", " throws SQLException {", " HashMap hm = JDBCDataSource.getDataSourceProperties(config);", " hm.put(property, value);", " XADataSource sds = J2EEDataSource.getXADataSource(config, hm);", " return sds;", " }", "", "}" ], "header": "@@ -0,0 +1,108 @@", "removed": [] } ] } ]
derby-DERBY-1952-f2e3e690
DERBY-1952 (partial) Ensure fixtures in jdbcapi.AutoloadTest are ordered and add a fixture to test that explicitly loading Derby's JDBC driver works when auto-loading is enabled. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@495603 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-1953-5e4e33b5
DERBY-1953 Test changes. MODE DB2SQL removed from most tests git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@469102 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/tools/org/apache/derby/impl/tools/dblook/DB_Trigger.java", "hunks": [ { "added": [], "header": "@@ -176,9 +176,6 @@ public class DB_Trigger {", "removed": [ "\t\t// DB2 requires the following keywords in order to work.", "\t\tsb.append(\"MODE DB2SQL \");", "" ] } ] } ]
derby-DERBY-1956-960054b0
DERBY-1956: Remove stale code from the statement classes in the client driver The patch removes escapedProcedureCallWithResult_ and all code that is only executed when the flag is true. It also removes a couple of methods that became no-ops, and SQLStates and messages that are never used. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@463565 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/client/org/apache/derby/client/am/CallableStatement.java", "hunks": [ { "added": [], "header": "@@ -162,7 +162,6 @@ public class CallableStatement extends PreparedStatement", "removed": [ " parameterIndex = checkForEscapedCallWithResult(parameterIndex);" ] }, { "added": [], "header": "@@ -189,11 +188,6 @@ public class CallableStatement extends PreparedStatement", "removed": [ " parameterIndex = checkForEscapedCallWithResult(parameterIndex, jdbcType);", " // if the parameter is the return clause of the call statement", " if (parameterIndex == 0 && escapedProcedureCallWithResult_) {", " return;", " }" ] }, { "added": [], "header": "@@ -245,16 +239,7 @@ public class CallableStatement extends PreparedStatement", "removed": [ " parameterIndex = checkForEscapedCallWithResult(parameterIndex);", " if (parameterIndex == 0 && escapedProcedureCallWithResult_) {", " result = agent_.crossConverters_.getBooleanFromInt(returnValueFromProcedure_);", " this.wasNull_ = this.WAS_NOT_NULL;", " if (agent_.loggingEnabled()) {", " agent_.logWriter_.traceExit(this, \"getBoolean\", result);", " }", " return result;", " }" ] }, { "added": [], "header": "@@ -278,16 +263,7 @@ public class CallableStatement extends PreparedStatement", "removed": [ " parameterIndex = checkForEscapedCallWithResult(parameterIndex);", " if (parameterIndex == 0 && escapedProcedureCallWithResult_) {", " result = agent_.crossConverters_.getByteFromInt(returnValueFromProcedure_);", " this.wasNull_ = this.WAS_NOT_NULL;", " if (agent_.loggingEnabled()) {", " agent_.logWriter_.traceExit(this, \"getByte\", result);", " }", " return result;", " }" ] }, { "added": [], "header": "@@ -311,16 +287,7 @@ public class CallableStatement extends PreparedStatement", "removed": [ " parameterIndex = checkForEscapedCallWithResult(parameterIndex);", " if (parameterIndex == 0 && escapedProcedureCallWithResult_) {", " result = agent_.crossConverters_.getShortFromInt(returnValueFromProcedure_);", " this.wasNull_ = this.WAS_NOT_NULL;", " if (agent_.loggingEnabled()) {", " agent_.logWriter_.traceExit(this, \"getShort\", result);", " }", " return result;", " }" ] }, { "added": [], "header": "@@ -359,11 +326,6 @@ public class CallableStatement extends PreparedStatement", "removed": [ " parameterIndex = checkForEscapedCallWithResult(parameterIndex);", " if (parameterIndex == 0 && escapedProcedureCallWithResult_) {", " this.wasNull_ = this.WAS_NOT_NULL;", " return returnValueFromProcedure_;", " }" ] }, { "added": [], "header": "@@ -377,16 +339,7 @@ public class CallableStatement extends PreparedStatement", "removed": [ " parameterIndex = checkForEscapedCallWithResult(parameterIndex);", " if (parameterIndex == 0 && escapedProcedureCallWithResult_) {", " result = (long) returnValueFromProcedure_;", " this.wasNull_ = this.WAS_NOT_NULL;", " if (agent_.loggingEnabled()) {", " agent_.logWriter_.traceExit(this, \"getLong\", result);", " }", " return result;", " }" ] }, { "added": [], "header": "@@ -410,16 +363,7 @@ public class CallableStatement extends PreparedStatement", "removed": [ " parameterIndex = checkForEscapedCallWithResult(parameterIndex);", " if (parameterIndex == 0 && escapedProcedureCallWithResult_) {", " result = (float) returnValueFromProcedure_;", " this.wasNull_ = this.WAS_NOT_NULL;", " if (agent_.loggingEnabled()) {", " agent_.logWriter_.traceExit(this, \"getFloat\", result);", " }", " return result;", " }" ] }, { "added": [], "header": "@@ -443,16 +387,7 @@ public class CallableStatement extends PreparedStatement", "removed": [ " parameterIndex = checkForEscapedCallWithResult(parameterIndex);", " if (parameterIndex == 0 && escapedProcedureCallWithResult_) {", " result = (double) returnValueFromProcedure_;", " this.wasNull_ = this.WAS_NOT_NULL;", " if (agent_.loggingEnabled()) {", " agent_.logWriter_.traceExit(this, \"getDouble\", result);", " }", " return result;", " }" ] }, { "added": [], "header": "@@ -477,16 +412,7 @@ public class CallableStatement extends PreparedStatement", "removed": [ " parameterIndex = checkForEscapedCallWithResult(parameterIndex);", " if (parameterIndex == 0 && escapedProcedureCallWithResult_) {", " result = java.math.BigDecimal.valueOf(returnValueFromProcedure_).setScale(scale);", " this.wasNull_ = this.WAS_NOT_NULL;", " if (agent_.loggingEnabled()) {", " agent_.logWriter_.traceDeprecatedExit(this, \"getBigDecimal\", result);", " }", " return result;", " }" ] }, { "added": [], "header": "@@ -513,16 +439,7 @@ public class CallableStatement extends PreparedStatement", "removed": [ " parameterIndex = checkForEscapedCallWithResult(parameterIndex);", " if (parameterIndex == 0 && escapedProcedureCallWithResult_) {", " result = java.math.BigDecimal.valueOf(returnValueFromProcedure_);", " this.wasNull_ = this.WAS_NOT_NULL;", " if (agent_.loggingEnabled()) {", " agent_.logWriter_.traceExit(this, \"getBigDecimal\", result);", " }", " return result;", " }" ] }, { "added": [], "header": "@@ -546,11 +463,6 @@ public class CallableStatement extends PreparedStatement", "removed": [ " parameterIndex = checkForEscapedCallWithResult(parameterIndex);", " if (parameterIndex == 0 && escapedProcedureCallWithResult_) {", " throw new SqlException(agent_.logWriter_, ", " new ClientMessageId(SQLState.INVALID_PARAM_USE_GETINT));", " }" ] }, { "added": [], "header": "@@ -604,11 +516,6 @@ public class CallableStatement extends PreparedStatement", "removed": [ " parameterIndex = checkForEscapedCallWithResult(parameterIndex);", " if (parameterIndex == 0 && escapedProcedureCallWithResult_) {", " throw new SqlException(agent_.logWriter_, ", " new ClientMessageId(SQLState.INVALID_PARAM_USE_GETINT));", " }" ] }, { "added": [], "header": "@@ -661,11 +568,6 @@ public class CallableStatement extends PreparedStatement", "removed": [ " parameterIndex = checkForEscapedCallWithResult(parameterIndex);", " if (parameterIndex == 0 && escapedProcedureCallWithResult_) {", " throw new SqlException(agent_.logWriter_, ", " new ClientMessageId(SQLState.INVALID_PARAM_USE_GETINT));", " }" ] }, { "added": [], "header": "@@ -735,11 +637,6 @@ public class CallableStatement extends PreparedStatement", "removed": [ " parameterIndex = checkForEscapedCallWithResult(parameterIndex);", " if (parameterIndex == 0 && escapedProcedureCallWithResult_) {", " this.wasNull_ = this.WAS_NOT_NULL;", " return Integer.toString(returnValueFromProcedure_);", " }" ] }, { "added": [], "header": "@@ -753,11 +650,6 @@ public class CallableStatement extends PreparedStatement", "removed": [ " parameterIndex = checkForEscapedCallWithResult(parameterIndex);", " if (parameterIndex == 0 && escapedProcedureCallWithResult_) {", " throw new SqlException(agent_.logWriter_, ", " new ClientMessageId(SQLState.INVALID_PARAM_USE_GETINT));", " }" ] }, { "added": [], "header": "@@ -781,11 +673,6 @@ public class CallableStatement extends PreparedStatement", "removed": [ " parameterIndex = checkForEscapedCallWithResult(parameterIndex);", " if (parameterIndex == 0 && escapedProcedureCallWithResult_) {", " throw new SqlException(agent_.logWriter_, ", " new ClientMessageId(SQLState.INVALID_PARAM_USE_GETINT));", " }" ] }, { "added": [], "header": "@@ -806,11 +693,6 @@ public class CallableStatement extends PreparedStatement", "removed": [ " parameterIndex = checkForEscapedCallWithResult(parameterIndex);", " if (parameterIndex == 0 && escapedProcedureCallWithResult_) {", " throw new SqlException(agent_.logWriter_, ", " new ClientMessageId(SQLState.INVALID_PARAM_USE_GETINT));", " }" ] }, { "added": [], "header": "@@ -834,11 +716,6 @@ public class CallableStatement extends PreparedStatement", "removed": [ " parameterIndex = checkForEscapedCallWithResult(parameterIndex);", " if (parameterIndex == 0 && escapedProcedureCallWithResult_) {", " throw new SqlException(agent_.logWriter_, ", " new ClientMessageId(SQLState.INVALID_PARAM_USE_GETINT)); ", " }" ] }, { "added": [], "header": "@@ -866,11 +743,6 @@ public class CallableStatement extends PreparedStatement", "removed": [ " parameterIndex = checkForEscapedCallWithResult(parameterIndex);", " if (parameterIndex == 0 && escapedProcedureCallWithResult_) {", " throw new SqlException(agent_.logWriter_, ", " new ClientMessageId(SQLState.INVALID_PARAM_USE_GETINT));", " }" ] }, { "added": [], "header": "@@ -898,16 +770,7 @@ public class CallableStatement extends PreparedStatement", "removed": [ " parameterIndex = checkForEscapedCallWithResult(parameterIndex);", " if (parameterIndex == 0 && escapedProcedureCallWithResult_) {", " result = new Integer(returnValueFromProcedure_);", " this.wasNull_ = this.WAS_NOT_NULL;", " if (agent_.loggingEnabled()) {", " agent_.logWriter_.traceExit(this, \"getObject\", result);", " }", " return result;", " }" ] }, { "added": [], "header": "@@ -931,7 +794,6 @@ public class CallableStatement extends PreparedStatement", "removed": [ " parameterIndex = checkForEscapedCallWithResult(parameterIndex);" ] }, { "added": [], "header": "@@ -1326,7 +1188,6 @@ public class CallableStatement extends PreparedStatement", "removed": [ " parameterIndex = checkForEscapedCallWithResult(parameterIndex);" ] } ] }, { "file": "java/client/org/apache/derby/client/am/ParameterMetaData.java", "hunks": [ { "added": [], "header": "@@ -33,59 +33,29 @@ import java.sql.SQLException;", "removed": [ " // This is false unless for parameterMetaData for a call statement with return clause", " boolean escapedProcedureCallWithResult_ = false;", "", " if (escapedProcedureCallWithResult_) {", " return columnMetaData_.columns_++;", " }", " if (escapedProcedureCallWithResult_) {", " param--;", " if (param == 0) {", " return java.sql.Types.INTEGER;", " }", " }", " if (escapedProcedureCallWithResult_) {", " param--;", " if (param == 0) {", " return \"INTEGER\";", " }", " }", " if (escapedProcedureCallWithResult_) {", " param--;", " if (param == 0) {", " return \"java.lang.Integer\";", " }", " }", " if (escapedProcedureCallWithResult_) {", " param--;", " if (param == 0) {", " return java.sql.ParameterMetaData.parameterModeOut;", " }", " }" ] } ] }, { "file": "java/client/org/apache/derby/client/am/PreparedStatement.java", "hunks": [ { "added": [ " getColumnMetaDataX().getColumnType(parameterIndex);" ], "header": "@@ -414,7 +414,7 @@ public class PreparedStatement extends Statement", "removed": [ " getColumnMetaDataX().getColumnType( checkForEscapedCallWithResult(parameterIndex) ) ;" ] }, { "added": [], "header": "@@ -436,7 +436,6 @@ public class PreparedStatement extends Statement", "removed": [ " parameterIndex = checkForEscapedCallWithResult(parameterIndex);" ] }, { "added": [ " getColumnMetaDataX().getColumnType(parameterIndex);" ], "header": "@@ -466,7 +465,7 @@ public class PreparedStatement extends Statement", "removed": [ " getColumnMetaDataX().getColumnType( checkForEscapedCallWithResult( parameterIndex ) );" ] }, { "added": [], "header": "@@ -476,7 +475,6 @@ public class PreparedStatement extends Statement", "removed": [ " parameterIndex = checkForEscapedCallWithResult(parameterIndex);" ] }, { "added": [ " getColumnMetaDataX().getColumnType(parameterIndex);" ], "header": "@@ -496,7 +494,7 @@ public class PreparedStatement extends Statement", "removed": [ " getColumnMetaDataX().getColumnType( checkForEscapedCallWithResult( parameterIndex ) );" ] }, { "added": [], "header": "@@ -506,7 +504,6 @@ public class PreparedStatement extends Statement", "removed": [ " parameterIndex = checkForEscapedCallWithResult(parameterIndex);" ] }, { "added": [ " getColumnMetaDataX().getColumnType(parameterIndex);" ], "header": "@@ -526,7 +523,7 @@ public class PreparedStatement extends Statement", "removed": [ " getColumnMetaDataX().getColumnType( checkForEscapedCallWithResult( parameterIndex ) );" ] }, { "added": [], "header": "@@ -548,7 +545,6 @@ public class PreparedStatement extends Statement", "removed": [ " parameterIndex = checkForEscapedCallWithResult(parameterIndex);" ] }, { "added": [ " getColumnMetaDataX().getColumnType(parameterIndex);" ], "header": "@@ -563,7 +559,7 @@ public class PreparedStatement extends Statement", "removed": [ " getColumnMetaDataX().getColumnType( checkForEscapedCallWithResult( parameterIndex ) );" ] }, { "added": [], "header": "@@ -583,7 +579,6 @@ public class PreparedStatement extends Statement", "removed": [ " parameterIndex = checkForEscapedCallWithResult(parameterIndex);" ] }, { "added": [ " getColumnMetaDataX().getColumnType(parameterIndex);" ], "header": "@@ -598,7 +593,7 @@ public class PreparedStatement extends Statement", "removed": [ " getColumnMetaDataX().getColumnType( checkForEscapedCallWithResult( parameterIndex ) );" ] }, { "added": [], "header": "@@ -607,7 +602,6 @@ public class PreparedStatement extends Statement", "removed": [ " parameterIndex = checkForEscapedCallWithResult(parameterIndex);" ] }, { "added": [ " getColumnMetaDataX().getColumnType(parameterIndex);" ], "header": "@@ -627,7 +621,7 @@ public class PreparedStatement extends Statement", "removed": [ " getColumnMetaDataX().getColumnType( checkForEscapedCallWithResult( parameterIndex ) );" ] }, { "added": [], "header": "@@ -637,7 +631,6 @@ public class PreparedStatement extends Statement", "removed": [ " parameterIndex = checkForEscapedCallWithResult(parameterIndex);" ] }, { "added": [ " getColumnMetaDataX().getColumnType(parameterIndex);" ], "header": "@@ -657,7 +650,7 @@ public class PreparedStatement extends Statement", "removed": [ " getColumnMetaDataX().getColumnType( checkForEscapedCallWithResult( parameterIndex ) );" ] }, { "added": [], "header": "@@ -667,7 +660,6 @@ public class PreparedStatement extends Statement", "removed": [ " parameterIndex = checkForEscapedCallWithResult(parameterIndex);" ] }, { "added": [ " getColumnMetaDataX().getColumnType(parameterIndex);" ], "header": "@@ -687,7 +679,7 @@ public class PreparedStatement extends Statement", "removed": [ " getColumnMetaDataX().getColumnType( checkForEscapedCallWithResult( parameterIndex ) );" ] }, { "added": [], "header": "@@ -697,7 +689,6 @@ public class PreparedStatement extends Statement", "removed": [ " parameterIndex = checkForEscapedCallWithResult(parameterIndex);" ] }, { "added": [ " getColumnMetaDataX().getColumnType(parameterIndex);" ], "header": "@@ -722,7 +713,7 @@ public class PreparedStatement extends Statement", "removed": [ " getColumnMetaDataX().getColumnType( checkForEscapedCallWithResult( parameterIndex ) );" ] }, { "added": [], "header": "@@ -733,7 +724,6 @@ public class PreparedStatement extends Statement", "removed": [ " parameterIndex = checkForEscapedCallWithResult(parameterIndex);" ] }, { "added": [ " getColumnMetaDataX().getColumnType(parameterIndex);" ], "header": "@@ -791,7 +781,7 @@ public class PreparedStatement extends Statement", "removed": [ " getColumnMetaDataX().getColumnType( checkForEscapedCallWithResult( parameterIndex ) );" ] }, { "added": [], "header": "@@ -800,7 +790,6 @@ public class PreparedStatement extends Statement", "removed": [ " parameterIndex = checkForEscapedCallWithResult(parameterIndex);" ] }, { "added": [ " getColumnMetaDataX().getColumnType(parameterIndex);" ], "header": "@@ -859,7 +848,7 @@ public class PreparedStatement extends Statement", "removed": [ " getColumnMetaDataX().getColumnType( checkForEscapedCallWithResult( parameterIndex ) );" ] }, { "added": [], "header": "@@ -869,7 +858,6 @@ public class PreparedStatement extends Statement", "removed": [ " parameterIndex = checkForEscapedCallWithResult(parameterIndex);" ] }, { "added": [ " getColumnMetaDataX().getColumnType(parameterIndex);" ], "header": "@@ -934,7 +922,7 @@ public class PreparedStatement extends Statement", "removed": [ " getColumnMetaDataX().getColumnType( checkForEscapedCallWithResult( parameterIndex ) );" ] }, { "added": [], "header": "@@ -953,7 +941,6 @@ public class PreparedStatement extends Statement", "removed": [ " parameterIndex = checkForEscapedCallWithResult(parameterIndex);" ] }, { "added": [ " getColumnMetaDataX().getColumnType(parameterIndex);" ], "header": "@@ -971,7 +958,7 @@ public class PreparedStatement extends Statement", "removed": [ " getColumnMetaDataX().getColumnType( checkForEscapedCallWithResult( parameterIndex ) );" ] }, { "added": [], "header": "@@ -991,7 +978,6 @@ public class PreparedStatement extends Statement", "removed": [ " parameterIndex = checkForEscapedCallWithResult(parameterIndex);" ] }, { "added": [], "header": "@@ -1054,7 +1040,6 @@ public class PreparedStatement extends Statement", "removed": [ " parameterIndex = checkForEscapedCallWithResult(parameterIndex);" ] }, { "added": [], "header": "@@ -1094,7 +1079,6 @@ public class PreparedStatement extends Statement", "removed": [ " parameterIndex = checkForEscapedCallWithResult(parameterIndex);" ] }, { "added": [ " int paramType = getColumnMetaDataX().getColumnType(parameterIndex);" ], "header": "@@ -1132,8 +1116,7 @@ public class PreparedStatement extends Statement", "removed": [ " int paramType = getColumnMetaDataX().getColumnType(", " checkForEscapedCallWithResult(parameterIndex));" ] }, { "added": [ " int paramType = getColumnMetaDataX().getColumnType(parameterIndex);" ], "header": "@@ -1146,8 +1129,7 @@ public class PreparedStatement extends Statement", "removed": [ " int paramType = getColumnMetaDataX().getColumnType(", " checkForEscapedCallWithResult(parameterIndex));" ] }, { "added": [ " int paramType = getColumnMetaDataX().getColumnType(parameterIndex);" ], "header": "@@ -1158,8 +1140,7 @@ public class PreparedStatement extends Statement", "removed": [ " int paramType = getColumnMetaDataX().getColumnType(", " checkForEscapedCallWithResult(parameterIndex));" ] }, { "added": [ " int paramType = getColumnMetaDataX().getColumnType(parameterIndex);" ], "header": "@@ -1170,8 +1151,7 @@ public class PreparedStatement extends Statement", "removed": [ " int paramType = getColumnMetaDataX().getColumnType(", " checkForEscapedCallWithResult(parameterIndex));" ] }, { "added": [ " int paramType = getColumnMetaDataX().getColumnType(parameterIndex);" ], "header": "@@ -1183,8 +1163,7 @@ public class PreparedStatement extends Statement", "removed": [ " int paramType = getColumnMetaDataX().getColumnType(", " checkForEscapedCallWithResult(parameterIndex));" ] }, { "added": [], "header": "@@ -1242,7 +1221,6 @@ public class PreparedStatement extends Statement", "removed": [ " parameterIndex = checkForEscapedCallWithResult(parameterIndex);" ] }, { "added": [], "header": "@@ -1278,7 +1256,6 @@ public class PreparedStatement extends Statement", "removed": [ " parameterIndex = checkForEscapedCallWithResult(parameterIndex);" ] }, { "added": [], "header": "@@ -1336,7 +1313,6 @@ public class PreparedStatement extends Statement", "removed": [ " parameterIndex = checkForEscapedCallWithResult(parameterIndex);" ] }, { "added": [], "header": "@@ -1364,7 +1340,6 @@ public class PreparedStatement extends Statement", "removed": [ " parameterIndex = checkForEscapedCallWithResult(parameterIndex);" ] }, { "added": [], "header": "@@ -1381,7 +1356,6 @@ public class PreparedStatement extends Statement", "removed": [ " parameterIndex = checkForEscapedCallWithResult(parameterIndex);" ] }, { "added": [], "header": "@@ -1399,7 +1373,6 @@ public class PreparedStatement extends Statement", "removed": [ " parameterIndex = checkForEscapedCallWithResult(parameterIndex);" ] }, { "added": [], "header": "@@ -1509,7 +1482,6 @@ public class PreparedStatement extends Statement", "removed": [ " parameterIndex = checkForEscapedCallWithResult(parameterIndex);" ] }, { "added": [], "header": "@@ -1779,9 +1751,6 @@ public class PreparedStatement extends Statement", "removed": [ " if (escapedProcedureCallWithResult_) {", " pm.escapedProcedureCallWithResult_ = true;", " }" ] }, { "added": [], "header": "@@ -2450,19 +2419,6 @@ public class PreparedStatement extends Statement", "removed": [ "", " private int checkForEscapedCallWithResult(int parameterIndex) throws SqlException {", " if (escapedProcedureCallWithResult_) {", " if (parameterIndex == 1) {", " throw new SqlException(agent_.logWriter_,", " new ClientMessageId(SQLState.LANG_RETURN_OUTPUT_PARAM_CANNOT_BE_SET));", " } else {", " parameterIndex--;", " }", " }", " return parameterIndex;", " }", "" ] } ] }, { "file": "java/client/org/apache/derby/client/am/Statement.java", "hunks": [ { "added": [], "header": "@@ -141,7 +141,6 @@ public class Statement implements java.sql.Statement, StatementCallbackInterface", "removed": [ " boolean escapedProcedureCallWithResult_ = false;" ] } ] }, { "file": "java/shared/org/apache/derby/shared/common/reference/SQLState.java", "hunks": [ { "added": [], "header": "@@ -1445,10 +1445,8 @@ public interface SQLState {", "removed": [ " String INVALID_PARAM_USE_GETINT = \"XJ089.S\";", " String RETURN_PARAM_MUST_BE_INT = \"XJ092.S\";" ] } ] } ]
derby-DERBY-1958-26c2de4c
DERBY-1958: Improve XSDG3 error to print container, operation, and name This patch was contributed by Eranda Sooriyabandara (070468D at gmail dot com) This patch modifies message XSDG3 ("Metadata for container could not be accessed") to provide additional information about which container, precisely, is having the problem. The message now includes the container identity and the container file name, as well as the type of access to the container that encountered the problem. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@989696 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/store/raw/data/RAFContainer.java", "hunks": [ { "added": [ " private String fileName;" ], "header": "@@ -94,6 +94,7 @@ class RAFContainer extends FileContainer implements PrivilegedExceptionAction", "removed": [] }, { "added": [ " SQLState.FILE_CONTAINER_EXCEPTION, ioe,", " getIdentity() != null ?", " getIdentity().toString() : \"unknown\",", " \"clean\", fileName));" ], "header": "@@ -543,7 +544,10 @@ class RAFContainer extends FileContainer implements PrivilegedExceptionAction", "removed": [ " SQLState.FILE_CONTAINER_EXCEPTION, ioe, this));" ] }, { "added": [ " SQLState.FILE_CONTAINER_EXCEPTION, ioe,", " getIdentity() != null ?", " getIdentity().toString() : \"unknown\",", " \"encrypt\", newFilePath);" ], "header": "@@ -1242,9 +1246,10 @@ class RAFContainer extends FileContainer implements PrivilegedExceptionAction", "removed": [ " SQLState.FILE_CONTAINER_EXCEPTION, ", " ioe, ", " newFile);" ] }, { "added": [ " SQLState.FILE_CONTAINER_EXCEPTION, ioe,", " getIdentity() != null ?", " getIdentity().toString() : \"unknown\",", " \"encrypt-close\", newFilePath);" ], "header": "@@ -1259,9 +1264,10 @@ class RAFContainer extends FileContainer implements PrivilegedExceptionAction", "removed": [ " SQLState.FILE_CONTAINER_EXCEPTION, ", " ioe, ", " newFile);" ] }, { "added": [ " fileName = file.toString();" ], "header": "@@ -1407,6 +1413,7 @@ class RAFContainer extends FileContainer implements PrivilegedExceptionAction", "removed": [] }, { "added": [ " FILE_CONTAINER_EXCEPTION, ioe,", " getIdentity() != null ?", " getIdentity().toString() :", " \"unknown\",", " \"read\", fileName));" ], "header": "@@ -1428,8 +1435,11 @@ class RAFContainer extends FileContainer implements PrivilegedExceptionAction", "removed": [ " FILE_CONTAINER_EXCEPTION, ", " ioe, this));" ] }, { "added": [ " ioe2,", " getIdentity() != null ?", " getIdentity().toString() :", " \"unknown\",", " \"delete-stub\", fileName));" ], "header": "@@ -1462,7 +1472,11 @@ class RAFContainer extends FileContainer implements PrivilegedExceptionAction", "removed": [ " ioe2, this));" ] } ] } ]
derby-DERBY-1961-106ea47b
Checked in the performance tests used in DERBY-1961 and DERBY-2911. The following command prints information on how to run the tests: java org.apache.derbyTesting.perf.clients.Runner git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@619404 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/perf/clients/WisconsinFiller.java", "hunks": [ { "added": [ "/*", "", "Derby - Class org.apache.derbyTesting.perf.clients.WisconsinFiller", "", "Licensed to the Apache Software Foundation (ASF) under one or more", "contributor license agreements. See the NOTICE file distributed with", "this work for additional information regarding copyright ownership.", "The ASF licenses this file to You under the Apache License, Version 2.0", "(the \"License\"); you may not use this file except in compliance with", "the License. You may obtain a copy of the License at", "", " http://www.apache.org/licenses/LICENSE-2.0", "", "Unless required by applicable law or agreed to in writing, software", "distributed under the License is distributed on an \"AS IS\" BASIS,", "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", "See the License for the specific language governing permissions and", "limitations under the License.", "", "*/", "", "package org.apache.derbyTesting.perf.clients;", "", "import java.sql.Connection;", "import java.sql.SQLException;", "import java.sql.Savepoint;", "import java.sql.Statement;", "import org.apache.derbyTesting.functionTests.tests.lang.wisconsin;", "", "/**", " * Class which creates and populates the tables used by", " * {@code IndexJoinClient}. These are the same tables as the ones used by the", " * functional Wisconsin test found in the lang suite.", " */", "public class WisconsinFiller implements DBFiller {", "", " public void fill(Connection c) throws SQLException {", " c.setAutoCommit(false);", "", " dropTable(c, \"TENKTUP1\");", " dropTable(c, \"TENKTUP2\");", " dropTable(c, \"ONEKTUP\");", " dropTable(c, \"BPRIME\");", "", " wisconsin.createTables(c, false);", "", " c.commit();", " }", "", " /**", " * Helper method which drops a table if it exists. Nothing happens if", " * the table doesn't exist.", " *", " * @param c the connection to use", " * @param table the table to drop", " * @throws SQLException if an unexpected database error occurs", " */", " static void dropTable(Connection c, String table) throws SQLException {", " // Create a savepoint that we can roll back to if drop table fails.", " // This is not needed by Derby, but some databases (e.g., PostgreSQL)", " // don't allow more operations in a transaction if a statement fails,", " // and we want to be able to run these tests against other databases", " // than Derby.", " Savepoint sp = c.setSavepoint();", " Statement stmt = c.createStatement();", " try {", " stmt.executeUpdate(\"DROP TABLE \" + table);", " } catch (SQLException e) {", " // OK to fail if table doesn't exist, roll back to savepoint", " c.rollback(sp);", " }", " stmt.close();", " c.releaseSavepoint(sp);", " }", "}" ], "header": "@@ -0,0 +1,75 @@", "removed": [] } ] } ]
derby-DERBY-1966-5b5091ff
DERBY-1966 (partial) Cleanup of some code in DRDAServerStarter. Add some comments and remove use of priv blocks to access public methods in public classes. Step in an incremental approach to clarify the interaction between this class and NetworkServerControlImpl. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@511360 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/jdbc/DRDAServerStarter.java", "hunks": [ { "added": [ "/**", " * Class that starts the network server in its own daemon thread.", " * Works in two situations.", " * <BR>", " * As a module in the engine's Monitor, booted if the", " * property derby.drda.startNetworkServer is set to true.", " * In this case the boot and shutdown is through the", " * standard ModuleControl methods.", " * <BR>", " * Direct calls from the NetworkServerControlImpl start methods.", " * This is to centralize the creation of the daemon thread in", " * this class in the engine code, since the Monitor provides", " * the thread. This means that NetworkServerControlImpl calls", " * this class to create a thread which in turn calls back", " * to NetworkServerControlImpl.runServer to start the server.", " *", " * @see ModuleControl#boot", " * @see ModuleControl#stop", " */", " /**", " * The instance of the NetworkServerControlImpl", " * being used to run the server.", " */", " ", " /**", " * Reflect reference to the method to run the server.", " * NetworkServerControlImpl.blockingStart", " */", " private Method runServerMethod;", " ", " /**", " * Reflect reference to the method to directly", " * shutdown the server.", " * NetworkServerControlImpl.directShutdown", " */", " private Method serverShutdownMethod;", "" ], "header": "@@ -37,13 +37,46 @@ import java.security.AccessController;", "removed": [ "", " private Method serverStartMethod;", "\tprivate Method serverShutdownMethod;", " private boolean loadSysIBM;" ] }, { "added": [ " /**", " * Find the methods to start and shutdown the server.", " * Perfomed through reflection so that the engine", " * code is not dependent on the network server code.", " * @param serverClass", " * @throws NoSuchMethodException ", " * @throws SecurityException ", " */", " private void findStartStopMethods(final Class serverClass)", " throws SecurityException, NoSuchMethodException", " {", " // Methods are public so no need for privilege blocks.", " runServerMethod = serverClass.getMethod(", " \"blockingStart\", new Class[] { java.io.PrintWriter.class});", " ", " serverShutdownMethod = serverClass.getMethod(", " \"directShutdown\", null);", " }" ], "header": "@@ -75,7 +108,24 @@ public final class DRDAServerStarter implements ModuleControl, Runnable", "removed": [ "" ] }, { "added": [], "header": "@@ -121,19 +171,6 @@ public final class DRDAServerStarter implements ModuleControl, Runnable", "removed": [ "\t\t\t\tserverStartMethod = (Method) AccessController.doPrivileged(", "\t\t\t\t new PrivilegedExceptionAction() {", "\t\t\t\t\t\t public Object run() throws NoSuchMethodException, SecurityException", "\t\t\t\t\t\t { return serverClass.getMethod( \"blockingStart\", new Class[] { java.io.PrintWriter.class});}", "\t\t\t\t\t }", "\t\t\t\t );", "\t\t\t\t", "\t\t\t\tserverShutdownMethod = (Method) AccessController.doPrivileged(", "\t\t\t\t new PrivilegedExceptionAction() {", "\t\t\t\t\t\t public Object run() throws NoSuchMethodException, SecurityException", "\t\t\t\t\t\t { return serverClass.getMethod( \"directShutdown\", null);}", "\t\t\t\t\t }", "\t\t\t\t );" ] }, { "added": [ " ", " findStartStopMethods(serverClass);", " " ], "header": "@@ -144,6 +181,9 @@ public final class DRDAServerStarter implements ModuleControl, Runnable", "removed": [] }, { "added": [ " runServerMethod.invoke( server," ], "header": "@@ -165,7 +205,7 @@ public final class DRDAServerStarter implements ModuleControl, Runnable", "removed": [ " serverStartMethod.invoke( server," ] }, { "added": [], "header": "@@ -212,8 +252,6 @@ public final class DRDAServerStarter implements ModuleControl, Runnable", "removed": [ "\t\tserverStartMethod = null;", "\t\tserverShutdownMethod = null;" ] } ] } ]
derby-DERBY-1970-f8fd911c
DERBY-1970 Add JDBCPerfTestCase as initial step in adding performance tests to Derby's testing. Contributed by Sunitha Kambhampati ksunithaghm@gmail.com git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@469567 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-1971-985662bc
DERBY-1952 (partial) DERBY-1971 (partial) Change more of the tests run from jdbcapi._Suite to return suites that run in embedded and client as primary configurations. Name some of the TestSuites returned from TestConfiguration to make the hierarchy view in the Swing Test Runner more useful. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@464999 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/junit/TestConfiguration.java", "hunks": [ { "added": [ " final TestSuite suite = new TestSuite(suiteName(testClass));" ], "header": "@@ -169,7 +169,7 @@ public class TestConfiguration {", "removed": [ " final TestSuite suite = new TestSuite();" ] }, { "added": [ " /**", " * Generate a suite name from a class name, taking", " * only the last element of the fully qualified class name.", " */", " private static String suiteName(Class testClass)", " {", " int lastDot = testClass.getName().lastIndexOf('.');", " String suiteName = testClass.getName();", " if (lastDot != -1)", " suiteName = suiteName.substring(lastDot + 1, suiteName.length());", " ", " return suiteName;", " }", " " ], "header": "@@ -177,6 +177,20 @@ public class TestConfiguration {", "removed": [] }, { "added": [ " return new TestSuite(testClass,", " suiteName(testClass)+\":embedded\");" ], "header": "@@ -184,7 +198,8 @@ public class TestConfiguration {", "removed": [ " return new TestSuite(testClass);" ] }, { "added": [ " TestSuite suite = new TestSuite(testClass,", " suiteName(testClass)+\":client\");" ], "header": "@@ -196,7 +211,8 @@ public class TestConfiguration {", "removed": [ " TestSuite suite = new TestSuite(testClass);" ] } ] } ]
derby-DERBY-1974-c61536a1
DERBY-1974 Add utility method TestConfiguration.sqlAuthorizationDecorator to change the default database to one that has SQL authorization mode enabled. Have PrepareExecuteDDL use this decorator and add this test to lang._Suite. Fix a bug in assertDrainResults() where the wrong variable was being used to check an assert. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@470024 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/junit/TestConfiguration.java", "hunks": [ { "added": [ " private final static String DEFAULT_DBNAME_SQL = \"dbsqlauth\";", " " ], "header": "@@ -41,6 +41,8 @@ public class TestConfiguration {", "removed": [] }, { "added": [], "header": "@@ -58,11 +60,6 @@ public class TestConfiguration {", "removed": [ "", " /**", " * Possible values of system properties.", " */", " private final static String UNUSED = \"file://unused/\";" ] }, { "added": [ " /**", " * Decorate a test changing the default user name and password.", " * Typically used along with DatabasePropertyTestSetup.builtinAuthentication.", " * The tearDown method resets the default user and password value to", " * their previous settings.", " * ", " * @param test Test to decorate", " * @param user New default user", " * @param password New password", " * @return decorated test", " * ", " * @see DatabasePropertyTestSetup#builtinAuthentication(Test, String[], String)", " */", " } ", " ", " /**", " * Decorate a test to use the default database that has", " * was created in SQL authorization mode.", " * The tearDown reverts the configuration to the previous", " * configuration.", " * ", " * Tests can use this in conjunction with", " * DatabasePropertyTestSetup.builtinAuthentication", " * to set up BUILTIN authentication and changeUserDecorator", " * to switch users.", " * ", " * @param test Test to be decorated", " * @return decorated test.", " * ", " * @see DatabasePropertyTestSetup#builtinAuthentication(Test, String[], String)", " */", " public static Test sqlAuthorizationDecorator(Test test)", " {", " TestConfiguration config = TestConfiguration.getCurrent();", " TestConfiguration newDBconfig = ", " new TestConfiguration(config, DEFAULT_DBNAME_SQL);", " ", " // Set the SQL authorization mode as a database property", " // with a modified DatabasePropertyTestSetup that does not", " // reset it.", " final Properties sqlAuth = new Properties();", " sqlAuth.setProperty(\"derby.database.sqlAuthorization\", \"true\");", " Test setSQLAuthMode = new DatabasePropertyTestSetup(test,", " sqlAuth, true) {", " protected void tearDown() {", " }", " };", "", " return new ChangeConfigurationSetup(newDBconfig, setSQLAuthMode);", " }", " " ], "header": "@@ -280,10 +277,60 @@ public class TestConfiguration {", "removed": [ " } " ] } ] } ]
derby-DERBY-1975-b83e61a0
DERBY-1975 (partial) Add some incremental work to support a single use database for a test. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@469594 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/junit/TestConfiguration.java", "hunks": [ { "added": [ " /**", " * Decorate a test to use a new database that is created upon the", " * first connection request to the database and shutdown & deleted at", " * tearDown. The configuration differs only from the current configuration", " * by the database name.", " * @param test Test to be decorated", " * @return decorated test.", " */", " public static Test singleUseDatabaseDecorator(Test test)", " {", " TestConfiguration config = TestConfiguration.getCurrent();", "", " // WORK IN PROGRESS - need to have unique name.", " String dbName = \"singleUse/wombat2\"; ", " TestConfiguration newDBconfig = ", " new TestConfiguration(config, dbName);", " return new ChangeConfigurationSetup(newDBconfig,", " new DropDatabaseSetup(test));", " }", " " ], "header": "@@ -245,6 +245,26 @@ public class TestConfiguration {", "removed": [] }, { "added": [ " /**", " * Obtain a new configuration identical to the passed in", " * one except for the database name.", " * @param copy Configuration to copy.", " * @param dbName New database name", " */", " TestConfiguration(TestConfiguration copy, String dbName)", " {", " this.dbName = dbName;", " this.userName = copy.userName;", " this.userPassword = copy.userPassword;", " this.isVerbose = copy.isVerbose;", " this.singleLegXA = copy.singleLegXA;", " this.port = copy.port;", " ", " this.jdbcClient = copy.jdbcClient;", " this.hostName = copy.hostName;", " ", " this.url = createJDBCUrlWithDatabaseName(dbName);", " }", " " ], "header": "@@ -306,7 +326,28 @@ public class TestConfiguration {", "removed": [] } ] } ]
derby-DERBY-1975-d488449a
DERBY-1975 Enhance the single database decorator and DropDatabaseSetup to use a unique database name and to drop the database at tearDown. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@469632 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/junit/TestConfiguration.java", "hunks": [ { "added": [ " ", " /**", " * Simple count to provide a unique number for database", " * names.", " */", " private static int uniqueDB;" ], "header": "@@ -63,6 +63,12 @@ public class TestConfiguration {", "removed": [] }, { "added": [ " * This decorator expects the database file to be local so it", " * can be removed." ], "header": "@@ -250,6 +256,8 @@ public class TestConfiguration {", "removed": [] }, { "added": [ " // Forward slash is ok, Derby treats database names", " // as URLs and translates forward slash to the local", " // separator.", " String dbName = \"singleUse/oneuse\";", " // Synchronize on the literal name which will be invariant", " // since it is interned.", " synchronized (dbName) {", " dbName = dbName.concat(Integer.toHexString(uniqueDB++));", " }" ], "header": "@@ -257,8 +265,15 @@ public class TestConfiguration {", "removed": [ " // WORK IN PROGRESS - need to have unique name.", " String dbName = \"singleUse/wombat2\"; " ] } ] } ]
derby-DERBY-1993-ff22a628
DERBY-1993: Checkin derby-1993-v03.diff, which puts the demo classes in the org.apache.derbyDemo namespace. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@470372 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/demo/scores/java/server/org/apache/derbyDemo/scores/proc/Procedures.java", "hunks": [ { "added": [ "/*", "", " Derby - Class org.apache.derbyDemo.scores.proc.Procedures", "", " Licensed to the Apache Software Foundation (ASF) under one or more", " contributor license agreements. See the NOTICE file distributed with", " this work for additional information regarding copyright ownership.", " The ASF licenses this file to You under the Apache License, Version 2.0", " (the \"License\"); you may not use this file except in compliance with", " the License. You may obtain a copy of the License at", "", " http://www.apache.org/licenses/LICENSE-2.0", "", " Unless required by applicable law or agreed to in writing, software", " distributed under the License is distributed on an \"AS IS\" BASIS,", " WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", " See the License for the specific language governing permissions and", " limitations under the License.", "", " */", "", "package org.apache.derbyDemo.scores.proc;", "", "import java.sql.*;", "", "import org.apache.derbyDemo.scores.util.*;", "", "/**", " * <p>", " * Procedures used by the Scores application.", " * </p>", " *", " * @author Rick Hillegas", " */", "public class Procedures", "{", " ////////////////////////////////////////////////////////", " //", " // CONSTANTS", " //", " ////////////////////////////////////////////////////////", "", " ////////////////////////////////////////////////////////", " //", " // STATE", " //", " ////////////////////////////////////////////////////////", "", " private static int _scoringCount = 0;", " ", " ////////////////////////////////////////////////////////", " //", " // STATIC BEHAVIOR", " //", " ////////////////////////////////////////////////////////", "", " /**", " * <p>", " * Score a test run and update TestTaking with the score.", " * </p>", " */", " public static void ScoreTestTaking( int takingID )", " throws SQLException", " {", " Connection conn = Functions.getDefaultConnection();", " Logger log = Logger.getLogger();", " boolean loggingEnabled = log.isLoggingEnabled();", "", " try {", " //", " // Only print out the first test taking.", " // They all look alike.", " //", " if ( _scoringCount > 0 ) { log.enableLogging( false ); }", "", " log.log", " (", " \"Trigger has just fired and started \" +", " \"the ScoreTestTaking procedure.\\n\"", " ); ", "", " PreparedStatement ps = Utils.prepare", " (", " conn,", " \"select \\n\" +", " \" sum( weighQuestion( q.difficulty ) ),\\n\" +", " \" sum( scoreAnswer( q.difficulty, q.numberOfChoices,\" +", " \" q.correctChoice, qt.actualChoice ) )\\n\" +", " \"from Question q, QuestionTaking qt\\n\" +", " \"where q.questionID = qt.questionID\\n\" +", " \"and qt.takingID = ?\\n\"", " );", " ps.setInt( 1, takingID );", "", " ResultSet rs = ps.executeQuery();", "", " rs.next();", " ", " int column = 1;", " double allCorrect = rs.getDouble( column++ );", " double actual = rs.getDouble( column++ );", " double score = Utils.finishScore", " ( allCorrect, actual );", "", " Utils.close( rs );", " Utils.close( ps );", "", " int param = 1;", " ps = Utils.prepare", " (", " conn,", " \"update TestTaking set score = ? where takingID = ?\\n\"", " );", " ps.setDouble( param++, score );", " ps.setInt( param++, takingID );", " ps.executeUpdate();", "", " Utils.close( ps );", "", " }", " finally", " {", " log.enableLogging( loggingEnabled );", " }", "", " _scoringCount++;", " }", "", " ////////////////////////////////////////////////////////", " //", " // MINIONS", " //", " ////////////////////////////////////////////////////////", "", "", "}" ], "header": "@@ -0,0 +1,136 @@", "removed": [] } ] } ]
derby-DERBY-1997-b06ac7ae
DERBY-1997: Remove custom exception printing methods and replace with printStackTrace as suggested git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1496870 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/demo/workingwithderby/WwdEmbedded.java", "hunks": [ { "added": [ " e.printStackTrace(System.out);" ], "header": "@@ -143,32 +143,8 @@ public class WwdEmbedded", "removed": [ " errorPrint(e);", " // ## DERBY EXCEPTION REPORTING CLASSES ## ", " /*** Exception reporting methods", " ** with special handling of SQLExceptions", " ***/", " static void errorPrint(Throwable e) {", " if (e instanceof SQLException) ", " SQLExceptionPrint((SQLException)e);", " else {", " System.out.println(\"A non SQL error occured.\");", " e.printStackTrace();", " } ", " } // END errorPrint ", "", " // Iterates through a stack of SQLExceptions ", " static void SQLExceptionPrint(SQLException sqle) {", " while (sqle != null) {", " System.out.println(\"\\n---SQLException Caught---\\n\");", " System.out.println(\"SQLState: \" + (sqle).getSQLState());", " System.out.println(\"Severity: \" + (sqle).getErrorCode());", " System.out.println(\"Message: \" + (sqle).getMessage()); ", " sqle.printStackTrace(); ", " sqle = sqle.getNextException();", " }", " } // END SQLExceptionPrint \t" ] } ] } ]
derby-DERBY-2000-23c0fede
DERBY-2000 Add a BaseTestSetup class that installs the security manager so that it is in place during the decorator's methods. Changed the various Derby decorators to extend this new class. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@541044 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/junit/Decorator.java", "hunks": [ { "added": [ " test = new BaseTestSetup(test) {" ], "header": "@@ -61,7 +61,7 @@ public class Decorator {", "removed": [ " test = new TestSetup(test) {" ] }, { "added": [], "header": "@@ -69,8 +69,6 @@ public class Decorator {", "removed": [ " String bootPhrase = getBootPhrase(16);", "" ] } ] }, { "file": "java/testing/org/apache/derbyTesting/junit/SecurityManagerSetup.java", "hunks": [ { "added": [ "import java.security.Policy;" ], "header": "@@ -22,6 +22,7 @@ package org.apache.derbyTesting.junit;", "removed": [] }, { "added": [ " * ", " * @param test Test to run without a security manager. Note that", " * this must be an instance of BaseTestCase as this call depends", " * on setup code in that class. Arbitrary Test instances cannot be passed in." ], "header": "@@ -75,6 +76,10 @@ public final class SecurityManagerSetup extends TestSetup {", "removed": [] }, { "added": [], "header": "@@ -83,18 +88,6 @@ public final class SecurityManagerSetup extends TestSetup {", "removed": [ "\t", " /**", " * Same as noSecurityManager() above but takes a TestSetup", " * instead of a BaseTestCase.", " */", " public static Test noSecurityManager(TestSetup tSetup)", " {", "\t\tif (externalSecurityManagerInstalled)", "\t\t\treturn new TestSuite(\"skipped due to external security manager \"", " + tSetup.toString());", "\t\treturn new SecurityManagerSetup(tSetup, \"<NONE>\");", " }" ] }, { "added": [ " SecurityManager sm = new SecurityManager();", "\t\t\t\tSystem.setSecurityManager(sm);", " \t\t\t\treturn null;" ], "header": "@@ -183,8 +176,9 @@ public final class SecurityManagerSetup extends TestSetup {", "removed": [ "\t\t\t\tSystem.setSecurityManager(new SecurityManager());", "\t\t\t\treturn null;" ] }, { "added": [ "\t\tif (policyURL != null) {", " }" ], "header": "@@ -206,9 +200,10 @@ public final class SecurityManagerSetup extends TestSetup {", "removed": [ "\t\tif (policyURL != null)" ] }, { "added": [ " System.setSecurityManager(null);" ], "header": "@@ -376,7 +371,7 @@ public final class SecurityManagerSetup extends TestSetup {", "removed": [ " System.setSecurityManager(null);" ] } ] } ]
derby-DERBY-2002-6f52e78a
DERBY-2002: Case expression allows NULL in all parts of <result> Require at least one expression with a known type (that is, not NULL or a ? parameter) in the THEN and ELSE clauses of a CASE expression. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1599142 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/compile/ConditionalNode.java", "hunks": [ { "added": [], "header": "@@ -21,7 +21,6 @@", "removed": [ "import java.sql.Types;" ] }, { "added": [], "header": "@@ -109,41 +108,6 @@ class ConditionalNode extends ValueNode", "removed": [ "\t/**", " * Find a type to which we can cast the untyped NULLs generated by", " * the parser (for clauses such as ELSE NULL). This does not have to", " * be the type that the CASE expression ends up returning. It is", " * enough that it is a type that can be converted into the type of the", " * CASE expression in order to keep the type checking in the compiler", " * happy.", "\t *", "\t * @param fromList The fromList (required for Column References).", "\t *", "\t * @exception StandardException Thrown on error.", "\t */", " private DataTypeDescriptor findType(", " FromList fromList, SubqueryList subqueryList, List<AggregateNode> aggregates)", "\t\tthrows StandardException", "\t{", "\t\t/* We need to \"prebind\" because we want the Types. Provide", "\t\t * dummy SubqueryList and AggreateList (we don't care)", "\t\t */", " thenElseList.bindExpression(fromList, subqueryList, aggregates);", "", " // Find the first typed expression.", " DataTypeDescriptor dtd = thenElseList.getTypeServices();", "", " if (dtd == null) {", " // If none of the expressions have a type, we should probably have", " // raised an error (DERBY-2002). However, Derby has always used the", " // type CHAR(1) in this case, so return that for now.", " dtd = DataTypeDescriptor.getBuiltInDataTypeDescriptor(", " Types.CHAR, 1);", " }", "", " return dtd;", "\t}", "" ] }, { "added": [], "header": "@@ -159,9 +123,6 @@ class ConditionalNode extends ValueNode", "removed": [ "\t\t// Don't do anything if we couldn't find a castType.", "\t\tif (castType == null) return;", "\t\t" ] }, { "added": [ " thenElseList.bindExpression(fromList, subqueryList, aggregates);", "", " // Find the type of the first typed value in thenElseList and cast", " // all untyped NULL values to that type. We don't need to find the", " // dominant type here, since a top-level cast to that type will be", " // added later, if necessary.", " DataTypeDescriptor nullType = thenElseList.getTypeServices();", " if (nullType == null) {", " // There are no values with a known type in the list. Raise", " // an error.", " throw StandardException.newException(", " SQLState.LANG_ALL_RESULT_EXPRESSIONS_UNTYPED);", " } else {", " recastNullNodes(nullType, fromList, subqueryList, aggregates);", " }" ], "header": "@@ -231,12 +192,21 @@ class ConditionalNode extends ValueNode", "removed": [ " // Following call to \"findType()\" and \"recastNullNodes\" will", " // indirectly bind the expressions in the thenElseList, so no need", " // to call \"thenElseList.bindExpression(...)\" after we do this.", " // DERBY-2986.", " recastNullNodes(findType(fromList, subqueryList, aggregates),", " fromList, subqueryList, aggregates);" ] } ] } ]
derby-DERBY-2003-be115c44
DERBY-2003 Add a utility method to allow setting the lock timeouts as a decorator building off DatabasePropertyTestSetup. Use this decorator in BlobClob4Blob to reduce the wait time. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@468209 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/junit/DatabasePropertyTestSetup.java", "hunks": [ { "added": [ " ", " /**", " * Decorator to change the lock time outs.", " * If either time is less than zero then that property is", " * not modified by this decorator.", " * The change is implemented by an instanceof DatabasePropertyTestSetup", " * and thus is reset by the tearDown method.", " * ", " * @param test Test to decorate", " * @param deadlockTime Time in seconds for derby.locks.deadlockTimeout.", " * @param waitTime Time in seconds for derby.locks.waitTimeout", " * @return", " */", " public static Test setLockTimeouts(Test test, int deadlockTime, int waitTime)", " {", " final Properties properties = new Properties();", " if (deadlockTime >= 0)", " {", " properties.setProperty(\"derby.locks.deadlockTimeout\",", " Integer.toString(deadlockTime));", " }", " if (waitTime >= 0) {", " properties.setProperty(\"derby.locks.waitTimeout\",", " Integer.toString(waitTime));", " }", " ", " // No change, no point to the decorator.", " if (properties.isEmpty())", " return test;", "", " return new DatabasePropertyTestSetup(test, properties);", " }" ], "header": "@@ -40,6 +40,38 @@ public class DatabasePropertyTestSetup extends BaseJDBCTestSetup {", "removed": [] } ] } ]
derby-DERBY-2006-87662285
DERBY-2006: Add a top-level Ant target that runs the junit tests and generates a report. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@470604 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/junit/SecurityManagerSetup.java", "hunks": [ { "added": [ "", "\t\t//We need the junit classes to instantiate this class, so the", "\t\t//following should not cause runtime errors.", " URL junit = null;", " junit = getURL(junit.framework.Test.class);", " classPathSet.setProperty(\"derbyTesting.junit\", junit == null ? \"\" : junit.toString());", "\t", " URL antjunit = null;", " Class antjunitclass = null;", " try {", " \t// Load indirectly so we don't need ant-junit.jar at compile time.", " antjunitclass = Class.forName(\"org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner\");", " antjunit = getURL(antjunitclass);", " classPathSet.setProperty(\"derbyTesting.antjunit\", antjunit == null ? \"\" : antjunit.toString());", " } catch (java.lang.ClassNotFoundException e) {", " \t// Not running in Ant, do nothing.", " antjunit = null;", " }" ], "header": "@@ -216,6 +216,24 @@ public final class SecurityManagerSetup extends TestSetup {", "removed": [] }, { "added": [ "\t" ], "header": "@@ -250,7 +268,7 @@ public final class SecurityManagerSetup extends TestSetup {", "removed": [ "\t\t" ] } ] } ]
derby-DERBY-2007-552e94e0
DERBY-2007 (partial) The dropping of tables in CleanDatabaseTestSetup needs to be smarter for the nist suite since it has tables that depend on each other. This is an incremental change that copes with tables in the same schema depending on each other except when two tables reference each other. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@468447 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/junit/JDBC.java", "hunks": [ { "added": [ "import java.util.ArrayList;", "import java.util.Iterator;", "import java.util.List;", "import java.util.ListIterator;" ], "header": "@@ -20,6 +20,10 @@", "removed": [] }, { "added": [ " " ], "header": "@@ -200,7 +204,7 @@ public class JDBC {", "removed": [ " " ] }, { "added": [ " // First collect the set of DROP SQL statements.", " ArrayList ddl = new ArrayList();", " ddl.add(dropLeadIn + JDBC.escape(schema, objectName));", " ", " // Execute them as a complete batch, hoping they will all succeed.", " s.clearBatch();", " int batchCount = 0;", " for (Iterator i = ddl.iterator(); i.hasNext(); )", " {", " Object sql = i.next();", " if (sql != null) {", " s.addBatch(sql.toString());", " batchCount++;", " }", " }", "", " boolean hadError;", " hadError = false;", " hadError = true;", " // Remove any statements from the list that succeeded." ], "header": "@@ -231,29 +235,44 @@ public class JDBC {", "removed": [ "\t\ts.clearBatch();", "\t\tint batchCount = 0;", "\t\t\ts.addBatch(dropLeadIn + JDBC.escape(schema, objectName));", "\t\t\tbatchCount++;", "\t\tboolean hadError = false;" ] }, { "added": [ " ", " if (didDrop)", " ddl.set(i, null);", " s.clearBatch();", " if (didDrop) {", " // Commit any work we did do.", " s.getConnection().commit();", " }", "", " // If we had failures drop them as individual statements", " // until there are none left or none succeed. We need to", " // do this because the batch processing stops at the first", " // error. This copes with the simple case where there", " // are objects of the same type that depend on each other", " // and a different drop order will allow all or most", " // to be dropped.", " if (hadError) {", " do {", " hadError = false;", " didDrop = false;", " for (ListIterator i = ddl.listIterator(); i.hasNext();) {", " Object sql = i.next();", " if (sql != null) {", " try {", " s.executeUpdate(sql.toString());", " i.set(null);", " didDrop = true;", " } catch (SQLException e) {", " hadError = true;", " }", " }", " }", " if (didDrop)", " s.getConnection().commit();", " } while (hadError && didDrop);", " }" ], "header": "@@ -266,11 +285,43 @@ public class JDBC {", "removed": [ "\t\t", "\t\t// Commit any work we did do.", "\t\ts.getConnection().commit();", "\t\ts.clearBatch();" ] } ] } ]
derby-DERBY-2007-64c254cd
DERBY-2007 Add a convenience method in DatabasePropertyTestSetup that returns a decorator that sets up BUILTIN authentication with the passed in list of users. Use this for the NIST test as seemed to be the intention under the old harness. Remove the remaining harness properties files for the nist suite. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@468803 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/junit/DatabasePropertyTestSetup.java", "hunks": [ { "added": [ " private final boolean staticProperties;" ], "header": "@@ -40,6 +40,7 @@ public class DatabasePropertyTestSetup extends BaseJDBCTestSetup {", "removed": [] }, { "added": [ " return new DatabasePropertyTestSetup(test, properties, true);", " }", " ", " /**", " * Decorate a test so that the database has authentication enabled", " * using the BUILTIN provider and the set of users passed in.", " * The password for each user is set to the user's name with ", " * the value of passwordToken appended.", " * <P>", " * Assumption is that no authentication was enabled upon entry.", " * <P>", " * The authentication is removed by the decorator's tearDown method.", " * @param test Test to be decorated.", " * @param users Set of users for authentication.", " * @return Decorated test.", " */", " public static Test builtinAuthentication(Test test, String[] users,", " String passwordToken)", " {", " final Properties userProps = new Properties();", " final Properties authProps = new Properties();", " ", " authProps.setProperty(\"derby.connection.requireAuthentication\", \"true\");", " authProps.setProperty(\"derby.authentication.provider\", \"BUILTIN\");", " ", " for (int i = 0; i < users.length; i++)", " {", " String user = users[i];", " userProps.setProperty(\"derby.user.\" + user, user.concat(passwordToken));", " }", " ", " // Need to setup the decorators carefully.", " // Need execution in this order:", " // 1) add user definitions (no authentication enabled)", " // 2) switch to a valid user", " // 3) enable authentication with database reboot", " // 4) disable authentication with database reboot", " // 5) switch back to previous user", " // 6) remove user defintions.", " //", " // Combining steps 1,3 does not work as no shutdown request", " // is possible for step 4 as no valid users would be defined!", " //", " // Note the decorators are executed in order from", " // outer (added last) to inner.", " ", " test = new DatabasePropertyTestSetup(test, authProps, true);", " test = new ChangeUserSetup(test, users[0], users[0].concat(passwordToken));", " test = new DatabasePropertyTestSetup(test, userProps, false);", " ", " return test;" ], "header": "@@ -70,7 +71,57 @@ public class DatabasePropertyTestSetup extends BaseJDBCTestSetup {", "removed": [ " return new DatabasePropertyTestSetup(test, properties);" ] }, { "added": [ " this(test, newValues, false);", " }", " ", " /**", " * Create a test decorator that sets and restores the passed", " * in properties. Assumption is that the contents of", " * properties and values will not change during execution.", " * @param test test to be decorated", " * @param newValues properties to be set", " * @param staticProperties True if database needs to be shutdown after", " * setting properties in setUp() and tearDown method().", " */", " public DatabasePropertyTestSetup(Test test,", " Properties newValues, boolean staticProperties)", " {", " this.staticProperties = staticProperties;" ], "header": "@@ -83,9 +134,25 @@ public class DatabasePropertyTestSetup extends BaseJDBCTestSetup {", "removed": [] }, { "added": [ " if (staticProperties) {", " try {", " TestConfiguration.getCurrent().getDefaultConnection(", " \"shutdown=true\");", " fail(\"Database failed to shut down\");", " } catch (SQLException e) {", " BaseJDBCTestCase.assertSQLState(\"Database shutdown\", \"08006\", e);", " }", " }" ], "header": "@@ -96,6 +163,15 @@ public class DatabasePropertyTestSetup extends BaseJDBCTestSetup {", "removed": [] }, { "added": [ " if (staticProperties) {", " try {", " TestConfiguration.getCurrent().getDefaultConnection(", " \"shutdown=true\");", " fail(\"Database failed to shut down\");", " } catch (SQLException e) {", " BaseJDBCTestCase.assertSQLState(\"Database shutdown\", \"08006\", e);", " }", " }" ], "header": "@@ -130,6 +206,15 @@ public class DatabasePropertyTestSetup extends BaseJDBCTestSetup {", "removed": [] } ] } ]
derby-DERBY-2007-8919a15e
DERBY-2007 (partial) Improve CleanDatabaseTestSetup to handle tables in a dependency loop due to foreign key constraints and simple cases for objects that are dependent across schemas. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@468502 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/junit/JDBC.java", "hunks": [ { "added": [ " ", " // At this point there may be tables left due to", " // foreign key constraints leading to a dependency loop.", " // Drop any constraints that remain and then drop the tables.", " // If there are no tables then this should be a quick no-op.", " rs = dmd.getExportedKeys((String) null, schema, (String) null);", " while (rs.next())", " {", " short keyPosition = rs.getShort(\"KEY_SEQ\");", " if (keyPosition != 1)", " continue;", " String fkName = rs.getString(\"FK_NAME\");", " // No name, probably can't happen but couldn't drop it anyway.", " if (fkName == null)", " continue;", " String fkSchema = rs.getString(\"FKTABLE_SCHEM\");", " String fkTable = rs.getString(\"FKTABLE_NAME\");", " ", " String ddl = \"ALTER TABLE \" +", " JDBC.escape(fkSchema, fkTable) +", " \" DROP FOREIGN KEY \" +", " JDBC.escape(fkName);", " s.executeUpdate(ddl);", " }", " conn.commit();", " ", " // Tables (again)", " rs = dmd.getTables((String) null, schema, (String) null,", " new String[] {\"TABLE\"}); ", " dropUsingDMD(s, rs, schema, \"TABLE_NAME\", \"TABLE\");" ], "header": "@@ -197,6 +197,36 @@ public class JDBC {", "removed": [] }, { "added": [ "\t\t\ts.executeUpdate(\"DROP SCHEMA \" + JDBC.escape(schema) + \" RESTRICT\");" ], "header": "@@ -207,7 +237,7 @@ public class JDBC {", "removed": [ "\t\t\ts.execute(\"DROP SCHEMA \" + JDBC.escape(schema) + \" RESTRICT\");" ] } ] } ]
derby-DERBY-2008-1d4b49f7
DERBY-2014: NullPointerException with NULLIF in GROUP BY clause This change was contributed by Yip Ng (yipng168@gmail.com) The NPE happens in isEquivalent() method where it does not handle value is null. (same symptom as DERBY-2008) and the patch addresses this + additonal testcases. The isEquivalent() method is used to compare the select column against the group by with expression. Note that it is comparing the structural form of the two expressions for equivalence at bind phase and not comparing the actual row values at runtime to produce a result. This patch converts all the tests in the previous patch into junit. Also the javadoc for ValueNode.isEquivalent() method has been updated. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@471459 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2014-1d4b49f7
DERBY-2014: NullPointerException with NULLIF in GROUP BY clause This change was contributed by Yip Ng (yipng168@gmail.com) The NPE happens in isEquivalent() method where it does not handle value is null. (same symptom as DERBY-2008) and the patch addresses this + additonal testcases. The isEquivalent() method is used to compare the select column against the group by with expression. Note that it is comparing the structural form of the two expressions for equivalence at bind phase and not comparing the actual row values at runtime to produce a result. This patch converts all the tests in the previous patch into junit. Also the javadoc for ValueNode.isEquivalent() method has been updated. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@471459 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2016-44937d74
DERBY-2016 ArrayIndexOutOfBoundsException for COALESCE with aggregate functions Patch DERBY-2016d. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@597278 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/compile/CoalesceFunctionNode.java", "hunks": [ { "added": [ "", "\t/**", "\t * The generated method will generate code to call coalesce on", "\t * this non-parameter argument.", "\t */", "\tprivate int firstNonParameterNodeIdx = -1;" ], "header": "@@ -105,7 +105,12 @@ public class CoalesceFunctionNode extends ValueNode", "removed": [ "\tValueNode firstNonParameterNode;//The generated method will generate code to call coalesce on this non-parameter argument" ] }, { "added": [ "\t\t\t\tfirstNonParameterNodeIdx = index;" ], "header": "@@ -152,7 +157,7 @@ public class CoalesceFunctionNode extends ValueNode", "removed": [ "\t\t\t\tfirstNonParameterNode = (ValueNode) argumentsList.elementAt(index);" ] }, { "added": [ "\t\t// coalesce will be called on this non-parameter argument", "\t\t((ValueNode) argumentsList.elementAt(firstNonParameterNodeIdx)).", "\t\t\tgenerateExpression(acb, mb);", "" ], "header": "@@ -279,7 +284,10 @@ public class CoalesceFunctionNode extends ValueNode", "removed": [ "\t\tfirstNonParameterNode.generateExpression(acb, mb); //coalesce will be called on this non-parameter argument" ] } ] } ]
derby-DERBY-2017-93c4b079
DERBY-2017: Client driver can insert and commit partial data when a LOB stream throws IOException or does not match the specified length Remove workaround for DERBY-2017 (the test accepted a row that shouldn't have been committed). Patch file: derby-2017-4a-remove_test_workaround.diff git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@937198 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2017-ed6bf515
DERBY-2017: Client driver can insert and commit partial data when a LOB stream throws IOException or does not match the specified length Enabled tests as part of the suites. Added tests for binary data. Patch file: derby-2017-5a-binary_tests.diff git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@937655 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2020-a1c5a361
DERBY-2020 (partial) Change file option for syncing log file to disk from rws to rwd 1. Rename the method called supportsRws() to supportWriteSync() in WritableStorageFactory and all of its implementations. 2. Fixed code comments referring to "rws" to also include "rwd" so that the comments also will be valid if rwd is used. Patch contributed by Olav Sandstå. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@532635 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/store/raw/log/LogToFile.java", "hunks": [ { "added": [ "\t * sync(rws and rwd modes) mechanism can be used correctly." ], "header": "@@ -439,7 +439,7 @@ public final class LogToFile implements LogFactory, ModuleControl, ModuleSupport", "removed": [ "\t * sync(rws mode) mechanism can be used corretly." ] } ] }, { "file": "java/testing/org/apache/derbyTesting/functionTests/util/corruptio/CorruptBaseStorageFactory.java", "hunks": [ { "added": [ " * If the \"rws\" and \"rwd\" modes are supported then the database engine will", " * conclude that the write methods of \"rws\" mode StorageRandomAccessFiles", " * are slow but the sync method is fast and optimize accordingly.", " public boolean supportsWriteSync()", "\t\treturn realStorageFactory.supportsWriteSync();" ], "header": "@@ -242,16 +242,16 @@ abstract class CorruptBaseStorageFactory implements WritableStorageFactory", "removed": [ " * If the \"rws\" method is supported then the database engine will conclude ", " * that the write methods of \"rws\" mode StorageRandomAccessFiles are", " * slow but the sync method is fast and optimize accordingly.", " public boolean supportsRws()", "\t\treturn realStorageFactory.supportsRws();" ] } ] } ]
derby-DERBY-2020-d617193c
DERBY-2020 (partial) Move check for JVM bug (DERBY-1) into separate method. Patch contributed by Olav Sandstå. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@530807 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/store/raw/log/LogToFile.java", "hunks": [ { "added": [ " /**", " * Status for whether the check on the sync error on some JVMs has been", " * done or not. See the checkJvmSyncError method for details.", " */", " private boolean jvmSyncErrorChecked = false;" ], "header": "@@ -460,6 +460,11 @@ public final class LogToFile implements LogFactory, ModuleControl, ModuleSupport", "removed": [] }, { "added": [ " /* Some JVMs have an error in the code for write syncing. If this error", " is present we disable write syncing and fall back to doing writes", " followed by an explicit sync operation. See the details about this", " problem in the checkJvmSyncError() method. This code should be", " removed when we no longer support the JVMs with this problem. */", " if ( !jvmSyncErrorChecked ) {", " if ( checkJvmSyncError(logFile) ) {", " // To work around the problem of error for write syncing we", " // disable write sync and open the file in \"rw\" mode", " isWriteSynced = false;", " return privRandomAccessFile(logFile, \"rw\");", " }", " }", "", "\t\tStorageRandomAccessFile log = privRandomAccessFile(logFile, \"rws\");" ], "header": "@@ -5008,23 +5013,21 @@ public final class LogToFile implements LogFactory, ModuleControl, ModuleSupport", "removed": [ "\t\tStorageRandomAccessFile log;", "\t\ttry{", "\t\t\tlog = privRandomAccessFile(logFile, \"rws\");", "\t\t}catch(FileNotFoundException ex)", "\t\t{", "\t\t\t// Normally this exception should never occur. For some reason", "\t\t\t// currently on Mac JVM 1.4.2 FileNotFoundException exception is", "\t\t\t// thrown if a file is opened in \"rws\" mode and if it already", "\t\t\t// exists. Please refere to Derby-1 for more/ details on this issue.", "\t\t\t// Temporary workaround to avoid this problem is to make the logging ", "\t\t\t// system use file sync mechanism. ", "", "\t\t\t// disable the write sync and open the file in \"rw\" mode. ", "\t\t\tisWriteSynced = false;", "\t\t\tlog = privRandomAccessFile(logFile, \"rw\");", "\t\t}", "\t\t" ] }, { "added": [ "", " /**", " * In Java 1.4.2 and newer rws and rwd modes for RandomAccessFile", " * are supported. Still, on some JVMs (e.g. early versions of 1.4.2", " * and 1.5 on Mac OS and FreeBSD) the support for rws and rwd is", " * not working. This method attempts to detect this by opening an", " * existing file in \"rws\" mode. If this fails, Derby should fall", " * back to use \"rw\" mode for the log files followed by explicit", " * syncing of the log.", " *", " * Note: it is important to use \"rws\" for the test. If \"rwd\" is used, no", " * exception is thrown when opening the file, but the syncing does not", " * take place.", " *", " * For more details see DERBY-1 (and DERBY-2020).", " *", " * @param logFile information about the log file to be opened", " *", " * @return true if a JVM error is detected, false otherwise", " *", " * @exception StandardException Standard Derby exception", " */", " private boolean checkJvmSyncError(StorageFile logFile) throws IOException", " {", " boolean hasJvmSyncError = false;", " StorageRandomAccessFile rwsTest;", "", " // Normally this log file already exists but in case it does", " // not we open the file using \"rw\" mode. This is needed in", " // order to ensure that the file already exists when it is", " // opened in \"rws\" mode. This should succeed on all JVMs", " rwsTest = privRandomAccessFile(logFile, \"rw\");", " rwsTest.close();", "", " // Try to re-open the file in \"rws\" mode", " try{", " rwsTest = privRandomAccessFile(logFile, \"rws\");", " rwsTest.close();", " }", " catch (FileNotFoundException ex) {", " // Normally this exception should never occur. For some", " // reason currently on some Mac and FreeBSD JVM 1.4.2 and", " // 1.5 FileNotFoundException exception is thrown if a file", " // is opened in \"rws\" mode and if it already", " // exists. Please refer to DERBY-1 for more details on", " // this issue. Temporary workaround to avoid this problem", " // is to make the logging system use file sync mechanism.", " logErrMsg(\"LogToFile.checkJvmSyncError: Your JVM seems to have a \" +", " \"problem with implicit syncing of log files. Will use \" +", " \"explicit syncing instead.\");", "", " hasJvmSyncError = true;", " }", "", " // Set this variable to true to avoid that this method is called", " // multiple times", " jvmSyncErrorChecked = true;", "", " return hasJvmSyncError;", " }", "", "" ], "header": "@@ -5036,6 +5039,68 @@ public final class LogToFile implements LogFactory, ModuleControl, ModuleSupport", "removed": [] } ] } ]
derby-DERBY-2021-16c6f358
DERBY-2021 Fix DataSourceProperties and SURQueryMixTest to runs tests in client and embedded as needed. Fix DataSourceProperties to actually run some tests. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@470476 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2021-283931ee
DERBY-2021 (partial) Change ProcedureTest.suite() to run tests embedded and client. Cleanup the creation of tables and procedures to use the decorateSQL method of CleanDatabaseTestSetup rather than a test specific way to drop objects. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@470233 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2021-4f37d7ca
DERBY-2021 Fix ConcurrencyTest to run embedded and client. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@470492 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2021-a708311a
DERBY-2021 Fix SURTest.suite() to run client & embedded. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@470418 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2021-bbdb3fd9
DERBY-2021 (partial) Fix UpdateXXXTest and ResultSetCloseTest suite() methods to run in client as well. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@470221 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2023-8ed08b20
DERBY-2023 DERBY-2047 Add JUnit utility class J2EEDataSource to return XA and ConnectionPooling data source implementations. Split out from JDBCDataSource to ensure no class not found exceptions when running in JSR169. Changed JUnit tests using the old harness class TestDataSourceFactory to use the J2EEDataSource and/or JDBCDataSource. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@472228 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/junit/J2EEDataSource.java", "hunks": [ { "added": [ "/*", " *", " * Derby - Class org.apache.derbyTesting.junit.JDBCDataSource", " *", " * Licensed to the Apache Software Foundation (ASF) under one or more", " * contributor license agreements. See the NOTICE file distributed with", " * this work for additional information regarding copyright ownership.", " * The ASF licenses this file to You under the Apache License, Version 2.0", " * (the \"License\"); you may not use this file except in compliance with", " * the License. You may obtain a copy of the License at", " *", " * http://www.apache.org/licenses/LICENSE-2.0", " *", " * Unless required by applicable law or agreed to in writing, ", " * software distributed under the License is distributed on an ", " * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, ", " * either express or implied. See the License for the specific ", " * language governing permissions and limitations under the License.", " */", "package org.apache.derbyTesting.junit;", "", "import java.util.HashMap;", "", "import javax.sql.ConnectionPoolDataSource;", "import javax.sql.XADataSource;", "", "/**", " * Utility methods related to J2EE JDBC DataSource objects.", " * Separated out from JDBCDataSource to ensure that no", " * ClassNotFoundExceptions are thrown with JSR169.", " *", " */", "public class J2EEDataSource {", " ", " /**", " * Return a DataSource corresponding to the current", " * configuration. The getPooledConnection() method is configured", " * to use the user name and password from the configuration.", " */", " public static javax.sql.ConnectionPoolDataSource getConnectionPoolDataSource()", " {", " return getConnectionPoolDataSource(TestConfiguration.getCurrent(), (HashMap) null);", " }", " /**", " * Create a new DataSource object setup from the passed in TestConfiguration.", " * The getPooledConnection() method is configured", " * to use the user name and password from the configuration.", " */", " static ConnectionPoolDataSource getConnectionPoolDataSource(", " TestConfiguration config,", " HashMap beanProperties)", " {", " if (beanProperties == null)", " beanProperties = JDBCDataSource.getDataSourceProperties(config);", " ", " String dataSourceClass = config.getJDBCClient().getConnectionPoolDataSourceClassName();", " ", " return (ConnectionPoolDataSource) JDBCDataSource.getDataSourceObject(", " dataSourceClass, beanProperties);", " }", " ", " /**", " * Return an XA DataSource corresponding to the current", " * configuration. The getXAConnection() method is configured", " * to use the user name and password from the configuration.", " */", " public static XADataSource getXADataSource()", " {", " return getXADataSource(TestConfiguration.getCurrent(), (HashMap) null);", " }", " /**", " * Create a new DataSource object setup from the passed in TestConfiguration.", " * The getXAConnection() method is configured", " * to use the user name and password from the configuration.", " */", " static XADataSource getXADataSource(TestConfiguration config,", " HashMap beanProperties)", " {", " if (beanProperties == null)", " beanProperties = JDBCDataSource.getDataSourceProperties(config);", " ", " String dataSourceClass = config.getJDBCClient().getXADataSourceClassName();", " ", " return (XADataSource) JDBCDataSource.getDataSourceObject(", " dataSourceClass, beanProperties);", " }", "}" ], "header": "@@ -0,0 +1,87 @@", "removed": [] } ] } ]
derby-DERBY-2023-ec5ae26d
DERBY-2023: Ensure all tests called by jdbc40._Suite run in embedded and client as required The attached patch (derby-2023.diff) makes most of the tests in jdbc4._Suite run in client and embedded. The exceptions are - ClosedObjectTest - StatementEventsTest - XA40Test - UnsupportedVetter - DataSourceTest These tests can only run in embedded mode until DERBY-2047 has been fixed, and I have added a note about it in their suite() methods. jdbc4._Suite is removed from jdbc40.runall. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@472016 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2026-67f6bb01
DERBY-2026 Setting a login timeout in client driver can lead to query timeout git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@986689 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/client/org/apache/derby/client/net/NetConnection.java", "hunks": [ { "added": [ " //DERBY-2026. reset timeout after connection is made", " netAgent_.setTimeout(0);" ], "header": "@@ -218,6 +218,8 @@ public class NetConnection extends org.apache.derby.client.am.Connection {", "removed": [] }, { "added": [ " if(!isConnectionNull()) {", " }", " // DERBY-2026", " //reset timeout if previously set for login timeout", " netAgent_.setTimeout(0);", " " ], "header": "@@ -304,14 +306,19 @@ public class NetConnection extends org.apache.derby.client.am.Connection {", "removed": [ " if(!isConnectionNull())" ] } ] } ]
derby-DERBY-2026-73863c93
DERBY-2026 Setting a login timeout in client driver can lead to query timeout Change tests to set loginTimeout to 0 after test completes, so later tests won't be impacted. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@986834 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2031-463fe167
DERBY-2031: Convert derbynet/testProtocol.java to JUnit. Enabled the ProtocolTest JUnit test. It can be run as part of the package private test suite; ant junit-pptesting Patch file: derby-2031-3b-enable_test.diff git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@672770 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/junit/SecurityManagerSetup.java", "hunks": [ { "added": [ " * <BR>", " * derbyTesting.ppcodeclasses set to URL of the 'classes.pptesting' folder", " * if it exists on the classpath. The existence of the package private tests", " * is determined via org.apache.derby.PackagePrivateTestSuite" ], "header": "@@ -234,6 +234,10 @@ public final class SecurityManagerSetup extends TestSetup {", "removed": [] }, { "added": [ " URL ppTesting = getURL(\"org.apache.derby.PackagePrivateTestSuite\");", " // ppTesting can be null, for instance if 'classes.pptesting' is", " // not on the classpath.", " if (ppTesting != null) {", " classPathSet.setProperty(\"derbyTesting.ppcodeclasses\",", " ppTesting.toExternalForm());", " }" ], "header": "@@ -287,11 +291,18 @@ public final class SecurityManagerSetup extends TestSetup {", "removed": [] } ] } ]
derby-DERBY-2031-816270f3
DERBY-4746: Server support for UTF8 in DRDA This patch was contributed by Tiago R. Espinha (tiago dot derby at yahoo dot co dot uk) The code portion of this change puts in place all the switches necessary on the server-side to enable and disable UTF8 support. Principally, the new internal methods switchToUtf8() and switchToEbcdic() are added to DRDAConnThread, and called appropriately from the ACCSEC code point. The test portion of this change contains the protocol tests and changes to the framework required for the UTF8 protocol tests. The test changes implement the command 'switchToUtf8CcsidManager' in the protocol tests that essentially tells the framework to switch its DDMWriter and Reader to UTF8. Normally, a client would negotiate this through the MGRLVLS but the ProtocolTest doesn't take this into consideration and has to be forced into UTF8 mode. Note that due to DERBY-2031, each time we add a feature to the JUnit protocol test we have to do the same for the other or it'll break. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@980800 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/drda/org/apache/derby/impl/drda/AppRequester.java", "hunks": [ { "added": [ "\t\t\t\t\t\t\t\t\t\t\t1208, // UNICODEMGR" ], "header": "@@ -52,6 +52,7 @@ class AppRequester", "removed": [] } ] }, { "file": "java/drda/org/apache/derby/impl/drda/CodePoint.java", "hunks": [ { "added": [ "\t// UNICODE Manager. Min. level 0.", "\t// Provides character encoding of the DDM objects and parameters", "\tstatic final int UNICODEMGR = 0x1C08;", "\t" ], "header": "@@ -163,6 +163,10 @@ class CodePoint", "removed": [] } ] }, { "file": "java/drda/org/apache/derby/impl/drda/DRDAConnThread.java", "hunks": [ { "added": [ "\t\t\t\t\t", "\t\t\t\t\t/* ACCSECRD is the last reply that is mandatorily in EBCDIC */", "\t\t\t\t\tif (appRequester.supportsUtf8Ccsid()) {", "\t\t\t\t\t switchToUtf8();", "\t\t\t\t\t} else {", "\t\t\t\t\t /* This thread might serve several requests.", "\t\t\t\t\t * Revert if not supported by current client. */", "\t\t\t\t\t switchToEbcdic();", "\t\t\t\t\t}" ], "header": "@@ -953,6 +953,15 @@ class DRDAConnThread extends Thread {", "removed": [] } ] }, { "file": "java/drda/org/apache/derby/impl/drda/TestProto.java", "hunks": [ { "added": [ " private static final int SWITCH_TO_UTF8_CCSID_MANAGER = 58;", " private static final int DELETE_DATABASE = 59;", "\t", "\t// Replaces %UTF8TestString% in protocol.tests", " private static final String UTF8_TEST_MATCH = \"%UTF8TestString%\";", " private static final String UTF8_TEST_STRING = \"\\u4f60\\u597d\\u4e16\\u754cABCDEFGHIJKLMNOPQ\";", " " ], "header": "@@ -110,10 +110,17 @@ public class TestProto {", "removed": [] }, { "added": [ " commandTable.put(\"switchtoutf8ccsidmanager\", new Integer(SWITCH_TO_UTF8_CCSID_MANAGER));", "\t\tcommandTable.put(\"deletedatabase\", new Integer(DELETE_DATABASE));", " " ], "header": "@@ -326,7 +333,9 @@ public class TestProto {", "removed": [ "\t\t" ] }, { "added": [ "\t\t\tcase SWITCH_TO_UTF8_CCSID_MANAGER:", "\t\t\t writer.setUtf8Ccsid();", "\t\t\t reader.setUtf8Ccsid();", "\t\t\t break;", "\t\t\tcase DELETE_DATABASE:", "\t\t\t getString(); //NO-OP - automatic cleanup for TestProto", "\t\t\t break;" ], "header": "@@ -516,6 +525,13 @@ public class TestProto {", "removed": [] } ] }, { "file": "java/testing/org/apache/derbyTesting/functionTests/util/ProtocolTestGrammar.java", "hunks": [ { "added": [ " READ_SECMEC_AND_SECCHKCD,", " SWITCH_TO_UTF8_CCSID_MANAGER,", " DELETE_DATABASE;" ], "header": "@@ -87,7 +87,9 @@ public enum ProtocolTestGrammar {", "removed": [ " READ_SECMEC_AND_SECCHKCD;" ] } ] } ]
derby-DERBY-2031-bbbeea75
DERBY-2031: Convert derbynet/testProtocol.java to JUnit. Close opened readers/streams (caused failure on Windows). Patch file: derby-2031-4a-close_streams.diff git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@681302 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2031-bec8b0d6
DERBY-2031: Convert derbynet/testProtocol.java to JUnit Removed the package-private version of the test. This used to be run as 'ant junit-pptesting'. Patch file: derby-2031-6a-pptesting_removal.diff git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1300285 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derby/impl/drda/_Suite.java", "hunks": [ { "added": [], "header": "@@ -1,53 +0,0 @@", "removed": [ "/*", "", " Derby - Class org.apache.derby.impl.drda._Suite", "", " Licensed to the Apache Software Foundation (ASF) under one", " or more contributor license agreements. See the NOTICE file", " distributed with this work for additional information", " regarding copyright ownership. The ASF licenses this file", " to you under the Apache License, Version 2.0 (the", " \"License\"); you may not use this file except in compliance", " with the License. You may obtain a copy of the License at", "", " http://www.apache.org/licenses/LICENSE-2.0", "", " Unless required by applicable law or agreed to in writing,", " software distributed under the License is distributed on an", " \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY", " KIND, either express or implied. See the License for the", " specific language governing permissions and limitations", " under the License.", "", " */", "package org.apache.derby.impl.drda;", "", "import org.apache.derbyTesting.junit.BaseTestCase;", "import org.apache.derbyTesting.junit.Derby;", "", "import junit.framework.Test;", "import junit.framework.TestSuite;", "", "public class _Suite", " extends BaseTestCase {", "", " /**", " * Use suite method instead.", " */", " private _Suite(String name) {", " super(name);", " }", "", " public static Test suite()", " throws Exception {", "", " TestSuite suite = new TestSuite(\"impl.drda package-private\");", "", " // Add tests that explicitly require the network server.", " if (Derby.hasServer()) {", " suite.addTest(ProtocolTest.suite());", " }", "", " return suite;", " }", "} // End class _Suite" ] } ] } ]
derby-DERBY-2032-b9989a85
DERBY-2032 Convert MathTrigFunctionsTest to use PreparedStatements instead of many compiled Statements and thus reduce execution time from eighty seconds to around ten seconds. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@470463 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2036-cef7d1e0
DERBY-2036 DERBY-2043 DERBY-2047 (partial) Re-work connection handling in JUnit tests. Create connection factory Connector with two implementations, DataSourceConnector and DriverManagerConnector. This ensures that running tests does not attempt to load DriverManager when running tests with JSR169. Ensure DataSource implementation sets user name and password from configuration for the getConnection() method to ensure the ChangerUserTestSetup works. Refactor the setting of data source Java bean properties to be from a HashMap rather than a Properties object to ensure that no special code exists at the lowest level to deal with different property types. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@472187 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/junit/JDBCClient.java", "hunks": [ { "added": [ "import junit.framework.Assert;", "" ], "header": "@@ -19,6 +19,8 @@", "removed": [] }, { "added": [ " private static final JDBCClient EMBEDDED_30= new JDBCClient(", " \"Embedded_30\", ", " \"org.apache.derby.jdbc.EmbeddedConnectionPoolDataSource\",", " \"org.apache.derby.jdbc.EmbeddedXADataSource\",", " \"jdbc:derby:\");", " ", " /**", " * The embedded JDBC client for JDBC 4.0.", " */", " private static final JDBCClient EMBEDDED_40 = new JDBCClient(", " \"Embedded_40\", ", " \"org.apache.derby.jdbc.EmbeddedDriver\", ", " \"org.apache.derby.jdbc.EmbeddedDataSource40\", ", " \"org.apache.derby.jdbc.EmbeddedConnectionPoolDataSource40\",", " \"org.apache.derby.jdbc.EmbeddedXADataSource40\",", " /**", " * The embedded JDBC client for JSR 169", " */", " private static final JDBCClient EMBEDDED_169 = new JDBCClient(", " \"Embedded_169\", ", " null, // No driver", " \"org.apache.derby.jdbc.EmbeddedSimpleDataSource\", ", " null, // No connection pooling", " null, // No XA", " null); // No JDBC URLs", " ", " /**", " * Get the default embedded client for this JVM.", " * @return", " */", " static JDBCClient getDefaultEmbedded()", " {", " if (JDBC.vmSupportsJDBC4())", " return EMBEDDED_40;", " if (JDBC.vmSupportsJDBC2())", " return EMBEDDED_30;", " if (JDBC.vmSupportsJSR169())", " return EMBEDDED_169;", " ", " Assert.fail(\"Unknown JVM environment\");", " return null;", " }", " ", " JDBC.vmSupportsJDBC4() ?", " \"org.apache.derby.jdbc.ClientDataSource40\" :", " JDBC.vmSupportsJDBC4() ?", " \"org.apache.derby.jdbc.ClientConnectionPoolDataSource40\" :", " \"org.apache.derby.jdbc.ClientConnectionPoolDataSource\",", " JDBC.vmSupportsJDBC4() ?", " \"org.apache.derby.jdbc.ClientXADataSource40\" :", " \"org.apache.derby.jdbc.ClientXADataSource\"," ], "header": "@@ -29,19 +31,68 @@ public final class JDBCClient {", "removed": [ " static final JDBCClient EMBEDDED = new JDBCClient(", " \"Embedded\", " ] }, { "added": [ " null, null, null," ], "header": "@@ -52,7 +103,7 @@ public final class JDBCClient {", "removed": [ " null," ] }, { "added": [ " \treturn getName().startsWith(\"Embedded\");" ], "header": "@@ -60,7 +111,7 @@ public final class JDBCClient {", "removed": [ " \treturn getName().equals(EMBEDDED.getName());" ] }, { "added": [ " /**", " * Get ConnectionPoolDataSource class name.", " *", " * @return class name for ConnectionPoolDataSource implementation.", " */", " public String getConnectionPoolDataSourceClassName() {", " return poolDsClassName;", " }", "", " /**", " * Get XADataSource class name.", " *", " * @return class name for XADataSource implementation.", " */", " public String getXADataSourceClassName() {", " return xaDsClassName;", " }", "" ], "header": "@@ -105,6 +156,24 @@ public final class JDBCClient {", "removed": [] } ] }, { "file": "java/testing/org/apache/derbyTesting/junit/TestConfiguration.java", "hunks": [ { "added": [ " this.jdbcClient = JDBCClient.getDefaultEmbedded();", " initConnector();" ], "header": "@@ -344,8 +344,9 @@ public class TestConfiguration {", "removed": [ " this.jdbcClient = JDBCClient.EMBEDDED;" ] }, { "added": [ " initConnector();" ], "header": "@@ -364,6 +365,7 @@ public class TestConfiguration {", "removed": [] }, { "added": [ " initConnector();" ], "header": "@@ -388,6 +390,7 @@ public class TestConfiguration {", "removed": [] }, { "added": [ " initConnector();" ], "header": "@@ -409,6 +412,7 @@ public class TestConfiguration {", "removed": [] }, { "added": [ " jdbcClient = JDBCClient.getDefaultEmbedded();", " initConnector();" ], "header": "@@ -447,9 +451,10 @@ public class TestConfiguration {", "removed": [ " jdbcClient = JDBCClient.EMBEDDED;" ] }, { "added": [ " if (JDBC.vmSupportsJDBC2())", " {", " if (jdbcClient.isEmbedded()) {", " return jdbcClient.getUrlBase() + name;", " } else {", " return jdbcClient.getUrlBase() + hostName + \":\" + port + \"/\" + name;", " }", " }", " // No DriverManager support so no URL support.", " return null;", " }", " ", " /**", " * Initialize the connection factory.", " * Defaults to the DriverManager implementation", " * if running JDBC 2.0 or higher, otherwise a", " * DataSource implementation for JSR 169.", " *", " */", " private void initConnector()", " {", " if (JDBC.vmSupportsJDBC2())", " {", " try {", " connector = (Connector) Class.forName(", " \"org.apache.derbyTesting.junit.DriverManagerConnector\").newInstance();", " } catch (Exception e) {", " Assert.fail(e.getMessage());", " }", " ", " connector = new DataSourceConnector();", " connector.setConfiguration(this);" ], "header": "@@ -474,11 +479,40 @@ public class TestConfiguration {", "removed": [ " if (jdbcClient == JDBCClient.EMBEDDED) {", " return jdbcClient.getUrlBase() + name;", " return jdbcClient.getUrlBase() + hostName + \":\" + port + \"/\" + name;" ] }, { "added": [ " return connector.openConnection();" ], "header": "@@ -564,7 +598,7 @@ public class TestConfiguration {", "removed": [ " return getDefaultConnection(\"create=true\");" ] }, { "added": [], "header": "@@ -580,19 +614,6 @@ public class TestConfiguration {", "removed": [ " /**", " * Get a connection to the default database using the specified connection", " * attributes.", " * ", " * @param connAttrs connection attributes", " * @return connection to database.", " * @throws SQLException", " */", " private Connection getDefaultConnection(String connAttrs)", " throws SQLException {", " return getConnection(getDatabaseName(), connAttrs);", " }", " " ] }, { "added": [ " connector.shutDatabase();" ], "header": "@@ -637,7 +658,7 @@ public class TestConfiguration {", "removed": [ " getDefaultConnection(\"shutdown=true\");" ] }, { "added": [ " connector.shutEngine();" ], "header": "@@ -652,7 +673,7 @@ public class TestConfiguration {", "removed": [ " getConnection(\"\", \"shutdown=true\");" ] }, { "added": [ " /**", " * Indirection for obtaining connections based upon", " * this configuration.", " */", " private Connector connector;", " " ], "header": "@@ -772,6 +793,12 @@ public class TestConfiguration {", "removed": [] }, { "added": [ " if (!getCurrent().getJDBCClient().isEmbedded()) {" ], "header": "@@ -800,7 +827,7 @@ public class TestConfiguration {", "removed": [ " if (!(getCurrent().getJDBCClient() == JDBCClient.EMBEDDED)) {" ] } ] } ]
derby-DERBY-2040-2b7530f1
DERBY-2040 (partial) Change the api for jarReader to return the StorageFile rather than the (potentially) opened jar. Removes the possibility for user code to access the jar by calling methods of JarReader directly (and hence abusing any privileged blocks that would be required while opening the jar). Cleans up JarLoader by having explict calls to open the stream or file within the class loader. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@486201 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/services/loader/JarReader.java", "hunks": [ { "added": [ "import org.apache.derby.io.StorageFile;" ], "header": "@@ -22,6 +22,7 @@", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/db/BasicDatabase.java", "hunks": [ { "added": [ "\tpublic StorageFile getJarFile(String schemaName, String sqlName)" ], "header": "@@ -790,7 +790,7 @@ public class BasicDatabase implements ModuleControl, ModuleSupportable, Property", "removed": [ "\tpublic Object readJarFile(String schemaName, String sqlName)" ] } ] }, { "file": "java/engine/org/apache/derby/impl/services/reflect/JarLoader.java", "hunks": [ { "added": [ "import java.io.FileNotFoundException;" ], "header": "@@ -26,6 +26,7 @@ import org.apache.derby.iapi.error.StandardException;", "removed": [] }, { "added": [ "import org.apache.derby.io.StorageFile;" ], "header": "@@ -43,6 +44,7 @@ import org.apache.derby.iapi.util.IdUtil;", "removed": [] }, { "added": [ " /**", " * Handle to the installed jar file.", " */", " private StorageFile installedJar;", " " ], "header": "@@ -52,6 +54,11 @@ class JarLoader extends ClassLoader {", "removed": [] }, { "added": [ "\t/**", "\t * Initialize the class loader so it knows if it", "\t * is loading from a ZipFile or an InputStream", "\t */", "\t\tString schemaName = name[IdUtil.DBCP_SCHEMA_NAME];", "\t\tString sqlName = name[IdUtil.DBCP_SQL_JAR_NAME];", "\t\tException e;", "\t\t\tinstalledJar =", "\t\t\t\tupdateLoader.getJarReader().getJarFile(", "\t\t\t\t\tschemaName, sqlName);", "\t\t\tif (installedJar instanceof File) {", "\t\t\t\tjar = new JarFile((File) installedJar);", "\t\t\t// Jar is only accessible as an InputStream,", "\t\t\t// which means we need to re-open the stream for", "\t\t\t// each access.", "", "\t\t\tisStream = true;", "\t\t\treturn;", "", "\t\t\te = ioe;", "\t\t} catch (StandardException se) {", "\t\t\te = se;", "\t\tif (vs != null)", "\t\t\tvs.println(MessageService.getTextMessage(", "\t\t\t\t\tMessageId.CM_LOAD_JAR_EXCEPTION, getJarName(), e));", "", "\t\tsetInvalid();", "\t * Handle all requests to the top-level loader.", "\t * ", "\t * @exception ClassNotFoundException", "\t * Class can not be found", "\t */" ], "header": "@@ -77,45 +84,53 @@ class JarLoader extends ClassLoader {", "removed": [ "\t// Initialize the class loader so it knows if it", "\t// is loading from a ZipFile or an InputStream", "\t\tObject zipData = load();", "\t\t\tif (zipData instanceof File) {", " jar = new JarFile((File) zipData);", " // Jar is only accessible as an INputStream,", " // which means we need to re-open the stream for", " // each access. Thus we close the stream now as we have", " // no further use for it.", "\t\t\tif (zipData instanceof InputStream) {", "\t\t\t\tisStream = true;", "\t\t\t\ttry {", "\t\t\t\t\t((InputStream) zipData).close();", "\t\t\t\t} catch (IOException ioe) {", "\t\t\t\t}", "\t\t\t\treturn;", "\t\t\t}", "\t\t\tif (vs != null)", "\t\t\t\tvs.println(MessageService.getTextMessage(MessageId.CM_LOAD_JAR_EXCEPTION, getJarName(), ioe));", "\t\tsetInvalid();\t", "\t\tHandle all requests to the top-level loader.", "", "\t\t@exception ClassNotFoundException Class can not be found", "\t*/" ] }, { "added": [ "\t\t\t\treturn loadClassData(installedJar.getInputStream(),", "\t\t\treturn null;", "\t\t} catch (FileNotFoundException fnfe) {", "\t\t\t// No such entry." ], "header": "@@ -164,10 +179,13 @@ class JarLoader extends ClassLoader {", "removed": [ "\t\t\t\treturn loadClassData((InputStream) load()," ] }, { "added": [ "\t\t\ttry {", "\t\t\t\treturn getRawStream(installedJar.getInputStream(), name);", "\t\t\t} catch (FileNotFoundException e) {", "\t\t\t\t// no such entry", "\t\t\t}" ], "header": "@@ -188,7 +206,11 @@ class JarLoader extends ClassLoader {", "removed": [ "\t\t\treturn getRawStream((InputStream) load(), name);" ] }, { "added": [], "header": "@@ -287,24 +309,6 @@ class JarLoader extends ClassLoader {", "removed": [ "\tprivate Object load() {", "", "\t\tString[] dbJarName = name;", "", "\t\tString schemaName = dbJarName[IdUtil.DBCP_SCHEMA_NAME];", "\t\tString sqlName = dbJarName[IdUtil.DBCP_SQL_JAR_NAME];", "", "\t\t// don't need a connection, just call the code directly", "\t\ttry {", "\t\t\treturn updateLoader.getJarReader().readJarFile(schemaName, sqlName);", "\t\t} catch (StandardException se) {", "\t\t\tif (vs != null)", "\t\t\t\tvs.println(MessageService.getTextMessage(MessageId.CM_LOAD_JAR_EXCEPTION, getJarName(), se));", "\t\t\treturn null;", "\t\t}", "", "\t}", "" ] } ] } ]
derby-DERBY-2040-420f9d68
DERBY-2040 (partial) Create the class loaders (JarLoader instances) for database class loading within a privileged block. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@473387 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/services/reflect/UpdateLoader.java", "hunks": [ { "added": [ "import java.security.AccessController;", "class UpdateLoader {" ], "header": "@@ -40,12 +40,13 @@ import org.apache.derby.iapi.services.property.PropertyUtil;", "removed": [ "public class UpdateLoader {" ] }, { "added": [ "\tUpdateLoader(String classpath, DatabaseClasses parent, boolean verbose, boolean normalizeToUpper) " ], "header": "@@ -61,7 +62,7 @@ public class UpdateLoader {", "removed": [ "\tpublic UpdateLoader(String classpath, DatabaseClasses parent, boolean verbose, boolean normalizeToUpper) " ] }, { "added": [ "\t\tfinal String[][] elements = IdUtil.parseDbClassPath(classpath, normalizeToUpper);", "\t\tfinal int jarCount = elements.length;", " if (jarCount != 0) {", " // Creating class loaders is a restricted operation", " // so we need to use a privileged block.", " AccessController.doPrivileged", " (new java.security.PrivilegedAction(){", " ", " public Object run(){ ", " \t\t for (int i = 0; i < jarCount; i++) {", " \t\t\t jarList[i] = new JarLoader(UpdateLoader.this, elements[i], vs);", " \t\t }", " return null;", " }", " });", " }" ], "header": "@@ -81,15 +82,25 @@ public class UpdateLoader {", "removed": [ "\t\tString[][] elements = IdUtil.parseDbClassPath(classpath, normalizeToUpper);", "\t\tint jarCount = elements.length;", "\t\tfor (int i = 0; i < jarCount; i++) {", "\t\t\tjarList[i] = new JarLoader(this, elements[i], vs);", "\t\t}", "" ] }, { "added": [ "\tClass loadClass(String className, boolean resolve) " ], "header": "@@ -103,7 +114,7 @@ public class UpdateLoader {", "removed": [ "\tpublic Class loadClass(String className, boolean resolve) " ] }, { "added": [ "\tInputStream getResourceAsStream(String name) {" ], "header": "@@ -154,7 +165,7 @@ public class UpdateLoader {", "removed": [ "\tpublic InputStream getResourceAsStream(String name) {" ] }, { "added": [ "\tsynchronized void modifyClasspath(String classpath)" ], "header": "@@ -201,7 +212,7 @@ public class UpdateLoader {", "removed": [ "\tpublic synchronized void modifyClasspath(String classpath)" ] }, { "added": [ "\tsynchronized void modifyJar(boolean reload) throws StandardException {" ], "header": "@@ -214,7 +225,7 @@ public class UpdateLoader {", "removed": [ "\tpublic synchronized void modifyJar(boolean reload) throws StandardException {" ] }, { "added": [ "\tvoid close() {" ], "header": "@@ -278,7 +289,7 @@ public class UpdateLoader {", "removed": [ "\tpublic void close() {" ] }, { "added": [ "\tint getClassLoaderVersion() {" ], "header": "@@ -297,7 +308,7 @@ public class UpdateLoader {", "removed": [ "\tpublic int getClassLoaderVersion() {" ] } ] } ]
derby-DERBY-2040-fb934605
DERBY-538 DERBY-2040 Remove the FileResource.getAsStream method as the getAsFile() method now returns a StorageFile and that class has a getInputStream method. Incremental step in pushing the JarClassLoader to work off URLs for the jar files and thus allow use of the standard java.net.URLClassLoader. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@484722 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/db/BasicDatabase.java", "hunks": [ { "added": [ "import org.apache.derby.io.StorageFile;" ], "header": "@@ -70,6 +70,7 @@ import org.apache.derby.iapi.services.property.PropertySetCallback;", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/store/raw/data/RFResource.java", "hunks": [ { "added": [ "import java.io.IOException;", "import java.io.InputStream;", "import java.io.OutputStream;", "import java.security.AccessController;", "import java.security.PrivilegedActionException;", "import java.security.PrivilegedExceptionAction;", "import org.apache.derby.iapi.error.StandardException;", "import org.apache.derby.iapi.reference.SQLState;", "import org.apache.derby.iapi.services.context.ContextService;", "import org.apache.derby.iapi.store.access.FileResource;" ], "header": "@@ -21,32 +21,22 @@", "removed": [ "import org.apache.derby.iapi.reference.SQLState;", "import org.apache.derby.iapi.services.context.ContextService;", "import org.apache.derby.iapi.services.sanity.SanityManager;", "import org.apache.derby.iapi.error.StandardException;", "import org.apache.derby.iapi.store.access.FileResource;", "import org.apache.derby.iapi.store.raw.Transaction;", "import org.apache.derby.iapi.store.access.DatabaseInstant;", "", "import org.apache.derby.io.StorageFactory;", "import org.apache.derby.io.WritableStorageFactory;", "import org.apache.derby.io.StorageRandomAccessFile;", "", "import java.io.InputStream;", "import java.io.OutputStream;", "import java.io.FileNotFoundException;", "import java.io.IOException;", "import java.security.AccessController;", "import java.security.PrivilegedAction;", "import java.security.PrivilegedActionException;", "import java.security.PrivilegedExceptionAction;" ] }, { "added": [], "header": "@@ -210,16 +200,6 @@ class RFResource implements FileResource {", "removed": [ "\t/**", "\t @see FileResource#getAsStream", "\t @exception IOException trouble accessing file.", "\t */", "\tpublic InputStream getAsStream(String name, long generationId) ", "\t\t throws IOException", "\t{", " return getAsFile(name, generationId).getInputStream();", "\t}", "" ] } ] } ]
derby-DERBY-2041-23362a43
DERBY-2041: Trigger should register a dependency on tables and columns used in its body Add an upgrade test to verify how the dependencies are handled after upgrade and downgrade. Skip some cross checking between getColumns() and ResultSetMetaData for views in DatabaseMetaDataTest, since those checks only pass for tables. The upgrade test case adds a view that upsets the meta-data test. (This is the first upgrade test that uses views.) git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1548032 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2041-cc67949e
DERBY-2041: Trigger should register a dependency on tables and columns used in its body git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1545179 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/sql/dictionary/TriggerDescriptor.java", "hunks": [ { "added": [ " ** We are dependent on the underlying table, our SPSs, any tables", " ** or other SQL objects that are referenced from the trigger, and" ], "header": "@@ -773,7 +773,8 @@ public class TriggerDescriptor extends UniqueSQLObjectDescriptor", "removed": [ "\t\t\t** We are only dependent on the underlying table, and our spses and " ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/CreateTriggerNode.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.sql.depend.DependencyManager;", "import org.apache.derby.iapi.sql.depend.ProviderInfo;", "import org.apache.derby.iapi.sql.depend.ProviderList;" ], "header": "@@ -36,6 +36,9 @@ import org.apache.derby.iapi.sql.compile.CompilerContext;", "removed": [] }, { "added": [ " private ProviderInfo[] providerInfo;" ], "header": "@@ -69,6 +72,7 @@ class CreateTriggerNode extends DDLStatementNode", "removed": [] }, { "added": [ " ProviderList prevAPL =", " compilerContext.getCurrentAuxiliaryProviderList();", " ProviderList apl = new ProviderList();", "", " compilerContext.setCurrentAuxiliaryProviderList(apl);", "" ], "header": "@@ -370,9 +374,15 @@ class CreateTriggerNode extends DDLStatementNode", "removed": [] }, { "added": [ " compilerContext.setCurrentAuxiliaryProviderList(prevAPL);" ], "header": "@@ -406,6 +416,7 @@ class CreateTriggerNode extends DDLStatementNode", "removed": [] }, { "added": [ "", " DependencyManager dm = dd.getDependencyManager();", " providerInfo = dm.getPersistentProviderInfos(apl);", " dm.clearColumnInfoInProviders(apl);", "" ], "header": "@@ -445,6 +456,11 @@ class CreateTriggerNode extends DDLStatementNode", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/CreateTriggerConstantAction.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.sql.depend.Provider;", "import org.apache.derby.iapi.sql.depend.ProviderInfo;" ], "header": "@@ -34,19 +34,15 @@ import org.apache.derby.iapi.sql.dictionary.SPSDescriptor;", "removed": [ "import org.apache.derby.iapi.types.DataValueFactory;", "", "", "import org.apache.derby.iapi.sql.execute.ExecutionFactory;", "import org.apache.derby.iapi.services.context.ContextService;", "" ] }, { "added": [ " private final ProviderInfo[] providerInfo;" ], "header": "@@ -83,6 +79,7 @@ class CreateTriggerConstantAction extends DDLSingleTableConstantAction", "removed": [] }, { "added": [ " * @param providerInfo array of providers that the trigger depends on" ], "header": "@@ -115,6 +112,7 @@ class CreateTriggerConstantAction extends DDLSingleTableConstantAction", "removed": [] }, { "added": [ " String newReferencingName,", " ProviderInfo[] providerInfo" ], "header": "@@ -138,7 +136,8 @@ class CreateTriggerConstantAction extends DDLSingleTableConstantAction", "removed": [ "\t\tString\t\t\t\tnewReferencingName" ] }, { "added": [ " this.providerInfo = providerInfo;" ], "header": "@@ -163,6 +162,7 @@ class CreateTriggerConstantAction extends DDLSingleTableConstantAction", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/GenericConstantActionFactory.java", "hunks": [ { "added": [ " * @param providerInfo array of providers that the trigger depends on" ], "header": "@@ -1002,6 +1002,7 @@ public class GenericConstantActionFactory", "removed": [] }, { "added": [ " String newReferencingName,", " ProviderInfo[] providerInfo" ], "header": "@@ -1025,7 +1026,8 @@ public class GenericConstantActionFactory", "removed": [ "\t\tString\t\t\t\tnewReferencingName" ] } ] }, { "file": "java/testing/org/apache/derbyTesting/junit/JDBC.java", "hunks": [ { "added": [ "", " // Triggers", " PreparedStatement pstr = conn.prepareStatement(", " \"SELECT TRIGGERNAME FROM SYS.SYSSCHEMAS S, SYS.SYSTRIGGERS T \"", " + \"WHERE S.SCHEMAID = T.SCHEMAID AND SCHEMANAME = ?\");", " pstr.setString(1, schema);", " ResultSet trrs = pstr.executeQuery();", " while (trrs.next()) {", " String trigger = trrs.getString(1);", " s.execute(\"DROP TRIGGER \" + JDBC.escape(schema, trigger));", " }", " trrs.close();", " pstr.close();", "" ], "header": "@@ -300,7 +300,20 @@ public class JDBC {", "removed": [ " " ] } ] } ]
derby-DERBY-2041-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-2047-01fe8675
DERBY-2047 Remove TestDataSourceFactory and clean up associated code. Functionality has been replaced by JDBCDataSource and J2EEDataSource which allows clean separation for JSR169 which does not include the XA and connection pooling data sources. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@473366 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/junit/TestConfiguration.java", "hunks": [ { "added": [], "header": "@@ -32,8 +32,6 @@ import junit.framework.Test;", "removed": [ "import org.apache.derbyTesting.functionTests.util.TestDataSourceFactory;", "" ] }, { "added": [], "header": "@@ -623,48 +621,6 @@ public class TestConfiguration {", "removed": [ " /**", " * Open a connection to a database.", " * If the database does not exist, it will be created.", " * A default username and password will be used for the connection.", " *", " * @param databaseName database to connect to", " *", " * @return connection to database.", " */", " Connection openConnection (String databaseName) throws SQLException {", " return getConnection(databaseName, \"create=true\");", " }", " ", " /**", " * Get a connection to a database using the specified connection ", " * attributes.", " * ", " * @param databaseName database to connect to", " * @param connAttrs connection attributes", " * @return connection to database.", " * @throws SQLException", " */", " private Connection getConnection (String databaseName, String connAttrs) ", " \tthrows SQLException {", " Connection con = null;", " JDBCClient client =getJDBCClient();", " if (JDBC.vmSupportsJDBC2()) { ", " loadJDBCDriver(client.getJDBCDriverName());", " {", " con = DriverManager.getConnection(", " getJDBCUrl(databaseName) + \";\" + connAttrs,", " getUserName(),", " getUserPassword());", " }", " } else {", " //Use DataSource for JSR169", " Properties attrs = getDataSourcePropertiesForDatabase(databaseName, connAttrs);", " con = TestDataSourceFactory.getDataSource(attrs).getConnection();", " }", " return con;", " }", " " ] }, { "added": [], "header": "@@ -807,65 +763,6 @@ public class TestConfiguration {", "removed": [ "", " /**", " * Generate properties which can be set on a", " * <code>DataSource</code> in order to connect to the default", " * database. If the database does not exist, it will be created.", " *", " * @return a <code>Properties</code> object containing server", " * name, port number, database name and other attributes needed to", " * connect to the default database", " */", " public static Properties getDefaultDataSourceProperties() {", " return getDataSourcePropertiesForDatabase(", " getCurrent().getDatabaseName(), \"create=true\");", " }", " ", " /**", " * Generate properties which can be set on a <code>DataSource</code> ", " * in order to connect to a database using the specified connection ", " * attributes.", " * ", " * @param databaseName database to connect to", " * @param connAttrs connection attributes", " * @return", " */", " private static Properties getDataSourcePropertiesForDatabase", " \t(String databaseName, String connAttrs) ", " {", " Properties attrs = new Properties();", " if (!getCurrent().getJDBCClient().isEmbedded()) {", " attrs.setProperty(\"serverName\", getCurrent().getHostName());", " attrs.setProperty(\"portNumber\", Integer.toString(getCurrent().getPort()));", " }", " attrs.setProperty(\"databaseName\", databaseName);", " attrs.setProperty(\"connectionAttributes\", connAttrs);", " return attrs;", " }", "", " /**", " * Load the specified JDBC driver", " *", " * @param driverClass name of the JDBC driver class.", " * @throws SQLException if loading the driver fails.", " */", " private static void loadJDBCDriver(String driverClass) ", " throws SQLException {", " try {", " Class.forName(driverClass).newInstance();", " } catch (ClassNotFoundException cnfe) {", " throw new SQLException(\"Failed to load JDBC driver '\" + ", " driverClass + \"': \" + cnfe.getMessage());", " } catch (IllegalAccessException iae) {", " throw new SQLException(\"Failed to load JDBC driver '\" +", " driverClass + \"': \" + iae.getMessage());", " } catch (InstantiationException ie) {", " throw new SQLException(\"Failed to load JDBC driver '\" +", " driverClass + \"': \" + ie.getMessage());", " }", " }", " " ] } ] } ]
derby-DERBY-2047-3ca3bd45
DERBY-1952 DERBY-2047 Remove the remaining code directly related to derbyTesting.xa.single. This functionality has been replaced with a decorator. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@473079 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/junit/TestConfiguration.java", "hunks": [ { "added": [], "header": "@@ -60,7 +60,6 @@ public class TestConfiguration {", "removed": [ " private final static String KEY_SINGLE_LEG_XA = \"derbyTesting.xa.single\";" ] }, { "added": [], "header": "@@ -114,10 +113,6 @@ public class TestConfiguration {", "removed": [ " ", " // If forced into single leg XA, assume harness", " if (DERBY_HARNESS_CONFIG.isSingleLegXA())", " assumeHarness = true;" ] }, { "added": [ " * and to start the network server at setUp.", " * The previous TestConfiguration is restored at tearDown and", " * the network server is shutdown." ], "header": "@@ -222,13 +217,13 @@ public class TestConfiguration {", "removed": [ " * and to start the network server at setUp if it is not", " * already started.", " * The previous TestConfiguration is restored at tearDown." ] }, { "added": [ " Test test = new NetworkServerTestSetup(suite, false);" ], "header": "@@ -243,7 +238,7 @@ public class TestConfiguration {", "removed": [ " Test test = new NetworkServerTestSetup(suite);" ] }, { "added": [], "header": "@@ -373,7 +368,6 @@ public class TestConfiguration {", "removed": [ " this.singleLegXA = false;" ] }, { "added": [], "header": "@@ -389,7 +383,6 @@ public class TestConfiguration {", "removed": [ " this.singleLegXA = copy.singleLegXA;" ] }, { "added": [], "header": "@@ -414,7 +407,6 @@ public class TestConfiguration {", "removed": [ " this.singleLegXA = copy.singleLegXA;" ] }, { "added": [], "header": "@@ -436,7 +428,6 @@ public class TestConfiguration {", "removed": [ " this.singleLegXA = copy.singleLegXA;" ] }, { "added": [], "header": "@@ -461,8 +452,6 @@ public class TestConfiguration {", "removed": [ " singleLegXA = Boolean.valueOf(props.getProperty(KEY_SINGLE_LEG_XA)", " ).booleanValue();" ] }, { "added": [ " String url;", " url = jdbcClient.getUrlBase();", " url = jdbcClient.getUrlBase() + hostName + \":\" + port + \"/\";", " return url.concat(name);" ], "header": "@@ -512,11 +501,13 @@ public class TestConfiguration {", "removed": [ " return jdbcClient.getUrlBase() + name;", " return jdbcClient.getUrlBase() + hostName + \":\" + port + \"/\" + name;" ] }, { "added": [ " {" ], "header": "@@ -660,19 +651,12 @@ public class TestConfiguration {", "removed": [ " if (!isSingleLegXA()) {", " else {", " Properties attrs = ", " \tgetDataSourcePropertiesForDatabase(databaseName, connAttrs);", " con = TestDataSourceFactory.getXADataSource(attrs).", " getXAConnection (getUserName(), ", " getUserPassword()).getConnection();", " }" ] }, { "added": [ " * This method can only be called when the engine", " * is running embedded in this JVM." ], "header": "@@ -699,6 +683,8 @@ public class TestConfiguration {", "removed": [] }, { "added": [], "header": "@@ -747,14 +733,6 @@ public class TestConfiguration {", "removed": [ "", " /**", " * Return if it has to run under single legged xa transaction", " * @return singleLegXA", " */", " public boolean isSingleLegXA () {", " return singleLegXA;", " }" ] }, { "added": [], "header": "@@ -822,7 +800,6 @@ public class TestConfiguration {", "removed": [ " private final boolean singleLegXA;" ] } ] } ]
derby-DERBY-2047-419724b6
DERBY-2047 (partial) Expose the generic data source (bean) property setting method in JDBCDataSource and change DataSourcePropertiesTest to use it as part of clean up to ensure clean separation between old harness code and JUnit code. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@472707 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/junit/TestConfiguration.java", "hunks": [ { "added": [ " private static Properties getDataSourcePropertiesForDatabase" ], "header": "@@ -823,7 +823,7 @@ public class TestConfiguration {", "removed": [ " public static Properties getDataSourcePropertiesForDatabase" ] } ] } ]
derby-DERBY-2047-45da985a
DERBY-2043 DERBY-2047 (partial) More connection utility method cleanup to provide a single consistent shutdownEngine() method. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@471808 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/junit/TestConfiguration.java", "hunks": [ { "added": [ " private Connection getDefaultConnection(String connAttrs)" ], "header": "@@ -588,7 +588,7 @@ public class TestConfiguration {", "removed": [ " public Connection getDefaultConnection(String connAttrs)" ] }, { "added": [ " private Connection getConnection (String databaseName, String connAttrs) " ], "header": "@@ -602,7 +602,7 @@ public class TestConfiguration {", "removed": [ " public Connection getConnection (String databaseName, String connAttrs) " ] }, { "added": [ " /**", " * Shutdown the engine for this configuration", " * assuming it is booted.", " *", " */", " public void shutdownEngine()", " {", " try {", " getConnection(\"\", \"shutdown=true\");", " Assert.fail(\"Engine failed to shut down\");", " } catch (SQLException e) {", " BaseJDBCTestCase.assertSQLState(\"Engine shutdown\", \"XJ015\", e);", " }", " } " ], "header": "@@ -644,6 +644,20 @@ public class TestConfiguration {", "removed": [] } ] } ]
derby-DERBY-2047-8ed08b20
DERBY-2023 DERBY-2047 Add JUnit utility class J2EEDataSource to return XA and ConnectionPooling data source implementations. Split out from JDBCDataSource to ensure no class not found exceptions when running in JSR169. Changed JUnit tests using the old harness class TestDataSourceFactory to use the J2EEDataSource and/or JDBCDataSource. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@472228 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/junit/J2EEDataSource.java", "hunks": [ { "added": [ "/*", " *", " * Derby - Class org.apache.derbyTesting.junit.JDBCDataSource", " *", " * Licensed to the Apache Software Foundation (ASF) under one or more", " * contributor license agreements. See the NOTICE file distributed with", " * this work for additional information regarding copyright ownership.", " * The ASF licenses this file to You under the Apache License, Version 2.0", " * (the \"License\"); you may not use this file except in compliance with", " * the License. You may obtain a copy of the License at", " *", " * http://www.apache.org/licenses/LICENSE-2.0", " *", " * Unless required by applicable law or agreed to in writing, ", " * software distributed under the License is distributed on an ", " * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, ", " * either express or implied. See the License for the specific ", " * language governing permissions and limitations under the License.", " */", "package org.apache.derbyTesting.junit;", "", "import java.util.HashMap;", "", "import javax.sql.ConnectionPoolDataSource;", "import javax.sql.XADataSource;", "", "/**", " * Utility methods related to J2EE JDBC DataSource objects.", " * Separated out from JDBCDataSource to ensure that no", " * ClassNotFoundExceptions are thrown with JSR169.", " *", " */", "public class J2EEDataSource {", " ", " /**", " * Return a DataSource corresponding to the current", " * configuration. The getPooledConnection() method is configured", " * to use the user name and password from the configuration.", " */", " public static javax.sql.ConnectionPoolDataSource getConnectionPoolDataSource()", " {", " return getConnectionPoolDataSource(TestConfiguration.getCurrent(), (HashMap) null);", " }", " /**", " * Create a new DataSource object setup from the passed in TestConfiguration.", " * The getPooledConnection() method is configured", " * to use the user name and password from the configuration.", " */", " static ConnectionPoolDataSource getConnectionPoolDataSource(", " TestConfiguration config,", " HashMap beanProperties)", " {", " if (beanProperties == null)", " beanProperties = JDBCDataSource.getDataSourceProperties(config);", " ", " String dataSourceClass = config.getJDBCClient().getConnectionPoolDataSourceClassName();", " ", " return (ConnectionPoolDataSource) JDBCDataSource.getDataSourceObject(", " dataSourceClass, beanProperties);", " }", " ", " /**", " * Return an XA DataSource corresponding to the current", " * configuration. The getXAConnection() method is configured", " * to use the user name and password from the configuration.", " */", " public static XADataSource getXADataSource()", " {", " return getXADataSource(TestConfiguration.getCurrent(), (HashMap) null);", " }", " /**", " * Create a new DataSource object setup from the passed in TestConfiguration.", " * The getXAConnection() method is configured", " * to use the user name and password from the configuration.", " */", " static XADataSource getXADataSource(TestConfiguration config,", " HashMap beanProperties)", " {", " if (beanProperties == null)", " beanProperties = JDBCDataSource.getDataSourceProperties(config);", " ", " String dataSourceClass = config.getJDBCClient().getXADataSourceClassName();", " ", " return (XADataSource) JDBCDataSource.getDataSourceObject(", " dataSourceClass, beanProperties);", " }", "}" ], "header": "@@ -0,0 +1,87 @@", "removed": [] } ] } ]
derby-DERBY-2047-b1c5200c
DERBY-1952 DERBY-2047 Convert store/BootAllTest to run as a standard JUNit test and not within the harness. Added a store._Suite and hooked it into the suites.All and the ant junit-all target. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@473175 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/junit/DropDatabaseSetup.java", "hunks": [ { "added": [ "class DropDatabaseSetup extends BaseJDBCTestSetup {" ], "header": "@@ -30,7 +30,7 @@ import junit.framework.Test;", "removed": [ "class DropDatabaseSetup extends TestSetup {" ] }, { "added": [ " protected void tearDown() throws Exception {", " ", " // Ensure the database is booted", " // since that is what shutdownDatabase() requires.", " getConnection().close();" ], "header": "@@ -39,7 +39,11 @@ class DropDatabaseSetup extends TestSetup {", "removed": [ " protected void tearDown() throws Exception { " ] } ] } ]
derby-DERBY-2047-cef7d1e0
DERBY-2036 DERBY-2043 DERBY-2047 (partial) Re-work connection handling in JUnit tests. Create connection factory Connector with two implementations, DataSourceConnector and DriverManagerConnector. This ensures that running tests does not attempt to load DriverManager when running tests with JSR169. Ensure DataSource implementation sets user name and password from configuration for the getConnection() method to ensure the ChangerUserTestSetup works. Refactor the setting of data source Java bean properties to be from a HashMap rather than a Properties object to ensure that no special code exists at the lowest level to deal with different property types. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@472187 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/junit/JDBCClient.java", "hunks": [ { "added": [ "import junit.framework.Assert;", "" ], "header": "@@ -19,6 +19,8 @@", "removed": [] }, { "added": [ " private static final JDBCClient EMBEDDED_30= new JDBCClient(", " \"Embedded_30\", ", " \"org.apache.derby.jdbc.EmbeddedConnectionPoolDataSource\",", " \"org.apache.derby.jdbc.EmbeddedXADataSource\",", " \"jdbc:derby:\");", " ", " /**", " * The embedded JDBC client for JDBC 4.0.", " */", " private static final JDBCClient EMBEDDED_40 = new JDBCClient(", " \"Embedded_40\", ", " \"org.apache.derby.jdbc.EmbeddedDriver\", ", " \"org.apache.derby.jdbc.EmbeddedDataSource40\", ", " \"org.apache.derby.jdbc.EmbeddedConnectionPoolDataSource40\",", " \"org.apache.derby.jdbc.EmbeddedXADataSource40\",", " /**", " * The embedded JDBC client for JSR 169", " */", " private static final JDBCClient EMBEDDED_169 = new JDBCClient(", " \"Embedded_169\", ", " null, // No driver", " \"org.apache.derby.jdbc.EmbeddedSimpleDataSource\", ", " null, // No connection pooling", " null, // No XA", " null); // No JDBC URLs", " ", " /**", " * Get the default embedded client for this JVM.", " * @return", " */", " static JDBCClient getDefaultEmbedded()", " {", " if (JDBC.vmSupportsJDBC4())", " return EMBEDDED_40;", " if (JDBC.vmSupportsJDBC2())", " return EMBEDDED_30;", " if (JDBC.vmSupportsJSR169())", " return EMBEDDED_169;", " ", " Assert.fail(\"Unknown JVM environment\");", " return null;", " }", " ", " JDBC.vmSupportsJDBC4() ?", " \"org.apache.derby.jdbc.ClientDataSource40\" :", " JDBC.vmSupportsJDBC4() ?", " \"org.apache.derby.jdbc.ClientConnectionPoolDataSource40\" :", " \"org.apache.derby.jdbc.ClientConnectionPoolDataSource\",", " JDBC.vmSupportsJDBC4() ?", " \"org.apache.derby.jdbc.ClientXADataSource40\" :", " \"org.apache.derby.jdbc.ClientXADataSource\"," ], "header": "@@ -29,19 +31,68 @@ public final class JDBCClient {", "removed": [ " static final JDBCClient EMBEDDED = new JDBCClient(", " \"Embedded\", " ] }, { "added": [ " null, null, null," ], "header": "@@ -52,7 +103,7 @@ public final class JDBCClient {", "removed": [ " null," ] }, { "added": [ " \treturn getName().startsWith(\"Embedded\");" ], "header": "@@ -60,7 +111,7 @@ public final class JDBCClient {", "removed": [ " \treturn getName().equals(EMBEDDED.getName());" ] }, { "added": [ " /**", " * Get ConnectionPoolDataSource class name.", " *", " * @return class name for ConnectionPoolDataSource implementation.", " */", " public String getConnectionPoolDataSourceClassName() {", " return poolDsClassName;", " }", "", " /**", " * Get XADataSource class name.", " *", " * @return class name for XADataSource implementation.", " */", " public String getXADataSourceClassName() {", " return xaDsClassName;", " }", "" ], "header": "@@ -105,6 +156,24 @@ public final class JDBCClient {", "removed": [] } ] }, { "file": "java/testing/org/apache/derbyTesting/junit/TestConfiguration.java", "hunks": [ { "added": [ " this.jdbcClient = JDBCClient.getDefaultEmbedded();", " initConnector();" ], "header": "@@ -344,8 +344,9 @@ public class TestConfiguration {", "removed": [ " this.jdbcClient = JDBCClient.EMBEDDED;" ] }, { "added": [ " initConnector();" ], "header": "@@ -364,6 +365,7 @@ public class TestConfiguration {", "removed": [] }, { "added": [ " initConnector();" ], "header": "@@ -388,6 +390,7 @@ public class TestConfiguration {", "removed": [] }, { "added": [ " initConnector();" ], "header": "@@ -409,6 +412,7 @@ public class TestConfiguration {", "removed": [] }, { "added": [ " jdbcClient = JDBCClient.getDefaultEmbedded();", " initConnector();" ], "header": "@@ -447,9 +451,10 @@ public class TestConfiguration {", "removed": [ " jdbcClient = JDBCClient.EMBEDDED;" ] }, { "added": [ " if (JDBC.vmSupportsJDBC2())", " {", " if (jdbcClient.isEmbedded()) {", " return jdbcClient.getUrlBase() + name;", " } else {", " return jdbcClient.getUrlBase() + hostName + \":\" + port + \"/\" + name;", " }", " }", " // No DriverManager support so no URL support.", " return null;", " }", " ", " /**", " * Initialize the connection factory.", " * Defaults to the DriverManager implementation", " * if running JDBC 2.0 or higher, otherwise a", " * DataSource implementation for JSR 169.", " *", " */", " private void initConnector()", " {", " if (JDBC.vmSupportsJDBC2())", " {", " try {", " connector = (Connector) Class.forName(", " \"org.apache.derbyTesting.junit.DriverManagerConnector\").newInstance();", " } catch (Exception e) {", " Assert.fail(e.getMessage());", " }", " ", " connector = new DataSourceConnector();", " connector.setConfiguration(this);" ], "header": "@@ -474,11 +479,40 @@ public class TestConfiguration {", "removed": [ " if (jdbcClient == JDBCClient.EMBEDDED) {", " return jdbcClient.getUrlBase() + name;", " return jdbcClient.getUrlBase() + hostName + \":\" + port + \"/\" + name;" ] }, { "added": [ " return connector.openConnection();" ], "header": "@@ -564,7 +598,7 @@ public class TestConfiguration {", "removed": [ " return getDefaultConnection(\"create=true\");" ] }, { "added": [], "header": "@@ -580,19 +614,6 @@ public class TestConfiguration {", "removed": [ " /**", " * Get a connection to the default database using the specified connection", " * attributes.", " * ", " * @param connAttrs connection attributes", " * @return connection to database.", " * @throws SQLException", " */", " private Connection getDefaultConnection(String connAttrs)", " throws SQLException {", " return getConnection(getDatabaseName(), connAttrs);", " }", " " ] }, { "added": [ " connector.shutDatabase();" ], "header": "@@ -637,7 +658,7 @@ public class TestConfiguration {", "removed": [ " getDefaultConnection(\"shutdown=true\");" ] }, { "added": [ " connector.shutEngine();" ], "header": "@@ -652,7 +673,7 @@ public class TestConfiguration {", "removed": [ " getConnection(\"\", \"shutdown=true\");" ] }, { "added": [ " /**", " * Indirection for obtaining connections based upon", " * this configuration.", " */", " private Connector connector;", " " ], "header": "@@ -772,6 +793,12 @@ public class TestConfiguration {", "removed": [] }, { "added": [ " if (!getCurrent().getJDBCClient().isEmbedded()) {" ], "header": "@@ -800,7 +827,7 @@ public class TestConfiguration {", "removed": [ " if (!(getCurrent().getJDBCClient() == JDBCClient.EMBEDDED)) {" ] } ] } ]
derby-DERBY-2047-ec5ae26d
DERBY-2023: Ensure all tests called by jdbc40._Suite run in embedded and client as required The attached patch (derby-2023.diff) makes most of the tests in jdbc4._Suite run in client and embedded. The exceptions are - ClosedObjectTest - StatementEventsTest - XA40Test - UnsupportedVetter - DataSourceTest These tests can only run in embedded mode until DERBY-2047 has been fixed, and I have added a note about it in their suite() methods. jdbc4._Suite is removed from jdbc40.runall. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@472016 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2047-ee7f6684
DERBY-2047 DERBY-1952 (partial) Implement the ability to run with the default connction coming from an XADataSource as a decorator via the utility method TestConfiguration.connectionXADecorator. This will replace the functionality driven by the property derbyTesting.xa.single. Improved jdbc4.ConnectionTest and PreparedStatementTest to also run their test fixtures with this XA decorator. This will replace the old harness suite jdbcxa40 which does not seem to be part of derbyall but the new runs are part of jdbc4._Suite. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@472722 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/junit/TestConfiguration.java", "hunks": [ { "added": [ " /**", " * Return a decorator that changes the configuration to obtain", " * connections from an XADataSource using", " * <code>", " * getXAConnection().getConnection()", " * </code>", " * The connection is not connected to any global transaction,", " * thus it is in local connection mode.", " * The tearDown reverts the configuration to the previous", " * configuration.", " */", " public static Test connectionXADecorator(Test test)", " {", " // Copy the current configuration by creating one", " // with the same database name", " TestConfiguration config = TestConfiguration.getCurrent();", " TestConfiguration newConfig = ", " new TestConfiguration(config, config.getDatabaseName());", " ", " try {", " newConfig.connector = (Connector) Class.forName(", " \"org.apache.derbyTesting.junit.XADataSourceConnector\").newInstance();", " } catch (Exception e) {", " Assert.fail(e.getMessage());", " }", " ", " newConfig.connector.setConfiguration(newConfig);", " ", " return new ChangeConfigurationSetup(newConfig, test);", " }", " " ], "header": "@@ -332,6 +332,37 @@ public class TestConfiguration {", "removed": [] } ] }, { "file": "java/testing/org/apache/derbyTesting/junit/XADataSourceConnector.java", "hunks": [ { "added": [ "/*", " *", " * Derby - Class org.apache.derbyTesting.junit.XADataSourceConnector", " *", " * Licensed to the Apache Software Foundation (ASF) under one or more", " * contributor license agreements. See the NOTICE file distributed with", " * this work for additional information regarding copyright ownership.", " * The ASF licenses this file to You under the Apache License, Version 2.0", " * (the \"License\"); you may not use this file except in compliance with", " * the License. You may obtain a copy of the License at", " *", " * http://www.apache.org/licenses/LICENSE-2.0", " *", " * Unless required by applicable law or agreed to in writing, ", " * software distributed under the License is distributed on an ", " * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, ", " * either express or implied. See the License for the specific ", " * language governing permissions and limitations under the License.", " */", "package org.apache.derbyTesting.junit;", "", "import java.sql.Connection;", "import java.sql.SQLException;", "import java.util.HashMap;", "", "import javax.sql.XADataSource;", "", "import junit.framework.Assert;", "", "/**", " * Connection factory using javax.sql.XADataSource.", " * Returns a connection in local mode obtained from", " * getXAConnection().getConnection().", " *", " */", "public class XADataSourceConnector implements Connector {", " ", " private TestConfiguration config;", " /**", " * DataSource that maps to the database for the", " * configuration. The no-arg getXAConnection() method", " * maps to the default user and password for the", " * configuration.", " */", " private XADataSource ds;", "", " public void setConfiguration(TestConfiguration config) {", " ", " this.config = config;", " ds = J2EEDataSource.getXADataSource(config, (HashMap) null);", " }", "", " public Connection openConnection() throws SQLException {", " try {", " return ds.getXAConnection().getConnection();", " } catch (SQLException e) {", " // Expected state for database not found.", " // For the client the generic 08004 is returned,", " // will just retry on that.", " String expectedState = ", " config.getJDBCClient().isEmbedded() ? \"XJ004\" : \"08004\";", "", " // If there is a database not found exception", " // then retry the connection request with", " // a new DataSource with the createDtabase property set.", " if (!expectedState.equals(e.getSQLState()))", " throw e;", " return singleUseDS(\"createDatabase\", \"create\").", " getXAConnection().getConnection(); ", " }", " }", "", " public Connection openConnection(String user, String password)", " throws SQLException {", " try {", " return ds.getXAConnection(user, password).getConnection();", " } catch (SQLException e) {", " // If there is a database not found exception", " // then retry the connection request with", " // a new DataSource with the createDatabase property set.", " if (!\"XJ004\".equals(e.getSQLState()))", " throw e;", " return singleUseDS(\"createDatabase\", \"create\").", " getXAConnection(user, password).getConnection(); ", " }", " }", "", " public void shutDatabase() throws SQLException {", " singleUseDS(\"shutdownDatabase\", \"shutdown\").getXAConnection().getConnection(); ", " }", "", " public void shutEngine() throws SQLException {", " Assert.fail(\"shutdown engine not implemened\");", " }", " ", " /**", " * Get a connection from a single use XADataSource configured", " * from the configuration but with the passed in property set.", " */", " private XADataSource singleUseDS(String property, String value)", " throws SQLException {", " HashMap hm = JDBCDataSource.getDataSourceProperties(config);", " hm.put(property, value);", " XADataSource sds = J2EEDataSource.getXADataSource(config, hm);", " return sds;", " }", "", "}" ], "header": "@@ -0,0 +1,108 @@", "removed": [] } ] } ]
derby-DERBY-2048-25dd7cdc
DERBY-2048 Add an additional cleanup step(compression) to cleanDatabase() method. After objects removal is performed via removeObjects(), object compression is performed in the new compressObjects() method on the SYS.SYSDEPENDS to compact the system table. (Currently it only compress this system table.) Contributed by Yip Ng yipng168@gmail.com git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@472613 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/junit/CleanDatabaseTestSetup.java", "hunks": [ { "added": [ " compressObjects(conn);" ], "header": "@@ -109,7 +109,7 @@ public class CleanDatabaseTestSetup extends BaseJDBCTestSetup {", "removed": [ "" ] }, { "added": [ " /**", " * Set of objects that will be compressed as part of cleaning a database.", " */", " private static final String[] COMPRESS_DB_OBJECTS =", " {", " \"SYS.SYSDEPENDS\",", " };", " ", " /**", " * Compress the objects in the database.", " * ", " * @param conn the db connection", " * @throws SQLException database error", " */", " private static void compressObjects(Connection conn) throws SQLException {", " \t ", " \t CallableStatement cs = conn.prepareCall", " \t (\"CALL SYSCS_UTIL.SYSCS_INPLACE_COMPRESS_TABLE(?, ?, 1, 1, 1)\");", " \t ", " \t for (int i = 0; i < COMPRESS_DB_OBJECTS.length; i++)", " \t {", " \t\t int delim = COMPRESS_DB_OBJECTS[i].indexOf(\".\");", " cs.setString(1, COMPRESS_DB_OBJECTS[i].substring(0, delim) );", " cs.setString(2, COMPRESS_DB_OBJECTS[i].substring(delim+1) );", " cs.execute();", " \t }", " \t ", " \t cs.close();", " \t conn.commit();", " }", " \t " ], "header": "@@ -186,4 +186,35 @@ public class CleanDatabaseTestSetup extends BaseJDBCTestSetup {", "removed": [] } ] } ]
derby-DERBY-205-27e2c4b9
DERBY-205 spin off - clean up handling of derby.stream.error properties - Removed the (redundant) reading of these stream name properties from NetworkServerControlImpl.java: derby.stream.error.file derby.stream.error.method derby.stream.error.field - Modified DRDAConnThread.java to get the stream name via Monitor.getStream().getName (a new method). DRDAConnThread was the sole client and reason for the redundancy Kathey spotted. - Augmented HeaderPrintWriter interface with a new method, getName. - Augmented BasicHeaderPrintWriter to hold the stream name of the error log. - Moved hard coded constants for the stream name attributes from SingleStream.java to the Property interface and documented them there. - Removed the errorLogLocation field and the getErrorLogLocation from NetworkServerControlImpl.java - Cleaned up some Javadoc for the items I touched. I have run derbyall with JDK1.4.2 on Solaris/x86. derbyall runs with errors, but the same errors are present on a clean checkout as well There are some additional changes to the sed file for the new errorstream test. Checking in all but the addition to the suite. contributed by Dag H. Wanvik git-svn-id: https://svn.apache.org/repos/asf/incubator/derby/code/trunk@179584 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java", "hunks": [ { "added": [], "header": "@@ -121,14 +121,6 @@ public class NetworkServerControlImpl {", "removed": [ "\tprivate final static String", "\t\tNETWORKSERVER_PROP_STREAM_ERROR_FIELD=\"derby.stream.error.field\";", "", "\tprivate final static String", "\t\tNETWORKSERVER_PROP_STREAM_ERROR_METHOD=\"derby.stream.error.method\";", "\tprivate final static String", "\t\tNETWORKSERVER_PROP_STREAM_ERROR_FILE=\"derby.stream.error.file\";", "" ] }, { "added": [], "header": "@@ -253,8 +245,6 @@ public class NetworkServerControlImpl {", "removed": [ "\tprivate String errorLogLocation = null;", "" ] }, { "added": [], "header": "@@ -2506,28 +2496,6 @@ public class NetworkServerControlImpl {", "removed": [ "\t\t//RESOLVE: Need to clean this up. There should be just a", "\t\t// server API call to get the log location", "\t\t// Determine errror log location", "\t\tpropval = PropertyUtil.getSystemProperty(", " NetworkServerControlImpl.NETWORKSERVER_PROP_STREAM_ERROR_FIELD);", "\t\tif (propval == null)", "\t\t\tpropval = PropertyUtil.getSystemProperty( ", " NetworkServerControlImpl.NETWORKSERVER_PROP_STREAM_ERROR_METHOD);", "\t\tif (propval == null)", "\t\t{", "\t\t\tpropval = PropertyUtil.getSystemProperty( ", " NetworkServerControlImpl.NETWORKSERVER_PROP_STREAM_ERROR_FILE);", "\t\t\tif (propval == null)", "\t\t\t\tpropval = \"derby.log\";", "\t\t}", "\t\tFile errorFile = new File(propval);", "\t\tif (errorFile.isAbsolute())", "\t\t\terrorLogLocation = errorFile.getPath();", "\t\telse", "\t\t\terrorLogLocation = (new File", "\t\t\t\t(directory,propval)).getPath();", "\t\t" ] } ] }, { "file": "java/engine/org/apache/derby/impl/services/stream/BasicHeaderPrintWriter.java", "hunks": [ { "added": [ "\tprivate final String name;", "\t * @param writeTo Where to write to.", "\t * @param canClose If true, {@link #complete} will also close writeTo", "\t * @param streamName Name of writeTo, e.g. a file name", "\t\t\tPrintWriterGetHeader headerGetter, boolean canClose, String streamName){", "\t\tthis.name = streamName;", "", "\t/**", "\t * the constructor sets up the HeaderPrintWriter. ", "\t * <p>", "\t * @param writeTo Where to write to.", "\t * @param headerGetter\tObject to get headers for output lines.", "\t * @param canClose If true, {@link #complete} will also close writeTo", "\t * @param writerName Name of writeTo, e.g. a file name", "\t *", "\t * @see\tPrintWriterGetHeader", "\t */", "\t\t\tPrintWriterGetHeader headerGetter, boolean canClose, String writerName){", "\t\tthis.name = writerName;" ], "header": "@@ -42,28 +42,44 @@ class BasicHeaderPrintWriter", "removed": [ "\t * @param writeTo\t\tWhere to write to.", "\t\t\tPrintWriterGetHeader headerGetter, boolean canClose){", "\t\t\tPrintWriterGetHeader headerGetter, boolean canClose){" ] } ] }, { "file": "java/engine/org/apache/derby/impl/services/stream/SingleStream.java", "hunks": [ { "added": [ "\t\tHeaderPrintWriter hpw = makeHPW(header);" ], "header": "@@ -121,17 +121,9 @@ implements InfoStreams, ModuleControl, java.security.PrivilegedAction", "removed": [ "\t\tStringBuffer propName = new StringBuffer(\"derby.stream.error.\");", "", "\t\tint prefixLength = propName.length();", "", "", "\t\t// get the stream", "\t\tpropName.setLength(prefixLength);", "\t\t", "\t\tHeaderPrintWriter hpw = makeHPW(propName, header);" ] }, { "added": [ "\tprivate HeaderPrintWriter makeHPW(PrintWriterGetHeader header) {", "\t\tString target = PropertyUtil.", " getSystemProperty(Property.ERRORLOG_FILE_PROPERTY);", "\t\ttarget = PropertyUtil.", " getSystemProperty(Property.ERRORLOG_METHOD_PROPERTY);", "\t\ttarget = PropertyUtil.", " getSystemProperty(Property.ERRORLOG_FIELD_PROPERTY);" ], "header": "@@ -152,31 +144,23 @@ implements InfoStreams, ModuleControl, java.security.PrivilegedAction", "removed": [ "\tprivate HeaderPrintWriter makeHPW(StringBuffer propPrefix,", "\t\tPrintWriterGetHeader header) {", "\t\tint prefixLength = propPrefix.length();", "", "\t\t// looking for derby.stream.<name>.file=<path to file>", "\t\tpropPrefix.append(\"file\");", "\t\tString target = PropertyUtil.getSystemProperty(propPrefix.toString());", "\t\t// looking for derby.stream.<name>.method=<className>.<methodName>", "\t\tpropPrefix.setLength(prefixLength);", "\t\tpropPrefix.append(\"method\");", "\t\ttarget = PropertyUtil.getSystemProperty(propPrefix.toString());", "\t\t// looking for derby.stream.<name>.field=<className>.<fieldName>", "\t\tpropPrefix.setLength(prefixLength);", "\t\tpropPrefix.append(\"field\");", "\t\ttarget = PropertyUtil.getSystemProperty(propPrefix.toString());" ] }, { "added": [ "\t\treturn new BasicHeaderPrintWriter(new BufferedOutputStream(fos), header,", "\t\t\ttrue, streamFile.getPath());" ], "header": "@@ -217,7 +201,8 @@ implements InfoStreams, ModuleControl, java.security.PrivilegedAction", "removed": [ "\t\treturn new BasicHeaderPrintWriter(new BufferedOutputStream(fos), header, true);" ] }, { "added": [ "\t\t\t\t\treturn makeValueHPW(theMethod, theMethod.invoke((Object) null, ", "\t\t\t\t\t\tnew Object[0]), header, methodInvocation);" ], "header": "@@ -241,7 +226,8 @@ implements InfoStreams, ModuleControl, java.security.PrivilegedAction", "removed": [ "\t\t\t\t\treturn makeValueHPW(theMethod, theMethod.invoke((Object) null, new Object[0]), header);" ] }, { "added": [ "\t\t\t\t\treturn makeValueHPW(theField, theField.get((Object) null), ", "\t\t\t\t\t\theader, fieldAccess);" ], "header": "@@ -286,7 +272,8 @@ implements InfoStreams, ModuleControl, java.security.PrivilegedAction", "removed": [ "\t\t\t\t\treturn makeValueHPW(theField, theField.get((Object) null), header);" ] }, { "added": [ "\t\tPrintWriterGetHeader header, String name) {", "\t\t\t return new BasicHeaderPrintWriter((OutputStream) value, header, false, name);", "\t\t\t return new BasicHeaderPrintWriter((Writer) value, header, false, name);" ], "header": "@@ -317,12 +304,12 @@ implements InfoStreams, ModuleControl, java.security.PrivilegedAction", "removed": [ "\t\tPrintWriterGetHeader header) {", "\t\t\t return new BasicHeaderPrintWriter((OutputStream) value, header, false);", "\t\t\t return new BasicHeaderPrintWriter((Writer) value, header, false);" ] } ] } ]
derby-DERBY-2050-4882b305
DERBY-2050: Manipulating CachedItems could be more efficient Use five boolean fields instead of one int to record CachedItem's state. Contributed by Dyre Tjeldvoll. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@472803 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/services/cache/CachedItem.java", "hunks": [ { "added": [ "\tprivate boolean valid_ = false;", "\tprivate boolean removeRequested_ = false;", "\tprivate boolean settingIdentity_ = false;", "\tprivate boolean removeOk_ = false;", "\tprivate boolean recentlyUsed_ = false;" ], "header": "@@ -66,24 +66,15 @@ import org.apache.derby.iapi.services.context.ContextService;", "removed": [ "", "\tprivate static final int VALID = 0x00000001;", "\tprivate static final int REMOVE_REQUESTED = 0x00000002;", "\tprivate static final int SETTING_IDENTITY = 0x00000004;", "\tprivate static final int REMOVE_OK = 0x00000008;", "", "\tprivate static final int RECENTLY_USED = 0x00000010;", "", "\t/**", "\t\tDoes entry (the Cacheable) have an identity.", "", "\t\t<BR> MT - single thread required : synchronization provided by cache manager.", "\t*/", "\tprivate int state;" ] }, { "added": [ "\t\tsettingIdentity_ = true;" ], "header": "@@ -121,7 +112,7 @@ public final class CachedItem {", "removed": [ "\t\tstate |= SETTING_IDENTITY;" ] }, { "added": [ "\t\treturn (unkept && removeRequested_);" ], "header": "@@ -152,7 +143,7 @@ public final class CachedItem {", "removed": [ "\t\treturn unkept && ((state & REMOVE_REQUESTED) != 0);" ] }, { "added": [ "\t\tremoveRequested_ = true;", "\t\treturn valid_;", "\t\tvalid_ = flag;", "\t\tremoveRequested_ = false;", "\t\tremoveOk_ = false;", "\t\trecentlyUsed_ = flag;" ], "header": "@@ -186,29 +177,24 @@ public final class CachedItem {", "removed": [ "\t\tstate |= REMOVE_REQUESTED;", "\t\treturn (state & VALID) != 0;", "", "\t\tif (flag)", "\t\t\tstate |= VALID;", "\t\telse", "\t\t\tstate &= ~VALID;", "", "\t\tstate &= ~(REMOVE_REQUESTED | REMOVE_OK);", "", "\t\tsetUsed(flag);" ] }, { "added": [ "\t\tsettingIdentity_ = false;" ], "header": "@@ -252,8 +238,7 @@ public final class CachedItem {", "removed": [ "\t\tstate &= ~SETTING_IDENTITY;", "\t\t\t\t" ] }, { "added": [ "\t\twhile (settingIdentity_) {" ], "header": "@@ -263,7 +248,7 @@ public final class CachedItem {", "removed": [ "\t\twhile ((state & SETTING_IDENTITY) != 0) {" ] }, { "added": [ "\t\tif (!valid_) {", "\t\t}" ], "header": "@@ -278,8 +263,9 @@ public final class CachedItem {", "removed": [ "\t\tif (!isValid())" ] }, { "added": [ "\t\t\t\twhile (!removeOk_) {" ], "header": "@@ -299,7 +285,7 @@ public final class CachedItem {", "removed": [ "\t\t\t\twhile ((state & REMOVE_OK) == 0) {" ] }, { "added": [ "\t\t\tSanityManager.ASSERT(removeRequested_);", "\t\tremoveOk_ = true;" ], "header": "@@ -315,11 +301,11 @@ public final class CachedItem {", "removed": [ "\t\t\tSanityManager.ASSERT((state & REMOVE_REQUESTED) != 0);", "\t\tstate |= REMOVE_OK;" ] }, { "added": [ "\t\trecentlyUsed_ = flag;" ], "header": "@@ -328,10 +314,7 @@ public final class CachedItem {", "removed": [ "\t\tif (flag)", "\t\t\tstate |= RECENTLY_USED;", "\t\telse", "\t\t\tstate &= ~RECENTLY_USED;" ] }, { "added": [ "\t\treturn recentlyUsed_;" ], "header": "@@ -339,7 +322,7 @@ public final class CachedItem {", "removed": [ "\t\treturn (state & RECENTLY_USED) != 0;" ] } ] } ]
derby-DERBY-2051-ac5a3a2d
DERBY-2051: Remove the unused CachedItem class git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1625521 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/services/cache/CachedItem.java", "hunks": [ { "added": [], "header": "@@ -1,330 +0,0 @@", "removed": [ "/*", "", " Derby - Class org.apache.derby.impl.services.cache.CachedItem", "", " Licensed to the Apache Software Foundation (ASF) under one or more", " contributor license agreements. See the NOTICE file distributed with", " this work for additional information regarding copyright ownership.", " The ASF licenses this file to you under the Apache License, Version 2.0", " (the \"License\"); you may not use this file except in compliance with", " the License. You may obtain a copy of the License at", "", " http://www.apache.org/licenses/LICENSE-2.0", "", " Unless required by applicable law or agreed to in writing, software", " distributed under the License is distributed on an \"AS IS\" BASIS,", " WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", " See the License for the specific language governing permissions and", " limitations under the License.", "", " */", "", "package org.apache.derby.impl.services.cache;", "", "import org.apache.derby.iapi.services.cache.Cacheable;", "import org.apache.derby.iapi.services.cache.CacheableFactory;", "import org.apache.derby.iapi.services.cache.CacheManager;", "import org.apache.derby.iapi.error.StandardException;", "", "import org.apache.derby.shared.common.sanity.SanityManager;", "import org.apache.derby.iapi.services.context.ContextService;", "", "/**", "\tA generic class to represent the cache related infomation of a cached object (Cacheable).", "\t<P><PRE>", "\tThe relationship between isValid and settingIdentity can be explain by the", "\tfollowing life cycle of a cached item.", "", "\tStage\t\t 1\t2\t3", "\t----------------------", "\tisValid\t F\tT\tT\t", "\tsettingIdentity\tX\tT\tF", "", "\tIn Stage 1, the CachedItem is created but it is invalid and has an entry", "\tthat is just a holder object with no identity.", "", "\tIn Stage 2, the identity has been set and the item is being created or", "\tbeing faulted into the cache.", "", "\tIn Stage 3, the item found in the CachedItem entry", "\t</PRE> <P>", "\tRemove is set if this item is being removed out of existance, not just", "\tbeing evicted from the cache. When the last referece to it release it from", "\tthe cache, it will be removed.", "\t<BR>", "\tRecentlyUsed is set whenever this item is accessed (via a keep() call).", "\tIt is reset by the clockHand as it sweeps around the cache looking for", "\tvictims to evict.", "", "\t<P>MT - must be MT-safe and work with cache manager. Every method that", "\taccess (set or get) instance variables is synchronized on the cached item", "\tobject. The following method waits so it should not be called by the cache", "\tmanager inside a sync block: clean(), waitFor(), create(), remove().", "\t(RESOLVE: need to move these from the cache manager to here)", "", "\t@see org.apache.derby.impl.services.cache", "\t@see Cacheable", "*/", "final class CachedItem {", "\t/*", "\t** Fields", "\t*/", "", "\tprivate boolean valid_ = false;", "\tprivate boolean removeRequested_ = false;", "\tprivate boolean settingIdentity_ = false;", "\tprivate boolean removeOk_ = false;", "\tprivate boolean recentlyUsed_ = false;", "", "\t/**", "\t\tThe current keep count on the entry.", "", "\t\t<BR> MT - single thread required : synchronization provided by cache manager.", "", "\t*/", "\tprivate int\tkeepCount;", "", "\t/**", "\t\tThe Cacheable object being represented.", "", "\t\t<BR> Mutable - content dynamic", "\t*/", "\tprivate Cacheable\tentry;", "\t\t", "\t/**", "\t\tCreate a CachedItem in the not valid state.", "\t*/", "\tpublic CachedItem() {", "\t}", "", "\t/**", "\t\tKeep the cached object after a search.", "", "\t*/", "\tpublic void keepAfterSearch() {", "\t\tkeepCount++;", "\t\tsetUsed(true);", "\t}", "", "\tpublic void keepForCreate() {", "\t\tif (SanityManager.DEBUG) {", "\t\t\tSanityManager.ASSERT(!isKept());", "\t\t\tSanityManager.ASSERT(!isValid());", "\t\t}", "\t\tkeepCount = 1;", "\t\tsettingIdentity_ = true;", "\t}", "", " public void unkeepForCreate( )", " {", " settingIdentityComplete();", " unkeep();", " }", "", "\tpublic void keepForClean() {", "\t\tif (SanityManager.DEBUG) {", "\t\t\tSanityManager.ASSERT(isValid());", "\t\t}", "\t\tkeepCount++;", "\t}", "", "", "", "\t/**", "\t\tUnkeep the cached object.", "", "\t\t<P>MT - not synchronized, only modified single threaded by the cache manager", "", "\t\t@return if the object is still kept after this call. ", "\t*/", "\tpublic synchronized boolean unkeep() {", "\t\tboolean unkept = --keepCount == 0;", "", "\t\tif (SanityManager.DEBUG) {", "\t\t\tSanityManager.ASSERT(keepCount >= 0);", "\t\t}", "\t\treturn (unkept && removeRequested_);", "\t}", "", "\t/**", "\t\tIs the cached object kept?", "", "\t\t<P>MT - not synchronized, only accessed single threaded by the cache manager", "\t*/", "\tpublic final boolean isKept() {", "", "\t\treturn keepCount != 0;", "\t}", "", "\t/**", "\t\tClean the cached object", "", "\t\t<P>MT -\t\t<BR>", "\t\tThe wait will not release the lock on the cache manager, so the", "\t\tcache manager should not waitfor clean inside a sync block or", "\t\tthe whole cache will freeze", "", "\t\t@param forRemove if true, get rid of the backend persistent store object", "\t\t@exception StandardException error thrown while writing cacheable", "\t\tobject to disk", "\t*/", "\tpublic void clean(boolean forRemove) throws StandardException", "\t{", "\t\tentry.clean(forRemove);", "\t}", "", "\t/**", "\t\tSet the state of the to-be removed flag.", "\t*/", "\tpublic synchronized void setRemoveState() {", "\t\tremoveRequested_ = true;", "\t}", "", "\t/**", "\t\tDoes the cached object have a valid identity.", "\t*/", "\tpublic final synchronized boolean isValid() {", "\t\treturn valid_;", "\t}", "", "\t/**", "\t\tSet the valid state of the cached object.", "\t*/", "\tpublic synchronized void setValidState(boolean flag) {", "\t\tvalid_ = flag;", "\t\tremoveRequested_ = false;", "\t\tremoveOk_ = false;", "\t\trecentlyUsed_ = flag;", "\t}", "", "\t/**", "\t\tGet the cached object.", "\t*/", "\tpublic Cacheable getEntry() {", "\t\treturn entry;", "\t}", "", "\t/**", "\t\tMake entry (the Cacheable) take on a new identity.", "\t*/", "\tpublic Cacheable takeOnIdentity(CacheManager cm, CacheableFactory holderFactory,", "\t\tObject key, boolean forCreate, Object createParameter)", "\t\tthrows StandardException {", "", "\t\t// tell the object it needs to create itself", "\t\tCacheable oldEntry = entry;", "\t\tif (oldEntry == null)", "\t\t\toldEntry = holderFactory.newCacheable(cm);", "", "\t\tif (forCreate) {", "\t\t\tentry = oldEntry.createIdentity(key, createParameter);", "\t\t} else {", "\t\t\tentry = oldEntry.setIdentity(key);", "\t\t}", "", "\t\tif (entry != null) {", "\t\t\t// item was found or created", "\t\t\tif (SanityManager.DEBUG) {", "\t\t\t\tSanityManager.ASSERT(entry.getIdentity().equals(key));", "\t\t\t}", "", "\t\t\treturn entry;", "\t\t}", "", "\t\tentry = oldEntry;", "\t\treturn null;", "\t}", "", "\tpublic synchronized void settingIdentityComplete() {", "\t\t// notify all waiters that this item has finished setting its identity,", "\t\t// successfully or not.", "\t\tsettingIdentity_ = false;", "\t\tnotifyAll();", "\t}", "", "\t/**", "\t\tAllow use of the cacheable entry. ", "\t*/", "", "\tpublic synchronized Cacheable use() throws StandardException {", "", "\t\twhile (settingIdentity_) {", "\t\t\ttry {", "\t\t\t\tif (SanityManager.DEBUG) {", "\t\t\t\t\tSanityManager.DEBUG(\"CacheTrace\", ", " \"trying to use a cached item that is taking on an identity\");", "\t\t\t\t}", "", "\t\t\t\twait();", "", "\t\t\t} catch (InterruptedException ie) {", "\t\t\t\tthrow StandardException.interrupt(ie);", "\t\t\t}", "\t\t}", "", "\t\t// see if the setting of this identity failed ...", "\t\tif (!valid_) {", "\t\t\treturn null;", "\t\t}", "", "\t\tif (SanityManager.DEBUG)", " {", " if (SanityManager.DEBUG_ON(\"CacheTrace\"))", " SanityManager.DEBUG(", " \"CacheTrace\", \"item keep count is \" + keepCount);", "\t\t}", "", "", "\t\treturn entry;", "\t}", "", "\t/**", "\t*/", "\tpublic void remove(boolean removeNow) throws StandardException {", "", "\t\tif (!removeNow) {", "", "\t\t\tsynchronized (this) {", "\t\t\t\twhile (!removeOk_) {", "\t\t\t\t\ttry {", "\t\t\t\t\t\twait();", "\t\t\t\t\t} catch (InterruptedException ie) {", "\t\t\t\t\t\tthrow StandardException.interrupt(ie);", "\t\t\t\t\t}", "\t\t\t\t}", "\t\t\t}", "\t\t}", "\t\t", "\t\tclean(true);", "\t}", "", "\tpublic synchronized void notifyRemover() {", "", "\t\tif (SanityManager.DEBUG) {", "\t\t\tSanityManager.ASSERT(removeRequested_);", "\t\t\tSanityManager.ASSERT(isKept());", "\t\t}", "", "\t\tremoveOk_ = true;", "\t\tnotifyAll();", "\t}", "", "\t/**", "\t\tThe clock hand has swept past this entry.", "\t*/", "\tpublic synchronized void setUsed(boolean flag)", "\t{", "\t\trecentlyUsed_ = flag;", "\t}", "", "\t/**", "\t\tHas the cached object been referenced (kept) since the last sweep of", "\t\tthe clock hand?", "\t*/", "\tpublic synchronized boolean recentlyUsed() {", "\t\treturn recentlyUsed_;", "\t}", "}", "", "\t", "\t" ] } ] } ]
derby-DERBY-2052-c5eb0bcc
DERBY-2052: JDBC.assertRowInResultSet compares the wrong value if using trimmed strings and a SMALLINT column exists. Patch that 1) moves the locally scoped variables in JDBC.assertRowInResultSet() into the for loop, and 2) sets the "obj" variable through all paths. Contributed by Dan Debrunner (djd@apache.org) git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@472391 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/junit/JDBC.java", "hunks": [ { "added": [ " Object obj;" ], "header": "@@ -597,12 +597,10 @@ public class JDBC {", "removed": [ " String s;", " boolean ok;", " Object obj = null;" ] }, { "added": [ " String s = expectedRow[i].toString();", " else", " obj = rs.getString(i+1);", " ", " ", " // Trim the rs string.", " if (obj != null)", " obj = ((String)obj).trim();", " boolean ok = (rs.wasNull() && (expectedRow[i] == null))" ], "header": "@@ -621,24 +619,28 @@ public class JDBC {", "removed": [ " s = expectedRow[i].toString();", " // Trim the rs string.", " if (obj != null)", " obj = ((String)obj).trim();", " ok = (rs.wasNull() && (expectedRow[i] == null))" ] } ] } ]
derby-DERBY-2063-0c9f73e3
DERBY-2063 (partial) Change ShutdownDBWhenNSShutsDown from being a JUnit test run under the old harness to one that is run as a regular JUnit tests. Add a new _Suite for derbynet and hook it into suites.All and the ant junit-all target. Required fixing some bugs in the DriverManager connection handling. Also refactored NetworkServerTestSetup to allow starting the server from the "command line" and to provide some utility methods for tests, e.g. to get a correctly setup NetworkServerControl. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@473123 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/junit/DriverManagerConnector.java", "hunks": [ { "added": [ "import java.util.Properties;" ], "header": "@@ -22,6 +22,7 @@ package org.apache.derbyTesting.junit;", "removed": [] }, { "added": [ " return getConnectionByAttributes(url,", " \"create\", \"true\"); " ], "header": "@@ -79,8 +80,8 @@ public class DriverManagerConnector implements Connector {", "removed": [ " url = url.concat(\";create=true\");", " return DriverManager.getConnection(url, user, password);" ] } ] }, { "file": "java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java", "hunks": [ { "added": [ "import java.net.UnknownHostException;" ], "header": "@@ -21,6 +21,7 @@ package org.apache.derbyTesting.junit;", "removed": [] }, { "added": [], "header": "@@ -34,8 +35,6 @@ import org.apache.derby.drda.NetworkServerControl;", "removed": [ " * It does not start it if the test is configured to run in", " * embedded mode." ] }, { "added": [ " private final boolean asCommand;", " public NetworkServerTestSetup(Test test, boolean asCommand) {", " this.asCommand = asCommand;", " BaseTestCase.println(\"Starting network server:\");", " networkServerController = getNetworkServerControl();", " ", " if (asCommand)", " startWithCommand();", " else", " startWithAPI();", " waitForServerStart(networkServerController);", " }", " private void startWithAPI() throws Exception", " {" ], "header": "@@ -44,23 +43,34 @@ import org.apache.derby.drda.NetworkServerControl;", "removed": [ " public NetworkServerTestSetup(Test test) {", " TestConfiguration config = TestConfiguration.getCurrent();", " BaseTestCase.println(\"Starting network server:\");" ] }, { "added": [ " ", " }", " ", " private void startWithCommand() throws Exception", " {", " final TestConfiguration config = TestConfiguration.getCurrent();", " ", " // start the server through the command line", " // arguments using a new thread to do so.", " new Thread(", " new Runnable() {", " public void run() {", " org.apache.derby.drda.NetworkServerControl.main(", " new String[] {", " \"start\",", " \"-h\",", " config.getHostName(),", " \"-p\",", " Integer.toString(config.getPort())", " }); ", " ", " }, \"NetworkServerTestSetup command\").start();", " * Stop the network server if it still", " * appears to be running.", " boolean running = false;", " try {", " networkServerController.ping();", " running = true;", " } catch (Exception e) {", " }", " ", " if (running)", " networkServerController.shutdown();", " " ], "header": "@@ -77,33 +87,49 @@ final public class NetworkServerTestSetup extends TestSetup {", "removed": [ "", " networkServerController = new NetworkServerControl", " (InetAddress.getByName(config.getHostName()), config.getPort());", " ", " final long startTime = System.currentTimeMillis();", " while (true) {", " Thread.sleep(SLEEP_TIME);", " try {", " networkServerController.ping();", " break;", " } catch (Exception e) {", " if (System.currentTimeMillis() - startTime > WAIT_TIME) {", " e.printStackTrace();", " fail(\"Timed out waiting for network server to start\");", " }", " }", " * Stop the network server.", " networkServerController.shutdown();" ] }, { "added": [ " ", " ", " /*", " * Utility methods related to controlling network server.", " */", " ", " /**", " * Return a new NetworkServerControl for the current configuration.", " */", " public static NetworkServerControl getNetworkServerControl()", " throws Exception", " {", " TestConfiguration config = TestConfiguration.getCurrent();", " return new NetworkServerControl", " (InetAddress.getByName(config.getHostName()), config.getPort());", " }", " ", " /**", " * Ping the server until it has started. Asserts a failure", " * if the server has not started within sixty seconds.", " */", " public static void waitForServerStart(NetworkServerControl networkServerController)", " throws InterruptedException {", " final long startTime = System.currentTimeMillis();", " while (true) {", " Thread.sleep(SLEEP_TIME);", " try {", " networkServerController.ping();", " break;", " } catch (Exception e) {", " if (System.currentTimeMillis() - startTime > WAIT_TIME) {", " e.printStackTrace();", " fail(\"Timed out waiting for network server to start\");", " }", " }", " }", " }" ], "header": "@@ -116,4 +142,41 @@ final public class NetworkServerTestSetup extends TestSetup {", "removed": [] } ] } ]
derby-DERBY-2067-cb705acc
DERBY-2067: Assert failure in EmbedConnection.restoreContextStack() when running lang/closed.java Change the assert so that it doesn't raise an error if the engine has been shut down. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@473687 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java", "hunks": [ { "added": [ "\t\t\tif (tr.getCsf() != null) {", "\t\t\t\tContextManager cm1 = tr.getCsf().getCurrentContextManager();", "\t\t\t\tContextManager cm2 = tr.getContextManager();", "\t\t\t\t// If the system has been shut down, cm1 can be null.", "\t\t\t\t// Otherwise, cm1 and cm2 should be identical.", "\t\t\t\tUtil.ASSERT(this, (cm1 == cm2 || cm1 == null),", "\t\t\t\t\t cm1 + \" \" + cm2);" ], "header": "@@ -1557,13 +1557,14 @@ public class EmbedConnection implements EngineConnection", "removed": [ "\t\t\tif ((tr.getCsf() != null) && (tr.getCsf().getCurrentContextManager() !=", "\t\t\t\ttr.getContextManager()))", "\t\t\t{", "\t\t\t\tUtil.THROWASSERT(this, ", "\t\t\t\t\t tr.getCsf().getCurrentContextManager() + \" \" + ", "\t\t\t\t\t tr.getContextManager());" ] } ] } ]
derby-DERBY-2074-877a43d4
DERBY-2074: NullPointerException when two threads load sort factory concurrently Added a flag in ModuleInstance that tells whether the module is fully booted. This flag is checked when we go through the list of modules, so that we can avoid using partly booted instances. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@788670 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/services/monitor/ModuleInstance.java", "hunks": [ { "added": [ " /** Flag that tells whether booting of the module has completed. */", " private boolean booted;", "" ], "header": "@@ -56,6 +56,9 @@ class ModuleInstance {", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/services/monitor/TopService.java", "hunks": [ { "added": [ " // DERBY-2074: The module has not been properly booted, so we", " // cannot yet determine whether or not this is a module we can", " // use. Assume that we cannot use it and continue looking. We", " // may end up booting the module twice if the assumption", " // doesn't hold, but we'll detect and resolve that later when", " // we call addToProtocol().", " if (!module.isBooted()) {", " continue;", " }", "" ], "header": "@@ -255,6 +255,16 @@ final class TopService {", "removed": [] } ] } ]
derby-DERBY-2083-02985805
DERBY-2033 Convert remaining tests from dcl.sql to DatabaseClassLoadingTest including those that execute against a database in a jar. Database in a jar tests pass but cause an issue on clenaup which is entered as DERBY-2083. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@474878 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2083-55ffdfb0
DERBY-2083 Ensure the store closes the StorageFactory it is using at database shutdown time. Add shutdown code for the JarStorageFactory to close the jar file it has opened. Ensure the monitor does not use a stream opened from a StorageFactory after it has called shutdown(). git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@483606 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/io/JarStorageFactory.java", "hunks": [ { "added": [ "import org.apache.derby.io.StorageFile;", "" ], "header": "@@ -21,21 +21,12 @@", "removed": [ "import org.apache.derby.iapi.services.sanity.SanityManager;", "", "import org.apache.derby.io.StorageFactory;", "import org.apache.derby.io.StorageFile;", "", "import java.io.FileNotFoundException;", "import java.io.InputStream;", "import java.io.OutputStream;", "", "import java.util.Properties;", "import java.util.zip.ZipEntry;" ] } ] }, { "file": "java/engine/org/apache/derby/impl/services/monitor/StorageFactoryService.java", "hunks": [ { "added": [ " final Properties serviceProperties = new Properties(defaultProperties);", " AccessController.doPrivileged(", " throws IOException, StandardException," ], "header": "@@ -250,14 +250,14 @@ final class StorageFactoryService implements PersistentService", "removed": [ " InputStream is = null;", " is = (InputStream) AccessController.doPrivileged(", " throws FileNotFoundException, IOException, StandardException," ] }, { "added": [ " try {", " InputStream is = file.getInputStream();", " try {", " // Need to load the properties before closing the", " // StorageFactory.", " serviceProperties.load(new BufferedInputStream(is));", " } finally {", " is.close();", " }", " } finally {", " storageFactory.shutdown();", " }", " return null;" ], "header": "@@ -269,17 +269,24 @@ final class StorageFactoryService implements PersistentService", "removed": [ " InputStream is1 = file.getInputStream();", " storageFactory.shutdown();", " return is1;", "\t\t\tProperties serviceProperties = new Properties(defaultProperties);", "\t\t\tserviceProperties.load(new BufferedInputStream(is));", "" ] } ] }, { "file": "java/engine/org/apache/derby/impl/store/raw/data/BaseDataFileFactory.java", "hunks": [ { "added": [], "header": "@@ -126,7 +126,6 @@ public class BaseDataFileFactory", "removed": [ " private String subSubProtocol;" ] }, { "added": [ " storageFactory.shutdown();" ], "header": "@@ -496,6 +495,7 @@ public class BaseDataFileFactory", "removed": [] } ] } ]
derby-DERBY-2085-f2220fd2
DERBY-2085: Misleading error message for non-matching ORDER BY clause This change modifies the SQL compiler to change the error message that is displayed for the query: SELECT i FROM t GROUP BY i ORDER BY j After this patch, Derby will once again issue the error message that it issued in release 10.1 and earlier: ERROR 42Y36: Column reference 'J' is invalid. For a SELECT list with a GROUP BY, the list may only contain grouping columns and valid aggregate expressions. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@653988 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2087-3df869c3
DERBY-2087 Create a TestConfiguration.singleUseDatabaseDecorator(Test, String dbName, boolean asDefault) and also the methods openConnection(databaseName) to BaseJDBCTestCase and all the required infrustructure. TestConfiguration manages a list of databases in use in a usedDbNames property. The singleUseDatabaseDecorator creates a new configuration and appends a passed (or generated) database name at the end of the old database list. Optionally, if specified, the default database might be also changed. Renamed the TestConfiguration.getDatabaseName to getDefaultDatabaseName, since it is more accurate now. Contributed by Julius Stroffek - Julius.Stroffek@sun.com git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@499100 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/junit/Connector.java", "hunks": [ { "added": [ " /**", " * Open a connection with the database, user and password", " * defined by the configuration passed to setConfiguration.", " * If the database does not exist then it should be created.", " */", " abstract Connection openConnection(String databaseName) throws SQLException;", " " ], "header": "@@ -53,6 +53,13 @@ interface Connector {", "removed": [] } ] }, { "file": "java/testing/org/apache/derbyTesting/junit/DataSourceConnector.java", "hunks": [ { "added": [ " public Connection openConnection(String databaseName) throws SQLException {", " JDBCDataSource.setBeanProperty(ds, \"databaseName\", databaseName);", " try {", " return ds.getConnection();", " } catch (SQLException e) {", " // Expected state for database not found.", " // For the client the generic 08004 is returned,", " // will just retry on that.", " String expectedState = ", " config.getJDBCClient().isEmbedded() ? \"XJ004\" : \"08004\";", "", " // If there is a database not found exception", " // then retry the connection request with", " // a new DataSource with the createDtabase property set.", " if (!expectedState.equals(e.getSQLState()))", " throw e;", " DataSource tmpDs = singleUseDS(\"createDatabase\", \"create\");", " JDBCDataSource.setBeanProperty(tmpDs, \"databaseName\", databaseName);", " return tmpDs.getConnection();", " }", " }", "" ], "header": "@@ -68,6 +68,28 @@ public class DataSourceConnector implements Connector {", "removed": [] } ] }, { "file": "java/testing/org/apache/derbyTesting/junit/DriverManagerConnector.java", "hunks": [ { "added": [ " return openConnection(config.getDefaultDatabaseName(), config.getUserName(), config.getUserPassword());", " }", "", " public Connection openConnection(String databaseName) throws SQLException {", " return openConnection(databaseName, config.getUserName(), config.getUserPassword());", " }", "", " public Connection openConnection(String user, String password) throws SQLException {", " return openConnection(config.getDefaultDatabaseName(), user, password);" ], "header": "@@ -40,7 +40,15 @@ public class DriverManagerConnector implements Connector {", "removed": [ " return openConnection(config.getUserName(), config.getUserPassword());" ] } ] }, { "file": "java/testing/org/apache/derbyTesting/junit/DropDatabaseSetup.java", "hunks": [ { "added": [ "import java.util.ArrayList;" ], "header": "@@ -22,6 +22,7 @@ package org.apache.derbyTesting.junit;", "removed": [] }, { "added": [ " * Drop the last database added to the list of used databases." ], "header": "@@ -37,7 +38,7 @@ class DropDatabaseSetup extends BaseJDBCTestSetup {", "removed": [ " * Drop the current database." ] } ] }, { "file": "java/testing/org/apache/derbyTesting/junit/TestConfiguration.java", "hunks": [ { "added": [ "import java.util.ArrayList;", "import java.util.Collection;" ], "header": "@@ -26,6 +26,8 @@ import java.sql.Connection;", "removed": [] }, { "added": [ " * ", " * A configuration manages the pool of databases in use", " * in <code>usedDbNames</code> property. One of those databases", " * is supposed to be the default database. A new database name", " * is added to the pool by one of singleUseDatabaseDecorator functions.", " * The database files are supposed to be local and they will be", " * removed by <code>DropDatabaseSetup</code>.", " *" ], "header": "@@ -35,6 +37,14 @@ import junit.framework.TestSuite;", "removed": [] }, { "added": [ " if (!DERBY_HARNESS_CONFIG.getDefaultDatabaseName().equals(DEFAULT_DBNAME))" ], "header": "@@ -101,7 +111,7 @@ public class TestConfiguration {", "removed": [ " if (!DERBY_HARNESS_CONFIG.getDatabaseName().equals(DEFAULT_DBNAME))" ] }, { "added": [ " * by the list of used databases. The new database name", " * is generated automatically as 'singleUse/oneuseXX' where 'XX' is", " * the unique number. The generated database name is added at the end", " * of <code>usedDbNames</code> and assigned as a default database name." ], "header": "@@ -266,7 +276,10 @@ public class TestConfiguration {", "removed": [ " * by the database name." ] }, { "added": [ " return new DatabaseChangeSetup(new DropDatabaseSetup(test), dbName, true);", " }", " ", " /**", " * Decorate a test to use a new database that is created upon the", " * first connection request to the database and shutdown & deleted at", " * tearDown. The configuration differs only from the current configuration", " * by the list of used databases. The default database name is changed", " * according the <code>defaultDb</code> parameter. The passed database name", " * is added at the end of <code>usedDbNames</code>.", " * This decorator expects the database file to be local so it", " * can be removed.", " * @param test Test to be decorated", " * @param dbName The database name to be added to the list of used databases.", " * @param defaultDb Indicates that the passed database name should be used as a default database.", " * @return decorated test.", " */", " public static TestSetup singleUseDatabaseDecorator(Test test, String dbName, boolean defaultDb)", " {", " return new DatabaseChangeSetup(new DropDatabaseSetup(test), dbName, defaultDb);" ], "header": "@@ -284,7 +297,26 @@ public class TestConfiguration {", "removed": [ " return new DatabaseChangeSetup(new DropDatabaseSetup(test), dbName);" ] }, { "added": [ " return new DatabaseChangeSetup(setSQLAuthMode, DEFAULT_DBNAME_SQL, true);" ], "header": "@@ -334,7 +366,7 @@ public class TestConfiguration {", "removed": [ " return new DatabaseChangeSetup(setSQLAuthMode, DEFAULT_DBNAME_SQL);" ] }, { "added": [ " this.defaultDbName = DEFAULT_DBNAME;", " usedDbNames.add(DEFAULT_DBNAME);", " url = createJDBCUrlWithDatabaseName(defaultDbName);" ], "header": "@@ -390,14 +422,15 @@ public class TestConfiguration {", "removed": [ " this.dbName = DEFAULT_DBNAME;", " url = createJDBCUrlWithDatabaseName(dbName);" ] }, { "added": [ " this.defaultDbName = copy.defaultDbName;", " this.usedDbNames.addAll(copy.usedDbNames); " ], "header": "@@ -405,7 +438,8 @@ public class TestConfiguration {", "removed": [ " this.dbName = copy.dbName;" ] }, { "added": [ " this.url = createJDBCUrlWithDatabaseName(defaultDbName);" ], "header": "@@ -415,7 +449,7 @@ public class TestConfiguration {", "removed": [ " this.url = createJDBCUrlWithDatabaseName(dbName);" ] }, { "added": [ " this.defaultDbName = copy.defaultDbName;", " this.usedDbNames.addAll(copy.usedDbNames);" ], "header": "@@ -429,7 +463,8 @@ public class TestConfiguration {", "removed": [ " this.dbName = copy.dbName;" ] }, { "added": [ " * one except for the database name. The passed database name", " * is added at the end of the list of used databases.", " * If the <code>defaulDb</code> parameter is <code>true</code>", " * the new database name is used as a default database.", " * @param defaultDbName New database name", " * @param defaultDb Indicates that the passed <code>dbName</code> is supposed", " * to be used as the default database name.", " */", " TestConfiguration(TestConfiguration copy, String dbName, boolean defaultDb)", " this.usedDbNames.addAll(copy.usedDbNames);", " this.usedDbNames.add(dbName);", " if (defaultDb) {", " this.defaultDbName = dbName;", " } else {", " this.defaultDbName = copy.defaultDbName;", " }", " " ], "header": "@@ -444,13 +479,25 @@ public class TestConfiguration {", "removed": [ " * one except for the database name.", " * @param dbName New database name", " */", " TestConfiguration(TestConfiguration copy, String dbName)", " this.dbName = dbName;" ] }, { "added": [ " this.url = createJDBCUrlWithDatabaseName(this.defaultDbName);" ], "header": "@@ -460,7 +507,7 @@ public class TestConfiguration {", "removed": [ " this.url = createJDBCUrlWithDatabaseName(dbName);" ] }, { "added": [ " defaultDbName = props.getProperty(KEY_DBNAME, DEFAULT_DBNAME);" ], "header": "@@ -472,7 +519,7 @@ public class TestConfiguration {", "removed": [ " dbName = props.getProperty(KEY_DBNAME, DEFAULT_DBNAME);" ] }, { "added": [ " url = createJDBCUrlWithDatabaseName(defaultDbName);" ], "header": "@@ -500,7 +547,7 @@ public class TestConfiguration {", "removed": [ " url = createJDBCUrlWithDatabaseName(dbName);" ] }, { "added": [ " public String getDefaultDatabaseName() {", " return defaultDbName;", " /**", " * Return the names of all used databases.", " * ", " * @return The ArrayList containing the database names.", " */", " public ArrayList getUsedDatabaseNames() {", " return usedDbNames;", " }", "" ], "header": "@@ -610,10 +657,19 @@ public class TestConfiguration {", "removed": [ " public String getDatabaseName() {", " return dbName;" ] }, { "added": [ " /**", " * Open connection to the specified database.", " * If the database does not exist, it will be created.", " * A default username and password will be used for the connection.", " * Requires that the test has been decorated with a", " * singleUseDatabaseDecorator with the matching name.", " * @return connection to specified database.", " */", " Connection openConnection(String databaseName)", " throws SQLException {", " if (usedDbNames.contains(databaseName))", " return connector.openConnection(databaseName);", " else", " throw new SQLException(\"Database name \\\"\" + databaseName + \"\\\" is not in a list of used databases. \"", " + \"Use method TestConfiguration.singleUseDatabaseDecorator first.\");", " }", " " ], "header": "@@ -662,6 +718,23 @@ public class TestConfiguration {", "removed": [] } ] }, { "file": "java/testing/org/apache/derbyTesting/junit/XADataSourceConnector.java", "hunks": [ { "added": [ " public Connection openConnection(String databaseName) throws SQLException {", " JDBCDataSource.setBeanProperty(ds, \"databaseName\", databaseName);", " try {", " return ds.getXAConnection().getConnection();", " } catch (SQLException e) {", " // Expected state for database not found.", " // For the client the generic 08004 is returned,", " // will just retry on that.", " String expectedState = ", " config.getJDBCClient().isEmbedded() ? \"XJ004\" : \"08004\";", "", " // If there is a database not found exception", " // then retry the connection request with", " // a new DataSource with the createDtabase property set.", " if (!expectedState.equals(e.getSQLState()))", " throw e;", " XADataSource tmpDs = singleUseDS(\"createDatabase\", \"create\");", " JDBCDataSource.setBeanProperty(tmpDs, \"databaseName\", databaseName);", " return tmpDs.getXAConnection().getConnection();", " }", " }", "" ], "header": "@@ -70,6 +70,28 @@ public class XADataSourceConnector implements Connector {", "removed": [] }, { "added": [ " getXAConnection(user, password).getConnection(); ", " }", " }", "", " public Connection openConnection(String databaseName, String user, String password)", " throws SQLException {", " JDBCDataSource.setBeanProperty(ds, \"databaseName\", databaseName);", " try {", " return ds.getXAConnection(user, password).getConnection();", " } catch (SQLException e) {", " // If there is a database not found exception", " // then retry the connection request with", " // a new DataSource with the createDatabase property set.", " if (!\"XJ004\".equals(e.getSQLState()))", " throw e;", " XADataSource tmpDs = singleUseDS(\"createDatabase\", \"create\");", " JDBCDataSource.setBeanProperty(tmpDs, \"databaseName\", databaseName);", " return tmpDs.getXAConnection(user, password).getConnection(); " ], "header": "@@ -81,7 +103,24 @@ public class XADataSourceConnector implements Connector {", "removed": [ " getXAConnection(user, password).getConnection(); " ] } ] } ]
derby-DERBY-2087-e5c9e58c
DERBY-2087 Uses logical database names in additionalDatabaseDecorator method (which replaces singleUseDatabaseDecorator with database name). Contributed by Julius Stroffek Julius.Stroffek@sun.com git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@509258 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/junit/TestConfiguration.java", "hunks": [ { "added": [ "import java.util.Hashtable;" ], "header": "@@ -28,6 +28,7 @@ import java.sql.SQLException;", "removed": [] }, { "added": [ " * is supposed to be the default database. A new default database", " * is added to the pool by <code>singleUseDatabaseDecorator</code> function.", " * <br>", " * Additional databases may be added by <code>additionalDatabaseDecorator</code>", " * function. Each of the additional databases has its logical and physical name.", " * Physical database name is automatically generated as 'singleUse/oneuseXX'", " * where 'XX' is unique number. The logical database name is used to establish", " * a connection to the database using", " * a <code>TestConfiguration::openConnection(String logicalDatabaseName)</code>", " * function.", " * <br>" ], "header": "@@ -40,8 +41,17 @@ import junit.framework.TestSuite;", "removed": [ " * is supposed to be the default database. A new database name", " * is added to the pool by one of singleUseDatabaseDecorator functions." ] }, { "added": [ " ", "", " /**", " * Generate the unique database name for single use.", " */", " private static synchronized String generateUniqueDatabaseName()", " {", " // Forward slash is ok, Derby treats database names", " // as URLs and translates forward slash to the local", " // separator.", " String dbName = \"singleUse/oneuse\";", " dbName = dbName.concat(Integer.toHexString(uniqueDB++));", " return dbName;", " }", "", " " ], "header": "@@ -269,7 +279,22 @@ public class TestConfiguration {", "removed": [ " " ] }, { "added": [ " String dbName = generateUniqueDatabaseName();", " return new DatabaseChangeSetup(new DropDatabaseSetup(test), dbName, dbName, true);", " * by the list of used databases. ", " * The passed database name is mapped to the generated database", " * name 'singleUse/oneuseXX' where 'XX' is the unique number.", " * (by generateUniqueDatabaseName). The generated database name is added", " * at the end of <code>usedDbNames</code>.", " * @param logicalDbName The logical database name. This name is used to identify", " * the database in openConnection(String logicalDatabaseName) method calls.", " public static TestSetup additionalDatabaseDecorator(Test test, String logicalDbName)", " return new DatabaseChangeSetup(new DropDatabaseSetup(test),", " logicalDbName,", " generateUniqueDatabaseName(),", " false);" ], "header": "@@ -285,36 +310,33 @@ public class TestConfiguration {", "removed": [ " // Forward slash is ok, Derby treats database names", " // as URLs and translates forward slash to the local", " // separator.", " String dbName = \"singleUse/oneuse\";", " // Synchronize on the literal name which will be invariant", " // since it is interned.", " synchronized (dbName) {", " dbName = dbName.concat(Integer.toHexString(uniqueDB++));", " }", " return new DatabaseChangeSetup(new DropDatabaseSetup(test), dbName, true);", " * by the list of used databases. The default database name is changed", " * according the <code>defaultDb</code> parameter. The passed database name", " * is added at the end of <code>usedDbNames</code>.", " * @param dbName The database name to be added to the list of used databases.", " * @param defaultDb Indicates that the passed database name should be used as a default database.", " public static TestSetup singleUseDatabaseDecorator(Test test, String dbName, boolean defaultDb)", " return new DatabaseChangeSetup(new DropDatabaseSetup(test), dbName, defaultDb);" ] }, { "added": [ " new DatabaseChangeSetup(setSQLAuthMode, DEFAULT_DBNAME_SQL, DEFAULT_DBNAME_SQL, true)," ], "header": "@@ -379,7 +401,7 @@ public class TestConfiguration {", "removed": [ " new DatabaseChangeSetup(setSQLAuthMode, DEFAULT_DBNAME_SQL, true)," ] }, { "added": [ " logicalDbMapping.put(DEFAULT_DBNAME, DEFAULT_DBNAME);" ], "header": "@@ -465,6 +487,7 @@ public class TestConfiguration {", "removed": [] }, { "added": [ " /**", " * Obtain a new configuration identical to the passed one.", " */", " TestConfiguration(TestConfiguration copy)", " {", " this.defaultDbName = copy.defaultDbName;", " this.usedDbNames.addAll(copy.usedDbNames);", " logicalDbMapping.putAll(copy.logicalDbMapping);", " this.userName = copy.userName;", " this.userPassword = copy.userPassword;", "", " this.isVerbose = copy.isVerbose;", " this.port = copy.port;", " ", " this.jdbcClient = copy.jdbcClient;", " this.hostName = copy.hostName;", " ", " this.url = copy.url;", " initConnector(copy.connector);", " }", "", " logicalDbMapping.putAll(copy.logicalDbMapping);" ], "header": "@@ -476,11 +499,33 @@ public class TestConfiguration {", "removed": [] }, { "added": [], "header": "@@ -494,7 +539,6 @@ public class TestConfiguration {", "removed": [ " " ] }, { "added": [ " logicalDbMapping.putAll(copy.logicalDbMapping);" ], "header": "@@ -507,6 +551,7 @@ public class TestConfiguration {", "removed": [] }, { "added": [ "" ], "header": "@@ -521,6 +566,7 @@ public class TestConfiguration {", "removed": [] }, { "added": [ " TestConfiguration(TestConfiguration copy, String logicalDbName,", " String dbName, boolean defaultDb)", " logicalDbMapping.putAll(copy.logicalDbMapping);", "", " // Can not use the same logical name for different database.", " // If this assert will make failures it might be safely removed", " // since having more physical databases accessible throught the same", " // logical database name will access only the last physical database", " Assert.assertTrue(logicalDbMapping.put(logicalDbName, dbName) == null);", "" ], "header": "@@ -532,10 +578,19 @@ public class TestConfiguration {", "removed": [ " TestConfiguration(TestConfiguration copy, String dbName, boolean defaultDb)" ] }, { "added": [ " usedDbNames.add(defaultDbName);", " logicalDbMapping.put(defaultDbName, defaultDbName);" ], "header": "@@ -564,6 +619,8 @@ public class TestConfiguration {", "removed": [] }, { "added": [ " }", "", " * Requires that the test has been decorated with", " * additionalDatabaseDecorator with the matching name.", " * The physical database name may differ.", " * @param logicalDatabaseName A logical database name as passed", " * to <code>additionalDatabaseDecorator</code> function.", " Connection openConnection(String logicalDatabaseName)", " String databaseName = (String) logicalDbMapping.get(logicalDatabaseName);", " throw new SQLException(\"Database name \\\"\" + logicalDatabaseName", " + \"\\\" is not in a list of used databases.\"", " + \"Use method TestConfiguration.additionalDatabaseDecorator first.\");", "" ], "header": "@@ -771,24 +828,30 @@ public class TestConfiguration {", "removed": [ " } ", " * Requires that the test has been decorated with a", " * singleUseDatabaseDecorator with the matching name.", " Connection openConnection(String databaseName)", " throw new SQLException(\"Database name \\\"\" + databaseName + \"\\\" is not in a list of used databases. \"", " + \"Use method TestConfiguration.singleUseDatabaseDecorator first.\");", " " ] }, { "added": [ " /** Contains the mapping of logical database names to physical database names. */", " private final Hashtable logicalDbMapping = new Hashtable();" ], "header": "@@ -922,6 +985,8 @@ public class TestConfiguration {", "removed": [] } ] } ]
derby-DERBY-2091-077d16c4
DERBY-2091: Increase coverage for StatementEventsTest git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1504820 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2093-1573d084
DERBY-2093 Fixed error in initSlotTable() to print the right page info in case of error during initialization of page from disk into cache. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@476190 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/store/raw/data/StoredPage.java", "hunks": [ { "added": [ "\t\t\tinitSlotTable(newIdentity);" ], "header": "@@ -795,7 +795,7 @@ public class StoredPage extends CachedPage", "removed": [ "\t\t\tinitSlotTable();" ] }, { "added": [ " * @param newIdentity The identity of the page we are trying to ", " * initialize, since we are in the middle of trying", " * to build the page existing info in the class is", " * not set up yet (like getIdentity()). ", "\tprivate void initSlotTable(", " PageKey newIdentity)" ], "header": "@@ -2165,10 +2165,15 @@ public class StoredPage extends CachedPage", "removed": [ "\tprivate void initSlotTable() " ] }, { "added": [ " SQLState.DATA_CORRUPT_PAGE, newIdentity));" ], "header": "@@ -2212,7 +2217,7 @@ public class StoredPage extends CachedPage", "removed": [ " SQLState.DATA_CORRUPT_PAGE, getPageId()));" ] }, { "added": [ " SQLState.DATA_CORRUPT_PAGE, ioe, newIdentity));" ], "header": "@@ -2276,7 +2281,7 @@ public class StoredPage extends CachedPage", "removed": [ " SQLState.DATA_CORRUPT_PAGE, ioe, getPageId()));" ] } ] } ]
derby-DERBY-2096-354d5e84
DERBY-2096 Move remaining methods that are limited to StatementNode from QueryTreeNode. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@481421 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/compile/QueryTreeNode.java", "hunks": [ { "added": [], "header": "@@ -209,18 +209,6 @@ public abstract class QueryTreeNode implements Visitable", "removed": [ "\t/**", "\t * Get the name of the SPS that is used", "\t * to execute this statement. Only relevant", "\t * for an ExecSPSNode -- otherwise, returns null.", "\t *", "\t * @return the name of the underlying sps", "\t */", "\tpublic String getSPSName()", "\t{", "\t\treturn null;", "\t}", "" ] }, { "added": [], "header": "@@ -554,27 +542,6 @@ public abstract class QueryTreeNode implements Visitable", "removed": [ "\t/**", "\t * this implementation of generate() is", "\t * a place-holder until all of the nodes that need to,", "\t * implement it. Only the root, statement nodes", "\t * implement this flavor of generate; the other nodes", "\t * will implement the version that returns Generators", "\t * and takes an activation class builder as an", "\t * argument.", "\t *", "\t * @param\tignored - ignored (he he)", "\t *", "\t * @return\tA GeneratedClass for this statement", "\t *", "\t * @exception StandardException\t\tThrown on error", "\t */", "\tpublic GeneratedClass generate(ByteArray ignored) throws StandardException", "\t{", "\t\tthrow StandardException.newException(SQLState.LANG_UNABLE_TO_GENERATE,", "\t\t\tthis.nodeHeader());", "\t}", "" ] }, { "added": [], "header": "@@ -594,21 +561,6 @@ public abstract class QueryTreeNode implements Visitable", "removed": [ "\t/**", "\t * Only DML statements have result descriptions - for all others", "\t * return null. This method is overridden in DMLStatementNode.", "\t *", "\t * @return\tnull", "\t *", "\t * @exception StandardException never actually thrown here,", "\t *\tbut thrown by subclasses", "\t */", "\tpublic ResultDescription makeResultDescription() ", "\t\tthrows StandardException", "\t{", "\t\treturn null;", "\t}", "" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/StatementNode.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.sql.ResultDescription;" ], "header": "@@ -25,6 +25,7 @@ import org.apache.derby.iapi.services.context.ContextManager;", "removed": [] }, { "added": [ "\t", "\t/**", "\t * Get the name of the SPS that is used to execute this statement. Only", "\t * relevant for an ExecSPSNode -- otherwise, returns null.", "\t * ", "\t * @return the name of the underlying sps", "\t */", "\tpublic String getSPSName() {", "\t\treturn null;", "\t}", "\t * Returns the name of statement in EXECUTE STATEMENT command. Returns null", "\t * for all other commands.", "\t * ", "\t * @return String null unless overridden for Execute Statement command", "\t */", "\tpublic String executeStatementName() {", "\t\treturn null;", "\t}", "", "\t/**", "\t * Returns name of schema in EXECUTE STATEMENT command. Returns null for all", "\t * other commands.", "\t * ", "\t * @return String schema for EXECUTE STATEMENT null for all others", "\t */", "\tpublic String executeSchemaName() {", "\t\treturn null;", "\t}", "\t", "\t/**", "\t * Only DML statements have result descriptions - for all others return", "\t * null. This method is overridden in DMLStatementNode.", "\t * ", "\t * @return null", "\t * ", "\t */", "\tpublic ResultDescription makeResultDescription() {", "\t\treturn null;", "\t}", "", "\t/**", "\t * Convert this object to a String. See comments in QueryTreeNode.java for", "\t * how this should be done for tree printing.", "\t * ", "\t * @return This object as a String" ], "header": "@@ -96,12 +97,53 @@ public abstract class StatementNode extends QueryTreeNode", "removed": [ "\t * Convert this object to a String. See comments in QueryTreeNode.java", "\t * for how this should be done for tree printing.", "\t *", "\t * @return\tThis object as a String" ] } ] } ]
derby-DERBY-2096-8a934404
DERBY-2096 (partial) Move needsSavepoint() to StatementNode, remove QueryTreeNode.bind and optimize. Have GenericStatement use StatementNode for the head of the statement's query tree. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@479886 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/GenericStatement.java", "hunks": [ { "added": [ "import org.apache.derby.impl.sql.compile.StatementNode;" ], "header": "@@ -44,10 +44,9 @@ import org.apache.derby.iapi.sql.conn.StatementContext;", "removed": [ "import org.apache.derby.iapi.sql.compile.NodeFactory;", "import org.apache.derby.impl.sql.compile.QueryTreeNode;" ] }, { "added": [ "\t\t\t\tStatementNode qt = p.parseStatement(statementText, paramDefaults);" ], "header": "@@ -308,7 +307,7 @@ public class GenericStatement", "removed": [ "\t\t\t\tQueryTreeNode qt = p.parseStatement(statementText, paramDefaults);" ] }, { "added": [ "\t\t\t\t\tqt.bindStatement();" ], "header": "@@ -342,7 +341,7 @@ public class GenericStatement", "removed": [ "\t\t\t\t\tqt = qt.bind();" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/CreateTriggerNode.java", "hunks": [ { "added": [ "\tprivate\tValueNode\t\t whenClause;" ], "header": "@@ -78,7 +78,7 @@ public class CreateTriggerNode extends DDLStatementNode", "removed": [ "\tprivate\tQueryTreeNode\t\twhenClause;" ] }, { "added": [ "\t\tthis.whenClause = (ValueNode) whenClause;" ], "header": "@@ -157,7 +157,7 @@ public class CreateTriggerNode extends DDLStatementNode", "removed": [ "\t\tthis.whenClause = (QueryTreeNode) whenClause;" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/DeleteNode.java", "hunks": [ { "added": [ "\tprivate StatementNode[] dependentNodes;" ], "header": "@@ -106,7 +106,7 @@ public class DeleteNode extends DMLModStatementNode", "removed": [ "\tprivate QueryTreeNode[] dependentNodes;" ] }, { "added": [ "\t\t\t\t\tdependentNodes = new StatementNode[noDependents];", "\t\t\t\t\t\tdependentNodes[i].bindStatement();" ], "header": "@@ -369,14 +369,14 @@ public class DeleteNode extends DMLModStatementNode", "removed": [ "\t\t\t\t\tdependentNodes = new QueryTreeNode[noDependents];", "\t\t\t\t\t\tdependentNodes[i].bind();" ] }, { "added": [ "\tprivate StatementNode getDependentTableNode(String tableName, int refAction,", "\t\tStatementNode node=null;" ], "header": "@@ -726,10 +726,10 @@ public class DeleteNode extends DMLModStatementNode", "removed": [ "\tprivate QueryTreeNode getDependentTableNode(String tableName, int refAction,", "\t\tQueryTreeNode node=null;" ] }, { "added": [ " private StatementNode getEmptyDeleteNode(String schemaName, String targetTableName)", " TableName tableName = new TableName();", " FromTable fromTable = (FromTable) nodeFactory.getNode(" ], "header": "@@ -752,22 +752,18 @@ public class DeleteNode extends DMLModStatementNode", "removed": [ " private QueryTreeNode getEmptyDeleteNode(String schemaName, String targetTableName)", " TableName tableName = null;", " FromTable fromTable = null;", " QueryTreeNode retval;", " SelectNode resultSet;", " tableName = new TableName();", " fromTable = (FromTable) nodeFactory.getNode(" ] }, { "added": [ " SelectNode resultSet = (SelectNode) nodeFactory.getNode(" ], "header": "@@ -782,7 +778,7 @@ public class DeleteNode extends DMLModStatementNode", "removed": [ " resultSet = (SelectNode) nodeFactory.getNode(" ] }, { "added": [ " return (StatementNode) nodeFactory.getNode(", " private StatementNode getEmptyUpdateNode(String schemaName, ", " TableName tableName = new TableName();", " FromTable fromTable = (FromTable) nodeFactory.getNode(" ], "header": "@@ -791,35 +787,30 @@ public class DeleteNode extends DMLModStatementNode", "removed": [ " retval =(QueryTreeNode) nodeFactory.getNode(", " return retval;", " private QueryTreeNode getEmptyUpdateNode(String schemaName, ", " TableName tableName = null;", " FromTable fromTable = null;", " QueryTreeNode retval;", " SelectNode resultSet;", " tableName = new TableName();", " fromTable = (FromTable) nodeFactory.getNode(" ] }, { "added": [ " SelectNode resultSet = (SelectNode) nodeFactory.getNode(" ], "header": "@@ -836,7 +827,7 @@ public class DeleteNode extends DMLModStatementNode", "removed": [ "\t\tresultSet = (SelectNode) nodeFactory.getNode(" ] }, { "added": [ " return (StatementNode) nodeFactory.getNode(" ], "header": "@@ -845,13 +836,12 @@ public class DeleteNode extends DMLModStatementNode", "removed": [ " retval =(QueryTreeNode) nodeFactory.getNode(", " return retval;" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/QueryTreeNode.java", "hunks": [ { "added": [], "header": "@@ -467,26 +467,6 @@ public abstract class QueryTreeNode implements Visitable", "removed": [ "\t/**", "\t * Perform the binding operation on a query tree. Binding consists of", "\t * permissions checking, view resolution, datatype resolution, and", "\t * creation of a dependency list (for determining whether a tree or", "\t * plan is still up to date).", "\t *", "\t * This bind() method does nothing. Each node type that can appear", "\t * at the top of a tree can override this method with its own bind()", "\t * method that does \"something\".", "\t *", "\t * @return\tThe bound query tree", "\t *", "\t * @exception StandardException\t\tThrown on error", "\t */", "", "\tpublic QueryTreeNode bind() throws StandardException", "\t{", "\t\treturn this;", "\t}", "" ] }, { "added": [], "header": "@@ -574,29 +554,6 @@ public abstract class QueryTreeNode implements Visitable", "removed": [ "\t/**", "\t * Generates an optimized QueryTree from a bound QueryTree. Actually,", "\t * it annotates the tree in place rather than generating a new tree,", "\t * but this interface allows the root node of the optmized QueryTree", "\t * to be different from the root node of the bound QueryTree.", "\t *", "\t * For non-optimizable statements (for example, CREATE TABLE),", "\t * return the bound tree without doing anything. For optimizable", "\t * statements, this method will be over-ridden in the statement's", "\t * root node (DMLStatementNode in all cases we know about so far).", "\t *", "\t * Throws an exception if the tree is not bound, or if the binding", "\t * is out of date.", "\t *", "\t * @return\tAn optimized QueryTree", "\t *", "\t * @exception StandardException\t\tThrown on error", "\t */", "\tpublic QueryTreeNode optimize() throws StandardException", "\t{", "\t\treturn this;", "\t}", "" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/StatementNode.java", "hunks": [ { "added": [ "\t", "\t/**", "\t * Returns whether or not this Statement requires a set/clear savepoint", "\t * around its execution. The following statement \"types\" do not require them:", "\t *\t\tCursor\t- unnecessary and won't work in a read only environment", "\t *\t\tXact\t- savepoint will get blown away underneath us during commit/rollback", "\t * <p>", "\t * ONLY CALLABLE AFTER GENERATION", "\t * <P>", "\t * This implementation returns true, sub-classes can override the", "\t * method to not require a savepoint.", "\t *", "\t * @return boolean\tWhether or not this Statement requires a set/clear savepoint", "\t */", "\tpublic boolean needsSavepoint()", "\t{", "\t\treturn true;", "\t}" ], "header": "@@ -78,6 +78,24 @@ public abstract class StatementNode extends QueryTreeNode", "removed": [] }, { "added": [], "header": "@@ -119,15 +137,6 @@ public abstract class StatementNode extends QueryTreeNode", "removed": [ "\t// TEMP map QueryTreeNode.bind() onto bindStatement()", "\t// for StatementNode. Part of incremental development", "\t// in switching the api for a compiled statement to", "\t// be StatementNode.", "\tpublic final QueryTreeNode bind() throws StandardException {", "\t\tbindStatement();", "\t\treturn this;", "\t}", "\t" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/depend/BasicDependencyManager.java", "hunks": [ { "added": [], "header": "@@ -305,7 +305,6 @@ public class BasicDependencyManager implements DependencyManager {", "removed": [ "\t\t\t\t\t\t\tLanguageConnectionFactory\tlcf = lcc.getLanguageConnectionFactory();" ] }, { "added": [ "\t\t\t\t\t\t\tcvn.bindStatement();" ], "header": "@@ -314,7 +313,7 @@ public class BasicDependencyManager implements DependencyManager {", "removed": [ "\t\t\t\t\t\t\tcvn = (CreateViewNode) cvn.bind();" ] } ] } ]
derby-DERBY-2096-be0b54fa
DERBY-2096 (partial) Change the main return type from parsing a statement to a StatementNode. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@478031 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/sql/compile/Parser.java", "hunks": [ { "added": [ "import org.apache.derby.impl.sql.compile.StatementNode;" ], "header": "@@ -27,7 +27,7 @@ import org.apache.derby.iapi.error.StandardException;", "removed": [ "import\torg.apache.derby.impl.sql.compile.QueryTreeNode;" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/CreateTriggerNode.java", "hunks": [ { "added": [ "\t\t\tactionNode = parseStatement(actionText, true);" ], "header": "@@ -492,7 +492,7 @@ public class CreateTriggerNode extends DDLStatementNode", "removed": [ "\t\t\tactionNode = (StatementNode)reparseTriggerText();" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/ParserImpl.java", "hunks": [ { "added": [ " private SQLParser cachedParser; " ], "header": "@@ -56,7 +56,7 @@ public class ParserImpl implements Parser", "removed": [ " protected Object cachedParser; " ] }, { "added": [ "\tpublic StatementNode parseStatement(String statementSQLText) " ], "header": "@@ -73,7 +73,7 @@ public class ParserImpl implements Parser", "removed": [ "\tpublic QueryTreeNode parseStatement(String statementSQLText) " ] }, { "added": [ " /**", " private SQLParser getParser()" ], "header": "@@ -96,10 +96,10 @@ public class ParserImpl implements Parser", "removed": [ " /**", " protected Object getParser()" ] }, { "added": [ "\tpublic StatementNode parseStatement(String statementSQLText, Object[] paramDefaults) " ], "header": "@@ -126,7 +126,7 @@ public class ParserImpl implements Parser", "removed": [ "\tpublic QueryTreeNode parseStatement(String statementSQLText, Object[] paramDefaults) " ] }, { "added": [ "\t\t return getParser().Statement(statementSQLText, paramDefaults);" ], "header": "@@ -148,7 +148,7 @@ public class ParserImpl implements Parser", "removed": [ "\t\t return parseGoalProduction( statementSQLText, paramDefaults);" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/StatementNode.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.sql.compile.Parser;", "import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;" ], "header": "@@ -26,6 +26,8 @@ import org.apache.derby.iapi.services.context.ContextManager;", "removed": [] }, { "added": [ "\t" ], "header": "@@ -151,7 +153,7 @@ public abstract class StatementNode extends QueryTreeNode", "removed": [ "" ] } ] } ]
derby-DERBY-2096-cc770d8f
DERBY-2096 (partial) Rename the bind() method for StatementNode to bindStatement() as a step in switching the return type of a parse statement to StatementNode. Make bindStatement() void as no implementation ever switches the type and several implementations did not handle the type switching anyway. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@477371 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/compile/AlterTableNode.java", "hunks": [ { "added": [ "\tpublic void bindStatement() throws StandardException" ], "header": "@@ -208,11 +208,10 @@ public class AlterTableNode extends DDLStatementNode", "removed": [ "\t * @return\tThe bound query tree", "\tpublic QueryTreeNode bind() throws StandardException" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/CallStatementNode.java", "hunks": [ { "added": [ "\tpublic void bindStatement() throws StandardException" ], "header": "@@ -150,12 +150,11 @@ public class CallStatementNode extends DMLStatementNode", "removed": [ "\t * @return\tThe bound query tree", "\tpublic QueryTreeNode bind() throws StandardException" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/CreateAliasNode.java", "hunks": [ { "added": [ "\tpublic void bindStatement() throws StandardException", "\t\t\treturn;" ], "header": "@@ -240,17 +240,16 @@ public class CreateAliasNode extends DDLStatementNode", "removed": [ "\t * @return\tThe bound query tree", "\tpublic QueryTreeNode bind() throws StandardException", "\t\t\treturn this;" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/CreateIndexNode.java", "hunks": [ { "added": [ "\tpublic void bindStatement() throws StandardException" ], "header": "@@ -160,12 +160,10 @@ public class CreateIndexNode extends DDLStatementNode", "removed": [ "\t * @return\tThe bound query tree", "\t *", "\tpublic QueryTreeNode bind() throws StandardException" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/CreateTableNode.java", "hunks": [ { "added": [ "\tpublic void bindStatement() throws StandardException" ], "header": "@@ -197,12 +197,11 @@ public class CreateTableNode extends DDLStatementNode", "removed": [ "\t * @return\tThe bound query tree", "\tpublic QueryTreeNode bind() throws StandardException" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/CreateTriggerNode.java", "hunks": [ { "added": [ "\tpublic void bindStatement() throws StandardException" ], "header": "@@ -215,11 +215,10 @@ public class CreateTriggerNode extends DDLStatementNode", "removed": [ "\t * @return\tThe bound query tree", "\tpublic QueryTreeNode bind() throws StandardException" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/CreateViewNode.java", "hunks": [ { "added": [ "\tpublic void bindStatement() throws StandardException" ], "header": "@@ -167,11 +167,10 @@ public class CreateViewNode extends DDLStatementNode", "removed": [ "\t * @return\tThe bound query tree", "\tpublic QueryTreeNode bind() throws StandardException" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/CursorNode.java", "hunks": [ { "added": [ "\tpublic void bindStatement() throws StandardException" ], "header": "@@ -214,12 +214,11 @@ public class CursorNode extends DMLStatementNode", "removed": [ "\t * @return\tThe bound query tree", "\tpublic QueryTreeNode bind() throws StandardException" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/DMLModStatementNode.java", "hunks": [ { "added": [ "\tValueNode bindConstraints" ], "header": "@@ -460,7 +460,7 @@ abstract class DMLModStatementNode extends DMLStatementNode", "removed": [ "\tpublic\tValueNode bindConstraints" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/DeleteNode.java", "hunks": [ { "added": [ "\tpublic void bindStatement() throws StandardException" ], "header": "@@ -140,12 +140,11 @@ public class DeleteNode extends DMLModStatementNode", "removed": [ "\t * @return\tThe bound query tree", "\tpublic QueryTreeNode bind() throws StandardException" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/DropAliasNode.java", "hunks": [ { "added": [ "\tpublic void bindStatement() throws StandardException" ], "header": "@@ -98,11 +98,10 @@ public class DropAliasNode extends DDLStatementNode", "removed": [ "\t * @return\tThe bound query tree", "\tpublic QueryTreeNode bind() throws StandardException" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/DropIndexNode.java", "hunks": [ { "added": [ "\tpublic void bindStatement() throws StandardException" ], "header": "@@ -61,11 +61,10 @@ public class DropIndexNode extends DDLStatementNode", "removed": [ "\t * @return\tThe bound query tree", "\tpublic QueryTreeNode bind() throws StandardException" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/DropSchemaNode.java", "hunks": [ { "added": [ "\tpublic void bindStatement() throws StandardException" ], "header": "@@ -58,7 +58,7 @@ public class DropSchemaNode extends DDLStatementNode", "removed": [ "\tpublic QueryTreeNode bind() throws StandardException" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/DropTableNode.java", "hunks": [ { "added": [ "\tpublic void bindStatement() throws StandardException" ], "header": "@@ -103,12 +103,11 @@ public class DropTableNode extends DDLStatementNode", "removed": [ "\t * @return\tThe bound query tree", "\tpublic QueryTreeNode bind() throws StandardException" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/DropTriggerNode.java", "hunks": [ { "added": [ "\tpublic void bindStatement() throws StandardException" ], "header": "@@ -51,11 +51,10 @@ public class DropTriggerNode extends DDLStatementNode", "removed": [ "\t * @return\tThe bound query tree", "\tpublic QueryTreeNode bind() throws StandardException" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/DropViewNode.java", "hunks": [ { "added": [ "\tpublic void bindStatement() throws StandardException" ], "header": "@@ -68,12 +68,11 @@ public class DropViewNode extends DDLStatementNode", "removed": [ " \t * @return\tThe bound query tree", "\tpublic QueryTreeNode bind() throws StandardException" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/ExecSPSNode.java", "hunks": [ { "added": [ "\tpublic void bindStatement() throws StandardException" ], "header": "@@ -94,7 +94,7 @@ public class ExecSPSNode extends StatementNode", "removed": [ "\tpublic QueryTreeNode bind() throws StandardException" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/InsertNode.java", "hunks": [ { "added": [ "\tpublic void bindStatement() throws StandardException" ], "header": "@@ -220,12 +220,11 @@ public final class InsertNode extends DMLModStatementNode", "removed": [ "\t * @return\tThe bound query tree", "\tpublic QueryTreeNode bind() throws StandardException" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/LockTableNode.java", "hunks": [ { "added": [ "\tpublic void bindStatement() throws StandardException" ], "header": "@@ -107,12 +107,11 @@ public class LockTableNode extends MiscellaneousStatementNode", "removed": [ "\t * @return\tThe bound query tree", "\tpublic QueryTreeNode bind() throws StandardException" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/RenameNode.java", "hunks": [ { "added": [ "\tpublic void bindStatement() throws StandardException" ], "header": "@@ -224,12 +224,10 @@ public class RenameNode extends DDLStatementNode", "removed": [ "\t * @return\tThe bound query tree", "\t *", "\tpublic QueryTreeNode bind() throws StandardException" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/UpdateNode.java", "hunks": [ { "added": [ "\tpublic void bindStatement() throws StandardException" ], "header": "@@ -180,12 +180,11 @@ public final class UpdateNode extends DMLModStatementNode", "removed": [ "\t * @return\tThe bound query tree", "\tpublic QueryTreeNode bind() throws StandardException" ] }, { "added": [], "header": "@@ -614,7 +613,6 @@ public final class UpdateNode extends DMLModStatementNode", "removed": [ "\t\treturn this;" ] } ] } ]
derby-DERBY-2096-d725d435
DERBY-2096 (partial) Rename the optimize() method for StatementNode to optimizeStatement() as a step in switching the return type of a parse statement to StatementNode. Make optimizeStatement() void as no implementation ever switches the type and several implementations did not handle the type switching anyway. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@477420 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/compile/CallStatementNode.java", "hunks": [ { "added": [ "\tpublic void optimizeStatement() throws StandardException" ], "header": "@@ -189,12 +189,11 @@ public class CallStatementNode extends DMLStatementNode", "removed": [ "\t * @return\tAn optimized QueryTree", "\tpublic QueryTreeNode optimize() throws StandardException" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/CursorNode.java", "hunks": [ { "added": [ "\tpublic void optimizeStatement() throws StandardException" ], "header": "@@ -509,12 +509,11 @@ public class CursorNode extends DMLStatementNode", "removed": [ "\t * @return\tAn optimized QueryTree", "\tpublic QueryTreeNode optimize() throws StandardException" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/DMLModStatementNode.java", "hunks": [ { "added": [ "\tpublic void optimizeStatement() throws StandardException", "\t\tsuper.optimizeStatement();" ], "header": "@@ -1343,16 +1343,13 @@ abstract class DMLModStatementNode extends DMLStatementNode", "removed": [ " * @return An optimized QueryTree", "\tpublic QueryTreeNode optimize() throws StandardException", "\t\tResultSetNode originalRSNode = getResultSetNode();", "", "\t\tQueryTreeNode retval = super.optimize();" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/DMLStatementNode.java", "hunks": [ { "added": [ "\tpublic void optimizeStatement() throws StandardException" ], "header": "@@ -316,12 +316,10 @@ abstract class DMLStatementNode extends StatementNode", "removed": [ "\t * @return\tAn optimized QueryTree", "", "\tpublic QueryTreeNode optimize() throws StandardException" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/DeleteNode.java", "hunks": [ { "added": [ "\tpublic void optimizeStatement() throws StandardException" ], "header": "@@ -890,7 +890,7 @@ public class DeleteNode extends DMLModStatementNode", "removed": [ "\tpublic QueryTreeNode optimize() throws StandardException" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/StatementNode.java", "hunks": [ { "added": [ "\t", "\t/**", "\t * Generates an optimized statement from a bound StatementNode. Actually,", "\t * it annotates the tree in place rather than generating a new tree.", "\t *", "\t * For non-optimizable statements (for example, CREATE TABLE),", "\t * return the bound tree without doing anything. For optimizable", "\t * statements, this method will be over-ridden in the statement's", "\t * root node (DMLStatementNode in all cases we know about so far).", "\t *", "\t * Throws an exception if the tree is not bound, or if the binding", "\t * is out of date.", "\t *", "\t *", "\t * @exception StandardException\t\tThrown on error", "\t */", "\tpublic void optimizeStatement() throws StandardException", "\t{", "\t\t", "\t}", "\t// TEMP -RE_WORK for switching to StatementNode.", "\tpublic final QueryTreeNode optimize() throws StandardException", "\t{", "\t\toptimizeStatement();", "\t\treturn this;", "\t}" ], "header": "@@ -125,6 +125,32 @@ public abstract class StatementNode extends QueryTreeNode", "removed": [] } ] } ]
derby-DERBY-210-64b55c26
DERBY-210 reverting change until jdk1.5 lang/updatableResultset.java diff can be resolved git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@370275 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/client/org/apache/derby/client/am/Connection.java", "hunks": [ { "added": [ " // Since DERBY prepared statements must be re-prepared after a commit,", " // then we must traverse this list after a commit and notify statements", " // that they are now in an un-prepared state.", " final java.util.LinkedList openStatements_ = new java.util.LinkedList();", " // Some statuses of DERBY objects may be invalid on server either after only rollback", " // or after both commit and rollback. For example,", " // If they only depend on rollback, they need to get on RollbackOnlyListeners_.", " final java.util.LinkedList RollbackOnlyListeners_ = new java.util.LinkedList();", " final java.util.LinkedList CommitAndRollbackListeners_ = new java.util.LinkedList();" ], "header": "@@ -30,21 +30,20 @@ public abstract class Connection implements java.sql.Connection,", "removed": [ " ", " // WeakHashMap is used to store references so that the objects added to ", " // the map can get garbage-collected without waiting for the Connection object.", " ", " // When Connection.close() is called, this list is traversed and markClosed() ", " // is called on all statements in this list. ", " final java.util.WeakHashMap openStatements_ = new java.util.WeakHashMap();", " // Some statuses of DERBY objects may be invalid on server after both ", " // commit and rollback. For example,", " final java.util.WeakHashMap CommitAndRollbackListeners_ = new java.util.WeakHashMap();" ] }, { "added": [ " openStatements_.add(ps);" ], "header": "@@ -395,7 +394,7 @@ public abstract class Connection implements java.sql.Connection,", "removed": [ " openStatements_.put(ps,null);" ] }, { "added": [ " RollbackOnlyListeners_.clear();" ], "header": "@@ -738,6 +737,7 @@ public abstract class Connection implements java.sql.Connection,", "removed": [] }, { "added": [ " for (java.util.ListIterator i = openStatements_.listIterator(); i.hasNext();) {" ], "header": "@@ -748,8 +748,7 @@ public abstract class Connection implements java.sql.Connection,", "removed": [ " \tjava.util.Set keySet = openStatements_.keySet();", " for (java.util.Iterator i = keySet.iterator(); i.hasNext();) {" ] }, { "added": [ " for (java.util.ListIterator i = openStatements_.listIterator(); i.hasNext();) {", " for (java.util.ListIterator i = openStatements_.listIterator(); i.hasNext();) {" ], "header": "@@ -757,15 +756,13 @@ public abstract class Connection implements java.sql.Connection,", "removed": [ " \tjava.util.Set keySet = openStatements_.keySet();", " for (java.util.Iterator i = keySet.iterator(); i.hasNext();) {", " \tjava.util.Set keySet = openStatements_.keySet();", " for (java.util.Iterator i = keySet.iterator(); i.hasNext();) {" ] }, { "added": [ " openStatements_.add(s);" ], "header": "@@ -1223,7 +1220,7 @@ public abstract class Connection implements java.sql.Connection,", "removed": [ " openStatements_.put(s,null);" ] }, { "added": [ " openStatements_.add(ps);" ], "header": "@@ -1269,7 +1266,7 @@ public abstract class Connection implements java.sql.Connection,", "removed": [ " openStatements_.put(ps,null);" ] }, { "added": [ " openStatements_.add(cs);" ], "header": "@@ -1307,7 +1304,7 @@ public abstract class Connection implements java.sql.Connection,", "removed": [ " openStatements_.put(cs,null);" ] }, { "added": [ " for (java.util.Iterator i = CommitAndRollbackListeners_.iterator(); i.hasNext();) {" ], "header": "@@ -1447,8 +1444,7 @@ public abstract class Connection implements java.sql.Connection,", "removed": [ " \tjava.util.Set keySet = CommitAndRollbackListeners_.keySet();", " for (java.util.Iterator i = keySet.iterator(); i.hasNext();) {" ] }, { "added": [ " for (java.util.Iterator i = CommitAndRollbackListeners_.iterator(); i.hasNext();) {", " UnitOfWorkListener listener = (UnitOfWorkListener) i.next();", " listener.completeLocalRollback(i);", " }", " for (java.util.Iterator i = RollbackOnlyListeners_.iterator(); i.hasNext();) {" ], "header": "@@ -1463,8 +1459,11 @@ public abstract class Connection implements java.sql.Connection,", "removed": [ " \tjava.util.Set keySet = CommitAndRollbackListeners_.keySet();", " for (java.util.Iterator i = keySet.iterator(); i.hasNext();) {" ] } ] } ]
derby-DERBY-210-bd644c6e
patch 4 toward resolving DERBY-210 Network Server will leak prepared statements if not explicitly closed by the user until the connection is closed Contributed by Deepa Remesh Changes the finalizer method in Statement and PreparedStatement to not send commits or CLSQRY to the server n PreparedStatement class, the finalizer was calling closeX method, which was doing: * Call super.closeX() ---> Statement.closeX() * Cleanup parameter objects - parameterMetaData_, sql_, parameters_ array * Remove the PreparedStatement from connection_.CommitAndRollbackListeners_ list Changes done by patch: * Add a new method markClosed() which will free client-side resources. * The new method is named markClosed() to keep it uniform with naming convention in superclass. * This method is called from close() and finalize() methods. * markClosed() method will call super.markClosed() to perform cleanup of parent class. It will cleanup the objects specific to PreparedStatement, which are ParameterMetaData and parameters. It also removes the PreparedStatement form the list in Connection object. 2. In Statement class, the finalizer was calling closeX method, which was doing: * Close any open cursors for this statement on the server. - If result set is open on server, send CLSQRY to the server. - check if autocommit is required when closing result sets and flow a commit to server, if required * Call Statement.markClosed(), which does - Mark close the result sets on the client - If cursor name was set on the statement, remove it from Connection.clientCursorNameCache_ - Call markClosed() on prepared statements for auto generated keys - Call markClosedOnServer(), which frees up the section. The freed section will be re-used by new statements. * Remove the Statement from Connection.openStatements_ list * Cleanup ResultSetMetaData Changes done by patch: * Move the cleanup of ResultSetMetaData and remove of Statement from Connection.openStatements_ list into markClosed() method. This will keep all client-side cleanup in markClosed(). * Change the finalizer to just call markClosed(). This method frees up client-side resources and operates on synchronized collections. So I have removed the synchronize block from the finalizer. * The autocommit logic does not exist in the finalizer since only markClosed() is called from finalizer. This will avoid untimely commits which was causing the regression in the test lang/updatableResultSet.java -This line, and those below, will be ignored-- M java/client/org/apache/derby/client/am/Statement.java M java/client/org/apache/derby/client/am/PreparedStatement.java git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@380892 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/client/org/apache/derby/client/am/PreparedStatement.java", "hunks": [ { "added": [], "header": "@@ -219,18 +219,6 @@ public class PreparedStatement extends Statement", "removed": [ " protected void finalize() throws java.lang.Throwable {", " if (agent_.loggingEnabled()) {", " agent_.logWriter_.traceEntry(this, \"finalize\");", " }", " if (openOnClient_) {", " synchronized (connection_) {", " closeX();", " }", " }", " super.finalize();", " }", "" ] }, { "added": [ " /* (non-Javadoc)", " * @see org.apache.derby.client.am.Statement#markClosed(boolean)", " */", " protected void markClosed(boolean removeListener){", " \tsuper.markClosed(removeListener);", " \t", " \tif (parameterMetaData_ != null) {" ], "header": "@@ -2003,29 +1991,13 @@ public class PreparedStatement extends Statement", "removed": [ " public void close() throws SQLException {", " try", " {", " synchronized (connection_) {", " if (agent_.loggingEnabled()) {", " agent_.logWriter_.traceEntry(this, \"close\");", " }", " closeX();", " }", " }", " catch ( SqlException se )", " {", " throw se.getSQLException();", " }", " }", "", " // An untraced version of close()", " public void closeX() throws SqlException {", " if (!openOnClient_) {", " return;", " }", " super.closeX();", " if (parameterMetaData_ != null) {" ] } ] }, { "file": "java/client/org/apache/derby/client/am/Statement.java", "hunks": [ { "added": [ " /* (non-Javadoc)", " * @see java.lang.Object#finalize()", " * ", " * This method cleans up client-side resources by calling markClosed().", " * It is different from close() method, which also does clean up on server.", " * Changes done as part of DERBY-210. ", " */", " markClosed();" ], "header": "@@ -358,14 +358,19 @@ public class Statement implements java.sql.Statement, StatementCallbackInterface", "removed": [ " synchronized (connection_) {", " closeX();", " }" ] }, { "added": [ " /**", " * An untraced version of <code>close</code>. This method cleans up ", " * client-side resources and also sends commands to network server to ", " * perform clean up. This should not be called in the finalizer. ", " * Difference between <code>finalize</code> and <code>close</code> is", " * that close method does these things additionally (Changes done as ", " * part of DERBY-210):", " * 1) Sends commands to the server to close the result sets.", " * 2) Sends commands to the server to close the result sets of the ", " * generated keys query.", " * 3) Sends a commit if autocommit is on and it is appropriate.", " * 4) Explicitly removes the statement from connection_.openStatements_ ", " * and CommitAndRollbackListeners_ by passing true to markClosed. ", " * ", " * We may need to do 1) in finalizer too. This is being tracked in ", " * DERBY-1021", " * ", " * @throws SqlException", " */" ], "header": "@@ -475,7 +480,25 @@ public class Statement implements java.sql.Statement, StatementCallbackInterface", "removed": [ " // An untraced version of close()" ] }, { "added": [ " markClosed(true);" ], "header": "@@ -491,13 +514,7 @@ public class Statement implements java.sql.Statement, StatementCallbackInterface", "removed": [ " markClosed();", " connection_.openStatements_.remove(this);", " }", " // push the mark close of rsmd into Statement.markClosed() method", " if (resultSetMetaData_ != null) {", " resultSetMetaData_.markClosed();", " resultSetMetaData_ = null;" ] }, { "added": [ " /**", " * This method cleans up client-side resources held by this Statement. ", " * The Statement will not be removed from the open statements list and ", " * PreparedStatement will also not be removed from the commit and rollback ", " * listeners list in <code>org.apache.derby.client.am.Connection</code>.", " * ", " * This method is called from:", " * 1. finalize() - For the finaizer to be called, the Statement ", " * should not have any references and so it should have been already ", " * removed from the lists. ", " * ", " * 2. <code>org.apache.derby.client.am.Connection#markStatementsClosed</code> ", " * This method explicitly removes the Statement from open statements list.", " * ", " * 3. To close positioned update statements - These statements are not", " * added to the list of open statements.", " */", " \tmarkClosed(false);", " }", " ", " /**", " * This method cleans up client-side resources held by this Statement. ", " * If removeListener is true, the Statement is removed from open statements", " * list and PreparedStatement is also removed from commit and rollback ", " * listeners list. This is called from the close methods.", " * ", " * @param removeListener if true the Statement will be removed", " * from the open statements list and PreparedStatement will also be removed", " * from commit and rollback listeners list in ", " * <code>org.apache.derby.client.am.Connection</code>.", " */", " void markClosed(boolean removeListener) {" ], "header": "@@ -1633,7 +1650,39 @@ public class Statement implements java.sql.Statement, StatementCallbackInterface", "removed": [] }, { "added": [ "", " // mark close ResultSetMetaData", " if (resultSetMetaData_ != null) {", " resultSetMetaData_.markClosed();", " resultSetMetaData_ = null;", " }", " ", " if(removeListener)", " \tconnection_.openStatements_.remove(this);" ], "header": "@@ -1643,6 +1692,15 @@ public class Statement implements java.sql.Statement, StatementCallbackInterface", "removed": [] } ] } ]
derby-DERBY-210-ca8747c0
DERBY-210 cleanup patch in preparation for change Attaching a patch 'derby-210-patch1.diff' which removes the list 'RollbackOnlyListeners_' from org.apache.derby.client.am.Connection class since this is not being used. This is an incremental patch and does not solve the issue fully. While working on this issue, I found one of the causes of memory leaks is object references stored in the lists in the Connection class. On looking at the lists, I found that 'RollbackOnlyListeners' is not being used anywhere in the client code. Submitting this patch to remove this. Contributed by Deepa Remesh git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@376874 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/client/org/apache/derby/client/am/Connection.java", "hunks": [ { "added": [ " // Some statuses of DERBY objects may be invalid on server", " // after both commit and rollback. For example," ], "header": "@@ -38,14 +38,12 @@ public abstract class Connection implements java.sql.Connection,", "removed": [ " // Some statuses of DERBY objects may be invalid on server either after only rollback", " // or after both commit and rollback. For example,", " // If they only depend on rollback, they need to get on RollbackOnlyListeners_.", " final java.util.LinkedList RollbackOnlyListeners_ = new java.util.LinkedList();" ] }, { "added": [], "header": "@@ -807,7 +805,6 @@ public abstract class Connection implements java.sql.Connection,", "removed": [ " RollbackOnlyListeners_.clear();" ] }, { "added": [], "header": "@@ -1712,10 +1709,6 @@ public abstract class Connection implements java.sql.Connection,", "removed": [ " for (java.util.Iterator i = RollbackOnlyListeners_.iterator(); i.hasNext();) {", " UnitOfWorkListener listener = (UnitOfWorkListener) i.next();", " listener.completeLocalRollback(i);", " }" ] } ] } ]
derby-DERBY-210-cff2860a
DERBY-210 - Network Server will leak prepared statements if not explicitly closed by the user until the connection is closed I am uploading a combined patch 'derby-210.diff' which solves the memory leak. As Bryan suggested, I am uploading this patch and will open jira issues for other optimizations. Patch does the following: * Eliminates the below references to PreparedStatement objects by using WeakHashMap instead of LinkedList. When there are no other references to the keys in a WeakHashMap, they will get removed from the map and can thus get garbage-collected. They do not have to wait till the Connection object is collected. - 'openStatements_' in org.apache.derby.client.am.Connection - 'CommitAndRollbackListeners_' in org.apache.derby.client.am.Connection * Removes the list 'RollbackOnlyListeners_' since this is not being used. * Updates the following comment for openStatements_: // Since DERBY prepared statements must be re-prepared after a commit, // then we must traverse this list after a commit and notify statements // that they are now in an un-prepared state. final java.util.LinkedList openStatements_ = new java.util.LinkedList(); In the code, I did not see this list being traversed after a commit to re-prepare statements. Also, I think this is not needed since Derby does not require re-prepare of statements after a commit. Currently, this list is used to close all open statements when the originating connection is closed. * Removes all ResultSets from HashTable 'positionedUpdateCursorNameToResultSet_' in SectionManager. Only result sets of positioned update statements were being removed from this hashtable whereas all result sets were added. Because of this, client driver was holding on to result sets and statements even after rs.close() was called. * Adds a test 'derbyStress.java' to jdbcapi suite. This test is based on the repro for this patch. Without this patch, it fails when run with client driver. Kathey had suggested in another mail that tests for client memory leak problems (DERBY-557, DERBY-210) can be added to same test. I did not see an existing test. So I created this new test. If DERBY-557 does not have a test, I think it can be added to this new test. * Excludes the new test from running with jcc because jcc gives out of memory error. * Creates 'derbyStress_app.properties' with following property 'jvmflags=-Xmx64M' to guarantee the test fails on all machines. Successfully ran derbyall with Sun JDK 1.4.2 on Windows XP. Please take a look at this patch. Contributed by Deepa Remesh git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@369612 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/client/org/apache/derby/client/am/Connection.java", "hunks": [ { "added": [ " ", " // WeakHashMap is used to store references so that the objects added to ", " // the map can get garbage-collected without waiting for the Connection object.", " ", " // When Connection.close() is called, this list is traversed and markClosed() ", " // is called on all statements in this list. ", " final java.util.WeakHashMap openStatements_ = new java.util.WeakHashMap();", " // Some statuses of DERBY objects may be invalid on server after both ", " // commit and rollback. For example,", " final java.util.WeakHashMap CommitAndRollbackListeners_ = new java.util.WeakHashMap();" ], "header": "@@ -30,20 +30,21 @@ public abstract class Connection implements java.sql.Connection,", "removed": [ " // Since DERBY prepared statements must be re-prepared after a commit,", " // then we must traverse this list after a commit and notify statements", " // that they are now in an un-prepared state.", " final java.util.LinkedList openStatements_ = new java.util.LinkedList();", " // Some statuses of DERBY objects may be invalid on server either after only rollback", " // or after both commit and rollback. For example,", " // If they only depend on rollback, they need to get on RollbackOnlyListeners_.", " final java.util.LinkedList RollbackOnlyListeners_ = new java.util.LinkedList();", " final java.util.LinkedList CommitAndRollbackListeners_ = new java.util.LinkedList();" ] }, { "added": [ " openStatements_.put(ps,null);" ], "header": "@@ -394,7 +395,7 @@ public abstract class Connection implements java.sql.Connection,", "removed": [ " openStatements_.add(ps);" ] }, { "added": [], "header": "@@ -737,7 +738,6 @@ public abstract class Connection implements java.sql.Connection,", "removed": [ " RollbackOnlyListeners_.clear();" ] }, { "added": [ " \tjava.util.Set keySet = openStatements_.keySet();", " for (java.util.Iterator i = keySet.iterator(); i.hasNext();) {" ], "header": "@@ -748,7 +748,8 @@ public abstract class Connection implements java.sql.Connection,", "removed": [ " for (java.util.ListIterator i = openStatements_.listIterator(); i.hasNext();) {" ] }, { "added": [ " \tjava.util.Set keySet = openStatements_.keySet();", " for (java.util.Iterator i = keySet.iterator(); i.hasNext();) {", " \tjava.util.Set keySet = openStatements_.keySet();", " for (java.util.Iterator i = keySet.iterator(); i.hasNext();) {" ], "header": "@@ -756,13 +757,15 @@ public abstract class Connection implements java.sql.Connection,", "removed": [ " for (java.util.ListIterator i = openStatements_.listIterator(); i.hasNext();) {", " for (java.util.ListIterator i = openStatements_.listIterator(); i.hasNext();) {" ] }, { "added": [ " openStatements_.put(s,null);" ], "header": "@@ -1220,7 +1223,7 @@ public abstract class Connection implements java.sql.Connection,", "removed": [ " openStatements_.add(s);" ] }, { "added": [ " openStatements_.put(ps,null);" ], "header": "@@ -1266,7 +1269,7 @@ public abstract class Connection implements java.sql.Connection,", "removed": [ " openStatements_.add(ps);" ] }, { "added": [ " openStatements_.put(cs,null);" ], "header": "@@ -1304,7 +1307,7 @@ public abstract class Connection implements java.sql.Connection,", "removed": [ " openStatements_.add(cs);" ] }, { "added": [ " \tjava.util.Set keySet = CommitAndRollbackListeners_.keySet();", " for (java.util.Iterator i = keySet.iterator(); i.hasNext();) {" ], "header": "@@ -1444,7 +1447,8 @@ public abstract class Connection implements java.sql.Connection,", "removed": [ " for (java.util.Iterator i = CommitAndRollbackListeners_.iterator(); i.hasNext();) {" ] }, { "added": [ " \tjava.util.Set keySet = CommitAndRollbackListeners_.keySet();", " for (java.util.Iterator i = keySet.iterator(); i.hasNext();) {" ], "header": "@@ -1459,11 +1463,8 @@ public abstract class Connection implements java.sql.Connection,", "removed": [ " for (java.util.Iterator i = CommitAndRollbackListeners_.iterator(); i.hasNext();) {", " UnitOfWorkListener listener = (UnitOfWorkListener) i.next();", " listener.completeLocalRollback(i);", " }", " for (java.util.Iterator i = RollbackOnlyListeners_.iterator(); i.hasNext();) {" ] } ] } ]
derby-DERBY-210-d51b773e
DERBY-1036: Embedded and client differ with regard to Statement.setCursor Name. client will disallow duplicate cursor names. Embedded will allow it. and DERBY-1183: Client java.sql.ResultSet.getCursorName() does not return the correct cursor name for Statements after the first execution Patch description: The problem underlying DERBY-1183 is the following: A Statement (and by inheritance, PreparedStatement and CallableStatement) will have a cursor name associated with result set generated by the statement. Such names are either set by the user (Statement#setCursorName) or assigned by the system (aka "canned" cursor names in the client driver). In either case, the user can get at the cursor name attached to a statement by calling Resultset#getCursorName. This string can be used to construct the SQL text of positioned update or delete statement. Currently, when a cursor name is set on a statement, the following actions are taken (Statement#setCursorName): 1. The statement's string variable cursorName_ is set to the new string. This keeps track of the user cursor name set for this statement. 2. A cache (clientCursorNameCache) of cursor names set by the user for this connection is maintained to avoid having any two identical cursor name for the same statement/result set. When the cursor name is set, the check is performed (2a) and the cache is updated with the new cursor name if all is well (2b). If the statement (only applies for PreparedStatement and CallableStatement) already has a DRDA section (ch 7.14) allocated, the following is also performed: 3. A map (cursor name -> section) is updated. 4. The section associated with this statement gets its variable clientCursorName set to the supplied cursor name. For Statement, this association (steps 3 and 4) is performed at statement execution time (inside flowExecute, just after the new section is allocated for a query). 5. Also in flowExecute (of Statement, PreparedStatement) the cursor (user set or canned) is associated with the result set (call to mapCursorNameToResultSet). The symptom of this bug is that the cursor name set for a statement seems to be lost after one execution of that statement, reverting to a canned cursor name for executions 2..n. This happens because the cursor name is actually reset as part of the next execute on a statement object: 6. Open result sets for a statement are closed when flowExecute calls readCloseResultSets. During the closing of a result set, ResultSet#markClosed calls statement_.removeClientCursorNameFromCache, which in addition to removing the user cursor name from the cache also sets the statements cursorName_ to null, causing it effectively to be forgotten. Since #5 happens *after* #6 in flowExecute, the execution still works, but with a canned cursor instead of the user named cursor (see mapCursorNameToResultSet). This "race condition" suggests deferring the setup of mappings and insertion into the name cache till execution time (*after* the closing of open result sets on this statement). When studying this I found there was already a bug filed (DERBY-1036) which advises that we defer the check of duplicates till execution time, so this patch fixes both DERBY-1183 and DERBY-1036. In the patch, Statement#setCursorName now only sets the string variable cursorName_. The patch also removes the resetting of cursorName_ in removeClientCursorNameFromCache, so it won't be forgotten. It is still removed from the cache when the result set is closed (and current maps deleted). Furthermore, it moves #2, #3 and #4 till execution time (flowExecute). Item #2a is performed at the start of flowExecute, so we can avoid starting any protocol action if it turns out that we should not start execution (duplicate name). The actions needed in Statement#flowExecute and PreparedStatement#flowExecute are similar, so I factored these out into the methods Statement# checkForDuplicateCursorName and Statement#setupCursorNameCacheAndMappings. Next, I removed code from getCursorName which redundantly performs #3 (now always handled at execute time). CAVEAT: When working on understanding what goes on here, I found that the Statement finalizer can lead to cursors being released; this is part of the client side clean-up for statements that are not explicitly closed (DERBY-210). This can sometimes lead to time variability in canned cursor names in client driver tests which do not close statements explicitly. If the canned cursor name occurs in the canon file, we can see spurious diff due to this. I think we have seen this in the past. Avoid it by closing statements or by naming the cursors explicitly. Finally, I removed work-around code in jdbcapi/checkDataSource.java for derby-1036 and derby-1183 and updated masters to reflect that the cursor names are no longer forgotten. Patch submitted by Dag H. Wanvik. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@416661 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/client/org/apache/derby/client/am/PreparedStatement.java", "hunks": [ { "added": [ " // DERBY-1036: Moved check till execute time to comply with embedded", " // behavior. Since we check here and not in setCursorName, several", " // statements can have the same cursor name as long as their result", " // sets are not simultaneously open.", "", " if (sqlMode_ == isQuery__) {", " checkForDuplicateCursorName();", " }", "" ], "header": "@@ -1588,6 +1588,15 @@ public class PreparedStatement extends Statement", "removed": [] } ] }, { "file": "java/client/org/apache/derby/client/am/Statement.java", "hunks": [ { "added": [ " // s.setCursorName()) adds a user-defined name, but it is not", " // added to the cursor map until execution time (DERBY-1036);", " // then is given the canned cursor name as defined by our jdbc package set." ], "header": "@@ -110,9 +110,10 @@ public class Statement implements java.sql.Statement, StatementCallbackInterface", "removed": [ " // When set (s.setCursorName()) with a user-defined name, then it is added to the cursor map at that time;", " // then is given the canned cursor name as defined by our jdbc package set and added to the cursor map." ] }, { "added": [ " // DERBY-1036: Duplicate cursor names not allowed, check", " // deferred till execute time. " ], "header": "@@ -824,22 +825,9 @@ public class Statement implements java.sql.Statement, StatementCallbackInterface", "removed": [ " // Duplicate cursor names not allowed.", " if (connection_.clientCursorNameCache_.containsKey(name)) {", " throw new SqlException(agent_.logWriter_, ", " new ClientMessageId(SQLState.CURSOR_DUPLICATE_NAME), name);", " }", " connection_.clientCursorNameCache_.put(name, name);", "", " // section_ is null for Statement objects. We will defer the mapping of cursorName", " // to section until when the query is executed.", " if (section_ != null) {", " agent_.sectionManager_.mapCursorNameToQuerySection(name, (Section) section_);", " // This means we must subtitute the <users-cursor-name> with the <canned-cursor-name>", " // in the pass-thru sql string \"...where current of <canned-cursor-name>\".", " section_.setClientCursorName(name);", " }" ] }, { "added": [ " // DERBY-1036: Moved check till execute time to comply with embedded", " // behavior. Since we check here and not in setCursorName, several", " // statements can have the same cursor name as long as their result", " // sets are not simultaneously open.", "", " if (sqlMode_ == isQuery__) {", " checkForDuplicateCursorName();", " }", "" ], "header": "@@ -1893,6 +1881,15 @@ public class Statement implements java.sql.Statement, StatementCallbackInterface", "removed": [] }, { "added": [], "header": "@@ -1912,16 +1909,6 @@ public class Statement implements java.sql.Statement, StatementCallbackInterface", "removed": [ " // if client's cursor name is set, map it to the query section in the hashtable", " // after we obtain the section.", " if (cursorName_ != null) {", " agent_.sectionManager_.mapCursorNameToQuerySection(cursorName_, newSection);", "", " // This means we must subtitute the <users-cursor-name> with the <canned-cursor-name>", " // in the pass-thru sql string \"...where current of <canned-cursor-name>\".", " newSection.setClientCursorName(cursorName_);", " }", "" ] }, { "added": [ "", " // DERBY-1183: If we set it up it earlier, the entry in", " // clientCursorNameCache_ gets wiped out by the closing of", " // result sets happening during readCloseResultSets above", " // because ResultSet#markClosed calls", " // Statement#removeClientCursorNameFromCache.", " setupCursorNameCacheAndMappings();" ], "header": "@@ -2028,9 +2015,13 @@ public class Statement implements java.sql.Statement, StatementCallbackInterface", "removed": [ " // If client's cursor name is set, map the client's cursor name to the ResultSet", " // Else map the server's cursor name to the ResultSet", " mapCursorNameToResultSet();" ] }, { "added": [ " // Two open result sets can not have the same cursor name. ", " protected void checkForDuplicateCursorName() throws SqlException {", " if (cursorName_ != null && (connection_.clientCursorNameCache_.", " containsKey(cursorName_))) {", " throw new SqlException", " (agent_.logWriter_, ", " new ClientMessageId(SQLState.CURSOR_DUPLICATE_NAME), ", " cursorName_);", " }", " }", "", "", " // Set up information to be able to handle cursor names:", " // canned or user named (via setCursorName).", " protected void setupCursorNameCacheAndMappings() {", " if (cursorName_ != null) {", " // The user has set a cursor name for this statement.", " // This means we must subtitute the <users-cursor-name>", " // with the <canned-cursor-name> in the pass-thru sql", " // string \"...where current of <canned-cursor-name>\"", " // whenever the result set produced by this statement", " // is referenced in a positioned update/delete statement.", " agent_.sectionManager_.mapCursorNameToQuerySection", " (cursorName_, section_);", " section_.setClientCursorName(cursorName_);", " ", " // Update cache to avoid duplicates of user set cursor name.", " connection_.clientCursorNameCache_.put(cursorName_, ", " cursorName_);", " } else {", "\t // canned cursor name", "\t agent_.sectionManager_.mapCursorNameToQuerySection", " (section_.getServerCursorName(), section_);", "\t}", "", " // If client's cursor name is set, map the client's cursor name to the", " // result set, else map the server's cursor name to the result set.", " mapCursorNameToResultSet();", " }", "", "" ], "header": "@@ -2411,6 +2402,47 @@ public class Statement implements java.sql.Statement, StatementCallbackInterface", "removed": [] } ] } ]
derby-DERBY-210-dd7d579b
DERBY-210 Network Server will leak prepared statements if not explicitly closed by the user until the connection is closed Contributed by Deepa Remesh ---------------------------------------------------------------- Summary of patch: 'derby-210-patch5-v1.diff' ----------------------------------------------------------------- 1. Eliminates the below references to PreparedStatement objects by using WeakHashMap instead of LinkedList. When there are no other references to the keys in a WeakHashMap, they will get removed from the map and can thus get garbage-collected. They do not have to wait till the Connection object is collected. - 'openStatements_' in org.apache.derby.client.am.Connection - 'CommitAndRollbackListeners_' in org.apache.derby.client.am.Connection 2. Updates the following comment for openStatements_: // Since DERBY prepared statements must be re-prepared after a commit, // then we must traverse this list after a commit and notify statements // that they are now in an un-prepared state. final java.util.LinkedList openStatements_ = new java.util.LinkedList(); In the code, I did not see this list being traversed after a commit to re-prepare statements. Also, I think this is not needed since Derby does not require re-prepare of statements after a commit. Currently, this list is used to close all open statements when the originating connection is closed. 3. Removes all ResultSets from HashTable 'positionedUpdateCursorNameToResultSet_' in SectionManager. Only result sets of positioned update statements were being removed from this hashtable whereas all result sets were added. Because of this, client driver was holding on to result sets and statements even after rs.close() was called. 4. Modifies the test jdbcapi/derbyStress.java to run the test for derby-210. The test was checked in as patch2 but disabled for client framework. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@384331 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/client/org/apache/derby/client/am/Connection.java", "hunks": [ { "added": [ " // DERBY-210 - WeakHashMap is used to store references to objects to avoid", " // memory leaks. When there are no other references to the keys in a ", " // WeakHashMap, they will get removed from the map and can thus get ", " // garbage-collected. They do not have to wait till the Connection object ", " // is collected.", " ", " // In Connection.markStatementsClosed() method, this list is traversed to get a", " // list of open statements, which are marked closed and removed from the list.", " final java.util.WeakHashMap openStatements_ = new java.util.WeakHashMap();" ], "header": "@@ -34,10 +34,15 @@ public abstract class Connection implements java.sql.Connection,", "removed": [ " // Since DERBY prepared statements must be re-prepared after a commit,", " // then we must traverse this list after a commit and notify statements", " // that they are now in an un-prepared state.", " final java.util.LinkedList openStatements_ = new java.util.LinkedList();" ] }, { "added": [ " final java.util.WeakHashMap CommitAndRollbackListeners_ = new java.util.WeakHashMap();" ], "header": "@@ -45,7 +50,7 @@ public abstract class Connection implements java.sql.Connection,", "removed": [ " final java.util.LinkedList CommitAndRollbackListeners_ = new java.util.LinkedList();" ] }, { "added": [ " openStatements_.put(ps, null);" ], "header": "@@ -426,7 +431,7 @@ public abstract class Connection implements java.sql.Connection,", "removed": [ " openStatements_.add(ps);" ] }, { "added": [ " \tjava.util.Set keySet = openStatements_.keySet();", " for (java.util.Iterator i = keySet.iterator(); i.hasNext();) {" ], "header": "@@ -825,7 +830,8 @@ public abstract class Connection implements java.sql.Connection,", "removed": [ " for (java.util.ListIterator i = openStatements_.listIterator(); i.hasNext();) {" ] }, { "added": [ " \tjava.util.Set keySet = openStatements_.keySet();", " for (java.util.Iterator i = keySet.iterator(); i.hasNext();) {", " \tjava.util.Set keySet = openStatements_.keySet();", " for (java.util.Iterator i = keySet.iterator(); i.hasNext();) {" ], "header": "@@ -833,13 +839,15 @@ public abstract class Connection implements java.sql.Connection,", "removed": [ " for (java.util.ListIterator i = openStatements_.listIterator(); i.hasNext();) {", " for (java.util.ListIterator i = openStatements_.listIterator(); i.hasNext();) {" ] }, { "added": [ " openStatements_.put(s, null);" ], "header": "@@ -1462,7 +1470,7 @@ public abstract class Connection implements java.sql.Connection,", "removed": [ " openStatements_.add(s);" ] }, { "added": [ " openStatements_.put(ps,null);" ], "header": "@@ -1515,7 +1523,7 @@ public abstract class Connection implements java.sql.Connection,", "removed": [ " openStatements_.add(ps);" ] }, { "added": [ " openStatements_.put(cs,null);" ], "header": "@@ -1560,7 +1568,7 @@ public abstract class Connection implements java.sql.Connection,", "removed": [ " openStatements_.add(cs);" ] }, { "added": [ " \tjava.util.Set keySet = CommitAndRollbackListeners_.keySet();", " for (java.util.Iterator i = keySet.iterator(); i.hasNext();) {" ], "header": "@@ -1721,7 +1729,8 @@ public abstract class Connection implements java.sql.Connection,", "removed": [ " for (java.util.Iterator i = CommitAndRollbackListeners_.iterator(); i.hasNext();) {" ] }, { "added": [ " \tjava.util.Set keySet = CommitAndRollbackListeners_.keySet();", " \tfor (java.util.Iterator i = keySet.iterator(); i.hasNext();) {" ], "header": "@@ -1736,7 +1745,8 @@ public abstract class Connection implements java.sql.Connection,", "removed": [ " for (java.util.Iterator i = CommitAndRollbackListeners_.iterator(); i.hasNext();) {" ] } ] }, { "file": "java/client/org/apache/derby/client/am/Statement.java", "hunks": [ { "added": [ " // This was being called only on positioned update statements. When working ", " // on DERBY-210, it was found that result sets of all statements (not just", " // positioned update statements) get added to the table. So, this is called", " // for all statements. Otherwise, this will cause memory leaks when statements", " // are not explicitly closed in the application. " ], "header": "@@ -2320,7 +2320,11 @@ public class Statement implements java.sql.Statement, StatementCallbackInterface", "removed": [ " // Only called on positioned upate statements" ] } ] } ]
derby-DERBY-2102-4631dd7d
DERBY-2102: JDBC.assertFullResultSet should handle byte arrays Patch contributed by Øystein Grøvlen. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@477645 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/junit/JDBC.java", "hunks": [ { "added": [ "import java.util.Arrays;" ], "header": "@@ -21,6 +21,7 @@ package org.apache.derbyTesting.junit;", "removed": [] }, { "added": [ " && (expectedRow[i].equals(obj)", " || (obj instanceof byte[] // Assumes byte arrays", " && Arrays.equals((byte[] )obj,", " (byte[] )expectedRow[i]))));", " Object expected = expectedRow[i];", " Object found = obj;", " if (obj instanceof byte[]) {", " expected = bytesToString((byte[] )expectedRow[i]);", " found = bytesToString((byte[] )obj);", " }", " \":\\n Expected: >\" + expected +", " \"<\\n Found: >\" + found + \"<\");", " /**", " * Convert byte array to String.", " * Each byte is converted to a hexadecimal string representation.", " *", " * @param ba Byte array to be converted.", " * @return Hexadecimal string representation. Returns null on null input.", " */", " private static String bytesToString(byte[] ba)", " {", " if (ba == null) return null;", " StringBuffer s = new StringBuffer();", " for (int i = 0; i < ba.length; ++i) {", " s.append(Integer.toHexString(ba[i] & 0x00ff));", " }", " return s.toString();", " }", "" ], "header": "@@ -644,18 +645,43 @@ public class JDBC {", "removed": [ " && expectedRow[i].equals(obj));", "", " \":\\n Expected: >\" + expectedRow[i] +", " \"<\\n Found: >\" + obj + \"<\");" ] } ] } ]
derby-DERBY-2107-1d8153ce
DERBY-2107: Move page latching out of the lock manager Removed the latch methods from the lock manager and the unit tests. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@504462 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/services/locks/LockFactory.java", "hunks": [ { "added": [], "header": "@@ -77,39 +77,6 @@ public interface LockFactory extends PropertySetCallback {", "removed": [ "\t/**", "\t\tLock an object within a compatability space", "\t\tand associate the lock with a group object,", "\t\twaits forever the object to become unlocked.", "\t\t<P>", "\t\tA compatibility space in an space where lock requests are assumed to be", " compatabile and granted by the lock manager if the trio", " {compatabilitySpace, ref, qualifier} are equal (i.e. reference equality", " for qualifier, equals() method", "\t\tfor compatabilitySpace and ref ). A typical reference to use for the compatability", "\t\tspace is a reference to an object representing a transaction.", "\t\tGranted by the lock manager means that the Lockable object may or may ", " not be queried to see if the request is compatible.", "\t\t<BR>", "\t\tA compatability space is not assumed to be owned by a single thread.", "\t", "", "", "\t\t@param compatabilitySpace object defining compatability space (by value)", "\t\t@param group handle of group, must be private to a thread.", "\t\t@param ref reference to object to be locked", "\t\t@param qualifier A qualification of the request.", "", "\t\t@exception org.apache.derby.iapi.error.StandardException A deadlock has occured (message id will be LockFactory.Deadlock)", "\t\t@exception org.apache.derby.iapi.error.StandardException Another thread interupted this thread while", "\t\tit was waiting for the lock. This will be a StandardException with a nested java.lang.InterruptedException exception,", "\t\t(message id will be LockFactory.InterruptedExceptionId)", "\t\t@exception StandardException Standard Cloudscape error policy.", "", "\t*/", "\t//public void lockObject(Object compatabilitySpace, Object group, Lockable ref, Object qualifier)", "\t//\tthrows StandardException;", "" ] } ] }, { "file": "java/engine/org/apache/derby/impl/services/locks/SinglePool.java", "hunks": [ { "added": [], "header": "@@ -21,12 +21,9 @@", "removed": [ "import org.apache.derby.iapi.services.monitor.Monitor;", "", "import org.apache.derby.iapi.services.locks.Latch;" ] }, { "added": [], "header": "@@ -39,24 +36,14 @@ import org.apache.derby.iapi.util.Matchable;", "removed": [ "import java.util.Properties;", "// debugging", "import org.apache.derby.iapi.services.stream.HeaderPrintWriter;", "", " <p>", " The default concrete class \"SinglePool.java\", prints nothing and thus ", " incurs no overhead associated with the code to dump lock information. An", " alternate concrete class \"LockDebug/TracingSinglePool.java\", attempts to ", " output only lock information that \"makes sense\" to a user - for instance it", " doesn't print latch locks." ] } ] }, { "file": "java/testing/org/apache/derbyTesting/unitTests/services/T_LockFactory.java", "hunks": [ { "added": [], "header": "@@ -91,7 +91,6 @@ public class T_LockFactory extends T_MultiIterations", "removed": [ "\t\t\tS008();" ] }, { "added": [], "header": "@@ -499,81 +498,6 @@ public class T_LockFactory extends T_MultiIterations", "removed": [ "\t/**", "\t\tSingle user API test 008.", "", "\t\tCreate two compatability spaces and ensure that locks/latches", "\t\tblock each other out.", "", "\t\tThis test case originally tested that latches were released when a row", "\t\tlock couldn't be obtained immediately, but LockFactory doesn't have", "\t\tthat functionality any more after DERBY-2197.", "", "\t\t@exception StandardException\tAn exception thrown by a method of LockFactory", "\t\t@exception T_Fail\tSome behaviour of the LockFactory is incorrect", "\t*/", "\tvoid S008() throws StandardException, T_Fail {", "", "\t\tObject cs0 = new Object();\t// create an object for the compatability space", "\t\tObject cs1 = new Object();\t// create an object for the compatability space", "", "\t\tObject g0 = new Object();", "\t\tObject g1 = new Object();", "", "\t\tT_L1 page = new T_L1();", "\t\tLockable rA = new T_L1();", "\t\tLockable rB = new T_L1();", "", "\t\tint count;", "", "\t\t// Simulate a page/row lock type access", "\t\tlf.latchObject(cs0, page, null, C_LockFactory.WAIT_FOREVER);", "\t\tlf.lockObject(cs0, g0, rA, null, C_LockFactory.WAIT_FOREVER);", "\t\tlf.unlatch(page.latch);", "", "\t\tlf.latchObject(cs1, page, null, C_LockFactory.WAIT_FOREVER);", "\t\tlf.lockObject(cs1, g1, rB, null, C_LockFactory.WAIT_FOREVER);", "", "\t\tcheckLockCount(cs0, 1);", "\t\tcheckLockCount(cs1, 2);", "", "\t\ttry {", "\t\t\tlf.lockObject(cs1, g1, rA, null, 5000);", "\t\t\tthrow T_Fail.testFailMsg(\"lock succeeded on already locked object\");", "\t\t}", "\t\tcatch (StandardException lfe) {", "\t\t\t// we are expecting the timoeut exception, anything else is an error", "\t\t\tif (!lfe.getMessageId().equals(SQLState.LOCK_TIMEOUT)) {", "\t\t\t\tthrow lfe;", "\t\t\t}", "\t\t\tcheckLockCount(cs0, 1);", "\t\t\tcheckLockCount(cs1, 1);", "\t\t}", "", " try {", " // make sure latch is held", " lf.latchObject(cs0, page, null, 5000);", "\t\t\tthrow T_Fail.testFailMsg(\"latch succeeded on already latch object\");", " }", "\t\tcatch (StandardException lfe) {", "\t\t\t// we are expecting timoeut exception, anything else is an error", "\t\t\tif (!lfe.getMessageId().equals(SQLState.LOCK_TIMEOUT)) {", "\t\t\t\tthrow lfe;", "\t\t\t}", "\t\t}", "", "\t\tlf.unlatch(page.latch);", "", "\t\tlf.unlock(cs0, g0, rA, null);", "\t\tlf.unlock(cs1, g0, rB, null);", "", "\t\tPASS(\"S008\");", "", "", "\t}\t", "", "", "" ] } ] } ]
derby-DERBY-2107-363cf3ae
DERBY-2107: Move page latching out of the lock manager Handle latches locally in BasePage instead of going through the lock manager. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@503440 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/store/raw/data/BasePage.java", "hunks": [ { "added": [], "header": "@@ -25,12 +25,6 @@ import org.apache.derby.iapi.reference.SQLState;", "removed": [ "import org.apache.derby.iapi.services.io.DynamicByteArrayOutputStream;", "", "import org.apache.derby.iapi.services.locks.C_LockFactory;", "import org.apache.derby.iapi.services.locks.Lockable;", "import org.apache.derby.iapi.services.locks.Latch;", "import org.apache.derby.iapi.services.locks.VirtualLockTable;" ] }, { "added": [], "header": "@@ -46,20 +40,15 @@ import org.apache.derby.iapi.store.raw.FetchDescriptor;", "removed": [ "import org.apache.derby.iapi.store.raw.RawStoreFactory;", "import org.apache.derby.iapi.store.access.Qualifier;", "import org.apache.derby.iapi.types.DataValueDescriptor;", "", "import java.util.Hashtable;" ] }, { "added": [ "abstract class BasePage implements Page, Observer, TypedFormat" ], "header": "@@ -85,7 +74,7 @@ import java.util.Observable;", "removed": [ "public abstract class BasePage implements Page, Lockable, Observer, TypedFormat" ] }, { "added": [], "header": "@@ -128,12 +117,6 @@ public abstract class BasePage implements Page, Lockable, Observer, TypedFormat", "removed": [ "\t/**", "\t\tLockManager held latch during exclusive access.", "\t\tWhen this is not null, latch.getQualifier() == owner", "\t*/", "\tprivate Latch\tmyLatch;", "\t" ] }, { "added": [ "\t/**", "\t * Check whether the page is latched.", "\t *", "\t * @return <code>true</code> if the page is latched, <code>false</code>", "\t * otherwise", "\t * @see Page#isLatched", "\t */", "\tpublic final synchronized boolean isLatched() {", "\t\t\tSanityManager.ASSERT(identity != null);" ], "header": "@@ -1306,18 +1289,16 @@ public abstract class BasePage implements Page, Lockable, Observer, TypedFormat", "removed": [ "\t/** @see Page#isLatched */", "\tpublic boolean isLatched() {", "", "\t\t\tsynchronized(this)", "\t\t\t{", "\t\t\t\tSanityManager.ASSERT(identity != null);", "\t\t\t\tif (owner != null) {", "\t\t\t\t\tif (owner != myLatch.getQualifier())", "\t\t\t\t\t\tSanityManager.THROWASSERT(\"Page incorrectly latched - \" + owner + \" \" + myLatch.getQualifier());", "\t\t\t\t}", "\t\t\t}" ] }, { "added": [], "header": "@@ -1502,88 +1483,6 @@ public abstract class BasePage implements Page, Lockable, Observer, TypedFormat", "removed": [ "\t/*", "\t** Methods from Lockable, just require a single exclusive locker", "\t*/", "", "\t/**", "\t\tLatch me.", "\t\t<BR>", "\t\tMT - single thread required (methods of Lockable)", "\t\t@see Lockable#lockEvent", "\t*/", "\tpublic void lockEvent(Latch lockInfo) {", "\t\tif (SanityManager.DEBUG) {", "\t\t\tSanityManager.ASSERT(owner == null, \"Should only be called when not locked\");", "\t\t}", "", "\t\tsynchronized (this) {", "", "\t\t\tmyLatch = lockInfo;", "", " // Move page state from UNLATCHED to PRELATCH, setExclusiveNo*()", " // routines do the work of completing the latch - using the ", " // preLatch status. This is so that", " // we don't have to wait for a clean() initiated I/O here while", " // holding the locking system monitor.", "\t\t\t(owner = (BaseContainerHandle) lockInfo.getQualifier()).addObserver(this);", " preLatch = true;", "\t\t}", "\t}", "", "\t/**", "\t\tIs another request compatible, no never.", "\t\t<BR> MT - single thread required (methods of Lockable)", "\t\t@see Lockable#requestCompatible", "\t*/", "\tpublic boolean requestCompatible(Object requestedQualifier, Object grantedQualifier) {", "\t\tif (SanityManager.DEBUG) {", "\t\t\tSanityManager.ASSERT(owner != null, \"Should only be called when locked\");", "\t\t}", "", "\t\treturn false;", "\t}", "", "\t/**", "\t\tIs another request compatible, no never.", "\t\t<BR> MT - single thread required (methods of Lockable)", "\t\t@see Lockable#requestCompatible", "\t*/", "\tpublic boolean lockerAlwaysCompatible() {", "\t\tif (SanityManager.DEBUG) {", "\t\t\tSanityManager.ASSERT(owner != null, \"Should only be called when locked\");", "\t\t}", "", "\t\treturn false;", "\t}", "", "\t/**", "\t\tUnlatch me, only to be called from lock manager.", "\t\t<BR> MT - single thread required (methods of Lockable)", "", "\t\t@see Lockable#requestCompatible", "\t*/", "\tpublic void unlockEvent(Latch lockInfo) {", "\t\tif (SanityManager.DEBUG) {", "\t\t\tSanityManager.ASSERT(owner != null, \"Should only be called when locked\");", "\t\t}", "", "\t\tsynchronized (this) {", "", "\t\t\tif (SanityManager.DEBUG) {", "\t\t\t\tif (nestedLatch != 0)", "\t\t\t\t\tSanityManager.THROWASSERT(\"nestedLatch is non-zero on unlockEvent - value = \" + nestedLatch);", "\t\t\t}", "", "\t\t\towner.deleteObserver(this);", "\t\t\towner = null;", "\t\t\tmyLatch = null;", "\t\t\tif (inClean)", "\t\t\t\tnotifyAll();", "\t\t}", "\t}", "", "" ] }, { "added": [ "\tvoid setExclusive(BaseContainerHandle requester)" ], "header": "@@ -1632,7 +1531,7 @@ public abstract class BasePage implements Page, Lockable, Observer, TypedFormat", "removed": [ "\tpublic void setExclusive(BaseContainerHandle requester) " ] }, { "added": [ "\t\t// because i) latches are exclusive for simplicity and" ], "header": "@@ -1642,7 +1541,7 @@ public abstract class BasePage implements Page, Lockable, Observer, TypedFormat", "removed": [ "\t\t// because i) lock manager might assume latches are exclusive for" ] }, { "added": [ "", "\t\t\t\t// just deadlock out if a transaction tries to double latch the", "\t\t\t\t// page while not in abort", "\t\t\twhile (owner != null) {", "\t\t\t\ttry {", "\t\t\t\t\t// Expect notify from releaseExclusive().", "\t\t\t\t\twait();", "\t\t\t\t} catch (InterruptedException ie) {", "\t\t\t\t\tthrow StandardException.interrupt(ie);", "\t\t\t\t}", "\t\t\t}", "\t\t\tpreLatch(requester);", "\t\t\t// latch granted, but cleaner may \"own\" the page.", "\t\t\tif (SanityManager.DEBUG) {", "\t\t\t\tSanityManager.ASSERT(isLatched(), \"page not latched\");", "\t\t\t}", " // Latch will be granted, even if cleaner \"owns\" the page." ], "header": "@@ -1661,24 +1560,29 @@ public abstract class BasePage implements Page, Lockable, Observer, TypedFormat", "removed": [ "\t\t\t// just deadlock out ...", "\t\t}", "\t\t// Latch the page, owner is set through the Lockable call backs.", "\t\tt.getLockFactory().latchObject(", " t, this, requester, C_LockFactory.WAIT_FOREVER);\t\t", " // latch granted, but cleaner may \"own\" the page. ", "\t\tif (SanityManager.DEBUG) {", "\t\t\tSanityManager.ASSERT(isLatched(), \"page not latched\");", "\t\t}", " synchronized (this)", " {", " // lockEvent() will grant latch, even if cleaner \"owns\" the page." ] }, { "added": [ "\t\t\t// Pre-latch the page if no one already has latched it or requested", "\t\t\t// a latch. Otherwise, give up and return false.", "\t\t\tif (owner == null) {", "\t\t\t\tpreLatch(requester);", "\t\t\t} else {", "\t\t\t\treturn false;", "\t\t\t}", " // Latch will be granted, even if cleaner \"owns\" the page." ], "header": "@@ -1724,17 +1628,16 @@ public abstract class BasePage implements Page, Lockable, Observer, TypedFormat", "removed": [ "\t\t\t// just deadlock out ...", "\t\t}", "\t\t// Latch the page, owner is set through the Lockable call backs.", "\t\tboolean gotLatch = t.getLockFactory().latchObject(t, this, requester, C_LockFactory.NO_WAIT);", "\t\tif (!gotLatch)", "\t\t\treturn false;", " synchronized (this)", " {", " // lockEvent() will grant latch, even if cleaner \"owns\" the page." ] }, { "added": [ "\tprotected synchronized void releaseExclusive() {" ], "header": "@@ -1773,7 +1676,7 @@ public abstract class BasePage implements Page, Lockable, Observer, TypedFormat", "removed": [ "\tprotected void releaseExclusive() /* throws StandardException */ {" ] }, { "added": [ "\t\towner.deleteObserver(this);", "\t\towner = null;", "\t\tnotifyAll();", "\t}", "", "\t/**", "\t * Move page state from UNLATCHED to PRELATCH. setExclusive*() routines do", "\t * the work of completing the latch - using the preLatch status.", "\t *", "\t * @param requester handle to the container requesting ownership", "\t */", "\tprivate void preLatch(BaseContainerHandle requester) {", "\t\tif (SanityManager.DEBUG) {", "\t\t\tSanityManager.ASSERT(!isLatched(),", "\t\t\t\t\t\t\t\t \"Attempted to pre-latch a latched page\");", "\t\t}", "\t\towner = requester;", "\t\t// make sure the latch is released if the container is closed", "\t\trequester.addObserver(this);", "\t\tpreLatch = true;" ], "header": "@@ -1788,8 +1691,26 @@ public abstract class BasePage implements Page, Lockable, Observer, TypedFormat", "removed": [ "\t\tRawTransaction t = owner.getTransaction();", "\t\tt.getLockFactory().unlatch(myLatch);" ] }, { "added": [], "header": "@@ -2798,39 +2719,4 @@ public abstract class BasePage implements Page, Lockable, Observer, TypedFormat", "removed": [ "", "\t/**", "\t\tThis lockable wants to participate in the Virtual Lock table.", "\t */", "\tpublic boolean lockAttributes(int flag, Hashtable attributes)", "\t{", "\t\tif (SanityManager.DEBUG)", "\t\t{", "\t\t\tSanityManager.ASSERT(attributes != null, ", "\t\t\t\t\"cannot call lockProperties with null attribute list\");", "\t\t}", "", "\t\tif ((flag & VirtualLockTable.LATCH) == 0)", "\t\t\treturn false;", "", "\t\t// by the time this is called, the page may be unlatched.", "\t\tPageKey pageId = identity;", "", "\t\t// not latched", "\t\tif (pageId == null)", "\t\t\treturn false;", "", "\t\tattributes.put(VirtualLockTable.CONTAINERID, ", "\t\t\t\t\t new Long(pageId.getContainerId().getContainerId()));", "\t\tattributes.put(VirtualLockTable.LOCKNAME, pageId.toString());", "\t\tattributes.put(VirtualLockTable.LOCKTYPE, \"LATCH\");", "", "\t\t// don't new unecesary things for now", "\t\t// attributes.put(VirtualLockTable.SEGMENTID, new Long(pageId.getContainerId().getSegmentId()));", "\t\t// attributes.put(VirtualLockTable.PAGENUM, new Long(pageId.getPageNumber()));", "", "\t\treturn true;", "\t}", "\t\t", "" ] } ] } ]