Author: mikem
Date: Fri May 11 23:54:17 2007
New Revision: 537349
URL: http://svn.apache.org/viewvc?view=rev&rev=537349
Log:
DERBY-2537
Fixed assert that did not work with collated database, it needed to be updated
to take collation id of template into account.
Modified:
db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/io/ArrayUtil.java
db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/btree/BTree.java
db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/btree/BTreeScan.java
db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/conglomerate/TemplateRow.java
Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/io/ArrayUtil.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/io/ArrayUtil.java?view=diff&rev=537349&r1=537348&r2=537349
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/io/ArrayUtil.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/io/ArrayUtil.java Fri May
11 23:54:17 2007
@@ -236,6 +236,26 @@
return retVal;
}
+ public static String toString(int[] value)
+ {
+ String ret_val;
+
+ if (value == null || value.length == 0)
+ {
+ ret_val = "null";
+ }
+ else
+ {
+ ret_val = "";
+ for (int i = 0; i < value.length; i++)
+ {
+ ret_val += "[" + value[i] + "],";
+ }
+ }
+ return(ret_val);
+ }
+
+
///////////////////////////////////////////////////////////////////
//
// Methods for Arrays of LONGs
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/btree/BTree.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/btree/BTree.java?view=diff&rev=537349&r1=537348&r2=537349
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/btree/BTree.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/btree/BTree.java Fri
May 11 23:54:17 2007
@@ -57,6 +57,8 @@
import java.util.Properties;
+import org.apache.derby.iapi.services.io.ArrayUtil;
+
/**
A b-tree object corresponds to an instance of a b-tree conglomerate. It
@@ -546,6 +548,8 @@
long conglomId)
throws StandardException
{
+ SanityManager.DEBUG_PRINT("BTree.getDynamicCompiledConglomInfo", "collation_ids =
" + ArrayUtil.toString(collation_ids));
+ SanityManager.showTrace(new Throwable());
return(new OpenConglomerateScratchSpace(format_ids, collation_ids));
}
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/btree/BTreeScan.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/btree/BTreeScan.java?view=diff&rev=537349&r1=537348&r2=537349
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/btree/BTreeScan.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/btree/BTreeScan.java
Fri May 11 23:54:17 2007
@@ -83,7 +83,7 @@
*/
protected Transaction init_rawtran = null;
protected boolean init_forUpdate;
- protected FormatableBitSet init_scanColumnList;
+ protected FormatableBitSet init_scanColumnList;
protected DataValueDescriptor[] init_template;
protected DataValueDescriptor[] init_startKeyValue;
protected int init_startSearchOperator = 0;
@@ -1176,7 +1176,7 @@
int open_mode,
int lock_level,
BTreeLockingPolicy btree_locking_policy,
- FormatableBitSet scanColumnList,
+ FormatableBitSet scanColumnList,
DataValueDescriptor[] startKeyValue,
int startSearchOperator,
Qualifier qualifier[][],
@@ -1236,14 +1236,12 @@
if (SanityManager.DEBUG)
{
- // RESOLVE - (mikem) we should we require a template, need to
- // clean up some of the old tests which did not provide one?
- if (init_template != null)
- {
- SanityManager.ASSERT(
- TemplateRow.checkColumnTypes(
- this.getConglomerate().format_ids, init_template));
- }
+ SanityManager.ASSERT(
+ TemplateRow.checkColumnTypes(
+ getRawTran().getDataValueFactory(),
+ this.getConglomerate().format_ids,
+ this.getConglomerate().collation_ids,
+ init_template));
}
// System.out.println("initializing scan:" + this);
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/conglomerate/TemplateRow.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/conglomerate/TemplateRow.java?view=diff&rev=537349&r1=537348&r2=537349
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/conglomerate/TemplateRow.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/conglomerate/TemplateRow.java
Fri May 11 23:54:17 2007
@@ -23,8 +23,8 @@
import org.apache.derby.iapi.reference.SQLState;
-import org.apache.derby.iapi.services.monitor.Monitor;
import org.apache.derby.iapi.services.sanity.SanityManager;
+import org.apache.derby.iapi.services.io.ArrayUtil;
import org.apache.derby.iapi.services.io.Storable;
import org.apache.derby.iapi.error.StandardException;
@@ -258,7 +258,9 @@
* @exception StandardException Standard exception policy.
**/
static public boolean checkColumnTypes(
+ DataValueFactory dvf,
int[] format_ids,
+ int[] collation_ids,
DataValueDescriptor[] row)
throws StandardException
{
@@ -295,7 +297,7 @@
}
column_template =
- Monitor.newInstanceFromIdentifier(format_ids[colid]);
+ dvf.getNull(format_ids[colid], collation_ids[colid]);
// is this the right check?
@@ -305,11 +307,14 @@
"check", "row = " + RowUtil.toString(row));
SanityManager.THROWASSERT(
- "column["+colid+"] (" + column.getClass() +
- ") expected to be instanceof column_tempate() (" +
+ "input column["+colid+"] (" + column.getClass() +
+ ") did not match expected template class (" +
column_template.getClass() + ")" +
- "column = " + column +
- "row[colid] = " + row[colid]);
+ "\ncolumn value = " + column +
+ "\nformat_ids = " +
+ ArrayUtil.toString(format_ids) +
+ "\ncollation = " +
+ ArrayUtil.toString(collation_ids));
}
}
}
|