id
stringlengths
22
25
commit_message
stringlengths
137
6.96k
diffs
listlengths
0
63
derby-DERBY-2653-b52081a4
DERBY-2653 Expose existing auto-generated key functionality through more JDBC APIs in Derby Client. Add client support for columnIndex API's: Connection.prepareStatement(String sql, int[] columnIndexes); Statement.execute(String sql, int[] columIndexes); Statement.executeUpdate(String sql, int[] columnIndexes); git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@629566 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/client/org/apache/derby/client/am/CallableStatement.java", "hunks": [ { "added": [ " super(agent, connection, sql, type, concurrency, holdability, java.sql.Statement.NO_GENERATED_KEYS, ", " null, null,cpc);" ], "header": "@@ -88,7 +88,8 @@ public class CallableStatement extends PreparedStatement", "removed": [ " super(agent, connection, sql, type, concurrency, holdability, java.sql.Statement.NO_GENERATED_KEYS, null,cpc);" ] } ] }, { "file": "java/client/org/apache/derby/client/am/ClientJDBCObjectFactory.java", "hunks": [ { "added": [ " * @param columnIndexes an array of column indexes indicating the columns", " * that should be returned form the inserted row. " ], "header": "@@ -145,6 +145,8 @@ public interface ClientJDBCObjectFactory {", "removed": [] }, { "added": [ " String [] columnNames, int[] columnIndexes, ClientPooledConnection cpc) " ], "header": "@@ -156,7 +158,7 @@ public interface ClientJDBCObjectFactory {", "removed": [ " String [] columnNames,ClientPooledConnection cpc) " ] }, { "added": [ " * @param columnIndexes int[]" ], "header": "@@ -284,6 +286,7 @@ public interface ClientJDBCObjectFactory {", "removed": [] } ] }, { "file": "java/client/org/apache/derby/client/am/Connection.java", "hunks": [ { "added": [ " null, null);" ], "header": "@@ -411,7 +411,7 @@ public abstract class Connection implements java.sql.Connection,", "removed": [ " null);" ] }, { "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,", " null);" ], "header": "@@ -460,7 +460,8 @@ 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, holdability(), java.sql.Statement.NO_GENERATED_KEYS, null);" ] }, { "added": [ " null, null);" ], "header": "@@ -1207,7 +1208,7 @@ public abstract class Connection implements java.sql.Connection,", "removed": [ " null);" ] }, { "added": [ " null, null);" ], "header": "@@ -1614,7 +1615,7 @@ public abstract class Connection implements java.sql.Connection,", "removed": [ " null);" ] }, { "added": [ " String[] columnNames,", " int[] columnIndexes) throws SqlException {", " PreparedStatement ps = newPreparedStatement_(sql, resultSetType, resultSetConcurrency, resultSetHoldability, autoGeneratedKeys, columnNames,", " columnIndexes);" ], "header": "@@ -1632,10 +1633,12 @@ public abstract class Connection implements java.sql.Connection,", "removed": [ " String[] columnNames) throws SqlException {", " PreparedStatement ps = newPreparedStatement_(sql, resultSetType, resultSetConcurrency, resultSetHoldability, autoGeneratedKeys, columnNames);" ] }, { "added": [ " resetPreparedStatement_(ps, ps.sql_, ps.resultSetType_, ps.resultSetConcurrency_, ps.resultSetHoldability_, ps.autoGeneratedKeys_, ps.generatedKeysColumnNames_,", " ps.generatedKeysColumnIndexes_);" ], "header": "@@ -1647,7 +1650,8 @@ public abstract class Connection implements java.sql.Connection,", "removed": [ " resetPreparedStatement_(ps, ps.sql_, ps.resultSetType_, ps.resultSetConcurrency_, ps.resultSetHoldability_, ps.autoGeneratedKeys_, ps.generatedKeysColumnNames_);" ] }, { "added": [ " null, null);" ], "header": "@@ -1704,7 +1708,7 @@ public abstract class Connection implements java.sql.Connection,", "removed": [ " null);" ] }, { "added": [ " int genKeys = (columnIndexes == null ||", " columnIndexes.length == 0", " ? Statement.NO_GENERATED_KEYS: ", " Statement.RETURN_GENERATED_KEYS);", " PreparedStatement ps = prepareStatementX(sql,", " java.sql.ResultSet.TYPE_FORWARD_ONLY,", " java.sql.ResultSet.CONCUR_READ_ONLY,", " holdability(),", " genKeys,", " null, columnIndexes);", " if (agent_.loggingEnabled()) {", " agent_.logWriter_.traceExit(this, \"prepareStatement\", ps);", " } ", " return ps;" ], "header": "@@ -1722,10 +1726,20 @@ public abstract class Connection implements java.sql.Connection,", "removed": [ " checkForClosedConnection();", " throw new SqlException(agent_.logWriter_, ", " new ClientMessageId (SQLState.NOT_IMPLEMENTED),", " \"prepareStatement(String, int[])\");" ] }, { "added": [ " columnNames, null);" ], "header": "@@ -1748,7 +1762,7 @@ public abstract class Connection implements java.sql.Connection,", "removed": [ " columnNames);" ] }, { "added": [ " String[] columnNames, int[] columnIndexes) throws SqlException;" ], "header": "@@ -1794,7 +1808,7 @@ public abstract class Connection implements java.sql.Connection,", "removed": [ " String[] columnNames) throws SqlException;" ] } ] }, { "file": "java/client/org/apache/derby/client/am/PreparedStatement.java", "hunks": [ { "added": [ " * @param columnIndexes an array of column names indicating the columns that", " * should be returned from the inserted row. " ], "header": "@@ -195,6 +195,8 @@ public class PreparedStatement extends Statement", "removed": [] }, { "added": [ " int[] columnIndexes,", " autoGeneratedKeys, columnNames, columnIndexes);" ], "header": "@@ -207,10 +209,11 @@ public class PreparedStatement extends Statement", "removed": [ " autoGeneratedKeys, columnNames);" ] } ] }, { "file": "java/client/org/apache/derby/client/am/PreparedStatement40.java", "hunks": [ { "added": [ " * @param columnIndexes an array of column indexes indicating the columns", " * that should be returned from the inserted row. " ], "header": "@@ -82,6 +82,8 @@ public class PreparedStatement40 extends org.apache.derby.client.am.PreparedSt", "removed": [] } ] }, { "file": "java/client/org/apache/derby/client/am/Statement.java", "hunks": [ { "added": [ " public int[] generatedKeysColumnIndexes_;", " " ], "header": "@@ -183,6 +183,8 @@ public class Statement implements java.sql.Statement, StatementCallbackInterface", "removed": [] }, { "added": [ " generatedKeysColumnIndexes_ = null;" ], "header": "@@ -266,6 +268,7 @@ public class Statement implements java.sql.Statement, StatementCallbackInterface", "removed": [] }, { "added": [ " int autoGeneratedKeys, String[] columnNames, int[] columnIndexes) throws SqlException {", " initStatement(type, concurrency, holdability, autoGeneratedKeys, columnNames,", " columnIndexes);", " int autoGeneratedKeys, String[] columnNames, int[] columnIndexes) throws SqlException {", " initStatement(type, concurrency, holdability, autoGeneratedKeys, columnNames, columnIndexes);", " int autoGeneratedKeys, String[] columnNames,", " int[] columnIndexes) throws SqlException {" ], "header": "@@ -306,19 +309,21 @@ public class Statement implements java.sql.Statement, StatementCallbackInterface", "removed": [ " int autoGeneratedKeys, String[] columnNames) throws SqlException {", " initStatement(type, concurrency, holdability, autoGeneratedKeys, columnNames);", " int autoGeneratedKeys, String[] columnNames) throws SqlException {", " initStatement(type, concurrency, holdability, autoGeneratedKeys, columnNames);", " int autoGeneratedKeys, String[] columnNames) throws SqlException {" ] }, { "added": [ " generatedKeysColumnIndexes_ = columnIndexes;" ], "header": "@@ -368,6 +373,7 @@ public class Statement implements java.sql.Statement, StatementCallbackInterface", "removed": [] }, { "added": [ " synchronized (connection_) { ", " if (agent_.loggingEnabled()) {", " agent_.logWriter_.traceEntry(this, \"executeUpdate\", sql, columnIndexes);", " }", " if (columnIndexes != null && columnIndexes.length > 0)", " autoGeneratedKeys_ = Statement.RETURN_GENERATED_KEYS;", " generatedKeysColumnIndexes_ = columnIndexes;", " int updateValue = executeUpdateX(sql);", " if (agent_.loggingEnabled()) {", " agent_.logWriter_.traceExit(this, \"executeUpdate\", updateValue);", " }", " return updateValue;" ], "header": "@@ -1190,13 +1196,19 @@ public class Statement implements java.sql.Statement, StatementCallbackInterface", "removed": [ " if (agent_.loggingEnabled()) {", " agent_.logWriter_.traceEntry(this, \"executeUpdate\", sql, columnIndexes);", " checkForClosedStatement();", " throw new SqlException(agent_.logWriter_, ", " new ClientMessageId(SQLState.NOT_IMPLEMENTED),", " \"executeUpdate(String, int[])\");" ] }, { "added": [ " synchronized(connection_) {", " if (agent_.loggingEnabled()) {", " agent_.logWriter_.traceEntry(this, \"execute\", sql, columnIndexes);", " } ", " if (columnIndexes != null && columnIndexes.length > 0)", " autoGeneratedKeys_ = Statement.RETURN_GENERATED_KEYS;", " generatedKeysColumnIndexes_ = columnIndexes;", " boolean b = executeX(sql);", " if (agent_.loggingEnabled()) {", " agent_.logWriter_.traceExit(this, \"execute\", b);", " }", " return b;" ], "header": "@@ -1251,13 +1263,19 @@ public class Statement implements java.sql.Statement, StatementCallbackInterface", "removed": [ " if (agent_.loggingEnabled()) {", " agent_.logWriter_.traceEntry(this, \"execute\", sql, columnIndexes);", " checkForClosedStatement();", " throw new SqlException(agent_.logWriter_, ", " new ClientMessageId(SQLState.NOT_IMPLEMENTED),", " \"execute(String, int[])\");" ] }, { "added": [ " null, null);" ], "header": "@@ -2656,7 +2674,7 @@ public class Statement implements java.sql.Statement, StatementCallbackInterface", "removed": [ " null);" ] } ] }, { "file": "java/client/org/apache/derby/client/net/ClientJDBCObjectFactoryImpl.java", "hunks": [ { "added": [ " int[] columnIndexes,", " holdability,autoGeneratedKeys,columnNames, columnIndexes, cpc);" ], "header": "@@ -175,10 +175,11 @@ public class ClientJDBCObjectFactoryImpl implements ClientJDBCObjectFactory{", "removed": [ " holdability,autoGeneratedKeys,columnNames,cpc);" ] }, { "added": [ " * @param columnIndexes int[]" ], "header": "@@ -311,6 +312,7 @@ public class ClientJDBCObjectFactoryImpl implements ClientJDBCObjectFactory{", "removed": [] } ] }, { "file": "java/client/org/apache/derby/client/net/ClientJDBCObjectFactoryImpl40.java", "hunks": [ { "added": [ " * @param columnIndexes an array of column indexes indicating the columns", " * that should be returned from the inserted row. " ], "header": "@@ -158,6 +158,8 @@ public class ClientJDBCObjectFactoryImpl40 implements ClientJDBCObjectFactory{", "removed": [] }, { "added": [ " String [] columnNames,", " int[] columnIndexes, ClientPooledConnection cpc) ", " holdability,autoGeneratedKeys,columnNames,columnIndexes, cpc);" ], "header": "@@ -171,10 +173,11 @@ public class ClientJDBCObjectFactoryImpl40 implements ClientJDBCObjectFactory{", "removed": [ " String [] columnNames,ClientPooledConnection cpc) ", " holdability,autoGeneratedKeys,columnNames,cpc);" ] }, { "added": [ " * @param columnIndexes int[]" ], "header": "@@ -308,6 +311,7 @@ public class ClientJDBCObjectFactoryImpl40 implements ClientJDBCObjectFactory{", "removed": [] } ] }, { "file": "java/client/org/apache/derby/client/net/NetConnection.java", "hunks": [ { "added": [ " protected PreparedStatement newPreparedStatement_(String sql, int type, int concurrency, int holdability, int autoGeneratedKeys, String[] columnNames,", " int[] columnIndexes) throws SqlException {", " return new NetPreparedStatement(netAgent_, this, sql, type, concurrency, holdability, autoGeneratedKeys, columnNames,", " columnIndexes, pooledConnection_).preparedStatement_;" ], "header": "@@ -1074,11 +1074,13 @@ public class NetConnection extends org.apache.derby.client.am.Connection {", "removed": [ " protected PreparedStatement newPreparedStatement_(String sql, int type, int concurrency, int holdability, int autoGeneratedKeys, String[] columnNames) throws SqlException {", " return new NetPreparedStatement(netAgent_, this, sql, type, concurrency, holdability, autoGeneratedKeys, columnNames,pooledConnection_).preparedStatement_;" ] } ] }, { "file": "java/client/org/apache/derby/client/net/NetPreparedStatement.java", "hunks": [ { "added": [ " * @param columnIndexes An int array of column indexes indicating", " * the column that should be returned from ", " * the inserted row. " ], "header": "@@ -80,6 +80,9 @@ public class NetPreparedStatement extends NetStatement", "removed": [] } ] } ]
derby-DERBY-2661-4119c42d
DERBY-2661 (partial) Remove some unused and trivial methods from ExecutionContext and GenericExecutionContext. Knock onto effect to other methods which no longer need to pass in an execution context. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@539007 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/execute/GenericExecutionContext.java", "hunks": [ { "added": [], "header": "@@ -52,8 +52,6 @@ class GenericExecutionContext", "removed": [ "\tprivate ResultSet sourceRS;", "" ] }, { "added": [], "header": "@@ -108,47 +106,6 @@ class GenericExecutionContext", "removed": [ "\t/**", "\t * @see ExecutionContext#beginStatement", "\t * @exception StandardException Thrown on error", "\t */", "\tpublic void beginStatement(ResultSet sourceRS) throws StandardException {", "\t\tthis.sourceRS = sourceRS;", "\t}", "", "\t/**", "\t * @see ExecutionContext#endStatement", "\t * @exception StandardException Thrown on error", "\t */", "\tpublic void endStatement() throws StandardException {", "\t\tsourceRS = null;", "\t}", "", "\t/**", "\t * @see ExecutionContext#siftForeignKeys", "\t * @exception StandardException Thrown on error", "\t */", "\tpublic\tObject[]\tsiftForeignKeys( Object[] fullList ) throws StandardException", "\t{", "\t\t// for the Core Language, this routine is a NOP. The interesting", "\t\t// cases occur during REFRESH and the initial boot of a Target", "\t\t// database. See RepExecutionContext for the interesting cases.", "", "\t\treturn\tfullList;", "\t}", "", "\t/**", "\t * @see ExecutionContext#siftTriggers", "\t * @exception StandardException Thrown on error", "\t */", "\tpublic Object siftTriggers(Object triggerInfo) throws StandardException", "\t{", "\t\t// for the Core Language, this routine is a NOP. The interesting", "\t\t// cases occur during REFRESH and the initial boot of a Target", "\t\t// database. See RepExecutionContext for the interesting cases.", "\t\treturn\ttriggerInfo;", "\t}", "" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/WriteCursorConstantAction.java", "hunks": [ { "added": [ "\t *\taction.", "\tfinal FKInfo[] getFKInfo()", "\t\treturn fkInfo;" ], "header": "@@ -174,29 +174,16 @@ abstract\tclass WriteCursorConstantAction implements ConstantAction, Formatable", "removed": [ "\t *\taction. However, we prune this list at run time so that we", "\t *\tenforce only the foreign keys that we absolutely must.", "\t *", "\t *\tWhat's going on here? Well, in certain contexts (REFRESH and", "\t *\twhen intially booting a Target), we don't have to enforce some", "\t *\tforeign keys. We allow the ExecutionContext to rule on which", "\t *\tforeign keys are relevant and which aren't.", "\t * @exception StandardException\t\tThrown on failure", "\tpublic\tFKInfo[]\tgetFKInfo", "\t(", "\t\tExecutionContext\tec", " )", "\t\tthrows StandardException", "\t\tFKInfo[]\tsiftedArray = (FKInfo[]) ec.siftForeignKeys( fkInfo );", "", "\t\treturn siftedArray;" ] }, { "added": [ "\tTriggerInfo getTriggerInfo()", "\t\treturn triggerInfo;" ], "header": "@@ -204,12 +191,10 @@ abstract\tclass WriteCursorConstantAction implements ConstantAction, Formatable", "removed": [ "\t * @exception StandardException\t\tThrown on failure", "\tpublic TriggerInfo getTriggerInfo(ExecutionContext ec) ", "\t\tthrows StandardException", "\t\treturn (TriggerInfo)ec.siftTriggers(triggerInfo);" ] } ] } ]
derby-DERBY-2661-48d26291
Minor code cleanup, removing some unused methods/fields. Making activation private final in some classes. Related to DERBY-2661 git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@565966 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/sql/dictionary/IndexRowGenerator.java", "hunks": [ { "added": [ "import java.io.IOException;", "import java.io.ObjectInput;", "import java.io.ObjectOutput;", "import org.apache.derby.catalog.IndexDescriptor;", "import org.apache.derby.catalog.types.IndexDescriptorImpl;", "import org.apache.derby.iapi.error.StandardException;", "import org.apache.derby.iapi.services.context.ContextService;", "import org.apache.derby.iapi.services.io.Formatable;", "import org.apache.derby.iapi.services.io.FormatableBitSet;", "import org.apache.derby.iapi.services.io.StoredFormatIds;", "import org.apache.derby.iapi.services.sanity.SanityManager;", "import org.apache.derby.iapi.sql.execute.ExecutionContext;", "\tprivate IndexDescriptor\tid;" ], "header": "@@ -21,44 +21,32 @@", "removed": [ "import org.apache.derby.iapi.sql.dictionary.ColumnDescriptorList;", "", "import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;", "import org.apache.derby.iapi.sql.execute.ExecutionContext;", "", "import org.apache.derby.iapi.types.DataTypeDescriptor;", "import org.apache.derby.iapi.services.io.Formatable;", "import org.apache.derby.iapi.services.io.FormatIdUtil;", "import org.apache.derby.iapi.services.io.StoredFormatIds;", "", "import org.apache.derby.iapi.services.sanity.SanityManager;", "", "import org.apache.derby.iapi.services.context.ContextService;", "", "import org.apache.derby.iapi.error.StandardException;", "", "import org.apache.derby.catalog.IndexDescriptor;", "import org.apache.derby.catalog.types.IndexDescriptorImpl;", "", "import java.io.ObjectInput;", "import java.io.ObjectOutput;", "import java.io.IOException;", "import org.apache.derby.iapi.services.io.FormatableBitSet;", "", "\tIndexDescriptor\tid;" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/IndexChanger.java", "hunks": [ { "added": [], "header": "@@ -68,8 +68,6 @@ public class IndexChanger", "removed": [ "\tprivate LanguageConnectionContext lcc;", "" ] }, { "added": [ "\tprivate final Activation\t\t\t\tactivation;" ], "header": "@@ -78,7 +76,7 @@ public class IndexChanger", "removed": [ "\tprivate Activation\t\t\t\tactivation;" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/TemporaryRowHolderResultSet.java", "hunks": [ { "added": [], "header": "@@ -32,7 +32,6 @@ import org.apache.derby.iapi.sql.ResultSet;", "removed": [ "import org.apache.derby.iapi.sql.execute.ExecutionFactory;" ] }, { "added": [], "header": "@@ -59,7 +58,6 @@ class TemporaryRowHolderResultSet implements CursorResultSet, NoPutResultSet, Cl", "removed": [ "\tprivate ExecutionFactory\t\tef;" ] } ] } ]
derby-DERBY-2661-53ce71e9
DERBY-2661 (partial) Move getting of the run time statistics factory from the ExecutionContext to the ExecutionFactory. Remove the LanguageConnectionContext.getExecutionContext() method as it is no longer used. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@609053 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/sql/execute/ExecutionContext.java", "hunks": [ { "added": [], "header": "@@ -23,10 +23,6 @@ package org.apache.derby.iapi.sql.execute;", "removed": [ "import org.apache.derby.iapi.error.StandardException;", "", "import org.apache.derby.iapi.sql.ResultSet;", "" ] }, { "added": [ " /**", " * Map from Derby transaction isolation constants to", " * JDBC constants.", " */" ], "header": "@@ -49,6 +45,10 @@ public interface ExecutionContext extends Context {", "removed": [] }, { "added": [ " /**", " * Map from Derby transaction isolation constants to", " * text values used in SQL. Note that the text", " * \"REPEATABLE READ\" or \"RR\" maps to SERIALIZABLE_ISOLATION_LEVEL", " * as a hang over from DB2 compatibility and now to preserve", " * backwards compatability.", " */" ], "header": "@@ -57,6 +57,13 @@ public interface ExecutionContext extends Context {", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/GenericExecutionContext.java", "hunks": [ { "added": [], "header": "@@ -21,16 +21,12 @@", "removed": [ "import java.util.Properties;", "", "import org.apache.derby.iapi.services.monitor.Monitor;", "import org.apache.derby.iapi.sql.execute.ResultSetStatisticsFactory;" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/GenericExecutionFactory.java", "hunks": [ { "added": [ " ", " /**", " * Statistics factory for this factory.", " */", " private ResultSetStatisticsFactory rssFactory;" ], "header": "@@ -75,6 +75,11 @@ import java.util.Vector;", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/NoRowsResultSetImpl.java", "hunks": [ { "added": [], "header": "@@ -40,7 +40,6 @@ import org.apache.derby.iapi.sql.dictionary.ConglomerateDescriptor;", "removed": [ "import org.apache.derby.iapi.sql.execute.ExecutionContext;" ] }, { "added": [ "\t\t\t\tResultSetStatisticsFactory rssf =", " lcc.getLanguageConnectionFactory().", " getExecutionFactory().getResultSetStatisticsFactory();" ], "header": "@@ -348,9 +347,9 @@ abstract class NoRowsResultSetImpl implements ResultSet", "removed": [ "\t\t\t\tExecutionContext ec = lcc.getExecutionContext();", "\t\t\t\tResultSetStatisticsFactory rssf;", "\t\t\t\trssf = ec.getResultSetStatisticsFactory();" ] } ] } ]
derby-DERBY-2661-6c000e85
DERBY-2661 (partial) Change some callers of the ExecutionContext to get the ExecutionFactory directly using the language connection context. Remove the getResultSetFactory from ExecutionContext. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@539254 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/db/ConsistencyChecker.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.sql.execute.ExecutionFactory;" ], "header": "@@ -34,7 +34,7 @@ import org.apache.derby.iapi.sql.dictionary.ConstraintDescriptorList;", "removed": [ "import org.apache.derby.iapi.sql.execute.ExecutionContext;" ] }, { "added": [], "header": "@@ -128,7 +128,6 @@ public class ConsistencyChecker", "removed": [ "\t\tExecutionContext\t\tec;" ] }, { "added": [ " ", " ExecutionFactory ef = lcc.getLanguageConnectionFactory().getExecutionFactory();" ], "header": "@@ -140,8 +139,8 @@ public class ConsistencyChecker", "removed": [ "", " ec = lcc.getExecutionContext() ;" ] }, { "added": [ "\t\t\tbaseRow = ef.getValueRow(td.getNumberOfColumns());" ], "header": "@@ -171,7 +170,7 @@ public class ConsistencyChecker", "removed": [ "\t\t\tbaseRow = ec.getExecutionFactory().getValueRow(td.getNumberOfColumns());" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java", "hunks": [ { "added": [], "header": "@@ -1522,15 +1522,7 @@ public class ResultColumnList extends QueryTreeNodeVector", "removed": [ "", "\t{", "\t\tExecutionContext ec = (ExecutionContext) getContextManager().getContext(", "\t\t\tExecutionContext.CONTEXT_ID);", "\t\treturn makeResultDescriptors(ec);", "\t}", "", "\tResultColumnDescriptor[] makeResultDescriptors(ExecutionContext ec)" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/ResultSetNode.java", "hunks": [ { "added": [ "\tResultColumnDescriptor[] makeResultDescriptors()", "\t return resultColumns.makeResultDescriptors();" ], "header": "@@ -910,9 +910,9 @@ public abstract class ResultSetNode extends QueryTreeNode", "removed": [ "\tResultColumnDescriptor[] makeResultDescriptors(ExecutionContext ec)", "\t return resultColumns.makeResultDescriptors(ec);" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/BaseActivation.java", "hunks": [ { "added": [ "\tprivate\tLanguageConnectionContext\tlcc;" ], "header": "@@ -79,14 +79,8 @@ import org.apache.derby.iapi.util.ReuseFactory;", "removed": [ "", "\tprotected ResultSetFactory rsFactory;", "\tprotected ExecutionFactory exFactory;", "\tprotected\tDataValueFactory\t\t\tdvFactory;", "\tprotected\tLanguageConnectionContext\tlcc;", "\tprotected /*private*/ ExecutionContext\t\t\tec;", "" ] }, { "added": [], "header": "@@ -183,29 +177,6 @@ public abstract class BaseActivation implements CursorActivation, GeneratedByteC", "removed": [ "\t\tdvFactory = lcc.getDataValueFactory();", "\t\tif (SanityManager.DEBUG)", "\t\t{", "\t\t\tSanityManager.ASSERT(dvFactory != null,", "\t\t\t\t\t\t\t\t \"No data value factory in getDataValueFactory\");", "\t\t}", "", "\t\tec = lcc.getExecutionContext();", "", "\t\t// look for the execution context and", "\t\t// get our result set factory from it.", "\t\trsFactory = ec.getResultSetFactory();", "\t\tif (SanityManager.DEBUG)", "\t\t{", "\t\t\tSanityManager.ASSERT(rsFactory!=null, \"Unable to find ResultSetFactory\");", "\t\t}", "", "\t\texFactory = ec.getExecutionFactory();", "\t\tif (SanityManager.DEBUG)", "\t\t{", "\t\t\tSanityManager.ASSERT(exFactory!=null, \"Unable to find ExecutionFactory\");", "\t\t}\t\t", "" ] }, { "added": [ "\tpublic final ResultSetFactory getResultSetFactory() {", "\t\treturn getExecutionFactory().getResultSetFactory();", "\tpublic final ExecutionFactory getExecutionFactory() {", "\t\treturn getLanguageConnectionContext().", " getLanguageConnectionFactory().getExecutionFactory();" ], "header": "@@ -595,15 +566,16 @@ public abstract class BaseActivation implements CursorActivation, GeneratedByteC", "removed": [ "\tpublic ResultSetFactory getResultSetFactory() {", "\t\treturn rsFactory;", "\tpublic ExecutionFactory getExecutionFactory() {", "\t\treturn exFactory;" ] }, { "added": [], "header": "@@ -1592,14 +1564,6 @@ public abstract class BaseActivation implements CursorActivation, GeneratedByteC", "removed": [ "\t/**", "\t * Get the ExecutionContext.", "\t */", "\tExecutionContext getExecutionContext()", "\t{", "\t\treturn ec;", "\t}", "" ] }, { "added": [ "\t\treturn getLanguageConnectionContext().getDataValueFactory();" ], "header": "@@ -1616,7 +1580,7 @@ public abstract class BaseActivation implements CursorActivation, GeneratedByteC", "removed": [ "\t\treturn dvFactory;" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/GenericExecutionContext.java", "hunks": [ { "added": [ "import java.util.Properties;", "import org.apache.derby.iapi.error.ExceptionSeverity;", "import org.apache.derby.iapi.error.StandardException;", "import org.apache.derby.iapi.sql.execute.ExecutionContext;", "import org.apache.derby.iapi.sql.execute.ExecutionFactory;", "import org.apache.derby.iapi.sql.execute.ResultSetStatisticsFactory;" ], "header": "@@ -21,24 +21,16 @@", "removed": [ "import org.apache.derby.iapi.sql.execute.ExecutionContext;", "import org.apache.derby.iapi.sql.execute.ExecutionFactory;", "import org.apache.derby.iapi.sql.execute.ResultSetFactory;", "import org.apache.derby.iapi.sql.execute.ResultSetStatisticsFactory;", "", "import org.apache.derby.iapi.sql.ResultSet;", "", "import org.apache.derby.iapi.services.sanity.SanityManager;", "", "", "import org.apache.derby.iapi.error.StandardException;", "", "import java.util.Properties;", "import org.apache.derby.iapi.error.ExceptionSeverity;" ] }, { "added": [], "header": "@@ -55,30 +47,12 @@ class GenericExecutionContext", "removed": [ "\tprivate ResultSetFactory rsFactory;", "\t/**", "\t * Get the ResultSetFactory from this ExecutionContext.", "\t *", "\t * @return\tThe result set factory associated with this", "\t *\t\tExecutionContext", "\t */", "\tpublic ResultSetFactory getResultSetFactory() ", "\t{", "\t\t/* null rsFactory may have been passed to", "\t\t * constructor in order to speed up boot time.", "\t\t */", "\t\tif (rsFactory == null)", "\t\t{", "\t\t\trsFactory = execFactory.getResultSetFactory();", "\t\t}", "\t\treturn rsFactory;", "\t}" ] } ] }, { "file": "java/testing/org/apache/derbyTesting/functionTests/util/T_ConsistencyChecker.java", "hunks": [ { "added": [ "\t\tbaseRow = lcc.getLanguageConnectionFactory().getExecutionFactory().getValueRow(td.getNumberOfColumns());" ], "header": "@@ -299,7 +299,7 @@ public class T_ConsistencyChecker", "removed": [ "\t\tbaseRow = ec.getExecutionFactory().getValueRow(td.getNumberOfColumns());" ] }, { "added": [ "\t\tindexScanTemplate = lcc.getLanguageConnectionFactory().getExecutionFactory().getValueRow(baseColumns + 1);" ], "header": "@@ -375,7 +375,7 @@ public class T_ConsistencyChecker", "removed": [ "\t\tindexScanTemplate = ec.getExecutionFactory().getValueRow(baseColumns + 1);" ] } ] } ]
derby-DERBY-2661-ceb12d3f
DERBY-2661 (partial) Remove one use of ExecutuionContext with a direct use of ExecutionFactory. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@541732 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/execute/RowUtil.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.error.StandardException;", "import org.apache.derby.iapi.services.io.FormatableBitSet;", "import org.apache.derby.iapi.sql.execute.ExecRow;" ], "header": "@@ -21,19 +21,12 @@", "removed": [ "import org.apache.derby.iapi.services.context.ContextManager;", "", "", "", "import org.apache.derby.iapi.sql.execute.ExecRow;", "import org.apache.derby.iapi.sql.execute.ExecutionContext;", "import org.apache.derby.iapi.error.StandardException;", "", "import org.apache.derby.iapi.services.io.FormatableBitSet;", "import java.util.Vector;" ] }, { "added": [ "\tpublic static ExecIndexRow getEmptyIndexRow(int columnCount, LanguageConnectionContext lcc)", "\t\treturn lcc.getLanguageConnectionFactory().", " getExecutionFactory().getIndexableRow(columnCount);" ], "header": "@@ -62,13 +55,10 @@ public class RowUtil", "removed": [ "\tpublic static ExecIndexRow getEmptyIndexRow(int columnCount, ContextManager cm)", "\t\tExecutionContext\tec;", "", "\t\tec = (ExecutionContext)", "\t\t\t\tcm.getContext(ExecutionContext.CONTEXT_ID);", "\t\treturn ec.getExecutionFactory().getIndexableRow(columnCount);" ] } ] } ]
derby-DERBY-2661-e5bbea45
DERBY-2661 Remove one use of ExecutionContext and instead obtain the ExecutionFactory directly for TableDescriptor.getEmptyExecRow. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@541393 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/sql/dictionary/TableDescriptor.java", "hunks": [ { "added": [ "import java.util.Enumeration;", "import java.util.Iterator;", "import java.util.List;", "import org.apache.derby.catalog.Dependable;", "import org.apache.derby.catalog.UUID;", "import org.apache.derby.iapi.error.StandardException;", "import org.apache.derby.iapi.services.sanity.SanityManager;", "import org.apache.derby.iapi.sql.StatementType;", "import org.apache.derby.iapi.types.DataValueDescriptor;" ], "header": "@@ -21,34 +21,21 @@", "removed": [ "import org.apache.derby.iapi.services.context.ContextManager;", "", "import org.apache.derby.iapi.error.StandardException;", "", "import org.apache.derby.iapi.sql.dictionary.GenericDescriptorList;", "", "import org.apache.derby.iapi.sql.depend.Provider;", "import org.apache.derby.iapi.sql.execute.ExecRow;", "import org.apache.derby.catalog.UUID;", "import org.apache.derby.iapi.sql.StatementType;", "", "import org.apache.derby.iapi.types.DataValueDescriptor;", "import org.apache.derby.iapi.sql.execute.ExecutionContext;", "", "import org.apache.derby.iapi.reference.SQLState;", "import\torg.apache.derby.catalog.Dependable;", "import org.apache.derby.iapi.services.sanity.SanityManager;", "", "import java.util.Vector;", "import java.util.Enumeration;", "import java.util.List;", "import java.util.Iterator;" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/AlterTableConstantAction.java", "hunks": [ { "added": [ "\t\tExecRow emptyHeapRow = td.getEmptyExecRow();" ], "header": "@@ -1174,7 +1174,7 @@ class AlterTableConstantAction extends DDLSingleTableConstantAction", "removed": [ "\t\tExecRow emptyHeapRow = td.getEmptyExecRow(lcc.getContextManager());" ] }, { "added": [ "\t\t\tbaseRow[i] = td.getEmptyExecRow();" ], "header": "@@ -1249,7 +1249,7 @@ class AlterTableConstantAction extends DDLSingleTableConstantAction", "removed": [ "\t\t\tbaseRow[i] = td.getEmptyExecRow(lcc.getContextManager());" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/WriteCursorConstantAction.java", "hunks": [ { "added": [], "header": "@@ -39,7 +39,6 @@ import org.apache.derby.iapi.sql.dictionary.IndexRowGenerator;", "removed": [ "import org.apache.derby.iapi.sql.execute.ExecutionContext;" ] }, { "added": [ "\t\t\temptyHeapRow = td.getEmptyExecRow();" ], "header": "@@ -322,7 +321,7 @@ abstract\tclass WriteCursorConstantAction implements ConstantAction, Formatable", "removed": [ "\t\t\temptyHeapRow = td.getEmptyExecRow(lcc.getContextManager());" ] } ] } ]
derby-DERBY-2667-02c89761
DERBY-2667 - improve junit test runs - save off derby.log for failing fixtures. patch (DERBY-2667_diff_02_21.txt) contributed by Manjula Kutty. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@630077 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2667-8cd67f55
DERBY-2667: Create more robust junit TestRunner for running derby tests Added property derby.tests.trace which enables printing of test name and time spent. Contributed by Ole Solberg. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@552046 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/junit/TestConfiguration.java", "hunks": [ { "added": [ " private final static String KEY_TRACE = \"derby.tests.trace\";" ], "header": "@@ -83,6 +83,7 @@ public class TestConfiguration {", "removed": [] }, { "added": [ " this.doTrace = Boolean.valueOf(", " getSystemProperties().getProperty(KEY_TRACE)).", " booleanValue();" ], "header": "@@ -645,6 +646,9 @@ public class TestConfiguration {", "removed": [] }, { "added": [ " this.doTrace = copy.doTrace;" ], "header": "@@ -665,6 +669,7 @@ public class TestConfiguration {", "removed": [] }, { "added": [ " this.doTrace = copy.doTrace;" ], "header": "@@ -686,6 +691,7 @@ public class TestConfiguration {", "removed": [] }, { "added": [ " this.doTrace = copy.doTrace;" ], "header": "@@ -716,6 +722,7 @@ public class TestConfiguration {", "removed": [] }, { "added": [ " this.doTrace = copy.doTrace;" ], "header": "@@ -773,6 +780,7 @@ public class TestConfiguration {", "removed": [] }, { "added": [ " doTrace = Boolean.valueOf(props.getProperty(KEY_TRACE)).booleanValue();" ], "header": "@@ -800,6 +808,7 @@ public class TestConfiguration {", "removed": [] }, { "added": [ " /**", " * Set JUnit test method tracing.", " */", " public void setTrace( boolean isChatty ) { doTrace = isChatty; }" ], "header": "@@ -1074,6 +1083,10 @@ public class TestConfiguration {", "removed": [] }, { "added": [ " /**", " * Return JUnit test method trace flag.", " *", " * @return JUnit test method trace flag.", " */", " public boolean doTrace() {", " return doTrace;", " }" ], "header": "@@ -1083,6 +1096,14 @@ public class TestConfiguration {", "removed": [] }, { "added": [ " private boolean doTrace;" ], "header": "@@ -1180,6 +1201,7 @@ public class TestConfiguration {", "removed": [] } ] } ]
derby-DERBY-2667-b85a4504
DERBY-2667 - modifying mix of tabs & spaces to only spaces in recently added code (revision 630077). git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@630354 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2669-888ae01f
DERBY-2669 add test case to CollationTest2 to test case of setting teritory based collation without setting territory attribute. I tried to make it so that the test will run in norway, english and polish territory where the test can handle results and not run in other territories - but sort of hard to test. Let me know if the testDefaultJVMTerritoryCollation() fails, and what the value of territory is for the vm it failed in. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@542175 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2673-023768a5
DERBY-2673 If derby.system.home does not exist then first attempt to create it with File.mkdir() to avoid requiring read permission on the parent folder. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@539614 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/services/monitor/FileMonitor.java", "hunks": [ { "added": [ " // Attempt to create just the folder initially", " // which does not require read permission on", " // the parent folder. This is to allow a policy", " // file to limit file permissions for derby.jar", " // to be contained under derby.system.home.", " // If the folder cannot be created that way", " // due to missing parent folder(s) ", " // then mkdir() will return false and thus", " // mkdirs will be called to create the", " // intermediate folders. This use of mkdir()", " // and mkdirs() retains existing (pre10.3) behaviour", " // but avoids requiring read permission on the parent", " // directory if it exists.", "\t\t\t\t\tboolean created = home.mkdir() || home.mkdirs();" ], "header": "@@ -130,7 +130,20 @@ public final class FileMonitor extends BaseMonitor implements java.security.Priv", "removed": [ "\t\t\t\t\thome.mkdirs();" ] } ] } ]
derby-DERBY-2674-79b7c086
DERBY-2674 (partial) Stop running jdbc40 tests in the old test framework The attached patch removes the TestPreparedStatementMethods test and associated files that are not used by other tests. An inspection of PreparedStatementTest showed that testing of isPoolable/setPoolable on a closed PreparedStatement was omitted when the test was ported to Junit. The patch adds test cases for this to PreparedStatementTest. Contributed by Øystein Grøvlen. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@540150 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2678-553cb1d0
DERBY-2678 There are some test cases in CollationTest.java which should pass after rule 1b) in DERBY-2678 is fixed. They should all pass but they do not because we just check if the 2 sides of the collation operation have same derivation or not and if not, then we throw an exception. But for the case where one side has collation derivation of NONE and the other side has IMPLICIT, we should do the collation using the collation type of the side that has collation derivation of NONE. Once we fix this, the CollationTest will fail and will need to be fixed. I am adding comments in CollationTest.java wherever the rule 1b) should apply. Please fix these comments in the test when you are implementing rule 1b) git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@545381 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2686-71d73dd6
DERBY-2686: Brushed up two skip methods; one to return 0 when a negative amount to skip is passed in, the other one will now break when 0 is returned from the underlying stream. No assumption is made about EOF, this is still up to the higher level streams, but the skip method will no longer hang forever if there is less bytes than requested in skip. Also removed some unused imports. Patch file: derby-2686-3a.diff git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@542005 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/drda/org/apache/derby/impl/drda/EXTDTAInputStream.java", "hunks": [ { "added": [], "header": "@@ -20,7 +20,6 @@", "removed": [ "import java.io.ByteArrayInputStream;" ] }, { "added": [], "header": "@@ -29,8 +28,6 @@ import java.sql.Blob;", "removed": [ "import java.io.UnsupportedEncodingException;", "" ] } ] }, { "file": "java/engine/org/apache/derby/impl/store/raw/data/BufferedByteHolderInputStream.java", "hunks": [ { "added": [], "header": "@@ -21,7 +21,6 @@", "removed": [ "import java.io.InputStream;" ] }, { "added": [ "\t\tlong bytesSkipped = 0L;", "\t\t\tlong skipped = super.skip(count - bytesSkipped);", "\t\t\tif (skipped <= 0L) {", "\t\t\t\tbreak;", "\t\t\t}", "\t\t\tbytesSkipped += skipped;" ], "header": "@@ -48,10 +47,14 @@ extends ByteHolderInputStream", "removed": [ "\t\tint bytesSkipped = 0;", "\t\t\tbytesSkipped += super.skip(count - bytesSkipped);" ] } ] } ]
derby-DERBY-2687-5c759ff9
DERBY-2687 store/encryptDatabase.sql fails intermittently with ClassNotFoundException, Log Corrupted Patch derby-2687-2 + removed an additional unused line. This converts encryptDatabase.sql to JUnit and also makes the test ignore a hash collision case: the stored two byte digest of the secret key can in can 1/2**16 cases match the the digest of bogus key gotten by decoding the encrypted key using the wrong bootpassword, thus allowing boot to proceed using a wrong encryption key, leading to a boot crash (the "boot issue"). Another issue (less likely) can still make the test fail (the "bootpassword change issue"), but cf. the improvement issue DERBY-5622 which would resolve that. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1292084 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/junit/Decorator.java", "hunks": [ { "added": [ " {", " return encryptedDatabaseBpw(test, getBootPhrase(16));", " }", "", " /**", " * Decorate a set of tests to use an encrypted", " * single use database. This is to run tests", " * using encryption as a general test and", " * not specific tests of how encryption is handled.", " * E.g. tests of setting various URL attributes", " * would be handled in a specific test.", " * <BR>", " * The database will use the default encryption", " * algorithm.", " * ", " * @param test test to decorate", " * @param bootPassword boot passphrase to use", " * @return decorated tests", " */", " public static Test encryptedDatabaseBpw(Test test, String bootPassword)", " attributes.setProperty(\"bootPassword\", bootPassword);", "" ], "header": "@@ -56,17 +56,37 @@ public class Decorator {", "removed": [ " attributes.setProperty(\"bootPassword\", getBootPhrase(16));", " " ] }, { "added": [ " {", " return encryptedDatabaseBpw(test, algorithm, getBootPhrase(16));", " }", "", "", " /**", " * Decorate a set of tests to use an encrypted", " * single use database. This is to run tests", " * using encryption as a general test and", " * not specific tests of how encryption is handled.", " * E.g. tests of setting various URL attributes", " * would be handled in a specific test.", " * <BR>", " * The database will use the specified encryption", " * algorithm.", " * ", " * @param test test to decorate", " * @param bootPassword boot passphrase to use", " * @return decorated tests", " */", " public static Test encryptedDatabaseBpw(Test test,", " final String algorithm,", " String bootPassword)", " attributes.setProperty(\"bootPassword\", bootPassword);", "" ], "header": "@@ -85,15 +105,38 @@ public class Decorator {", "removed": [ " attributes.setProperty(\"bootPassword\", getBootPhrase(64));", " " ] } ] } ]
derby-DERBY-269-963d9f4e
DERBY-269 This patch will provide a manual way of updating the statistics of all or just one index on a table using the new stored procedure SYSCS_UTIL.SYSCS_UPDATE_STATISTICS. The signature of the new procedure is as follows SYSCS_UTIL.SYSCS_UPDATE_STATISTICS(schemaname, tablename, indexname) If the user provides null for indexname then statistics will be updated for all the indexes on schemaname.tablename otherwise statistics will be updated only for schemaname.tablename.indexname. We implement this functionality by intercepting the stored procedure call and converting it to an internal to Derby only ALTER TABLE syntax. This allows us to use lot of basic code needed for schema/table name validation, privilege checking etc. Other than this, the actual code for implementing the functionality was obtained from exisiting unused class execute/UpdateStatisticsConstantAction.java I have removed that class from the codeline since the code inside it has now been moved into AlterTableConstantAction.java git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@677998 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/sql/dictionary/IndexRowGenerator.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.types.DataTypeDescriptor;" ], "header": "@@ -39,6 +39,7 @@ import org.apache.derby.iapi.sql.execute.ExecutionContext;", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/catalog/DD_Version.java", "hunks": [ { "added": [ "\t\tcase DataDictionary.DD_VERSION_DERBY_10_5:", "\t\t\treturn \"10.5\";" ], "header": "@@ -151,6 +151,8 @@ public\tclass DD_Version implements\tFormatable", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java", "hunks": [ { "added": [ "\t\t\t\t\t\t\t\t\t\t\t\t\"SYSCS_UPDATE_STATISTICS\"," ], "header": "@@ -411,6 +411,7 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ "\t\tsoftwareVersion = new DD_Version(this, DataDictionary.DD_VERSION_DERBY_10_5);" ], "header": "@@ -471,7 +472,7 @@ public final class\tDataDictionaryImpl", "removed": [ "\t\tsoftwareVersion = new DD_Version(this, DataDictionary.DD_VERSION_DERBY_10_4);" ] }, { "added": [ " // add 10.5 specific system procedures", " create_10_5_system_procedures(tc);" ], "header": "@@ -10141,6 +10142,8 @@ public final class\tDataDictionaryImpl", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/AlterTableNode.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.sql.dictionary.ConglomerateDescriptor;" ], "header": "@@ -30,6 +30,7 @@ import org.apache.derby.iapi.error.StandardException;", "removed": [] }, { "added": [ "", "\t/**", "\t * updateStatistics will indicate that we are here for updating the", "\t * statistics. It could be statistics of just one index or all the", "\t * indexes on a given table. ", "\t */", "\tprivate\tboolean\t\t\t\tupdateStatistics = false;", "\t/**", "\t * The flag updateStatisticsAll will tell if we are going to update the ", "\t * statistics of all indexes or just one index on a table. ", "\t */", "\tprivate\tboolean\t\t\t\tupdateStatisticsAll = false;", "\t/**", "\t * If statistic is getting updated for just one index, then ", "\t * indexNameForUpdateStatistics will tell the name of the specific index ", "\t * whose statistics need to be updated.", "\t */", "\tprivate\tString\t\t\t\tindexNameForUpdateStatistics;", "\t" ], "header": "@@ -51,6 +52,25 @@ public class AlterTableNode extends DDLStatementNode", "removed": [] }, { "added": [ "\t/**", "\t * Initializer for a AlterTableNode for updating the statistics. The user", "\t * can ask for update statistic of all the indexes or only a specific index", "\t *", "\t * @param objectName\t\tThe name of the table whose index(es) will have", "\t * their statistics updated.", "\t * @param updateStatisticsAll\tIf true then update the statistics of all ", "\t * the indexes on the table. If false, then update", "\t * the statistics of only the index provided as", "\t * 3rd parameter here", "\t * @param indexName\t\t\tOnly used if updateStatisticsAll is set to ", "\t * false. ", "\t *", "\t * @exception StandardException\t\tThrown on error", "\t */", "\tpublic void init(Object objectName,", "\t\t\tObject updateStatisticsAll,", "\t\t\tObject indexName)", "\tthrows StandardException", "\t{", "\t\tinitAndCheck(objectName);", "\t\tthis.updateStatisticsAll = ((Boolean) updateStatisticsAll).booleanValue();", "\t\tthis.indexNameForUpdateStatistics = (String)indexName;", "\t\tschemaDescriptor = getSchemaDescriptor();", "\t\tupdateStatistics = true;", "\t}", "\t" ], "header": "@@ -103,6 +123,33 @@ public class AlterTableNode extends DDLStatementNode", "removed": [] }, { "added": [ "\t\t\t\t\"truncateEndOfTable: \" + \"\\n\" + truncateEndOfTable + \"\\n\" +", "\t\t\t\t\"updateStatistics: \" + \"\\n\" + updateStatistics + \"\\n\" +", "\t\t\t\t\"updateStatisticsAll: \" + \"\\n\" + updateStatisticsAll + \"\\n\" +", "\t\t\t\t\"indexNameForUpdateStatistics: \" + \"\\n\" + indexNameForUpdateStatistics + \"\\n\";" ], "header": "@@ -216,7 +263,10 @@ public class AlterTableNode extends DDLStatementNode", "removed": [ "\t\t\t\t\"truncateEndOfTable: \" + \"\\n\" + truncateEndOfTable + \"\\n\";" ] }, { "added": [ "\t\t//Check if we are in alter table to update the statistics. If yes, then", "\t\t//check if we are here to update the statistics of a specific index. If", "\t\t//yes, then verify that the indexname provided is a valid one.", "\t\tif (updateStatistics && !updateStatisticsAll)", "\t\t{", "\t\t\tConglomerateDescriptor\tcd = null;", "\t\t\tif (schemaDescriptor.getUUID() != null) ", "\t\t\t\tcd = dd.getConglomerateDescriptor(indexNameForUpdateStatistics, schemaDescriptor, false);", "", "\t\t\tif (cd == null)", "\t\t\t{", "\t\t\t\tthrow StandardException.newException(", "\t\t\t\t\t\tSQLState.LANG_INDEX_NOT_FOUND, ", "\t\t\t\t\t\tschemaDescriptor.getSchemaName() + \".\" + indexNameForUpdateStatistics);", "\t\t\t}\t\t\t", "\t\t}", "" ], "header": "@@ -364,6 +414,23 @@ public class AlterTableNode extends DDLStatementNode", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/AlterTableConstantAction.java", "hunks": [ { "added": [ "\t/**", "\t * updateStatistics will indicate that we are here for updating the", "\t * statistics. It could be statistics of just one index or all the", "\t * indexes on a given table. ", "\t */", " private\t boolean\t\t\t\t\t updateStatistics;", "\t/**", "\t * The flag updateStatisticsAll will tell if we are going to update the ", "\t * statistics of all indexes or just one index on a table. ", "\t */", " private\t boolean\t\t\t\t\t updateStatisticsAll;", "\t/**", "\t * If statistic is getting updated for just one index, then ", "\t * indexNameForUpdateStatistics will tell the name of the specific index ", "\t * whose statistics need to be updated.", "\t */", " private\t String\t\t\t\t\t\tindexNameForUpdateStatistics;", " /**", " * RUNTIME state of the system is maintained in these objects.", " * rowBufferOne simply reuses the index row prepared by", " * makeConstantAction. rowBufferTwo is a clone (an extra copy) of", " * objects. rowBufferCurrent just switches between rowBufferOne and", " * rowBufferTwo. ", " */", " private DataValueDescriptor[][] rowBufferArray;", " private DataValueDescriptor[] rowBuffer;", " private DataValueDescriptor[] lastUniqueKey;", " private static final int GROUP_FETCH_SIZE = 16;", " " ], "header": "@@ -115,6 +115,35 @@ class AlterTableConstantAction extends DDLSingleTableConstantAction", "removed": [] }, { "added": [ "\t * @param updateStatistics\t\tTRUE means we are here to update statistics", "\t * @param updateStatisticsAll\tTRUE means we are here to update statistics", "\t * \tof all the indexes. False means we are here to update statistics of", "\t * \tonly one index.", "\t * @param indexNameForUpdateStatistics\tWill name the index whose statistics", "\t * \twill be updated" ], "header": "@@ -170,6 +199,12 @@ class AlterTableConstantAction extends DDLSingleTableConstantAction", "removed": [] }, { "added": [ " boolean truncateEndOfTable,", " boolean updateStatistics,", " boolean updateStatisticsAll,", " String\t indexNameForUpdateStatistics)" ], "header": "@@ -186,7 +221,10 @@ class AlterTableConstantAction extends DDLSingleTableConstantAction", "removed": [ " boolean truncateEndOfTable)" ] }, { "added": [ "\t\tthis.updateStatistics \t= updateStatistics;", "\t\tthis.updateStatisticsAll = updateStatisticsAll;", "\t\tthis.indexNameForUpdateStatistics = indexNameForUpdateStatistics;" ], "header": "@@ -203,6 +241,9 @@ class AlterTableConstantAction extends DDLSingleTableConstantAction", "removed": [] }, { "added": [ "\t\tif (updateStatistics)", "\t\t{", "\t\t\tupdateStatistics(activation);", "\t\t}" ], "header": "@@ -277,6 +318,10 @@ class AlterTableConstantAction extends DDLSingleTableConstantAction", "removed": [] }, { "added": [ "\t/**", "\t * Update statistics of either all the indexes on the table or only one", "\t * specific index depending on what user has requested.", "\t * ", "\t * @param activation the current activation", "\t * @throws StandardException", "\t */", "\tprivate void updateStatistics(Activation activation)", "\tthrows StandardException", "\t{", "\t\tLanguageConnectionContext lcc = activation.getLanguageConnectionContext();", "\t\tDataDictionary dd = lcc.getDataDictionary();", "\t\tTransactionController tc = lcc.getTransactionCompile();", "\t\tConglomerateDescriptor[] cds;", "\t\tlong[] conglomerateNumber;", "\t\tExecIndexRow[] indexRow;", "\t\tUUID[] objectUUID;", "\t\tGroupFetchScanController gsc;", "\t\tDependencyManager dm = dd.getDependencyManager();", "", "\t\ttd = dd.getTableDescriptor(tableId);", "\t\tif (updateStatisticsAll)", "\t\t{", "\t\t\tcds = td.getConglomerateDescriptors();", "\t\t}", "\t\telse", "\t\t{", "\t\t\tcds = new ConglomerateDescriptor[1];", "\t\t\tcds[0] = dd.getConglomerateDescriptor(indexNameForUpdateStatistics, sd, false);", "\t\t}", "", "\t\tconglomerateNumber = new long[cds.length];", "\t\tindexRow = new ExecIndexRow[cds.length];", "\t\tobjectUUID = new UUID[cds.length];", "\t\tConglomerateController heapCC =", "\t\t\ttc.openConglomerate(td.getHeapConglomerateId(), false, 0,", "\t\t\t\t\tTransactionController.MODE_RECORD,", "\t\t\t\t\tTransactionController.ISOLATION_REPEATABLE_READ);", "", "\t\t//= null;", "\t\ttry", "\t\t{", "/*\t\t\t heapCC = ", "\t\t\t\ttc.openConglomerate(td.getHeapConglomerateId(), false, 0,", "\t\t\t\t\tTransactionController.MODE_RECORD,", "\t\t\t\t\tTransactionController.ISOLATION_REPEATABLE_READ);*/", "", "\t\t\tfor (int i = 0; i < cds.length; i++)", "\t\t\t{", "\t\t\t\tif (!cds[i].isIndex())", "\t\t\t\t{", "\t\t\t\t\tconglomerateNumber[i] = -1;", "\t\t\t\t\tcontinue;", "\t\t\t\t}", "", "\t\t\t\tconglomerateNumber[i] = cds[i].getConglomerateNumber();", "", "\t\t\t\tobjectUUID[i] = cds[i].getUUID();", "", "\t\t\t\tindexRow[i] =", "\t\t\t\t\tcds[i].getIndexDescriptor().getNullIndexRow(", "\t\t\t\t\t\ttd.getColumnDescriptorList(),", "\t\t\t\t\t\theapCC.newRowLocationTemplate());", "\t\t\t}", "\t\t}", "\t\tfinally", "\t\t{", "//\t\t\tif (heapCC != null)", "\t\t\t\theapCC.close();", "\t\t}", "", "\t\tdd.startWriting(lcc);", "", "\t\tdm.invalidateFor(td, DependencyManager.UPDATE_STATISTICS, lcc);", "", "\t\tfor (int indexNumber = 0; indexNumber < conglomerateNumber.length;", "\t\t\t indexNumber++)", "\t\t{", "\t\t\tif (conglomerateNumber[indexNumber] == -1)", "\t\t\t\tcontinue;", "", "\t\t\tint numCols = indexRow[indexNumber].nColumns() - 1;", "\t\t\tlong[] cardinality = new long[numCols];", "\t\t\tlong numRows = 0;", "\t\t\tinitializeRowBuffers(indexRow[indexNumber]);", "", "\t\t\t/* Read uncommited, with record locking. Actually CS store may", "\t\t\t not hold record locks */", "\t\t\tgsc = ", "\t\t\t\ttc.openGroupFetchScan(", "\t\t\t\t\t\tconglomerateNumber[indexNumber],", "\t\t\t\t\t\tfalse, // hold", "\t\t\t\t\t\t0, // openMode: for read", "\t\t\t\t\t\tTransactionController.MODE_RECORD, // locking", "\t\t\t\t\t\tTransactionController.ISOLATION_READ_UNCOMMITTED, //isolation level", "\t\t\t\t\t\tnull, // scancolumnlist-- want everything.", "\t\t\t\t\t\tnull, // startkeyvalue-- start from the beginning.", "\t\t\t\t\t\t0,", "\t\t\t\t\t\tnull, // qualifiers, none!", "\t\t\t\t\t\tnull, // stopkeyvalue,", "\t\t\t\t\t\t0);", "", "\t\t\ttry", "\t\t\t{", "\t\t\t\tboolean firstRow = true;", "\t\t\t\tint rowsFetched = 0;", "\t\t\t\twhile ((rowsFetched = gsc.fetchNextGroup(rowBufferArray, null)) > 0)", "\t\t\t\t{", "\t\t\t\t\tfor (int i = 0; i < rowsFetched; i++)", "\t\t\t\t\t{", "\t\t\t\t\t\tint whichPositionChanged = compareWithPrevKey(i, firstRow);", "\t\t\t\t\t\tfirstRow = false;", "\t\t\t\t\t\tif (whichPositionChanged >= 0)", "\t\t\t\t\t\t{", "\t\t\t\t\t\t\tfor (int j = whichPositionChanged; j < cardinality.length; j++)", "\t\t\t\t\t\t\t\tcardinality[j]++;", "\t\t\t\t\t\t}", "\t\t\t\t\t\tnumRows++;", "\t\t\t\t\t}", "", "\t\t\t\t\tDataValueDescriptor[] tmp;", "\t\t\t\t\ttmp = rowBufferArray[GROUP_FETCH_SIZE - 1];", "\t\t\t\t\trowBufferArray[GROUP_FETCH_SIZE - 1] = lastUniqueKey;", "\t\t\t\t\tlastUniqueKey = tmp;", "\t\t\t\t} // while", "\t\t\t} // try", "\t\t\tfinally", "\t\t\t{", "//\t\t\t\tif (gsc != null)", "\t\t\t\t{", "\t\t\t\t\tgsc.close();", "\t\t\t\t\tgsc = null;", "\t\t\t\t}", "\t\t\t}", "", "\t\t\tif (numRows == 0)", "\t\t\t{", "\t\t\t\t/* if there is no data in the table: no need to write anything", "\t\t\t\t * to sys.systatstics.", "\t\t\t\t */", "\t\t\t\tbreak;\t\t\t", "\t\t\t}", "", "\t\t\tStatisticsDescriptor statDesc;", "", "\t\t\tdd.dropStatisticsDescriptors(tableId, objectUUID[indexNumber],", "\t\t\t\t\t\t\t\t\t\t tc);", "", "\t\t\tfor (int i = 0; i < indexRow[indexNumber].nColumns() - 1; i++)", "\t\t\t{", "\t\t\t\tstatDesc = new StatisticsDescriptor(dd, dd.getUUIDFactory().createUUID(),", "\t\t\t\t\t\tobjectUUID[indexNumber],", "\t\t\t\t\t\ttableId,", "\t\t\t\t\t\t\"I\",", "\t\t\t\t\t\tnew StatisticsImpl(numRows,", "\t\t\t\t\t\t\t\tcardinality[i]),", "\t\t\t\t\t\t\t\ti + 1);", "\t\t\t\tdd.addDescriptor(statDesc, null,", "\t\t\t\t\t\tDataDictionary.SYSSTATISTICS_CATALOG_NUM,", "\t\t\t\t\t\t\t\t true, tc);", "\t\t\t} // for each leading column (c1) (c1,c2)....", "", "\t\t} // for each index.", "\t}", "", "\tprivate void initializeRowBuffers(ExecIndexRow ir)", "\t{", "", "\t\trowBufferArray = new DataValueDescriptor[GROUP_FETCH_SIZE][];", "\t\tlastUniqueKey = ir.getRowArrayClone();", "\t\trowBufferArray[0] = ir.getRowArray(); // 1 gets old objects.", "\t}", "", " \tprivate int compareWithPrevKey(int index, boolean firstRow)", " \t\tthrows StandardException", " \t{", " \t\tif (firstRow)", " \t\t\treturn 0;", "", " \t\tDataValueDescriptor[] prev = (index == 0) ? lastUniqueKey : rowBufferArray[index - 1];", " \t\tDataValueDescriptor[] curr = rowBufferArray[index];", " \t\t// no point trying to do rowlocation; hence - 1", " \t\tfor (int i = 0; i < (prev.length - 1); i++)", " \t\t{", "\t\t\tDataValueDescriptor dvd = (DataValueDescriptor)prev[i];", "", "\t\t\tif (dvd.isNull())", "\t\t\t\treturn i;// nulls are counted as unique values.", "", " \t\t\tif (prev[i].compare(curr[i]) != 0)", " \t\t\t{", " \t\t\t\treturn i;", " \t\t\t}", " \t\t}", "", " \t\treturn -1;", " \t}", "" ], "header": "@@ -580,6 +625,204 @@ class AlterTableConstantAction extends DDLSingleTableConstantAction", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/GenericConstantActionFactory.java", "hunks": [ { "added": [ "\t * @param updateStatistics\t\tTRUE means we are here to update statistics", "\t * @param updateStatisticsAll\tTRUE means we are here to update statistics", "\t * \tof all the indexes. False means we are here to update statistics of", "\t * \tonly one index.", "\t * @param indexNameForUpdateStatistics\tWill name the index whose statistics", "\t * \twill be updated. This param is looked at only if updateStatisticsAll", "\t * \tis set to false." ], "header": "@@ -131,6 +131,13 @@ public class GenericConstantActionFactory", "removed": [] }, { "added": [ "\t\tboolean\t\t\t\t\t\ttruncateEndOfTable,", "\t\tboolean\t\t\t\t\t\tupdateStatistics,", "\t\tboolean\t\t\t\t\t\tupdateStatisticsAll,", "\t\tString\t\t\t\t\t\tindexNameForUpdateStatistics", "\t\t\t\t\t\t\t\t\t\t\t purge, defragment, truncateEndOfTable,", "\t\t\t\t\t\t\t\t\t\t\t updateStatistics, ", "\t\t\t\t\t\t\t\t\t\t\t updateStatisticsAll,", "\t\t\t\t\t\t\t\t\t\t\t indexNameForUpdateStatistics);" ], "header": "@@ -149,14 +156,20 @@ public class GenericConstantActionFactory", "removed": [ "\t\tboolean\t\t\t\t\t\ttruncateEndOfTable ", "\t\t\t\t\t\t\t\t\t\t\t purge, defragment, truncateEndOfTable);" ] } ] } ]
derby-DERBY-269-c2b03c4c
DERBY-3788 and DERBY-269 Adding a new test case which will show that updating the statistics will make a query pickup better index compare to prior to statistics availability + // + //Check statistics update causes most efficient index usage + //Create a table with 2 non-unique indexes on 2 different columns. + //The indexes are created when the table is still empty and hence + //there are no statistics available for them in sys.sysstatistics. + //The table looks as follows + // create table t2(c21 int, c22 char(14), c23 char(200)) + // create index t2i1 on t2(c21) + // create index t2i2 on t2(c22) + //Load the data into the table and running following query will + //pickup index t2i1 on column c21 + // select * from t2 where c21=? and c22=? + //But once you make the statistics available for t2i2, the query + //will pickup index t2i2 on column c22 for the query above git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@681085 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/junit/RuntimeStatisticsParser.java", "hunks": [ { "added": [ "", " /**", " * @param tableName", " * @param indexName", " * @return true if passed indexName was used for Index Scan ResultSet ", " * for the passed tableName", " */", " public boolean usedSpecificIndexForIndexScan(", " \t\tString tableName, String indexName){", " return (statistics.indexOf(\"Index Scan ResultSet for \" + ", " tableName + \" using index \" + indexName)!= -1);", " }", "" ], "header": "@@ -170,6 +170,19 @@ public class RuntimeStatisticsParser {", "removed": [] } ] } ]
derby-DERBY-269-c8131776
DERBY-269 Cleaning up code comments in AlterTableConstantAction. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@678460 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/execute/AlterTableConstantAction.java", "hunks": [ { "added": [], "header": "@@ -664,14 +664,8 @@ class AlterTableConstantAction extends DDLSingleTableConstantAction", "removed": [ "\t\t//= null;", "/*\t\t\t heapCC = ", "\t\t\t\ttc.openConglomerate(td.getHeapConglomerateId(), false, 0,", "\t\t\t\t\tTransactionController.MODE_RECORD,", "\t\t\t\t\tTransactionController.ISOLATION_REPEATABLE_READ);*/", "" ] }, { "added": [ "\t\t\theapCC.close();" ], "header": "@@ -692,8 +686,7 @@ class AlterTableConstantAction extends DDLSingleTableConstantAction", "removed": [ "//\t\t\tif (heapCC != null)", "\t\t\t\theapCC.close();" ] }, { "added": [ "\t\t\t\tgsc.close();", "\t\t\t\tgsc = null;" ], "header": "@@ -753,11 +746,8 @@ class AlterTableConstantAction extends DDLSingleTableConstantAction", "removed": [ "//\t\t\t\tif (gsc != null)", "\t\t\t\t{", "\t\t\t\t\tgsc.close();", "\t\t\t\t\tgsc = null;", "\t\t\t\t}" ] } ] } ]
derby-DERBY-2692-55d4cdfa
DERBY-2692: Client driver doesn't chain exceptions received from the server Always use initCause() to chain exceptions, also when they are chained with setNextException(). git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@543428 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/client/org/apache/derby/client/am/ExceptionFormatter.java", "hunks": [ { "added": [ " java.lang.Throwable throwable = e.getCause();" ], "header": "@@ -36,11 +36,7 @@ public class ExceptionFormatter {", "removed": [ " java.lang.Throwable throwable = null;", " try {", " throwable = ((Diagnosable) e).getThrowable();", " } catch (java.lang.NoSuchMethodError doNothing) {", " }" ] } ] }, { "file": "java/client/org/apache/derby/client/am/SqlException.java", "hunks": [ { "added": [], "header": "@@ -24,7 +24,6 @@ package org.apache.derby.client.am;", "removed": [ "import org.apache.derby.iapi.services.info.JVMInfo;" ] }, { "added": [ " * Set the cause of this exception based on its type.", " * <code>SQLException</code>s and <code>SqlException</code>s are", " * linked with <code>setNextException()</code> and <code>initCause()</code>.", " * All other exception types are linked with <code>initCause()</code>.", " private void setThrowable(Throwable throwable)" ], "header": "@@ -315,15 +314,13 @@ public class SqlException extends Exception implements Diagnosable {", "removed": [ " * Set the cause of this exception based on its type and", " * the current runtime version of Java", " protected void setThrowable(Throwable throwable)", " throwable_ = throwable;", " ", " // If the throwable is a SQL exception, use nextException rather", " // than chained exceptions" ] }, { "added": [ " if (throwable != null) {", " initCause(throwable);", " }" ], "header": "@@ -332,23 +329,10 @@ public class SqlException extends Exception implements Diagnosable {", "removed": [ " else if ( throwable != null )", " {", " // Set up a string indicating the cause if the current runtime", " // doesn't support the initCause() method. This is then used", " // by getMessage() when it composes the message string.", " if (JVMInfo.JDK_ID < JVMInfo.J2SE_14 )", " {", " causeString_ = \" \" + ", " getMessageUtil().getTextMessage(CAUSED_BY_EXCEPTION_ID) + \" \" +", " throwable.getClass() + \": \" + throwable.getMessage();", " }", " else", " {", " initCause(throwable);", " }", " }" ] }, { "added": [ " sqle.initCause(this);" ], "header": "@@ -377,14 +361,7 @@ public class SqlException extends Exception implements Diagnosable {", "removed": [ "", " // If we're in a runtime that supports chained exceptions, set the cause ", " // of the SQLException to be this SqlException. Otherwise the stack", " // trace is lost.", " if (JVMInfo.JDK_ID >= JVMInfo.J2SE_14 )", " {", " sqle.initCause(this);", " }" ] } ] }, { "file": "java/client/org/apache/derby/client/am/SqlWarning.java", "hunks": [ { "added": [], "header": "@@ -22,7 +22,6 @@", "removed": [ "import org.apache.derby.iapi.services.info.JVMInfo;" ] } ] }, { "file": "java/client/org/apache/derby/client/am/XaException.java", "hunks": [ { "added": [], "header": "@@ -23,7 +23,6 @@ package org.apache.derby.client.am;", "removed": [ " java.lang.Throwable throwable_ = null;" ] }, { "added": [ " initCause(throwable);" ], "header": "@@ -36,12 +35,7 @@ public class XaException extends javax.transaction.xa.XAException implements Dia", "removed": [ " throwable_ = throwable;", " if (((org.apache.derby.client.am.Configuration.jreLevelMajor == 1) &&", " (org.apache.derby.client.am.Configuration.jreLevelMinor >= 4)) ||", " (org.apache.derby.client.am.Configuration.jreLevelMajor > 1)) { // jre 1.4 or above, init the cause", " initCause(throwable);", " }" ] }, { "added": [ " initCause(throwable);" ], "header": "@@ -58,12 +52,7 @@ public class XaException extends javax.transaction.xa.XAException implements Dia", "removed": [ " throwable_ = throwable;", " if (((org.apache.derby.client.am.Configuration.jreLevelMajor == 1) &&", " (org.apache.derby.client.am.Configuration.jreLevelMinor >= 4)) ||", " (org.apache.derby.client.am.Configuration.jreLevelMajor > 1)) { // jre 1.4 or above, init the cause", " initCause(throwable);", " }" ] }, { "added": [ " initCause(throwable);" ], "header": "@@ -78,12 +67,7 @@ public class XaException extends javax.transaction.xa.XAException implements Dia", "removed": [ " throwable_ = throwable;", " if (((org.apache.derby.client.am.Configuration.jreLevelMajor == 1) &&", " (org.apache.derby.client.am.Configuration.jreLevelMinor >= 4)) ||", " (org.apache.derby.client.am.Configuration.jreLevelMajor > 1)) { // jre 1.4 or above, init the cause", " initCause(throwable);", " }" ] }, { "added": [], "header": "@@ -93,10 +77,6 @@ public class XaException extends javax.transaction.xa.XAException implements Dia", "removed": [ " public java.lang.Throwable getThrowable() {", " return throwable_;", " }", "" ] } ] } ]
derby-DERBY-2692-96889c19
DERBY-2692: Client driver doesn't chain exceptions received from the server This patch makes the client recreate the chain of exceptions sent by the server instead of concatenating the messages. Description of the changes: * java/client/org/apache/derby/client/am/Sqlca.java: - added a message number parameter to the methods that retrieved mesage and SQL state - fixed SqlErrmc parsing (used the correct delimiter) and renamed sqlErrmcTokens_ to sqlErrmcMessages_ since the SqlErrmc was split into its separate messages, not its tokens - added a string array called sqlStates_, which keeps the SQL states for each message in the chain * java/client/org/apache/derby/client/am/SqlException.java - added a message number field to keep track of which message in the SQLCA to use - changed the constructor that takes an Sqlca argument so that it recursively builds the chain of exceptions when the Sqlca contains many messages * java/client/org/apache/derby/client/am/ExceptionFormatter.java - removed the printing of SqlErrmcTokens in printTrace(), because (a) that method was renamed, and (b) it contains the exact same information as SqlErrmc which is printed anyway * java/testing/org/apache/derbyTesting/junit/BaseJDBCTestCase.java - changed assertSQLState() so that it checks nested exceptions on the client the same way as on embedded * java/testing/org/apache/derbyTesting/functionTests/tests/lang/ProcedureInTriggerTest.java - enabled an assert that previously only worked on embedded git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@543090 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/client/org/apache/derby/client/am/SqlException.java", "hunks": [ { "added": [ " /** Tells which of the messages in the SQLCA this exception refers to", " * (counting from 0). For engine generated errors only. */", " private transient int messageNumber_;" ], "header": "@@ -75,6 +75,9 @@ import org.apache.derby.shared.common.reference.SQLState;", "removed": [] }, { "added": [ "", " /**", " * Create an exception for an engine generated error.", " *", " * @param logWriter object used for tracing", " * @param sqlca the SQLCA sent from the server", " */", " this(sqlca, 0, true);", " // only set the error code for the first exception in the chain (we", " // don't know the error code for the rest)", " errorcode_ = sqlca.getSqlCode();", "", " /**", " * Create one of the exceptions in an exception chain generated by the", " * engine. This constructor calls itself recursively to create the rest of", " * the exception chain if <code>chain</code> is <code>true</code>.", " *", " * @param sqlca the SQLCA sent from the server", " * @param number the message number for this exception (counting from 0)", " * @param chain if <code>true</code>, generate the rest of the exception", " * chain recursively and link it to this exception", " */", " private SqlException(Sqlca sqlca, int number, boolean chain) {", " this.sqlca_ = sqlca;", " messageNumber_ = number;", " sqlstate_ = sqlca.getSqlState(number);", " int nextMsg = number + 1;", " if (chain && (sqlca.numberOfMessages() > nextMsg)) {", " setThrowable(new SqlException(sqlca, nextMsg, true));", " }", " }" ], "header": "@@ -251,14 +254,43 @@ public class SqlException extends Exception implements Diagnosable {", "removed": [ " ", " this.sqlca_ = sqlca;" ] }, { "added": [ " cachedMessage_ = message_ =", " ((Sqlca) sqlca_).getJDBCMessage(messageNumber_);" ], "header": "@@ -398,7 +430,8 @@ public class SqlException extends Exception implements Diagnosable {", "removed": [ " cachedMessage_ = message_ = ((Sqlca) sqlca_).getJDBCMessage();" ] }, { "added": [ "", " return sqlstate_;" ], "header": "@@ -424,12 +457,8 @@ public class SqlException extends Exception implements Diagnosable {", "removed": [ " ", " if (sqlca_ == null) {", " return sqlstate_;", " } else {", " return sqlca_.getSqlState();", " }" ] }, { "added": [ " return errorcode_;" ], "header": "@@ -438,11 +467,7 @@ public class SqlException extends Exception implements Diagnosable {", "removed": [ " if (sqlca_ == null) {", " return errorcode_;", " } else {", " return sqlca_.getSqlCode();", " }" ] } ] }, { "file": "java/client/org/apache/derby/client/am/Sqlca.java", "hunks": [ { "added": [ " /** A string representation of <code>sqlErrmcBytes_</code>. */", " private String sqlErrmc_;", " /** Array of errmc strings for each message in the chain. */", " protected String[] sqlErrmcMessages_;", " /** SQL states for all the messages in the exception chain. */", " private String[] sqlStates_;" ], "header": "@@ -31,8 +31,12 @@ public abstract class Sqlca {", "removed": [ " private String sqlErrmc_; // A string with all error tokens delimited by sqlErrmcDelimiter", " protected String[] sqlErrmcTokens_; // A string array with each element" ] }, { "added": [ " /**", " * Character sequence that separates the different messages in the errmc.", " * @see org.apache.derby.catalog.SystemProcedures#SQLERRMC_MESSAGE_DELIMITER", " */", " private static final String sqlErrmcDelimiter__ = \"\\u0014\\u0014\\u0014\";", " /** Cached error messages (to prevent multiple invocations of the stored", " * procedure to get the same message). */", " private String[] cachedMessages;" ], "header": "@@ -48,15 +52,20 @@ public abstract class Sqlca {", "removed": [ " //public static final String sqlErrmcDelimiter = \"\\u00FF\";", " private static final String sqlErrmcDelimiter__ = \";\";", " private String cachedMessage;" ] }, { "added": [ " /**", " * Returns the number of messages this SQLCA contains.", " *", " * @return number of messages", " */", " synchronized int numberOfMessages() {", " initSqlErrmcMessages();", " if (sqlErrmcMessages_ != null) {", " return sqlErrmcMessages_.length;", " }", " // even if we don't have an array of errmc messages, we are able to get", " // one message out of this sqlca (although it's not very readable)", " return 1;", " }", "" ], "header": "@@ -67,6 +76,21 @@ public abstract class Sqlca {", "removed": [] }, { "added": [ " // sqlErrmc string is dependent on sqlErrmcMessages_ array having", " // been built", " initSqlErrmcMessages();", " // sqlErrmc will be built only if sqlErrmcMessages_ has been built.", " if (sqlErrmcMessages_ == null) {", " if (sqlErrmcMessages_.length == 0) {" ], "header": "@@ -76,19 +100,18 @@ public abstract class Sqlca {", "removed": [ " // sqlErrmc string is dependent on sqlErrmcTokens array having been built", " if (sqlErrmcTokens_ == null) {", " getSqlErrmcTokens();", " }", " // sqlErrmc will be build only if sqlErrmcTokens has been build.", " if (sqlErrmcTokens_ == null) {", " if (sqlErrmcTokens_.length == 0) {" ] }, { "added": [ " for (indx = 0; indx < sqlErrmcMessages_.length - 1; indx++) {", " buffer.append(sqlErrmcMessages_[indx]);", " // all but the first message should be preceded by the SQL state", " // and a colon (see DRDAConnThread.buildTokenizedSqlerrmc() on the", " // server)", " buffer.append(sqlStates_[indx+1]);", " buffer.append(\":\");", " buffer.append(sqlErrmcMessages_[indx]);", " /**", " * Initialize and build the arrays <code>sqlErrmcMessages_</code> and", " * <code>sqlStates_</code>.", " */", " private void initSqlErrmcMessages() {", " if (sqlErrmcMessages_ == null || sqlStates_ == null) {", " // processSqlErrmcTokens handles null sqlErrmcBytes_ case", " processSqlErrmcTokens(sqlErrmcBytes_);" ], "header": "@@ -96,26 +119,32 @@ public abstract class Sqlca {", "removed": [ " for (indx = 0; indx < sqlErrmcTokens_.length - 1; indx++) {", " buffer.append(sqlErrmcTokens_[indx]);", " buffer.append(sqlErrmcTokens_[indx]);", " synchronized public String[] getSqlErrmcTokens() {", " if (sqlErrmcTokens_ != null) {", " return sqlErrmcTokens_;", "", " // processSqlErrmcTokens handles null sqlErrmcBytes_ case", " sqlErrmcTokens_ = processSqlErrmcTokens(sqlErrmcBytes_);", " return sqlErrmcTokens_;" ] }, { "added": [ " /**", " * Get the SQL state for a given error.", " *", " * @param messageNumber the error to retrieve SQL state for", " * @return SQL state for the error", " */", " synchronized String getSqlState(int messageNumber) {", " initSqlErrmcMessages();", " if (sqlStates_ != null) {", " return sqlStates_[messageNumber];", " }", " return getSqlState();", " }", "", " private String getMessage(int messageNumber) throws SqlException {", " if (cachedMessages != null && cachedMessages[messageNumber] != null) {", " return cachedMessages[messageNumber];", " return getUnformattedMessage(messageNumber);" ], "header": "@@ -169,15 +198,29 @@ public abstract class Sqlca {", "removed": [ " synchronized public String getMessage() throws SqlException {", " if (cachedMessage != null) {", " return cachedMessage;", " return getUnformattedMessage();" ] }, { "added": [ " String errmc = null;", " String sqlState = null;", "", " if (sqlErrmcMessages_ != null) {", " errmc = sqlErrmcMessages_[messageNumber];", " sqlState = sqlStates_[messageNumber];", " }", "", " cs.setIntX(1, (messageNumber == 0) ? getSqlCode() : 0);", " cs.setShortX(2, (short) ((errmc == null) ? 0 : errmc.length()));", " // SQLErrmc: SQL error message tokens as a String", " cs.setStringX(3, errmc);" ], "header": "@@ -185,12 +228,20 @@ public abstract class Sqlca {", "removed": [ " cs.setIntX(1, getSqlCode());", " cs.setShortX(2, (short) ((getSqlErrmc() != null) ? getSqlErrmc().length() : 0));", " // SQLErrmc: SQL error message tokens as a String (delimited by semicolon \";\").", " cs.setStringX(3, getSqlErrmc());" ] }, { "added": [ " cs.setStringX(12, sqlState);" ], "header": "@@ -203,7 +254,7 @@ public abstract class Sqlca {", "removed": [ " cs.setStringX(12, getSqlState());" ] }, { "added": [ " if (cachedMessages == null) {", " cachedMessages = new String[numberOfMessages()];", " }", " cachedMessages[messageNumber] = message;", " return getUnformattedMessage(messageNumber);" ], "header": "@@ -220,12 +271,15 @@ public abstract class Sqlca {", "removed": [ " cachedMessage = message;", " return getUnformattedMessage();" ] }, { "added": [ " synchronized String getJDBCMessage(int messageNumber) {", " return getMessage(messageNumber);", " return getUnformattedMessage(messageNumber);", " return getUnformattedMessage(messageNumber);", " /**", " * Get the unformatted message text (in case we cannot ask the server).", " *", " * @param messageNumber which message number to get the text for", " * @return string with details about the error", " */", " private String getUnformattedMessage(int messageNumber) {", " int sqlCode;", " String sqlState;", " String sqlErrmc;", " if (messageNumber == 0) {", " // if the first exception in the chain is requested, return all the", " // information we have", " sqlCode = getSqlCode();", " sqlState = getSqlState();", " sqlErrmc = getSqlErrmc();", " } else {", " // otherwise, return information about the specified error only", " sqlCode = 0;", " sqlState = sqlStates_[messageNumber];", " sqlErrmc = sqlErrmcMessages_[messageNumber];", " }", " return \"DERBY SQL error: SQLCODE: \" + sqlCode + \", SQLSTATE: \" +", " sqlState + \", SQLERRMC: \" + sqlErrmc;" ], "header": "@@ -239,24 +293,46 @@ public abstract class Sqlca {", "removed": [ " public synchronized String getJDBCMessage() {", " return getMessage();", " return getUnformattedMessage();", " return getUnformattedMessage();", " private String getUnformattedMessage() {", " return \"DERBY SQL error: SQLCODE: \" + getSqlCode() + \", SQLSTATE: \" + getSqlState() + \", SQLERRMC: \" + getSqlErrmc();" ] } ] } ]
derby-DERBY-2694-f81f6103
DERBY-2694: Checkin Anurag's patch to correct the truncation of large utf-8 strings sent over the network. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@544195 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/drda/org/apache/derby/impl/drda/DDMWriter.java", "hunks": [ { "added": [ " ", "\tprivate static final byte MULTI_BYTE_MASK = (byte) 0xC0;", "\tprivate static final byte CONTINUATION_BYTE = (byte) 0x80;" ], "header": "@@ -55,6 +55,9 @@ class DDMWriter", "removed": [] }, { "added": [ "\t\t\tif (writeLen != origLen) {", "\t\t\t\t//find the first byte of the multibyte char in case", "\t\t\t\t//the last byte is part of a multibyte char", "\t\t\t\twhile (isContinuationChar (byteval [writeLen])) {", "\t\t\t\t//", "\t\t\t\t// Now byteval[ writeLen ] is either a standalone 1-byte char", "\t\t\t\t// or the first byte of a multi-byte character. That means that", "\t\t\t\t// byteval[ writeLen -1 ] is the last (perhaps only) byte of the", "\t\t\t\t// previous character.", "\t\t\t\t//", "\t\t\t}", " " ], "header": "@@ -1220,19 +1223,20 @@ class DDMWriter", "removed": [ "\t\t\tif (writeLen != origLen)", "\t\t\t\t// first position on the first byte of the multibyte char", "\t\t\t\twhile ((byteval[writeLen -1] & 0xC0) == 0x80)", "\t\t\t\t{", "\t\t\t\t\tmultiByteTrunc = true;", "\t\t\t\t\t// Then subtract one more to get to the end of the", "\t\t\t\t\t// previous character", "\t\t\t\t\tif (multiByteTrunc == true)", "\t\t\t\t\t{", "\t\t\t\t\t\twriteLen = writeLen -1;", "\t\t\t\t\t}" ] }, { "added": [ "\tprivate boolean isContinuationChar( byte b ) { ", "\t\treturn ( (b & MULTI_BYTE_MASK) == CONTINUATION_BYTE );", "\t}" ], "header": "@@ -1242,6 +1246,9 @@ class DDMWriter", "removed": [] } ] } ]
derby-DERBY-2699-cf427292
DERBY-2699: Change how collation elements for ESCAPE clause are calculated Since we only need to know whether or not there is a single collation element, just look at the first two elements to see if we have none, one or many. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1428305 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/types/WorkHorseForCollatorDatatypes.java", "hunks": [ { "added": [], "header": "@@ -21,9 +21,6 @@", "removed": [ "import org.apache.derby.iapi.types.DataValueDescriptor;", "import org.apache.derby.iapi.types.BooleanDataValue;", "" ] }, { "added": [], "header": "@@ -57,21 +54,6 @@ final class WorkHorseForCollatorDatatypes", "removed": [ "\t/**", "\t * Following is the array holding a series of collation elements for the", "\t * string. It will be used in the like method. This gets initialized when", "\t * the like method is first invoked. ", "\t */", "\tprivate int[]\tcollationElementsForString;", "\t/** ", "\t * Number of valid collation elements in the array above. Note that this ", "\t * might be smaller than the actual size of the array above. Gets ", "\t * initialized when the like method is first invoked.", "\t */", "\tprivate int\t\tcountOfCollationElements;", "", "\t// For null strings, cKey = null.", "\tprivate CollationKey cKey; " ] }, { "added": [ "\t\tif (!escapeCharacter.hasSingleCollationElement())" ], "header": "@@ -171,8 +153,7 @@ final class WorkHorseForCollatorDatatypes", "removed": [ "\t\tif (escapeCharacter.getCollationElementsForString() != null && ", "\t\t\t\t(escapeCharacter.getCountOfCollationElements() != 1))" ] }, { "added": [ " /**", " * Check if the string consists of a single collation element.", " * @return {@code true} iff it's a single collation element", " * @see CollationElementsInterface#hasSingleCollationElement()", " */", " boolean hasSingleCollationElement() throws StandardException {", " if (stringData.isNull()) {", " return false;", " }", "", " CollationElementIterator cei =", " // First call next() to see that there is at least one element, and", " // then call next() to see that there is no more than one element.", " return cei.next() != CollationElementIterator.NULLORDER &&", " cei.next() == CollationElementIterator.NULLORDER;", " }" ], "header": "@@ -199,87 +180,23 @@ final class WorkHorseForCollatorDatatypes", "removed": [ "\t/**", "\t * This method returns the count of collation elements for SQLChar object.", "\t * It method will return the correct value only if method ", "\t * getCollationElementsForString has been called previously on the SQLChar", "\t * object. ", "\t *", "\t * @return count of collation elements for this instance of CollatorSQLChar", "\t */", "\tint getCountOfCollationElements()", "\t{", "\t\treturn countOfCollationElements;", "\t}", "", "\t/**", "\t * This method translates the string into a series of collation elements.", "\t * These elements will get used in the like method.", "\t * ", "\t * @return an array of collation elements for the string", "\t * @throws StandardException", "\t */", "\tint[] getCollationElementsForString()", "\t\tthrows StandardException", "\t{", "\t\tif (stringData.isNull())", "\t\t{", "\t\t\treturn (int[]) null;", "\t\t}", "", "", "", " // Caching of collationElementsForString is not working properly, in ", " // order to cache it needs to get invalidated everytime the container", " // type's value is changed - through any interface, eg: readExternal, ", " // setValue, ... To get proper behavior, disabling caching, and will", " // file a performance enhancement to implement correct caching.", " collationElementsForString = null;", " countOfCollationElements = 0;", "", "", "\t\tif (collationElementsForString != null)", "\t\t{", "\t\t\treturn collationElementsForString;", "\t\t}", "", "\t\t// countOfCollationElements should always be 0 when ", " // collationElementsForString is null", "\t\tif (SanityManager.DEBUG)", "\t\t{", "\t\t\tif (countOfCollationElements != 0)", "\t\t\t{", "\t\t\t\tSanityManager.THROWASSERT(", "\t\t\t\t\t\"countOfCollationElements expected to be 0, not \" + ", " countOfCollationElements);", "\t\t\t}", "\t\t}", " ", "", "\t\tcollationElementsForString = new int[stringData.getLength()];", "", "\t\tCollationElementIterator cei = ", "\t\tint nextInt;", "\t\twhile ((nextInt = cei.next()) != CollationElementIterator.NULLORDER)", "\t\t{", "\t\t\t/* Believe it or not, a String might have more", "\t\t\t * collation elements than characters.", "\t\t\t * So, we handle that case by increasing the int array", "\t\t\t * by 5 and copying array elements.", "\t\t\t */", "\t\t\tif (countOfCollationElements == collationElementsForString.length)", "\t\t\t{", "\t\t\t\tint[] expandedArray = new int[countOfCollationElements + 5];", "\t\t\t\tSystem.arraycopy(collationElementsForString, 0, expandedArray, ", "\t\t\t\t\t\t0, collationElementsForString.length);", "\t\t\t\tcollationElementsForString = expandedArray;", "\t\t\t}", "\t\t\tcollationElementsForString[countOfCollationElements++] = nextInt;", "\t\t}", "", "\t\treturn collationElementsForString;", "\t}" ] } ] } ]
derby-DERBY-2701-613392c3
DERBY-2701: many sealing violation errors in ibm142 and ibm15 jvm test runs of junit tests Removed references to StandardException from java/tools. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@541977 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/tools/org/apache/derby/impl/tools/ij/utilMain.java", "hunks": [ { "added": [], "header": "@@ -22,7 +22,6 @@", "removed": [ "import org.apache.derby.iapi.reference.JDBC30Translation;" ] }, { "added": [], "header": "@@ -30,9 +29,6 @@ import org.apache.derby.iapi.tools.i18n.*;", "removed": [ "import org.apache.derby.iapi.error.PublicAPI;", "import org.apache.derby.iapi.error.StandardException;", "" ] }, { "added": [], "header": "@@ -53,8 +49,6 @@ import java.sql.ResultSet;", "removed": [ "import java.lang.reflect.*;", "" ] }, { "added": [], "header": "@@ -63,9 +57,6 @@ import java.lang.reflect.*;", "removed": [ " private static final Class[] CONN_PARAM = { Integer.TYPE };", " private static final Object[] CONN_ARG = { new Integer(JDBC30Translation.CLOSE_CURSORS_AT_COMMIT)};", "" ] }, { "added": [ "\t * or ResultSet.CLOSE_CURSORS_AT_COMMIT." ], "header": "@@ -671,7 +662,7 @@ public class utilMain implements java.security.PrivilegedAction {", "removed": [ "\t * or ResultSet.CLOSE_CURSORS_AT_COMMIT. We implement this using reflection in jdk13 and lower" ] }, { "added": [ " conn.setHoldability(ResultSet.CLOSE_CURSORS_AT_COMMIT);", " return conn;", "\t * Connection object." ], "header": "@@ -685,19 +676,13 @@ public class utilMain implements java.security.PrivilegedAction {", "removed": [ " //Since there is no direct jdbc api in jdk13 and lower to do that, we are using reflection to set the holdability to close cursors", " try { //for jdks prior to jdk14, need to use reflection to set holdability to false. ", " \tMethod sh = conn.getClass().getMethod(\"setHoldability\", CONN_PARAM);", " \tsh.invoke(conn, CONN_ARG);", " } catch( Exception e) {", " \tthrow PublicAPI.wrapStandardException( StandardException.plainWrapException( e));", " }", " return conn;", "\t * Connection object. We implement this using reflection in jdk13 and lower" ] } ] }, { "file": "java/tools/org/apache/derby/impl/tools/sysinfo/Main.java", "hunks": [ { "added": [], "header": "@@ -51,7 +51,6 @@ import java.security.AccessController;", "removed": [ "import org.apache.derby.iapi.error.StandardException;" ] }, { "added": [ " private static void reportLocales (java.io.PrintWriter localAW) {" ], "header": "@@ -347,7 +346,7 @@ public static void getMainInfo (java.io.PrintWriter aw, boolean pause) {", "removed": [ " private static void reportLocales (java.io.PrintWriter localAW) { // throws StandardException {" ] } ] } ]
derby-DERBY-2707-9b529367
DERBY-2707: Inadequate clean-up in many jdbc4 tests Fixed the tearDown() methods in many of the jdbc4 tests. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@542016 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2711-f302c785
DERBY-2711: Added missing throw, made variable blob final, misc. JavaDoc/documentation changes. Patch file: derby-2711-3a-additional.diff git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@545501 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/jdbc/UpdateableBlobStream.java", "hunks": [ { "added": [ "/*" ], "header": "@@ -1,4 +1,4 @@", "removed": [ "/* " ] }, { "added": [ " * Updateable blob stream is a wrapper stream over dvd stream", " * and LOBInputStream.", " * It detects if blob data has moved from dvd to clob control. If this happens,", " * it will update itself to point to LOBInputStream and reflect changes made to", " * the Blob after the current position of the stream.", " /**", " * Flag to check if it is using stream from LOBStreamControl or from DVD.", " * <code>true</code> means data is read from LOBStreamControl,", " * <code>false</code> means data is read from the DVD.", " */", " /* Current position of this stream in number of bytes. */", " private final EmbedBlob blob;", "", " * parameter. The initial position is set to the <code>0</code>.", " stream = is;", "", " /**", " * Checks if this object is using materialized blob", " * if not it checks if the blob was materialized since", " * this stream was last access. If the blob was materialized", " * (due to one of the set methods) it gets the stream again and", " * sets the position to current read position.", " */" ], "header": "@@ -30,36 +30,43 @@ import org.apache.derby.iapi.reference.SQLState;", "removed": [ " * Updateable blob stream is a wrapper stream over dvd stream ", " * and LOBInputStream. It detects if blob data has moved from ", " * dvd to clob control update itself to point to LOBInputStream.", " //flag to check if its using stream from LOBStreamControl", " //or from DVD.", " private EmbedBlob blob;", " ", " * parameter. The initial position is set to the pos.", " * @throws IOException", " stream = is; ", " ", " //Checks if this object is using materialized blob", " //if not it checks if the blob was materialized since", " //this stream was last access. If the blob was materialized ", " //(due to one of the set methods) it gets the stream again and ", " //sets the position to current read position" ] }, { "added": [ " throw ioe;" ], "header": "@@ -70,6 +77,7 @@ class UpdateableBlobStream extends InputStream {", "removed": [] }, { "added": [ "" ], "header": "@@ -86,11 +94,10 @@ class UpdateableBlobStream extends InputStream {", "removed": [ " ", " " ] }, { "added": [ " * <p>", " * A subclass must provide an implementation of this method.", " * <p>", " * Note that this stream will reflect changes made to the underlying Blob at", " * positions equal to or larger then the current position.", " *", " * @see InputStream#read", " updateIfRequired();" ], "header": "@@ -98,15 +105,19 @@ class UpdateableBlobStream extends InputStream {", "removed": [ " * ", " * <p> A subclass must provide an implementation of this method.", " * ", " updateIfRequired(); " ] }, { "added": [ " * <p>", " * Note that this stream will reflect changes made to the underlying Blob at", " * positions equal to or larger then the current position .", " *" ], "header": "@@ -118,8 +129,10 @@ class UpdateableBlobStream extends InputStream {", "removed": [ " * ", " * " ] }, { "added": [ " * @exception IndexOutOfBoundsException If <code>off</code> is negative,", " * <code>len</code> is negative, or <code>len</code> is greater than", " * @see java.io.InputStream#read(byte[],int,int)", " updateIfRequired();" ], "header": "@@ -131,13 +144,13 @@ class UpdateableBlobStream extends InputStream {", "removed": [ " * @exception IndexOutOfBoundsException If <code>off</code> is negative, ", " * <code>len</code> is negative, or <code>len</code> is greater than ", " * @see java.io.InputStream#read()", " updateIfRequired(); " ] }, { "added": [ " * <p>", " * Note that this stream will reflect changes made to the underlying Blob at", " * positions equal to or larger then the current position .", " *" ], "header": "@@ -149,7 +162,10 @@ class UpdateableBlobStream extends InputStream {", "removed": [ " * " ] }, { "added": [ " * @see java.io.InputStream#read(byte[])" ], "header": "@@ -158,7 +174,7 @@ class UpdateableBlobStream extends InputStream {", "removed": [ " * @see java.io.InputStream#read(byte[], int, int)" ] }, { "added": [ " * <p>", " * Note that this stream will reflect changes made to the underlying Blob at", " * positions equal to or larger then the current position .", " *" ], "header": "@@ -176,7 +192,10 @@ class UpdateableBlobStream extends InputStream {", "removed": [ " * " ] }, { "added": [ " }" ], "header": "@@ -189,5 +208,5 @@ class UpdateableBlobStream extends InputStream {", "removed": [ " } " ] } ] } ]
derby-DERBY-2712-80424bf6
DERBY-2712: If large Clob is updated after getting a Reader, the reader continues to point to old data. Patch file: derby-2712v3.diff Patch contributed by Anurag Shekhar. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@546831 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/jdbc/ClobUpdateableReader.java", "hunks": [ { "added": [ "import java.io.EOFException;", "import java.io.InputStream;", "import java.sql.SQLException;", "import org.apache.derby.iapi.reference.SQLState;", "import org.apache.derby.iapi.services.i18n.MessageService;", "import org.apache.derby.iapi.services.sanity.SanityManager;" ], "header": "@@ -22,8 +22,14 @@", "removed": [] }, { "added": [ " private InputStream stream;", " /** flag to indicate if its associated with materialized clob */", " private boolean materialized;", " /** clob object this object is associated */", " private final EmbedClob clob;" ], "header": "@@ -42,9 +48,13 @@ final class ClobUpdateableReader extends Reader {", "removed": [ " private LOBInputStream stream;" ] }, { "added": [ " clob = null;", " materialized = true;", " init (stream, 0);", " }", "", " /**", " * Constructs a <code>Reader</code> over a <code>LOBInputStream</code>.", " * @param clob EmbedClob this Reader is associated to.", " * @throws IOException", " * @throws SQLException", " */", " ClobUpdateableReader (EmbedClob clob) throws IOException, SQLException {", " materialized = clob.isWritable(); ", " this.clob = clob;", " this.conChild = clob;", " //getting bytelength make some time leave exisitng streams", " //unusable", " long byteLength = clob.getByteLength();", " this.stream = clob.getInternalStream ();", " init (0, byteLength);" ], "header": "@@ -54,9 +64,28 @@ final class ClobUpdateableReader extends Reader {", "removed": [ " init (0);" ] }, { "added": [ " public int read(char[] cbuf, int off, int len) throws IOException { ", " updateIfRequired();" ], "header": "@@ -68,11 +97,8 @@ final class ClobUpdateableReader extends Reader {", "removed": [ " public int read(char[] cbuf, int off, int len) throws IOException {", " if (stream.isObsolete()) {", " stream.reInitialize();", " init (pos);", " }" ] } ] }, { "file": "java/engine/org/apache/derby/impl/jdbc/EmbedClob.java", "hunks": [ { "added": [ " return new ClobUpdateableReader (this);" ], "header": "@@ -253,7 +253,7 @@ final class EmbedClob extends ConnectionChild implements Clob", "removed": [ " return this.clob.getReader(1L);" ] } ] } ]
derby-DERBY-2713-d2b4fdb0
DERBY-2713: Ensure that a temporary file is not created for a lob obtained from resultset unless user updates it. Contributed by Anurag Shekhar. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@545197 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/jdbc/EmbedBlob.java", "hunks": [ { "added": [ " control = new LOBStreamControl (con.getDBName(), blobBytes);" ], "header": "@@ -112,8 +112,7 @@ final class EmbedBlob extends ConnectionChild implements Blob", "removed": [ " control = new LOBStreamControl (con.getDBName());", " control.write (blobBytes, 0, blobBytes.length, 0);" ] } ] }, { "file": "java/engine/org/apache/derby/impl/jdbc/LOBStreamControl.java", "hunks": [ { "added": [ " * The max bytes of data stored in memory depends on the way this", " * class is created. If the class is created with initial data, the buffer", " * size is set to the size of the byte array supplied. If no initial data", " * is supplied or if the initial data size is less than DEFAULT_MAX_BUF_SIZE,", " * The buffer size is set to DEFAULT_MAX_BUF_SIZE.", " * When write increases the data beyond this value a temporary file is created", " * and data is moved into that. If truncate reduces the size of the file below", " * initial buffer size (max of DEFAULT_MAX_BUF_SIZE and initial byte array size)", " * the data moved into memory.", " * This class also creates InputStream and OutputStream which can be used to access" ], "header": "@@ -45,12 +45,17 @@ import org.apache.derby.shared.common.error.ExceptionUtil;", "removed": [ " * The max bytes of data stored in memory is MAX_BUF_SIZE. When write", " * increases the data beyond this value a temporary file is created and data", " * is moved into that. If truncate reduces the size of the file below", " * MAX_BUF_SIZE the data moved into memory.", " * This class also creates Input- and OutputStream which can be used to access" ] }, { "added": [ " private final int bufferSize;", " private static final int DEFAULT_MAX_BUF_SIZE = 4096;", " /**", " * Creates an empty LOBStreamControl.", " * @param dbName database name", " */", " LOBStreamControl (String dbName) {", " this.dbName = dbName;", " updateCount = 0;", " //default buffer size", " bufferSize = DEFAULT_MAX_BUF_SIZE;", " }", "", " /**", " * Creates a LOBStreamControl and initializes with a bytes array.", " * @param dbName database name", " * @param data initial value", " */", " LOBStreamControl (String dbName, byte [] data)", " throws IOException, SQLException, StandardException {", " bufferSize = Math.max (DEFAULT_MAX_BUF_SIZE, data.length);", " write (data, 0, data.length, 0);" ], "header": "@@ -59,15 +64,33 @@ class LOBStreamControl {", "removed": [ " //keeping max 4k bytes in memory", " //randomly selected value", " private final int MAX_BUF_SIZE = 4096;", " public LOBStreamControl (String dbName) {" ] }, { "added": [ " dataBytes = null;" ], "header": "@@ -107,6 +130,7 @@ class LOBStreamControl {", "removed": [] }, { "added": [ " if (pos < bufferSize) {" ], "header": "@@ -186,7 +210,7 @@ class LOBStreamControl {", "removed": [ " if (pos < MAX_BUF_SIZE) {" ] }, { "added": [ " if (pos + len <= bufferSize)" ], "header": "@@ -223,7 +247,7 @@ class LOBStreamControl {", "removed": [ " if (pos + len <= MAX_BUF_SIZE)" ] }, { "added": [ " if (size < bufferSize) {" ], "header": "@@ -331,7 +355,7 @@ class LOBStreamControl {", "removed": [ " if (size < MAX_BUF_SIZE) {" ] }, { "added": [ " byte [] data = new byte [bufferSize];", " int len = (int) Math.min (length - sz, bufferSize);" ], "header": "@@ -356,11 +380,10 @@ class LOBStreamControl {", "removed": [ " byte [] data = new byte [MAX_BUF_SIZE];", " int len = (int) (((length - sz) >= MAX_BUF_SIZE) ? MAX_BUF_SIZE", " : length - sz);" ] }, { "added": [ " if (finalLength > bufferSize) {" ], "header": "@@ -420,7 +443,7 @@ class LOBStreamControl {", "removed": [ " if (finalLength > MAX_BUF_SIZE) {" ] } ] } ]
derby-DERBY-2714-e0f042af
DERBY-2714: SecureServerTest spends five minutes waiting for a server to start Abort waiting for the server to come up if the server process has terminated. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@542449 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java", "hunks": [ { "added": [ " private Process serverProcess;" ], "header": "@@ -67,6 +67,7 @@ final public class NetworkServerTestSetup extends BaseTestSetup {", "removed": [] }, { "added": [ " { serverProcess = startSeparateProcess(); }" ], "header": "@@ -115,7 +116,7 @@ final public class NetworkServerTestSetup extends BaseTestSetup {", "removed": [ " { startSeparateProcess(); }" ] }, { "added": [ " private Process startSeparateProcess() throws Exception" ], "header": "@@ -164,7 +165,7 @@ final public class NetworkServerTestSetup extends BaseTestSetup {", "removed": [ " private void startSeparateProcess() throws Exception" ] }, { "added": [ " return serverProcess;", " }", "", " /**", " * Returns the <code>Process</code> object for the server process.", " *", " * @param a <code>Process</code> object, or <code>null</code> if the", " * network server does not run in a separate process", " */", " public Process getServerProcess() {", " return serverProcess;" ], "header": "@@ -219,6 +220,17 @@ final public class NetworkServerTestSetup extends BaseTestSetup {", "removed": [] }, { "added": [ "", " if (serverProcess != null) {", " serverProcess.waitFor();", " serverProcess = null;", " }" ], "header": "@@ -241,6 +253,11 @@ final public class NetworkServerTestSetup extends BaseTestSetup {", "removed": [] }, { "added": [ " * @param networkServerController controller object for network server", " * @param serverProcess the external process in which the server runs", " * (could be <code>null</code>)", " * @return true if server responds in time, false otherwise", " public static boolean pingForServerStart(", " NetworkServerControl networkServerController, Process serverProcess)" ], "header": "@@ -303,8 +320,13 @@ final public class NetworkServerTestSetup extends BaseTestSetup {", "removed": [ " public static boolean pingForServerStart(NetworkServerControl networkServerController)" ] }, { "added": [ " if (serverProcess != null) {", " // if the server runs in a separate process, check whether the", " // process is still alive", " try {", " int exitVal = serverProcess.exitValue();", " // When exitValue() returns successfully, the server", " // process must have terminated. No point in pinging the", " // server anymore.", " return false;", " } catch (IllegalThreadStateException e) {", " // This exception is thrown by Process.exitValue() if the", " // process has not terminated. Keep on pinging the server.", " }", " }", "", " public static boolean pingForServerStart(NetworkServerControl control)", " throws InterruptedException", " {", " return pingForServerStart(control, null);", " }" ], "header": "@@ -318,6 +340,26 @@ final public class NetworkServerTestSetup extends BaseTestSetup {", "removed": [] } ] } ]
derby-DERBY-2715-ce145efd
DERBY-2715: Fix assertionFailedError in LobStreamsTest and ClobUpdateableReaderTest. Patch contributed by Anurag Shekhar. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@547394 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/jdbc/LOBStreamControl.java", "hunks": [ { "added": [ " private void deleteFile (StorageFile file) throws IOException {", " try {", " final StorageFile sf = file;", " AccessController.doPrivileged(new PrivilegedExceptionAction() {", " public Object run() throws IOException {", " sf.delete();", " return null;", " }", " });", " } catch (PrivilegedActionException pae) {", " Exception e = pae.getException();", " if (e instanceof IOException)", " throw (IOException) e;", " if (e instanceof RuntimeException)", " throw (RuntimeException) e;", " IOException ioe = new IOException(e.getMessage());", " ioe.initCause(e);", " throw ioe;", " }", " }" ], "header": "@@ -397,6 +397,26 @@ class LOBStreamControl {", "removed": [] }, { "added": [ " deleteFile(lobFile);", " tmpFile = null;" ], "header": "@@ -405,24 +425,8 @@ class LOBStreamControl {", "removed": [ " try {", " AccessController.doPrivileged (new PrivilegedExceptionAction() {", " public Object run() throws IOException {", " lobFile.delete();", " return null;", " }", " });", " }", " catch (PrivilegedActionException pae) {", " Exception e = pae.getException();", " if (e instanceof IOException)", " throw (IOException) e;", " if (e instanceof RuntimeException)", " throw (RuntimeException) e;", " IOException ioe = new IOException (e.getMessage());", " ioe.initCause (e);", " throw ioe;", " }" ] }, { "added": [ " StorageFile oldStoreFile = lobFile;" ], "header": "@@ -470,6 +474,7 @@ class LOBStreamControl {", "removed": [] }, { "added": [ " oldFile.close();", " deleteFile(oldStoreFile);" ], "header": "@@ -492,6 +497,8 @@ class LOBStreamControl {", "removed": [] } ] } ]
derby-DERBY-2716-ea2bbddb
DERBY-2716 fixed bad parsing of java version argument. In the process also discovered that J2ME environment also reproduces DERBY-2703, so changed the test case to also not run in this enviroment. I just brute forced the java version check, hopefully 2703 will get fixed before needing to add more jvm's to ignore. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@542697 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2718-63616cca
DERBY-2718 - LobStreamsTest and BlobClob4BlobTest fail with JSR169 because missing support for encryption. Now, only running encryption part with vms supporting JDBC3 and higher. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@543343 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2720-0e5e425c
DERBY-2720: remove dead code associated with unsupported National Char implementation Removed dead code. Patch file: derby-2720-1a-remove_sqlchar_getXFormat.diff git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1172535 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/types/SQLChar.java", "hunks": [ { "added": [], "header": "@@ -72,7 +72,6 @@ import java.sql.Time;", "removed": [ "import java.text.DateFormat;" ] }, { "added": [], "header": "@@ -2968,42 +2967,6 @@ readingLoop:", "removed": [ " protected DateFormat getDateFormat() throws StandardException {", " return getLocaleFinder().getDateFormat();", " }", " protected DateFormat getTimeFormat() throws StandardException {", " return getLocaleFinder().getTimeFormat();", " }", " protected DateFormat getTimestampFormat() throws StandardException {", " return getLocaleFinder().getTimestampFormat();", " }", "", " protected DateFormat getDateFormat( Calendar cal) ", " throws StandardException {", " return setDateFormatCalendar( getLocaleFinder().getDateFormat(), cal);", " }", " protected DateFormat getTimeFormat( Calendar cal) ", " throws StandardException {", " return setDateFormatCalendar( getLocaleFinder().getTimeFormat(), cal);", " }", " protected DateFormat getTimestampFormat( Calendar cal) ", " throws StandardException {", " return setDateFormatCalendar(", " getLocaleFinder().getTimestampFormat(), cal);", " }", "", " private DateFormat setDateFormatCalendar( DateFormat df, Calendar cal)", " {", " if( cal != null && df.getTimeZone() != cal.getTimeZone())", " {", " // The DateFormat returned by getDateFormat may be cached and used", " // by other threads. Therefore we cannot change its calendar.", " df = (DateFormat) df.clone();", " df.setCalendar( cal);", " }", " return df;", " }", "" ] } ] } ]
derby-DERBY-2720-aff8c993
DERBY-2720: remove dead code associated with unsupported National Char implementation Removed unused method DataType.getNationalString and its implementations. Patch file: derby-2720-2a-remove_getNationalString.diff git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1181679 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/types/DataType.java", "hunks": [ { "added": [], "header": "@@ -21,18 +21,11 @@", "removed": [ "import org.apache.derby.iapi.types.DataValueDescriptor;", "import org.apache.derby.iapi.types.DataTypeDescriptor;", "import org.apache.derby.iapi.types.BooleanDataValue;", "import org.apache.derby.iapi.types.Orderable;", "", "import org.apache.derby.iapi.services.i18n.LocaleFinder;", "" ] } ] }, { "file": "java/engine/org/apache/derby/iapi/types/SQLDate.java", "hunks": [ { "added": [], "header": "@@ -21,8 +21,6 @@", "removed": [ "import org.apache.derby.iapi.types.SQLInteger;", "" ] }, { "added": [], "header": "@@ -30,11 +28,6 @@ import org.apache.derby.iapi.services.io.ArrayInputStream;", "removed": [ "import org.apache.derby.iapi.types.DataValueDescriptor;", "import org.apache.derby.iapi.types.TypeId;", "", "import org.apache.derby.iapi.types.NumberDataValue;", "import org.apache.derby.iapi.types.DateTimeDataValue;" ] }, { "added": [], "header": "@@ -42,16 +35,12 @@ import org.apache.derby.iapi.services.io.StoredFormatIds;", "removed": [ "import org.apache.derby.iapi.types.DataType;", "", "import java.sql.Time;", "import java.sql.Types;" ] } ] }, { "file": "java/engine/org/apache/derby/iapi/types/SQLTime.java", "hunks": [ { "added": [], "header": "@@ -34,21 +34,12 @@ import org.apache.derby.iapi.error.StandardException;", "removed": [ "import org.apache.derby.iapi.types.DataValueDescriptor;", "import org.apache.derby.iapi.types.TypeId;", "", "import org.apache.derby.iapi.types.DateTimeDataValue;", "import org.apache.derby.iapi.types.NumberDataValue;", "", "import org.apache.derby.iapi.types.DataType;", "import java.sql.Date;", "import java.sql.Types;" ] } ] }, { "file": "java/engine/org/apache/derby/iapi/types/SQLTimestamp.java", "hunks": [ { "added": [], "header": "@@ -28,29 +28,18 @@ import org.apache.derby.iapi.services.io.ArrayInputStream;", "removed": [ "import org.apache.derby.iapi.types.DataValueDescriptor;", "import org.apache.derby.iapi.types.TypeId;", "", "import org.apache.derby.iapi.types.NumberDataValue;", "import org.apache.derby.iapi.types.DateTimeDataValue;", "", "import org.apache.derby.iapi.types.DataType;", "import org.apache.derby.iapi.types.SQLDouble;", "import org.apache.derby.iapi.types.SQLTime;", "", "import java.sql.Types;" ] }, { "added": [], "header": "@@ -879,25 +868,6 @@ public final class SQLTimestamp extends DataType", "removed": [ "\t// International Support", "", "\t/**", "\t * International version of getString(). Overrides getNationalString", "\t * in DataType for date, time, and timestamp.", "\t *", "\t * @exception StandardException\t\tThrown on error", "\t */", "\tprotected String getNationalString(LocaleFinder localeFinder) throws StandardException", "\t{", "\t\tif (isNull())", "\t\t{", "\t\t\treturn getString();", "\t\t}", "", "", "\t\treturn localeFinder.getTimestampFormat().format(getTimestamp((Calendar) null));", "\t}", "" ] } ] } ]
derby-DERBY-2722-649830ff
DERBY-2722 Committing changes which will make sure that we set the collation to current schema's collation for the return character string from XMLSERIALIZE. Don't have to make any changes for CHAR and VARCHAR functions because these functions gets translated into CAST by the parser and I have already checked in changes for the result of CAST to have the collation of current schema. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@543183 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2722-bcb6e16a
DERBY-2722 Before making call to XMLSERIALIZE, we should check if the classpath includes the required Xalan/JAXP classes. Otherwise the test will fail with jvms, where these classes can't be found. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@543209 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2723-7fb68b4d
DERBY-2723 The RoutineAliasInfo for user defined function stores the collation infomraiton about it's return type and parameters if they happen to be character string type. This commit makes sure that for those DTDs, we use the collation of the schema in which the function is getting defined. The existing code creates these DTDs at the parse time but the SchemaDescriptor for the function is not available at that stage. To get around this, at the bind time, we check in CreateAliasNode if we are dealing with any character string types in the function definition. If yes, then we create new DTDs which are based on the ones created during the parse time, but we set the correct collation informaiton on them. And then we recreate a new RoutineAliasInfo using the infomration from parse time RoutineAliasInfo and the newly created DTDs. I have added a CREATE FUNCTION using character string types in CollationTest. Code to use this collation information correctly when the function gets used inside a sql will go in as a separate patch. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@547206 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/compile/CreateAliasNode.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.types.DataTypeDescriptor;", "import org.apache.derby.iapi.types.StringDataValue;", "import org.apache.derby.catalog.types.TypeDescriptorImpl;" ], "header": "@@ -21,39 +21,28 @@", "removed": [ "import org.apache.derby.iapi.services.loader.ClassInspector;", "", "import org.apache.derby.iapi.services.context.ContextManager;", "", "import org.apache.derby.iapi.sql.compile.CompilerContext;", "import org.apache.derby.iapi.sql.compile.C_NodeTypes;", "", "import org.apache.derby.iapi.sql.ResultSet;", "import org.apache.derby.iapi.sql.dictionary.TableDescriptor;", "import org.apache.derby.iapi.services.monitor.Monitor;", "import org.apache.derby.impl.sql.compile.ActivationClassBuilder;", "import org.apache.derby.impl.sql.execute.BaseActivation;", "", "import java.lang.reflect.Member;" ] }, { "added": [ "\t/**", "\t * CreateAliasNode creates the RoutineAliasInfo for a user defined function", "\t * in it's init method, which is called by the parser. But at that time, we", "\t * do not have the SchemaDescriptor ready to determine the collation", "\t * type. Hence, at the bind time, when we do have the SchemaDescriptor", "\t * available, we should go back and fix the RoutineAliasIno to have correct", "\t * collation for it's character string parameters and also fix it's return", "\t * type's collation if the return type is a character string.", "\t * ", "\t * This method here checks if the RoutineAliasInfo has any character string", "\t * types associated with it. If not, then the RoutineAliasInfo that got", "\t * created at parsing time is just fine. But if not, then we should take", "\t * care of the collation type of it's character string types. ", "\t * ", "\t * @return true if it has a parameter or return type of character string", "\t */", "\tprivate boolean anyStringTypeDescriptor() {", "\t\tRoutineAliasInfo rai = (RoutineAliasInfo)aliasInfo;", "\t\tTypeDescriptor aType = rai.getReturnType();", "\t\t/*", "\t\t** Try for a built in type matching the", "\t\t** type name. ", "\t\t*/", "\t\tTypeId compTypeId = TypeId.getBuiltInTypeId(aType.getTypeName());", "\t\tif (compTypeId != null && compTypeId.isStringTypeId()) ", "\t\t\treturn true;", "\t\tif (rai.getParameterCount() != 0) {", "\t\t\tint paramCount = rai.getParameterCount();", "\t\t\tTypeDescriptor[] paramTypes = rai.getParameterTypes();", "\t\t\tfor (int i = 0; i < paramCount; i++) {", "\t\t\t\tcompTypeId = TypeId.getBuiltInTypeId(paramTypes[i].getTypeName());", "\t\t\t\tif (compTypeId != null && compTypeId.isStringTypeId()) ", "\t\t\t\t\treturn true;", "\t\t\t}", "\t\t}", "\t\treturn false;\t\t", "\t}", "\t", "\t/**", "\t * Take the passed TypeDescriptor and check if it corresponds to a ", "\t * character string type. If yes, then create a new one based on it's ", "\t * typeid, length and nullability to create a new DataTypeDescriptor and ", "\t * then have it take the collation type of the schema in which the method ", "\t * is getting defined in. This is because all the character strings ", "\t * associated with the definition of the user defined function should take ", "\t * the collation of the schema in which this user defined function is ", "\t * getting created.", "\t * ", "\t * @param changeTD TypeDescriptor with incorrect collation setting", "\t * @return New TypeDescriptor with collation of the schema in which ", "\t * the function is getting created.", "\t * @throws StandardException", "\t */", "\tprivate TypeDescriptor typeDescriptorWithCorrectCollation(TypeDescriptor changeTD)", "\tthrows StandardException {", "\t\tTypeId compTypeId = TypeId.getBuiltInTypeId(changeTD.getTypeName());", "\t\t//No work to do if type id does not correspond to a character string", "\t\tif (compTypeId != null && compTypeId.isStringTypeId()) {", "\t\t\tDataTypeDescriptor newTDWithCorrectCollation = ", "\t\t\t\tnew DataTypeDescriptor(compTypeId, ", "\t\t\t\t\t\tchangeTD.isNullable(),", "\t\t\t\t\t\tchangeTD.getMaximumWidth());", "\t\t\t//Use the collation type and info of the schema in which this", "\t\t\t//function is defined for the return value of the function", "\t\t\tnewTDWithCorrectCollation.setCollationType(", "\t\t \t getSchemaDescriptor(getObjectName().getSchemaName(), false).getCollationType());", "\t\t\tnewTDWithCorrectCollation.setCollationDerivation(", "\t \t\tStringDataValue.COLLATION_DERIVATION_IMPLICIT);", "\t\t\treturn newTDWithCorrectCollation;", "\t\t}", "\t\treturn changeTD;", "\t}", "\t" ], "header": "@@ -231,6 +220,79 @@ public class CreateAliasNode extends DDLStatementNode", "removed": [] } ] } ]
derby-DERBY-2724-353feeeb
DERBY-2724 Commiting changes so that the resultant character string from CURRENT ISOLATION, CURRENT_USER, SESSION_USER, SYSTEM_USER, CURRENT SCHEMA and CURRENT SQLID will take the collation type of UCS_BASIC. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@544180 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/compile/SpecialFunctionNode.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.types.StringDataValue;" ], "header": "@@ -24,6 +24,7 @@ package\torg.apache.derby.impl.sql.compile;", "removed": [] }, { "added": [], "header": "@@ -41,7 +42,6 @@ import org.apache.derby.iapi.reference.ClassName;", "removed": [ "" ] }, { "added": [ "\t\t\t//SQL spec Section 6.4 Syntax Rule 4 says that the collation type ", "\t\t\t//of these functions will be the collation of character set ", "\t\t\t//SQL_IDENTIFIER. In Derby's case, that will mean, the collation of", "\t\t\t//these functions will be UCS_BASIC. The collation derivation will ", "\t\t\t//be implicit. ", "\t\t\tdtd.setCollationDerivation(StringDataValue.COLLATION_DERIVATION_IMPLICIT);", "\t\t\tdtd.setCollationType(StringDataValue.COLLATION_TYPE_UCS_BASIC);" ], "header": "@@ -134,6 +134,13 @@ public class SpecialFunctionNode extends ValueNode", "removed": [] }, { "added": [ "\t\t\t//This is a Derby specific function but it's collation type will", "\t\t\t//be based on the same rules as for SESSION_USER/CURRENT_USER etc. ", "\t\t\t//ie there collation type will be UCS_BASIC. The collation ", "\t\t\t//derivation will be implicit. ", "\t\t\tdtd.setCollationDerivation(StringDataValue.COLLATION_DERIVATION_IMPLICIT);", "\t\t\tdtd.setCollationType(StringDataValue.COLLATION_TYPE_UCS_BASIC);" ], "header": "@@ -141,6 +148,12 @@ public class SpecialFunctionNode extends ValueNode", "removed": [] } ] } ]
derby-DERBY-273-c73df2b0
- DERBY-273_2 The derbynet/dataSourcePermissions_net.java test fails intermittently - Patch by Tomohito Nakayama (tomonaka@basil.ocn.ne.jp) git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@380099 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-273-cdad0a15
DERBY-273 The derbynet/dataSourcePermissions_net.java test fails intermittently - Patch by Tomohito Nakayama (tomonaka@basil.ocn.ne.jp) git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@378903 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-273-d9ffc2bc
- rollback DERBY-273.patch - Patch by Tomohito Nakayama (tomonaka@basil.ocn.ne.jp) git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@379091 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2730-78afc5bc
DERBY-2730 Embedded method Blob.getBinaryStream. Submitted by V.Narayanan git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@546838 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/jdbc/UpdateableBlobStream.java", "hunks": [ { "added": [ " ", " /**", " * Position in Blob where to stop reading.", " */", " private long maxPos;", " " ], "header": "@@ -47,6 +47,12 @@ class UpdateableBlobStream extends InputStream {", "removed": [] }, { "added": [ " //The subset of the Blob", " //has not been requested.", " //Hence set maxPos to -1.", " this.maxPos = -1;", " }", " ", " /**", " * Construct an <code>UpdateableBlobStream<code> using the ", " * <code>InputStream</code> received as parameter. The initial", " * position in the stream is set to <code>pos</code> and the", " * stream is restricted to a length of <code>len</code>.", " *", " * @param blob EmbedBlob this stream is associated with.", " * @param is InputStream this class is going to use internally.", " * @param pos initial position", " * @param len The length to which the underlying <code>InputStream</code>", " * has to be restricted.", " * @throws IOException", " */", " UpdateableBlobStream (EmbedBlob blob, InputStream is, long pos, long len) ", " throws SQLException {", " this(blob, is);", " //The length requested cannot exceed the length", " //of the underlying Blob object. Hence chose the", " //minimum of the length of the underlying Blob", " //object and requested length.", " maxPos = Math.min(blob.length(), pos + len);", " ", " try {", " //Skip to the requested position", " //inside the stream.", " skip(pos);", " }", " catch(IOException ioe) {", " //Skip throws an IOException. Wrap the", " //exception inside a SQLException and ", " //throw it to the caller.", " ", " SQLException sqle = new SQLException();", " sqle.initCause(ioe);", " throw sqle;", " }" ], "header": "@@ -58,6 +64,48 @@ class UpdateableBlobStream extends InputStream {", "removed": [] }, { "added": [ " ", " //If maxPos is not invalid and the current", " //position inside the stream has exceeded", " //maxPos the read sould return -1 signifying", " //end of stream.", " if (maxPos != -1 && pos >= maxPos) {", " return -1;", " }" ], "header": "@@ -118,6 +166,14 @@ class UpdateableBlobStream extends InputStream {", "removed": [] }, { "added": [ " int actualLength = 0;", " ", " //If maxPos is not invalid then", " //ensure that the length(len) ", " //that is requested falls within", " //the restriction set by maxPos.", " if(maxPos != -1) {", " actualLength ", " = (int )Math.min(len, maxPos - pos);", " }", " else {", " //maxPos has not been set. Make", " //maxPos the length requested.", " actualLength = len;", " }", " int retValue = super.read(b, off, actualLength);" ], "header": "@@ -150,8 +206,23 @@ class UpdateableBlobStream extends InputStream {", "removed": [ " int retValue = super.read(b, off, len);" ] } ] } ]
derby-DERBY-2730-cd727e77
DERBY-2730 Embedded method Clob.getCharacterStream. Submitted by V.Narayanan git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@547203 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/jdbc/ClobUpdateableReader.java", "hunks": [ { "added": [ " /**", " * Position in Clob where to stop reading.", " */", " private final long maxPos;", " " ], "header": "@@ -55,6 +55,11 @@ final class ClobUpdateableReader extends Reader {", "removed": [] }, { "added": [ " //The subset of the Clob has not been requested. ", " //Hence set maxPos to -1.", " this.maxPos = -1;" ], "header": "@@ -69,6 +74,9 @@ final class ClobUpdateableReader extends Reader {", "removed": [] }, { "added": [ " //The subset of the Clob", " //has not been requested.", " //Hence set maxPos to -1.", " this.maxPos = -1;", " }", " ", " /**", " * Construct an <code>ClobUpdateableReader<code> using the ", " * <code>EmbedClob</code> received as parameter. The initial", " * position in the stream is set to <code>pos</code> and the", " * stream is restricted to a length of <code>len</code>.", " *", " * @param clob EmbedClob this stream is associated with.", " * @param pos initial position. The position starts from 0.", " * @param len The length to which the underlying <code>InputStream</code>", " * has to be restricted.", " * @throws IOException", " * @throws SQLException", " */", " ClobUpdateableReader (EmbedClob clob, long pos, long len) ", " throws IOException, SQLException {", " materialized = clob.isWritable(); ", " this.clob = clob;", " this.conChild = clob;", " //Get the Byte length from the Clob which can be ", " //passes to the init method.", " long byteLength = clob.getByteLength();", " //Initialize the InputStream with the underlying ", " //InputStream of the Clob.", " this.stream = clob.getInternalStream ();", " //position the stream on pos using the init method.", " init (pos, byteLength);", " //The length requested cannot exceed the length", " //of the underlying Clob object. Hence chose the", " //minimum of the length of the underlying Clob", " //object and requested length.", " maxPos = Math.min(clob.length(), pos + len);" ], "header": "@@ -86,6 +94,43 @@ final class ClobUpdateableReader extends Reader {", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/jdbc/UpdateableBlobStream.java", "hunks": [ { "added": [ " * @throws SQLException", " throws IOException, SQLException {" ], "header": "@@ -82,9 +82,10 @@ class UpdateableBlobStream extends InputStream {", "removed": [ " throws SQLException {" ] } ] } ]
derby-DERBY-2735-0d4b4001
DERBY-2735 (partial) Basic working implementation of the SYSCS_SET_USER_ACCESS and tests for it. Need more cleanup work including checking invlaid parameters for the procedure and function. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@543281 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2735-3243663a
DERBY-2735 Test that the new routines to get the user's connection access level are restricted to the database owner. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@544890 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2735-72b93c59
DERBY-2735 (partial) Add the system procedure & function for connection level authorization with SYSCS_GET_USER_ACCESS mostly implemented and SYSCS_SET_USER_ACCESS as a stub. Add some testing of SYSCS_GET_USER_ACCESS. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@543254 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/catalog/SystemProcedures.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.reference.Property;", "import org.apache.derby.iapi.services.property.PropertyUtil;", "import org.apache.derby.iapi.util.StringUtil;" ], "header": "@@ -37,11 +37,14 @@ import org.apache.derby.iapi.db.Factory;", "removed": [] }, { "added": [ " LanguageConnectionContext lcc = ConnectionUtil.getCurrentLCC();", "", " try {", " return PropertyUtil.getDatabaseProperty(lcc.getTransactionExecute(), key);", " } catch (StandardException se) {", " throw PublicAPI.wrapStandardException(se);", " }" ], "header": "@@ -679,7 +682,13 @@ public class SystemProcedures {", "removed": [ " return(PropertyInfo.getDatabaseProperty(key));" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java", "hunks": [ { "added": [ " // Safe to re-use a TypeDescriptor here as they are", " // not modified during the creation of the routine", " TypeDescriptor varchar128 =", " DataTypeDescriptor.getBuiltInDataTypeDescriptor(", " Types.VARCHAR, 128);", "" ], "header": "@@ -10526,6 +10526,12 @@ public final class\tDataDictionaryImpl", "removed": [] } ] } ]
derby-DERBY-2735-9174d61f
DERBY-2735 Make 28502 exception statement level severity so that IDUtil.getUserAuthorizationId() can be used anywhere a valid authentication identifier is required. Ensure a non-session level severity exception during a connection creation failure is handled as a session level severity. Add testing of invalid authentication identifiers to SYSCS_GET_USER_ACCESS. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@544684 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.error.ExceptionSeverity;" ], "header": "@@ -39,6 +39,7 @@ import org.apache.derby.iapi.jdbc.AuthenticationService;", "removed": [] } ] } ]
derby-DERBY-2735-9cf7d230
DERBY-2735 (partial) More tests and fix the return from SYSCS_GET_USER_ACCESS when default connection mode is not set. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@543302 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2735-d36746b5
DERBY-2735 Fix the JDBC 4 TestDbMetaData test including simplyfying it a little so that the builtin functions can be defined once the the sub lists generated from that, rather than having three separate lists to keep up to date. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@543531 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2739-273e6aca
DERBY-2739: Test XPath function call prefixed with namespace git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1054991 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2739-52837960
DERBY-2739: Use DOM interfaces to implement XML operators Make SqlXmlUtil use JAXP and DOM interfaces and factory classes to provide support for XML serialization and XPath queries. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1073874 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/services/loader/ClassInspector.java", "hunks": [ { "added": [], "header": "@@ -28,11 +28,6 @@ import org.apache.derby.iapi.error.StandardException;", "removed": [ "import java.util.StringTokenizer;", "import java.util.List;", "import java.util.ArrayList;", "import java.util.NoSuchElementException;", "import java.util.Collections;" ] } ] }, { "file": "java/engine/org/apache/derby/iapi/types/SqlXmlUtil.java", "hunks": [ { "added": [ "import java.util.Collections;", "import java.util.List;", "import java.lang.reflect.InvocationTargetException;", "import java.lang.reflect.Method;", "import java.math.BigDecimal;", "", "import org.w3c.dom.xpath.XPathEvaluator;", "import org.w3c.dom.xpath.XPathExpression;", "import org.w3c.dom.xpath.XPathResult;", "" ], "header": "@@ -29,21 +29,29 @@ import org.apache.derby.iapi.services.sanity.SanityManager;", "removed": [ "import org.w3c.dom.Element;", "import org.w3c.dom.NodeList;" ] }, { "added": [ "import javax.xml.transform.Transformer;", "import javax.xml.transform.TransformerConfigurationException;", "import javax.xml.transform.TransformerFactory;", "import javax.xml.transform.dom.DOMSource;", "import javax.xml.transform.stream.StreamResult;" ], "header": "@@ -53,21 +61,12 @@ import javax.xml.parsers.DocumentBuilder;", "removed": [ "", "// -- Xalan-specific classes.", "", "import org.apache.xpath.XPath;", "import org.apache.xpath.XPathContext;", "import org.apache.xpath.objects.XObject;", "import org.apache.xpath.objects.XNodeSet;", "", "import org.apache.xml.utils.PrefixResolverDefault;", "", "import org.apache.xalan.serialize.DOMSerializer;", "import org.apache.xalan.serialize.Serializer;", "import org.apache.xalan.serialize.SerializerFactory;", "import org.apache.xalan.templates.OutputProperties;" ] }, { "added": [ " private Transformer serializer;", " private XPathExpression query;", "", " /**", " * <p>", " * An object representing the {@code BigDecimal.toPlainString()} method", " * if it's available on the platform. If it's not available, this field", " * will be initialized to {@code null}, and in that case the", " * {@code BigDecimal.toString()} method should be used instead without", " * reflection.", " * </p>", " *", " * <p>", " * The behaviour of the {@code toString()} method changed when", " * {@code toPlainString()} was introduced in Java SE 5. On older", " * platforms, it behaves just like {@code toPlainString()} does on", " * newer platforms. So when {@code toPlainString()} is not", " * available, it is safe to fall back to {@code toString()}. It", " * behaves differently on newer platforms, so we need to use", " * {@code toPlainString()} when it is available in order to get", " * consistent behaviour across all platforms.", " * </p>", " *", " * @see #numberToString(double)", " */", " private static final Method TO_PLAIN_STRING;", " static {", " Method m = null;", " try {", " m = BigDecimal.class.getMethod(\"toPlainString\", new Class[0]);", " } catch (NoSuchMethodException nsme) {", " // Couldn't find the method, so we'll just fall back to toString()", " // on this platform.", " }", " TO_PLAIN_STRING = m;", " }", "" ], "header": "@@ -122,19 +121,52 @@ public class SqlXmlUtil implements Formatable", "removed": [ " private Serializer serializer;", " private XPath query;", " private XPathContext xpContext;", " " ] }, { "added": [ " * as part of the construction process. We pass a null", " * namespace resolver object so that the implementation will", " * provide one for us, which means prefixes will not be resolved", " XPathEvaluator eval = (XPathEvaluator)", " dBuilder.getDOMImplementation().getFeature(\"+XPath\", \"3.0\");", " query = eval.createExpression(queryExpr, null);", "" ], "header": "@@ -256,18 +288,17 @@ public class SqlXmlUtil implements Formatable", "removed": [ " * as part of the construction process. We have to pass", " * in a PrefixResolver object in order to avoid NPEs when", " * invalid/unknown functions are used, so we just create", " * a dummy one, which means prefixes will not be resolved", " query = new XPath(queryExpr, null,", " new PrefixResolverDefault(dBuilder.newDocument()),", " XPath.SELECT);", " " ] }, { "added": [ " protected String serializeToString(List items,", " XMLDataValue xmlVal) throws TransformerException", " if ((items == null) || items.isEmpty()) {", " }" ], "header": "@@ -381,12 +412,13 @@ public class SqlXmlUtil implements Formatable", "removed": [ " protected String serializeToString(ArrayList items,", " XMLDataValue xmlVal) throws java.io.IOException", " if ((items == null) || (items.size() == 0))" ] }, { "added": [], "header": "@@ -397,9 +429,6 @@ public class SqlXmlUtil implements Formatable", "removed": [ " serializer.setWriter(sWriter);", " DOMSerializer dSer = serializer.asDOMSerializer();", "" ] }, { "added": [ " serializer.transform(", " new DOMSource((Node) obj), new StreamResult(sWriter));" ], "header": "@@ -473,7 +502,8 @@ public class SqlXmlUtil implements Formatable", "removed": [ " dSer.serialize((Node)obj);" ] }, { "added": [ " serializer.transform(", " new DOMSource(n), new StreamResult(sWriter));" ], "header": "@@ -507,7 +537,8 @@ public class SqlXmlUtil implements Formatable", "removed": [ " dSer.serialize(n);" ] }, { "added": [ " protected List evalXQExpression(XMLDataValue xmlContext," ], "header": "@@ -555,7 +586,7 @@ public class SqlXmlUtil implements Formatable", "removed": [ " protected ArrayList evalXQExpression(XMLDataValue xmlContext," ] }, { "added": [ " (query != null)," ], "header": "@@ -567,7 +598,7 @@ public class SqlXmlUtil implements Formatable", "removed": [ " (query != null) && (query.getExpression() != null)," ] }, { "added": [ " XPathResult result = (XPathResult)", " query.evaluate(docNode, XPathResult.ANY_TYPE, null);", " switch (result.getResultType()) {", " case XPathResult.UNORDERED_NODE_ITERATOR_TYPE:", " case XPathResult.ORDERED_NODE_ITERATOR_TYPE:", " if (result.iterateNext() == null) {", " // We have an empty sequence, so return null.", " return null;", " } else {", " // We have a non-empty sequence, so return a non-null", " // list to indicate that we found at least one item.", " return Collections.EMPTY_LIST;", " }", " default:", " // We have a single atomic value, which means the result is", " // non-empty. So return a non-null list.", " return Collections.EMPTY_LIST;", " List itemRefs;", " switch (result.getResultType()) {", " case XPathResult.NUMBER_TYPE:", " // Single atomic number. Get its string value.", " String val = numberToString(result.getNumberValue());", " itemRefs = Collections.singletonList(val);", " break;", " case XPathResult.STRING_TYPE:", " // Single atomic string value.", " itemRefs = Collections.singletonList(result.getStringValue());", " break;", " case XPathResult.BOOLEAN_TYPE:", " // Single atomic boolean. Get its string value.", " itemRefs = Collections.singletonList(", " String.valueOf(result.getBooleanValue()));", " break;", " case XPathResult.UNORDERED_NODE_ITERATOR_TYPE:", " case XPathResult.ORDERED_NODE_ITERATOR_TYPE:", " // We have a sequence. Get all nodes.", " itemRefs = new ArrayList();", " Node node;", " while ((node = result.iterateNext()) != null) {", " itemRefs.add(node);", " }", " break;", " default:", " if (SanityManager.DEBUG) {", " SanityManager.THROWASSERT(", " \"Don't know how to handle XPath result type \" +", " result.getResultType());", " }", " itemRefs = null;", " if ((itemRefs.size() == 1) && (itemRefs.get(0) instanceof Document))" ], "header": "@@ -592,64 +623,74 @@ public class SqlXmlUtil implements Formatable", "removed": [ " getXPathContext();", " xpContext.reset();", " XObject xOb = query.execute(xpContext, docNode, null);", " if ((xOb instanceof XNodeSet) &&", " (((XNodeSet)xOb).nodelist().getLength() > 0))", " { // If we have a sequence (XNodeSet) of length greater", " // than zero, then we know that at least one item", " // \"exists\" in the result so return a non-null list.", " return new ArrayList(0);", " }", " else if (!(xOb instanceof XNodeSet))", " // we have a single atomic value, which means the result is", " // non-empty. So return a non-null list.", " return new ArrayList(0);", " else {", " // return null; caller will take this to mean we have an", " // an empty sequence.", " return null;", " NodeList nodeList = null;", " int numItems = 0;", " if (!(xOb instanceof XNodeSet))", " // then we only have a single (probably atomic) item.", " numItems = 1;", " else {", " nodeList = xOb.nodelist();", " numItems = nodeList.getLength();", " }", "", " // Return a list of the items contained in the query results.", " ArrayList itemRefs = new ArrayList();", " if (nodeList == null)", " // result is a single, non-node value (ex. it's an atomic number);", " // in this case, just take the string value.", " itemRefs.add(xOb.str());", " else {", " for (int i = 0; i < numItems; i++)", " itemRefs.add(nodeList.item(i));", " nodeList = null;", "", " if ((numItems == 1) && (itemRefs.get(0) instanceof Document))" ] }, { "added": [ " private void loadSerializer() throws TransformerConfigurationException", " Properties props = new Properties();" ], "header": "@@ -661,27 +702,15 @@ public class SqlXmlUtil implements Formatable", "removed": [ " /**", " * Create and return an instance of Xalan's XPathContext", " * that can be used to compile an XPath expression.", " */", " private XPathContext getXPathContext()", " {", " if (xpContext == null)", " xpContext = new XPathContext();", "", " return xpContext;", " }", "", " private void loadSerializer() throws java.io.IOException", " Properties props = OutputProperties.getDefaultMethodProperties(\"xml\");" ] } ] }, { "file": "java/engine/org/apache/derby/iapi/types/XML.java", "hunks": [ { "added": [], "header": "@@ -33,10 +33,6 @@ import org.apache.derby.iapi.services.loader.ClassInspector;", "removed": [ "import org.apache.derby.iapi.types.DataValueDescriptor;", "import org.apache.derby.iapi.types.StringDataValue;", "import org.apache.derby.iapi.types.BooleanDataValue;", "" ] }, { "added": [ "import java.lang.reflect.Method;", "import java.util.List;" ], "header": "@@ -48,9 +44,9 @@ import java.io.InputStream;", "removed": [ "import java.io.StringReader;", "import java.util.ArrayList;" ] }, { "added": [ " List itemRefs = sqlxUtil.evalXQExpression(" ], "header": "@@ -867,7 +863,7 @@ public class XML", "removed": [ " ArrayList itemRefs = sqlxUtil.evalXQExpression(" ] }, { "added": [ " Object docImpl = checkJAXPRequirement();", " if (docImpl == null)" ], "header": "@@ -995,7 +991,8 @@ public class XML", "removed": [ " if (!ClassInspector.classIsLoadable(\"org.w3c.dom.Document\"))" ] }, { "added": [ " else if (!checkXPathRequirement(docImpl))", " xmlReqCheck = \"XPath 3.0\";" ], "header": "@@ -1007,8 +1004,8 @@ public class XML", "removed": [ " else if (!ClassInspector.classIsLoadable(\"org.apache.xpath.XPath\"))", " xmlReqCheck = \"Xalan\";" ] } ] }, { "file": "java/testing/org/apache/derbyTesting/junit/XML.java", "hunks": [ { "added": [], "header": "@@ -20,8 +20,6 @@", "removed": [ "import java.io.PrintWriter;", "import java.io.ByteArrayOutputStream;" ] }, { "added": [], "header": "@@ -31,8 +29,6 @@ import java.sql.Connection;", "removed": [ "import java.util.StringTokenizer;", "" ] }, { "added": [], "header": "@@ -72,15 +68,6 @@ import junit.framework.Assert;", "removed": [ " ", " /**", " * Minimum version of Xalan required to run XML tests under", " * Security Manager. In this case, we're saying that the", " * minimum version is Xalan 2.5.0 (because there's a bug", " * in earlier versions that causes problems with security", " * manager).", " */", " private static int [] MIN_XALAN_VERSION = new int [] { 2, 5, 0 };" ] }, { "added": [ " * running has a JAXP implementation.", " private static final boolean HAVE_JAXP_IMPL =", " HAVE_JAXP && checkJAXPImplementation();", " * Determine if we have support for DOM level 3 XPath, which is required", " private static final boolean HAVE_XPATH_LEVEL_3", " = HAVE_JAXP_IMPL && checkXPathSupport();" ], "header": "@@ -92,26 +79,17 @@ public class XML {", "removed": [ " * running has a version of Xalan in it. Xalan is required", " * for use of the Derby XML operators. In particular we", " * check for:", " *", " * 1. Xalan classes (version doesn't matter here)", " * 2. The Xalan \"EnvironmentCheck\" class, which is included", " * as part of Xalan. This allows us to check the specific", " * version of Xalan in use so that we can determine if", " * if we satisfy the minimum requirement.", " private static final boolean HAVE_XALAN =", " JDBC.haveClass(\"org.apache.xpath.XPath\") &&", " JDBC.haveClass(\"org.apache.xalan.xslt.EnvironmentCheck\");", " * Determine if we have the minimum required version of Xalan", " private static final boolean HAVE_MIN_XALAN", " = HAVE_XALAN && checkXalanVersion();" ] }, { "added": [ " * an implementation of the JAXP interfaces, for example the", " * support for DOM level 3 XPath).", " public static boolean classpathHasJAXP()", " return HAVE_JAXP_IMPL;", " * required classes exist in the classpath AND there is support", " * for DOM level 3 XPath.", " return HAVE_XPATH_LEVEL_3;" ], "header": "@@ -122,23 +100,24 @@ public class XML {", "removed": [ " * the particular version of Xalan).", " public static boolean classpathHasXalanAndJAXP()", " return HAVE_JAXP && HAVE_XALAN;", " * required classes exist in the classpath AND the version", " * of Xalan that we found is at least MIN_XALAN_VERSION.", " return HAVE_JAXP && HAVE_MIN_XALAN;" ] }, { "added": [ " * <p>", " * running contains a JAXP implementation that supports", " * DOM level 3 XPath.", " * </p>", " * <p>", " * know that there *is* an implementation of JAXP in the classpath.", " * </p>", " private static boolean checkXPathSupport()", " boolean supportsXPath;", "", " // Invoke the following using reflection to see if we have support", " // for DOM level 3 XPath:", " //", " // DocumentBuilderFactory.newInstance().newDocumentBuilder()", " // .getDOMImplementation().getFeature(\"+XPath\", \"3.0\");", " //", " Class factoryClass =", " Class.forName(\"javax.xml.parsers.DocumentBuilderFactory\");", " Method newFactory =", " factoryClass.getMethod(\"newInstance\", new Class[0]);", " Object factory = newFactory.invoke(null, new Object[0]);", "", " Method newBuilder = factoryClass.getMethod(", " \"newDocumentBuilder\", new Class[0]);", "", " Object builder = newBuilder.invoke(factory, new Object[0]);", "", " Class builderClass =", " Class.forName(\"javax.xml.parsers.DocumentBuilder\");", "", " Method getImpl = builderClass.getMethod(", " \"getDOMImplementation\", new Class[0]);", "", " Object impl = getImpl.invoke(builder, new Object[0]);", " Class domImplClass = Class.forName(\"org.w3c.dom.DOMImplementation\");", " Method getFeature = domImplClass.getMethod(", " \"getFeature\", new Class[] {String.class, String.class});", "", " Object ret =", " getFeature.invoke(impl, new Object[] {\"+XPath\", \"3.0\"});", "", " supportsXPath = (ret != null);", "", " } catch (Throwable t) {", " supportsXPath = false;", " return supportsXPath;", " }", "", " private static boolean checkJAXPImplementation() {", " try {", " Class factoryClass =", " Class.forName(\"javax.xml.parsers.DocumentBuilderFactory\");", " Method newFactory =", " factoryClass.getMethod(\"newInstance\", new Class[0]);", " Object factory = newFactory.invoke(null, new Object[0]);", " return factory != null;", " } catch (Throwable t) {", " return false;", " }" ], "header": "@@ -265,157 +244,79 @@ public class XML {", "removed": [ " * running has a version of Xalan that meets the minimum", " * Xalan version requirement. We do that by using a Java", " * utility that ships with Xalan--namely, \"EnvironmentCheck\"--", " * and by parsing the info gathered by that method to find", " * the Xalan version. We use reflection when doing this", " * so that this file will compile/execute even if XML classes", " * are missing.", " * know that there *is* a version of Xalan in the classpath", " * and that version includes the \"EnvironmentCheck\" class.", " *", " * Note that this method returns false if the call to Xalan's", " * EnvironmentCheck.checkEnvironment() returns false for any", " * reason. As a specific example, that method will always", " * return false when running with ibm131 because it cannot", " * find the required methods on the SAX 2 classes (apparently", " * the classes in ibm131 jdk don't have all of the methods", " * required by Xalan). Thus this method will always return", " * \"false\" for ibm131.", " private static boolean checkXalanVersion()", " boolean haveMinXalanVersion = false;", " // These io objects allow us to retrieve information generated", " // by the call to EnvironmenCheck.checkEnvironment()", " ByteArrayOutputStream bos = new ByteArrayOutputStream();", " PrintWriter pW = new PrintWriter(bos);", "", " // Call the method using reflection.", "", " Class cl = Class.forName(\"org.apache.xalan.xslt.EnvironmentCheck\");", " Method meth = cl.getMethod(\"checkEnvironment\",", " new Class[] { PrintWriter.class });", "", " Boolean boolObj = (Boolean)meth.invoke(", " cl.newInstance(), new Object [] { pW });", "", " pW.flush();", " bos.flush();", "", " cl = null;", " meth = null;", " pW = null;", "", " /* At this point 'bos' holds a list of properties with", " * a bunch of environment information. The specific", " * property we're looking for is \"version.xalan2_2\",", " * so get that property, parse the value, and see", " * if the version is at least the minimum required.", " */", " if (boolObj.booleanValue())", " {", " /* We wrote the byte array using the platform's default", " * encodinging (that's what we get with the call to", " * \"new PrintWriter(bos)\" above), so read it in using", " * the default encoding, as well (i.e. don't pass an", " * encoding into toString()).", " */", " String checkEnvOutput = bos.toString();", " bos.close();", "", " /* The property we're looking for is on a single line", " * of the output, and that line starts with the name", " * of the property. So extract that line out now. If", " * we can't find it, just return \"false\" to say that", " * we could not find the minimum version. Note: it's", " * possible (though admittedly unlikely) that the", " * string \"version.xalan2_2\" appears in the user's", " * classpath. Adding an equals sign (\"=\") at the end", " * of our search pattern reduces the chance of the", " * search string appearing in the classpath, but does", " * not eliminate it...", " */", " int pos = checkEnvOutput.indexOf(\"version.xalan2_2=\");", " if (pos < 0)", " return false;", "", " String ver = checkEnvOutput.substring(", " pos, checkEnvOutput.indexOf(\"\\n\", pos));", "", " // Now pull out the one we need.", " haveMinXalanVersion = (ver != null);", " if (haveMinXalanVersion)", " {", " /* We found the property, so parse out the necessary", " * piece. The value is of the form:", " *", " * <productName> Major.minor.x", " *", " * Ex:", " *", " * version.xalan2_2=Xalan Java 2.5.1 ", " * version.xalan2_2=XSLT4J Java 2.6.6", " */", " int i = 0;", " StringTokenizer tok = new StringTokenizer(ver, \". \");", " while (tok.hasMoreTokens())", " {", " String str = tok.nextToken().trim();", " if (Character.isDigit(str.charAt(0)))", " {", " int val = Integer.valueOf(str).intValue();", " if (val < MIN_XALAN_VERSION[i])", " {", " haveMinXalanVersion = false;", " break;", " }", " i++;", " }", "", " /* If we've checked all parts of the min version,", " * then we assume we're okay. Ex. \"2.5.0.2\"", " * is considered greater than \"2.5.0\".", " */", " if (i >= MIN_XALAN_VERSION.length)", " break;", " }", "", " /* If the value had fewer parts than the", " * mininum version, then it doesn't meet", " * the requirement. Ex. \"2.5\" is considered", " * to be a lower version than \"2.5.0\".", " */", " if (i < MIN_XALAN_VERSION.length)", " haveMinXalanVersion = false;", " }", " }", "", " /* Else the call to checkEnvironment() returned \"false\",", " * which means it couldn't find all of the classes/methods", " * required for Xalan to function. So in that case we'll", " * fall through and just return false, as well.", " */", " } catch (Throwable t) {", " System.out.println(\"Unexpected exception while \" +", " \"trying to find Xalan version:\");", " t.printStackTrace(System.err);", " haveMinXalanVersion = false;", "", " return haveMinXalanVersion;" ] } ] } ]
derby-DERBY-2739-7004c178
DERBY-2739: Test format of numeric values returned by the XMLQUERY operator git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1054962 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2739-911d88c4
DERBY-2739: Stricter checks in XMLTypeAndOpsTest Changed many assertStatementError() calls to assertCompileError(). git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1055031 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2740-9fd3c004
DERBY-2740: Set start and stop keys correctly when multi-probing an index that is defined on more than one column. Patch also adds appropriate test cases. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@544175 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/execute/TableScanResultSet.java", "hunks": [ { "added": [ "\t\t * happen if we plug it into first column of \"startPositionRow\".", "\t\t * So in this case startPositionRow[0] functions as a \"place-holder\"", "\t\t * for the probe value. The same goes for stopPositionRow[0].", "\t\t *", "\t\t * Note that it *is* possible for a start/stop key to contain more", "\t\t * than one column (ex. if we're scanning a multi-column index). In", "\t\t * that case we plug probeValue into the first column of the start", "\t\t * and/or stop key and leave the rest of the key as it is. As an ", "\t\t * example, assume we have the following predicates:", "\t\t *", "\t\t * ... where d in (1, 20000) and b > 200 and b <= 500", "\t\t *", "\t\t * And assume further that we have an index defined on (d, b).", "\t\t * In this case it's possible that we have TWO start predicates", "\t\t * and TWO stop predicates: the IN list will give us \"d = probeVal\",", "\t\t * which is a start predicate and a stop predicate; then \"b > 200\"", "\t\t * may give us a second start predicate, while \"b <= 500\" may give", "\t\t * us a second stop predicate. So in this situation we want our", "\t\t * start key to be:", "\t\t *", "\t\t * (probeValue, 200)", "\t\t *", "\t\t * and our stop key to be:", "\t\t *", "\t\t * (probeValue, 500).", "\t\t *", "\t\t * This will effectively limit the scan so that it only returns", "\t\t * rows whose \"D\" column equals probeValue and whose \"B\" column", "\t\t * falls in the range of 200 thru 500.", "\t\t *", "\t\t * Note: Derby currently only allows a single start/stop predicate", "\t\t * per column. See PredicateList.orderUsefulPredicates().", "\t\t{", "\t\t \t/* If the start key and stop key are the same, we've already set", "\t\t\t * stopPosition equal to startPosition as part of openCore().", "\t\t\t * So by putting the probe value into startPositionRow[0], we", "\t\t\t * also put it into stopPositionRow[0].", "\t\t\t */", "\t\t\tif (!sameStartStopPosition)", "\t\t\t\tstopPositionRow[0] = probeValue;", "\t\t}", "" ], "header": "@@ -366,19 +366,52 @@ class TableScanResultSet extends ScanResultSet", "removed": [ "\t\t * happen if we plug it into \"startPositionRow\". So in this case", "\t\t * startPositionRow functions as a \"place-holder\" for the probe", "\t\t * value. Note: if we have a probe value then we want to use it", "\t\t * as the start key AND as the stop key. In that case the value", "\t\t * of \"sameStartStopPosition\" would have been true when we created", "\t\t * this result set, and thus we've already set stopPosition equal", "\t\t * to startPosition as part of openCore(). So by putting the probe", "\t\t * value into startPositionRow, we're also putting it into", "\t\t * stopPositionRow, which is what we want." ] } ] }, { "file": "java/testing/org/apache/derbyTesting/junit/RuntimeStatisticsParser.java", "hunks": [ { "added": [ "", " /**", " * Return whether or not the query plan includes a line of the form", " *", " * \"Number of rows qualified=n\"", " *", " * where \"n\" is the received qualRows argument. Note that this", " * method will return true if the above string is found anywhere", " * in the query plan. For queries which specifying more than one", " * table, more advanced parsing will be required to associate the", " * number of rows qualified with the correct table.", " */", " public boolean rowsQualifiedEquals(int qualRows)", " {", " return (statistics.indexOf(\"Number of rows qualified=\" +", " qualRows + \"\\n\") != -1);", " }" ], "header": "@@ -202,4 +202,21 @@ public class RuntimeStatisticsParser {", "removed": [] } ] } ]
derby-DERBY-2744-3f677d15
DERBY-2744 DERBY-2242 Remove the testing of the new JDBC 4.0 DatabaseMetaData functions from the harness based metadata tests that are already covered by the JUnit jdbc4.TestDbMetaData test. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@543544 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2754-90eecadc
DERBY-2754 Client connections should not fail if permission is not granted to read derby.client.traceLevel and derby.client.traceDirectory Ignore properties if there is no permission to read them. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@545251 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/client/org/apache/derby/jdbc/ClientBaseDataSource.java", "hunks": [ { "added": [ "import java.security.PrivilegedActionException;" ], "header": "@@ -25,6 +25,7 @@ import java.io.Serializable;", "removed": [] }, { "added": [ " ", "", " ", " * @return value of the system property, null if there is no permission to read the property" ], "header": "@@ -379,17 +380,20 @@ public abstract class ClientBaseDataSource implements Serializable, Referenceabl", "removed": [ " * @return value of the system property" ] }, { "added": [ " try {", " return System.getProperty(key);", " } catch (SecurityException se) {", " // We do not want the connection to fail if the user does not have permission to ", " // read the property, so if a security exception occurs, just return null and ", " // continue with the connection. ", " return null;", " }" ], "header": "@@ -404,7 +408,14 @@ public abstract class ClientBaseDataSource implements Serializable, Referenceabl", "removed": [ " \t\t\treturn System.getProperty(key);" ] } ] } ]
derby-DERBY-2757-84f4b0ae
DERBY-2757: No longer flunk server boot when authentication is not enabled. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@544934 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2758-3bdf6de7
DERBY-2758: ODBC metadata function "SQLForeignKeys" returns different results in 10.3. Added test case. Contributed by Jørgen Løland. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@545865 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2758-c4b18e65
DERBY-2758: Add a JUnit test case to the existing JUnit DatabaseMetaDataTest. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@546312 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2758-fde4b69a
DERBY-2758: Update ODBCMetadataGenerator to create an ODBC version of the getCrossReference metadata query. This is required because, as of DERBY-2610, the JDBC version of that query no longer allows pattern matching on table names. Since the ODBC SQLForeignKeys function, which is mapped onto the getCrossReference metadata query, depends on pattern matching for correct behavior, we now create an ODBC-version of getCrossReference that allows pattern matching as in pre-10.3 releases. The SQLForeignKeys function is then mapped to the new, ODBC-specific version of the query. Contributed by: Jorgen Loland (jorgen.loland@sun.com) git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@545321 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/build/org/apache/derbyBuild/ODBCMetadataGenerator.java", "hunks": [ { "added": [ "\t// Types of changes that are possible. There are four", "\t//\t2. Where clause:", "\t//\t\tChange the where clause of the query. For ex. ", "\t//\t\tused to change getCrossReference \"T.TABLENAME=?\"", "\t//\t\tto \"T.TABLENAME LIKE ?\" since JDBC and ODBC specs", "\t//\t\tdiffer on whether table name must be set or not", "\t//\t3. Type and/or value change:", "\t//\t4. Additional column(s):", "", "\tprivate final byte WHERE_CLAUSE_CHANGE = 0x08;" ], "header": "@@ -56,23 +56,30 @@ import org.apache.derby.iapi.services.sanity.SanityManager;", "removed": [ "\t// Types of changes that are possible. There are three", "\t//\t2. Type and/or value change:", "\t//\t3. Additional column(s):" ] }, { "added": [ "\t\tchangeMap.put(\"getCrossReference\",", "\t\t\tnew Byte(WHERE_CLAUSE_CHANGE));", "" ], "header": "@@ -211,6 +218,9 @@ public class ODBCMetadataGenerator {", "removed": [] }, { "added": [ "\t\t// -- #2: Change WHERE clause.", "\t\tif (changeWhereClause(queryName, queryText)) haveODBCChanges = true;", "" ], "header": "@@ -351,6 +361,9 @@ public class ODBCMetadataGenerator {", "removed": [] }, { "added": [ "\t\t// -- #3.A: Prep to add new ODBC columns. Note: we need" ], "header": "@@ -361,7 +374,7 @@ public class ODBCMetadataGenerator {", "removed": [ "\t\t// -- #2.A: Prep to add new ODBC columns. Note: we need" ] }, { "added": [ "\t\t// -- #4: Alter column values, where needed.", "\t\t// -- #3.B: Add new ODBC columns." ], "header": "@@ -370,10 +383,10 @@ public class ODBCMetadataGenerator {", "removed": [ "\t\t// -- #3: Alter column values, where needed.", "\t\t// -- #2.B: Add new ODBC columns." ] }, { "added": [ "", "\t\t\tif (orderBy.length() != 0) {", "\t\t\t\t// re-attach ORDER BY clause.", "\t\t\t\todbcMetaFile.write(orderBy);", "\t\t\t}", "" ], "header": "@@ -392,6 +405,12 @@ public class ODBCMetadataGenerator {", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/jdbc/EmbedDatabaseMetaData.java", "hunks": [ { "added": [ "", "\t\tif (primaryTable == null || foreignTable == null) {", "\t\t\tthrow Util.generateCsSQLException(", "\t\t\t\t\t\t\tSQLState.TABLE_NAME_CANNOT_BE_NULL);", "\t\t}", "", "\t\ts.setString(3, primaryTable); //JDBC spec: must match table name as stored", "\t\ts.setString(6, foreignTable); //JDBC spec: must match table name as stored", " /**", " * In contrast to the JDBC version of getCrossReference, this", " * method allows null values for table names.", " */", " public ResultSet getCrossReferenceForODBC(", " String primaryCatalog, String primarySchema, String primaryTable,", " String foreignCatalog, String foreignSchema, String foreignTable)", " throws SQLException {", "", " PreparedStatement s = getPreparedQuery(\"odbc_getCrossReference\");", " s.setString(1, swapNull(primaryCatalog));", " s.setString(2, swapNull(primarySchema));", " s.setString(3, swapNull(primaryTable));", " s.setString(4, swapNull(foreignCatalog));", " s.setString(5, swapNull(foreignSchema));", " s.setString(6, swapNull(foreignTable));", " return s.executeQuery();", " }", "" ], "header": "@@ -2602,16 +2602,41 @@ public class EmbedDatabaseMetaData extends ConnectionChild", "removed": [ "\t\ts.setString(3, swapNull(primaryTable));", "\t\ts.setString(6, swapNull(foreignTable));" ] } ] } ]
derby-DERBY-276-ff0fafb5
DERBY-276 The functionality of next,previous,first,last,beforeFirst,afterLast,relative and absolute should be aligned with ch. 14.2.2 in the JDBC 3.0 spec. Another issue found: absolute(0) should behave like beforeFirst(). Patch contributed by Bernt Marius Johnsen - Bernt.Johnsen@Sun.COM git-svn-id: https://svn.apache.org/repos/asf/incubator/derby/code/trunk@208683 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/execute/ScrollInsensitiveResultSet.java", "hunks": [ { "added": [ " // Absolute 0 is defined to be before first!", " setBeforeFirstRow();", " return null;" ], "header": "@@ -232,10 +232,11 @@ public class ScrollInsensitiveResultSet extends NoPutResultSetImpl", "removed": [ "\t\t// 0 is an invalid parameter", "\t\t\tthrow StandardException.newException(SQLState.LANG_ZERO_INVALID_FOR_R_S_ABSOLUTE);" ] } ] }, { "file": "java/tools/org/apache/derby/impl/tools/ij/utilMain.java", "hunks": [ { "added": [ "\t\t// 0 is an *VALID* value for row" ], "header": "@@ -693,12 +693,7 @@ public class utilMain implements java.security.PrivilegedAction {", "removed": [ "\t\t// 0 is an invalid value for row", "\t\tif (row == 0)", "\t\t{", "\t\t\tthrow ijException.zeroInvalidForAbsolute();", "\t\t}", "" ] } ] } ]
derby-DERBY-2760-88ff3fa9
DERBY-2760: Clean-up issues for UTF8Util.java. Added tests. Added internal result-holder class to UTF8Util. Patch-file: derby-2760-2b-inner_class.diff git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@605531 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/util/UTF8Util.java", "hunks": [ { "added": [], "header": "@@ -40,11 +40,6 @@ import java.io.UTFDataFormatException;", "removed": [ " /** Constant used to look up character count in an array. */", " private static final int CHAR_COUNT = 0;", " /** Constant used to look up byte count in an array. */", " private static final int BYTE_COUNT = 1;", "" ] }, { "added": [ " return internalSkip(in, Long.MAX_VALUE).charsSkipped();" ], "header": "@@ -61,7 +56,7 @@ public final class UTF8Util {", "removed": [ " return internalSkip(in, Long.MAX_VALUE)[CHAR_COUNT];" ] }, { "added": [ " SkipCount skipped = internalSkip(in, charsToSkip);", " if (skipped.charsSkipped() != charsToSkip) {", " \"character/byte position \" + skipped.charsSkipped() + \"/\" +", " skipped.bytesSkipped() + \", trying to skip \" + charsToSkip);", " return skipped.bytesSkipped();" ], "header": "@@ -77,13 +72,13 @@ public final class UTF8Util {", "removed": [ " long[] counts = internalSkip(in, charsToSkip);", " if (counts[CHAR_COUNT] != charsToSkip) {", " \"character/byte position \" + counts[CHAR_COUNT] + \"/\" +", " counts[BYTE_COUNT] + \", trying to skip \" + charsToSkip);", " return counts[BYTE_COUNT];" ] }, { "added": [ " private static final SkipCount internalSkip(final InputStream in,", " final long charsToSkip)" ], "header": "@@ -105,8 +100,8 @@ public final class UTF8Util {", "removed": [ " private static final long[] internalSkip(final InputStream in,", " final long charsToSkip)" ] }, { "added": [ " return new SkipCount(charsSkipped, bytesSkipped);" ], "header": "@@ -166,7 +161,7 @@ public final class UTF8Util {", "removed": [ " return new long[] {charsSkipped, bytesSkipped};" ] } ] }, { "file": "java/testing/org/apache/derbyTesting/unitTests/junit/_Suite.java", "hunks": [ { "added": [ " suite.addTest(UTF8UtilTest.suite());" ], "header": "@@ -48,6 +48,7 @@ public class _Suite extends BaseTestCase {", "removed": [] } ] } ]
derby-DERBY-2760-a8452cff
DERBY-2760: Clean-up issues for UTF8Util.java. Added a few more tests to improve test coverage. Patch file: derby-2760-3a-extra_tests.diff git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@616786 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2763-a8908bdc
DERBY-2763: Commit Narayanan's patch coordinating simultaneous reads and writes to a LOB. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@547382 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/client/org/apache/derby/client/am/Blob.java", "hunks": [ { "added": [ " //The Blob is locator enabled. Return a instance of the ", " //UpdateSensitive stream which wraps inside it a ", " //Buffered Locator stream. The wrapper watches out ", " //for updates.", " return new UpdateSensitiveBlobLocatorInputStream", " (agent_.connection_, this);" ], "header": "@@ -267,8 +267,12 @@ public class Blob extends Lob implements java.sql.Blob {", "removed": [ " return new BufferedInputStream(", " new BlobLocatorInputStream(agent_.connection_, this));" ] }, { "added": [ " //The Blob value has been", " //modified. Increment the", " //updateCount to reflect the", " //change.", " incrementUpdateCount();" ], "header": "@@ -487,6 +491,11 @@ public class Blob extends Lob implements java.sql.Blob {", "removed": [] }, { "added": [ " //The Blob value has been", " //updated Increment the", " //update count to reflect", " //the change.", " incrementUpdateCount();" ], "header": "@@ -562,6 +571,11 @@ public class Blob extends Lob implements java.sql.Blob {", "removed": [] } ] }, { "file": "java/client/org/apache/derby/client/am/BlobLocatorInputStream.java", "hunks": [ { "added": [ " ", " //In this case a subset of the Blob has", " //not been requested for. We set maxPos ", " //to -1 and instead will call ", " //blob.sqlLength() each time we want ", " //the maximum length.", " this.maxPos = -1;" ], "header": "@@ -66,7 +66,13 @@ public class BlobLocatorInputStream extends java.io.InputStream", "removed": [ " this.maxPos = blob.sqlLength();" ] }, { "added": [ " if (length != -1) {//verify if length is -1", " this.maxPos = Math.min(blob.sqlLength(), position + length - 1);", " }", " else {", " this.maxPos = -1;", " }" ], "header": "@@ -94,7 +100,12 @@ public class BlobLocatorInputStream extends java.io.InputStream", "removed": [ " this.maxPos = Math.min(blob.sqlLength(), position + length - 1);" ] } ] }, { "file": "java/client/org/apache/derby/client/am/Clob.java", "hunks": [ { "added": [ " //The Lob is locator enabled. Return an instance of the", " //update sensitive Reader that wraps inside it a", " //Buffered Locator Reader. The wrapper class", " //watches out for updates.", " return new UpdateSensitiveClobLocatorReader", " (agent_.connection_, this);" ], "header": "@@ -368,10 +368,12 @@ public class Clob extends Lob implements java.sql.Clob {", "removed": [ " //The Lob is locator enabled. Return an instance of the Locator", " //enabled Writer implementation", " return new BufferedReader", " (new ClobLocatorReader(agent_.connection_, this));" ] }, { "added": [ " //of the update sensitive wrappers that wrap inside", " //it a Buffered Locator enabled InputStream. The", " //wrapper watches out for updates to the underlying", " //Clob.", " return new UpdateSensitiveClobLocatorInputStream", " (agent_.connection_,this);" ], "header": "@@ -416,10 +418,12 @@ public class Clob extends Lob implements java.sql.Clob {", "removed": [ " //of the Locator enabled Clob specific InputStream", " //implementation.", " return new BufferedInputStream(", " new ClobLocatorInputStream(agent_.connection_,this));" ] }, { "added": [ " //The Clob value has been", " //updated. Increment the", " //update count.", " incrementUpdateCount();" ], "header": "@@ -662,6 +666,10 @@ public class Clob extends Lob implements java.sql.Clob {", "removed": [] }, { "added": [ " //The Clob value has been", " //modified. Increment the", " //update count.", " incrementUpdateCount();" ], "header": "@@ -781,6 +789,10 @@ public class Clob extends Lob implements java.sql.Clob {", "removed": [] } ] }, { "file": "java/client/org/apache/derby/client/am/ClobLocatorInputStream.java", "hunks": [ { "added": [], "header": "@@ -62,12 +62,6 @@ public class ClobLocatorInputStream extends java.io.InputStream {", "removed": [ " /**", " * Position in Clob where to stop reading.", " * maxPos starts counting from 1.", " */", " private final long maxPos;", "" ] }, { "added": [ " }", " ", " /**", " * Create an <code>InputStream</code> for reading the", " * <code>Clob</code> value represented by the given locator based", " * <code>Clob</code> object.", " * @param connection connection to be used to read the", " * <code>Clob</code> value from the server", " * @param clob <code>Clob</code> object that contains locator for", " * the <code>Clob</code> value on the server.", " * @param pos the position inside the <code>Clob<code> from which", " * the reading must begin.", " */", " public ClobLocatorInputStream(Connection connection, Clob clob, long pos)", " throws SqlException{", " this(connection, clob);", " this.currentPos = pos;" ], "header": "@@ -86,7 +80,23 @@ public class ClobLocatorInputStream extends java.io.InputStream {", "removed": [ " this.maxPos = clob.sqlLength();" ] } ] }, { "file": "java/client/org/apache/derby/client/am/ClobLocatorReader.java", "hunks": [ { "added": [ " ", " //In this case a subset of the Clob has", " //not been requested for. We set maxPos ", " //to -1 and instead will call ", " //clob.sqlLength() each time we want ", " //the maximum length.", " this.maxPos = -1;" ], "header": "@@ -84,7 +84,13 @@ public class ClobLocatorReader extends java.io.Reader {", "removed": [ " this.maxPos = clob.sqlLength();" ] }, { "added": [ " if(len != -1) {", " this.maxPos = Math.min(clob.sqlLength(), pos + len - 1);", " }", " else {", " this.maxPos = -1;", " }" ], "header": "@@ -108,7 +114,12 @@ public class ClobLocatorReader extends java.io.Reader {", "removed": [ " this.maxPos = Math.min(clob.sqlLength(), pos + len - 1);" ] } ] }, { "file": "java/client/org/apache/derby/client/am/Lob.java", "hunks": [ { "added": [ " ", " ", " //A running counter that keeps track", " //of whether a update has been done", " //on this LOB value. We do not need", " //to bother about the limit imposed", " //by this counter because we just check", " //whether its latest value matches hence", " //for all practical purposes there is no ", " //limit imposed.", " private long updateCount;" ], "header": "@@ -54,6 +54,17 @@ public abstract class Lob implements UnitOfWorkListener {", "removed": [] } ] } ]
derby-DERBY-2768-9484ceb2
DERBY-2768: Do cleanup (closing stmts., conns.) on failures in jdbcapi/BlobClob4BlobTest.java jdbcapi/BlobClob4BlobTest.java should cleanup when detecting failures ['fail("FAIL - ....");']. When failures occur, as when doing compatibility testing for Blob/Clob locator support, other failures will occur later. Missing cleanup makes subsequent tests fail. Contributed by Ole Solberg. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@544861 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2769-1e5b2aac
DERBY-2769 Implement error handling/parameter checking in Clob.setString Contributed by Yun Lee (yun dot lee dot bj at gmail dot com) git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@769948 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/client/org/apache/derby/client/am/Clob.java", "hunks": [ { "added": [ "", "", "import org.apache.derby.shared.common.reference.SQLState;" ], "header": "@@ -21,14 +21,13 @@", "removed": [ "import java.io.BufferedInputStream;", "import java.io.BufferedReader;", "import java.io.InputStream;", "import org.apache.derby.shared.common.reference.SQLState;" ] }, { "added": [ " ", " if (str == null) {", " throw new SqlException(agent_.logWriter_,", " new ClientMessageId(", " SQLState.BLOB_NULL_PATTERN_OR_SEARCH_STR));", " }", " ", " if (str.length() == 0) {", " return 0;", " }", " ", " if ((offset < 0) || offset >= str.length() ) {" ], "header": "@@ -625,7 +624,18 @@ public class Clob extends Lob implements java.sql.Clob {", "removed": [ " if ((offset < 0) || offset > str.length() ) {" ] } ] } ]
derby-DERBY-2770-5bb6623a
DERBY-2770: Fixed BlobClob4BlobTest from failing by changing the expected SQLState. Patch file: derby-2770-1a.diff git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@544856 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2770-855f0de6
DERBY-2770: testBlobAfterCommit(....jdbcapi.BlobClob4BlobTest) fails with 'Unexpected SQL state. expected:<XJ[073]> but was:<XJ[215]>' Changed error message to reflect that XJ215 is used both after free() has been called on a Lob and after the lob's transaction has been committed. Changed SQL state when locators are invalid from XJ073 to XJ215 on the client driver. Patch contributed by Øystein Grøvlen. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@545910 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2772-293a5e65
DERBY-2772 Add system procedure SYSCS_UTIL.SYSCS_EMPTY_STATEMENT_CACHE() that ages statements out of the cache. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@544993 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/catalog/SystemProcedures.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.services.cache.CacheManager;" ], "header": "@@ -39,6 +39,7 @@ import org.apache.derby.iapi.error.PublicAPI;", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/diag/StatementCache.java", "hunks": [ { "added": [ "import java.sql.ResultSetMetaData;", "import java.sql.SQLException;", "import java.sql.Timestamp;", "import java.sql.Types;", "import java.util.Collection;", "import java.util.Iterator;", "import java.util.Vector;", "import org.apache.derby.iapi.reference.Limits;", "import org.apache.derby.iapi.services.cache.CacheManager;", "import org.apache.derby.iapi.sql.ResultColumnDescriptor;", "import org.apache.derby.iapi.util.StringUtil;", "import org.apache.derby.impl.jdbc.EmbedResultSetMetaData;", "import org.apache.derby.vti.VTITemplate;" ], "header": "@@ -21,30 +21,25 @@", "removed": [ "import org.apache.derby.vti.VTITemplate;", "", "import org.apache.derby.iapi.sql.ResultColumnDescriptor;", "import org.apache.derby.impl.jdbc.EmbedResultSetMetaData;", "import org.apache.derby.iapi.reference.Limits;", "import org.apache.derby.iapi.util.StringUtil;", "", "import java.sql.Types;", "import java.sql.ResultSetMetaData;", "import java.sql.SQLException;", "import java.sql.Timestamp;", "", "", "", "import java.util.Vector;", "", "import java.util.Iterator;", "import java.util.Collection;" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java", "hunks": [ { "added": [ " // VARCHAR(128) SYSCS_UTIL.SYSCS_SET_USER_ACCESS(USER_NAME VARCHAR(128))" ], "header": "@@ -10740,8 +10740,7 @@ public final class\tDataDictionaryImpl", "removed": [ " // void SYSCS_UTIL.SYSCS_SET_USER_ACCESS(USER_NAME VARCHAR(128),", " // CONNECTION_PERMISSION VARCHAR(128))" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java", "hunks": [ { "added": [], "header": "@@ -254,9 +254,6 @@ public class GenericLanguageConnectionContext", "removed": [ "\t// temp public", "\tpublic CacheManager statementCache;", "" ] }, { "added": [], "header": "@@ -310,8 +307,6 @@ public class GenericLanguageConnectionContext", "removed": [ "\t\t", "\t\tstatementCache = lcf.getStatementCache();" ] }, { "added": [], "header": "@@ -409,17 +404,6 @@ public class GenericLanguageConnectionContext", "removed": [ "\t/*", "\t\tThe methods that follow are for consistency checking purposes", "\t */", "", "\tpublic int getCacheSize() {", "\t\tif (statementCache != null)", "\t\t\treturn statementCache.getNumberInUse();", "\t\telse", "\t\t\treturn 0;", "\t}", "" ] }, { "added": [ " ", " CacheManager statementCache =", " getLanguageConnectionFactory().getStatementCache();" ], "header": "@@ -855,6 +839,9 @@ public class GenericLanguageConnectionContext", "removed": [] }, { "added": [ " CacheManager statementCache =", " getLanguageConnectionFactory().getStatementCache();", " " ], "header": "@@ -875,7 +862,9 @@ public class GenericLanguageConnectionContext", "removed": [ "" ] } ] } ]
derby-DERBY-2775-01b59615
DERBY-2775 DERBY-2917 (partial) Remove final set method (setCollationType) on TypeDescriptor to make TypeDescriptor and DataTypeDescriptor logically immutable. Required cleanup to ensure that a routine definition is only passed catalog types (TypeDescriptor) and also resulted in a cleanup of CreateAliasNode by encapsulating collation changes within the type system and RoutineAliasInfo. Also required that the tyep system use a valid JDBC Types constant for the XML type, using the Types.SQLXML from JDBC4. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@617665 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/catalog/types/BaseTypeIdImpl.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.reference.JDBC40Translation;" ], "header": "@@ -35,6 +35,7 @@ import org.apache.derby.iapi.services.io.StreamStorable;", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/catalog/types/RoutineAliasInfo.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.types.DataTypeDescriptor;" ], "header": "@@ -32,6 +32,7 @@ import java.io.IOException;", "removed": [] }, { "added": [ " /**", " * Types of the parameters. If there are no parameters", " * then this may be null (or a zero length array).", " */" ], "header": "@@ -57,6 +58,10 @@ public class RoutineAliasInfo extends MethodAliasInfo", "removed": [] }, { "added": [ " SanityManager.ASSERT(!(returnType instanceof DataTypeDescriptor));" ], "header": "@@ -156,6 +161,7 @@ public class RoutineAliasInfo extends MethodAliasInfo", "removed": [] }, { "added": [ " /**", " * Types of the parameters. If there are no parameters", " * then this may return null (or a zero length array).", " */" ], "header": "@@ -172,6 +178,10 @@ public class RoutineAliasInfo extends MethodAliasInfo", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/iapi/types/DataTypeDescriptor.java", "hunks": [ { "added": [ " ", " /**", " * Get a catlog type identical to the passed in type exception", " * that the collationType is set to the passed in value.", " * @param catalogType Type to be based upon.", " * @param collationType Collation type of returned type.", " * ", " * @return catalogType if it already has the correct collation,", " * otherwise a new TypeDescriptor with the correct collation.", " */", " public static TypeDescriptor getCatalogType(TypeDescriptor catalogType,", " int collationType)", " {", " if (catalogType.isRowMultiSet())", " return getRowMultiSetCollation(catalogType, collationType);", " ", " if (catalogType.getCollationType() == collationType)", " return catalogType;", " ", " // Create through a runtime type, derivation will be thrown away.", " return getType(catalogType).getCollatedType(collationType,", " StringDataValue.COLLATION_DERIVATION_IMPLICIT).getCatalogType();", " }" ], "header": "@@ -151,6 +151,29 @@ public final class DataTypeDescriptor implements TypeDescriptor, Formatable", "removed": [] }, { "added": [ " public static TypeDescriptor getRowMultiSet(String[] columnNames,", " TypeDescriptor[] catalogTypes)", " {" ], "header": "@@ -330,16 +353,9 @@ public final class DataTypeDescriptor implements TypeDescriptor, Formatable", "removed": [ "\tpublic static TypeDescriptor getRowMultiSet", "\t(", "\t\tString[]\t columnNames,", "\t\tDataTypeDescriptor[]\ttypes", "\t)", "\t{", " TypeDescriptor[] catalogTypes =", " new TypeDescriptor[types.length];", " for (int i = 0; i < types.length; i++)", " catalogTypes[i] = types[i].getCatalogType();" ] }, { "added": [ " * taken from the passed in information. If the type", " * does not represent a string type then the collation", " * will be unchanged and this is returned.", " * ", " { ", " if (!typeDescriptor.isStringType())", " return this;", " " ], "header": "@@ -1140,12 +1156,18 @@ public final class DataTypeDescriptor implements TypeDescriptor, Formatable", "removed": [ " * taken from the passed in information.", " {" ] } ] }, { "file": "java/engine/org/apache/derby/iapi/types/DataTypeUtilities.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.reference.JDBC40Translation;" ], "header": "@@ -24,6 +24,7 @@ package org.apache.derby.iapi.types;", "removed": [] }, { "added": [ "\t\tcase JDBC40Translation.SQLXML:" ], "header": "@@ -51,7 +52,7 @@ public abstract class DataTypeUtilities {", "removed": [ "\t\tcase StoredFormatIds.XML_TYPE_ID:" ] } ] }, { "file": "java/engine/org/apache/derby/iapi/types/TypeId.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.reference.JDBC40Translation;" ], "header": "@@ -44,6 +44,7 @@ import org.apache.derby.iapi.types.*;", "removed": [] }, { "added": [ " case JDBC40Translation.SQLXML:" ], "header": "@@ -411,7 +412,7 @@ public final class TypeId implements Formatable", "removed": [ " case StoredFormatIds.XML_TYPE_ID:" ] } ] }, { "file": "java/engine/org/apache/derby/impl/load/ColumnInfo.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.reference.JDBC40Translation;" ], "header": "@@ -21,6 +21,7 @@", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/BinaryOperatorNode.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.reference.JDBC40Translation;" ], "header": "@@ -42,6 +42,7 @@ import org.apache.derby.iapi.types.SqlXmlUtil;", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/CreateAliasNode.java", "hunks": [ { "added": [], "header": "@@ -262,73 +262,6 @@ public class CreateAliasNode extends DDLStatementNode", "removed": [ "\t", "\t/**", "\t * Take the passed TypeDescriptor and check if it corresponds to a ", "\t * character string type. If yes, then create a new one based on it's ", "\t * typeid, length and nullability to create a new DataTypeDescriptor and ", "\t * then have it take the collation type of the schema in which the method ", "\t * is getting defined in. This is because all the character strings ", "\t * associated with the definition of the user defined function/procedure ", "\t * should take the collation of the schema in which this user defined ", "\t * function is getting created.", "\t * ", "\t * @param changeTD TypeDescriptor with incorrect collation setting", "\t * @return New TypeDescriptor with collation of the schema in which ", "\t * the function/procedure is getting created.", "\t * @throws StandardException", "\t */", "\tprivate TypeDescriptor typeDescriptorWithCorrectCollation(TypeDescriptor changeTD)", "\tthrows StandardException {", "\t\t//We could have been called for the return type but for procedures ", "\t\t//there is no return type and hence we should be careful that we", "\t\t//don't run into null ptr exception. So before doing anything, check if", "\t\t//the passed parameter is null and if so, then simply return.", "\t\tif (changeTD == null) ", "\t\t\treturn changeTD;", " ", "\t\tTypeId compTypeId = TypeId.getBuiltInTypeId(changeTD.getTypeName());", "\t\t//No work to do if type id does not correspond to a character string", "\t\tif (compTypeId != null && compTypeId.isStringTypeId()) {", "\t\t\tDataTypeDescriptor newTDWithCorrectCollation = ", "\t\t\t\tnew DataTypeDescriptor(compTypeId, ", "\t\t\t\t\t\tchangeTD.isNullable(),", "\t\t\t\t\t\tchangeTD.getMaximumWidth());", "\t\t\t//Use the collation type and info of the schema in which this", "\t\t\t//function is defined for the return value of the function", " newTDWithCorrectCollation =", " newTDWithCorrectCollation.getCollatedType(", "\t\t\t\t\tgetSchemaDescriptor().getCollationType(),", " StringDataValue.COLLATION_DERIVATION_IMPLICIT);", "\t\t\treturn newTDWithCorrectCollation.getCatalogType();", "\t\t}", "\t\treturn changeTD;", "\t}", "\t", "\t/**", "\t * Set the collation of the columns in a Table Function's returned row set.", "\t */", "\tprivate void setTableFunctionCollations()", " throws StandardException", " {", "\t\tif ( aliasInfo.isTableFunction() )", " {", " RoutineAliasInfo info = (RoutineAliasInfo) aliasInfo;", " TypeDescriptor[] types = info.getReturnType().getRowTypes();", "", " SchemaDescriptor sd = getSchemaDescriptor();", "", " for ( int i = 0; i < types.length; i++ )", " {", " TypeDescriptorImpl tdi = (TypeDescriptorImpl) types[ i ];", " if ( tdi.isStringType() )", " {", " tdi.setCollationType( sd.getCollationType() );", " }", " }", " }", "", " }" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/QueryTreeNode.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.reference.JDBC40Translation;" ], "header": "@@ -27,6 +27,7 @@ import org.apache.derby.catalog.AliasInfo;", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/TypeCompilerFactoryImpl.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.reference.JDBC40Translation;" ], "header": "@@ -29,6 +29,7 @@ import org.apache.derby.iapi.services.sanity.SanityManager;", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/UnaryOperatorNode.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.reference.JDBC40Translation;" ], "header": "@@ -28,6 +28,7 @@ import org.apache.derby.iapi.sql.compile.Visitor;", "removed": [] } ] } ]
derby-DERBY-2775-2afe5788
DERBY-2775 Add some comments to the main type classes to indicate their roles: TypeId Information about the type without specific attributes TypeDescriptor Catalog type descriptor DataTypeDescriptor Runtime type descriptor git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@555028 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/catalog/types/BaseTypeIdImpl.java", "hunks": [ { "added": [ " ", " private int formatId;", " /**", " * JDBC type - derived from the format identifier.", " */", " transient int JDBCTypeId;", "", " private int wrapperTypeFormatId;" ], "header": "@@ -69,11 +69,16 @@ public class BaseTypeIdImpl implements Formatable", "removed": [ " int JDBCTypeId;", " int formatId;", " int wrapperTypeFormatId;" ] } ] }, { "file": "java/engine/org/apache/derby/catalog/types/DecimalTypeIdImpl.java", "hunks": [ { "added": [ "\tpublic DecimalTypeIdImpl(boolean isNumeric) ", " if (isNumeric)", " setNumericType();" ], "header": "@@ -34,9 +34,11 @@ public class DecimalTypeIdImpl extends BaseTypeIdImpl", "removed": [ "\tpublic DecimalTypeIdImpl() " ] } ] }, { "file": "java/engine/org/apache/derby/iapi/types/DataTypeDescriptor.java", "hunks": [ { "added": [ " * DataTypeDescriptor describes a runtime SQL type." ], "header": "@@ -39,10 +39,7 @@ import org.apache.derby.iapi.services.sanity.SanityManager;", "removed": [ " * This is an implementation of DataTypeDescriptor from the generic language", " * datatype module interface.", " *", " * @version 1.0" ] }, { "added": [ " ", " public static final DataTypeDescriptor INTEGER = new DataTypeDescriptor(TypeId.INTEGER_ID, true);", "\t * Get a descriptor that corresponds to a nullable builtin JDBC type." ], "header": "@@ -60,12 +57,14 @@ public final class DataTypeDescriptor implements TypeDescriptor, Formatable", "removed": [ "\t * Get a descriptor that corresponds to a builtin JDBC type." ] } ] }, { "file": "java/engine/org/apache/derby/iapi/types/TypeId.java", "hunks": [ { "added": [ " * TypeId describes the static information about a SQL type", " * independent of any specific attributes of the type such", " * as length. So the TypeId for CHARACTER describes the", " * fundamental information about CHARACTER. A specific", " * type (e.g. CHARACTER(10)) is described by a DataTypeDescriptor.", "", " @see DataTypeDescriptor" ], "header": "@@ -48,13 +48,17 @@ import org.apache.derby.iapi.reference.JDBC30Translation;", "removed": [ " * The TypeId interface provides methods to get information about datatype ids.", " ", " *" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java", "hunks": [ { "added": [ " TypeDescriptor integerType = DataTypeDescriptor.INTEGER.getCatalogType();", " TypeDescriptor varchar128Type =", " DataTypeDescriptor.getBuiltInDataTypeDescriptor(Types.VARCHAR, 128).getCatalogType();" ], "header": "@@ -8740,6 +8740,9 @@ public final class\tDataDictionaryImpl", "removed": [] }, { "added": [ " varchar128Type," ], "header": "@@ -8760,8 +8763,7 @@ public final class\tDataDictionaryImpl", "removed": [ " DataTypeDescriptor.getBuiltInDataTypeDescriptor(", " Types.VARCHAR, 128)," ] }, { "added": [ " varchar128Type,", " varchar128Type," ], "header": "@@ -8786,10 +8788,8 @@ public final class\tDataDictionaryImpl", "removed": [ " DataTypeDescriptor.getBuiltInDataTypeDescriptor(", " Types.VARCHAR, 128),", " DataTypeDescriptor.getBuiltInDataTypeDescriptor(", " Types.VARCHAR, 128)," ] }, { "added": [ " varchar128Type" ], "header": "@@ -8989,8 +8989,7 @@ public final class\tDataDictionaryImpl", "removed": [ " DataTypeDescriptor.getBuiltInDataTypeDescriptor(", " Types.VARCHAR, 128)" ] }, { "added": [ " varchar128Type,", " varchar128Type" ], "header": "@@ -9013,10 +9012,8 @@ public final class\tDataDictionaryImpl", "removed": [ " DataTypeDescriptor.getBuiltInDataTypeDescriptor(", " Types.VARCHAR, 128),", " DataTypeDescriptor.getBuiltInDataTypeDescriptor(", " Types.VARCHAR, 128)" ] }, { "added": [ " varchar128Type,", " integerType" ], "header": "@@ -9073,10 +9070,8 @@ public final class\tDataDictionaryImpl", "removed": [ " DataTypeDescriptor.getBuiltInDataTypeDescriptor(", " Types.VARCHAR, 128),", "\t\t\t\tDataTypeDescriptor.getBuiltInDataTypeDescriptor(", " Types.INTEGER)" ] }, { "added": [ " varchar128Type" ], "header": "@@ -9098,8 +9093,7 @@ public final class\tDataDictionaryImpl", "removed": [ " DataTypeDescriptor.getBuiltInDataTypeDescriptor(", " Types.VARCHAR, 128)" ] }, { "added": [ " varchar128Type,", " integerType" ], "header": "@@ -9119,10 +9113,8 @@ public final class\tDataDictionaryImpl", "removed": [ "\t\t\t\tDataTypeDescriptor.getBuiltInDataTypeDescriptor(", " Types.VARCHAR, 128),", " DataTypeDescriptor.getBuiltInDataTypeDescriptor(", " Types.INTEGER)" ] }, { "added": [ " varchar128Type, ", " varchar128Type,", " varchar128Type" ], "header": "@@ -9152,18 +9144,15 @@ public final class\tDataDictionaryImpl", "removed": [ " DataTypeDescriptor.getBuiltInDataTypeDescriptor(", "\t\t\t\tTypes.VARCHAR, 128), ", "\t\t\t\tDataTypeDescriptor.getBuiltInDataTypeDescriptor(", "\t\t\t\tTypes.VARCHAR, 128),", "\t\t\t\tDataTypeDescriptor.getBuiltInDataTypeDescriptor(", "\t\t\t\tTypes.VARCHAR, 128)" ] }, { "added": [ " varchar128Type" ], "header": "@@ -9200,8 +9189,7 @@ public final class\tDataDictionaryImpl", "removed": [ "\t\t\t\tDataTypeDescriptor.getBuiltInDataTypeDescriptor(", "\t\t\t\tTypes.VARCHAR, 128)" ] }, { "added": [ " varchar128Type, ", " varchar128Type,", " varchar128Type," ], "header": "@@ -9232,18 +9220,15 @@ public final class\tDataDictionaryImpl", "removed": [ " DataTypeDescriptor.getBuiltInDataTypeDescriptor(", "\t\t\t\tTypes.VARCHAR, 128), ", "\t\t\t\tDataTypeDescriptor.getBuiltInDataTypeDescriptor(", "\t\t\t\tTypes.VARCHAR, 128),", "\t\t\t\tDataTypeDescriptor.getBuiltInDataTypeDescriptor(", "\t\t\t\tTypes.VARCHAR,\t128)," ] }, { "added": [ " varchar128Type, ", " varchar128Type," ], "header": "@@ -9278,10 +9263,8 @@ public final class\tDataDictionaryImpl", "removed": [ " DataTypeDescriptor.getBuiltInDataTypeDescriptor(", "\t\t\t\tTypes.VARCHAR, 128), ", "\t\t\t\tDataTypeDescriptor.getBuiltInDataTypeDescriptor(", "\t\t\t\tTypes.VARCHAR, 128)," ] }, { "added": [ " varchar128Type," ], "header": "@@ -9292,8 +9275,7 @@ public final class\tDataDictionaryImpl", "removed": [ "\t\t\t\tDataTypeDescriptor.getBuiltInDataTypeDescriptor(", "\t\t\t\tTypes.VARCHAR,\t128)," ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/catalog/SYSCOLUMNSRowFactory.java", "hunks": [ { "added": [ "import java.util.Properties;", "import org.apache.derby.catalog.UUID;", "import org.apache.derby.catalog.types.DefaultInfoImpl;", "import org.apache.derby.catalog.types.TypeDescriptorImpl;", "import org.apache.derby.iapi.error.StandardException;", "import org.apache.derby.iapi.reference.Property;", "import org.apache.derby.iapi.services.monitor.Monitor;", "import org.apache.derby.iapi.services.sanity.SanityManager;", "import org.apache.derby.iapi.services.uuid.UUIDFactory;", "import org.apache.derby.iapi.sql.dictionary.SystemColumn;", "import org.apache.derby.iapi.sql.execute.ExecutionFactory;", "import org.apache.derby.iapi.store.raw.RawStoreFactory;", "import org.apache.derby.iapi.types.DataTypeDescriptor;", "import org.apache.derby.iapi.types.DataValueDescriptor;", "import org.apache.derby.iapi.types.DataValueFactory;", "import org.apache.derby.iapi.types.SQLChar;", "import org.apache.derby.iapi.types.SQLInteger;", "import org.apache.derby.iapi.types.SQLLongint;", "import org.apache.derby.iapi.types.SQLVarchar;", "import org.apache.derby.iapi.types.TypeId;" ], "header": "@@ -21,61 +21,38 @@", "removed": [ "import org.apache.derby.iapi.reference.Property;", "", "import org.apache.derby.iapi.types.DataTypeDescriptor;", "import org.apache.derby.iapi.types.TypeId;", "import org.apache.derby.iapi.types.DataValueDescriptor;", "", "import org.apache.derby.iapi.store.raw.RawStoreFactory;", "import org.apache.derby.iapi.types.DataValueFactory;", "import org.apache.derby.iapi.sql.dictionary.SystemColumn;", "", "import org.apache.derby.iapi.types.DataValueDescriptor;", "", "import org.apache.derby.iapi.types.SQLVarchar;", "import org.apache.derby.iapi.types.TypeId;", "import org.apache.derby.iapi.types.DataTypeDescriptor;", "import org.apache.derby.iapi.types.DataValueFactory;", "import org.apache.derby.iapi.types.RowLocation;", "", "import org.apache.derby.iapi.sql.dictionary.TableDescriptor;", "import org.apache.derby.iapi.sql.dictionary.SchemaDescriptor;", "", "import org.apache.derby.iapi.sql.execute.ExecutionContext;", "import org.apache.derby.iapi.sql.execute.ExecutionFactory;", "import org.apache.derby.iapi.sql.execute.ExecIndexRow;", "", "import org.apache.derby.iapi.error.StandardException;", "", "import org.apache.derby.iapi.services.sanity.SanityManager;", "", "import org.apache.derby.iapi.services.monitor.Monitor;", "import org.apache.derby.catalog.types.TypeDescriptorImpl;", "import org.apache.derby.catalog.DefaultInfo;", "import org.apache.derby.iapi.services.uuid.UUIDFactory;", "import org.apache.derby.catalog.UUID;", "", "import org.apache.derby.catalog.types.DefaultInfoImpl;", "", "import org.apache.derby.iapi.types.*;", "", "import java.io.Serializable;", "", "import java.util.Properties;", "" ] }, { "added": [ "\t\tTypeDescriptor \t\t typeDesc = null;" ], "header": "@@ -182,13 +159,12 @@ public class SYSCOLUMNSRowFactory extends CatalogRowFactory", "removed": [ "\t\tDataValueDescriptor\t\tcol;", "\t\tTypeDescriptorImpl\t\ttypeDesc = null;" ] }, { "added": [], "header": "@@ -354,8 +330,6 @@ public class SYSCOLUMNSRowFactory extends CatalogRowFactory", "removed": [ "\t\tBaseTypeIdImpl\t\ttypeId;", "\t\tTypeId\twrapperTypeId;" ] }, { "added": [ " BaseTypeIdImpl typeId = typeDescriptor.getTypeId();", " TypeId wrapperTypeId = new TypeId(typeId.wrapperTypeFormatId(), typeId);" ], "header": "@@ -430,16 +404,13 @@ public class SYSCOLUMNSRowFactory extends CatalogRowFactory", "removed": [ "\t\ttypeId = typeDescriptor.getTypeId();", "\t\twrapperTypeId =", "\t\t\t(TypeId) Monitor.newInstanceFromIdentifier(typeId.wrapperTypeFormatId());", "\t\t/* Wrap the BaseTypeIdImpl in a full type id */", "\t\twrapperTypeId.setNestedTypeId(typeId);" ] } ] } ]
derby-DERBY-2775-32812bde
DERBY-2775 (partial) Add getNullabilityType() method to DataTypeDescriptor to return a DataTypeDescriptor with the nullability changed. Returns the same object if the nullability would be unchanged. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@545609 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/types/DataTypeDescriptor.java", "hunks": [ { "added": [ " " ], "header": "@@ -252,6 +252,7 @@ public final class DataTypeDescriptor implements TypeDescriptor, Formatable", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/SubqueryNode.java", "hunks": [ { "added": [ "\t\tsetType(dts.getNullabilityType(true));" ], "header": "@@ -2275,14 +2275,7 @@ public class SubqueryNode extends ValueNode", "removed": [ "\t\t/* If datatype of underlying resultSet is nullable, reuse it, otherwise", "\t\t * we need to generate a new one.", "\t\t */", "\t\tif (! dts.isNullable())", "\t\t{", "\t\t\tdts = new DataTypeDescriptor(dts, true);", "\t\t}", "\t\tsetType(dts);" ] } ] } ]
derby-DERBY-2775-7a361f26
DERBY-2775 Remove last use of DataTypeDescriptor.setNullability() to make DTD's use immutable wrt nullability. Fixes DERBY-3346 and DERBY-3342 which were cases when a query was getting the incorrect nullability for some columns due to the mutability of DTD when shared across nodes. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@616853 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2775-7dda5d5a
DERBY-2775 Change ColumnDefinition to have a getType() method and a setNullability() method to move towards having an immutable DataTypeDescriptor. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@554824 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/compile/ColumnDefinitionNode.java", "hunks": [ { "added": [ " DataTypeDescriptor type;" ], "header": "@@ -70,7 +70,7 @@ public class ColumnDefinitionNode extends TableElementNode", "removed": [ " DataTypeDescriptor\t\t\tdataTypeServices;" ] }, { "added": [ "\t\tthis.type = (DataTypeDescriptor) dataTypeServices;" ], "header": "@@ -117,7 +117,7 @@ public class ColumnDefinitionNode extends TableElementNode", "removed": [ "\t\tthis.dataTypeServices = (DataTypeDescriptor) dataTypeServices;" ] }, { "added": [ "\t\t\t\t\t\t\t\t\tconvertDefaultNode(this.type);" ], "header": "@@ -125,7 +125,7 @@ public class ColumnDefinitionNode extends TableElementNode", "removed": [ "\t\t\t\t\t\t\t\t\tconvertDefaultNode(this.dataTypeServices);" ] }, { "added": [ " setNullability(false);" ], "header": "@@ -165,7 +165,7 @@ public class ColumnDefinitionNode extends TableElementNode", "removed": [ " this.dataTypeServices = getDataTypeServices().getNullabilityType(false);" ] }, { "added": [ "\t\t\treturn \"type: \" + getType().toString() + \"\\n\" +" ], "header": "@@ -181,7 +181,7 @@ public class ColumnDefinitionNode extends TableElementNode", "removed": [ "\t\t\treturn \"dataTypeServices: \" + dataTypeServices.toString() + \"\\n\" +" ] }, { "added": [ "\t * Returns the data type of the column being defined.", "\t * @return\tthe data type of the column", "\tpublic final DataTypeDescriptor getType()", "\t\treturn type;", " ", " /**", " * Set the nullability of the column definition node.", " */", " void setNullability(boolean nullable)", " {", " type = getType().getNullabilityType(nullable);", " }" ], "header": "@@ -202,14 +202,22 @@ public class ColumnDefinitionNode extends TableElementNode", "removed": [ "\t * Returns the data type services of the column being defined.", "\t * @return\tthe data type services of the column", "\tpublic final DataTypeDescriptor getDataTypeServices()", "\t\treturn this.dataTypeServices;" ] }, { "added": [ "\t\tif (!getType().getTypeId().userType())", "\t\t\tgetType().getTypeId().getCorrespondingJavaTypeName();" ], "header": "@@ -338,13 +346,13 @@ public class ColumnDefinitionNode extends TableElementNode", "removed": [ "\t\tif (!dataTypeServices.getTypeId().userType())", "\t\t\tdataTypeServices.getTypeId().getCorrespondingJavaTypeName();" ] }, { "added": [ "\t\tif (td != null && !getType().isNullable() && defaultNode == null)" ], "header": "@@ -410,7 +418,7 @@ public class ColumnDefinitionNode extends TableElementNode", "removed": [ "\t\tif (td != null && !dataTypeServices.isNullable() && defaultNode == null)" ] }, { "added": [ "\t\tint jdbctype = getType().getTypeId().getJDBCTypeId();" ], "header": "@@ -464,7 +472,7 @@ public class ColumnDefinitionNode extends TableElementNode", "removed": [ "\t\tint jdbctype = dataTypeServices.getTypeId().getJDBCTypeId();" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/ModifyColumnNode.java", "hunks": [ { "added": [ " setNullability(oldType.isNullable());", "\t\tif (!(oldType.getTypeId().equals(getType().getTypeId())))", "\t\tString typeName = getType().getTypeName();" ], "header": "@@ -103,18 +103,17 @@ public class ModifyColumnNode extends ColumnDefinitionNode", "removed": [ " dataTypeServices = ", " getDataTypeServices().getNullabilityType(oldType.isNullable());", "\t\tif (!(oldType.getTypeId().equals(getDataTypeServices().getTypeId())))", "\t\tString typeName = getDataTypeServices().getTypeName();" ] }, { "added": [ "\t\tif (getType().getMaximumWidth() < oldType.getMaximumWidth())" ], "header": "@@ -124,7 +123,7 @@ public class ModifyColumnNode extends ColumnDefinitionNode", "removed": [ "\t\tif (getDataTypeServices().getMaximumWidth() < oldType.getMaximumWidth())" ] }, { "added": [ "\t\ttype = cd.getType();" ], "header": "@@ -302,7 +301,7 @@ public class ModifyColumnNode extends ColumnDefinitionNode", "removed": [ "\t\tdataTypeServices = cd.getType();" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/TableElementList.java", "hunks": [ { "added": [ "\t\t\t\t\t(cdn.getType().getTypeId().isLongConcatableTypeId() ||", "\t\t\t\t\tcdn.getType().getTypeId().isUserDefinedTypeId()))" ], "header": "@@ -165,8 +165,8 @@ public class TableElementList extends QueryTreeNodeVector", "removed": [ "\t\t\t\t\t(cdn.getDataTypeServices().getTypeId().isLongConcatableTypeId() ||", "\t\t\t\t\tcdn.getDataTypeServices().getTypeId().isUserDefinedTypeId()))" ] }, { "added": [ "\t\t\t\t\t\t\t coldef.getType()," ], "header": "@@ -399,7 +399,7 @@ public class TableElementList extends QueryTreeNodeVector", "removed": [ "\t\t\t\t\t\t\t coldef.getDataTypeServices()," ] }, { "added": [ "\t\t\t\t\t\t\t\t\t\t\tcdn.getType(),", "\t\t\t\t\t\t\t\t\t\t\t\tcdn.getType(), " ], "header": "@@ -449,12 +449,12 @@ public class TableElementList extends QueryTreeNodeVector", "removed": [ "\t\t\t\t\t\t\t\t\t\t\tcdn.getDataTypeServices(),", "\t\t\t\t\t\t\t\t\t\t\t\tcdn.getDataTypeServices(), " ] }, { "added": [ " return cdn.getType();" ], "header": "@@ -938,7 +938,7 @@ public class TableElementList extends QueryTreeNodeVector", "removed": [ " return cdn.getDataTypeServices();" ] } ] } ]
derby-DERBY-2775-81de1884
DERBY-2775 (partial) Remove the setCollation methods from TypeDescriptor as it presents a read-only view of a type. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@545579 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/catalog/TypeDescriptor.java", "hunks": [ { "added": [], "header": "@@ -159,16 +159,6 @@ public interface TypeDescriptor", "removed": [ "\t/**", "\t * Set the collation type of this TypeDescriptor", "\t * @param collationTypeValue This will be COLLATION_TYPE_UCS_BASIC", " * or COLLATION_TYPE_TERRITORY_BASED", " * ", " * @see StringDataValue#COLLATION_TYPE_UCS_BASIC", " * @see StringDataValue#COLLATION_TYPE_TERRITORY_BASED", "\t */", "\tpublic void setCollationType(int collationTypeValue);", "" ] } ] }, { "file": "java/engine/org/apache/derby/iapi/types/DataTypeDescriptor.java", "hunks": [ { "added": [ "import java.io.IOException;", "import java.io.ObjectInput;", "import java.io.ObjectOutput;", "import java.sql.Types;", "import java.text.RuleBasedCollator;", "import org.apache.derby.iapi.reference.SQLState;", "import org.apache.derby.iapi.services.io.Formatable;", "import org.apache.derby.iapi.services.io.StoredFormatIds;", "import org.apache.derby.iapi.services.sanity.SanityManager;" ], "header": "@@ -21,38 +21,23 @@", "removed": [ "import org.apache.derby.iapi.services.io.Formatable;", "import org.apache.derby.iapi.error.StandardException;", "import org.apache.derby.iapi.services.loader.ClassFactory;", "", "import org.apache.derby.iapi.services.sanity.SanityManager;", "", "import org.apache.derby.iapi.services.io.StoredFormatIds;", "import org.apache.derby.iapi.services.io.FormatIdUtil;", "import org.apache.derby.iapi.services.io.Formatable;", "", "", "import org.apache.derby.iapi.types.RowLocation;", "", "import java.text.RuleBasedCollator;", "", "import org.apache.derby.iapi.reference.JDBC30Translation;", "import org.apache.derby.iapi.reference.SQLState;", "", "import java.io.ObjectOutput;", "import java.io.ObjectInput;", "import java.io.IOException;", "", "import java.sql.Types;", "" ] }, { "added": [ " /**", " * Set the collation type of this TypeDescriptor", " * @param collationTypeValue This will be COLLATION_TYPE_UCS_BASIC", " * or COLLATION_TYPE_TERRITORY_BASED", " * ", " * @see StringDataValue#COLLATION_TYPE_UCS_BASIC", " * @see StringDataValue#COLLATION_TYPE_TERRITORY_BASED", " */", " public void\tsetCollationType(int collationTypeValue)" ], "header": "@@ -868,8 +853,15 @@ public final class DataTypeDescriptor implements TypeDescriptor, Formatable", "removed": [ "\t/** @see TypeDescriptor#setCollationType(int) */", "\tpublic void\tsetCollationType(int collationTypeValue)" ] }, { "added": [ " /**", " * Set the collation derivation of this DTD", " * @param collationDerivationValue This will be ", " * COLLATION_DERIVATION_NONE/COLLATION_DERIVATION_IMPLICIT/COLLATION_DERIVATION_EXPLICIT", " * In Derby 10.3, we do not expect to get value COLLATION_DERIVATION_EXPLICIT.", " * ", " * @see StringDataValue#COLLATION_DERIVATION_NONE", " * @see StringDataValue#COLLATION_DERIVATION_IMPLICIT", " * @see StringDataValue#COLLATION_DERIVATION_EXPLICIT", "", " */" ], "header": "@@ -880,7 +872,17 @@ public final class DataTypeDescriptor implements TypeDescriptor, Formatable", "removed": [ "\t/** @see TypeDescriptor#setCollationDerivation(int) */" ] } ] } ]
derby-DERBY-2775-85ddc17f
DERBY-2775 (partial) Change AggregateDefinition to use a DataTypeDescritor as the declared type instead of a TypeDescriptor. Code using the api assumed the object was a DTD anyway. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@546478 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/compile/AggregateDefinition.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.types.DataTypeDescriptor;", "" ], "header": "@@ -21,10 +21,10 @@", "removed": [ "import java.lang.StringBuffer;", "import org.apache.derby.catalog.TypeDescriptor;" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/AggregateNode.java", "hunks": [ { "added": [], "header": "@@ -276,14 +276,7 @@ public class AggregateNode extends UnaryOperatorNode", "removed": [ "\t\tTypeId\toutType;", "\t\tTypeId\tinputType = null;", "\t\tClass\t\t\t\tinputClass = null;", "\t\tString\t\t\t\tinputTypeName = null;", "\t\tClass\t\t\t\tinputInterfaceClass = null;", "\t\tString\t\t\t\tinputInterfaceName = null;", "\t\tTypeDescriptor \t\tresultType = null;" ] }, { "added": [ " // operand being null means a count(*)" ], "header": "@@ -298,6 +291,7 @@ public class AggregateNode extends UnaryOperatorNode", "removed": [] }, { "added": [ "\t \t** the input datatype.", " aggregatorClassName = new StringBuffer();", " DataTypeDescriptor resultType = uad.getAggregator(dts, aggregatorClassName);" ], "header": "@@ -359,22 +353,10 @@ public class AggregateNode extends UnaryOperatorNode", "removed": [ "\t \t** the input datatype. If an exception is thrown,", "\t\t** barf.", "\t\ttry", "\t\t{", "\t\t\taggregatorClassName = new StringBuffer();", "\t\t\tresultType = uad.getAggregator(dts, aggregatorClassName);", "\t\t} catch (Exception e)", "\t\t{", "\t\t\t//RESOLVE: would be a good idea to add some additional text to", "\t\t\t// this error, like during getResultDataType on aggregate x", "\t\t\t// maybe enhance this error everywhere (seems like execution", "\t\t\t// should also add some text, at the very least saying during", "\t\t\t// execution. see Compiltion/Generator/UserExpressionBuilder.java", "\t\t\tthrow StandardException.unexpectedUserException(e);", "\t\t}" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/MaxMinAggregateDefinition.java", "hunks": [ { "added": [ "\tpublic final DataTypeDescriptor\tgetAggregator(DataTypeDescriptor inputType, " ], "header": "@@ -64,7 +64,7 @@ public class MaxMinAggregateDefinition", "removed": [ "\tpublic final TypeDescriptor\tgetAggregator(TypeDescriptor inputType, " ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/SumAvgAggregateDefinition.java", "hunks": [ { "added": [ "\tpublic final DataTypeDescriptor\tgetAggregator(DataTypeDescriptor inputType, ", "\t\t\tTypeId compType = inputType.getTypeId();" ], "header": "@@ -68,16 +68,12 @@ public class SumAvgAggregateDefinition", "removed": [ "\tpublic final TypeDescriptor\tgetAggregator(TypeDescriptor inputType, ", "\t\t\tLanguageConnectionContext lcc = (LanguageConnectionContext)", "\t\t\t\tContextService.getContext(LanguageConnectionContext.CONTEXT_ID);", "", "\t\t\tDataTypeDescriptor dts = new DataTypeDescriptor( (DataTypeDescriptor)inputType, inputType.isNullable());", "\t\t\tTypeId compType = dts.getTypeId();" ] }, { "added": [ " inputType, inputType, getOperator());", "\t\t\t\treturn outDts.getNullabilityType(true);" ], "header": "@@ -94,12 +90,11 @@ public class SumAvgAggregateDefinition", "removed": [ "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdts, dts, getOperator());", "\t\t\t\toutDts.setNullability(true);", "\t\t\t\treturn outDts;" ] } ] } ]
derby-DERBY-2775-9ed7c4df
DERBY-2775 Make DataTypeDescriptor immutable by removing the set methods for collation type and derivation. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@617162 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/sql/dictionary/DataDictionary.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.types.StringDataValue;" ], "header": "@@ -32,6 +32,7 @@ import org.apache.derby.iapi.types.DataTypeDescriptor;", "removed": [] }, { "added": [ "import org.apache.derby.catalog.TypeDescriptor;", "import java.sql.Types;" ], "header": "@@ -39,9 +40,11 @@ import org.apache.derby.iapi.error.StandardException;", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/iapi/types/DataTypeDescriptor.java", "hunks": [ { "added": [ " * If a variable length type then the size information will be set ", " * to the maximum possible.", " * ", " * Collation type will be UCS_BASIC and derivation IMPLICIT." ], "header": "@@ -74,6 +74,10 @@ public final class DataTypeDescriptor implements TypeDescriptor, Formatable", "removed": [] }, { "added": [ " ", " /**", " * Get a descriptor that corresponds to a nullable builtin variable", " * length JDBC type.", " *", " * Collation type will be UCS_BASIC and derivation IMPLICIT.", " * ", " * @param jdbcType The int type of the JDBC type for which to get", " * a corresponding SQL DataTypeDescriptor", " *", " * @return A new DataTypeDescriptor that corresponds to the Java type.", " * A null return value means there is no corresponding SQL type", " */", " public static DataTypeDescriptor getBuiltInDataTypeDescriptor" ], "header": "@@ -88,7 +92,20 @@ public final class DataTypeDescriptor implements TypeDescriptor, Formatable", "removed": [ "\tpublic static DataTypeDescriptor getBuiltInDataTypeDescriptor" ] }, { "added": [ " * ", " * Collation type will be UCS_BASIC and derivation IMPLICIT." ], "header": "@@ -162,6 +179,8 @@ public final class DataTypeDescriptor implements TypeDescriptor, Formatable", "removed": [] }, { "added": [ "\t * Get a DataTypeServices that corresponds to a nullable builtin SQL type.", " * ", " * Collation type will be UCS_BASIC and derivation IMPLICIT." ], "header": "@@ -187,7 +206,9 @@ public final class DataTypeDescriptor implements TypeDescriptor, Formatable", "removed": [ "\t * Get a DataTypeServices that corresponds to a builtin SQL type" ] }, { "added": [ " * ", " * Collation type will be UCS_BASIC and derivation IMPLICIT." ], "header": "@@ -204,6 +225,8 @@ public final class DataTypeDescriptor implements TypeDescriptor, Formatable", "removed": [] }, { "added": [ "\t\tDataTypeDescriptor\thigherType;" ], "header": "@@ -631,7 +654,7 @@ public final class DataTypeDescriptor implements TypeDescriptor, Formatable", "removed": [ "\t\tDataTypeDescriptor\thigherType = null;" ] }, { "added": [ " higherType = higherType.getCollatedType(", " otherDTS.getCollationType(),", " otherDTS.getCollationDerivation()); ", "", " higherType = higherType.getCollatedType(", " getCollationType(),", " getCollationDerivation());\t\t\t\t\t\t\t\t\t\t", " higherType = higherType.getCollatedType(", " StringDataValue.COLLATION_TYPE_UCS_BASIC, // ignored", " StringDataValue.COLLATION_DERIVATION_NONE);\t\t\t\t\t", " higherType = higherType.getCollatedType(", " StringDataValue.COLLATION_TYPE_UCS_BASIC, // ignored", " StringDataValue.COLLATION_DERIVATION_NONE); ", " higherType = higherType.getCollatedType(", " getCollationType(),", " getCollationDerivation());" ], "header": "@@ -832,23 +855,31 @@ public final class DataTypeDescriptor implements TypeDescriptor, Formatable", "removed": [ "\t\t\t\t\thigherType.setCollationDerivation(otherDTS.getCollationDerivation());\t\t\t\t\t", "\t\t\t\t\thigherType.setCollationType(otherDTS.getCollationType());\t\t\t\t\t", "\t\t\t\t\thigherType.setCollationDerivation(getCollationDerivation());\t\t\t\t\t", "\t\t\t\t\thigherType.setCollationType(getCollationType());\t\t\t\t\t\t\t\t\t\t", "\t\t\t\t\thigherType.setCollationDerivation(StringDataValue.COLLATION_DERIVATION_NONE);\t\t\t\t\t", "\t\t\t\thigherType.setCollationDerivation(StringDataValue.COLLATION_DERIVATION_NONE);\t", "\t\t\t\thigherType.setCollationDerivation(getCollationDerivation());\t\t\t\t\t", "\t\t\t\thigherType.setCollationType(getCollationType());\t\t\t\t\t\t\t\t\t" ] }, { "added": [], "header": "@@ -1029,19 +1060,6 @@ public final class DataTypeDescriptor implements TypeDescriptor, Formatable", "removed": [ " /**", " * Set the collation type of this TypeDescriptor", " * @param collationTypeValue This will be COLLATION_TYPE_UCS_BASIC", " * or COLLATION_TYPE_TERRITORY_BASED", " * ", " * @see StringDataValue#COLLATION_TYPE_UCS_BASIC", " * @see StringDataValue#COLLATION_TYPE_TERRITORY_BASED", " */", " public void\tsetCollationType(int collationTypeValue)", "\t{", "\t\ttypeDescriptor.setCollationType(collationTypeValue);", "\t}", "" ] }, { "added": [ " * Collation derivation will be initialized to COLLATION_DERIVATION_IMPLICIT", " * if not explicitly set." ], "header": "@@ -1070,7 +1088,8 @@ public final class DataTypeDescriptor implements TypeDescriptor, Formatable", "removed": [ " * Collation derivation will be initialized to COLLATION_DERIVATION_NONE." ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java", "hunks": [ { "added": [ " CATALOG_TYPE_SYSTEM_IDENTIFIER," ], "header": "@@ -9039,7 +9039,7 @@ public final class\tDataDictionaryImpl", "removed": [ " TypeDescriptor.VARCHAR128," ] }, { "added": [ " CATALOG_TYPE_SYSTEM_IDENTIFIER,", " CATALOG_TYPE_SYSTEM_IDENTIFIER," ], "header": "@@ -9064,8 +9064,8 @@ public final class\tDataDictionaryImpl", "removed": [ " TypeDescriptor.VARCHAR128,", " TypeDescriptor.VARCHAR128," ] }, { "added": [ " TypeDescriptor[] arg_types = {CATALOG_TYPE_SYSTEM_IDENTIFIER};" ], "header": "@@ -9253,7 +9253,7 @@ public final class\tDataDictionaryImpl", "removed": [ " TypeDescriptor[] arg_types = {TypeDescriptor.VARCHAR128};" ] }, { "added": [ " CATALOG_TYPE_SYSTEM_IDENTIFIER,", " CATALOG_TYPE_SYSTEM_IDENTIFIER" ], "header": "@@ -9275,8 +9275,8 @@ public final class\tDataDictionaryImpl", "removed": [ " TypeDescriptor.VARCHAR128,", " TypeDescriptor.VARCHAR128" ] }, { "added": [ " CATALOG_TYPE_SYSTEM_IDENTIFIER," ], "header": "@@ -9332,7 +9332,7 @@ public final class\tDataDictionaryImpl", "removed": [ " TypeDescriptor.VARCHAR128," ] }, { "added": [ " CATALOG_TYPE_SYSTEM_IDENTIFIER" ], "header": "@@ -9355,7 +9355,7 @@ public final class\tDataDictionaryImpl", "removed": [ " TypeDescriptor.VARCHAR128" ] }, { "added": [ " CATALOG_TYPE_SYSTEM_IDENTIFIER," ], "header": "@@ -9375,7 +9375,7 @@ public final class\tDataDictionaryImpl", "removed": [ " TypeDescriptor.VARCHAR128," ] }, { "added": [ " CATALOG_TYPE_SYSTEM_IDENTIFIER, ", " CATALOG_TYPE_SYSTEM_IDENTIFIER,", " CATALOG_TYPE_SYSTEM_IDENTIFIER" ], "header": "@@ -9406,14 +9406,14 @@ public final class\tDataDictionaryImpl", "removed": [ " TypeDescriptor.VARCHAR128, ", " TypeDescriptor.VARCHAR128,", " TypeDescriptor.VARCHAR128" ] }, { "added": [ " CATALOG_TYPE_SYSTEM_IDENTIFIER" ], "header": "@@ -9448,7 +9448,7 @@ public final class\tDataDictionaryImpl", "removed": [ " TypeDescriptor.VARCHAR128" ] }, { "added": [ " CATALOG_TYPE_SYSTEM_IDENTIFIER, ", " CATALOG_TYPE_SYSTEM_IDENTIFIER,", " CATALOG_TYPE_SYSTEM_IDENTIFIER," ], "header": "@@ -9479,14 +9479,14 @@ public final class\tDataDictionaryImpl", "removed": [ " TypeDescriptor.VARCHAR128, ", " TypeDescriptor.VARCHAR128,", " TypeDescriptor.VARCHAR128," ] }, { "added": [ " CATALOG_TYPE_SYSTEM_IDENTIFIER, ", " CATALOG_TYPE_SYSTEM_IDENTIFIER," ], "header": "@@ -9520,8 +9520,8 @@ public final class\tDataDictionaryImpl", "removed": [ " TypeDescriptor.VARCHAR128, ", " TypeDescriptor.VARCHAR128," ] }, { "added": [ " CATALOG_TYPE_SYSTEM_IDENTIFIER," ], "header": "@@ -9529,7 +9529,7 @@ public final class\tDataDictionaryImpl", "removed": [ " TypeDescriptor.VARCHAR128," ] }, { "added": [ " CATALOG_TYPE_SYSTEM_IDENTIFIER, ", " CATALOG_TYPE_SYSTEM_IDENTIFIER," ], "header": "@@ -9561,8 +9561,8 @@ public final class\tDataDictionaryImpl", "removed": [ " TypeDescriptor.VARCHAR128, ", " TypeDescriptor.VARCHAR128," ] }, { "added": [ " CATALOG_TYPE_SYSTEM_IDENTIFIER,", " CATALOG_TYPE_SYSTEM_IDENTIFIER,", " CATALOG_TYPE_SYSTEM_IDENTIFIER," ], "header": "@@ -9680,9 +9680,9 @@ public final class\tDataDictionaryImpl", "removed": [ " TypeDescriptor.VARCHAR128,", " TypeDescriptor.VARCHAR128,", " TypeDescriptor.VARCHAR128," ] }, { "added": [ " CATALOG_TYPE_SYSTEM_IDENTIFIER,", " CATALOG_TYPE_SYSTEM_IDENTIFIER,", " CATALOG_TYPE_SYSTEM_IDENTIFIER," ], "header": "@@ -9709,9 +9709,9 @@ public final class\tDataDictionaryImpl", "removed": [ " TypeDescriptor.VARCHAR128,", " TypeDescriptor.VARCHAR128,", " TypeDescriptor.VARCHAR128," ] }, { "added": [ " CATALOG_TYPE_SYSTEM_IDENTIFIER,", " CATALOG_TYPE_SYSTEM_IDENTIFIER,", " CATALOG_TYPE_SYSTEM_IDENTIFIER," ], "header": "@@ -9738,9 +9738,9 @@ public final class\tDataDictionaryImpl", "removed": [ " TypeDescriptor.VARCHAR128,", " TypeDescriptor.VARCHAR128,", " TypeDescriptor.VARCHAR128," ] }, { "added": [ " CATALOG_TYPE_SYSTEM_IDENTIFIER,", " CATALOG_TYPE_SYSTEM_IDENTIFIER,", " CATALOG_TYPE_SYSTEM_IDENTIFIER," ], "header": "@@ -9768,9 +9768,9 @@ public final class\tDataDictionaryImpl", "removed": [ " TypeDescriptor.VARCHAR128,", " TypeDescriptor.VARCHAR128,", " TypeDescriptor.VARCHAR128," ] }, { "added": [ "\t\t\t\tCATALOG_TYPE_SYSTEM_IDENTIFIER,", "\t\t\t\tCATALOG_TYPE_SYSTEM_IDENTIFIER,", "\t\t\t\tCATALOG_TYPE_SYSTEM_IDENTIFIER,", "\t\t\t\tCATALOG_TYPE_SYSTEM_IDENTIFIER," ], "header": "@@ -9800,10 +9800,10 @@ public final class\tDataDictionaryImpl", "removed": [ "\t\t\t\tTypeDescriptor.VARCHAR128,", "\t\t\t\tTypeDescriptor.VARCHAR128,", "\t\t\t\tTypeDescriptor.VARCHAR128,", "\t\t\t\tTypeDescriptor.VARCHAR128," ] }, { "added": [ "\t\t\t\tCATALOG_TYPE_SYSTEM_IDENTIFIER,", "\t\t\t\tCATALOG_TYPE_SYSTEM_IDENTIFIER,", "\t\t\t\tCATALOG_TYPE_SYSTEM_IDENTIFIER,", "\t\t\t\tCATALOG_TYPE_SYSTEM_IDENTIFIER," ], "header": "@@ -9831,10 +9831,10 @@ public final class\tDataDictionaryImpl", "removed": [ "\t\t\t\tTypeDescriptor.VARCHAR128,", "\t\t\t\tTypeDescriptor.VARCHAR128,", "\t\t\t\tTypeDescriptor.VARCHAR128,", "\t\t\t\tTypeDescriptor.VARCHAR128," ] }, { "added": [ "\t\t\t\tCATALOG_TYPE_SYSTEM_IDENTIFIER,", "\t\t\t\tCATALOG_TYPE_SYSTEM_IDENTIFIER,", "\t\t\t\tCATALOG_TYPE_SYSTEM_IDENTIFIER,", "\t\t\t\tCATALOG_TYPE_SYSTEM_IDENTIFIER," ], "header": "@@ -9862,10 +9862,10 @@ public final class\tDataDictionaryImpl", "removed": [ "\t\t\t\tTypeDescriptor.VARCHAR128,", "\t\t\t\tTypeDescriptor.VARCHAR128,", "\t\t\t\tTypeDescriptor.VARCHAR128,", "\t\t\t\tTypeDescriptor.VARCHAR128," ] }, { "added": [ "\t\t\t\tCATALOG_TYPE_SYSTEM_IDENTIFIER,", "\t\t\t\tCATALOG_TYPE_SYSTEM_IDENTIFIER,", "\t\t\t\tCATALOG_TYPE_SYSTEM_IDENTIFIER,", "\t\t\t\tCATALOG_TYPE_SYSTEM_IDENTIFIER," ], "header": "@@ -9893,10 +9893,10 @@ public final class\tDataDictionaryImpl", "removed": [ "\t\t\t\tTypeDescriptor.VARCHAR128,", "\t\t\t\tTypeDescriptor.VARCHAR128,", "\t\t\t\tTypeDescriptor.VARCHAR128,", "\t\t\t\tTypeDescriptor.VARCHAR128," ] }, { "added": [ "\t\t\t\tCATALOG_TYPE_SYSTEM_IDENTIFIER,", "\t\t\t\tCATALOG_TYPE_SYSTEM_IDENTIFIER,", "\t\t\t\tCATALOG_TYPE_SYSTEM_IDENTIFIER,", "\t\t\t\tCATALOG_TYPE_SYSTEM_IDENTIFIER,", "\t\t\t\tCATALOG_TYPE_SYSTEM_IDENTIFIER,", "\t\t\t\tCATALOG_TYPE_SYSTEM_IDENTIFIER," ], "header": "@@ -9927,12 +9927,12 @@ public final class\tDataDictionaryImpl", "removed": [ "\t\t\t\tTypeDescriptor.VARCHAR128,", "\t\t\t\tTypeDescriptor.VARCHAR128,", "\t\t\t\tTypeDescriptor.VARCHAR128,", "\t\t\t\tTypeDescriptor.VARCHAR128,", "\t\t\t\tTypeDescriptor.VARCHAR128,", "\t\t\t\tTypeDescriptor.VARCHAR128," ] }, { "added": [ "\t\t\t\tCATALOG_TYPE_SYSTEM_IDENTIFIER,", "\t\t\t\tCATALOG_TYPE_SYSTEM_IDENTIFIER,", "\t\t\t\tCATALOG_TYPE_SYSTEM_IDENTIFIER," ], "header": "@@ -9964,9 +9964,9 @@ public final class\tDataDictionaryImpl", "removed": [ "\t\t\t\tTypeDescriptor.VARCHAR128,", "\t\t\t\tTypeDescriptor.VARCHAR128,", "\t\t\t\tTypeDescriptor.VARCHAR128," ] }, { "added": [ "\t\t\t\tCATALOG_TYPE_SYSTEM_IDENTIFIER,", "\t\t\t\tCATALOG_TYPE_SYSTEM_IDENTIFIER,", "\t\t\t\tCATALOG_TYPE_SYSTEM_IDENTIFIER," ], "header": "@@ -10023,9 +10023,9 @@ public final class\tDataDictionaryImpl", "removed": [ "\t\t\t\tTypeDescriptor.VARCHAR128,", "\t\t\t\tTypeDescriptor.VARCHAR128,", "\t\t\t\tTypeDescriptor.VARCHAR128," ] }, { "added": [ " CATALOG_TYPE_SYSTEM_IDENTIFIER,", " CATALOG_TYPE_SYSTEM_IDENTIFIER," ], "header": "@@ -10198,8 +10198,8 @@ public final class\tDataDictionaryImpl", "removed": [ " TypeDescriptor.VARCHAR128,", " TypeDescriptor.VARCHAR128," ] }, { "added": [ " CATALOG_TYPE_SYSTEM_IDENTIFIER,", " CATALOG_TYPE_SYSTEM_IDENTIFIER,", " CATALOG_TYPE_SYSTEM_IDENTIFIER," ], "header": "@@ -10306,9 +10306,9 @@ public final class\tDataDictionaryImpl", "removed": [ " TypeDescriptor.VARCHAR128,", " TypeDescriptor.VARCHAR128,", " TypeDescriptor.VARCHAR128," ] }, { "added": [ " CATALOG_TYPE_SYSTEM_IDENTIFIER,", " CATALOG_TYPE_SYSTEM_IDENTIFIER,", " CATALOG_TYPE_SYSTEM_IDENTIFIER,", " CATALOG_TYPE_SYSTEM_IDENTIFIER," ], "header": "@@ -10337,10 +10337,10 @@ public final class\tDataDictionaryImpl", "removed": [ " TypeDescriptor.VARCHAR128,", " TypeDescriptor.VARCHAR128,", " TypeDescriptor.VARCHAR128,", " TypeDescriptor.VARCHAR128," ] }, { "added": [ " CATALOG_TYPE_SYSTEM_IDENTIFIER, ", " CATALOG_TYPE_SYSTEM_IDENTIFIER,", " CATALOG_TYPE_SYSTEM_IDENTIFIER," ], "header": "@@ -10771,15 +10771,15 @@ public final class\tDataDictionaryImpl", "removed": [ " TypeDescriptor.VARCHAR128, ", " TypeDescriptor.VARCHAR128,", " TypeDescriptor.VARCHAR128," ] }, { "added": [ " CATALOG_TYPE_SYSTEM_IDENTIFIER," ], "header": "@@ -10819,7 +10819,7 @@ public final class\tDataDictionaryImpl", "removed": [ " TypeDescriptor.VARCHAR128," ] }, { "added": [ " CATALOG_TYPE_SYSTEM_IDENTIFIER, ", " CATALOG_TYPE_SYSTEM_IDENTIFIER,", " CATALOG_TYPE_SYSTEM_IDENTIFIER," ], "header": "@@ -10850,15 +10850,15 @@ public final class\tDataDictionaryImpl", "removed": [ " TypeDescriptor.VARCHAR128, ", " TypeDescriptor.VARCHAR128,", " TypeDescriptor.VARCHAR128," ] }, { "added": [ " CATALOG_TYPE_SYSTEM_IDENTIFIER, ", " CATALOG_TYPE_SYSTEM_IDENTIFIER," ], "header": "@@ -10890,8 +10890,8 @@ public final class\tDataDictionaryImpl", "removed": [ " TypeDescriptor.VARCHAR128, ", " TypeDescriptor.VARCHAR128," ] }, { "added": [ " CATALOG_TYPE_SYSTEM_IDENTIFIER," ], "header": "@@ -10902,7 +10902,7 @@ public final class\tDataDictionaryImpl", "removed": [ " TypeDescriptor.VARCHAR128," ] }, { "added": [ " TypeDescriptor[] arg_types = {CATALOG_TYPE_SYSTEM_IDENTIFIER, CATALOG_TYPE_SYSTEM_IDENTIFIER};" ], "header": "@@ -10937,7 +10937,7 @@ public final class\tDataDictionaryImpl", "removed": [ " TypeDescriptor[] arg_types = {TypeDescriptor.VARCHAR128, TypeDescriptor.VARCHAR128};" ] }, { "added": [ " TypeDescriptor[] arg_types = { CATALOG_TYPE_SYSTEM_IDENTIFIER };" ], "header": "@@ -10953,7 +10953,7 @@ public final class\tDataDictionaryImpl", "removed": [ " TypeDescriptor[] arg_types = { TypeDescriptor.VARCHAR128 };" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/ColumnDefinitionNode.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.types.StringDataValue;" ], "header": "@@ -37,6 +37,7 @@ import org.apache.derby.iapi.sql.dictionary.TableDescriptor;", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/ConcatenationOperatorNode.java", "hunks": [ { "added": [ "", "\t\t\t// DERBY-2910 - Match current schema collation for implicit cast as we do for", "\t\t\t// explicit casts per SQL Spec 6.12 (10)\t\t\t", "\t\t\tleftOperand.setCollationUsingCompilationSchema();", "\t\t\t\t\t\t" ], "header": "@@ -196,16 +196,17 @@ public class ConcatenationOperatorNode extends BinaryOperatorNode {", "removed": [ "\t\t\t// DERBY-2910 - Match current schema collation for implicit cast as we do for", "\t\t\t// explicit casts per SQL Spec 6.12 (10)\t\t\t\t\t\t\t\t\t", "\t\t\tdtd.setCollationType(getSchemaDescriptor(null).getCollationType());", "\t\t\tdtd.setCollationDerivation(StringDataValue.COLLATION_DERIVATION_IMPLICIT);" ] }, { "added": [ "\t\t\t", "\t\t\t// DERBY-2910 - Match current schema collation for implicit cast as we do for", "\t\t\t// explicit casts per SQL Spec 6.12 (10)\t\t\t\t\t", "\t\t\trightOperand.setCollationUsingCompilationSchema();", "\t\t\t" ], "header": "@@ -215,16 +216,17 @@ public class ConcatenationOperatorNode extends BinaryOperatorNode {", "removed": [ "\t\t\t// DERBY-2910 - Match current schema collation for implicit cast as we do for", "\t\t\t// explicit casts per SQL Spec 6.12 (10)\t\t\t\t\t", "\t\t\tdtd.setCollationType(getSchemaDescriptor(null).getCollationType());", "\t\t\tdtd.setCollationDerivation(StringDataValue.COLLATION_DERIVATION_IMPLICIT);" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/CreateAliasNode.java", "hunks": [ { "added": [ " " ], "header": "@@ -287,6 +287,7 @@ public class CreateAliasNode extends DDLStatementNode", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/ModifyColumnNode.java", "hunks": [ { "added": [ "\t * get its collation from the corresponding column in the TableDescriptor." ], "header": "@@ -215,7 +215,7 @@ public class ModifyColumnNode extends ColumnDefinitionNode", "removed": [ "\t * get it's collation from the corresponding column in the TableDescriptor." ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/SimpleStringOperatorNode.java", "hunks": [ { "added": [], "header": "@@ -106,10 +106,6 @@ public class SimpleStringOperatorNode extends UnaryOperatorNode", "removed": [ "\t\t\t\t// DERBY-2910 - Match current schema collation for implicit cast as we do for", "\t\t\t\t// explicit casts per SQL Spec 6.12 (10)\t\t\t\t\t", "\t\t\t\tdtd.setCollationType(getSchemaDescriptor(null).getCollationType());", "\t\t\t\tdtd.setCollationDerivation(StringDataValue.COLLATION_DERIVATION_IMPLICIT);" ] }, { "added": [ "\t\t\t\t\t", "\t\t\t\t// DERBY-2910 - Match current schema collation for implicit cast as we do for", "\t\t\t\t// explicit casts per SQL Spec 6.12 (10)\t\t\t\t\t", "\t\t\t operand.setCollationUsingCompilationSchema();", "\t\t\t " ], "header": "@@ -117,6 +113,11 @@ public class SimpleStringOperatorNode extends UnaryOperatorNode", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/SpecialFunctionNode.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.sql.dictionary.DataDictionary;" ], "header": "@@ -41,6 +41,7 @@ import org.apache.derby.iapi.error.StandardException;", "removed": [] }, { "added": [ " ", " dtd = DataDictionary.TYPE_SYSTEM_IDENTIFIER;", "\t\t\t", "\t\t\t//This is a Derby specific function but its collation type will", " dtd = DataDictionary.TYPE_SYSTEM_IDENTIFIER;" ], "header": "@@ -134,27 +135,25 @@ public class SpecialFunctionNode extends ValueNode", "removed": [ "\t\t\tdtd = DataTypeDescriptor.getBuiltInDataTypeDescriptor(Types.VARCHAR, false, 128);", "\t\t\tdtd.setCollationDerivation(StringDataValue.COLLATION_DERIVATION_IMPLICIT);", "\t\t\tdtd.setCollationType(StringDataValue.COLLATION_TYPE_UCS_BASIC);", "\t\t\tdtd = DataTypeDescriptor.getBuiltInDataTypeDescriptor(Types.VARCHAR, false, 128);", "\t\t\t//This is a Derby specific function but it's collation type will", "\t\t\tdtd.setCollationDerivation(StringDataValue.COLLATION_DERIVATION_IMPLICIT);", "\t\t\tdtd.setCollationType(StringDataValue.COLLATION_TYPE_UCS_BASIC);" ] }, { "added": [ "\t\t\t//be implicit. (set by default)" ], "header": "@@ -167,10 +166,7 @@ public class SpecialFunctionNode extends ValueNode", "removed": [ "\t\t\t//be implicit.", "\t\t\tdtd.setCollationDerivation(", "\t\t\t\tStringDataValue.COLLATION_DERIVATION_IMPLICIT);", "\t\t\tdtd.setCollationType(StringDataValue.COLLATION_TYPE_UCS_BASIC);" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/StaticMethodCallNode.java", "hunks": [ { "added": [ "\t\t\t\t\t\t\t", "" ], "header": "@@ -278,9 +278,8 @@ public class StaticMethodCallNode extends MethodCallNode", "removed": [ "\t\t\t\t\t// DERBY-2972 Match the collation of the RoutineAliasInfo\t\t", "\t\t\t\t\treturnValueDtd.setCollationType(returnType.getCollationType());", " returnValueDtd.setCollationDerivation(StringDataValue.COLLATION_DERIVATION_IMPLICIT);" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/TernaryOperatorNode.java", "hunks": [ { "added": [ " \t\t\treceiver.setCollationUsingCompilationSchema(); \t" ], "header": "@@ -534,8 +534,7 @@ public class TernaryOperatorNode extends ValueNode", "removed": [ " \t\t\treceiver.setCollationUsingCompilationSchema(", " \t\t\t\t\tStringDataValue.COLLATION_DERIVATION_IMPLICIT); \t" ] }, { "added": [ "\t\t\t\treceiver.setCollationUsingCompilationSchema(); \t" ], "header": "@@ -633,8 +632,7 @@ public class TernaryOperatorNode extends ValueNode", "removed": [ "\t\t\t\treceiver.setCollationUsingCompilationSchema(", "\t\t\t\t\t\tStringDataValue.COLLATION_DERIVATION_IMPLICIT); \t" ] }, { "added": [ "", " ", " // DERBY-2910 - Match current schema collation for implicit cast as we do for", " // explicit casts per SQL Spec 6.12 (10) ", " newNode.setCollationUsingCompilationSchema();", " " ], "header": "@@ -719,16 +717,18 @@ public class TernaryOperatorNode extends ValueNode", "removed": [ "\t\t\t// DERBY-2910 - Match current schema collation for implicit cast as we do for", "\t\t\t// explicit casts per SQL Spec 6.12 (10)\t\t\t\t\t\t\t ", "\t\t\tdtd.setCollationType(getSchemaDescriptor(null).getCollationType());", "\t\t\tdtd.setCollationDerivation(StringDataValue.COLLATION_DERIVATION_IMPLICIT);" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/ValueNode.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.types.StringDataValue;" ], "header": "@@ -36,6 +36,7 @@ import org.apache.derby.iapi.sql.compile.TypeCompiler;", "removed": [] }, { "added": [ "\t/**", "\t * Set the collation based upon the current schema with derivation", "\t * type implicit.", "\t * ", "\t * @throws StandardException", "\t */", "\tprotected final void setCollationUsingCompilationSchema()", "\tthrows StandardException {", "\t\tsetCollationUsingCompilationSchema(", "\t\t\t\tStringDataValue.COLLATION_DERIVATION_IMPLICIT);", "\t}\t", "\t" ], "header": "@@ -288,6 +289,18 @@ public abstract class ValueNode extends QueryTreeNode", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/ValueNodeList.java", "hunks": [ { "added": [ "\t\t\t\tdominantDTS =", " dominantDTS.getCollatedType(", " dominantDTS.getCollationType(),", " StringDataValue.COLLATION_DERIVATION_NONE);" ], "header": "@@ -236,7 +236,10 @@ public class ValueNodeList extends QueryTreeNodeVector", "removed": [ "\t\t\t\tdominantDTS.setCollationDerivation(StringDataValue.COLLATION_DERIVATION_NONE);" ] } ] } ]
derby-DERBY-2775-ae196bc4
DERBY-2775 Remove setNullability methods on TypeDescriptorImpl and DataTypeDescriptor to make the types actually immutable wrt nullability. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@616908 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/types/DataTypeDescriptor.java", "hunks": [ { "added": [], "header": "@@ -1118,17 +1118,6 @@ public final class DataTypeDescriptor implements TypeDescriptor, Formatable", "removed": [ "", "\t/**", "\t * Set the nullability of the datatype described by this descriptor", "\t *", "\t * @param nullable\tTRUE means set nullability to TRUE, FALSE", "\t *\t\t\tmeans set it to FALSE", "\t */", "\tpublic void\tsetNullability(boolean nullable)", "\t{", "\t\ttypeDescriptor.setNullability(nullable);", "\t}" ] } ] } ]
derby-DERBY-2775-b25481fa
DERBY-2775 (partial) Add a method to obtain an logically immutable DataTypeDescriptor based upon a DataTypeDescriptor but with different collation settings. Add setCollationInfo methods in ValueNode to change its collation settings and hence its (soon to be) immutable data type. Use ValueNode.setCollationInfo for the simple cases where a node's collation is set from another type. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@608901 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/types/DataTypeDescriptor.java", "hunks": [ { "added": [ " dtd.collationDerivation = StringDataValue.COLLATION_DERIVATION_IMPLICIT;" ], "header": "@@ -115,8 +115,7 @@ public final class DataTypeDescriptor implements TypeDescriptor, Formatable", "removed": [ " dtd.setCollationDerivation(", " StringDataValue.COLLATION_DERIVATION_IMPLICIT);" ] }, { "added": [ "\tprivate DataTypeDescriptor(DataTypeDescriptor source, boolean isNullable)" ], "header": "@@ -425,7 +424,7 @@ public final class DataTypeDescriptor implements TypeDescriptor, Formatable", "removed": [ "\tpublic DataTypeDescriptor(DataTypeDescriptor source, boolean isNullable)" ] }, { "added": [ " ", " private DataTypeDescriptor(DataTypeDescriptor source,", " int collationType,", " int collationDerivation)", " {", " //There might be other places, but one place this method gets called", " //from is ResultColumn.init. When the ResultColumn(RC) is for a ", " //ColumnDescriptor(CD), the RC's TypeDescriptorImpl(TDI) should get ", " //all the attributes of CD's TDI. So, if the CD is for a user table's", " //character type column, then this call by RC.init should have CD's ", " //collation attributes copied into RC along with other attributes. ", " this.typeId = source.typeId;", " typeDescriptor = new TypeDescriptorImpl(source.typeDescriptor,", " source.getPrecision(),", " source.getScale(),", " source.isNullable(),", " source.getMaximumWidth(),", " collationType", " );", " this.collationDerivation = collationDerivation;", " }" ], "header": "@@ -443,6 +442,27 @@ public final class DataTypeDescriptor implements TypeDescriptor, Formatable", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/ConcatenationOperatorNode.java", "hunks": [ { "added": [ " leftOperand.setCollationInfo(rightOperand.getTypeServices());" ], "header": "@@ -126,10 +126,7 @@ public class ConcatenationOperatorNode extends BinaryOperatorNode {", "removed": [ "\t\t\t\tleftOperand.getTypeServices().setCollationDerivation(", "\t\t\t\t\t\trightOperand.getTypeServices().getCollationDerivation());", "\t\t\t\tleftOperand.getTypeServices().setCollationType(", "\t\t\t\t\t\trightOperand.getTypeServices().getCollationType());" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/LikeEscapeOperatorNode.java", "hunks": [ { "added": [ " receiver.setCollationInfo(leftOperand.getTypeServices());", "", " receiver.setCollationInfo(rightOperand.getTypeServices()); \t" ], "header": "@@ -193,15 +193,10 @@ public final class LikeEscapeOperatorNode extends TernaryOperatorNode", "removed": [ " \treceiver.getTypeServices().setCollationDerivation(", " \t\t\tleftOperand.getTypeServices().getCollationDerivation());", " \treceiver.getTypeServices().setCollationType(", " \t\t\tleftOperand.getTypeServices().getCollationType());", " \treceiver.getTypeServices().setCollationDerivation(", " \t\t\trightOperand.getTypeServices().getCollationDerivation());", " \treceiver.getTypeServices().setCollationType(", " \t\t\trightOperand.getTypeServices().getCollationType()); \t" ] }, { "added": [ " leftOperand.setCollationInfo(receiver.getTypeServices()); \t" ], "header": "@@ -235,10 +230,7 @@ public final class LikeEscapeOperatorNode extends TernaryOperatorNode", "removed": [ "\t\t\tleftOperand.getTypeServices().setCollationDerivation(", "\t\t\t\t\treceiver.getTypeServices().getCollationDerivation());", "\t\t\tleftOperand.getTypeServices().setCollationType(", " \t\t\treceiver.getTypeServices().getCollationType()); \t" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/TernaryOperatorNode.java", "hunks": [ { "added": [ " receiver.setCollationInfo(leftOperand.getTypeServices());" ], "header": "@@ -532,10 +532,7 @@ public class TernaryOperatorNode extends ValueNode", "removed": [ " \treceiver.getTypeServices().setCollationDerivation(", " \t\t\tleftOperand.getTypeServices().getCollationDerivation());", " \treceiver.getTypeServices().setCollationType(", " \t\t\tleftOperand.getTypeServices().getCollationType());" ] }, { "added": [ " leftOperand.setCollationInfo(receiver.getTypeServices()); \t" ], "header": "@@ -551,10 +548,7 @@ public class TernaryOperatorNode extends ValueNode", "removed": [ "\t\t\tleftOperand.getTypeServices().setCollationDerivation(", "\t\t\t\t\treceiver.getTypeServices().getCollationDerivation());", "\t\t\tleftOperand.getTypeServices().setCollationType(", " \t\t\treceiver.getTypeServices().getCollationType()); \t" ] }, { "added": [ " setCollationInfo(receiver.getTypeServices());" ], "header": "@@ -597,10 +591,7 @@ public class TernaryOperatorNode extends ValueNode", "removed": [ "\t\tgetTypeServices().setCollationDerivation(", "\t\t\t\treceiver.getTypeServices().getCollationDerivation());", "\t\tgetTypeServices().setCollationType(", "\t\t\t\treceiver.getTypeServices().getCollationType());" ] }, { "added": [ " leftOperand.setCollationInfo(receiver.getTypeServices()); \t" ], "header": "@@ -681,10 +672,7 @@ public class TernaryOperatorNode extends ValueNode", "removed": [ "\t\t\tleftOperand.getTypeServices().setCollationDerivation(", "\t\t\t\t\treceiver.getTypeServices().getCollationDerivation());", "\t\t\tleftOperand.getTypeServices().setCollationType(", " \t\t\treceiver.getTypeServices().getCollationType()); \t" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/ValueNode.java", "hunks": [ { "added": [ " ", " /**", " * Set the collation type and derivation of this node based upon", " * the collation information in the passed in type. Note that the", " * base type of this node is not changed (e.g. INTEGER), only its", " * collation settings. This may result in a different object being", " * returned from getTypeServices().", " * ", " * @param collationInfoType Type to take collation type and derivation from.", " * @throws StandardException Error setting type.", " */", " public void setCollationInfo(DataTypeDescriptor collationInfoType)", " throws StandardException", " {", " setCollationInfo(collationInfoType.getCollationType(),", " collationInfoType.getCollationDerivation());", " }", "", " /**", " * Set the collation type and derivation of this node based upon", " * the collation information passed in.", " * This may result in a different object being", " * returned from getTypeServices().", " * ", " * @param collationType Collation type", " * @param collationDerivation Collation derivation", " * @throws StandardException Error setting type", " */", " public void setCollationInfo(int collationType, int collationDerivation)", " throws StandardException", " {", " setType(getTypeServices().getCollatedType(", " collationType, collationDerivation));", " }" ], "header": "@@ -206,6 +206,40 @@ public abstract class ValueNode extends QueryTreeNode", "removed": [] }, { "added": [ " setCollationInfo(", " getSchemaDescriptor(null, false).getCollationType(),", " collationDerivation);" ], "header": "@@ -271,9 +305,9 @@ public abstract class ValueNode extends QueryTreeNode", "removed": [ " getTypeServices().setCollationType(", "\t \t getSchemaDescriptor(null, false).getCollationType());", " getTypeServices().setCollationDerivation(collationDerivation);" ] } ] } ]
derby-DERBY-2775-ba1b7ec2
DERBY-2775 (partial) Clarify some type handling for ResultColumn and its expression by making callers explictly get the expression's type from the expression, rather than having a method in ResultColumn that doesn't do what it indicates it did. Make VirtualColumnNode's type just refect its source node. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@554012 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/compile/GroupByNode.java", "hunks": [ { "added": [ "\t\t\tnewColumnRef.setType(newRC.getExpression().getTypeServices());" ], "header": "@@ -625,7 +625,7 @@ public class GroupByNode extends SingleChildResultSetNode", "removed": [ "\t\t\tnewColumnRef.setType(newRC.getExpressionType());" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/ResultColumn.java", "hunks": [ { "added": [ " * ", " * The type of the ResultColumn can differ from its underlying expression,", " * for example in certain joins the ResultColumn can be nullable even if", " * its underlying column is not." ], "header": "@@ -71,6 +71,10 @@ import java.util.Vector;", "removed": [] }, { "added": [], "header": "@@ -294,13 +298,6 @@ public class ResultColumn extends ValueNode", "removed": [ "\tpublic DataTypeDescriptor getExpressionType() throws StandardException", "\t{", "\t\treturn (expression == null) ?", "\t\t\tdataTypeServices :", "\t\t\texpression.getTypeServices();", "\t}", "" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/VirtualColumnNode.java", "hunks": [ { "added": [ "\tprivate boolean correlated = false;" ], "header": "@@ -54,7 +54,7 @@ public class VirtualColumnNode extends ValueNode", "removed": [ "\tboolean correlated = false;" ] }, { "added": [ " return sourceColumn.getTypeServices();", " }", " ", " public void setType(DataTypeDescriptor dtd) throws StandardException", " {", " sourceColumn.setType(dtd);", " }" ], "header": "@@ -275,15 +275,13 @@ public class VirtualColumnNode extends ValueNode", "removed": [ " DataTypeDescriptor dtd = super.getTypeServices();", " if( dtd == null && sourceColumn != null)", " {", " dtd = sourceColumn.getTypeServices();", " if( dtd != null)", " setType( dtd);", " }", " return dtd;", " } // end of getTypeServices" ] } ] } ]
derby-DERBY-2775-bd664569
DERBY-2775 (partial) Remove a couple of cases where DataTypeDescriptor.setNullability() was being called and replace with the immutable DataTypeDescriptor calls. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@608966 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/compile/TableElementList.java", "hunks": [ { "added": [ " ", " findColumnDefinition(colName).setNullability(false);" ], "header": "@@ -936,8 +936,8 @@ public class TableElementList extends QueryTreeNodeVector", "removed": [ " DataTypeDescriptor dtd = getColumnDataTypeDescriptor(colName);", " dtd.setNullability(false);" ] }, { "added": [ " ColumnDefinitionNode col = findColumnDefinition(colName);", " if (col != null)", " return col.getType();" ], "header": "@@ -968,21 +968,10 @@ public class TableElementList extends QueryTreeNodeVector", "removed": [ " int size = size();", " for (int index = 0; index < size; index++)", " {", " TableElementNode tableElement = (TableElementNode) elementAt(index);", "", " if (tableElement instanceof ColumnDefinitionNode)", " {", " ColumnDefinitionNode cdn = (ColumnDefinitionNode) tableElement;", " if (colName.equals(cdn.getColumnName()))", " {", " return cdn.getType();", " }", " }", " }" ] } ] } ]
derby-DERBY-2775-cb8f1093
DERBY-2775 (partial) Cleanup of type handling in ColumnDefinitionNode & its sub-class and uses. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@546372 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/compile/ColumnDefinitionNode.java", "hunks": [ { "added": [ "\t", " /**", " * The data type of this column.", " */", " DataTypeDescriptor\t\t\tdataTypeServices;", " " ], "header": "@@ -66,7 +66,12 @@ import java.sql.Types;", "removed": [ "\tDataTypeDescriptor\t\t\tdataTypeServices;" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/ModifyColumnNode.java", "hunks": [ { "added": [ " ColumnDescriptor cd = td.getColumnDescriptor(name);", "\t\tDataTypeDescriptor oldType = cd.getType();", " dataTypeServices = ", " getDataTypeServices().getNullabilityType(oldType.isNullable());", "\t\tif (!(oldType.getTypeId().equals(getDataTypeServices().getTypeId())))", "\t\tString typeName = getDataTypeServices().getTypeName();" ], "header": "@@ -92,36 +92,29 @@ public class ModifyColumnNode extends ColumnDefinitionNode", "removed": [ "\t\tColumnDescriptor cd;", "\t\tTypeDescriptor oldType;", "\t\tDataTypeDescriptor newType = dataTypeServices;", "\t\tTypeId oldTypeId;", "\t\tTypeId newTypeId;", "", "\t\tcd = td.getColumnDescriptor(name);", "\t\toldType = cd.getType();", "\t\toldTypeId = cd.getType().getTypeId();", "\t\tnewTypeId = dataTypeServices.getTypeId();", "\t\tnewType.setNullability(oldType.isNullable());", "\t\tif (!(oldTypeId.equals(newTypeId)))", "\t\tString typeName = dataTypeServices.getTypeName();" ] }, { "added": [ "\t\tif (getDataTypeServices().getMaximumWidth() < oldType.getMaximumWidth())" ], "header": "@@ -131,7 +124,7 @@ public class ModifyColumnNode extends ColumnDefinitionNode", "removed": [ "\t\tif (newType.getMaximumWidth() < oldType.getMaximumWidth())" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/AlterTableConstantAction.java", "hunks": [ { "added": [ " ", " // Get the type and change the nullability", "\t\tDataTypeDescriptor dataType =", " columnDescriptor.getType().getNullabilityType(nullability);" ], "header": "@@ -1029,10 +1029,11 @@ class AlterTableConstantAction extends DDLSingleTableConstantAction", "removed": [ "\t\tDataTypeDescriptor dataType = columnDescriptor.getType();", "\t\t// set nullability", "\t\tdataType.setNullability(nullability);" ] } ] } ]
derby-DERBY-2775-d1e9d3cb
DERBY-2775 (partial) Remove one use of DataTypeDescriptor.setNullability() that was not required. Nullabilty was being set for system columns that needed to be upgraded in old databases from an incorrect value. Using the nullability of the original definition is already correct and avoids redundant setting. Changed the name of the method as it is now a generic fix a system column rather than being specific to nullability. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@608580 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java", "hunks": [ { "added": [ "\t *\tUpgrade an existing system catalog column's definition", " * by setting it to the value it would have in a newly", " * created database. This is only used to for a couple", " * of columns that had incorrectly nullability. Other", " * uses (e.g. changing column type) might require more work.", "\tpublic void upgradeFixSystemColumnDefinition(CatalogRowFactory rowFactory,", "\t\tString columnName = cd.getColumnName();" ], "header": "@@ -6922,31 +6922,31 @@ public final class\tDataDictionaryImpl", "removed": [ "\t *\tUpgrade an existing catalog by setting the nullability", "\t *\t@param\tnullability\t\t\t\ttrue if nullable ", "\tpublic void upgrade_setNullability(CatalogRowFactory rowFactory,", "\t\t\t\t\t\t\t\t\t boolean nullability,", "\t\tString columnName;", "\t\tcolumnName = cd.getColumnName();", "\t\tcd.getType().setNullability(nullability);" ] } ] } ]
derby-DERBY-2775-d5ce63a7
DERBY-2775 (cleanup) Change CastNode to store the type in the facility provided by its super-class ValueNode, and not store the type twice. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@552038 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/compile/CastNode.java", "hunks": [ { "added": [ "\tprivate int\t\t\t\t\ttargetCharType;", "\tprivate boolean forDataTypeFunction = false;", " " ], "header": "@@ -69,12 +69,11 @@ import java.util.Vector;", "removed": [ "\tDataTypeDescriptor\tcastTarget;", "\tint\t\t\t\t\ttargetCharType;", "\tTypeId\tdestCTI = null;", "\tboolean forDataTypeFunction = false;" ] }, { "added": [ "\tprivate boolean externallyGeneratedCastNode = false;" ], "header": "@@ -85,7 +84,7 @@ public class CastNode extends ValueNode", "removed": [ "\tboolean externallyGeneratedCastNode = false;" ] }, { "added": [ "\t\tsetType((DataTypeDescriptor) castTarget);" ], "header": "@@ -106,7 +105,7 @@ public class CastNode extends ValueNode", "removed": [ "\t\tthis.castTarget = (DataTypeDescriptor) castTarget;" ] }, { "added": [ "\t\tsetType(DataTypeDescriptor.getBuiltInDataTypeDescriptor(targetCharType, charLen));" ], "header": "@@ -127,7 +126,7 @@ public class CastNode extends ValueNode", "removed": [ "\t\tthis.castTarget = DataTypeDescriptor.getBuiltInDataTypeDescriptor(targetCharType, charLen);" ] }, { "added": [ "\t\t\ttry {", " return \"castTarget: \" + getTypeServices() + \"\\n\" +", " \tsuper.toString();", " } catch (StandardException e) {", " // TEMP - getTypeServices() should not be throwing an exception", " return \"\";", " }" ], "header": "@@ -141,8 +140,13 @@ public class CastNode extends ValueNode", "removed": [ "\t\t\treturn \"castTarget: \" + castTarget + \"\\n\" +", "\t\t\t\tsuper.toString();" ] }, { "added": [ "\t\tif (getTypeServices() == null) //CHAR or VARCHAR function without specifying target length" ], "header": "@@ -197,7 +201,7 @@ public class CastNode extends ValueNode", "removed": [ "\t\tif (castTarget == null) //CHAR or VARCHAR function without specifying target length" ] }, { "added": [ "\t\t\tsetType(DataTypeDescriptor.getBuiltInDataTypeDescriptor(targetCharType, length));" ], "header": "@@ -238,7 +242,7 @@ public class CastNode extends ValueNode", "removed": [ "\t\t\tcastTarget = DataTypeDescriptor.getBuiltInDataTypeDescriptor(targetCharType, length);" ] }, { "added": [ "\t\t\tcastOperand.setType(getTypeServices());" ], "header": "@@ -248,7 +252,7 @@ public class CastNode extends ValueNode", "removed": [ "\t\t\tcastOperand.setType(castTarget);" ] }, { "added": [ "\t\t\tint\t\t destJDBCTypeId = getTypeId().getJDBCTypeId();" ], "header": "@@ -280,7 +284,7 @@ public class CastNode extends ValueNode", "removed": [ "\t\t\tint\t\t destJDBCTypeId = destCTI.getJDBCTypeId();" ] }, { "added": [ " getTypeServices().getMaximumWidth())," ], "header": "@@ -299,7 +303,7 @@ public class CastNode extends ValueNode", "removed": [ "\t\t\t\t\t\t\t\t\t\t\t\tcastTarget.getMaximumWidth())," ] }, { "added": [ " getTypeServices().getMaximumWidth())," ], "header": "@@ -321,7 +325,7 @@ public class CastNode extends ValueNode", "removed": [ "\t\t\t\t\t\t\t\t\t\t\t\t castTarget.getMaximumWidth())," ] }, { "added": [ "\t\tif (externallyGeneratedCastNode && getTypeId().isStringTypeId()) {" ], "header": "@@ -367,13 +371,11 @@ public class CastNode extends ValueNode", "removed": [ "\t\tsetType(castTarget);", "\t\tdestCTI = castTarget.getTypeId();", "\t\tif (externallyGeneratedCastNode && destCTI.isStringTypeId()) {" ] }, { "added": [ "\t\tif (getTypeId().userType())", "\t\t\tsetType(new DataTypeDescriptor(TypeId.getUserDefinedTypeId(className, false),", "\t\t\t\t\t\t\t\t\t\t\t\t\t));" ], "header": "@@ -384,17 +386,15 @@ public class CastNode extends ValueNode", "removed": [ "\t\tif (destCTI.userType())", "\t\t\tcastTarget = new DataTypeDescriptor(TypeId.getUserDefinedTypeId(className, false),", "\t\t\t\t\t\t\t\t\t\t\t\t\t);", "\t\t\tsetType(castTarget);", "\t\t\tdestCTI = castTarget.getTypeId();" ] }, { "added": [ "\t\t\tif (! tc.convertible(getTypeId(), forDataTypeFunction))", " getTypeId().getSQLTypeName());" ], "header": "@@ -413,11 +413,11 @@ public class CastNode extends ValueNode", "removed": [ "\t\t\tif (! tc.convertible(destCTI, forDataTypeFunction))", "\t\t\t\t\t\tdestCTI.getSQLTypeName());" ] }, { "added": [ " getTypeServices().getMaximumWidth())," ], "header": "@@ -567,7 +567,7 @@ public class CastNode extends ValueNode", "removed": [ "\t\t\t\t\t\t\t\t\t\t\tcastTarget.getMaximumWidth())," ] }, { "added": [ " getTypeServices().getMaximumWidth())," ], "header": "@@ -664,7 +664,7 @@ public class CastNode extends ValueNode", "removed": [ "\t\t\t\t\t\t\t\t\t\t\tcastTarget.getMaximumWidth())," ] }, { "added": [ "\t\tcastOperand.setType(getTypeServices());" ], "header": "@@ -811,7 +811,7 @@ public class CastNode extends ValueNode", "removed": [ "\t\tcastOperand.setType(castTarget);" ] }, { "added": [ " getTypeId().getCorrespondingJavaTypeName()))" ], "header": "@@ -839,7 +839,7 @@ public class CastNode extends ValueNode", "removed": [ "\t\t\t\tdestCTI.getCorrespondingJavaTypeName()))" ] }, { "added": [ "\t\t\tsourceCTI = getTypeId();" ], "header": "@@ -879,7 +879,7 @@ public class CastNode extends ValueNode", "removed": [ "\t\t\tsourceCTI = destCTI;" ] }, { "added": [ "\t\tacb.generateNull(acbConstructor, getTypeCompiler(getTypeId()), ", " getTypeServices().getCollationType());" ], "header": "@@ -902,8 +902,8 @@ public class CastNode extends ValueNode", "removed": [ "\t\tacb.generateNull(acbConstructor, getTypeCompiler(destCTI), ", "\t\t\t\tcastTarget.getCollationType());" ] }, { "added": [ "\t\tif (!sourceCTI.userType() && !getTypeId().userType()) {" ], "header": "@@ -921,7 +921,7 @@ public class CastNode extends ValueNode", "removed": [ "\t\tif (!sourceCTI.userType() && !destCTI.userType()) {" ] }, { "added": [ "\t\tif (getTypeId().variableLength()) ", "\t\t\tboolean isNumber = getTypeId().isNumericTypeId();" ], "header": "@@ -967,9 +967,9 @@ public class CastNode extends ValueNode", "removed": [ "\t\tif (destCTI.variableLength()) ", "\t\t\tboolean isNumber = destCTI.isNumericTypeId();" ] }, { "added": [ "\t\t\tmb.push(isNumber ? getTypeServices().getPrecision() : getTypeServices().getMaximumWidth());", "\t\t\tmb.push(getTypeServices().getScale());" ], "header": "@@ -979,8 +979,8 @@ public class CastNode extends ValueNode", "removed": [ "\t\t\tmb.push(isNumber ? castTarget.getPrecision() : castTarget.getMaximumWidth());", "\t\t\tmb.push(castTarget.getScale());" ] }, { "added": [ "\tvoid setForExternallyGeneratedCASTnode()" ], "header": "@@ -1022,7 +1022,7 @@ public class CastNode extends ValueNode", "removed": [ "\tpublic void setForExternallyGeneratedCASTnode()" ] }, { "added": [ "\tvoid setForDataTypeFunction(boolean b)" ], "header": "@@ -1031,20 +1031,11 @@ public class CastNode extends ValueNode", "removed": [ "\tpublic void setForDataTypeFunction(boolean b)", "\t/** is this a cast node for a data type scalar function?", "\t * @return true if this is a function, false for regular cast node", "\t *", "\t */", "\tpublic boolean getForDataTypeFunction()", "\t{", "\t\treturn forDataTypeFunction;", "\t}", " " ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/ConditionalNode.java", "hunks": [ { "added": [ "\t * @throws StandardException ", "\tprivate boolean isCastToChar(ValueNode node) throws StandardException {", "\t\tif (node.getTypeServices().getTypeName().equals(TypeId.CHAR_NAME))" ], "header": "@@ -132,9 +132,10 @@ public class ConditionalNode extends ValueNode", "removed": [ "\tprivate boolean isCastToChar(CastNode node) {", "\t\tif (node.castTarget.getTypeName().equals(TypeId.CHAR_NAME))" ] }, { "added": [ "\t\tif (isCastNode(thenNode) && !isCastToChar(thenNode))", "\t\t\treturn thenNode.getTypeServices();" ], "header": "@@ -235,8 +236,8 @@ public class ConditionalNode extends ValueNode", "removed": [ "\t\tif (isCastNode(thenNode) && !isCastToChar((CastNode)thenNode))", "\t\t\treturn ((CastNode)thenNode).castTarget;" ] }, { "added": [ "\t\tif (isCastNode(elseNode) && !isCastToChar(elseNode))", "\t\t\treturn elseNode.getTypeServices();" ], "header": "@@ -247,8 +248,8 @@ public class ConditionalNode extends ValueNode", "removed": [ "\t\tif (isCastNode(elseNode) && !isCastToChar((CastNode)elseNode))", "\t\t\treturn ((CastNode)elseNode).castTarget;" ] } ] } ]
derby-DERBY-2775-ed824068
DERBY-2775 Cleanup ValueNode.getTypeServices to not throw an exception and cleanup some implementations of getTypeServices to be clear on what they are returning. Change the language compile code to use the new immutable method to get a nullable DataTypeDecriptor. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@554399 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/compile/ColumnDefinitionNode.java", "hunks": [ { "added": [ " if (dataTypeServices != null)", " this.dataTypeServices = getDataTypeServices().getNullabilityType(false);" ], "header": "@@ -164,8 +164,8 @@ public class ColumnDefinitionNode extends TableElementNode", "removed": [ "\t\t\t\tif (dataTypeServices != null)", "\t\t\t\t\t(this.dataTypeServices).setNullability(false);" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/ColumnReference.java", "hunks": [ { "added": [], "header": "@@ -390,17 +390,6 @@ public class ColumnReference extends ValueNode", "removed": [ "\t/**", "\t * Set the name of this column", "\t *", "\t * @param columnName\tThe name of this column", "\t */", "", "\tpublic void setColumnName(String columnName)", "\t{", "\t\tthis.columnName = columnName;", "\t}", "" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/GroupByNode.java", "hunks": [ { "added": [], "header": "@@ -625,7 +625,6 @@ public class GroupByNode extends SingleChildResultSetNode", "removed": [ "\t\t\tnewColumnRef.setType(newRC.getExpression().getTypeServices());" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/PredicateList.java", "hunks": [ { "added": [ "\t\t\t\t\tnextAnd.setNullability(true);" ], "header": "@@ -1178,7 +1178,7 @@ public class PredicateList extends QueryTreeNodeVector implements OptimizablePre", "removed": [ "\t\t\t\t\tnextAnd.getTypeServices().setNullability(true);" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/ResultColumn.java", "hunks": [ { "added": [ "import java.util.Vector;", "import org.apache.derby.iapi.error.StandardException;", "import org.apache.derby.iapi.reference.ClassName;", "import org.apache.derby.iapi.reference.SQLState;", "import org.apache.derby.iapi.services.compiler.MethodBuilder;", "import org.apache.derby.iapi.services.io.StoredFormatIds;", "import org.apache.derby.iapi.sql.compile.C_NodeTypes;", "import org.apache.derby.iapi.sql.dictionary.ColumnDescriptor;", "import org.apache.derby.iapi.sql.dictionary.TableDescriptor;", "import org.apache.derby.iapi.types.DataTypeDescriptor;", "import org.apache.derby.iapi.types.DataValueDescriptor;", "import org.apache.derby.iapi.types.DataValueFactory;", "import org.apache.derby.iapi.types.StringDataValue;", "import org.apache.derby.iapi.types.TypeId;" ], "header": "@@ -21,49 +21,28 @@", "removed": [ "import org.apache.derby.iapi.services.compiler.MethodBuilder;", "import org.apache.derby.iapi.services.context.ContextManager;", "", "import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;", "", "import org.apache.derby.iapi.types.DataTypeDescriptor;", "import org.apache.derby.iapi.types.DataValueDescriptor;", "import org.apache.derby.iapi.types.StringDataValue;", "import org.apache.derby.iapi.types.DataTypeDescriptor;", "import org.apache.derby.iapi.types.DataValueDescriptor;", "import org.apache.derby.iapi.types.TypeId;", "import org.apache.derby.iapi.services.io.StoredFormatIds;", "import org.apache.derby.iapi.types.DataValueFactory;", "", "import org.apache.derby.iapi.sql.dictionary.DataDictionary;", "import org.apache.derby.iapi.sql.dictionary.TableDescriptor;", "import org.apache.derby.iapi.sql.dictionary.ColumnDescriptor;", "", "import org.apache.derby.iapi.sql.compile.CompilerContext;", "import org.apache.derby.iapi.sql.compile.RowOrdering;", "import org.apache.derby.iapi.sql.compile.C_NodeTypes;", "", "import org.apache.derby.impl.sql.compile.ActivationClassBuilder;", "import org.apache.derby.impl.sql.compile.ExpressionClassBuilder;", "", "", "import org.apache.derby.iapi.error.StandardException;", "import org.apache.derby.iapi.reference.SQLState;", "import org.apache.derby.iapi.reference.ClassName;", "", "import org.apache.derby.iapi.util.JBitSet;", "import java.sql.Types;", "", "import java.util.Vector;", "" ] }, { "added": [ "\t\t\tsetType(coldes.getType());" ], "header": "@@ -181,12 +160,10 @@ public class ResultColumn extends ValueNode", "removed": [ "\t\t\tDataTypeDescriptor colType = coldes.getType();", "\t\t\t/* Clone the type info here, so we can change nullability if needed */", "\t\t\tsetType(new DataTypeDescriptor(colType, colType.isNullable()));" ] }, { "added": [ "\t\treturn getTypeServices();" ], "header": "@@ -295,7 +272,7 @@ public class ResultColumn extends ValueNode", "removed": [ "\t\treturn dataTypeServices;" ] }, { "added": [ "\t\t\t\t\"type: \" + getTypeServices() + \"\\n\" +" ], "header": "@@ -496,7 +473,7 @@ public class ResultColumn extends ValueNode", "removed": [ "\t\t\t\t\"type: \" + dataTypeServices + \"\\n\" +" ] }, { "added": [ " checkStorableExpression((ValueNode) toStore);", " ", " private void checkStorableExpression(ValueNode source)", " throws StandardException", " {", " TypeId toStoreTypeId = source.getTypeId();", " ", " if (!getTypeCompiler().storable(toStoreTypeId, getClassFactory()))", " {", " throw StandardException.newException(SQLState.LANG_NOT_STORABLE, ", " getTypeId().getSQLTypeName(),", " toStoreTypeId.getSQLTypeName() );", " } ", " }" ], "header": "@@ -833,19 +810,21 @@ public class ResultColumn extends ValueNode", "removed": [ "\t\tTypeId columnTypeId, toStoreTypeId;", "", "\t\ttoStoreTypeId = toStore.getTypeId();", " if( toStoreTypeId == null)", " return;", " ", "\t\tcolumnTypeId = getTypeId();", "", "\t\tif (! getTypeCompiler().storable(toStoreTypeId, getClassFactory()))", "\t\t\tthrow StandardException.newException(SQLState.LANG_NOT_STORABLE, ", "\t\t\t\tcolumnTypeId.getSQLTypeName(),", "\t\t\t\ttoStoreTypeId.getSQLTypeName() );" ] }, { "added": [ " checkStorableExpression(getExpression());" ], "header": "@@ -861,12 +840,7 @@ public class ResultColumn extends ValueNode", "removed": [ "\t\tTypeId toStoreTypeId = getExpression().getTypeId();", "", "\t\tif (! getTypeCompiler().storable(toStoreTypeId, getClassFactory()))", "\t\t\tthrow StandardException.newException(SQLState.LANG_NOT_STORABLE, ", " getTypeId().getSQLTypeName(),", "\t\t\t\ttoStoreTypeId.getSQLTypeName() );" ] }, { "added": [ "\t\tif (getExpression().requiresTypeFromContext())", "\t\tif (getTypeId().isXMLTypeId())", " ", " ", " DataTypeDescriptor expressionType = getExpression().getTypeServices();", " ", " if (expressionType == null)", " System.out.println(getExpression().getClass());", " ", " if (!getTypeServices().isExactTypeAndLengthMatch(expressionType))", " return false;", "\t\tif ((! getTypeServices().isNullable()) && expressionType.isNullable())" ], "header": "@@ -955,68 +929,37 @@ public class ResultColumn extends ValueNode", "removed": [ "\t\tDataTypeDescriptor\tresultColumnType;", "\t\tDataTypeDescriptor\texpressionType = expression.getTypeServices();", "\t\tif (expression.requiresTypeFromContext())", "\t\tresultColumnType = getType();", "", "\t\tif (SanityManager.DEBUG)", "\t\t{", "\t\t\tif (! (resultColumnType != null))", "\t\t\t{", "\t\t\t\tSanityManager.THROWASSERT(\"Type is null for column \" + ", "\t\t\t\t\t\t\t\t\t\t this);", "\t\t\t}", "\t\t}", "", "\t\tif (resultColumnType.getTypeId().isXMLTypeId())", "\t\t\treturn false;", "", "\t\t/* Are they the same type? */", "\t\tif ( ! resultColumnType.getTypeId().getSQLTypeName().equals(", "\t\t\texpressionType.getTypeId().getSQLTypeName()", "\t\t\t\t)", "\t\t\t)", "\t\t{", "\t\t\treturn false;", "\t\t}", "", "\t\t/* Are they the same precision? */", "\t\tif (resultColumnType.getPrecision() != expressionType.getPrecision())", "\t\t{", "\t\t\treturn false;", "\t\t}", "", "\t\t/* Are they the same scale? */", "\t\tif (resultColumnType.getScale() != expressionType.getScale())", "\t\t{", "\t\t\treturn false;", "\t\t}", "", "\t\t/* Are they the same width? */", "\t\tif (resultColumnType.getMaximumWidth() != expressionType.getMaximumWidth())", "\t\t{", "\t\t}", "\t\tif ((! resultColumnType.isNullable()) && expressionType.isNullable())" ] }, { "added": [ " DataTypeDescriptor resultColumnType = getTypeServices();", " DataTypeDescriptor otherResultColumnType = otherColumn.getTypeServices();" ], "header": "@@ -1027,12 +970,10 @@ public class ResultColumn extends ValueNode", "removed": [ "\t\tDataTypeDescriptor\tresultColumnType;", "\t\tDataTypeDescriptor\totherResultColumnType;", "\t\tresultColumnType = getType();", "\t\totherResultColumnType = otherColumn.getType();" ] }, { "added": [ "\t\treturn getTypeServices().getTypeId()", "\t\t\t.getApproximateLengthInBytes(getTypeServices());", " ", " public DataTypeDescriptor getTypeServices()", " {", " DataTypeDescriptor type = super.getTypeServices();", " if (type != null)", " return type;", " ", " if (getExpression() != null)", " return getExpression().getTypeServices();", " ", " return null;", " }" ], "header": "@@ -1464,9 +1405,21 @@ public class ResultColumn extends ValueNode", "removed": [ "\t\treturn dataTypeServices.getTypeId()", "\t\t\t.getApproximateLengthInBytes(dataTypeServices);" ] }, { "added": [], "header": "@@ -1536,14 +1489,6 @@ public class ResultColumn extends ValueNode", "removed": [ "\t/**", "\t * Set the nullability of this ResultColumn.", "\t */", "\tpublic void setNullability(boolean nullability)", "\t{", "\t\tdataTypeServices.setNullability(nullability);", "\t}", "" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/ValueNode.java", "hunks": [ { "added": [ "\tprivate DataTypeDescriptor\tdataTypeServices;" ], "header": "@@ -50,9 +50,7 @@ public abstract class ValueNode extends QueryTreeNode", "removed": [ "\tprotected DataTypeDescriptor\tdataTypeServices;", " ", "\tprivate TypeCompiler typeCompiler;" ] }, { "added": [ "\tpublic DataTypeDescriptor getTypeServices()", " ", " /**", " * Set the nullability of this value.", " * @throws StandardException ", " */", " public void setNullability(boolean nullability) throws StandardException", " {", " setType(getTypeServices().getNullabilityType(nullability));", " }" ], "header": "@@ -195,10 +193,19 @@ public abstract class ValueNode extends QueryTreeNode", "removed": [ "\tpublic DataTypeDescriptor getTypeServices() throws StandardException" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/VirtualColumnNode.java", "hunks": [ { "added": [ "\tpublic DataTypeDescriptor getTypeServices()" ], "header": "@@ -273,7 +273,7 @@ public class VirtualColumnNode extends ValueNode", "removed": [ "\tpublic DataTypeDescriptor getTypeServices() throws StandardException" ] } ] } ]
derby-DERBY-2775-ef158f22
DERBY-2775 (partial) Some cleanup of type handling in ValueNode towards the aime that the type of a node is defined by getTypeServices() consistently so that sub-classes can override getTypeServices() and ensure all other code will get the correct type. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@545566 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/compile/ConditionalNode.java", "hunks": [ { "added": [ " getTypeServices(),\t// cast to dominant type" ], "header": "@@ -494,7 +494,7 @@ public class ConditionalNode extends ValueNode", "removed": [ "\t\t\t\t\t\t\t\tdataTypeServices,\t// cast to dominant type" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/ConstantNode.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.types.TypeId;" ], "header": "@@ -22,6 +22,7 @@", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/ParameterNode.java", "hunks": [ { "added": [ "\t/**", "\t** Pointer to the array in the CompilerContext that holds array", " * of types for all the user-visible paramerers.. When each parameter is", " *", " * This array is not read in this class, but is read from the", " * CompilerContext on completion of compiling the statement.", " * ", " * In some case a parameter node may exist but is not a visble", " * user parameter, in this case typeServices will be null", " * so that setting its type will not modify the user's set.", "\tprivate DataTypeDescriptor[]\tuserParameterTypes;" ], "header": "@@ -51,15 +51,22 @@ public class ParameterNode extends ValueNode", "removed": [ "\t/*", "\t** Pointer to the array in the DMLStatementNode that holds the", "\t** DataTypeServices for the parameters. When each parameter is", "\tprivate DataTypeDescriptor[]\ttypeServices;" ] }, { "added": [ "\t\tuserParameterTypes = descriptors;" ], "header": "@@ -141,17 +148,7 @@ public class ParameterNode extends ValueNode", "removed": [ "", " // The following is commented out for #3546, for create publication ", " // or target ddl creations there could be multiple statements trying", " // to bind their own parameters. So the following assumptions does not", " // hold true. ", "", "\t//\tif (SanityManager.DEBUG)", "\t//\tSanityManager.ASSERT(typeServices == null,", "\t//\t\t\"Attempt to re-set typeServices\");", "", "\t\ttypeServices = descriptors;" ] }, { "added": [ "\t\tSanityManager.ASSERT(userParameterTypes != null," ], "header": "@@ -163,7 +160,7 @@ public class ParameterNode extends ValueNode", "removed": [ "\t\tSanityManager.ASSERT(typeServices != null," ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/ValueNode.java", "hunks": [ { "added": [ "import java.util.Vector;", "import org.apache.derby.iapi.error.StandardException;", "import org.apache.derby.iapi.reference.SQLState;", "import org.apache.derby.iapi.services.compiler.MethodBuilder;", "import org.apache.derby.iapi.services.i18n.MessageService;", "import org.apache.derby.iapi.sql.compile.CompilerContext;", "import org.apache.derby.iapi.sql.compile.Optimizable;", "import org.apache.derby.iapi.sql.compile.TypeCompiler;", "import org.apache.derby.iapi.types.DataTypeDescriptor;", "import org.apache.derby.iapi.types.DataValueFactory;", "import org.apache.derby.iapi.types.TypeId;" ], "header": "@@ -21,42 +21,23 @@", "removed": [ "import org.apache.derby.iapi.types.DataTypeDescriptor;", "import org.apache.derby.iapi.types.TypeId;", "import org.apache.derby.iapi.sql.dictionary.DataDictionary;", "import org.apache.derby.iapi.error.StandardException;", "", "import org.apache.derby.iapi.sql.compile.TypeCompiler;", "import org.apache.derby.iapi.types.DataValueFactory;", "", "import org.apache.derby.iapi.types.SQLChar;", "", "import org.apache.derby.iapi.sql.compile.CompilerContext;", "import org.apache.derby.iapi.sql.compile.Optimizable;", "", "import org.apache.derby.iapi.reference.SQLState;", "", "", "import org.apache.derby.impl.sql.compile.ActivationClassBuilder;", "import org.apache.derby.impl.sql.compile.ExpressionClassBuilder;", "", "import org.apache.derby.iapi.services.compiler.MethodBuilder;", "", "import org.apache.derby.iapi.services.i18n.MessageService;", "", "import java.lang.reflect.Modifier;", "", "import java.sql.Date;", "import java.sql.Time;", "import java.sql.Timestamp;", "", "import java.util.Vector;" ] }, { "added": [ " /**", " * The data type for this node.", " */", " " ], "header": "@@ -66,8 +47,11 @@ import java.util.Vector;", "removed": [ "\tprivate TypeId typeId;\t " ] }, { "added": [ " ", " /**", " * Set this node's type from type components.", " */", " final void setType(TypeId typeId,", " boolean isNullable,", " int maximumWidth)", " throws StandardException", " ", " {", " setType(", " new DataTypeDescriptor(", " (TypeId) typeId,", " isNullable,", " maximumWidth", " )", " ); ", " }", "", " /**", " * Set this node's type from type components.", " */", " final void setType(TypeId typeId,", " int precision, int scale,", " boolean isNullable,", " int maximumWidth)", " throws StandardException", " {", " setType(", " new DataTypeDescriptor(", " (TypeId) typeId,", " precision,", " scale,", " isNullable,", " maximumWidth", " )", " ); ", " }" ], "header": "@@ -83,6 +67,44 @@ public abstract class ValueNode extends QueryTreeNode", "removed": [] }, { "added": [ " DataTypeDescriptor dtd = getTypeServices();", " if (dtd != null)", " return dtd.getTypeId();", "\t\treturn null;" ], "header": "@@ -186,7 +208,10 @@ public abstract class ValueNode extends QueryTreeNode", "removed": [ "\t\treturn typeId;" ] }, { "added": [ "\t * Get the TypeCompiler from this ValueNode, based on its TypeId", " * using getTypeId().", "\tpublic final TypeCompiler getTypeCompiler() throws StandardException", "\t\treturn getTypeCompiler(getTypeId());" ], "header": "@@ -198,23 +223,15 @@ public abstract class ValueNode extends QueryTreeNode", "removed": [ "\t * Get the TypeCompiler from this ValueNode, based on its TypeId.", "\tpublic TypeCompiler getTypeCompiler() throws StandardException", "\t\tif (typeCompiler == null)", "\t\t{", "\t\t\t/*", "\t\t\t** getTypeId() is overriddend by parameter node so", "\t\t\t** don't get smart and remove the extra method call.", "\t\t\t*/", "\t\t\ttypeCompiler = getTypeCompiler(getTypeId());", "\t\t}", "", "\t\treturn typeCompiler;" ] }, { "added": [], "header": "@@ -229,12 +246,6 @@ public abstract class ValueNode extends QueryTreeNode", "removed": [ "\t\t/* Get this now so we only have to cast it once */", "\t\tif (dataTypeServices == null)", "\t\t\ttypeId = null;", "\t\telse", "\t\t\ttypeId = dataTypeServices.getTypeId();", "" ] }, { "added": [ " getTypeServices().setCollationType(", " getTypeServices().setCollationDerivation(collationDerivation);" ], "header": "@@ -256,9 +267,9 @@ public abstract class ValueNode extends QueryTreeNode", "removed": [ "\t\tdataTypeServices.setCollationType(", "\t\tdataTypeServices.setCollationDerivation(collationDerivation);" ] }, { "added": [ "\t\t\tSanityManager.ASSERT(getTypeId() != null,", "\t\t\tSanityManager.ASSERT(getTypeId().userType()," ], "header": "@@ -356,9 +367,9 @@ public abstract class ValueNode extends QueryTreeNode", "removed": [ "\t\t\tSanityManager.ASSERT(typeId != null,", "\t\t\tSanityManager.ASSERT(typeId.userType()," ] }, { "added": [ "\t\t\t\tgetTypeId().isBooleanTypeId(),", "\t\t\t\t\tgetTypeId().getSQLTypeName() +" ], "header": "@@ -426,10 +437,9 @@ public abstract class ValueNode extends QueryTreeNode", "removed": [ "\t\t\t\tdataTypeServices.getTypeId().equals(", "\t\t\t\t\t\t\t\t\t\t\t\tTypeId.BOOLEAN_ID),", "\t\t\t\t\tdataTypeServices.getTypeId().getSQLTypeName() +" ] }, { "added": [ "\t\tnullableResult = getTypeServices().isNullable();" ], "header": "@@ -462,7 +472,7 @@ public abstract class ValueNode extends QueryTreeNode", "removed": [ "\t\tnullableResult = dataTypeServices.isNullable();" ] }, { "added": [], "header": "@@ -742,7 +752,6 @@ public abstract class ValueNode extends QueryTreeNode", "removed": [ "\t\ttypeId = oldVN.getTypeId();" ] } ] } ]
derby-DERBY-2775-f5efedc1
Add some test cases for nullability of the value from a CASE expression. One of the cases failed before revision 616853 for DERBY-2775. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@616873 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2776-d8b9ea30
DERBY-2776 Internally generated CAST nodes should not pick up the collation of the current schema. In order to implement this, the CAST nodes generated directly by the user sql (parser) will set a flag on the cast node to indicate that they are externally generated CAST nodes. During the bind phase of a CAST node, we will check if the node is externally generated. If yes, then we will have it pick up the collation of the compilation schema otherwise we will leave the collation unchanged. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@551033 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/compile/CastNode.java", "hunks": [ { "added": [], "header": "@@ -31,7 +31,6 @@ import org.apache.derby.iapi.error.StandardException;", "removed": [ "import org.apache.derby.iapi.types.StringDataValue;" ] }, { "added": [ "\t/** This variable gets set by the parser to indiciate that this CAST node ", "\t * has been generated by the parser. This means that we should use the ", "\t * collation info of the current compilation schmea for this node's ", "\t * collation setting. If this variable does not get set to true, then it ", "\t * means that this CAST node has been an internally generated node and we ", "\t * should not touch the collation info set for this CAST node because it ", "\t * has been already set correctly by the class that generated this CAST ", "\t * node. Collation info is part of the DataTypeDescriptor that's defined", "\t * on the ValueNode (the super class of this CastNode class)", "\t */ ", "\tboolean externallyGeneratedCastNode = false;" ], "header": "@@ -76,6 +75,17 @@ public class CastNode extends ValueNode", "removed": [] }, { "added": [ "\t\tif (externallyGeneratedCastNode && destCTI.isStringTypeId()) {" ], "header": "@@ -363,7 +373,7 @@ public class CastNode extends ValueNode", "removed": [ "\t\tif (destCTI.isStringTypeId()) {" ] } ] } ]
derby-DERBY-2777-0a29524e
DERBY-2777 Fixed the combination of COALESCE and parameters so that the parameters take their collation from the context and not from the current compilation schema git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@545347 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/compile/CoalesceFunctionNode.java", "hunks": [ { "added": [], "header": "@@ -36,11 +36,9 @@ import org.apache.derby.iapi.services.compiler.LocalField;", "removed": [ "import org.apache.derby.iapi.types.StringDataValue;", "import java.util.Iterator;" ] } ] } ]
derby-DERBY-2777-0f58b386
DERBY-2777 Make sure that for operators like BOOLEAN, the collation information is picked from the context and not from the current compilation schema. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@545708 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2777-168a4f8d
DERBY-2777 Fixed the combination of CONCATENATION and parameters so that the parameters take their collation from the context and not from the current compilation schema git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@545443 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/compile/ConcatenationOperatorNode.java", "hunks": [ { "added": [ "\t\t\t\t//collation of ? operand should be picked from the context", "\t\t\t\tleftOperand.getTypeServices().setCollationDerivation(", "\t\t\t\t\t\trightOperand.getTypeServices().getCollationDerivation());", "\t\t\t\tleftOperand.getTypeServices().setCollationType(", "\t\t\t\t\t\trightOperand.getTypeServices().getCollationType());" ], "header": "@@ -125,9 +125,11 @@ public class ConcatenationOperatorNode extends BinaryOperatorNode {", "removed": [ "\t\t\t\t//collation of ? operand should be same as the compilation schema", "\t\t\t\tleftOperand.setCollationUsingCompilationSchema(", "\t\t\t\t\t\tStringDataValue.COLLATION_DERIVATION_IMPLICIT);" ] } ] } ]
derby-DERBY-2777-1c873332
DERBY-2777 Fixed the combination of IS NULL and parameters so that the parameters take their collation from the context and not from the current compilation schema. Also, the earlier checkin for test case of CONCATENATION was incorrect. This commit fixes that too. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@545593 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2777-63385d47
DERBY-2777 Fixed the combination of IN operator and parameters so that the parameters take their collation from the context and not from the current compilation schema. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@545319 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/compile/BinaryListOperatorNode.java", "hunks": [ { "added": [], "header": "@@ -27,7 +27,6 @@ import org.apache.derby.iapi.reference.SQLState;", "removed": [ "import org.apache.derby.iapi.types.StringDataValue;" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/InListOperatorNode.java", "hunks": [ { "added": [], "header": "@@ -25,12 +25,8 @@ import org.apache.derby.iapi.sql.compile.C_NodeTypes;", "removed": [ "import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;", "", "import org.apache.derby.iapi.sql.dictionary.DataDictionary;", "import org.apache.derby.iapi.types.StringDataValue;" ] }, { "added": [], "header": "@@ -44,7 +40,6 @@ import org.apache.derby.iapi.sql.compile.Optimizable;", "removed": [ "import org.apache.derby.iapi.util.JBitSet;" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/SubqueryNode.java", "hunks": [ { "added": [], "header": "@@ -21,8 +21,6 @@", "removed": [ "import org.apache.derby.iapi.services.context.ContextManager;", "" ] }, { "added": [], "header": "@@ -36,23 +34,10 @@ import org.apache.derby.iapi.reference.SQLState;", "removed": [ "import org.apache.derby.iapi.types.StringDataValue;", "", "import org.apache.derby.iapi.sql.execute.ExecRow;", "", "import org.apache.derby.iapi.sql.Activation;", "import org.apache.derby.iapi.types.DataValueDescriptor;", "import org.apache.derby.iapi.sql.Row;", "import org.apache.derby.iapi.types.DataTypeDescriptor;", "import org.apache.derby.iapi.sql.ResultSet;", "import org.apache.derby.iapi.types.TypeId;", "", "import org.apache.derby.iapi.services.loader.GeneratedMethod;", "" ] }, { "added": [], "header": "@@ -64,10 +49,8 @@ import org.apache.derby.impl.sql.compile.ActivationClassBuilder;", "removed": [ "import org.apache.derby.iapi.util.ReuseFactory;", "import java.util.Properties;" ] } ] } ]
derby-DERBY-2777-8cf0ef9b
DERBY-2777 Fixed the combination of binary operator and parameters so that the parameters take their collation from the context and not from the current compilation schema. eg ? = TABLENAME git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@545323 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/compile/BinaryOperatorNode.java", "hunks": [ { "added": [], "header": "@@ -316,9 +316,6 @@ public class BinaryOperatorNode extends ValueNode", "removed": [ "\t\t\t//collation of ? operand should be same as the compilation schema", "\t\t\tleftOperand.setCollationUsingCompilationSchema(", "\t\t\t\t\tStringDataValue.COLLATION_DERIVATION_IMPLICIT);" ] } ] } ]
derby-DERBY-2777-9841c0dd
DERBY-2777 We were incorrectly trying to set collation info on non-character string types. This commit will remove that code. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@553793 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/compile/TernaryOperatorNode.java", "hunks": [ { "added": [ " /**", " * This method gets called for non-character string types and hence no need ", " * to set any collation info. Collation applies only to character string", " * types.", " * ", " * @param arg Check if arg is a ? param and if yes, then set it's type to", " * jdbcType if arg doesn't have a type associated with it.", " * ", " * @param jdbcType Associate this type with arg if arg is a ? param with no", " * type associated with it", " * ", " * @return true if arg is a ? param with no type associated with it", " * @throws StandardException", " */" ], "header": "@@ -905,14 +905,25 @@ public class TernaryOperatorNode extends ValueNode", "removed": [ "\t\t\t//collation of ? operand should be same as the compilation schema", "\t\t\targ.setCollationUsingCompilationSchema(", "\t\t\t\t\tStringDataValue.COLLATION_DERIVATION_IMPLICIT);" ] } ] } ]
derby-DERBY-2777-db9ad011
DERBY-2777 Currently, the parameters in TRIM clause always pickup their collation from the compilation schema. That logic is not complete. I am fixing that logic here along with addition of some tests. For the sake of explanation, let me use the following syntax for TRIM clause TRIM (leftOperand FROM receiver) With the fix in this patch, if receiver is a parameter, it will set it's collation using following logic 1)check if leftOperand is not a parameter. If yes, then receiver will pick up collation from leftOperand. If not, goto step 2 2)receiver picks up the collation of the compilation schema because everything in the TRIM clause is ? Next, if leftOperand is a parameter, it will set it's collation using receiver. By this time, even if receiver is a parameter, we have set correct collation for receiver and hence leftOperand can simply rely on receiver for correct collation IF leftOperand is a parameter. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@553727 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/compile/TernaryOperatorNode.java", "hunks": [ { "added": [ "\t * The variable receiver is the string that needs to be trimmed.", "\t * The variable leftOperand is the character that needs to be trimmed from", "\t * receiver.", "\t * " ], "header": "@@ -505,6 +505,10 @@ public class TernaryOperatorNode extends ValueNode", "removed": [] }, { "added": [ " //check if this parameter can pick up it's collation from the ", "\t\t\t//character that will be used for trimming. If not(meaning the", "\t\t\t//character to be trimmed is also a parameter), then it will take ", "\t\t\t//it's collation from the compilation schema.", " if (!leftOperand.requiresTypeFromContext()) {", " \treceiver.getTypeServices().setCollationDerivation(", " \t\t\tleftOperand.getTypeServices().getCollationDerivation());", " \treceiver.getTypeServices().setCollationType(", " \t\t\tleftOperand.getTypeServices().getCollationType());", " } else {", " \t\t\treceiver.setCollationUsingCompilationSchema(", " \t\t\t\t\tStringDataValue.COLLATION_DERIVATION_IMPLICIT); \t", " }" ], "header": "@@ -528,9 +532,19 @@ public class TernaryOperatorNode extends ValueNode", "removed": [ "\t\t\t//collation of ? operand should be same as the compilation schema", "\t\t\treceiver.setCollationUsingCompilationSchema(", "\t\t\t\t\tStringDataValue.COLLATION_DERIVATION_IMPLICIT);" ] } ] } ]
derby-DERBY-2777-de4d4c54
DERBY-2777 Currently, the parameters in LOCATE clause always pickup their collation from the compilation schema. That logic is not complete. I am fixing that logic here along with addition of some tests. For the sake of explanation, let me use the following syntax for LOCATE clause LOCATE (receiver, leftOperand) With the fix in this patch, if receiver is a parameter, it will set it's collation using following logic 1)check if leftOperand is not a parameter. If yes, then receiver will pick up collation from leftOperand. If not, goto step 2 2)receiver picks up the collation of the compilation schema because everything in the LOCATE clause is ? Next, if leftOperand is a parameter, it will set it's collation using receiver. By this time, even if receiver is a parameter, we have set correct collation for receiver and hence leftOperand can simply rely on receiver for correct collation IF leftOperand is a parameter. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@553784 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/compile/TernaryOperatorNode.java", "hunks": [ { "added": [ "\t * The variable receiver is the string which will searched", "\t * The variable leftOperand is the search character that will looked in the", "\t * receiver variable." ], "header": "@@ -623,6 +623,9 @@ public class TernaryOperatorNode extends ValueNode", "removed": [] }, { "added": [ "\t //Since both receiver and leftOperands are parameters, use the", "\t\t\t\t//collation of compilation schema for receiver.", "\t\t\t\treceiver.setCollationUsingCompilationSchema(", "\t\t\t\t\t\tStringDataValue.COLLATION_DERIVATION_IMPLICIT); \t", "\t\t\t\t\t//Since the leftOperand is not a parameter, receiver will", "\t\t\t\t\t//get it's collation from leftOperand through following", "\t\t\t\t\t//setType method" ], "header": "@@ -643,18 +646,22 @@ public class TernaryOperatorNode extends ValueNode", "removed": [ "\t\t\t//collation of ? operand should be same as the compilation schema", "\t\t\treceiver.setCollationUsingCompilationSchema(", "\t\t\t\t\tStringDataValue.COLLATION_DERIVATION_IMPLICIT);" ] } ] } ]
derby-DERBY-2777-f1224882
DERBY-2777 Currently, the parameters in LIKE clause always pickup their collation from the compilation schema. That logic is not complete. I am fixing that logic here along with addition of some tests. For the sake of explanation, let me use the following syntax for LIKE clause receiver LIKE leftOperand ESCAPE rightOperand With the fix in this patch, if receiver is a parameter, it will set it's collation using following logic 1)check if leftOperand is not a parameter. If yes, then receiver will pick up collation from leftOperand. If not, goto step 2 2)check if rightOperand is not a parameter. If yes, then receiver will pick up collation from rightOperand. If not, goto step 3 3)receiver picks up the collation of the compilation schema because everything in the LIKE clause is ? Next, if leftOperand is a parameter, it will set it's collation using receiver. By this time, even if receiver is a parameter, we have set correct collation for receiver and hence leftOperand can simply rely on receiver for correct collation IF leftOperand is a parameter. Next, if rightOperand is a parameter, it will set it's collation using receiver. By this time, even if receiver is a parameter, we have set correct collation for receiver and hence rightOperand can simply rely on receiver for correct collation IF rightOperand is a parameter. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@553557 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/compile/LikeEscapeOperatorNode.java", "hunks": [ { "added": [ " //check if this parameter can pick up it's collation from pattern", " //or escape clauses in that order. If not, then it will take it's", " //collation from the compilation schema.", " if (!leftOperand.requiresTypeFromContext()) {", " \treceiver.getTypeServices().setCollationDerivation(", " \t\t\tleftOperand.getTypeServices().getCollationDerivation());", " \treceiver.getTypeServices().setCollationType(", " \t\t\tleftOperand.getTypeServices().getCollationType());", " } else if (rightOperand != null && !rightOperand.requiresTypeFromContext()) {", " \treceiver.getTypeServices().setCollationDerivation(", " \t\t\trightOperand.getTypeServices().getCollationDerivation());", " \treceiver.getTypeServices().setCollationType(", " \t\t\trightOperand.getTypeServices().getCollationType()); \t", " } else {", " \t\t\treceiver.setCollationUsingCompilationSchema(", " \t\t\t\t\tStringDataValue.COLLATION_DERIVATION_IMPLICIT); \t", " }" ], "header": "@@ -189,9 +189,23 @@ public final class LikeEscapeOperatorNode extends TernaryOperatorNode", "removed": [ "\t\t\t//collation of ? operand should be same as the compilation schema", "\t\t\treceiver.setCollationUsingCompilationSchema(", "\t\t\t\t\tStringDataValue.COLLATION_DERIVATION_IMPLICIT);" ] }, { "added": [ "\t\t\t//collation of ? operand should be picked up from the context.", " //By the time we come here, receiver will have correct collation", " //set on it and hence we can rely on it to get correct collation", " //for the other ? in LIKE clause", "\t\t\tleftOperand.getTypeServices().setCollationDerivation(", "\t\t\t\t\treceiver.getTypeServices().getCollationDerivation());", "\t\t\tleftOperand.getTypeServices().setCollationType(", " \t\t\treceiver.getTypeServices().getCollationType()); \t" ], "header": "@@ -217,9 +231,14 @@ public final class LikeEscapeOperatorNode extends TernaryOperatorNode", "removed": [ "\t\t\t//collation of ? operand should be same as the compilation schema", "\t\t\tleftOperand.setCollationUsingCompilationSchema(", "\t\t\t\t\tStringDataValue.COLLATION_DERIVATION_IMPLICIT);" ] } ] } ]
derby-DERBY-2795-0ab3f6e9
DERBY-2795 Unable to bring up server with SSL peer authentication enabled. Code fix. Checking sslMode values both on server and client. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@546217 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/client/org/apache/derby/jdbc/ClientBaseDataSource.java", "hunks": [ { "added": [ " public static final int getSSLModeFromString(String s) ", " throws SqlException", " {", " " ], "header": "@@ -177,7 +177,10 @@ public abstract class ClientBaseDataSource implements Serializable, Referenceabl", "removed": [ " public static final int getSSLModeFromString(String s) {" ] }, { "added": [ " throw new SqlException(null, ", " new ClientMessageId(SQLState.INVALID_ATTRIBUTE),", " Attribute.SSL_ATTR, s, \"off, basic, peerAuthentication\");" ], "header": "@@ -186,8 +189,9 @@ public abstract class ClientBaseDataSource implements Serializable, Referenceabl", "removed": [ "\t\t\t\t// Default", "\t\t\t\treturn SSL_OFF;" ] }, { "added": [ " throws SqlException" ], "header": "@@ -196,6 +200,7 @@ public abstract class ClientBaseDataSource implements Serializable, Referenceabl", "removed": [] }, { "added": [ " public void setSsl(String mode) ", " throws SqlException", " {" ], "header": "@@ -872,7 +877,9 @@ public abstract class ClientBaseDataSource implements Serializable, Referenceabl", "removed": [ " public void setSsl(String mode) {" ] } ] }, { "file": "java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java", "hunks": [ { "added": [ " throws Exception", "\t\t\t} else if (StringUtil.SQLEqualsIgnoreCase(s,\"peerAuthentication\")) {", " return SSL_PEER_AUTHENTICATION;", "\t\t\t\t// Unknown value", " consolePropertyMessage(\"DRDA_InvalidValue.U\", ", " new String [] {s, Property.DRDA_PROP_SSL_MODE});", " " ], "header": "@@ -2824,15 +2824,20 @@ public final class NetworkServerControlImpl {", "removed": [ "\t\t\t} else if (StringUtil.SQLEqualsIgnoreCase(s,\"peerAuthentication\")) {\t\t\t\treturn SSL_PEER_AUTHENTICATION;", "\t\t\t\t// Default" ] } ] } ]
derby-DERBY-2796-2a0eb8d8
DERBY-2796 Obscure error messages when using SSL in various combinations git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@548301 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java", "hunks": [ { "added": [ "import javax.net.ssl.SSLSocket;" ], "header": "@@ -36,6 +36,7 @@ import java.net.Socket;", "removed": [] }, { "added": [ "\t\t\t\t\t\t\t\t\t\t\tSSLSocket s1 = (SSLSocket)NaiveTrustManager.getSocketFactory().", "\t\t\t\t\t\t\t\t\t\t\t\tcreateSocket(connectAddress, portNumber);", "\t\t\t\t\t\t\t\t\t\t\t// Need to handshake now to get proper error reporting.", "\t\t\t\t\t\t\t\t\t\t\ts1.startHandshake();", "\t\t\t\t\t\t\t\t\t\t\treturn s1;", "", "\t\t\t\t\t\t\t\t\t\t\tSSLSocket s2 = (SSLSocket)SSLSocketFactory.getDefault().", "\t\t\t\t\t\t\t\t\t\t\t\tcreateSocket(connectAddress, portNumber);", "\t\t\t\t\t\t\t\t\t\t\t// Need to handshake now to get proper error reporting.", "\t\t\t\t\t\t\t\t\t\t\ts2.startHandshake();", "\t\t\t\t\t\t\t\t\t\t\treturn s2;", "", "\t\t\t\t\t\t\t\t\t\t\treturn SocketFactory.getDefault().", "\t\t\t\t\t\t\t\t\t\t\t\tcreateSocket(connectAddress, portNumber);" ], "header": "@@ -2244,20 +2245,26 @@ public final class NetworkServerControlImpl {", "removed": [ "\t\t\t\t\t\t\t\t\t\tSocketFactory sf;", "\t\t\t\t\t\t\t\t\t\t\tsf = NaiveTrustManager.getSocketFactory();", "\t\t\t\t\t\t\t\t\t\t\tbreak;", "\t\t\t\t\t\t\t\t\t\t\tsf = SSLSocketFactory.getDefault();", "\t\t\t\t\t\t\t\t\t\t\tbreak;", "\t\t\t\t\t\t\t\t\t\t\tsf = SocketFactory.getDefault();", "\t\t\t\t\t\t\t\t\t\t\tbreak;", "\t\t\t\t\t\t\t\t\t\treturn sf.createSocket(connectAddress, portNumber);" ] }, { "added": [ "\t\t\t\t\t\t\t\t\t\t new String [] {hostArg, ", "\t\t\t\t\t\t\t\t\t\t\t\t\t\t (new Integer(portNumber)).toString(), ", "\t\t\t\t\t\t\t\t\t\t\t\t\t\t e1.getMessage()});" ], "header": "@@ -2268,7 +2275,9 @@ public final class NetworkServerControlImpl {", "removed": [ "\t\t\t\t\t\tnew String [] {hostArg, (new Integer(portNumber)).toString()});" ] } ] } ]