id
stringlengths 22
25
| commit_message
stringlengths 137
6.96k
| diffs
listlengths 0
63
|
|---|---|---|
derby-DERBY-1-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-1001-5e009439
|
(DERBY-1001): Removed two unused imports and renamed a local variable hiding an instance variable.
Patch file: n/a
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@666583 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-1002-f0dcf0bb
|
DERBY-1002 - Check that DRDAStatement and DRDAResultSet states are reset when they are re-used
Contributed by Deepa Remesh
Please take a look at following two patches - patch 1 contains code changes and patch 2 contains tests. These have to be committed together.
------------------------------------------
1. derby1002-patch1-v1
------------------------------------------
* Adds reset() methods to DRDAStatement and DRDAResultSet objects. The purpose of reset method is to reset the states of all variables so that the objects can be re-used and will not have left-over states.
* In case of DRDAStatement, the following variables are not reset:
+ * 1. database - This variable gets initialized in the constructor and by
+ * call to setDatabase.
+ * 2. members which get initialized in setPkgnamcsn (pkgnamcsn, pkgcnstkn,
+ * pkgid, pkgsn, isolationLevel, cursorName). pkgnamcsn is the key used to
+ * find if the DRDAStatement can be re-used. Hence its value will not change
+ * when the object is re-used.
* close() methods are changed to only close and dereference objects.
* DRDAStatement.rsClose() method is not used in close() or reset(). This method has some checks which were causing the method to return without resetting currentDrdaRs. Now, close() calls currentDrdaRs.close() and reset() calls currentDrdaRs.reset().
* In Database.newDrdaStatement, close() method is called followed by reset() when the server finds the statement can be re-used.
------------------------------------------
2. derby1002-patch2-v2
------------------------------------------
Modifies test lang/procedure.java. Adds a method 'setupStatementReuse' which creates and uses statements in such a way as to provoke re-use of statements and result sets on network server. This method is called from tests for jira-491 and 'testImplicitClose'.
------------------------------------------------------------------------------------
Remaining TODOs for DERBY-1002
------------------------------------------------------------------------------------
* pkgcnstkn, pkgid, pkgsn variables can be removed from DRDAStatement since these are derived from pkgnamcsn object.
* Look into what is required by initialize() of default statement. Currently, initialize just calls setTypDefValues(). Once the purpose of this method is confirmed, we may need to modify the comments at places it is currently called.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@381937 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/drda/org/apache/derby/impl/drda/DRDAResultSet.java",
"hunks": [
{
"added": [
"\t//NOTE!",
"\t//",
"\t// Since DRDAResultSets are reused, ALL variables should be set ",
"\t// to their default values in reset()."
],
"header": "@@ -33,6 +33,10 @@ import org.apache.derby.impl.jdbc.EmbedResultSet;",
"removed": []
},
{
"added": [
"\t/**",
"\t * This method closes the JDBC objects and frees up all references held by",
"\t * this object.",
"\t * @throws SQLException"
],
"header": "@@ -341,19 +345,18 @@ class DRDAResultSet",
"removed": [
"\t/** Clean up statements and resultSet",
"\t\tgotPrctyp = false;",
"\t\tscrollType = ResultSet.TYPE_FORWARD_ONLY;\t",
"\t\tconcurType = 0;",
"\t\trowCount = 0;"
]
}
]
},
{
"file": "java/drda/org/apache/derby/impl/drda/DRDAStatement.java",
"hunks": [
{
"added": [
"\t//NOTE!",
"\t//",
"\t// Since DRDAStatements are reused, ALL variables (except those noted in ",
"\t// the comments for reset method) should be set to their default values ",
"\t// in reset().",
"\t"
],
"header": "@@ -50,7 +50,12 @@ import org.apache.derby.impl.jdbc.Util;",
"removed": [
""
]
},
{
"added": [
"\t * This method is used to initialize the default statement of the database",
"\t * for re-use. It is different from reset() method since default statements",
"\t * get initiliazed differently. e.g: stmt variable used in default statement",
"\t * is created only once in Database.makeConnection. ",
"\t * TODO: Need to see what exactly it means to initialize the default ",
"\t * statement. (DERBY-1002)",
"\t * "
],
"header": "@@ -462,7 +467,13 @@ class DRDAStatement",
"removed": [
"\t * Initialize for reuse"
]
},
{
"added": [
"\t/**",
"\t * This method closes the JDBC objects and frees up all references held by",
"\t * this object.",
"\t * @throws SQLException"
],
"header": "@@ -949,9 +960,11 @@ class DRDAStatement",
"removed": [
"\t/** ",
"\t * Clean up statements and resultSet"
]
}
]
},
{
"file": "java/drda/org/apache/derby/impl/drda/Database.java",
"hunks": [
{
"added": [
"\t * Get a new DRDA statement and store it in the stmtTable if stortStmt is ",
"\t * true. If possible recycle an existing statement. When the server gets a",
"\t * new statement with a previously used pkgnamcsn, it means that ",
"\t * client-side statement associated with this pkgnamcsn has been closed. In ",
"\t * this case, server can re-use the DRDAStatement by doing the following: ",
"\t * 1) Retrieve the old DRDAStatement associated with this pkgnamcsn and",
"\t * close it.",
"\t * 2) Reset the DRDAStatement state for re-use.",
"\t * "
],
"header": "@@ -168,10 +168,15 @@ class Database",
"removed": [
"\t * Get a new DRDA statement and store it in the stmtTable if stortStmt is true",
"\t * If possible recycle an existing statement",
"\t * If we are asking for one with the same name it means it",
"\t * was already closed."
]
}
]
}
] |
derby-DERBY-1004-494a3289
|
DERBY-1004: Client should not require user to rollback the active transaction before call to PooledConnection.getConnection()
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@412852 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/client/org/apache/derby/client/ClientPooledConnection.java",
"hunks": [
{
"added": [
" } "
],
"header": "@@ -178,7 +178,7 @@ public class ClientPooledConnection implements javax.sql.PooledConnection {",
"removed": [
" }"
]
}
]
}
] |
derby-DERBY-1005-fdfc981e
|
DERBY-966 DERBY-1005 1) Change DRDAStatement to use the EngineConnection.prepareStatement() method that has a holdability parameter. This ensures prepares on a connection that was obtained from a XADataSource (or a ConnectionPoolDataSource) do not lose the holdability requested by the application.
2) Change the client's state of holdability to match the embedded in that a Connection's holdability is set to close cursors on commit when it has an active global XA transaction.
Patch addresses this issue completely.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@380278 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/client/org/apache/derby/client/am/Connection.java",
"hunks": [
{
"added": [
"import org.apache.derby.shared.common.reference.JDBC30Translation;"
],
"header": "@@ -21,6 +21,7 @@",
"removed": []
},
{
"added": [
" /**",
" * Holdabilty for created statements.",
" * Only access through the holdability method",
" * to ensure the correct value is returned for an",
" * XA connection.",
" */",
" private int holdability = JDBC30Translation.HOLD_CURSORS_OVER_COMMIT;",
" "
],
"header": "@@ -53,7 +54,14 @@ public abstract class Connection implements java.sql.Connection,",
"removed": [
" public int resultSetHoldability_;"
]
},
{
"added": [
" private int xaState_ = XA_T0_NOT_ASSOCIATED;"
],
"header": "@@ -108,7 +116,7 @@ public abstract class Connection implements java.sql.Connection,",
"removed": [
" protected int xaState_ = XA_T0_NOT_ASSOCIATED;"
]
},
{
"added": [
" ",
" holdability = JDBC30Translation.HOLD_CURSORS_OVER_COMMIT;"
],
"header": "@@ -236,6 +244,8 @@ public abstract class Connection implements java.sql.Connection,",
"removed": []
},
{
"added": [
" Statement s = createStatementX(java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY, holdability());"
],
"header": "@@ -341,7 +351,7 @@ public abstract class Connection implements java.sql.Connection,",
"removed": [
" Statement s = createStatementX(java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY, resultSetHoldability_);"
]
},
{
"added": [
" holdability(),"
],
"header": "@@ -362,7 +372,7 @@ public abstract class Connection implements java.sql.Connection,",
"removed": [
" resultSetHoldability_,"
]
},
{
"added": [
" CallableStatement cs = prepareCallX(sql, java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY, holdability());"
],
"header": "@@ -400,7 +410,7 @@ public abstract class Connection implements java.sql.Connection,",
"removed": [
" CallableStatement cs = prepareCallX(sql, java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY, resultSetHoldability_);"
]
},
{
"added": [
" PreparedStatement ps = newPreparedStatement_(sql, java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY, holdability(), java.sql.Statement.NO_GENERATED_KEYS, null);"
],
"header": "@@ -413,7 +423,7 @@ public abstract class Connection implements java.sql.Connection,",
"removed": [
" PreparedStatement ps = newPreparedStatement_(sql, java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY, resultSetHoldability_, java.sql.Statement.NO_GENERATED_KEYS, null);"
]
},
{
"added": [
" holdability());"
],
"header": "@@ -908,7 +918,7 @@ public abstract class Connection implements java.sql.Connection,",
"removed": [
" resultSetHoldability_);"
]
},
{
"added": [
" Statement s = createStatementX(resultSetType, resultSetConcurrency, holdability());"
],
"header": "@@ -1052,7 +1062,7 @@ public abstract class Connection implements java.sql.Connection,",
"removed": [
" Statement s = createStatementX(resultSetType, resultSetConcurrency, resultSetHoldability_);"
]
},
{
"added": [
" holdability(),"
],
"header": "@@ -1075,7 +1085,7 @@ public abstract class Connection implements java.sql.Connection,",
"removed": [
" resultSetHoldability_,"
]
},
{
"added": [
" CallableStatement cs = prepareCallX(sql, resultSetType, resultSetConcurrency, holdability());"
],
"header": "@@ -1097,7 +1107,7 @@ public abstract class Connection implements java.sql.Connection,",
"removed": [
" CallableStatement cs = prepareCallX(sql, resultSetType, resultSetConcurrency, resultSetHoldability_);"
]
},
{
"added": [
" CallableStatement cs = prepareCallX(sql, java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY, holdability());"
],
"header": "@@ -1112,7 +1122,7 @@ public abstract class Connection implements java.sql.Connection,",
"removed": [
" CallableStatement cs = prepareCallX(sql, java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY, resultSetHoldability_);"
]
},
{
"added": [
" this.holdability = holdability;",
" ",
" }"
],
"header": "@@ -1182,8 +1192,9 @@ public abstract class Connection implements java.sql.Connection,",
"removed": [
" resultSetHoldability_ = holdability;",
" }"
]
},
{
"added": [
" agent_.logWriter_.traceExit(this, \"getHoldability\", holdability());",
" return holdability();"
],
"header": "@@ -1195,9 +1206,9 @@ public abstract class Connection implements java.sql.Connection,",
"removed": [
" agent_.logWriter_.traceExit(this, \"getHoldability\", resultSetHoldability_);",
" return resultSetHoldability_;"
]
},
{
"added": [
" holdability());"
],
"header": "@@ -1263,7 +1274,7 @@ public abstract class Connection implements java.sql.Connection,",
"removed": [
" resultSetHoldability_);"
]
},
{
"added": [
" holdability());"
],
"header": "@@ -1320,7 +1331,7 @@ public abstract class Connection implements java.sql.Connection,",
"removed": [
" resultSetHoldability_);"
]
},
{
"added": [
" holdability());"
],
"header": "@@ -1378,7 +1389,7 @@ public abstract class Connection implements java.sql.Connection,",
"removed": [
" resultSetHoldability_);"
]
},
{
"added": [
" holdability(),"
],
"header": "@@ -1551,7 +1562,7 @@ public abstract class Connection implements java.sql.Connection,",
"removed": [
" resultSetHoldability_,"
]
},
{
"added": [
" holdability(),"
],
"header": "@@ -1589,7 +1600,7 @@ public abstract class Connection implements java.sql.Connection,",
"removed": [
" resultSetHoldability_,"
]
}
]
},
{
"file": "java/client/org/apache/derby/client/am/DatabaseMetaData.java",
"hunks": [
{
"added": [
" if (connection_.holdability() == JDBC30Translation.HOLD_CURSORS_OVER_COMMIT) {"
],
"header": "@@ -1282,7 +1282,7 @@ public abstract class DatabaseMetaData implements java.sql.DatabaseMetaData {",
"removed": [
" if (connection_.resultSetHoldability_ == JDBC30Translation.HOLD_CURSORS_OVER_COMMIT) {"
]
},
{
"added": [
" if (connection_.holdability() == JDBC30Translation.HOLD_CURSORS_OVER_COMMIT) {"
],
"header": "@@ -1629,7 +1629,7 @@ public abstract class DatabaseMetaData implements java.sql.DatabaseMetaData {",
"removed": [
" if (connection_.resultSetHoldability_ == JDBC30Translation.HOLD_CURSORS_OVER_COMMIT) {"
]
},
{
"added": [
" if (connection_.holdability() == JDBC30Translation.HOLD_CURSORS_OVER_COMMIT) {"
],
"header": "@@ -1682,7 +1682,7 @@ public abstract class DatabaseMetaData implements java.sql.DatabaseMetaData {",
"removed": [
" if (connection_.resultSetHoldability_ == JDBC30Translation.HOLD_CURSORS_OVER_COMMIT) {"
]
},
{
"added": [
" if (connection_.holdability() == JDBC30Translation.HOLD_CURSORS_OVER_COMMIT) {"
],
"header": "@@ -1911,7 +1911,7 @@ public abstract class DatabaseMetaData implements java.sql.DatabaseMetaData {",
"removed": [
" if (connection_.resultSetHoldability_ == JDBC30Translation.HOLD_CURSORS_OVER_COMMIT) {"
]
}
]
},
{
"file": "java/client/org/apache/derby/client/am/Statement.java",
"hunks": [
{
"added": [
" return (connection_.getXAState() == Connection.XA_T0_NOT_ASSOCIATED) ;"
],
"header": "@@ -1447,7 +1447,7 @@ public class Statement implements java.sql.Statement, StatementCallbackInterface",
"removed": [
" return (connection_.xaState_ == Connection.XA_T0_NOT_ASSOCIATED) ;"
]
}
]
},
{
"file": "java/client/org/apache/derby/client/net/NetConnection.java",
"hunks": [
{
"added": [
""
],
"header": "@@ -270,9 +270,7 @@ public class NetConnection extends org.apache.derby.client.am.Connection {",
"removed": [
" if (resultSetHoldability_ == 0) {",
" ((org.apache.derby.client.net.NetDatabaseMetaData) databaseMetaData_).setDefaultResultSetHoldability();",
" }"
]
},
{
"added": [],
"header": "@@ -322,10 +320,6 @@ public class NetConnection extends org.apache.derby.client.am.Connection {",
"removed": [
"",
" if (resultSetHoldability_ == 0) {",
" ((org.apache.derby.client.net.NetDatabaseMetaData) databaseMetaData_).setDefaultResultSetHoldability();",
" }"
]
}
]
},
{
"file": "java/client/org/apache/derby/client/net/NetDatabaseMetaData.java",
"hunks": [
{
"added": [],
"header": "@@ -79,10 +79,6 @@ public class NetDatabaseMetaData extends org.apache.derby.client.am.DatabaseMeta",
"removed": [
" if (connection_.resultSetHoldability_ == 0) // property not set",
" {",
" setDefaultResultSetHoldability();",
" }"
]
}
]
},
{
"file": "java/drda/org/apache/derby/impl/drda/DRDAStatement.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.jdbc.EngineConnection;"
],
"header": "@@ -37,6 +37,7 @@ import java.util.Vector;",
"removed": []
},
{
"added": [
"\tint withHoldCursor = -1;\t // hold cursor after commit attribute."
],
"header": "@@ -65,7 +66,7 @@ class DRDAStatement",
"removed": [
"\tprotected int withHoldCursor = -1;\t // hold cursor after commit attribute."
]
},
{
"added": [
"\t\tps = prepareStatementJDBC3(sqlStmt, scrollType, concurType, "
],
"header": "@@ -510,11 +511,7 @@ class DRDAStatement",
"removed": [
"\t\tConnection conn = database.getConnection();",
"\t\tif (conn instanceof BrokeredConnection)",
"\t\t\tps = conn.prepareStatement(sqlStmt, scrollType, concurType);",
"\t\telse",
"\t\t\tps = prepareStatementJDBC3(sqlStmt, scrollType, concurType, "
]
},
{
"added": [
" ",
"\t\t{ ",
"\t\t{ "
],
"header": "@@ -1459,17 +1456,18 @@ class DRDAStatement",
"removed": [
"\t\t{",
"\t\t{"
]
},
{
"added": [
"\t * prepare a statement using EngineConnection.prepareStatement",
" * so that server can run on jdk131 and still pass holdability. "
],
"header": "@@ -1477,10 +1475,8 @@ class DRDAStatement",
"removed": [
"\t * prepare a statement using reflection so that server can run on jdk131",
"\t * and still pass holdability. ",
"\t * parameters are passed on to either the EmbedConnection or ",
"\t * BrokeredConnection prepareStatement() method."
]
},
{
"added": [
" EngineConnection conn = database.getConnection();",
" if (withHoldCursor == -1) {",
" // Holdability not explictly set, let the",
" // connection provide the default.",
" return conn.prepareStatement(sqlStmt,",
" scrollType, concurType);",
" }",
" ",
" // Holdability explictly set. ",
" return conn.prepareStatement(sqlStmt,",
" scrollType, concurType, withHoldCursor);"
],
"header": "@@ -1494,26 +1490,17 @@ class DRDAStatement",
"removed": [
"\t\tPreparedStatement lps = null;",
"",
"\t\t// If holdability is still uninitialized, default is HOLD_CURSORS_OVER_COMMIT",
"\t\tint resultSetHoldability = (withHoldCursor == -1) ? ",
"\t\t\tresultSetHoldability = JDBC30Translation.HOLD_CURSORS_OVER_COMMIT :",
"\t\t\twithHoldCursor;",
"",
"\t\t//prepareStatement takes 4 parameters",
"\t\tClass[] PREP_STMT_PARAM = { String.class, Integer.TYPE, Integer.TYPE, Integer.TYPE };",
"\t\tObject[] PREP_STMT_ARG = { sqlStmt, new Integer(scrollType),",
"\t\t\t\t\t\t\t\t new Integer(concurType), new Integer(resultSetHoldability)};",
"\t\ttry {",
"\t\t\t//create a prepared statement with hold cursor over commit using reflection.",
"\t\t\tMethod sh = database.getConnection().getClass().getMethod(\"prepareStatement\", PREP_STMT_PARAM);",
"\t\t\tlps = (PreparedStatement) (sh.invoke(database.getConnection(), PREP_STMT_ARG));",
"\t\t} catch (Exception e) {",
"\t\t\thandleReflectionException(e);",
"\t\t} ",
"",
"\t\treturn lps;"
]
}
]
}
] |
derby-DERBY-1006-4388f151
|
DERBY-1006 Disallow holdable cursor setting at the connection and statement
level while in a global transaction for the client driver. Matches the embedded
as the holdable cursors are not supported in global (XA) transactions.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@381549 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/client/org/apache/derby/client/am/Connection.java",
"hunks": [
{
"added": [
" // In an XA global transaction do not allow the",
" // holdability to be set to hold cursors across",
" // commits, as the engine does not support it.",
" if (this.isXAConnection_ && this.xaState_ == XA_T1_ASSOCIATED)",
" {",
" if (holdability == JDBC30Translation.HOLD_CURSORS_OVER_COMMIT)",
" throw new SqlException(agent_.logWriter_, ",
" new MessageId(SQLState.CANNOT_HOLD_CURSOR_XA));",
" }"
],
"header": "@@ -1192,6 +1192,15 @@ public abstract class Connection implements java.sql.Connection,",
"removed": []
}
]
}
] |
derby-DERBY-1007-ab10884c
|
DERBY-1007: Fix optimizer to make subqueries return correct cost estimates.
More description of the changes:
1. Added the "prepForNextRound()" method that was part of OptimizerImpl
to the Optimizer interface since that seemslike an appropriate place for it.
2. Added a single line to OptimizerImpl.prepForNextRound() to reset the "bestCost"
for the current round of optimization. Note that I do _not_ reset the "foundABestPlan"
variable nor the "bestJoinOrder" array. This is because it's possible that a
"best join order" may not exist for the current round, in which case the optimizer
must know whether or not it found a best join order in a previous round
(foundABestPlan) and if so what the corresponding join order was (bestJoinOrder).
That information is required so that a valid query plan can be generated after
optimization is complete.
3. After making the above changes, I noticed that the optimizer cost
estimates were not always showing up when logQueryPlan was set to true--they
were sometimes being printed as question marks to represent "Infinity". The reason
for this was that most of the code in the "modifyAccessPaths" phase of query
compilation uses the estimates as they sit in the ResultSetNode.costEstimate
field--which, for nodes above subqueries, will hold the "bestCost" estimates for
the most recent plan chosen by the OptimizerImpl for the subquery. Since I am now
(with DERBY-1007) resetting the "bestCost" variable at the start of every round,
it's possible that "bestCost" will hold an estimate that has been "reset" to
Double.MAX_VALUE. This can happen if it was reset (in prepForNextRound()) and
then no valid join order was found for the current round (ex. if no valid join
order exists or if there was an optimizer "timeout"). That in turn meant that
the "costEstimate" field for nodes above the OptimizerImpl would have been "reset"
as well, and hence the "infinity" value (i.e. question mark) was showing up in the
logged query plan. So I had to find all nodes that use "costEstimate" during
modifyAccessPaths() and update them to use the final, best cost estimate for
that node (instead of just using the most recent value of "costEstimate"). This
touched several of ResultSetNode's subclasses, but the diff in most cases is just
a few lines. The exceptions are FromTable, SelectNode, UnionNode,
IntersectOrExceptNode, and JoinNode, where I added new "getFinalCostEstimate" methods
to correctly figure out the final cost estimate based on the final estimates for
child nodes, as appropriate.
4. The current optimizer "timeout" mechanism is based on the value in
OptimizerImpl.bestCost. Since I'm now resetting that value at the start of every
round, the timeout mechanism had to be changed in order to preserve its current
functionality while removing the dependency on bestCost. So I've added a new
variable, timeLimit, to OptimizerImpl that plays the same role w.r.t optimizer
"timeout" that the old bestCost value did.
5. Updated master/derived.out to match new behavior. There's one query in
derived.sql that is affected by this issue. Before these changes the optimizer
thought one join order B was cheaper than another join order A and so it chose
to generate join order B. With these changes, though, it now (correctly) sees that
join order A and join order B are equivalent, so it just goes with join order A.
This difference manifests itself in the ordering of two rows in the result set for
that query--so I've updated the masters accordingly.
6. Added a new, simple test case specific to DERBY-1007 to lang/subquery.sql, and
updated the master file accordingly. The test case is the same one mentioned in the
description for this issue.
Submitted by Army Brown ([email protected])
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@382935 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/sql/compile/IntersectOrExceptNode.java",
"hunks": [
{
"added": [
"\t\t// Get our final cost estimate based on the child estimates.",
"\t\tcostEstimate = getFinalCostEstimate();",
""
],
"header": "@@ -330,6 +330,9 @@ public class IntersectOrExceptNode extends SetOperatorNode",
"removed": []
},
{
"added": [
"\t/**",
"\t * @see ResultSetNode#getFinalCostEstimate",
"\t *",
"\t * Get the final CostEstimate for this IntersectOrExceptNode.",
"\t *",
"\t * @return\tThe final CostEstimate for this IntersectOrExceptNode,",
"\t * which is the sum of the two child costs. The final number of",
"\t * rows depends on whether this is an INTERSECT or EXCEPT (see",
"\t * getRowCountEstimate() in this class for more).",
"\t */",
"\tpublic CostEstimate getFinalCostEstimate()",
"\t\tthrows StandardException",
"\t{",
"\t\tif (finalCostEstimate != null)",
"\t\t\treturn finalCostEstimate;",
"",
"\t\tCostEstimate leftCE = leftResultSet.getFinalCostEstimate();",
"\t\tCostEstimate rightCE = rightResultSet.getFinalCostEstimate();",
"",
"\t\tfinalCostEstimate = getNewCostEstimate();",
"\t\tfinalCostEstimate.setCost(",
"\t\t\tleftCE.getEstimatedCost() + rightCE.getEstimatedCost(),",
"\t\t\tgetRowCountEstimate(leftCE.rowCount(), rightCE.rowCount()),",
"\t\t\tgetSingleScanRowCountEstimate(leftCE.singleScanRowCount(),",
"\t\t\t\trightCE.singleScanRowCount()));",
"",
"\t\treturn finalCostEstimate;",
"\t}",
""
],
"header": "@@ -367,6 +370,35 @@ public class IntersectOrExceptNode extends SetOperatorNode",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/JoinNode.java",
"hunks": [
{
"added": [
"\t\t// Get our final cost estimate based on child estimates.",
"\t\tcostEstimate = getFinalCostEstimate();"
],
"header": "@@ -1567,16 +1567,8 @@ public class JoinNode extends TableOperatorNode",
"removed": [
"\t\t// Get the cost estimate if we don't have one yet",
"\t\tif (costEstimate == null)",
"\t\t{",
"\t\t\tcostEstimate = getNewCostEstimate();",
"\t\t\tcostEstimate.setCost(",
"\t\t\t\tleftResultSet.getFinalCostEstimate().getEstimatedCost() +",
"\t\t\t\trightResultSet.getFinalCostEstimate().getEstimatedCost(),",
"\t\t\t\trightResultSet.getFinalCostEstimate().rowCount(),",
"\t\t\t\trightResultSet.getFinalCostEstimate().rowCount());",
"\t\t}"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/OptimizerImpl.java",
"hunks": [
{
"added": [
"\t// Value used to figure out when/if we've timed out for this",
"\t// Optimizable.",
"\tprotected double timeLimit;",
"",
"\t// Cost estimate for the final \"best join order\" that we chose--i.e.",
"\t// the one that's actually going to be generated.",
"\tCostEstimate finalCostEstimate;",
""
],
"header": "@@ -155,6 +155,14 @@ public class OptimizerImpl implements Optimizer",
"removed": []
},
{
"added": [
"\t\ttimeLimit = Double.MAX_VALUE;"
],
"header": "@@ -232,6 +240,7 @@ public class OptimizerImpl implements Optimizer",
"removed": []
},
{
"added": [
"\tpublic void prepForNextRound()"
],
"header": "@@ -243,7 +252,7 @@ public class OptimizerImpl implements Optimizer",
"removed": [
"\tprotected void prepForNextRound()"
]
},
{
"added": [
"",
"\t\t/* Since we're preparing for a new round, we have to clear",
"\t\t * out the \"bestCost\" from the previous round to ensure that,",
"\t\t * when this round of optimizing is done, bestCost will hold",
"\t\t * the best cost estimate found _this_ round, if there was",
"\t\t * one. If there was no best cost found (which can happen if",
"\t\t * there is no feasible join order) then bestCost will remain",
"\t\t * at Double.MAX_VALUE. Then when outer queries check the",
"\t\t * cost and see that it is so high, they will reject whatever",
"\t\t * outer join order they're trying in favor of something that's",
"\t\t * actually valid (and therefore cheaper).",
"\t\t *",
"\t\t * Note that we do _not_ reset the \"foundABestPlan\" variable nor",
"\t\t * the \"bestJoinOrder\" array. This is because it's possible that",
"\t\t * a \"best join order\" may not exist for the current round, in",
"\t\t * which case this OptimizerImpl must know whether or not it found",
"\t\t * a best join order in a previous round (foundABestPlan) and if",
"\t\t * so what the corresponding join order was (bestJoinOrder). This",
"\t\t * information is required so that the correct query plan can be",
"\t\t * generated after optimization is complete, even if that best",
"\t\t * plan was not found in the most recent round.",
"\t\t */",
"\t\tbestCost = getNewCostEstimate(",
"\t\t\tDouble.MAX_VALUE, Double.MAX_VALUE, Double.MAX_VALUE);"
],
"header": "@@ -251,6 +260,30 @@ public class OptimizerImpl implements Optimizer",
"removed": []
},
{
"added": [
"\t\t\ttimeExceeded = (currentTime - timeOptimizationStarted) > timeLimit;"
],
"header": "@@ -299,8 +332,7 @@ public class OptimizerImpl implements Optimizer",
"removed": [
"\t\t\ttimeExceeded = (currentTime - timeOptimizationStarted) >",
"\t\t\t\t\t\t\t\t\tbestCost.getEstimatedCost();"
]
},
{
"added": [
"\t\t// Our time limit for optimizing this round is the time we think",
"\t\t// it will take us to execute the best join order that we've ",
"\t\t// found so far (across all rounds of optimizing). In other words,",
"\t\t// don't spend more time optimizing this OptimizerImpl than we think",
"\t\t// it's going to take to execute the best plan. So if we've just",
"\t\t// found a new \"best\" join order, use that to update our time limit.",
"\t\tif (bestCost.getEstimatedCost() < timeLimit)",
"\t\t\ttimeLimit = bestCost.getEstimatedCost();",
""
],
"header": "@@ -1296,6 +1328,15 @@ public class OptimizerImpl implements Optimizer",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/ProjectRestrictNode.java",
"hunks": [
{
"added": [
"\t\tthrows StandardException",
"\t\tif (finalCostEstimate != null)",
"\t\t// we already set it, so just return it.",
"\t\t\treturn finalCostEstimate;",
"",
"\t\t// If the child result set is an Optimizable, then this node's",
"\t\t// final cost is that of the child. Otherwise, this node must",
"\t\t// hold \"trulyTheBestAccessPath\" for it's child so we pull",
"\t\t// the final cost from there.",
"\t\tif (childResult instanceof Optimizable)",
"\t\t\tfinalCostEstimate = childResult.getFinalCostEstimate();",
"\t\t\tfinalCostEstimate = getTrulyTheBestAccessPath().getCostEstimate();",
"",
"\t\treturn finalCostEstimate;"
],
"header": "@@ -1117,19 +1117,22 @@ public class ProjectRestrictNode extends SingleChildResultSetNode",
"removed": [
"\t\t/*",
"\t\t** The cost estimate will be set here if either optimize() or",
"\t\t** optimizeIt() was called on this node. It's also possible",
"\t\t** that optimization was done directly on the child node,",
"\t\t** in which case the cost estimate will be null here.",
"\t\t*/",
"\t\tif (costEstimate == null)",
"\t\t\treturn childResult.getFinalCostEstimate();",
"\t\t{",
"\t\t\treturn costEstimate;",
"\t\t}"
]
},
{
"added": [
"\t\t// Load our final cost estimate.",
"\t\tcostEstimate = getFinalCostEstimate();"
],
"header": "@@ -1308,11 +1311,8 @@ public class ProjectRestrictNode extends SingleChildResultSetNode",
"removed": [
"\t\t/* Drop our cost estimate if it is uninitialized. */",
"\t\tif (costEstimate != null && costEstimate.isUninitialized())",
"\t\t{",
"\t\t\tcostEstimate = childResult.getFinalCostEstimate();",
"\t\t}"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/ResultSetNode.java",
"hunks": [
{
"added": [
"\t// Final cost estimate for this result set node, which is the estimate",
"\t// for this node with respect to the best join order for the top-level",
"\t// query. Subclasses will set this value where appropriate.",
"\tCostEstimate\t\tfinalCostEstimate;",
""
],
"header": "@@ -97,6 +97,11 @@ public abstract class ResultSetNode extends QueryTreeNode",
"removed": []
},
{
"added": [
"\t\tthrows StandardException",
"\t\t\tif (finalCostEstimate == null)",
"\t\t\t\t\t\"finalCostEstimate is not expected to be null for \" +",
"\t\treturn finalCostEstimate;"
],
"header": "@@ -180,17 +185,18 @@ public abstract class ResultSetNode extends QueryTreeNode",
"removed": [
"\t\t\tif (costEstimate == null)",
"\t\t\t\t\t\"costEstimate is not expected to be null for \" +",
"\t\treturn costEstimate;"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/SelectNode.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.sql.compile.CostEstimate;"
],
"header": "@@ -21,6 +21,7 @@",
"removed": []
},
{
"added": [
"\t\t// Load the costEstimate for the final \"best\" join order.",
"\t\tcostEstimate = optimizer.getFinalCost();",
""
],
"header": "@@ -1615,6 +1616,9 @@ public class SelectNode extends ResultSetNode",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/UnionNode.java",
"hunks": [
{
"added": [
"\t\t// Get our final cost estimate based on the child estimates.",
"\t\tcostEstimate = getFinalCostEstimate();",
""
],
"header": "@@ -545,6 +545,9 @@ public class UnionNode extends SetOperatorNode",
"removed": []
}
]
}
] |
derby-DERBY-1007-e540aee4
|
DERBY-1007: Follow up patch to earlier submitted patch.
In a word, the fix for this issue ensures that, in the case of subqueries, the optimizer will correctly propagate the estimated costs for subqueries up to the parent subquery(-ies), thus allowing the parent query to make a better decision about which join order is ultimately the best. As seen in the example scenario included above, the correct estimates are higher--sometimes much higher--than what the optimizer was returning prior to this change: in the example, the optimizer was returning an incorrect cost estimate of 10783 before the patch, and a correct estimate of 1 million after the patch (where "correct" means that it's the value calculated by the optimizer and thus the value that should be returned; I'm not saying anything about the accuracy of the estimate here).
One side effect of this is that, for very deeply nested queries and/or queries with a high number of FROM tables/expressions, the higher cost estimates can be multiplied--sometimes many times over--throughout the optimization process, which means that the overall query estimate can climb to a much larger number much more quickly. If the query is big enough, this can actually cause the optimizer to reach an estimated cost of INFINITY.
That said, the current optimizer logic for choosing a plan does not expect to see an estimate of infinity for its plans. As a result the optimizer does comparisons of, and arithmetic with, cost estimates and row counts that, when applied to Infinity, give unexpected results.
I have filed DERBY-1259 and DERBY-1260 to address the "infinity problem" in more detail, but am attaching here a follow-up patch that takes some basic steps toward making the optimizer more robust in the face of infinite cost estimates, which are now more likely to occur given the DERBY-1007 changes. In particular, the d1007_followup_v1.patch does the following:
1) Fixes a couple of small problems with the handling of estimates for FromBaseTables, to ensure that a FromBaseTable's estimate is correctly propagated to (and handled by) the ProjectRestrictNode that sits above it. This parallels the original DERBY-1007 work but is a much simpler "follow-up" task as it deals only with base tables instead of subqueries, and thus the changes are fairly minor.
2) There are several places in OptimizerImpl where the optimizer will only choose to accept a plan's cost if the cost is less than the current "bestCost". If no best cost has been found yet, bestCost is set to an uninitialized value of Double.MAX_VALUE with the assumption that the first valid plan will have a cost less than Double.MAX_VALUE and thus will be chosen as the best so far. However, since a plan's cost estimate can actually end up being Double.POSITIVE_INFINITY, which is greater than Double.MAX_VALUE, it's possible that the optimizer will reject a valid join order because its cost is infinity, and then end up completing without ever finding a valid plan--which is wrong. What we want is for the optimizer to accept the first valid plan that it finds, regardless of what the cost is. Then if it later finds a better plan, it can use that. So in several places the d1007_followup_v1.patch adds a check to see if bestCost is uninitialized and, if so, we'll always accept the first valid join order we find, regardless of what its cost is--even if it's infinity--because that's better than no plan at all.
3) Modifies the "compare" method in CostEstimateImpl.java to try to account for comparisons between two plans that both have infinite costs. If this happens, we don't have much choice but to guess as to which plan is actually better. So the changes for followup_v1 make that guess based on a comparison of row counts for the two plans. And if the row counts themselves are infinity, then we'll guess based on the single scan row counts. And finally, if those values are both infinity, as well, then we're out of luck and we just say that the two costs are "equal" for lack of better alternative.
4) And finally, due to unexpected behavior that results from arithmetic using infinity (see DERBY-1259), it is currently possible (though rather rare) for the optimizer to decide to do a hash join that has a cost estimate of Infinity. An example of a query for which this could happen can be found in DERBY-1205, query #1. That said, the BackingStoreHashtable that is used for carrying out a hash join currently creates a Java Hashtable instance with a capacity that matches the optimizer's estimated row count. So if the row count is infinity we'll try to create a Hashtable with some impossibly large capacity and, as a result, we'll end up with an OutOfMemory error. So the d1007_followup_v1.patch adds some code to handle this kind of situation in a more graceful manner.
I ran derbyall with these changes on Linux Red Hat using ibm142 and saw no new failures.
Submitted by Army Brown ([email protected])
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@397675 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/iapi/store/access/BackingStoreHashtable.java",
"hunks": [
{
"added": [
" /* We want to create the hash table based on the estimated row",
" * count if a) we have an estimated row count (i.e. it's greater",
" * than zero) and b) we think we can create a hash table to",
" * hold the estimated row count without running out of memory.",
" * The check for \"b\" is required because, for deeply nested",
" * queries and/or queries with a high number of tables in",
" * their FROM lists, the optimizer can end up calculating",
" * some very high row count estimates--even up to the point of",
" * Double.POSITIVE_INFINITY (see DERBY-1259 for an explanation",
" * of how that can happen). In that case any attempts to",
" * create a Hashtable of size estimated_rowcnt can cause",
" * OutOfMemory errors when we try to create the Hashtable.",
" * So as a \"red flag\" for that kind of situation, we check to",
" * see if the estimated row count is greater than the max",
" * in-memory size for this table. Unit-wise this comparison",
" * is relatively meaningless: rows vs bytes. But if our",
" * estimated row count is greater than the max number of",
" * in-memory bytes that we're allowed to consume, then",
" * it's very likely that creating a Hashtable with a capacity",
" * of estimated_rowcnt will lead to memory problems. So in",
" * that particular case we leave hash_table null here and",
" * initialize it further below, using the estimated in-memory",
" * size of the first row to figure out what a reasonable size",
" * for the Hashtable might be.",
" */",
" (((estimated_rowcnt <= 0) || (row_source == null)) ?",
" new Hashtable() :",
" (estimated_rowcnt < max_inmemory_size) ?",
" new Hashtable((int) estimated_rowcnt) :",
" null);"
],
"header": "@@ -224,9 +224,37 @@ public class BackingStoreHashtable",
"removed": [
" ((estimated_rowcnt <= 0) ? ",
" new Hashtable() : new Hashtable((int) estimated_rowcnt));"
]
},
{
"added": [
" // If we haven't initialized the hash_table yet then that's",
" // because a Hashtable with capacity estimated_rowcnt would",
" // probably cause memory problems. So look at the first row",
" // that we found and use that to create the hash table with",
" // an initial capacity such that, if it was completely full,",
" // it would still satisfy the max_inmemory condition. Note",
" // that this isn't a hard limit--the hash table can grow if",
" // needed.",
" if (hash_table == null)",
" {",
"\t\t\t\t\t// Check to see how much memory we think the first row",
" // is going to take, and then use that to set the initial",
" // capacity of the Hashtable.",
" double rowUsage = getEstimatedMemUsage(row);",
" hash_table = new Hashtable((int)(max_inmemory_size / rowUsage));",
" }"
],
"header": "@@ -235,6 +263,22 @@ public class BackingStoreHashtable",
"removed": []
},
{
"added": [
" max_inmemory_size -= getEstimatedMemUsage(row);"
],
"header": "@@ -387,13 +431,7 @@ public class BackingStoreHashtable",
"removed": [
" for( int i = 0; i < row.length; i++)",
" {",
" if( row[i] instanceof DataValueDescriptor)",
" max_inmemory_size -= ((DataValueDescriptor) row[i]).estimateMemoryUsage();",
" max_inmemory_size -= ClassSize.refSize;",
" }",
" max_inmemory_size -= ClassSize.refSize;"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/OptimizerImpl.java",
"hunks": [
{
"added": [
"\t\t\t\t**",
"\t\t\t\t** For very deeply nested queries, it's possible that the optimizer",
"\t\t\t\t** will return an estimated cost of Double.INFINITY, which is",
"\t\t\t\t** greater than our uninitialized cost of Double.MAX_VALUE and",
"\t\t\t\t** thus the \"compare\" check below will return false. So we have",
"\t\t\t\t** to check to see if bestCost is uninitialized and, if so, we",
"\t\t\t\t** save currentCost regardless of what value it is--because we",
"\t\t\t\t** haven't found anything better yet.",
"\t\t\t\t**",
"\t\t\t\t** That said, it's also possible for bestCost to be infinity",
"\t\t\t\t** AND for current cost to be infinity, as well. In that case",
"\t\t\t\t** we can't really tell much by comparing the two, so for lack",
"\t\t\t\t** of better alternative we look at the row counts. See",
"\t\t\t\t** CostEstimateImpl.compare() for more.",
"\t\t\t\tif ((! foundABestPlan) ||",
"\t\t\t\t\t(currentCost.compare(bestCost) < 0) ||",
"\t\t\t\t\tbestCost.isUninitialized())"
],
"header": "@@ -1368,8 +1368,24 @@ public class OptimizerImpl implements Optimizer",
"removed": [
"\t\t\t\tif ((! foundABestPlan) || currentCost.compare(bestCost) < 0)"
]
},
{
"added": [
"\t\t\t\t\t\tif ((currentSortAvoidanceCost.compare(bestCost) <= 0)",
"\t\t\t\t\t\t\t|| bestCost.isUninitialized())"
],
"header": "@@ -1414,7 +1430,8 @@ public class OptimizerImpl implements Optimizer",
"removed": [
"\t\t\t\t\t\tif (currentSortAvoidanceCost.compare(bestCost) <= 0)"
]
},
{
"added": [
"\t\t// Before considering the cost, make sure we set the optimizable's",
"\t\t// \"current\" cost to be the one that we found. Doing this allows",
"\t\t// us to compare \"current\" with \"best\" later on to find out if",
"\t\t// the \"current\" plan is also the \"best\" one this round--if it's",
"\t\t// not then we'll have to revert back to whatever the best plan is.",
"\t\t// That check is performed in getNextDecoratedPermutation() of",
"\t\t// this class.",
"\t\toptimizable.getCurrentAccessPath().setCostEstimate(estimatedCost);",
""
],
"header": "@@ -1776,6 +1793,15 @@ public class OptimizerImpl implements Optimizer",
"removed": []
},
{
"added": [
"\t\t// RESOLVE: The following call to memoryUsageOK does not behave",
"\t\t// correctly if outerCost.rowCount() is POSITIVE_INFINITY; see",
"\t\t// DERBY-1259."
],
"header": "@@ -1783,6 +1809,9 @@ public class OptimizerImpl implements Optimizer",
"removed": []
},
{
"added": [
"\t\t\tbestCostEstimate.isUninitialized() ||"
],
"header": "@@ -1797,6 +1826,7 @@ public class OptimizerImpl implements Optimizer",
"removed": []
},
{
"added": [
"\t\t\t\t\t\tbestCostEstimate.isUninitialized() ||"
],
"header": "@@ -1844,6 +1874,7 @@ public class OptimizerImpl implements Optimizer",
"removed": []
},
{
"added": [
"",
" // RESOLVE: The following call to memoryUsageOK does not behave",
" // correctly if outerCost.rowCount() is POSITIVE_INFINITY; see",
" // DERBY-1259."
],
"header": "@@ -1912,6 +1943,10 @@ public class OptimizerImpl implements Optimizer",
"removed": []
},
{
"added": [
"\t\t\tbestCostEstimate.isUninitialized() ||"
],
"header": "@@ -1935,6 +1970,7 @@ public class OptimizerImpl implements Optimizer",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/ProjectRestrictNode.java",
"hunks": [
{
"added": [
"",
"\t\t\t// Note: we don't call \"optimizer.considerCost()\" here because",
"\t\t\t// a) the child will make that call as part of its own",
"\t\t\t// \"optimizeIt()\" work above, and b) the child might have",
"\t\t\t// different criteria for \"considering\" (i.e. rejecting or",
"\t\t\t// accepting) a plan's cost than this ProjectRestrictNode does--",
"\t\t\t// and we don't want to override the child's decision. So as",
"\t\t\t// with most operations in this class, if the child is an",
"\t\t\t// Optimizable, we just let it do its own work and make its",
"\t\t\t// own decisions."
],
"header": "@@ -324,7 +324,16 @@ public class ProjectRestrictNode extends SingleChildResultSetNode",
"removed": [
"\t\t\toptimizer.considerCost(this, restrictionList, getCostEstimate(), outerCost);"
]
}
]
}
] |
derby-DERBY-1009-6d12993a
|
DERBY-434 DERBY-1009 DERBY-435
Remove static check methods with duplicated code in instance methods,
have the Java procedure call the instance method for the connection checks
on the nested connection.
Have the checkDataSource30 procedure nested connection checks use checkDataSource30 as
the object for the instance method, adds the holdability and savepoint tests for checkDataSource30.
Add test of the return of ResultSet.getStatement to expose DERBY-1009.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@378797 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-1009-e65be5ba
|
DERBY-1009 Ensure EmbedResultSet.getStatement() returns the BrokeredStatement object
the application used to create it, rather than the underlying physical statament.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@379178 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/iapi/jdbc/BrokeredPreparedStatement.java",
"hunks": [
{
"added": [
"\tfinal String\tsql;"
],
"header": "@@ -38,7 +38,7 @@ public class BrokeredPreparedStatement extends BrokeredStatement",
"removed": [
"\tprotected final String\tsql;"
]
}
]
},
{
"file": "java/engine/org/apache/derby/iapi/jdbc/BrokeredStatement.java",
"hunks": [
{
"added": [
"\tfinal BrokeredStatementControl control;",
"\tfinal int jdbcLevel;",
"\tfinal int resultSetType;",
"\tfinal int resultSetConcurrency;",
"\tfinal int resultSetHoldability;"
],
"header": "@@ -44,12 +44,12 @@ public class BrokeredStatement implements Statement",
"removed": [
"\tprotected final BrokeredStatementControl control;",
"\tprotected final int jdbcLevel;",
"\tprotected final int resultSetType;",
"\tprotected final int resultSetConcurrency;",
"\tprotected final int resultSetHoldability;"
]
},
{
"added": [
" BrokeredStatement(BrokeredStatementControl control, int jdbcLevel) throws SQLException"
],
"header": "@@ -57,7 +57,7 @@ public class BrokeredStatement implements Statement",
"removed": [
" protected BrokeredStatement(BrokeredStatementControl control, int jdbcLevel) throws SQLException"
]
},
{
"added": [
"\tvoid setStatementState(Statement oldStatement, Statement newStatement) throws SQLException {"
],
"header": "@@ -497,7 +497,7 @@ public class BrokeredStatement implements Statement",
"removed": [
"\tprotected void setStatementState(Statement oldStatement, Statement newStatement) throws SQLException {"
]
},
{
"added": [
" ",
" /**",
" * Provide the control access to every ResultSet we return.",
" * If required the control can wrap the ResultSet, but",
" * it (the control) must ensure a underlying ResultSet is",
" * only wrapped once, if say java.sql.Statement.getResultSet",
" * is returned twice.",
" * ",
" * @param rs ResultSet being returned, can be null.",
" */",
"\tfinal ResultSet wrapResultSet(ResultSet rs) {",
"\t\treturn control.wrapResultSet(this, rs);"
],
"header": "@@ -513,8 +513,18 @@ public class BrokeredStatement implements Statement",
"removed": [
"\tprotected final ResultSet wrapResultSet(ResultSet rs) {",
"\t\treturn control.wrapResultSet(rs);"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java",
"hunks": [
{
"added": [
"\t/**",
" * The statement object that originally created us.",
"\tprivate final EmbedStatement stmt;",
" ",
" /**",
" * The statement that currently owns this ResultSet.",
" * Statements created in procedures are passed off",
" * to the Statement that called the procedure.",
" * This is to avoid the ResultSet being closed",
" * due to the Statement within the procedure",
" * or the nested Connection being closed.",
" */",
" ",
" /**",
" * Statement object the application used to",
" * create this ResultSet.",
" */",
" private Statement applicationStmt;",
" "
],
"header": "@@ -141,12 +141,29 @@ public abstract class EmbedResultSet extends ConnectionChild",
"removed": [
"\t/*",
"\tprotected final EmbedStatement stmt;"
]
},
{
"added": [
" this.applicationStmt = this.stmt = owningStmt = stmt;"
],
"header": "@@ -182,7 +199,7 @@ public abstract class EmbedResultSet extends ConnectionChild",
"removed": [
"\t\tthis.stmt = owningStmt = stmt;"
]
}
]
},
{
"file": "java/engine/org/apache/derby/jdbc/XAStatementControl.java",
"hunks": [
{
"added": [
"import org.apache.derby.impl.jdbc.EmbedResultSet;"
],
"header": "@@ -26,6 +26,7 @@ import org.apache.derby.iapi.jdbc.BrokeredStatement;",
"removed": []
}
]
}
] |
derby-DERBY-1010-fe35a93d
|
DERBY-1010 - setTransactionIsolation can cause ava.sql.SQLException: Invalid operation: statement closed in some contexts with xa
Client has a Statement object that it reuses to send SET CURRENT ISOLATION commands to the server. Added a check to make sure this statement was not closed before trying to reuse it.
This change takes the checkDataSource test a bit further (DERBY-435) but there seem to be issues with isolation being set correctly with xa_join. I will investigate that and file a Jira issue
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@379993 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-1015-3734ddea
|
DERBY-1015 Use the EngineConnection class to call setDRDAId, set/getPrepareIsolation from
the network server on an embedded connction. Removes the requirement for specialized methods
in XADatasource.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@379609 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/drda/org/apache/derby/impl/drda/Database.java",
"hunks": [
{
"added": [],
"header": "@@ -33,7 +33,6 @@ import java.util.Properties;",
"removed": [
"import org.apache.derby.impl.jdbc.EmbedConnection;"
]
},
{
"added": [
"\tfinal void setDrdaID(String drdaID)",
"\t\t\tconn.setDrdaID(drdaID);"
],
"header": "@@ -322,10 +321,10 @@ class Database",
"removed": [
"\tprotected void setDrdaID(String drdaID)",
"\t\t\t((EmbedConnection)conn).setDrdaID(drdaID);"
]
}
]
},
{
"file": "java/drda/org/apache/derby/impl/drda/XADatabase.java",
"hunks": [
{
"added": [],
"header": "@@ -106,38 +106,6 @@ class XADatabase extends Database {",
"removed": [
"\t/** Set DRDA id for this connection",
"\t * @param drdaID",
"\t */",
"\tprotected void setDrdaID(String drdaID)",
"\t{",
"\t\tif (getConnection() != null)",
"\t\t\t((BrokeredConnection) getConnection()).setDrdaID(drdaID);",
"\t}",
"",
"",
"\t/**",
"\t * Set the internal isolation level to use for preparing statements.",
"\t * Subsequent prepares will use this isoalation level",
"\t * @param level internal isolation level ",
"\t *",
"\t * @throws SQLException",
"\t * @see BrokeredConnection#setPrepareIsolation",
"\t * ",
"\t */",
"\tprotected void setPrepareIsolation(int level) throws SQLException",
"\t{",
"\t\t((BrokeredConnection) getConnection()).setPrepareIsolation(level);",
"\t}",
"",
"\t/** get prepare isolation level for this connection.",
"\t * ",
"\t */",
"\tprotected int getPrepareIsolation() throws SQLException",
"\t{",
"\t\treturn ((BrokeredConnection) getConnection()).getPrepareIsolation();",
"\t}",
""
]
}
]
}
] |
derby-DERBY-1015-4e3b1b6b
|
DERBY-1015 (partial) Add an interface for Statement objects from the engine, EngineStatement. Removes
some use of reflection in brokered objects and the network server. Is also a step towards solving
DERBY-1158, downgrading holdabilty in global transactions.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@391691 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/drda/org/apache/derby/impl/drda/DRDAStatement.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.jdbc.EngineStatement;"
],
"header": "@@ -38,6 +38,7 @@ import java.util.Vector;",
"removed": []
},
{
"added": [
"\t * get resultSetHoldability.",
"\t\tStatement rsstmt;",
" ",
" int holdValue = ",
" ((EngineStatement) rsstmt).getResultSetHoldability();",
"",
"\t * get resultSetHoldability.",
"\tint getResultSetHoldability(ResultSet rs) throws SQLException",
"\t\tStatement rsstmt;",
" ",
" int holdValue = ",
" ((EngineStatement) rsstmt).getResultSetHoldability();",
""
],
"header": "@@ -249,65 +250,47 @@ class DRDAStatement",
"removed": [
"\t * get resultSetHoldability with reflection. ",
"\t * We need to use reflection so we can use hold cursors with 1.3.1. ",
"\t * And also since our statement might be a BrokeredStatement.",
"\t\tStatement rsstmt = null;",
"\t\tint holdValue = -1;",
"\t\t\t\t",
"\t\tClass[] getResultSetHoldabilityParam = {};",
"\t\ttry {",
"\t\t\tMethod sh =",
"\t\t\t\trsstmt.getClass().getMethod(\"getResultSetHoldability\", getResultSetHoldabilityParam);",
"\t\t\tholdValue = ((Integer) sh.invoke(rsstmt,null)).intValue();",
"\t\t}",
"\t\tcatch (Exception e) {",
"\t\t\thandleReflectionException(e);",
"\t\t}",
"\t * get resultSetHoldability with reflection. ",
"\t * We need to use reflection so we can use hold cursors with 1.3.1. ",
"\t * And also since our statement might be a BrokeredStatement.",
"\tprotected int getResultSetHoldability(ResultSet rs) throws SQLException",
"\t\tStatement rsstmt = null;",
"\t\tint holdValue = -1;",
"\t\t\t\t",
"\t\tClass[] getResultSetHoldabilityParam = {};",
"\t\ttry {",
"\t\t\tMethod sh =",
"\t\t\t\trsstmt.getClass().getMethod(\"getResultSetHoldability\", getResultSetHoldabilityParam);",
"\t\t\tholdValue = ((Integer) sh.invoke(rsstmt,null)).intValue();",
"\t\t}",
"\t\tcatch (Exception e) {",
"\t\t\thandleReflectionException(e);",
"\t\t}"
]
}
]
},
{
"file": "java/engine/org/apache/derby/iapi/jdbc/BrokeredStatement.java",
"hunks": [
{
"added": [
"public class BrokeredStatement implements EngineStatement"
],
"header": "@@ -36,7 +36,7 @@ import java.lang.reflect.*;",
"removed": [
"public class BrokeredStatement implements Statement"
]
},
{
"added": [
" return ((EngineStatement) getStatement()).getMoreResults( current);"
],
"header": "@@ -441,7 +441,7 @@ public class BrokeredStatement implements Statement",
"removed": [
" return getStatement().getMoreResults( current);"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/jdbc/EmbedStatement.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.jdbc.EngineStatement;"
],
"header": "@@ -32,6 +32,7 @@ import org.apache.derby.iapi.sql.ResultSet;",
"removed": []
},
{
"added": [
" implements EngineStatement {"
],
"header": "@@ -58,7 +59,7 @@ import java.sql.ResultSet;",
"removed": [
" implements java.sql.Statement {"
]
}
]
}
] |
derby-DERBY-1015-aadfd426
|
DERBY-1015: Define interface between network server and engine through
Java interfaces. Contributed by Sunitha Kambhampati. Passes
derbynetclientmats.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@421435 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/drda/org/apache/derby/impl/drda/DRDAConnThread.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.jdbc.EngineParameterMetaData;"
],
"header": "@@ -56,7 +56,7 @@ import org.apache.derby.iapi.services.monitor.Monitor;",
"removed": [
"import org.apache.derby.impl.jdbc.EmbedParameterSetMetaData;"
]
},
{
"added": [
"\t\tEngineParameterMetaData pmeta = null;"
],
"header": "@@ -3948,7 +3948,7 @@ class DRDAConnThread extends Thread {",
"removed": [
"\t\tEmbedParameterSetMetaData pmeta = null;"
]
},
{
"added": [
"\t\t\t\t\t\t\t\t\t drdaType, EngineParameterMetaData pmeta,"
],
"header": "@@ -4095,7 +4095,7 @@ class DRDAConnThread extends Thread {",
"removed": [
"\t\t\t\t\t\t\t\t\t drdaType, EmbedParameterSetMetaData pmeta,"
]
},
{
"added": [
"\t\tEngineParameterMetaData pmeta = stmt.getParameterMetaData();"
],
"header": "@@ -5804,7 +5804,7 @@ class DRDAConnThread extends Thread {",
"removed": [
"\t\tEmbedParameterSetMetaData pmeta = stmt.getParameterMetaData();"
]
},
{
"added": [
"\t\tEngineParameterMetaData pmeta = null;"
],
"header": "@@ -5856,7 +5856,7 @@ class DRDAConnThread extends Thread {",
"removed": [
"\t\tEmbedParameterSetMetaData pmeta = null;"
]
},
{
"added": [
"\t\t\t\t\t\t\t\tEngineParameterMetaData pmeta,"
],
"header": "@@ -5952,7 +5952,7 @@ class DRDAConnThread extends Thread {",
"removed": [
"\t\t\t\t\t\t\t\tEmbedParameterSetMetaData pmeta,"
]
},
{
"added": [
"\tprivate void writeSQLDAGRP(ResultSetMetaData rsmeta, EngineParameterMetaData pmeta, int elemNum, boolean rtnOutput)"
],
"header": "@@ -6695,7 +6695,7 @@ class DRDAConnThread extends Thread {",
"removed": [
"\tprivate void writeSQLDAGRP(ResultSetMetaData rsmeta, EmbedParameterSetMetaData pmeta, int elemNum, boolean rtnOutput)"
]
},
{
"added": [
"\tprivate void writeSQLUDTGRP(ResultSetMetaData rsmeta, EngineParameterMetaData pmeta, int jdbcElemNum, boolean rtnOutput)",
"\tprivate void writeSQLDOPTGRP(ResultSetMetaData rsmeta, EngineParameterMetaData pmeta, int jdbcElemNum, boolean rtnOutput)"
],
"header": "@@ -6831,14 +6831,14 @@ class DRDAConnThread extends Thread {",
"removed": [
"\tprivate void writeSQLUDTGRP(ResultSetMetaData rsmeta, EmbedParameterSetMetaData pmeta, int jdbcElemNum, boolean rtnOutput)",
"\tprivate void writeSQLDOPTGRP(ResultSetMetaData rsmeta, EmbedParameterSetMetaData pmeta, int jdbcElemNum, boolean rtnOutput)"
]
}
]
},
{
"file": "java/drda/org/apache/derby/impl/drda/DRDAStatement.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.jdbc.EnginePreparedStatement;",
"import org.apache.derby.iapi.jdbc.EngineParameterMetaData;"
],
"header": "@@ -39,10 +39,11 @@ import org.apache.derby.iapi.jdbc.BrokeredConnection;",
"removed": [
"import org.apache.derby.impl.jdbc.EmbedParameterSetMetaData;"
]
},
{
"added": [
"\tprotected EngineParameterMetaData stmtPmeta; // param metadata"
],
"header": "@@ -81,7 +82,7 @@ class DRDAStatement",
"removed": [
"\tprotected EmbedParameterSetMetaData stmtPmeta; // param metadata"
]
},
{
"added": [
"\t\treturn ps;"
],
"header": "@@ -537,11 +538,7 @@ class DRDAStatement",
"removed": [
"\t\tif (ps instanceof BrokeredPreparedStatement)",
"\t\t\treturn (PreparedStatement)(",
"\t\t\t\t\t\t ((BrokeredPreparedStatement) ps).getStatement());",
"\t\telse",
"\t\t\treturn ps;"
]
},
{
"added": [
"\t\t\tEngineParameterMetaData pmeta = \tgetParameterMetaData();"
],
"header": "@@ -1153,7 +1150,7 @@ class DRDAStatement",
"removed": [
"\t\t\tEmbedParameterSetMetaData pmeta = \tgetParameterMetaData();"
]
},
{
"added": [
"\t\t\tEngineParameterMetaData pmeta = \tgetParameterMetaData();"
],
"header": "@@ -1174,7 +1171,7 @@ class DRDAStatement",
"removed": [
"\t\t\tEmbedParameterSetMetaData pmeta = \tgetParameterMetaData();"
]
},
{
"added": [
"\t\tEngineParameterMetaData pmeta = \tgetParameterMetaData();"
],
"header": "@@ -1324,7 +1321,7 @@ class DRDAStatement",
"removed": [
"\t\tEmbedParameterSetMetaData pmeta = \tgetParameterMetaData();"
]
}
]
},
{
"file": "java/engine/org/apache/derby/iapi/jdbc/BrokeredPreparedStatement.java",
"hunks": [
{
"added": [
"\timplements EnginePreparedStatement"
],
"header": "@@ -32,7 +32,7 @@ import java.net.URL;",
"removed": [
"\timplements PreparedStatement"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/jdbc/EmbedParameterSetMetaData.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.jdbc.EngineParameterMetaData;"
],
"header": "@@ -26,6 +26,7 @@ import org.apache.derby.iapi.types.DataTypeDescriptor;",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/jdbc/EmbedPreparedStatement.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.jdbc.EngineParameterMetaData;",
"import org.apache.derby.iapi.jdbc.EnginePreparedStatement;"
],
"header": "@@ -70,6 +70,8 @@ import java.io.Reader;",
"removed": []
},
{
"added": [
"\timplements EnginePreparedStatement"
],
"header": "@@ -81,7 +83,7 @@ import org.apache.derby.iapi.jdbc.BrokeredConnectionControl;",
"removed": [
"\timplements java.sql.PreparedStatement"
]
},
{
"added": [
" * @return a EngineParameterMetaData object that contains information about the",
"\tpublic EngineParameterMetaData getEmbedParameterSetMetaData()"
],
"header": "@@ -1444,11 +1446,11 @@ public abstract class EmbedPreparedStatement",
"removed": [
" * @return a EmbedParameterSetMetaData object that contains information about the",
"\tpublic EmbedParameterSetMetaData getEmbedParameterSetMetaData()"
]
}
]
}
] |
derby-DERBY-1015-ab40defb
|
DERBY-1015: Added new interfaces
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@421460 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/iapi/jdbc/EnginePreparedStatement.java",
"hunks": [
{
"added": [
"/*",
" ",
" Derby - Class org.apache.derby.iapi.jdbc.EnginePreparedStatement",
" ",
" Copyright 2006 The Apache Software Foundation or its licensors, as applicable.",
" ",
" Licensed 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.iapi.jdbc;",
"",
"import java.sql.SQLException;",
"import java.sql.PreparedStatement;",
"",
"/**",
" * Additional methods the embedded engine exposes on its ",
" * PreparedStatement object implementations. An internal api only, mainly ",
" * for the network server. Allows consistent interaction between embedded ",
" * PreparedStatement and Brokered PreparedStatements.",
" * (DERBY-1015)",
" */",
"public interface EnginePreparedStatement extends PreparedStatement {",
" ",
" /**",
" * Imitate the getParameterMetaData() that is in JDBC 3.0",
" * Once,JDK1.3 stops being supported, instead of returning EngineParameterMetaData",
" * the JDBC 3.0 class - ParameterMetaData can be used.",
" *",
" * Retrieves the number, types and properties of this PreparedStatement",
" * object's parameters.",
" *",
" * @return a EngineParameterMetaData object that contains information about the",
" * number, types and properties of this PreparedStatement object's parameters.",
" * @exception SQLException if a database access error occurs",
" */",
" public EngineParameterMetaData getEmbedParameterSetMetaData()",
" throws SQLException;",
" ",
"}"
],
"header": "@@ -0,0 +1,49 @@",
"removed": []
}
]
}
] |
derby-DERBY-1015-af35756e
|
DERBY-1015 (partial) Minor cleanup in the methods to obtain a connection in the network server.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@379551 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/drda/org/apache/derby/impl/drda/Database.java",
"hunks": [
{
"added": [
"\tvoid setConnection(Connection conn)"
],
"header": "@@ -112,7 +112,7 @@ class Database",
"removed": [
"\tprotected void setConnection(Connection conn)"
]
},
{
"added": [
"\tConnection getConnection()"
],
"header": "@@ -124,7 +124,7 @@ class Database",
"removed": [
"\tprotected Connection getConnection()"
]
},
{
"added": [
"\tvoid makeConnection(Properties p) throws SQLException"
],
"header": "@@ -208,7 +208,7 @@ class Database",
"removed": [
"\tprotected Connection makeConnection(Properties p) throws SQLException"
]
}
]
},
{
"file": "java/drda/org/apache/derby/impl/drda/XADatabase.java",
"hunks": [
{
"added": [
"\tsynchronized void makeConnection(Properties p) throws"
],
"header": "@@ -62,7 +62,7 @@ class XADatabase extends Database {",
"removed": [
"\tprotected synchronized Connection makeConnection(Properties p) throws"
]
},
{
"added": [
"\t\tsetConnection(conn);\t\t"
],
"header": "@@ -92,9 +92,7 @@ class XADatabase extends Database {",
"removed": [
"\t\tsetConnection(conn);",
"\t\treturn conn;",
"\t\t"
]
}
]
}
] |
derby-DERBY-1015-da847a29
|
DERBY-1015 (partial) Initial code for EngineConnection. Add the EngineConnection
interface with a set of initial methods, make EmbedConnection and BrokeredConnection
implement this interface. No uses of the interface added yet. Some of the initial
methods were moved from BrokeredConnectionControl which looked like a start on the
same approach but did not address the issue of a single api for embedded and brokered
connections.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@379545 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/iapi/jdbc/BrokeredConnection.java",
"hunks": [
{
"added": [
"public class BrokeredConnection implements EngineConnection"
],
"header": "@@ -43,7 +43,7 @@ import org.apache.derby.iapi.error.StandardException;",
"removed": [
"public class BrokeredConnection implements Connection"
]
},
{
"added": [
"\tfinal EngineConnection getRealConnection() throws SQLException {"
],
"header": "@@ -371,7 +371,7 @@ public class BrokeredConnection implements Connection",
"removed": [
"\tfinal Connection getRealConnection() throws SQLException {"
]
},
{
"added": [
"\t\tEngineConnection conn = getRealConnection();",
" stateHoldability = conn.getHoldability(); "
],
"header": "@@ -388,20 +388,12 @@ public class BrokeredConnection implements Connection",
"removed": [
"\t\tConnection conn = getRealConnection();",
"\t\t// jdk13 does not have Connection.getHoldability method and hence using",
"\t\t// reflection to cover both jdk13 and higher jdks",
"\t\ttry {",
"\t\t\tMethod sh = conn.getClass().getMethod(\"getHoldability\", null);",
"\t\t\tstateHoldability = ((Integer)sh.invoke(conn, null)).intValue();",
"\t\t} catch( Exception e)",
"\t\t{",
"\t\t\tthrow PublicAPI.wrapStandardException( StandardException.plainWrapException( e));",
"\t\t} "
]
},
{
"added": [
"\t\tif (control.isIsolationLevelSetUsingSQLorJDBC()) {"
],
"header": "@@ -411,7 +403,7 @@ public class BrokeredConnection implements Connection",
"removed": [
"\t\tif (control!=null && control.isIsolationLevelSetUsingSQLorJDBC()) {"
]
},
{
"added": [
"\tpublic final void setDrdaID(String drdaID)",
" try {",
"\t\t getRealConnection().setDrdaID(drdaID);",
" } catch (SQLException sqle)",
" {",
" // connection is closed, just ignore drdaId",
" // since connection cannot be used.",
" }"
],
"header": "@@ -467,9 +459,15 @@ public class BrokeredConnection implements Connection",
"removed": [
"\tpublic void setDrdaID(String drdaID)",
"\t\tcontrol.setDrdaID(drdaID);"
]
},
{
"added": [
"\tpublic final void setPrepareIsolation(int level) throws SQLException",
" getRealConnection().setPrepareIsolation(level);"
],
"header": "@@ -480,9 +478,9 @@ public class BrokeredConnection implements Connection",
"removed": [
"\tpublic void setPrepareIsolation(int level) throws SQLException",
"\t\tcontrol.setPrepareIsolation(level);"
]
},
{
"added": [
"\tpublic final int getPrepareIsolation() throws SQLException",
"\t\treturn getRealConnection().getPrepareIsolation();"
],
"header": "@@ -493,9 +491,9 @@ public class BrokeredConnection implements Connection",
"removed": [
"\tpublic int getPrepareIsolation() throws SQLException",
"\t\treturn control.getPrepareIsolation();"
]
}
]
},
{
"file": "java/engine/org/apache/derby/iapi/jdbc/BrokeredConnection30.java",
"hunks": [
{
"added": [],
"header": "@@ -52,22 +52,6 @@ public class BrokeredConnection30 extends BrokeredConnection",
"removed": [
"\tpublic final PreparedStatement prepareStatement(String sql,",
" int resultSetType,",
" int resultSetConcurrency,",
" int resultSetHoldability)",
"\t\t\t\t\t\t\t\t\t\t throws SQLException {",
"\t\ttry {",
"\t\t\tcontrol.checkHoldCursors(resultSetHoldability);",
"\t\t\treturn control.wrapStatement(",
"\t\t\t\tgetRealConnection().prepareStatement(sql, resultSetType, resultSetConcurrency, resultSetHoldability), sql, null);",
"\t\t}",
"\t\tcatch (SQLException se)",
"\t\t{",
"\t\t\tnotifyException(se);",
"\t\t\tthrow se;",
"\t\t}",
"\t}"
]
}
]
},
{
"file": "java/engine/org/apache/derby/iapi/jdbc/BrokeredConnectionControl.java",
"hunks": [
{
"added": [],
"header": "@@ -20,7 +20,6 @@",
"removed": [
"import java.sql.Connection;"
]
},
{
"added": [
"\tpublic EngineConnection\tgetRealConnection() throws SQLException;"
],
"header": "@@ -34,7 +33,7 @@ public interface BrokeredConnectionControl",
"removed": [
"\tpublic Connection\tgetRealConnection() throws SQLException;"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.jdbc.EngineConnection;"
],
"header": "@@ -34,6 +34,7 @@ import org.apache.derby.iapi.services.monitor.Monitor;",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/jdbc/EmbedPooledConnection.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.jdbc.EngineConnection;"
],
"header": "@@ -30,6 +30,7 @@ import org.apache.derby.impl.jdbc.Util;",
"removed": []
},
{
"added": [
"\tpublic synchronized EngineConnection getRealConnection()",
" throws SQLException"
],
"header": "@@ -278,7 +279,8 @@ class EmbedPooledConnection implements javax.sql.PooledConnection, BrokeredConne",
"removed": [
"\tpublic synchronized Connection getRealConnection() throws SQLException"
]
}
]
},
{
"file": "java/engine/org/apache/derby/jdbc/EmbedXAConnection.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.jdbc.EngineConnection;"
],
"header": "@@ -27,6 +27,7 @@ import org.apache.derby.impl.jdbc.Util;",
"removed": []
},
{
"added": [
"\tpublic EngineConnection getRealConnection() throws SQLException",
" EngineConnection rc = super.getRealConnection();"
],
"header": "@@ -832,9 +833,9 @@ final class EmbedXAConnection extends EmbedPooledConnection",
"removed": [
"\tpublic Connection getRealConnection() throws SQLException",
"\t\tConnection rc = super.getRealConnection();"
]
}
]
}
] |
derby-DERBY-1015-faf21340
|
DERBY-1015 (partial) Modify the network server to hold the embedded Connection
object as a EngineConnection reference instead of a vanilla Connection. Does
not change the uses of the connection reference to take advantage of the consistent
api, will be done in a future patch.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@379567 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/drda/org/apache/derby/impl/drda/Database.java",
"hunks": [
{
"added": [
"",
"import org.apache.derby.iapi.jdbc.EngineConnection;"
],
"header": "@@ -29,6 +29,8 @@ import java.sql.SQLException;",
"removed": []
},
{
"added": [
" /**",
" * Connection to the database in the embedded engine.",
" */",
"\tprivate EngineConnection conn;"
],
"header": "@@ -67,7 +69,10 @@ class Database",
"removed": [
"\tprivate Connection conn;\t\t\t// Connection to the database"
]
},
{
"added": [
"\tfinal void setConnection(EngineConnection conn)"
],
"header": "@@ -112,7 +117,7 @@ class Database",
"removed": [
"\tvoid setConnection(Connection conn)"
]
},
{
"added": [
"\tfinal EngineConnection getConnection()"
],
"header": "@@ -124,7 +129,7 @@ class Database",
"removed": [
"\tConnection getConnection()"
]
},
{
"added": [],
"header": "@@ -206,7 +211,6 @@ class Database",
"removed": [
"\t * @return new local connection"
]
}
]
},
{
"file": "java/drda/org/apache/derby/impl/drda/XADatabase.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.jdbc.EngineConnection;"
],
"header": "@@ -41,6 +41,7 @@ import java.util.Enumeration;",
"removed": []
},
{
"added": [
"\t\tEngineConnection conn = getConnection();"
],
"header": "@@ -75,7 +76,7 @@ class XADatabase extends Database {",
"removed": [
"\t\tConnection conn = getConnection();"
]
},
{
"added": [
" // Contract between network server and embedded engine",
" // is that any connection returned implements EngineConnection.",
" \t\tconn = (EngineConnection) xaConnection.getConnection();"
],
"header": "@@ -88,7 +89,9 @@ class XADatabase extends Database {",
"removed": [
"\t\tconn = xaConnection.getConnection();"
]
}
]
}
] |
derby-DERBY-1016-418e135a
|
DERBY-1016; javax.transaction.xa.forget (Xid) raises XAER_NOTA exception instead of XA_PROTO on a prepared transaction
patch contributed by Jayaram Subramanian (rsjay1976 at gmail dot com).
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1210686 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-1024-d5ba8a8b
|
DERBY-1024 Remove the XA constants in XAResource that were duplicates of standard
constants from XAException and XAResource. Removed the code that translated (incorrectly)
an XA return value from one constant to another (with the same value in most cases).
Thus fixing 1024 where the incorrect XA code was being thrown, this was because the
unneded conversion code was incomplete.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@380282 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/client/org/apache/derby/client/net/NetXAConnection.java",
"hunks": [
{
"added": [
"import javax.transaction.xa.XAException;",
"import javax.transaction.xa.XAResource;"
],
"header": "@@ -22,6 +22,8 @@ package org.apache.derby.client.net;",
"removed": []
},
{
"added": [
" callInfo.xaRetVal_ = XAResource.XA_OK; // initialize XARETVAL",
" if (callInfo.xaRetVal_ != XAResource.XA_OK) { // xaRetVal has possible error, format it",
" callInfo.xaRetVal_ = XAResource.XA_OK; // re-initialize XARETVAL"
],
"header": "@@ -148,16 +150,16 @@ public class NetXAConnection extends org.apache.derby.client.net.NetConnection {",
"removed": [
" callInfo.xaRetVal_ = NetXAResource.XARETVAL_XAOK; // initialize XARETVAL",
" if (callInfo.xaRetVal_ != NetXAResource.XARETVAL_XAOK) { // xaRetVal has possible error, format it",
" callInfo.xaRetVal_ = NetXAResource.XARETVAL_XAOK; // re-initialize XARETVAL"
]
}
]
},
{
"file": "java/client/org/apache/derby/client/net/NetXAResource.java",
"hunks": [
{
"added": [],
"header": "@@ -62,39 +62,6 @@ public class NetXAResource implements XAResource {",
"removed": [
" // xaretval defines",
" public static final int XARETVAL_XALCSNOTSUPP = 99; // Loosely Coupled Not Supported",
" public static final int XARETVAL_RBROLLBACK = 100; // Rollback",
" public static final int XARETVAL_RBCOMMFAIL = 101; // Rollback Communication Failure",
" public static final int XARETVAL_RBDEADLOCK = 102; // Rollback Deadlock",
" public static final int XARETVAL_RBINTEGRITY = 103; // Rollback integrity violation",
" public static final int XARETVAL_RBOTHER = 104; // Rollback Other",
" public static final int XARETVAL_RBPROTO = 105; // Rollback Protocol",
" public static final int XARETVAL_RBTIMEOUT = 106; // Rollback Timeout",
" public static final int XARETVAL_RBTRANSIENT = 107; // Rollback Transaction branch",
" public static final int XARETVAL_NODISSOCIATE = 108; // Unable to Dissociate resources from connection",
" public static final int XARETVAL_XATWOPHASE = 13; // TwoPhase commit required",
" public static final int XARETVAL_XAPROMOTED = 12; // Promoted - unused",
" public static final int XARETVAL_XADEFERRED = 11; // Deferred - unused",
" public static final int XARETVAL_XACOMMFAIL = 10; // Communication Failure",
" public static final int XARETVAL_XANOMIGRATE = 9; // No Migration",
" public static final int XARETVAL_XAHEURHAZ = 8; // Heuristically completed",
" public static final int XARETVAL_XAHEURCOM = 7; // Heuristically Commited",
" public static final int XARETVAL_XAHEURRB = 6; // Heuristically Rolledback",
" public static final int XARETVAL_XAHEURMIX = 5; // Branch heuristically commit and rollback",
" public static final int XARETVAL_XARETRY = 4; // Retry Commit",
" public static final int XARETVAL_XARDONLY = 3; // Read Only",
" public static final int XARETVAL_XAOK = 0; // OK",
" public static final int XARETVAL_XAERASYNC = -2; // Async Request not possible",
" public static final int XARETVAL_XAERRMERR = -3; // RM Error",
" public static final int XARETVAL_XAERNOTA = -4; // XID does not exist",
" public static final int XARETVAL_XAERINVAL = -5; // Invalid arguments",
" public static final int XARETVAL_XAERPROTO = -6; // Protocol Violation",
" public static final int XARETVAL_XAERRMFAIL = -7; // RM Failed",
" public static final int XARETVAL_XAERDUPID = -8; // Duplicate XID",
" public static final int XARETVAL_XAEROUTSIDE = -9; // Local tansaction active",
" public static final int XARETVAL_XAEROPENRES = -10; // Open resources",
""
]
},
{
"added": [
" callInfo.xaRetVal_ = XAResource.XA_OK; // initialize XARETVAL",
" if (callInfo.xaRetVal_ != XAResource.XA_OK) { // xaRetVal has possible error, format it",
" callInfo.xaRetVal_ = XAResource.XA_OK; // re-initialize XARETVAL"
],
"header": "@@ -193,16 +160,16 @@ public class NetXAResource implements XAResource {",
"removed": [
" callInfo.xaRetVal_ = XARETVAL_XAOK; // initialize XARETVAL",
" if (callInfo.xaRetVal_ != XARETVAL_XAOK) { // xaRetVal has possible error, format it",
" callInfo.xaRetVal_ = XARETVAL_XAOK; // re-initialize XARETVAL"
]
},
{
"added": [
" callInfo.xaRetVal_ = XAResource.XA_OK; // initialize XARETVAL",
" if (callInfo.xaRetVal_ != XAResource.XA_OK) { // xaRetVal has possible error, format it",
" callInfo.xaRetVal_ = XAResource.XA_OK; // re-initialize XARETVAL"
],
"header": "@@ -253,17 +220,17 @@ public class NetXAResource implements XAResource {",
"removed": [
" callInfo.xaRetVal_ = XARETVAL_XAOK; // initialize XARETVAL",
" if (callInfo.xaRetVal_ != XARETVAL_XAOK) { // xaRetVal has possible error, format it",
" callInfo.xaRetVal_ = XARETVAL_XAOK; // re-initialize XARETVAL"
]
},
{
"added": [
" callInfo.xaRetVal_ = XAResource.XA_OK; // initialize XARETVAL"
],
"header": "@@ -303,7 +270,7 @@ public class NetXAResource implements XAResource {",
"removed": [
" callInfo.xaRetVal_ = XARETVAL_XAOK; // initialize XARETVAL"
]
},
{
"added": [
" if (callInfo.xaRetVal_ != XAResource.XA_OK) { // xaRetVal has possible error, format it",
" callInfo.xaRetVal_ = XAResource.XA_OK; // re-initialize XARETVAL"
],
"header": "@@ -317,10 +284,10 @@ public class NetXAResource implements XAResource {",
"removed": [
" if (callInfo.xaRetVal_ != XARETVAL_XAOK) { // xaRetVal has possible error, format it",
" callInfo.xaRetVal_ = XARETVAL_XAOK; // re-initialize XARETVAL"
]
},
{
"added": [
" callInfo.xaRetVal_ = XAResource.XA_OK; // initialize XARETVAL"
],
"header": "@@ -389,7 +356,7 @@ public class NetXAResource implements XAResource {",
"removed": [
" callInfo.xaRetVal_ = XARETVAL_XAOK; // initialize XARETVAL"
]
},
{
"added": [
" if ((callInfo.xaRetVal_ != XAResource.XA_OK) &&",
" (callInfo.xaRetVal_ != XAException.XA_RDONLY)) { // xaRetVal has possible error, format it",
" callInfo.xaRetVal_ = XAResource.XA_OK; // re-initialize XARETVAL"
],
"header": "@@ -398,11 +365,11 @@ public class NetXAResource implements XAResource {",
"removed": [
" if ((callInfo.xaRetVal_ != XARETVAL_XAOK) &&",
" (callInfo.xaRetVal_ != XARETVAL_XARDONLY)) { // xaRetVal has possible error, format it",
" callInfo.xaRetVal_ = XARETVAL_XAOK; // re-initialize XARETVAL"
]
},
{
"added": [
" callInfo.xaRetVal_ = XAResource.XA_OK; // initialize XARETVAL",
" if (callInfo.xaRetVal_ != XAResource.XA_OK) { // xaRetVal has possible error, format it",
" callInfo.xaRetVal_ = XAResource.XA_OK; // re-initialize XARETVAL"
],
"header": "@@ -455,17 +422,17 @@ public class NetXAResource implements XAResource {",
"removed": [
" callInfo.xaRetVal_ = XARETVAL_XAOK; // initialize XARETVAL",
" if (callInfo.xaRetVal_ != XARETVAL_XAOK) { // xaRetVal has possible error, format it",
" callInfo.xaRetVal_ = XARETVAL_XAOK; // re-initialize XARETVAL"
]
},
{
"added": [
" callInfo.xaRetVal_ = XAResource.XA_OK; // initialize XARETVAL"
],
"header": "@@ -518,7 +485,7 @@ public class NetXAResource implements XAResource {",
"removed": [
" callInfo.xaRetVal_ = XARETVAL_XAOK; // initialize XARETVAL"
]
},
{
"added": [
" if (callInfo.xaRetVal_ != XAResource.XA_OK) { // xaRetVal has possible error, format it",
" callInfo.xaRetVal_ = XAResource.XA_OK; // re-initialize XARETVAL"
],
"header": "@@ -526,10 +493,10 @@ public class NetXAResource implements XAResource {",
"removed": [
" if (callInfo.xaRetVal_ != XARETVAL_XAOK) { // xaRetVal has possible error, format it",
" callInfo.xaRetVal_ = XARETVAL_XAOK; // re-initialize XARETVAL"
]
},
{
"added": [
" callInfo.xaRetVal_ = XAResource.XA_OK; // initialize XARETVAL",
" if (callInfo.xaRetVal_ != XAResource.XA_OK) { // xaRetVal has possible error, format it",
" callInfo.xaRetVal_ = XAResource.XA_OK; // re-initialize XARETVAL",
" if (rc == XAResource.XA_OK) {"
],
"header": "@@ -591,20 +558,20 @@ public class NetXAResource implements XAResource {",
"removed": [
" callInfo.xaRetVal_ = XARETVAL_XAOK; // initialize XARETVAL",
" if (callInfo.xaRetVal_ != XARETVAL_XAOK) { // xaRetVal has possible error, format it",
" callInfo.xaRetVal_ = XARETVAL_XAOK; // re-initialize XARETVAL",
" if (rc == XARETVAL_XAOK) {"
]
},
{
"added": [
"",
" // xaRetVal_ is set by the server to be one of the",
" // standard constants from XAException.",
" int rc = callInfo.xaRetVal_;"
],
"header": "@@ -915,58 +882,10 @@ public class NetXAResource implements XAResource {",
"removed": [
" int rc;",
" switch (callInfo.xaRetVal_) {",
" case XARETVAL_XAOK:",
" case XARETVAL_NODISSOCIATE:",
" rc = XAResource.XA_OK;",
" break;",
" case XARETVAL_XALCSNOTSUPP:",
" rc = XAResource.XA_OK;",
" break;",
" case XARETVAL_RBROLLBACK:",
" rc = XAException.XA_RBROLLBACK;",
" break;",
" case XARETVAL_RBOTHER:",
" rc = XAException.XA_RBOTHER;",
" break;",
" case XARETVAL_RBDEADLOCK:",
" rc = XAException.XA_RBDEADLOCK;",
" break;",
" case XARETVAL_RBPROTO:",
" rc = XAException.XA_RBPROTO;",
" break;",
" case XARETVAL_XAERPROTO:",
" rc = XAException.XAER_PROTO;",
" break;",
" case XARETVAL_XARDONLY:",
" rc = XAException.XA_RDONLY;",
" break;",
" case XARETVAL_XAHEURCOM:",
" rc = XAException.XA_HEURCOM;",
" break;",
" case XARETVAL_XAHEURRB:",
" rc = XAException.XA_HEURRB;",
" break;",
" case XARETVAL_XAERDUPID:",
" rc = XAException.XAER_DUPID;",
" break;",
" case XARETVAL_XAERNOTA:",
" rc = XAException.XAER_NOTA;",
" break;",
" case XARETVAL_XAERRMERR:",
" rc = XAException.XAER_RMERR;",
" break;",
" case XARETVAL_XAERRMFAIL:",
" rc = XAException.XAER_RMFAIL;",
" break;",
" case XARETVAL_XAERINVAL:",
" rc = XAException.XAER_INVAL;",
" break;",
" default:",
" rc = XAException.XAER_RMFAIL;",
" break;",
" }"
]
}
]
}
] |
derby-DERBY-1025-1a7cb26e
|
DERBY-1025 - [xa] client XAResource.start() does not commit an active local transaction when auto commit is true
Contributed by Deepa Remesh
------------------------------------------------
Summary:
------------------------------------------------
* Modifies NetXAResource.start to check if the connection is in autocommit mode and flow an auto commit.
* Uncomments the tests for this issue in jdbcapi/XATest.java and jdbcapi/checkDataSource.java
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@394134 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-1025-bff53129
|
DERBY-1025 / DERBY-2620 test cases
Make sure statement is created with holdability CLOSE_CURSORS_AT_COMMIT when testing if xa_start commits the transaction. Exempt embedded from running DERBY-1025 test because of 08003 - No current connection
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@535973 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-1025-c63d941b
|
DERBY-435 jdbcapi/checkDataSource.java and jdbapi/checkDataSource30.java to tests should be changed or extended to test client DataSources
- Brings checkDataSource and checkDataSourc30 into derbynetclientmats
- Reenables tests for DERBY-1044 now that it is fixed.
Tests are excluded for some bugs uncovered by this test that have yet to
be resolved:
DERBY-1035, DERBY-1047, DERBY-1025, DERBY-1148, DERBY-1183
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@391902 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-1025-fa1185de
|
DERBY-435 continuing work to get checkDataSource running with client
disabled test cases for DERBY-1025, DERBY-1044, and DERBY-1047
added workaround for DERBY-1036 to give statements different cursor names
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@380672 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-1030-7d3ddb17
|
DERBY-1030 (partial) Add some comments to the logic for the RETURNS ON NULL INPUT's state field.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@475803 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/sql/compile/SQLToJavaValueNode.java",
"hunks": [
{
"added": [
" /**",
" * If set then this SQL value is being passed into a SQL function",
" * declared RETURNS NULL ON NULL input. In this case this node",
" * performs NULL checking logic in addition simple translation",
" * from the SQL domain to the Java domain. Thus if this",
" * is set then this node can not be removed when it",
" * is paired with a JavaToSQLValueNode.",
" * This field is set at generate time of the",
" * enclosing StaticMethodCallNode.",
" */"
],
"header": "@@ -59,6 +59,16 @@ public class SQLToJavaValueNode extends JavaValueNode",
"removed": []
},
{
"added": [
"\t{ "
],
"header": "@@ -326,7 +336,7 @@ public class SQLToJavaValueNode extends JavaValueNode",
"removed": [
"\t{"
]
},
{
"added": [
"\tprivate void generateSQLValue(ExpressionClassBuilder acb,"
],
"header": "@@ -344,7 +354,7 @@ public class SQLToJavaValueNode extends JavaValueNode",
"removed": [
"\tpublic void generateSQLValue(ExpressionClassBuilder acb,"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/StaticMethodCallNode.java",
"hunks": [
{
"added": [
" /**",
" * Generated boolean field to hold the indicator",
" * for if any of the parameters to a",
" * RETURNS NULL ON NULL INPUT function are NULL.",
" * Only set if this node is calling such a function.",
" * Set at generation time.",
" */"
],
"header": "@@ -120,6 +120,13 @@ public class StaticMethodCallNode extends MethodCallNode",
"removed": []
}
]
}
] |
derby-DERBY-1030-d2cb094d
|
DERBY-1030 (partial) Add test cases to RoutineTest that demonstrate this bug, where
a function declared as RETURNS NULL ON NULL INPUT can be called when its argument is NULL.
Look for the comment with this bug number.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@475490 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-1035-93abf18b
|
Disable tests for setting isolation with an SQL statement for client until DERBY-1035 is fixed
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@380020 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-1035-ac53be6a
|
DERBY-1148 Client XA getTransactionIsolation() does not return the correct isolation level when rejoining a global transaction
Contributed by Deepa Remesh
Summary of patch:
* Changes getTransactionIsolation method in org.apache.derby.client.am.Connection class to get the isolation level from server. The built-in function "CURRENT ISOLATION" is used for this. It throws SQLException in case of failures. At the start of the method, the current auto-commit value is stored in a variable. When executing the function, auto-commit is set to false. At the end of the method, auto-commit value is restored. As it is the client which drives the auto-commit, this strategy of locally changing the auto-commit works.
* Removes the excludes for DERBY-1148 and DERBY-1035 from checkDataSource test. Adds a test for transaction suspend/resume in checkDataSource test. Updates master files
With this patch, I have run derbynetclientmats with Sun jdk 1.4.2 on Windows XP. I also ran checkDataSource.java and checkDataSource30.java with embedded and client framework. No failures
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@409470 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/client/org/apache/derby/client/am/Connection.java",
"hunks": [
{
"added": [
" ",
" // used to get transaction isolation level",
" private Statement getTransactionIsolationStmt = null;",
" "
],
"header": "@@ -80,6 +80,10 @@ public abstract class Connection implements java.sql.Connection,",
"removed": []
},
{
"added": [
" setTransactionIsolationStmt = null;",
" if (getTransactionIsolationStmt != null) {",
" try {",
" getTransactionIsolationStmt.close();",
" } catch (SQLException se) {",
" accumulatedExceptions = Utils.accumulateSQLException(",
" se, accumulatedExceptions);",
" }",
" }",
" getTransactionIsolationStmt = null;"
],
"header": "@@ -752,6 +756,16 @@ public abstract class Connection implements java.sql.Connection,",
"removed": []
}
]
}
] |
derby-DERBY-1035-c63d941b
|
DERBY-435 jdbcapi/checkDataSource.java and jdbapi/checkDataSource30.java to tests should be changed or extended to test client DataSources
- Brings checkDataSource and checkDataSourc30 into derbynetclientmats
- Reenables tests for DERBY-1044 now that it is fixed.
Tests are excluded for some bugs uncovered by this test that have yet to
be resolved:
DERBY-1035, DERBY-1047, DERBY-1025, DERBY-1148, DERBY-1183
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@391902 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-1037-61634ec3
|
DERBY-1037: Fix lang/ShutdownDatabase.java in J2ME environment.
Committed for Myrna Van Lunteren <[email protected]>
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@386218 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-1039-b9ee498b
|
DERBY-1039, committed on behalf of Suresh Thalamati
-- database create will fail with error if the user specified logDevice location
already contains non-empty "log" dir at that location.
-- added a new test that tests database creation with logDevice location
with absolute paths and also the above expected error case.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@397011 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/store/raw/log/LogToFile.java",
"hunks": [
{
"added": [
"",
"",
" /**",
" * Create the directory where transaction log should go.",
" * @exception StandardException Standard Error Policy",
" */",
"\tprivate void createLogDirectory() throws StandardException",
"\t{",
"\t\tStorageFile logDir = ",
" logStorageFactory.newStorageFile(LogFactory.LOG_DIRECTORY_NAME);",
"",
" if (privExists(logDir)) {",
" // make sure log directory is empty.",
" String[] logfiles = privList(logDir);",
" if (logfiles != null) {",
" if(logfiles.length != 0) {",
" throw StandardException.newException(",
" SQLState.LOG_SEGMENT_EXIST, logDir.getPath());",
" }",
" }",
" ",
" }else {",
" // create the log directory.",
" if (!privMkdirs(logDir)) {",
" throw StandardException.newException(",
" SQLState.LOG_SEGMENT_NOT_EXIST, logDir.getPath());",
" }",
" }",
"\t}",
""
],
"header": "@@ -2464,6 +2464,36 @@ public final class LogToFile implements LogFactory, ModuleControl, ModuleSupport",
"removed": []
},
{
"added": [
" if (!privExists(logDir))"
],
"header": "@@ -2476,7 +2506,7 @@ public final class LogToFile implements LogFactory, ModuleControl, ModuleSupport",
"removed": [
" if (!privExists(logDir) && !privMkdirs(logDir))"
]
},
{
"added": [
"",
" if(create) {",
" getLogStorageFactory();",
" createLogDirectory();",
" ",
" } else {",
" // check if the database is being restored from the backup,",
" // if it is then restore the logs.",
" if (!restoreLogs(startParams)) {",
" // set the log storage factory.",
" getLogStorageFactory();",
" if (logDevice != null)",
" {",
" // Make sure we find the log, do not assume ",
" // it is OK that the log is not there because ",
" // it could be a user typo(like when users edit",
" // service.properties to change the log device ",
" // while restoring from backups using OS copy.",
" StorageFile checklogDir =",
" logStorageFactory.newStorageFile( ",
" LogFactory.LOG_DIRECTORY_NAME);",
" if (!privExists(checklogDir))",
" {",
" throw",
" StandardException.newException(",
" SQLState.LOG_FILE_NOT_FOUND, checklogDir.getPath());",
"",
" }",
" }",
" }",
" }",
" \t\t"
],
"header": "@@ -2806,48 +2836,44 @@ public final class LogToFile implements LogFactory, ModuleControl, ModuleSupport",
"removed": [
"\t\t//check whether we are restoring from backup",
"\t\trestoreLogs(startParams);",
"\t\t",
"",
" if( logStorageFactory == null)",
" getLogStorageFactory();",
"\t\tif (logDevice != null)",
"\t\t{",
"\t\t\t// in case the user specifies logDevice in URL form",
"\t\t\tString logDeviceURL = null;",
"\t\t\ttry {",
"\t\t\t\tURL url = new URL(logDevice);",
"\t\t\t\tlogDeviceURL = url.getFile();",
"\t\t\t} catch (MalformedURLException ex) {}",
"\t\t\tif (logDeviceURL != null)",
"\t\t\t\tlogDevice = logDeviceURL;",
"",
"\t\t\t// Make sure we find the log, do not assume it is OK that the log",
"\t\t\t// is not there because it could be a user typo.",
"\t\t\tif (!create)",
"\t\t\t{",
"\t\t\t\tStorageFile checklogDir =",
"\t\t\t\t\tlogStorageFactory.newStorageFile( LogFactory.LOG_DIRECTORY_NAME);",
"",
" if (!privExists(checklogDir))",
"\t\t\t\t{",
"",
"\t\t\t\t\tthrow",
" StandardException.newException(",
" SQLState.LOG_FILE_NOT_FOUND, checklogDir.getPath());",
"",
"\t\t\t\t}",
"\t\t\t}",
"\t\t}",
"",
""
]
},
{
"added": [
"\t * Attribute.RESTORE_FROM (Delete the whole database if it exists and then ",
" * restore it from backup)",
"\t * backup. log files in the backup are copied to the existing online log ",
" * directory."
],
"header": "@@ -4641,11 +4667,12 @@ public final class LogToFile implements LogFactory, ModuleControl, ModuleSupport",
"removed": [
"\t * Attribute.RESTORE_FROM (Delete the whole database if it exists and then restore",
"\t * it from backup)",
"\t * backup. log files in the backup are copied to the existing online log directory."
]
},
{
"added": [
"\t * log files(including control files) that exists in the backup from which ",
" * we are are trying to restore the database to the onlie log directory.",
"\tprivate boolean restoreLogs(Properties properties) throws StandardException",
"\t\t//check if the user requested for restore/recovery/create from backup",
" if (backupPath != null) {",
" isCreateFrom = true;",
" } else {",
" if (backupPath != null) {",
" isRestoreFrom = true;",
" } else {",
" backupPath = properties.getProperty(",
" Attribute.ROLL_FORWARD_RECOVERY_FROM);",
" // if the backup is not NULL then it is a rollforward recovery.",
" }",
" }",
"\t\t\t\t\t * In restoreFrom/rollForwardRecoveryFrom mode when no ",
" * logDevice on URL then the log is restored to the same ",
" * location where the log was when backup was taken.",
"\t\t\t\t\t * In createFrom mode behaviour is same as when create=true,",
"\t\t\t\t\t * i.e unless user specifies the logDevice on URL, log will",
" * be copied to the database home dir.",
"\t\t\t\t\tlogDevice = ",
" properties.getProperty(Property.LOG_DEVICE_AT_BACKUP);",
" ",
"\t\t\tlogDir = logStorageFactory.newStorageFile( ",
" LogFactory.LOG_DIRECTORY_NAME);"
],
"header": "@@ -4655,57 +4682,54 @@ public final class LogToFile implements LogFactory, ModuleControl, ModuleSupport",
"removed": [
"\t * log files(including control files) that exists in the backup from which we are",
"\t * are trying to restore the database to the onlie log directory.",
"\tprivate void restoreLogs(Properties properties) throws StandardException",
"\t\t//check if the user request for restore/recovery/create from backup",
"\t\tif(backupPath == null)",
"\t\telse",
"\t\t\tisCreateFrom = true;",
"",
"\t\tif(backupPath == null)",
"\t\t\tbackupPath =",
"\t\t\t\tproperties.getProperty(Attribute.ROLL_FORWARD_RECOVERY_FROM);",
"\t\telse",
"\t\t\tisRestoreFrom = true;",
"\t\t",
"\t\t\t\t\t * In restoreFrom/rollForwardRecoveryFrom mode when no logDevice on",
"\t\t\t\t\t * URL then the log is restored to the same location where the log was ",
"\t\t\t\t\t * when backup was taken.",
"\t\t\t\t\t * In createFrom mode behaviour is same as when create=true , ",
"\t\t\t\t\t * i.e unless user specifies the logDevice on URL, log will be copied to",
"\t\t\t\t\t * the database home dir.",
"\t\t\t\t\tlogDevice = properties.getProperty(Property.LOG_DEVICE_AT_BACKUP);",
"",
"\t\t\tlogDir = logStorageFactory.newStorageFile( LogFactory.LOG_DIRECTORY_NAME);",
"\t\t\tif(isCreateFrom){",
"\t\t\t\t//log dir should not exist if we are doing create from",
"\t\t\t\tif(privExists(logDir))",
"\t\t\t\t\tthrow StandardException.newException(SQLState.LOG_SEGMENT_EXIST, getLogDirPath( logDir));",
"\t\t\t}",
""
]
},
{
"added": [
" {",
"\t\t\t\t\t\tthrow StandardException.newException(",
" SQLState.UNABLE_TO_REMOVE_DATA_DIRECTORY,",
" getLogDirPath( logDir));",
" }",
" // if it is a create/restore from backup, ",
" // create the log directory.",
" if (isCreateFrom || isRestoreFrom) {",
" createLogDirectory();",
" }"
],
"header": "@@ -4716,13 +4740,20 @@ public final class LogToFile implements LogFactory, ModuleControl, ModuleSupport",
"removed": [
"\t\t\t\t\t\tthrow StandardException.newException(SQLState.UNABLE_TO_REMOVE_DATA_DIRECTORY,",
" getLogDirPath( logDir));",
"\t\t\tlogDir = getLogDirectory();"
]
}
]
}
] |
derby-DERBY-1040-67225cdc
|
DERBY-1040; Run store locking tests with network server and investigate locking behaviour
Pushing LockTableVtiTest to run with both embedded and DerbyNetClient/Network Server
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1629764 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-1042-31083414
|
DERBY-1042: committed on behalf of Suresh Thalamati
I could not reproduce this problem on my machine. By looking at the code I
found backup is getting unblocked before the post commit work is done.
This may cause the error that is reported, if the jar files to copied to the
backup is deleted by the post commit. Attached patch unblocks the backup
only after the post commit work that is schedules to run in the same
transaction is done. While scanning the code for this problem, I also noticed
couple of other small issues, this patch addresses them also.
DERBY-1042:
-- unblock the backup only after the post commit work to be done on the same
transaction is complete.
-- when backup is in progress drop stub files are not deleted during
checkpoint. These are necessary to perform recovery starting from the
backup checkpoint.
-- synchronized getContaineNames() that gets the containers to be written to
the backup. This method need to be synchronized so that other privileged
actions does not run in parallel and vice versa.
-- Modified the OnlineBackupTest1.java and OnlineBackupTest3.java tests to
abort if there is a error during the backup instead of waiting incorrectly
for the failed backup to complete forever.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@384661 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/store/raw/xact/Xact.java",
"hunks": [
{
"added": [],
"header": "@@ -1911,10 +1911,6 @@ public class Xact extends RawTransaction implements Limit {",
"removed": [
"\t\t// any backup blocking operations (like unlogged ops) in this ",
"\t\t// transaction are done with post commit/abort work by now, ",
"\t\t// unblock the backup.",
"\t\tunblockBackup();"
]
}
]
}
] |
derby-DERBY-1043-e2cf840c
|
DERBY-1043 Invalid column references are not caught in a trigger action statement when the referencing table of the column is the triggered table. Contributed by Fernanda Pizzorno.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@418933 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/sql/compile/UpdateNode.java",
"hunks": [
{
"added": [
"\t\t * the table name out from each RC. See comment on ",
"\t\t * checkTableNameAndScrubResultColumns().",
"\t\tcheckTableNameAndScrubResultColumns(resultColumnList);"
],
"header": "@@ -511,9 +511,10 @@ public final class UpdateNode extends DMLModStatementNode",
"removed": [
"\t\t * the table name out from each RC. See comment on scrubResultColumns().",
"\t\tscrubResultColumns( resultColumnList );"
]
},
{
"added": [],
"header": "@@ -1007,20 +1008,6 @@ public final class UpdateNode extends DMLModStatementNode",
"removed": [
"\tprivate\tvoid\tscrubResultColumns( ResultColumnList rcl )",
"\t{",
"\t\t/* The table name is",
"\t\t * unnecessary for an update. More importantly, though, it",
"\t\t * creates a problem in the degenerate case with a positioned",
"\t\t * update. The user must specify the base table name for a",
"\t\t * positioned update. If a correlation name was specified for",
"\t\t * the cursor, then a match for the ColumnReference would not",
"\t\t * be found if we didn't null out the name. (Aren't you",
"\t\t * glad you asked?)",
"\t\t */",
"\t\trcl.clearTableNames();",
"\t}",
""
]
}
]
}
] |
derby-DERBY-1044-c63d941b
|
DERBY-435 jdbcapi/checkDataSource.java and jdbapi/checkDataSource30.java to tests should be changed or extended to test client DataSources
- Brings checkDataSource and checkDataSourc30 into derbynetclientmats
- Reenables tests for DERBY-1044 now that it is fixed.
Tests are excluded for some bugs uncovered by this test that have yet to
be resolved:
DERBY-1035, DERBY-1047, DERBY-1025, DERBY-1148, DERBY-1183
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@391902 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-1044-fa1185de
|
DERBY-435 continuing work to get checkDataSource running with client
disabled test cases for DERBY-1025, DERBY-1044, and DERBY-1047
added workaround for DERBY-1036 to give statements different cursor names
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@380672 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-1047-b01ccf59
|
DERBY-1196 Network server closes prepared statements prematurely if exception occurs during OPNQRY
- Takes out close of prepared statement on exception in OPNQRY in DRDAConnThread processCommands
- Updates the JCC master for derbnet/setTransactionIsolation.
This test was getting Statement already closed errors for valid statements with JCC that are no longer in the master.
- Enables test for DERBY-1047 in checkDataSource ( Note this case actually passes withtout the fix because of the fix for DERBY-1158)
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@392781 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-1047-c63d941b
|
DERBY-435 jdbcapi/checkDataSource.java and jdbapi/checkDataSource30.java to tests should be changed or extended to test client DataSources
- Brings checkDataSource and checkDataSourc30 into derbynetclientmats
- Reenables tests for DERBY-1044 now that it is fixed.
Tests are excluded for some bugs uncovered by this test that have yet to
be resolved:
DERBY-1035, DERBY-1047, DERBY-1025, DERBY-1148, DERBY-1183
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@391902 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-1047-fa1185de
|
DERBY-435 continuing work to get checkDataSource running with client
disabled test cases for DERBY-1025, DERBY-1044, and DERBY-1047
added workaround for DERBY-1036 to give statements different cursor names
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@380672 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-1052-4a95eeb4
|
DERBY-434 DERBY-1052: Fix XA tests in remote server testing.
Committed for Myrna Van Lunteren <[email protected]>
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@386221 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/testing/org/apache/derbyTesting/functionTests/util/TestUtil.java",
"hunks": [
{
"added": [
"\t\t// for remote server testing, check whether the hostName is set for the test",
"\t\t// if so, and serverName is not yet set explicitly for the datasource, set it now",
"\t\tString hostName = getHostName();",
"\t\tif ( (!isEmbeddedFramework()) && (hostName != null ) && (attrs.getProperty(\"serverName\") == null) )",
"\t\t\tattrs.setProperty(\"serverName\", hostName);",
""
],
"header": "@@ -399,6 +399,12 @@ public class TestUtil {",
"removed": []
}
]
}
] |
derby-DERBY-1055-7a20f8d1
|
DERBY-1055 Security.AccessControlException in client under SecurityManager when trying to connect using EUSRIDPWD security mechanism
Contributed by Sunitha Kambhampati
Patch
- removes the unnecessary addProvider call in EncryptionManager that was causing
the Security.AccessControlException.
- enables test to connect using EUSRIDPWD mechanism and updates necessary masters
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@382911 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-1060-8d6d99d4
|
DERBY-1060: ResultSet methods should throw exception when the
ResultSet is closed
The patch adds calls to checkIfClosed (embeddded) or
checkForClosedResultSet (network client) in the ResultSet methods
which don't check whether the ResultSet is closed. It also adds a test
case to jdbc4/TestResultSetMethods.java.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@383394 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/client/org/apache/derby/client/am/ResultSet.java",
"hunks": [
{
"added": [
" /**",
" * Returns the first <code>SQLWarning</code> reported on this",
" * <code>ResultSet</code> object, or <code>null</code> if there",
" * are no warnings. Subsequent warnings are chained on the",
" * returned object.",
" *",
" * @return the first <code>SQLWarning</code> in the chain, or",
" * <code>null</code> if no warnings are reported",
" * @exception SQLException if a database error occurs or the",
" * result set is closed",
" */",
" public final java.sql.SQLWarning getWarnings() throws SQLException {",
" try {",
" checkForClosedResultSet();",
" } catch (SqlException se) {",
" throw se.getSQLException();",
" }",
" /**",
" * Clear all warnings on this <code>ResultSet</code> and make",
" * subsequent calls to <code>getWarnings()</code> return",
" * <code>null</code> until a new warning is reported.",
" *",
" * @exception SQLException if a database error occurs or the",
" * result set is closed",
" */",
" try {",
" checkForClosedResultSet();",
" } catch (SqlException se) {",
" throw se.getSQLException();",
" }",
" clearWarningsX();"
],
"header": "@@ -1817,19 +1817,48 @@ public abstract class ResultSet implements java.sql.ResultSet,",
"removed": [
" public final java.sql.SQLWarning getWarnings() {",
" warnings_ = null;"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java",
"hunks": [
{
"added": [
"\t * @exception SQLException if a database error occurs or the",
"\t * result set is closed",
"\tpublic final Statement getStatement() throws SQLException",
" checkIfClosed(\"getStatement\");"
],
"header": "@@ -1676,9 +1676,12 @@ public abstract class EmbedResultSet extends ConnectionChild",
"removed": [
"\tpublic final Statement getStatement()"
]
},
{
"added": [
"\t\tcheckIfClosed(\"getRow\");",
""
],
"header": "@@ -1837,6 +1840,8 @@ public abstract class EmbedResultSet extends ConnectionChild",
"removed": []
},
{
"added": [
"\t\tcheckIfClosed(\"setFetchDirection\");"
],
"header": "@@ -1946,6 +1951,7 @@ public abstract class EmbedResultSet extends ConnectionChild",
"removed": []
},
{
"added": [
"\t\tcheckIfClosed(\"getFetchDirection\");"
],
"header": "@@ -1963,6 +1969,7 @@ public abstract class EmbedResultSet extends ConnectionChild",
"removed": []
},
{
"added": [
"\t\tcheckIfClosed(\"setFetchSize\");"
],
"header": "@@ -1988,6 +1995,7 @@ public abstract class EmbedResultSet extends ConnectionChild",
"removed": []
},
{
"added": [
"\t\tcheckIfClosed(\"getFetchSize\");"
],
"header": "@@ -2006,6 +2014,7 @@ public abstract class EmbedResultSet extends ConnectionChild",
"removed": []
},
{
"added": [
"\t\tcheckIfClosed(\"getType\");"
],
"header": "@@ -2026,6 +2035,7 @@ public abstract class EmbedResultSet extends ConnectionChild",
"removed": []
},
{
"added": [
"\t\tcheckIfClosed(\"getConcurrency\");"
],
"header": "@@ -2047,6 +2057,7 @@ public abstract class EmbedResultSet extends ConnectionChild",
"removed": []
},
{
"added": [
"\t\tcheckIfClosed(\"rowUpdated\");"
],
"header": "@@ -2068,6 +2079,7 @@ public abstract class EmbedResultSet extends ConnectionChild",
"removed": []
},
{
"added": [
"\t\tcheckIfClosed(\"rowInserted\");"
],
"header": "@@ -2084,6 +2096,7 @@ public abstract class EmbedResultSet extends ConnectionChild",
"removed": []
},
{
"added": [
"\t\tcheckIfClosed(\"rowDeleted\");"
],
"header": "@@ -2102,6 +2115,7 @@ public abstract class EmbedResultSet extends ConnectionChild",
"removed": []
},
{
"added": [
"\t//1)Make sure JDBC ResultSet is not closed",
"\t//2)Make sure this is an updatable ResultSet",
" //1)Make sure JDBC ResultSet is not closed",
" //2)Make sure this is an updatable ResultSet",
" checkUpdatableCursor(methodName);",
""
],
"header": "@@ -2128,18 +2142,18 @@ public abstract class EmbedResultSet extends ConnectionChild",
"removed": [
"\t//1)Make sure this is an updatable ResultSet",
"\t//2)Make sure JDBC ResultSet is not closed",
" //1)Make sure this is an updatable ResultSet",
" checkUpdatableCursor(methodName);",
"",
" //2)Make sure JDBC ResultSet is not closed"
]
},
{
"added": [
" * 1) Make sure JDBC ResultSet is not closed",
" * 2) Make sure this is an updatable ResultSet",
" // 1)Make sure JDBC ResultSet is not closed",
" checkIfClosed(\"insertRow\");",
"",
" // 2)Make sure this is an updatable ResultSet"
],
"header": "@@ -2165,19 +2179,19 @@ public abstract class EmbedResultSet extends ConnectionChild",
"removed": [
" * 1) Make sure this is an updatable ResultSet",
" * 2) Make sure JDBC ResultSet is not closed",
" // 1)Make sure this is an updatable ResultSet",
" // 2)Make sure JDBC ResultSet is not closed",
" checkIfClosed(\"insertRow\");",
""
]
},
{
"added": [
"\t\tcheckExecIfClosed(\"moveToInsertRow\");",
""
],
"header": "@@ -3568,11 +3582,11 @@ public abstract class EmbedResultSet extends ConnectionChild",
"removed": [
"\t\tcheckExecIfClosed(\"moveToInsertRow\");",
""
]
}
]
}
] |
derby-DERBY-1062-3082e5d2
|
DERBY-1062: Escape special characters in table name and schema name before passing them on to ALTER TABLE
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@658604 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/catalog/SystemProcedures.java",
"hunks": [
{
"added": [
" String escapedSchema = escapeSQLIdentifier(schema);",
" String escapedTableName = escapeSQLIdentifier(tablename);",
" \"alter table \" + escapedSchema + \".\" + escapedTableName +"
],
"header": "@@ -723,8 +723,10 @@ public class SystemProcedures {",
"removed": [
" \"alter table \" + \"\\\"\" + schema + \"\\\"\" + \".\" + \"\\\"\" + tablename + \"\\\"\" + "
]
},
{
"added": [
" /**",
" * Escape an SQL identifier to preserve mixed case and special characters.",
" */",
" private static String escapeSQLIdentifier(String identifier) {",
" StringBuffer buffer = new StringBuffer(identifier.length() + 2);",
" buffer.append('\"');",
" for (int i = 0; i < identifier.length(); i++) {",
" char c = identifier.charAt(i);",
" // if c is a double quote, escape it with an extra double quote",
" if (c == '\"') buffer.append('\"');",
" buffer.append(c);",
" }",
" buffer.append('\"');",
" return buffer.toString();",
" }",
""
],
"header": "@@ -736,6 +738,22 @@ public class SystemProcedures {",
"removed": []
}
]
}
] |
derby-DERBY-1062-7bf9b221
|
Cleaning for sqlgrammar.jj a little bit by removing the code to pass the parameters which never will be
set during ALTER TABLE when we are doing a non-compress operation on the table. This is for DERBY-1062
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@657154 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/sql/compile/AlterTableNode.java",
"hunks": [
{
"added": [],
"header": "@@ -160,10 +160,6 @@ public class AlterTableNode extends DDLStatementNode",
"removed": [
"\t * @param sequential\t\tWhether or not the COMPRESS is SEQUENTIAL",
"\t * @param purge\t\t\t\tPURGE during INPLACE COMPRESS?",
"\t * @param defragment\t\tDEFRAGMENT during INPLACE COMPRESS?",
"\t * @param truncateEndOfTable\tTRUNCATE END during INPLACE COMPRESS?"
]
},
{
"added": [
"\t\t\t\t\t\t\tObject behavior )"
],
"header": "@@ -173,11 +169,7 @@ public class AlterTableNode extends DDLStatementNode",
"removed": [
"\t\t\t\t\t\t\tObject behavior,",
"\t\t\t\t\t\t\tObject sequential,",
"\t\t\t\t\t\t\tObject purge,",
"\t\t\t\t\t\t\tObject defragment,",
"\t\t\t\t\t\t\tObject truncateEndOfTable )"
]
}
]
}
] |
derby-DERBY-1062-818fd271
|
This commit is for DERBY-1062. Currently SYSCS_INPLACE_COMPRESS_TABLE is implemented on it's own in
OnlineCompress.java It will be nice for us to share the existing code for ALTER TABLE so we do all the
necessary checks that are already done in ALTER TABLE rather than repeat the code in OnlineCompress.
Another procedure similar to SYSCS_INPLACE_COMPRESS_TABLE is SYSCS_COMPRESS_TABLE and
SYSCS_COMPRESS_TABLE is written using the ALTER TABLE code. With this commit, I am getting rid of
OnlineCompress.java and moving the necessary code into ALTER TABLE related classes. One thing that
SYSCS_INPLACE_COMPRESS_TABLE allows is compressing tables in SYSTEM schemas. The compile code currently
throws an exception if the operation is being done on system schema for DDLs. I had to make changes
such that we allow SYSTEM schema handling in DDL.
This sharing of code also fixes the GRANT/REVOKE code for SYSCS_INPLACE_COMPRESS_TABLE. Earlier we didn't
look for permissions when letting a user issue SYSCS_INPLACE_COMPRESS_TABLE. But now since we use the
existing code in ALTER TABLE, it already handles the permission issues.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@655980 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/sql/compile/AlterTableNode.java",
"hunks": [
{
"added": [
"\t//The following three (purge, defragment and truncateEndOfTable) apply for ",
"\t//inplace compress",
"\tpublic\tboolean\t\t\t\tpurge = false;",
"\tpublic\tboolean\t\t\t\tdefragment = false;",
"\tpublic\tboolean\t\t\t\ttruncateEndOfTable = false;",
"\t"
],
"header": "@@ -53,6 +53,12 @@ public class AlterTableNode extends DDLStatementNode",
"removed": []
},
{
"added": [
"\t * Initializer for a AlterTableNode for COMPRESS using temporary tables",
"\t * rather than inplace compress"
],
"header": "@@ -98,7 +104,8 @@ public class AlterTableNode extends DDLStatementNode",
"removed": [
"\t * Initializer for a AlterTableNode for COMPRESS"
]
},
{
"added": [
"\t/**",
"\t * Initializer for a AlterTableNode for INPLACE COMPRESS",
"\t *",
"\t * @param objectName\t\t\tThe name of the table being altered",
"\t * @param purge\t\t\t\t\tPURGE during INPLACE COMPRESS?",
"\t * @param defragment\t\t\tDEFRAGMENT during INPLACE COMPRESS?",
"\t * @param truncateEndOfTable\tTRUNCATE END during INPLACE COMPRESS?",
"\t *",
"\t * @exception StandardException\t\tThrown on error",
"\t */",
"",
"\tpublic void init(Object objectName,",
"\t\t\t Object purge,",
"\t\t\t Object defragment,",
"\t\t\t Object truncateEndOfTable)",
"\t\tthrows StandardException",
"\t{",
"\t\tinitAndCheck(objectName);",
"",
"\t\tthis.purge = ((Boolean) purge).booleanValue();",
"\t\tthis.defragment = ((Boolean) defragment).booleanValue();",
"\t\tthis.truncateEndOfTable = ((Boolean) truncateEndOfTable).booleanValue();",
"\t\tcompressTable = true;",
"\t\tschemaDescriptor = getSchemaDescriptor(true, false);",
"\t}",
""
],
"header": "@@ -119,6 +126,32 @@ public class AlterTableNode extends DDLStatementNode",
"removed": []
},
{
"added": [
"\t * @param behavior\t\t\tIf drop column is CASCADE or RESTRICTED",
"\t * @param sequential\t\tWhether or not the COMPRESS is SEQUENTIAL",
"\t * @param purge\t\t\t\tPURGE during INPLACE COMPRESS?",
"\t * @param defragment\t\tDEFRAGMENT during INPLACE COMPRESS?",
"\t * @param truncateEndOfTable\tTRUNCATE END during INPLACE COMPRESS?"
],
"header": "@@ -126,6 +159,11 @@ public class AlterTableNode extends DDLStatementNode",
"removed": []
},
{
"added": [
"\t\t\t\t\t\t\tObject sequential,",
"\t\t\t\t\t\t\tObject purge,",
"\t\t\t\t\t\t\tObject defragment,",
"\t\t\t\t\t\t\tObject truncateEndOfTable )"
],
"header": "@@ -136,7 +174,10 @@ public class AlterTableNode extends DDLStatementNode",
"removed": [
"\t\t\t\t\t\t\tObject sequential )"
]
},
{
"added": [
"\t\tboolean[]\tbooleanPurge = (boolean[]) purge;",
"\t\tthis.purge = booleanPurge[0];",
"\t\tboolean[]\tbooleanDefragment = (boolean[]) defragment;",
"\t\tthis.defragment = booleanDefragment[0];",
"\t\tboolean[]\tbooleanTruncateEndOfTable = (boolean[]) truncateEndOfTable;",
"\t\tthis.truncateEndOfTable = booleanTruncateEndOfTable[0];"
],
"header": "@@ -148,6 +189,12 @@ public class AlterTableNode extends DDLStatementNode",
"removed": []
},
{
"added": [
"\t\t\t\t\"truncateTable: \" + \"\\n\" + truncateTable + \"\\n\" +",
"\t\t\t\t\"purge: \" + \"\\n\" + purge + \"\\n\" +",
"\t\t\t\t\"defragment: \" + \"\\n\" + defragment + \"\\n\" +",
"\t\t\t\t\"truncateEndOfTable: \" + \"\\n\" + truncateEndOfTable + \"\\n\";"
],
"header": "@@ -182,7 +229,10 @@ public class AlterTableNode extends DDLStatementNode",
"removed": [
"\t\t\t\t\"truncateTable: \" + \"\\n\" + truncateTable + \"\\n\";"
]
},
{
"added": [
"\t\tif(compressTable && (purge || defragment || truncateEndOfTable)) {",
"\t\t\t//We are dealing with inplace compress here and inplace compress is ",
"\t\t\t//allowed on system schemas. In order to support inplace compress",
"\t\t\t//on user as well as system tables, we need to use special ",
"\t\t\t//getTableDescriptor(boolean) call to get TableDescriptor. This",
"\t\t\t//getTableDescriptor(boolean) allows getting TableDescriptor for",
"\t\t\t//system tables without throwing an exception.",
"\t\t\tbaseTable = getTableDescriptor(false);",
"\t\t} else",
"\t\t\tbaseTable = getTableDescriptor();",
""
],
"header": "@@ -221,7 +271,17 @@ public class AlterTableNode extends DDLStatementNode",
"removed": [
"\t\tbaseTable = getTableDescriptor();"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/DDLStatementNode.java",
"hunks": [
{
"added": [
"\t\treturn getSchemaDescriptor(true, true);",
"\t* ",
"\t* The most common call to this method is with 2nd ",
"\t* parameter true which says that SchemaDescriptor",
"\t* should not be requested for system schema. The only",
"\t* time this method will get called with 2nd parameter",
"\t* set to false will be when user has requested for",
"\t* inplace compress using ",
"\t* SYSCS_UTIL.SYSCS_INPLACE_COMPRESS_TABLE",
"\t* Above inplace compress can be invoked on system tables.",
"\t* A call to SYSCS_UTIL.SYSCS_INPLACE_COMPRESS_TABLE ",
"\t* internally gets translated into ALTER TABLE sql.",
"\t* When ALTER TABLE is executed for SYSCS_INPLACE_COMPRESS_TABLE,",
"\t* we want to allow SchemaDescriptor request for system",
"\t* tables. DERBY-1062",
"\t* @param doSystemSchemaCheck If check for system schema is needed.",
"\t* If set to true, then throw an exception if schema descriptor",
"\t* is requested for a system schema. The only time this param ",
"\t* will be set to false is when user is asking for inplace",
"\t* compress of a system table. DERBY-1062",
"\tprotected final SchemaDescriptor getSchemaDescriptor(boolean ownerCheck,",
"\t\t\tboolean doSystemSchemaCheck)"
],
"header": "@@ -203,22 +203,42 @@ abstract class DDLStatementNode extends StatementNode",
"removed": [
"\t\treturn getSchemaDescriptor(true);",
"\tprotected final SchemaDescriptor getSchemaDescriptor(boolean ownerCheck)"
]
},
{
"added": [
"\t\t** Catch the system schema here if the caller wants us to.",
"\t\t** Currently, the only time we allow system schema is for inplace",
"\t\t** compress table calls.",
"\t\tif (doSystemSchemaCheck && sd.isSystemSchema())"
],
"header": "@@ -247,9 +267,11 @@ abstract class DDLStatementNode extends StatementNode",
"removed": [
"\t\t** Catch the system schema here.",
"\t\tif (sd.isSystemSchema())"
]
},
{
"added": [
"\t/**",
"\t * Validate that the table is ok for DDL -- e.g.",
"\t * that it exists, it is not a view. It is ok for",
"\t * it to be a system table. Also check that its ",
"\t * schema is ok. Currently, the only time this method",
"\t * is called is when user has asked for inplace ",
"\t * compress. eg",
"\t * call SYSCS_UTIL.SYSCS_INPLACE_COMPRESS_TABLE('SYS','SYSTABLES',1,1,1);",
"\t * Inplace compress is allowed on both system and",
"\t * user tables.",
"\t *",
"\t * @return the validated table descriptor, never null",
"\t *",
"\t * @exception StandardException on error",
"\t */",
"\tprotected final TableDescriptor getTableDescriptor(boolean doSystemTableCheck)",
"\tthrows StandardException",
"\t{",
"\t\tTableDescriptor td = justGetDescriptor(objectName);",
"\t\ttd = checkTableDescriptor(td,doSystemTableCheck);",
"\t\treturn td;",
"\t}",
"",
"\t\ttd = checkTableDescriptor(td,true);"
],
"header": "@@ -263,17 +285,39 @@ abstract class DDLStatementNode extends StatementNode",
"removed": [
"\t\ttd = checkTableDescriptor(td);",
""
]
},
{
"added": [
"\t{",
"\t\tTableDescriptor td = justGetDescriptor(tableName);",
"",
"\t\t/* beetle 4444, td may have changed when we obtain shared lock */",
"\t\ttd = checkTableDescriptor(td, true);",
"\t\treturn td;",
"",
"\t}",
"",
"\t/**",
"\t * Just get the table descriptor. Don't worry if it belongs to a view,",
"\t * system table, synonym or a real table. Let the caller decide what",
"\t * to do.",
"\t * ",
"\t * @param tableName",
"\t * ",
"\t * @return TableDescriptor for the give TableName",
"\t * ",
"\t * @throws StandardException on error",
"\t */",
"\tprivate TableDescriptor justGetDescriptor(TableName tableName)",
"\tthrows StandardException"
],
"header": "@@ -285,6 +329,28 @@ abstract class DDLStatementNode extends StatementNode",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/execute/AlterTableConstantAction.java",
"hunks": [
{
"added": [
"import java.sql.SQLException;"
],
"header": "@@ -21,6 +21,7 @@",
"removed": []
},
{
"added": [
"import org.apache.derby.iapi.error.PublicAPI;"
],
"header": "@@ -32,6 +33,7 @@ import org.apache.derby.catalog.IndexDescriptor;",
"removed": []
},
{
"added": [
"import org.apache.derby.iapi.sql.conn.ConnectionUtil;"
],
"header": "@@ -41,6 +43,7 @@ import org.apache.derby.iapi.sql.Activation;",
"removed": []
},
{
"added": [
"\t//The following three (purge, defragment and truncateEndOfTable) apply for ",
"\t//inplace compress",
" private\t boolean\t\t\t\t\t purge;",
" private\t boolean\t\t\t\t\t defragment;",
" private\t boolean\t\t\t\t\t truncateEndOfTable;"
],
"header": "@@ -106,8 +109,11 @@ class AlterTableConstantAction extends DDLSingleTableConstantAction",
"removed": [
"",
""
]
},
{
"added": [
"\t * @param purge\t\t\t\tPURGE during INPLACE COMPRESS?",
"\t * @param defragment\t\t\tDEFRAGMENT during INPLACE COMPRESS?",
"\t * @param truncateEndOfTable\tTRUNCATE END during INPLACE COMPRESS?"
],
"header": "@@ -161,6 +167,9 @@ class AlterTableConstantAction extends DDLSingleTableConstantAction",
"removed": []
},
{
"added": [
" boolean truncateTable,",
" boolean purge,",
" boolean defragment,",
" boolean truncateEndOfTable)"
],
"header": "@@ -174,7 +183,10 @@ class AlterTableConstantAction extends DDLSingleTableConstantAction",
"removed": [
" boolean truncateTable)"
]
},
{
"added": [
"\t\tthis.purge \t\t= purge;",
"\t\tthis.defragment \t= defragment;",
"\t\tthis.truncateEndOfTable = truncateEndOfTable;"
],
"header": "@@ -188,6 +200,9 @@ class AlterTableConstantAction extends DDLSingleTableConstantAction",
"removed": []
},
{
"added": [
" //Following if is for inplace compress. Compress using temporary",
" //tables to do the compression is done later in this method.",
"\t\tif (compressTable)",
"\t\t{",
"\t\t\tif (purge || defragment || truncateEndOfTable)",
"\t\t\t{",
"\t\t\t\ttd = dd.getTableDescriptor(tableId);",
"\t\t\t\tif (td == null)",
"\t\t\t\t{",
"\t\t\t\t\tthrow StandardException.newException(",
"\t\t\t\t\t\tSQLState.LANG_TABLE_NOT_FOUND_DURING_EXECUTION, tableName);",
"\t\t\t\t}",
"\t // Each of the following may give up locks allowing ddl on the",
"\t // table, so each phase needs to do the data dictionary lookup.",
"\t // The order is important as it makes sense to first purge",
"\t // deleted rows, then defragment existing non-deleted rows, and",
"\t // finally to truncate the end of the file which may have been",
"\t // made larger by the previous purge/defragment pass.",
"\t if (purge)",
"\t purgeRows(tc);",
"",
"\t if (defragment)",
"\t defragmentRows(tc, lcc);",
"",
"\t if (truncateEndOfTable)",
"\t truncateEnd(tc); ",
"\t return;\t\t\t\t",
"\t\t\t}",
"\t\t}",
""
],
"header": "@@ -232,6 +247,36 @@ class AlterTableConstantAction extends DDLSingleTableConstantAction",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/execute/GenericConstantActionFactory.java",
"hunks": [
{
"added": [
"\t * @param truncateTable\t Whether or not this is a truncate table",
"\t * @param purge\t\t\t\tPURGE during INPLACE COMPRESS?",
"\t * @param defragment\t\t\tDEFRAGMENT during INPLACE COMPRESS?",
"\t * @param truncateEndOfTable\tTRUNCATE END during INPLACE COMPRESS?"
],
"header": "@@ -127,6 +127,10 @@ public class GenericConstantActionFactory",
"removed": []
}
]
}
] |
derby-DERBY-1062-8fb718fa
|
Taking care of javadoc warnings caused by a checkin made for DERBY-1062
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@656323 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/sql/execute/AlterTableConstantAction.java",
"hunks": [
{
"added": [],
"header": "@@ -588,9 +588,6 @@ class AlterTableConstantAction extends DDLSingleTableConstantAction",
"removed": [
" * @param schemaName schema of table to defragment",
" * @param tableName name of table to defragment",
" * @param data_dictionary An open data dictionary to look up the table in."
]
},
{
"added": [
"\t * @param lcc\t\t\t\tthe language connection context"
],
"header": "@@ -637,10 +634,8 @@ class AlterTableConstantAction extends DDLSingleTableConstantAction",
"removed": [
" * @param schemaName schema of table to defragment",
" * @param tableName name of table to defragment",
" * @param data_dictionary An open data dictionary to look up the table in."
]
},
{
"added": [],
"header": "@@ -989,9 +984,6 @@ class AlterTableConstantAction extends DDLSingleTableConstantAction",
"removed": [
" * @param schemaName schema of table to defragment",
" * @param tableName name of table to defragment",
" * @param data_dictionary An open data dictionary to look up the table in."
]
}
]
}
] |
derby-DERBY-1062-ec55311e
|
DERBY-3674
Inplace compress test in store/TransactionTable.sql started failing after the checkin for DERBY-1062.
Prior to the fix for DERBY-1062, an inplace compress request on VTI would return with no exception
although the code just ignored the compress request on VTI. After DERBY-1062 fix, Derby started
throwing exception. With the changes going through this commit, I am restoring the behavior to no-op
on inplace compress on VTI. I am doing this by making the check for VTI in SystemProcedure and returning
from it if it is a VTI. All the other inplace compress request get fulfilled through internal
generation of ALTER TABLE sql.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@656797 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/catalog/SystemProcedures.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.store.access.TransactionController;",
"import org.apache.derby.iapi.sql.dictionary.DataDictionary;",
"import org.apache.derby.iapi.sql.dictionary.SchemaDescriptor;",
"import org.apache.derby.iapi.sql.dictionary.TableDescriptor;"
],
"header": "@@ -52,7 +52,10 @@ import org.apache.derby.impl.load.Export;",
"removed": [
""
]
},
{
"added": [
" \t//Inplace compress let's the user call compress on VTI but it",
" \t//is really a no-op. In order to avoid having to go throught",
" \t//the ALTER TABLE code just for a no-op, we simply do the check",
" \t//here and return if we are dealing with VTI.",
"\t\tLanguageConnectionContext lcc = ConnectionUtil.getCurrentLCC();",
"\t\tTransactionController tc = lcc.getTransactionExecute();",
"",
"\t\ttry ",
" {",
" DataDictionary data_dictionary = lcc.getDataDictionary();",
" SchemaDescriptor sd = ",
" data_dictionary.getSchemaDescriptor(schema, tc, true);",
" TableDescriptor td = ",
" data_dictionary.getTableDescriptor(tablename, sd, tc);",
"",
" if (td != null && td.getTableType() == TableDescriptor.VTI_TYPE)",
" {",
" return;",
" }",
" }",
"\t\tcatch (StandardException se)",
"\t\t{",
"\t\t\tthrow PublicAPI.wrapStandardException(se);",
"\t\t}",
"",
"\t\t//Send all the other inplace compress requests to ALTER TABLE",
"\t\t//machinery"
],
"header": "@@ -1053,7 +1056,33 @@ public class SystemProcedures {",
"removed": [
" "
]
}
]
}
] |
derby-DERBY-1063-50e065b7
|
DERBY-1063: Change server command in derbyrun.jar to server instead of
NetworkServerControl. Touch up the javadoc.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@395434 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/tools/org/apache/derby/iapi/tools/run.java",
"hunks": [
{
"added": [
" <p>",
" <p>",
" java -jar derbyrun.jar ij [-p propertiesfile] [sql script]<br>",
" java -jar derbyrun.jar sysinfo [-cp ...] [-cp help]<br>",
" java -jar derbyrun.jar dblook [args] (or no arguments for usage)<br>",
" java -jar derbyrun.jar server [args] (or no arguments for usage)<br>"
],
"header": "@@ -28,13 +28,14 @@ import org.apache.derby.tools.sysinfo;",
"removed": [
"",
" java -jar derbyrun.jar ij",
" java -jar derbyrun.jar sysinfo",
" java -jar derbyrun.jar dblook",
" java -jar derbyrun.jar NetworkServerControl"
]
},
{
"added": [
" } else if (args[0].equals(\"server\")) {",
" /**",
" /**"
],
"header": "@@ -51,18 +52,18 @@ public class run {",
"removed": [
" } else if (args[0].equals(\"NetworkServerControl\")) {",
" /*",
" /*"
]
}
]
}
] |
derby-DERBY-1063-83db8d61
|
DERBY-1063: Modify derbyrunjartest to call org.apache.derby.iapi.run directly
if it is not in a jar file. Hook the test into the tools suite.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@395453 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-1063-8750f312
|
DERBY-1063: Add derbyrun.jar - new jar file to execute tools with java -jar
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@384101 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/tools/org/apache/derby/iapi/tools/run.java",
"hunks": [
{
"added": [
" Derby - Class org.apache.derby.iapi.tools.run"
],
"header": "@@ -1,6 +1,6 @@",
"removed": [
" Derby - Class org.apache.derby.tools.iapi.run"
]
},
{
"added": [
"import org.apache.derby.drda.NetworkServerControl;"
],
"header": "@@ -21,6 +21,7 @@",
"removed": []
},
{
"added": [
" java -jar derbyrun.jar ij",
" java -jar derbyrun.jar sysinfo",
" java -jar derbyrun.jar dblook",
" java -jar derbyrun.jar NetworkServerControl"
],
"header": "@@ -30,9 +31,10 @@ import org.apache.derby.iapi.tools.i18n.LocalizedResource;",
"removed": [
" java -jar derbytools.jar ij",
" java -jar derbytools.jar sysinfo",
" java -jar derbytools.jar dblook"
]
}
]
}
] |
derby-DERBY-1071-3374162d
|
DERBY-1071 submitting on behalf of Sunitha Kambhampati.
Derby passes the user in a connection request as is; to the authenticateUser method. Thus if user attribute value is delimited with quotes, the userName in authenticateUser will also be delimited. Mentioned this explicitly in the javadoc.
Javadoc change only.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@382502 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/authentication/UserAuthenticator.java",
"hunks": [
{
"added": [
" * <i>Note</i>: Additional connection attributes can be specified on the ",
" * database connection URL and/or Properties object on jdbc connection. Values"
],
"header": "@@ -38,8 +38,8 @@ import java.sql.SQLException;",
"removed": [
" * <i>Note</i>: Additional connection attributes can be specified on the database",
" * connection URL and/or Properties object on jdbc connection. Values"
]
},
{
"added": [
" * <BR>",
" * E.g. if connection url is ",
" * <code>jdbc:derby:testdb;create=true;user=Fred;password=p</code>",
" * then the userName will be Fred",
" *<BR>",
" * if connection url is ",
" * <code>jdbc:derby:testdb;create=true;user=\"Fred\";password=p</code>",
" * then the userName will be \"Fred\"",
" * <BR>",
"\t * @param userName\t\tThe user's name for the connection request. May be ",
" * null. The user name is passed in as is from the ",
" * connection url. For example if user attribute ",
" * value in connection url is delimited with quotes, ",
" * then the userName passed here will also have the ",
" * delimiter quotes. Derby will pass in the user name ",
" * that is set on connection url, without changing the",
" * casing. ",
" *",
"\t * @param userPassword\tThe user's password for the connection request. ",
" * May be null.",
" *",
" *",
"\t * @param info\t\t\tA Properties object that contains additional ",
" * connection information, that can help to ",
" * authenticate the user. It has properties of the ",
" * 'info' object passed as part of ",
" * DriverManager.getConnection() call and any ",
" * attributes set on the JDBC URL.",
" *",
" * @return\tfalse if the connection request should be denied, true if the ",
" * connection request should proceed. If false is returned the ",
" * connection attempt will receive a SQLException with SQL State ",
" * 08004.",
"\t * @exception java.sql.SQLException An exception processing the request, ",
" * connection request will be denied. The SQL exception will ",
" * be returned to the connection attempt."
],
"header": "@@ -52,22 +52,46 @@ public interface UserAuthenticator",
"removed": [
"\t * @param userName\t\tThe user's name for the connection request. May be null.",
"\t * @param userPassword\tThe user's password for the connection request. May be null.",
"\t * @param info\t\t\tA Properties object that contains additional",
"\t * connection information, that can help to authenticate the user. It",
"\t * has properties of the 'info' object passed as part of",
"\t * DriverManager.getConnection() call and any",
"\t * attributes set on the JDBC URL.",
"",
"\t\t@return\tfalse if the connection request should be denied, true if the connection request should proceed.",
"\t\tIf false is returned the connection attempt will receive a SQLException with SQL State 08004.",
"\t * @exception java.sql.SQLException An exception processing the request, connection request will be denied.",
"\t\tThe SQL exception will be returned to the connection attempt."
]
}
]
}
] |
derby-DERBY-1071-a5f9148b
|
DERBY-1071 submitted on behalf of Sunitha Kambhampati
javadoc fixes from the UserAuthenticator class.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@386463 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/authentication/UserAuthenticator.java",
"hunks": [
{
"added": [
" * <code>jdbc:derby:testdb;user=Fred;password=ScT7dmM2</code>",
" * then the userName will be Fred and within the Derby user authorization ",
" * system, Fred becomes a case-insensitive authorization identifier and ",
" * is known as FRED",
" * <code>jdbc:derby:testdb;user=\"Fred\";password=ScT7dmM2</code>",
" * then the userName will be \"Fred\" and within the Derby user authorization",
" * system, Fred becomes a case-sensitive authorization identifier and is",
" * known as Fred",
" * connection request.",
" * Derby will pass in the user name that is set on",
" * connection request as is, without changing the ",
" * casing and without removing the delimiter quotes ",
" * if any."
],
"header": "@@ -54,22 +54,25 @@ public interface UserAuthenticator",
"removed": [
" * <code>jdbc:derby:testdb;create=true;user=Fred;password=p</code>",
" * then the userName will be Fred",
" * <code>jdbc:derby:testdb;create=true;user=\"Fred\";password=p</code>",
" * then the userName will be \"Fred\"",
" * connection url. For example if user attribute ",
" * value in connection url is delimited with quotes, ",
" * then the userName passed here will also have the ",
" * delimiter quotes. Derby will pass in the user name ",
" * that is set on connection url, without changing the",
" * casing. "
]
}
]
}
] |
derby-DERBY-1079-54792bee
|
DERBY-1079: Commit bug1079_clientPublicAPI, adding javadoc for client classes in our public api.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@397650 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/client/org/apache/derby/jdbc/ClientDataSource.java",
"hunks": [
{
"added": [
" * ClientDataSource is a simple data source implementation",
" * that can be used for establishing connections in a",
" * non-pooling, non-distributed environment.",
" * The class ClientConnectionPoolDataSource can be used in a connection pooling environment,",
" * and the class ClientXADataSource can be used in a distributed, and pooling",
" * environment. Use these DataSources if your application runs under",
" * JDBC3.0 or JDBC2.0, that is, on the following Java Virtual Machines:",
" * <UL>",
" * <LI> JDBC 3.0 - Java 2 - JDK 1.4, J2SE 5.0",
" * <LI> JDBC 2.0 - Java 2 - JDK 1.2,1.3",
" * </UL>",
" *",
" * <p>The example below registers a DNC data source object with a JNDI naming service."
],
"header": "@@ -30,11 +30,20 @@ import org.apache.derby.client.net.NetConnection;",
"removed": [
" * ClientDataSource is a simple data source implementation that can be used for establishing connections in a",
" * non-pooling, non-distributed environment. The class ClientConnectionPoolDataSource can be used in a connection pooling environment,",
" * and the class ClientXADataSource can be used in a distributed, and pooling environment.",
" * The example below registers a DNC data source object with a JNDI naming service."
]
}
]
},
{
"file": "java/client/org/apache/derby/jdbc/ClientXADataSource40.java",
"hunks": [
{
"added": [
" * <p>",
" * This is Derby's network XADataSource for use with JDBC4.0.",
" * </p>",
" * An XADataSource is a factory for XAConnection objects. It represents a",
" * RM in a DTP environment. An object that implements the XADataSource",
" * interface is typically registered with a JNDI service provider. \t",
" * <P>",
" * ClientXADataSource40 supports the JDBC 4.0 specification",
" * for the J2SE 6.0 Java Virtual Machine environment. Use ClientXADataSource",
" * if your application runs in the following environments:",
" * <UL>",
" * <LI> JDBC 3.0 - Java 2 - JDK 1.4, J2SE 5.0",
" * <LI> JDBC 2.0 - Java 2 - JDK 1.2,1.3",
" * </UL>",
" *",
" * <P>ClientXADataSource40 is serializable and referenceable.</p>",
" *",
" * <P>See ClientDataSource40 for DataSource properties.</p>"
],
"header": "@@ -31,7 +31,24 @@ import org.apache.derby.client.am.SqlException;",
"removed": [
" * XADataSource for jdbc4.0"
]
}
]
}
] |
derby-DERBY-1079-b33b410a
|
DERBY-1079: Expand public API javadoc for visible JDBC4 classes in the embedded client.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@394780 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/jdbc/EmbeddedXADataSource40.java",
"hunks": [
{
"added": [
"",
"\tEmbeddedXADataSource40 is Derby's XADataSource implementation for JDBC4.0.",
"\t",
"",
"\t<P>An XADataSource is a factory for XAConnection objects. It represents a",
"\tRM in a DTP environment. An object that implements the XADataSource",
"\tinterface is typically registered with a JNDI service provider. \t",
"\t<P>",
"\tEmbeddedXADataSource40 supports the JDBC 4.0 specification",
"\tfor the J2SE 6.0 Java Virtual Machine environment. Use EmbeddedXADataSource",
"\tif your application runs in the following environments:",
"\t<UL>",
"\t<LI> JDBC 3.0 - Java 2 - JDK 1.4, J2SE 5.0",
"\t<LI> JDBC 2.0 - Java 2 - JDK 1.2,1.3",
"\t</UL>",
"",
"\t<P>EmbeddedXADataSource40 object only works on a local database. There is no",
"\tclient/server support. An EmbeddedXADataSource40 object must live in the same jvm as",
"\tthe database. ",
"",
"\t<P>EmbeddedXADataSource40 is serializable and referenceable.",
"",
"\t<P>See EmbeddedDataSource40 for DataSource properties.",
""
],
"header": "@@ -30,9 +30,30 @@ import javax.sql.XAConnection;",
"removed": [
" * This class is JDBC4.0 implementation of XADataSource",
" * This class extends from EmbeddedDataSource40 so it inherits the",
" * new method introduced in ConnectionPoolDataSource from EmbeddedDataSource40"
]
}
]
}
] |
derby-DERBY-1080-25dfe8ce
|
DERBY-1080: Connection reset when using security mechanism=EUSRIDPWD results in protocol error
Patch contributed by Sunitha Kambhampati
For eusridpwd case, the client sends the encrypted userid and password
sectkns as part of SECCHK. The protocol error was happening because we
only read the 2 sectkns if the database.decryptedUserId ,
database.decryptedPassword is null, otherwise we think we have already
read this. Thus on a connection reset,if the decryptedUserId and
decryptedPassword are not reset, server assumes we have seen more SECTKN's
and thus we throw error too many codepoints.
Patch adds
-- code to reset the security mechanism related variables on a connection re-use
-- regression test to testSecMec.java
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@385857 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-1087-f4fc366c
|
DERBY-1087 Updatable result sets behave different depending on the type of query used to generate the result set. Submitted by Fernanda Pizzorno
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@406683 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/sql/execute/IndexRowToBaseRowResultSet.java",
"hunks": [
{
"added": [],
"header": "@@ -105,17 +105,6 @@ public class IndexRowToBaseRowResultSet extends NoPutResultSetImpl",
"removed": [
"\t// for scrollable insensitive updatable result sets, the rowLocation of each",
"\t// row is stored in a hash table, and used to position the scan by calling ",
"\t// the method positionScanAtRowLocation. When this method is called, the ",
"\t// baseRowLocation will be set to the value of the cached rowLocation, and",
"\t// it will not be necessary to read the row from the B-tree in order to get",
"\t// the rowLocation of the current row.",
"\t// If positionFromRowLocation is true, then baseRowLocation can be used for",
"\t// fetching the currentRow, and it is not necessary to read the rowLocation",
"\t// from the B-tree, otherwise, the rowLocation must be read from the B-tree.",
"\tprivate boolean positionFromRowLocation;",
""
]
},
{
"added": [],
"header": "@@ -223,7 +212,6 @@ public class IndexRowToBaseRowResultSet extends NoPutResultSetImpl",
"removed": [
"\t\tthis.positionFromRowLocation = false;"
]
},
{
"added": [],
"header": "@@ -614,7 +602,6 @@ public class IndexRowToBaseRowResultSet extends NoPutResultSetImpl",
"removed": [
"\t\tpositionFromRowLocation = true;"
]
}
]
}
] |
derby-DERBY-1091-3b16bbd7
|
DERBY-1091: Don't prepend a caret to jvmflags in RunSuite if the system
properties are empty, but the suite property is not. Fixes several tests
for J2ME (j9_foundation).
Committed for Myrna Van Lunteren <[email protected]>
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@427190 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/testing/org/apache/derbyTesting/functionTests/harness/RunSuite.java",
"hunks": [
{
"added": [
"\t\tif (jvmflags != null)",
"\t\t\tif (jflags != null)",
"\t\t \t\tsuiteProperties.put(\"jvmflags\", (jvmflags + \"^\" + jflags));",
"\t\t\telse",
"\t\t \t\tsuiteProperties.put(\"jvmflags\", jvmflags);",
"\t\t}",
"\t\telse",
"\t\t{",
"\t\t\tif (jflags != null)",
"\t\t \t\tsuiteProperties.put(\"jvmflags\", jflags);"
],
"header": "@@ -387,10 +387,17 @@ public class RunSuite",
"removed": [
"\t\tif (jflags != null)",
"\t\t jvmflags = jvmflags + \"^\" + jflags;",
"\t\t suiteProperties.put(\"jvmflags\", jvmflags);"
]
}
]
}
] |
derby-DERBY-1091-c92a9b38
|
DERBY-1091: Test harness does not pass jvm flags properly if there are more
than 1 property in jvm flags
Committed for Myrna Van Lunteren <[email protected]>
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@420048 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/testing/org/apache/derbyTesting/functionTests/harness/RunSuite.java",
"hunks": [
{
"added": [],
"header": "@@ -93,7 +93,6 @@ public class RunSuite",
"removed": [
"\t\t\t\t//jvmflags = \"-Xiss16k -Xss512k -Xmso16k -Xmx392388k\";"
]
},
{
"added": [
"\t\t// get System properties for jvmflags, and put them to the end, thus",
"\t\t// when the time comes to have this converted into actual jvm flags",
"\t\t// the ones given at the command line will overwrite whatever's in the suite",
"\t\t jvmflags = jvmflags + \"^\" + jflags;"
],
"header": "@@ -384,10 +383,13 @@ public class RunSuite",
"removed": [
"\t\t jvmflags = jflags;"
]
}
]
}
] |
derby-DERBY-1095-0c13195e
|
DERBY-1095 (partial) Clean up close methods on EmbedResultSet, mark the ResultSet
as closed (isClosed=true) once it discovers its Connection is closed.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@385570 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java",
"hunks": [
{
"added": [
" ",
" /**",
" * Set if this ResultSet is definitely closed.",
" * If the connection has been closed, or the database",
" * or system shutdown but the ResultSet has not been",
" * closed explictly then this may be false. Once",
" * this object detects the connection is closed",
" * isClosed will be set to true.",
" */",
" boolean isClosed;",
" "
],
"header": "@@ -102,7 +102,17 @@ public abstract class EmbedResultSet extends ConnectionChild",
"removed": [
"\tprotected boolean isClosed;"
]
},
{
"added": [
"\tprivate final void closeCurrentStream() {"
],
"header": "@@ -3966,7 +3976,7 @@ public abstract class EmbedResultSet extends ConnectionChild",
"removed": [
"\tprotected final void closeCurrentStream() {"
]
},
{
"added": [
"\tfinal void checkIfClosed(String operation) throws SQLException {",
" /**",
" * Throw an exception if this ResultSet is closed or its",
" * Connection has been closed. If the ResultSet has not",
" * been explictly closed but the Connection is closed,",
" * then this ResultSet will be marked as closed.",
" */",
"\tfinal void checkExecIfClosed(String operation) throws SQLException {",
" // Currently disconnected, i.e. a detached gobal transaction",
" if (appConn == null)",
" throw Util.noCurrentConnection();",
" ",
"\t\tif (appConn.isClosed()) {",
" closeCurrentStream();",
" isClosed = true;",
" }"
],
"header": "@@ -3995,20 +4005,33 @@ public abstract class EmbedResultSet extends ConnectionChild",
"removed": [
"\tprotected final void checkIfClosed(String operation) throws SQLException {",
"\tprotected final void checkExecIfClosed(String operation) throws SQLException {",
"\t\tif ((appConn == null) || appConn.isClosed())"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/jdbc/EmbedStatement.java",
"hunks": [
{
"added": [
"\tvoid closeActions() throws SQLException {"
],
"header": "@@ -275,7 +275,7 @@ public class EmbedStatement extends ConnectionChild",
"removed": [
"\tprotected void closeActions() throws SQLException {"
]
},
{
"added": [
"\t\tif ((appConn != applicationConnection) || (appConn == null)) {",
"",
" }"
],
"header": "@@ -939,8 +939,10 @@ public class EmbedStatement extends ConnectionChild",
"removed": [
"\t\tif ((appConn != applicationConnection) || (appConn == null))"
]
},
{
"added": [
"\t\t\t\t\tlrs.close();"
],
"header": "@@ -995,8 +997,7 @@ public class EmbedStatement extends ConnectionChild",
"removed": [
"\t\t\t\t\tif (!lrs.isClosed)",
"\t\t\t\t\t\tlrs.close();"
]
},
{
"added": [
" final void checkStatus() throws SQLException {"
],
"header": "@@ -1241,7 +1242,7 @@ public class EmbedStatement extends ConnectionChild",
"removed": [
" protected final void checkStatus() throws SQLException {"
]
},
{
"added": [
" \t"
],
"header": "@@ -1261,7 +1262,7 @@ public class EmbedStatement extends ConnectionChild",
"removed": [
"\t"
]
},
{
"added": [
"\t\t\t\t\tlrs.close();"
],
"header": "@@ -1305,8 +1306,7 @@ public class EmbedStatement extends ConnectionChild",
"removed": [
"\t\t\t\t\tif (!lrs.isClosed)",
"\t\t\t\t\t\tlrs.close();"
]
}
]
}
] |
derby-DERBY-1095-5781f54d
|
DERBY-1095 (partial): Closing an embedded connection does not seem to
close associated EmbedStatements
This patch makes EmbedResultSet.isClosed() return the correct result
when the connection is closed.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@388093 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-1095-5a50776e
|
DERBY-1095 (partial) Ensure StatementContexts and CompilerContexts are popped from
context manager on a session close.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@385569 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/sql/compile/CompilerContextImpl.java",
"hunks": [
{
"added": [
" ",
" int severity = se.getSeverity();",
"\t\t\tif (severity < ExceptionSeverity.SYSTEM_SEVERITY) "
],
"header": "@@ -113,8 +113,10 @@ public class CompilerContextImpl extends ContextImpl",
"removed": [
"\t\t\tif (se.getSeverity() < ExceptionSeverity.SYSTEM_SEVERITY) "
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java",
"hunks": [
{
"added": [
"\tprivate final StatementContext[] statementContexts = new StatementContext[2];",
"\tprivate int statementDepth;"
],
"header": "@@ -181,8 +181,8 @@ public class GenericLanguageConnectionContext",
"removed": [
"\tprotected StatementContext[] statementContexts = new StatementContext[2];",
"\tprotected int statementDepth;"
]
},
{
"added": [
" ",
" if (getContextManager().getContext(statementContext.getIdName()) != statementContext)",
" {",
" SanityManager.THROWASSERT(\"trying to pop statement context from middle of stack\");",
" }",
" statementContext.popMe();\t\t"
],
"header": "@@ -2037,9 +2037,14 @@ public class GenericLanguageConnectionContext",
"removed": [
"\t\t\tgetContextManager().getContext(org.apache.derby.iapi.reference.ContextId.LANG_STATEMENT).popMe();\t\t"
]
},
{
"added": [
" ",
" // Force the StatementContext that's normally",
" // left on the stack for optimization to be popped",
" // when the session is closed. Ensures full cleanup",
" // and no hanging refrences in the ContextManager.",
" if (severity >= ExceptionSeverity.SESSION_SEVERITY)",
" statementContexts[0].popMe();",
"\t\t\tstatementContexts[1].clearInUse(); ",
"\t\tif (severity >= ExceptionSeverity.SESSION_SEVERITY) "
],
"header": "@@ -2615,16 +2620,23 @@ public class GenericLanguageConnectionContext",
"removed": [
"\t\t\tstatementContexts[1].clearInUse();",
"\t\tif (severity == ExceptionSeverity.SESSION_SEVERITY) "
]
},
{
"added": [
" "
],
"header": "@@ -2636,11 +2648,7 @@ public class GenericLanguageConnectionContext",
"removed": [
"\t\t\tpopMe();",
"\t\t}",
"",
"\t\telse if (severity > ExceptionSeverity.SESSION_SEVERITY)",
"\t\t{"
]
}
]
}
] |
derby-DERBY-1095-7a8d0231
|
DERBY-1095 (partial) Once a ContextManager is empty no longer maintain a reference
to it in the thread local variable. Avoids a thread hanging onto memory for ever.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@388626 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/iapi/services/context/ContextService.java",
"hunks": [
{
"added": [
"\t\t\tif (--cm.activeCount == 0) {",
" ",
" // If the ContextManager is empty",
" // then don't keep a reference to it",
" // when it is not in use. The ContextManager",
" // has been closed (most likely) and this",
" // is now unwanted. Keeping the reference",
" // would hold onto memory and increase the",
" // chance of holding onto a another reference",
" // will could cause issues for future operations.",
" if (cm.isEmpty())",
" tcl.set(null);",
" ",
" }"
],
"header": "@@ -326,8 +326,21 @@ public final class ContextService //OLD extends Hashtable",
"removed": [
"\t\t\tif (--cm.activeCount == 0)"
]
}
]
}
] |
derby-DERBY-1095-8a059c40
|
DERBY-1095 Cleanup ContextManagers created during database boot.
Add some comments and synchronization to ContextService.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@387264 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/iapi/services/context/ContextService.java",
"hunks": [
{
"added": [
" /**",
" * Collection of all ContextManagers that are open",
" * in the complete Derby system. A ContextManager is",
" * added when it is created with newContextManager and",
" * removed when the session is closed.",
" * ",
" * @see #newContextManager()",
" * @see SystemContext#cleanupOnError(Throwable)",
" */",
" /**",
" * Create a new ContextService for a Derby system.",
" * Only a single system is active at any time.",
" *",
" */"
],
"header": "@@ -158,9 +158,22 @@ public final class ContextService //OLD extends Hashtable",
"removed": [
"\t// don't want any instances"
]
},
{
"added": [
" ContextService fact = ContextService.factory;",
" if (fact != null) {",
" synchronized (fact) {",
" fact.allContexts = null;",
" fact.threadContextList = null;",
" ContextService.factory = null;",
" }",
" }"
],
"header": "@@ -179,10 +192,14 @@ public final class ContextService //OLD extends Hashtable",
"removed": [
"\t\tfactory.allContexts = null;",
"\t\tfactory.threadContextList = null;",
"",
"\t\tContextService.factory = null;"
]
},
{
"added": [
" "
],
"header": "@@ -495,7 +512,7 @@ public final class ContextService //OLD extends Hashtable",
"removed": [
""
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/services/monitor/BaseMonitor.java",
"hunks": [
{
"added": [
" ",
" if (cm != previousCM)",
" cm.cleanupOnError(StandardException.closeException());",
" "
],
"header": "@@ -1836,7 +1836,10 @@ nextModule:",
"removed": [
""
]
}
]
}
] |
derby-DERBY-1095-913815a1
|
DERBY-1095 (partial) Ensure on a close connection/session contexts are popped off the
context manager. This ensures that references to database wide objects
are not maintained after a close connection.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@384900 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/iapi/services/loader/ClassFactoryContext.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.error.ExceptionSeverity;",
"",
" * Context that provides the correct ClassFactory for the",
" * current service. Allows stateless code to obtain the",
" * correct class loading scheme.",
"\tprotected ClassFactoryContext(ContextManager cm, ClassFactory cf) {",
"\tpublic final ClassFactory getClassFactory() {",
" /**",
" * Get the lock compatibility space to use for the",
" * transactional nature of the class loading lock.",
" * Used when the classpath changes or a database",
" * jar file is installed, removed or replaced.",
" */",
" /**",
" * Get the set of properties stored with this service.",
" */"
],
"header": "@@ -23,29 +23,42 @@ package org.apache.derby.iapi.services.loader;",
"removed": [
"",
"\tpublic ClassFactoryContext(ContextManager cm, ClassFactory cf) {",
"\tpublic ClassFactory getClassFactory() {"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/db/DatabaseContextImpl.java",
"hunks": [
{
"added": [
"final class DatabaseContextImpl extends ContextImpl implements DatabaseContext"
],
"header": "@@ -33,7 +33,7 @@ import org.apache.derby.iapi.error.ExceptionSeverity;",
"removed": [
"class DatabaseContextImpl extends ContextImpl implements DatabaseContext"
]
}
]
},
{
"file": "java/engine/org/apache/derby/jdbc/XATransactionState.java",
"hunks": [
{
"added": [
" ",
" if (se.getSeverity() >= ExceptionSeverity.SESSION_SEVERITY) {",
" popMe();",
" return;",
" }"
],
"header": "@@ -88,6 +88,11 @@ final class XATransactionState extends ContextImpl {",
"removed": []
}
]
}
] |
derby-DERBY-1095-b7df3e85
|
DERBY-1095 (partial) Ensure DataDictionaryContexts are popped off the stack
when the connection/session is closed. Cleanup unused code of nested DataDictionaryContexts.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@385106 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryContextImpl.java",
"hunks": [
{
"added": [],
"header": "@@ -42,11 +42,6 @@ class DataDictionaryContextImpl",
"removed": [
"\t//",
"\t// True means this is a nested data dictionary. We pop a nested data dictionary",
"\t// when we clean up an error.",
"\tprivate final boolean nested;",
""
]
},
{
"added": [
"\t\t \tif (se.getSeverity() < ExceptionSeverity.SESSION_SEVERITY)",
"\t\t\t\treturn;",
"\t\tpopMe();"
],
"header": "@@ -61,17 +56,13 @@ class DataDictionaryContextImpl",
"removed": [
"\t\tif (!nested) return;",
"\t\t \tif (se.getSeverity() >= ExceptionSeverity.STATEMENT_SEVERITY)",
"\t\t\t\tpopMe();",
"\t\t}",
"\t\telse",
"\t\t{",
"\t\t\tpopMe();"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java",
"hunks": [
{
"added": [
"\t\tpushDataDictionaryContext(cm);"
],
"header": "@@ -617,7 +617,7 @@ public final class\tDataDictionaryImpl",
"removed": [
"\t\tpushDataDictionaryContext(cm, false);"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionFactory.java",
"hunks": [
{
"added": [
"\t\tdd.pushDataDictionaryContext(cm);"
],
"header": "@@ -273,7 +273,7 @@ public class GenericLanguageConnectionFactory",
"removed": [
"\t\tdd.pushDataDictionaryContext(cm, false);"
]
}
]
}
] |
derby-DERBY-1101-c7d6c758
|
DERBY-1101 Modify EmbedResultSet.getHoldability() so that it uses getActivation() instead of getStatement().
Contributed by Knut Anders Hatlen [email protected]
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@391846 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.reference.JDBC30Translation;"
],
"header": "@@ -48,6 +48,7 @@ import org.apache.derby.iapi.services.io.NewByteArrayInputStream;",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/jdbc/EmbedResultSet40.java",
"hunks": [
{
"added": [],
"header": "@@ -60,29 +60,6 @@ public class EmbedResultSet40 extends org.apache.derby.impl.jdbc.EmbedResultSet2",
"removed": [
" /**",
" * Retrieves the holdability for this <code>ResultSet</code>",
" * object.",
" *",
" * @return either <code>ResultSet.HOLD_CURSORS_OVER_COMMIT</code>",
" * or <code>ResultSet.CLOSE_CURSORS_AT_COMMIT</code>",
" * @exception SQLException if a database error occurs",
" */",
" public final int getHoldability() throws SQLException {",
" checkIfClosed(\"getHoldability\");",
" Statement statement = getStatement();",
" if (statement == null) {",
" // If statement is null, the result set is an internal",
" // result set created by getNewRowSet() or getOldRowSet()",
" // in InternalTriggerExecutionContext. These result sets",
" // are not exposed to the JDBC applications. Returning",
" // CLOSE_CURSORS_AT_COMMIT since the result set will be",
" // closed when the trigger has finished.",
" return CLOSE_CURSORS_AT_COMMIT;",
" }",
" return statement.getResultSetHoldability();",
" }",
" "
]
}
]
}
] |
derby-DERBY-1101-d99b5c9f
|
DERBY-1101 (partial): ResultSet.getHoldability will return incorrect
value when the ResultSet is obtained from a procedure call
Adding a regression test for this issue. The test does not fail, since
the bug won't be exposed until DERBY-1111 is fixed.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@388144 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-1102-128eeb6e
|
DERBY-1102 More progress in converting triggerGeneral to Junit, testing of ordering of triggers with constraints.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@523935 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-1102-13e0e08a
|
DERBY-1102 (partial) Add more tests cases for all data types (including streaming values) in action statements.
Add tests for trigger ordering.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@509421 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-1102-648b4c12
|
DERBY-1102 (partial) Remove unused code in Triggers.java
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@385383 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/testing/org/apache/derbyTesting/functionTests/util/Triggers.java",
"hunks": [
{
"added": [],
"header": "@@ -117,14 +117,6 @@ public class Triggers",
"removed": [
"\t// used for performance numbers",
"\tpublic static void zipThroughTriggerResultSets() throws SQLException",
"\t{",
"\t\tTriggerExecutionContext tec = Factory.getTriggerExecutionContext();",
"\t\tzipThroughRs(tec.getOldRowSet());",
"\t\tzipThroughRs(tec.getNewRowSet());",
"\t}",
""
]
},
{
"added": [],
"header": "@@ -134,19 +126,6 @@ public class Triggers",
"removed": [
"\tpublic static void barfOnInsertEquals(int value) throws Throwable",
"\t{",
"\t\tTriggerExecutionContext tec = Factory.getTriggerExecutionContext();",
"\t\tResultSet rs = tec.getNewRowSet();",
"\t\twhile (rs.next())",
"\t\t{",
"\t\t\tif (rs.getInt(1) == value)",
"\t\t\t{",
"\t\t\t\tthrow new SQLException(\"barfing because of \"+value+\" in BeforeResultSet\",\"38001\");",
"\t\t\t}",
"\t\t}",
"\t}",
""
]
},
{
"added": [],
"header": "@@ -237,63 +216,6 @@ public class Triggers",
"removed": [
"\tpublic static void simpleTrigger() throws Throwable",
"\t{",
"\t\tLong ai;",
"\t\tConnection conn = DriverManager.getConnection(\"jdbc:default:connection\");",
"\t\t",
"\t\tPreparedStatement lastai = conn.prepareStatement(\"values org.apache.derby.iapi.db.ConnectionInfo::lastAutoincrementValue('APP', 'TRIGTEST', 'S1') \");",
"\t\t",
"\t\tResultSet rs = lastai.executeQuery();",
"\t\trs.next();",
"\t\tai = (Long)rs.getObject(1);",
"\t\trs.close();",
"\t\tSystem.out.println(\"autoincrement value is \" + ai);",
"\t}",
"\t/**",
"\t */",
"\tpublic static void insertIntoTab1(Integer level)",
"\t throws Throwable\t",
"\t{",
"\t\tLong entry, exit;",
"\t\tint levelValue = level.intValue();",
"\t\tlong entryValue, exitValue;",
"",
"\t\tConnection conn = DriverManager.getConnection(\"jdbc:default:connection\");",
"\t\t",
"\t\tPreparedStatement lastai = conn.prepareStatement(\"values (org.apache.derby.iapi.db.ConnectionInfo::lastAutoincrementValue('APP','TAB1','S1'))\");",
"\t\tResultSet rs = lastai.executeQuery();",
"\t\trs.next();",
"\t\tentry = (Long)rs.getObject(1);",
"\t\trs.close();",
"",
"\t\tSystem.out.println(\"coming in with level = \" + levelValue + ",
"\t\t\t\t\t\t \" and autoincrement = \" + entry.longValue());",
"\t\t",
"\t\tif (levelValue == 3)",
"\t\t\treturn;",
"",
"\t\t",
"\t\tPreparedStatement ps = ",
"\t\t\tconn.prepareStatement(\"insert into tab1 (lvl) values (?)\");",
"\t\t// insert one higher value into tab1.",
"\t\tps.setInt(1, levelValue + 1);",
"\t\tps.execute();",
"\t\t",
"\t\trs = lastai.executeQuery();",
"\t\trs.next();",
"\t\texit = (Long)rs.getObject(1);",
"\t\trs.close();",
"",
"\t\t// When we get out of this trigger, subsequent firings of the trigger by the",
"\t\t// insert statement in this routine shouldn't be returned by",
"\t\t// lastautoincrement value.",
"",
"\t\tSystem.out.println(\"going out with level = \" + levelValue + ",
"\t\t\t\t\t\t \" and autoincrement = \" + exit.longValue());",
"",
"\t}",
""
]
},
{
"added": [],
"header": "@@ -311,58 +233,6 @@ public class Triggers",
"removed": [
"\t// used to test binding",
"\tpublic static void allTypesMethodPrimitive",
"\t(",
"\t\tint \t\ti,",
"\t\tbyte\t\tby,\t",
"\t\tshort\t\ts,",
"\t\tlong\t\tl,",
"\t\tString\t\ts1,",
"\t\tString\t\ts2,",
"\t\tString\t\ts3,",
"\t\tboolean\t\tbl,",
"\t\tdouble\t\tdb,",
"\t\tfloat\t\tf1,",
"\t\tdouble\t\tdb2,",
"\t\tDate\t\tdt,",
"\t\tTime\t\tt,",
"\t\tTimestamp\tts,",
"\t\tbyte[]\t\tb1,",
"\t\tbyte[]\t\tb2,",
"\t\tbyte[]\t\tb3,",
"\t\tdouble\t\tbd1,",
"\t\tdouble\t\tbd2,",
"\t\tBigInteger\tbi",
"\t)",
"\t{",
"\t}",
"",
"\tpublic static void allTypesMethodObject",
"\t(",
"\t\tInteger\t\ti,",
"\t\tInteger\t\tby,\t",
"\t\tInteger\t\ts,",
"\t\tLong\t\tl,",
"\t\tString\t\ts1,",
"\t\tString\t\ts2,",
"\t\tString\t\ts3,",
"\t\tBoolean\t\tbl,",
"\t\tDouble\t\tdb,",
"\t\tFloat\t\tf1,",
"\t\tDouble\t\tdb2,",
"\t\tDate\t\tdt,",
"\t\tTime\t\tt,",
"\t\tTimestamp\tts,",
"\t\tbyte[]\t\tb1,",
"\t\tbyte[]\t\tb2,",
"\t\tbyte[]\t\tb3,",
"\t\tBigDecimal\tbd1,",
"\t\tBigDecimal\tbd2,",
"\t\tBigInteger\tbi",
"\t)",
"\t{",
"\t}"
]
}
]
}
] |
derby-DERBY-1102-8aa8c9b0
|
DERBY-1102 (partial) Add an initial TriggerTest. Only fixture is to ensure that all datatypes
work in an action statement.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@508442 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-1102-962234bf
|
DERBY-1102 (partial) Remove application code that printed the trigger information using
non-public apis.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@385377 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/testing/org/apache/derbyTesting/functionTests/util/Triggers.java",
"hunks": [
{
"added": [],
"header": "@@ -40,7 +40,6 @@ public class Triggers",
"removed": [
"\t\tTriggerExecutionContext tec = Factory.getTriggerExecutionContext();"
]
},
{
"added": [],
"header": "@@ -156,91 +155,6 @@ public class Triggers",
"removed": [
"\tpublic static String printTriggerInfo() throws Throwable",
"\t{",
"\t\tTriggerExecutionContext tec = Factory.getTriggerExecutionContext();",
"\t\tint eventType = tec.getEventType();",
"\t\tString eventName;",
"",
"\t\tswitch (eventType)",
"\t\t{",
"\t\t\tcase TriggerExecutionContext.UPDATE_EVENT: ",
"\t\t\t\t\teventName = \"UPDATE\";",
"\t\t\t\t\tbreak;",
"",
"\t\t\tcase TriggerExecutionContext.DELETE_EVENT: ",
"\t\t\t\t\teventName = \"DELETE\";",
"\t\t\t\t\tbreak;",
"",
"\t\t\tcase TriggerExecutionContext.INSERT_EVENT: ",
"\t\t\t\t\teventName = \"INSERT\";",
"\t\t\t\t\tbreak;",
"\t\t\tdefault:",
"\t\t\t\tthrow new Throwable(\"unexpected event type: \"+eventType);",
"\t\t}\t\t\t",
"",
"\t\tStringBuffer strbuf = new StringBuffer(\"TriggerInformation\\n------------------\\n\");",
"\t\tstrbuf.append(\"getEventStatetmentText(): \"+tec.getEventStatementText());",
"\t\tstrbuf.append(\"\\ngetEventType(): \"+eventName);",
"\t\tstrbuf.append(\"\\ngetModifiedColumns(): {\");",
"",
"\t\tString[] modifiedCols = tec.getModifiedColumns();",
"\t\tif (modifiedCols == null)",
"\t\t{",
"\t\t\tstrbuf.append(\" <all> }\");",
"\t\t}",
"\t\telse",
"\t\t{",
"\t\t\tfor (int i = 0; i < modifiedCols.length; i++)",
"\t\t\t{",
"\t\t\t\tif (i > 0)",
"\t\t\t\t\tstrbuf.append(\", \");",
"\t\t\t\tstrbuf.append(modifiedCols[i]);",
"\t\t\t}",
"\t\t\tstrbuf.append(\"}\");",
"\t\t}",
"\t\tstrbuf.append(\"\\n\");",
"\t\tstrbuf.append(getModifiedColumnsCheckInfo(tec));",
"\t\tSystem.out.println(strbuf.toString());",
"\t\tprintTriggerChanges();",
"\t\treturn \"\";",
"\t}",
"",
"\tprivate static String getModifiedColumnsCheckInfo(TriggerExecutionContext tec) throws Throwable",
"\t{",
"\t\tResultSet rs = (tec.getNewRowSet() == null) ?",
"\t\t\t\t\ttec.getOldRowSet() :",
"\t\t\t\t\ttec.getNewRowSet();",
"",
"\t\tResultSetMetaData rsmd = rs.getMetaData();",
"",
"\t\t// Get the number of columns in the result set",
"\t\tint numCols = rsmd.getColumnCount();",
"",
"\t\tStringBuffer msg = new StringBuffer(\"wasColumnModified() on each column\\n\\t\");",
"\t\tfor (int i=1; i<=numCols; i++) ",
"\t\t{",
"\t\t\tif (i > 1) ",
"\t\t\t{",
"\t\t\t\tmsg.append(\"\\n\\t\");",
"\t\t\t}",
"\t\t\tmsg.append(rsmd.getColumnLabel(i));",
"\t\t\tmsg.append(\":\\t\");",
"\t\t\tboolean wasModified = tec.wasColumnModified(rsmd.getColumnLabel(i));",
"\t\t\tif (wasModified != tec.wasColumnModified(i))",
"\t\t\t{",
"\t\t\t\tmsg.append(\"ERROR: tec.wasColumnModifed(String) = \"+wasModified);",
"\t\t\t\tmsg.append(\"and tec.wasColumnModifed(int) = \"+(!wasModified));",
"\t\t\t}",
"\t\t\telse",
"\t\t\t{",
"\t\t\t\tmsg.append(wasModified);",
"\t\t\t}",
"\t\t}",
"\t\tmsg.append(\"\\n\");",
"\t\treturn msg.toString();",
"\t}",
""
]
}
]
}
] |
derby-DERBY-1102-9a55713e
|
DERBY-1102 (partial) Remove test case of use of stale TriggerExecutionContext in triggerGeneral.sql
because applications no longer have access to the TriggerExecutionContext.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@385389 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/testing/org/apache/derbyTesting/functionTests/util/Triggers.java",
"hunks": [
{
"added": [
"\tprivate Triggers()"
],
"header": "@@ -30,11 +30,7 @@ import java.math.BigInteger;",
"removed": [
"",
"\t// used for threading test",
"\tstatic TriggerThread triggerThread;",
"",
"\tpublic Triggers()"
]
},
{
"added": [],
"header": "@@ -197,32 +193,6 @@ public class Triggers",
"removed": [
"\t// WARNING: will deadlock unless on a separate",
"\t// connection",
"\tpublic static void notifyDMLDone() throws Throwable",
"\t{",
"\t\tif (triggerThread == null)",
"\t\t{",
"\t\t\tSystem.out.println(\"ERROR: no triggerThread object, has beginInvalidRefToTECTest() been executed?\");",
"\t\t}",
"\t\telse",
"\t\t{",
"\t\t\ttriggerThread.goForIt();",
"\t\t\twhile (!triggerThread.done())",
"\t\t\t{",
"\t\t\t\ttry {Thread.sleep(1000L); } catch (InterruptedException e) {}",
"\t\t\t}",
"\t\t\ttriggerThread = null;",
"\t\t}",
"\t}",
"",
"\tpublic static String beginInvalidRefToTECTest() throws Throwable",
"\t{",
"\t\ttriggerThread = new TriggerThread();",
"\t\ttriggerThread.start();",
"\t\treturn \"\";",
"\t}",
""
]
},
{
"added": [
"}"
],
"header": "@@ -234,104 +204,4 @@ public class Triggers",
"removed": [
"}",
"",
"// class for testing valid tec accesses\t",
"class TriggerThread extends Thread",
"{\t",
"\tprivate TriggerExecutionContext tec;",
"\tprivate ResultSet rs;",
"\tprivate boolean start; ",
"\tprivate boolean done; ",
"",
"\tpublic TriggerThread() throws Throwable",
"\t{",
"\t\tthis.tec = Factory.getTriggerExecutionContext();",
"\t\tif (tec == null)",
"\t\t{",
"\t\t\tSystem.out.println(\"ERROR: no tec found, no trigger appears to be active\");",
"\t\t\treturn;",
"\t\t}",
"\t",
"\t\tthis.rs = (tec.getNewRowSet() == null) ?",
"\t\t\ttec.getOldRowSet() :",
"\t\t\ttec.getNewRowSet();",
"\t}",
"",
"\tpublic void goForIt()",
"\t{",
"\t\tstart = true;",
"\t}",
"",
"\tpublic boolean done()",
"\t{",
"\t\treturn done;",
"\t}",
"",
"\tpublic void run() ",
"\t{",
"\t\tboolean gotException = false;",
"\t",
"\t\tint i;\t",
"\t\tfor (i = 0; !start && i < 1000; i++)",
"\t\t{",
"\t\t\ttry {Thread.sleep(50L); } catch (InterruptedException e) {}",
"\t\t} ",
"\t\tif (i == 1000)",
"\t\t{",
"\t\t\tSystem.out.println(\"ERROR: start never received\");",
"\t\t\treturn;",
"\t\t}",
"\t\t// let the other thread get to its pause point",
"\t\ttry {Thread.sleep(5000L); } catch (InterruptedException e) {}",
"",
"\t\tSystem.out.println(\"...nested thread running using expired tec\");",
"\t\ttry",
"\t\t{",
"\t\t\tSystem.out.println(\"...trying to loop through stale result set\");",
"\t\t\tTriggers.zipThroughRs(rs);",
"\t\t} catch (SQLException e)",
"\t\t{",
"\t\t\tgotException = true;\t",
"\t\t\tSystem.out.println(\"Got expected exception: \"+e);",
"\t\t}",
"\t\tif (!gotException)",
"\t\t{",
"\t\t\tSystem.out.println(\"ERROR: no exception when trying to do next on stale ResultSet\");",
"\t\t}",
"\t\tgotException = false;",
"",
"\t\ttry",
"\t\t{\t",
"\t\t\ttec.getNewRowSet();",
"\t\t} catch (SQLException e)",
"\t\t{",
"\t\t\tgotException = true;\t",
"\t\t\tSystem.out.println(\"Got expected exception: \"+e);",
"\t\t}",
"",
"\t\tif (!gotException)",
"\t\t{",
"\t\t\tSystem.out.println(\"ERROR: getNewRowSet() didn't throw an exception on stale tec\");",
"\t\t}",
"",
"\t\tgotException = false;",
"",
"\t\ttry",
"\t\t{\t",
"\t\t\ttec.getOldRowSet();",
"\t\t} catch (SQLException e)",
"\t\t{",
"\t\t\tgotException = true;\t",
"\t\t\tSystem.out.println(\"Got expected exception: \"+e);",
"\t\t}",
"",
"\t\tif (!gotException)",
"\t\t{",
"\t\t\tSystem.out.println(\"ERROR: getOldRowSet() didn't throw an exception on stale tec\");",
"\t\t}",
"",
"\t\t// signal that we are done",
"\t\tdone = true;",
"\t}",
"}"
]
}
]
}
] |
derby-DERBY-1102-a7f52a6e
|
DERBY-1102 Add missing classes for TriggerTest and latest version of test with reference to DERBY-2350.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@508639 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/testing/org/apache/derbyTesting/functionTests/util/streams/StringReaderWithLength.java",
"hunks": [
{
"added": [
"package org.apache.derbyTesting.functionTests.util.streams;",
"",
"import java.io.StringReader;",
"",
"public class StringReaderWithLength extends StringReader {",
"",
" private final int length;",
" ",
" public StringReaderWithLength(String arg0) {",
" super(arg0);",
" this.length = arg0.length();",
" }",
" ",
" public boolean markSupported() {",
" return false;",
" }",
"",
" public int getLength()",
" {",
" return length;",
" }",
"}"
],
"header": "@@ -0,0 +1,22 @@",
"removed": []
}
]
}
] |
derby-DERBY-1102-dda212db
|
DERBY-1102 (partial) Remove triggerStream test, test of data types in action statement is now in TriggerTest
and covers more situations using the correct apis. Found two or three bugs with the new test.
Remove old utility code that used the old TriggerExecutionContext api.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@509423 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/testing/org/apache/derbyTesting/functionTests/util/StreamUtil.java",
"hunks": [
{
"added": [],
"header": "@@ -1,198 +0,0 @@",
"removed": [
"/*",
"",
" Derby - Class org.apache.derbyTesting.functionTests.util.StreamUtil",
"",
" 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.functionTests.util;",
"",
"import org.apache.derby.iapi.services.sanity.SanityManager;",
"import org.apache.derby.iapi.error.StandardException;",
"import org.apache.derby.iapi.db.*;",
"import java.sql.*;",
"import java.io.ByteArrayInputStream;",
"import java.io.InputStream;",
"import java.math.BigDecimal;",
"import java.math.BigInteger;",
"",
"/**",
" * Methods for stream columns",
" */",
"public class StreamUtil",
"{",
"",
"\tpublic static void insertAsciiColumn",
"\t(",
"\t\tConnection \t\tconn,\t",
"\t\tString \t\t\tstmtText, ",
"\t\tint\t\t\t\tcolNumber,",
"\t\tString \t\t\tvalue, ",
"\t\tint \t\t\tlength",
"\t)",
"\t\tthrows Throwable",
"\t{",
"\t\tPreparedStatement ps = conn.prepareStatement(stmtText);",
"\t\tsetAsciiColumn(ps, colNumber, value.charAt(0), length);",
"\t\tps.setInt(colNumber + 1, length);",
"\t\tps.execute();",
"\t}",
"\t",
"\tpublic static void insertBinaryColumn",
"\t(",
"\t\tConnection \t\tconn,",
"\t\tString \t\t\tstmtText, ",
"\t\tint\t\t\t\tcolNumber,",
"\t\tString \t\t\tvalue, ",
"\t\tint \t\t\tlength",
"\t)",
"\t\tthrows Throwable",
"\t{",
"\t\tPreparedStatement ps = conn.prepareStatement(stmtText);",
"\t\tsetBinaryColumn(ps, colNumber, value.charAt(0), length);",
"\t\tps.setInt(colNumber + 1, length);",
"\t\tps.execute();",
"\t}",
"",
"\t/**",
"\t * Set a particular column to whatever you",
"\t * wish. ",
"\t */",
"\tprivate static void setAsciiColumn",
"\t(",
"\t\tPreparedStatement \tps,",
"\t\tint\t\t\t\t\tcolNumber,",
"\t\tchar\t\t\t\tvalue,",
"\t\tint\t\t\t\t\tlength",
"\t) throws SQLException",
"\t{",
"\t\tbyte[] barray = new byte[length];",
"\t\tfor (int i = 0; i < length; i++)",
"\t\t{",
"\t\t\tbarray[i] = (byte)value;",
"\t\t}",
"\t\tps.setAsciiStream(colNumber, new ByteArrayInputStream(barray), length);",
"\t}",
"",
"\t/**",
"\t * Set a particular column to whatever you",
"\t * wish. ",
"\t */",
"\tprivate static void setBinaryColumn",
"\t(",
"\t\tPreparedStatement \tps,",
"\t\tint\t\t\t\t\tcolNumber,",
"\t\tchar\t\t\t\tvalue,",
"\t\tint\t\t\t\t\tlength",
"\t) throws SQLException",
"\t{",
"\t\tbyte[] barray = new byte[length];",
"\t\tfor (int i = 0; i < length; i++)",
"\t\t{",
"\t\t\tbarray[i] = (byte)value;",
"\t\t}",
"\t\tps.setBinaryStream(colNumber, new ByteArrayInputStream(barray), length);",
"\t}",
"\t",
"\tpublic static int getAsciiColumn",
"\t(",
"\t\tint\t\twhichRS, // 0 means old, 1 means new",
"\t\tint\t\t\t\tcolNumber,",
"\t\tString\t\t\tvalue",
"\t) throws Throwable",
"\t{",
"\t\tSystem.out.println(\"\\ngetAsciiColumn() called\");",
" ResultSet rs = getRowSet(whichRS);",
" if( rs == null)",
" return 0;",
"\t\twhile (rs.next())",
"\t\t{",
"\t\t\tInputStream in = rs.getAsciiStream(colNumber);",
"\t\t\tint readlen = drainAndValidateStream(in, value.charAt(0));",
"\t\t\tif (readlen != rs.getInt(4))",
"\t\t\t\tthrow new Exception(\"INCORRECT READ LENGTH \" + readlen + \" <> \" + rs.getInt(4));",
"\t\t}",
" return 1;",
"\t}",
"",
" private static ResultSet getRowSet( int whichRS)",
" throws Throwable",
" {",
" TriggerExecutionContext tec = org.apache.derby.iapi.db.Factory.getTriggerExecutionContext();",
" if( tec == null)",
" {",
" System.out.println( \"Not in a trigger.\");",
" return null;",
" }",
" ",
" return (whichRS == 0) ? tec.getOldRowSet() : tec.getNewRowSet();",
" }",
" ",
"\tpublic static int getBinaryColumn",
"\t(",
"\t\tint\t\twhichRS, // 0 means old, 1 means new",
"\t\tint\t\t\t\tcolNumber,",
"\t\tString\t\t\tvalue",
"\t) throws Throwable",
"\t{",
"\t\tSystem.out.println(\"\\ngetBinaryColumn() called\");",
" ResultSet rs = getRowSet(whichRS);",
" if( rs == null)",
" return 0;",
"\t\twhile (rs.next())",
"\t\t{",
"\t\t\tInputStream in = rs.getBinaryStream(colNumber);",
"\t\t\tint readlen = drainAndValidateStream(in, value.charAt(0));",
"",
"\t\t\tif (readlen != rs.getInt(4))",
"\t\t\t\tthrow new Exception(\"INCORRECT READ LENGTH \" + readlen + \" <> \" + rs.getInt(4));",
"\t\t}",
" return 1;",
"\t}",
"",
"\tprivate static int drainAndValidateStream(InputStream in, char value)",
"\t\tthrows Throwable",
"\t{",
"\t\tbyte[] buf = new byte[1024];",
"\t\tint inputLength = 0;",
"\t\twhile(true)",
"\t\t{",
"\t\t\tint size = 0;",
"\t\t\ttry",
"\t\t\t{",
"\t\t\t\tsize = in.read(buf);",
"\t\t\t} catch(Throwable t)",
"\t\t\t{",
"\t\t\t\tSystem.out.println(\"Got exception on byte \"+inputLength+\". Rethrowing...\");",
"\t\t\t\tthrow t;",
"\t\t\t}",
"\t\t\tif (size == -1)",
"\t\t\t\tbreak;",
"",
"\t\t\tfor (int i = 0; i < size; i++)\t",
"\t\t\t{",
"\t\t\t\tif (buf[i] != (byte)value)",
"\t\t\t\t{",
"\t\t\t\t\tthrow new Throwable(\"TEST ERROR: byte \"+(i+inputLength)+\" not what is expected. It is '\"+(char)buf[i]+\"' rather than '\"+value+\"'\");",
"\t\t\t\t}",
"\t\t\t}",
"\t\t\tinputLength += size;\t",
"\t\t}",
"\t\t// System.out.println(\"...read \"+inputLength+\" bytes\");",
"\t\treturn inputLength;",
"\t}",
"}"
]
}
]
}
] |
derby-DERBY-1102-f6f8e109
|
DERBY-1102 (partial) Remove old unused replication related methods in test code Triggers.java
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@385379 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/testing/org/apache/derbyTesting/functionTests/util/Triggers.java",
"hunks": [
{
"added": [],
"header": "@@ -52,27 +52,6 @@ public class Triggers",
"removed": [
"\tpublic static void triggerFiresRep(String string) throws Throwable",
"\t{\t",
"\t\tString preface = isReplicationTarget() ? ",
"\t\t\t\t\t\t\"TARGET: \" : isReplicationSource() ?",
"\t\t\t\t\t\t\t\t\"SOURCE: \" : \"<not in rep context>\" ;",
"\t\tTriggerExecutionContext tec = Factory.getTriggerExecutionContext();",
"\t\tSystem.out.println(preface + \"<\"+string+\"> on statement \"+tec.getEventStatementText());",
"\t\tprintTriggerChanges();",
"\t}",
"",
"\tpublic static boolean isReplicationTarget() throws Throwable",
"\t{",
"\t\tString repTargetProp = PropertyInfo.getDatabaseProperty(\"derby.engineType\");",
"\t\treturn (repTargetProp != null && repTargetProp.equals(\"8\"));",
"\t}",
"\tpublic static boolean isReplicationSource() throws Throwable",
"\t{",
"\t\tString repSourceProp = PropertyInfo.getDatabaseProperty(\"derby.engineType\");",
"\t\treturn (repSourceProp != null && repSourceProp.equals(\"4\"));",
"\t}",
""
]
},
{
"added": [],
"header": "@@ -138,23 +117,6 @@ public class Triggers",
"removed": [
"\tpublic static void doConnStmt(String text, boolean targetOnly) throws Throwable",
"\t{",
"\t\tif (isReplicationTarget() == targetOnly)",
"\t\t{",
"\t\t\tSystem.out.println(\"Trigger Executing: \"+text);",
"\t\t\tdoConnStmt(text);",
"\t\t}",
"\t}",
"",
"\tpublic static void workUnitFires() throws Throwable",
"\t{",
"\t\tSystem.out.println((isReplicationTarget() ? ",
"\t\t\t\t\t\t\"TARGET: workUnitFires\" : isReplicationSource() ?",
"\t\t\t\t\t\t\t\t\"SOURCE: workUnitFires\" : ",
"\t\t\t\t\t\t\t\t\"<error, not in rep context?!?>\"));",
"\t}",
""
]
},
{
"added": [],
"header": "@@ -332,18 +294,6 @@ public class Triggers",
"removed": [
"",
"\tpublic static void aiWorkUnit(String s)",
"\t \t throws Throwable\t",
"\t{",
"\t\tConnection conn = DriverManager.getConnection(\"jdbc:default:connection\");",
"\t\tString query = \"insert into watab (s) values (?)\";",
"\t\tPreparedStatement ps = conn.prepareStatement(query);",
"\t\tSystem.out.println(\"in work unit with s=\" + s);",
"\t\tps.setString(1, s);",
"\t\tps.execute();",
"\t}",
""
]
}
]
}
] |
derby-DERBY-1107-3f523e62
|
DERBY-1107 For existing databases JDBC metadata queries do not get updated properly between maintenance versions.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@712695 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/sql/catalog/DD_Version.java",
"hunks": [
{
"added": [
"\t\tbootingDictionary.updateMetadataSPSes(tc);"
],
"header": "@@ -340,8 +340,7 @@ public\tclass DD_Version implements\tFormatable",
"removed": [
"\t\tdropJDBCMetadataSPSes(tc, false);",
"\t\tbootingDictionary.createSystemSps(tc);"
]
},
{
"added": [
"\t\t\t// Once a database is version 10.5 we will start updating metadata SPSes",
"\t\t\t// on any version change,up or down. This will ensure that metadata queries ",
"\t\t\t// match the version we are using. We don't want to do this for lower ",
"\t\t\t// database versions because on reverting to the previous version the ",
"\t\t\t// SPSes won't be restored.",
"\t\t\tif (fromVersion.majorVersionNumber >= DataDictionary.DD_VERSION_DERBY_10_5)",
"\t\t\t\tbootingDictionary.updateMetadataSPSes(tc);",
"\t\t\telse",
"\t\t\t\tbootingDictionary.clearSPSPlans();"
],
"header": "@@ -450,7 +449,15 @@ public\tclass DD_Version implements\tFormatable",
"removed": [
"\t\t\tbootingDictionary.clearSPSPlans();"
]
}
]
},
{
"file": "java/storeless/org/apache/derby/impl/storeless/EmptyDictionary.java",
"hunks": [
{
"added": [
"",
"\tpublic void updateMetadataSPSes(TransactionController tc) throws StandardException {",
"\t\t// TODO Auto-generated method stub\t\t",
"\t}"
],
"header": "@@ -814,4 +814,8 @@ public class EmptyDictionary implements DataDictionary, ModuleSupportable {",
"removed": []
}
]
}
] |
derby-DERBY-1108-4ba425d2
|
DERBY-1108 (partial) More datatypes testing in TriggersTest
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@508593 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-1111-d99b5c9f
|
DERBY-1101 (partial): ResultSet.getHoldability will return incorrect
value when the ResultSet is obtained from a procedure call
Adding a regression test for this issue. The test does not fail, since
the bug won't be exposed until DERBY-1111 is fixed.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@388144 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
End of preview. Expand
in Data Studio
README.md exists but content is empty.
- Downloads last month
- 16