aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Ahlborn <jtahlborn@yahoo.com>2013-08-08 02:47:05 +0000
committerJames Ahlborn <jtahlborn@yahoo.com>2013-08-08 02:47:05 +0000
commitdccac86c851cc8121f792de0e3443986a3b1855c (patch)
tree799dcc6705155e0eb57b33c69a15c6bd0f1a03a1
parent482ba4844a366f6d606314ad4c9dd22723bc5f8d (diff)
downloadjackcess-dccac86c851cc8121f792de0e3443986a3b1855c.tar.gz
jackcess-dccac86c851cc8121f792de0e3443986a3b1855c.zip
expand javadocs for core interfaces
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@769 f203690c-595d-4dc9-a70b-905162fa7fd2
-rw-r--r--TODO.txt6
-rw-r--r--src/java/com/healthmarketscience/jackcess/Column.java6
-rw-r--r--src/java/com/healthmarketscience/jackcess/ColumnBuilder.java3
-rw-r--r--src/java/com/healthmarketscience/jackcess/Cursor.java16
-rw-r--r--src/java/com/healthmarketscience/jackcess/CursorBuilder.java41
-rw-r--r--src/java/com/healthmarketscience/jackcess/DataType.java3
-rw-r--r--src/java/com/healthmarketscience/jackcess/Database.java9
-rw-r--r--src/java/com/healthmarketscience/jackcess/DatabaseBuilder.java14
-rw-r--r--src/java/com/healthmarketscience/jackcess/Index.java5
-rw-r--r--src/java/com/healthmarketscience/jackcess/IndexBuilder.java3
-rw-r--r--src/java/com/healthmarketscience/jackcess/IndexCursor.java4
-rw-r--r--src/java/com/healthmarketscience/jackcess/Relationship.java3
-rw-r--r--src/java/com/healthmarketscience/jackcess/Row.java3
-rw-r--r--src/java/com/healthmarketscience/jackcess/Table.java17
-rw-r--r--src/java/com/healthmarketscience/jackcess/TableBuilder.java13
-rw-r--r--src/java/com/healthmarketscience/jackcess/impl/ComplexColumnSupport.java2
-rw-r--r--src/java/com/healthmarketscience/jackcess/impl/DatabaseImpl.java3
-rw-r--r--src/java/com/healthmarketscience/jackcess/impl/IndexImpl.java11
-rw-r--r--src/java/com/healthmarketscience/jackcess/util/Joiner.java3
-rw-r--r--test/src/java/com/healthmarketscience/jackcess/BigIndexTest.java8
-rw-r--r--test/src/java/com/healthmarketscience/jackcess/CursorBuilderTest.java12
-rw-r--r--test/src/java/com/healthmarketscience/jackcess/CursorTest.java38
-rw-r--r--test/src/java/com/healthmarketscience/jackcess/IndexTest.java4
-rw-r--r--test/src/java/com/healthmarketscience/jackcess/impl/IndexCodesTest.java12
24 files changed, 151 insertions, 88 deletions
diff --git a/TODO.txt b/TODO.txt
index 2de5697..3d74657 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -58,10 +58,10 @@ Refactor goals:
- implement page buffering in PageChannel
* need to implement logical flushing in update code (startUpdate/finishUpdate)
* limit size of IndexPageCache?
-- make non-thread-safeness more explicit
+* make non-thread-safeness more explicit
- refactor free-space handlers Table/Column?
-- update index/cookbook for new api
-- add basic walk-through in class javadocs to guide users to correct classes
+* update index/cookbook for new api
+* add basic walk-through in class javadocs to guide users to correct classes
and basic getting started stuff.
* public api final cleanup:
diff --git a/src/java/com/healthmarketscience/jackcess/Column.java b/src/java/com/healthmarketscience/jackcess/Column.java
index 82268e5..86e8ab0 100644
--- a/src/java/com/healthmarketscience/jackcess/Column.java
+++ b/src/java/com/healthmarketscience/jackcess/Column.java
@@ -27,7 +27,11 @@ import com.healthmarketscience.jackcess.complex.ComplexColumnInfo;
import com.healthmarketscience.jackcess.complex.ComplexValue;
/**
- * Access database column definition
+ * Access database column definition. A {@link Table} has a list of Column
+ * instances describing the table schema.
+ * <p>
+ * A Column instance is not thread-safe (see {@link Database} for more
+ * thread-safety details).
*
* @author James Ahlborn
*/
diff --git a/src/java/com/healthmarketscience/jackcess/ColumnBuilder.java b/src/java/com/healthmarketscience/jackcess/ColumnBuilder.java
index 90ddc34..0154ce1 100644
--- a/src/java/com/healthmarketscience/jackcess/ColumnBuilder.java
+++ b/src/java/com/healthmarketscience/jackcess/ColumnBuilder.java
@@ -36,7 +36,8 @@ import com.healthmarketscience.jackcess.impl.JetFormat;
import com.healthmarketscience.jackcess.impl.DatabaseImpl;
/**
- * Builder style class for constructing a Column.
+ * Builder style class for constructing a {@link Column}. See {@link
+ * TableBuilder} for example usage.
*
* @author James Ahlborn
*/
diff --git a/src/java/com/healthmarketscience/jackcess/Cursor.java b/src/java/com/healthmarketscience/jackcess/Cursor.java
index 5c6d12f..f84f8dd 100644
--- a/src/java/com/healthmarketscience/jackcess/Cursor.java
+++ b/src/java/com/healthmarketscience/jackcess/Cursor.java
@@ -29,17 +29,23 @@ import com.healthmarketscience.jackcess.util.ErrorHandler;
import com.healthmarketscience.jackcess.util.IterableBuilder;
/**
- * Manages iteration for a Table. Different cursors provide different methods
- * of traversing a table. Cursors should be fairly robust in the face of
- * table modification during traversal (although depending on how the table is
- * traversed, row updates may or may not be seen). Multiple cursors may
+ * Manages iteration for a {@link Table}. Different cursors provide different
+ * methods of traversing a table. Cursors should be fairly robust in the face
+ * of table modification during traversal (although depending on how the table
+ * is traversed, row updates may or may not be seen). Multiple cursors may
* traverse the same table simultaneously.
+ * <p/>
+ * Basic cursors will generally iterate table data in the order it appears in
+ * the database and searches will require scanning the entire table.
+ * Additional features are available when utilizing an {@link Index} backed
+ * {@link IndexCursor}.
* <p>
* The {@link CursorBuilder} provides a variety of static utility methods to
* construct cursors with given characteristics or easily search for specific
* values as well as friendly and flexible construction options.
* <p>
- * Is not thread-safe.
+ * A Cursor instance is not thread-safe (see {@link Database} for more
+ * thread-safety details).
*
* @author James Ahlborn
*/
diff --git a/src/java/com/healthmarketscience/jackcess/CursorBuilder.java b/src/java/com/healthmarketscience/jackcess/CursorBuilder.java
index 9485090..26f3f92 100644
--- a/src/java/com/healthmarketscience/jackcess/CursorBuilder.java
+++ b/src/java/com/healthmarketscience/jackcess/CursorBuilder.java
@@ -43,9 +43,21 @@ import com.healthmarketscience.jackcess.util.ColumnMatcher;
/**
- * Builder style class for constructing a Cursor. By default, a cursor is
- * created at the beginning of the table, and any start/end rows are
+ * Builder style class for constructing a {@link Cursor}. By default, a
+ * cursor is created at the beginning of the table, and any start/end rows are
* inclusive.
+ * <p/>
+ * Simple example traversal:
+ * <pre>
+ * for(Row row : table.newCursor().toCursor()) {
+ * // ... process each row ...
+ * }
+ * </pre>
+ * <p/>
+ * Simple example search:
+ * <pre>
+ * Row row = CursorBuilder.findRow(table, Collections.singletonMap(col, "foo"));
+ * </pre>
*
* @author James Ahlborn
*/
@@ -325,14 +337,13 @@ public class CursorBuilder {
* types of indexes do not include all entries (namely, some indexes ignore
* null entries, see {@link Index#shouldIgnoreNulls}).
*
- * @param table the table over which this cursor will traverse
* @param index index for the table which will define traversal order as
* well as enhance certain lookups
*/
- public static IndexCursor createCursor(Table table, Index index)
+ public static IndexCursor createCursor(Index index)
throws IOException
{
- return table.newCursor().setIndex(index).toIndexCursor();
+ return index.getTable().newCursor().setIndex(index).toIndexCursor();
}
/**
@@ -343,7 +354,6 @@ public class CursorBuilder {
* types of indexes do not include all entries (namely, some indexes ignore
* null entries, see {@link Index#shouldIgnoreNulls}).
*
- * @param table the table over which this cursor will traverse
* @param index index for the table which will define traversal order as
* well as enhance certain lookups
* @param startRow the first row of data for the cursor (inclusive), or
@@ -351,11 +361,11 @@ public class CursorBuilder {
* @param endRow the last row of data for the cursor (inclusive), or
* {@code null} for the last entry
*/
- public static IndexCursor createCursor(Table table, Index index,
+ public static IndexCursor createCursor(Index index,
Object[] startRow, Object[] endRow)
throws IOException
{
- return table.newCursor().setIndex(index)
+ return index.getTable().newCursor().setIndex(index)
.setStartRow(startRow)
.setEndRow(endRow)
.toIndexCursor();
@@ -369,7 +379,6 @@ public class CursorBuilder {
* types of indexes do not include all entries (namely, some indexes ignore
* null entries, see {@link Index#shouldIgnoreNulls}).
*
- * @param table the table over which this cursor will traverse
* @param index index for the table which will define traversal order as
* well as enhance certain lookups
* @param startRow the first row of data for the cursor, or {@code null} for
@@ -379,14 +388,14 @@ public class CursorBuilder {
* the last entry
* @param endInclusive whether or not endRow is inclusive or exclusive
*/
- public static IndexCursor createCursor(Table table, Index index,
+ public static IndexCursor createCursor(Index index,
Object[] startRow,
boolean startInclusive,
Object[] endRow,
boolean endInclusive)
throws IOException
{
- return table.newCursor().setIndex(index)
+ return index.getTable().newCursor().setIndex(index)
.setStartRow(startRow)
.setStartRowInclusive(startInclusive)
.setEndRow(endRow)
@@ -452,15 +461,14 @@ public class CursorBuilder {
* Warning, this method <i>always</i> starts searching from the beginning of
* the Table (you cannot use it to find successive matches).
*
- * @param table the table to search
* @param index index to assist the search
* @param rowPattern pattern to be used to find the row
* @return the matching row or {@code null} if a match could not be found.
*/
- public static Row findRow(Table table, Index index, Map<String,?> rowPattern)
+ public static Row findRow(Index index, Map<String,?> rowPattern)
throws IOException
{
- Cursor cursor = createCursor(table, index);
+ Cursor cursor = createCursor(index);
if(cursor.findFirstRow(rowPattern)) {
return cursor.getCurrentRow();
}
@@ -477,7 +485,6 @@ public class CursorBuilder {
* distinguishing this situation is important, you will need to use a Cursor
* directly instead of this convenience method.
*
- * @param table the table to search
* @param index index to assist the search
* @param column column whose value should be returned
* @param columnPattern column being matched by the valuePattern
@@ -485,11 +492,11 @@ public class CursorBuilder {
* desired row
* @return the matching row or {@code null} if a match could not be found.
*/
- public static Object findValue(Table table, Index index, Column column,
+ public static Object findValue(Index index, Column column,
Column columnPattern, Object valuePattern)
throws IOException
{
- Cursor cursor = createCursor(table, index);
+ Cursor cursor = createCursor(index);
if(cursor.findFirstRow(columnPattern, valuePattern)) {
return cursor.getCurrentRowValue(column);
}
diff --git a/src/java/com/healthmarketscience/jackcess/DataType.java b/src/java/com/healthmarketscience/jackcess/DataType.java
index 586d16e..75a5a4e 100644
--- a/src/java/com/healthmarketscience/jackcess/DataType.java
+++ b/src/java/com/healthmarketscience/jackcess/DataType.java
@@ -39,7 +39,8 @@ import java.math.BigInteger;
import com.healthmarketscience.jackcess.impl.JetFormat;
/**
- * Access data type
+ * Supported access data types.
+ *
* @author Tim McCune
*/
public enum DataType {
diff --git a/src/java/com/healthmarketscience/jackcess/Database.java b/src/java/com/healthmarketscience/jackcess/Database.java
index 71a6d59..ab4b7ca 100644
--- a/src/java/com/healthmarketscience/jackcess/Database.java
+++ b/src/java/com/healthmarketscience/jackcess/Database.java
@@ -44,10 +44,15 @@ import com.healthmarketscience.jackcess.util.LinkResolver;
* Database has been opened, you can interact with the data via the relevant
* {@link Table}. When a Database instance is no longer useful, it should
* <b>always</b> be closed ({@link #close}) to avoid corruption.
- * <p>
- * Note, Database instances (and all the related objects) are <i>not</i>
+ * <p/>
+ * Database instances (and all the related objects) are <i>not</i>
* thread-safe. However, separate Database instances (and their respective
* objects) can be used by separate threads without a problem.
+ * <p/>
+ * Database instances do not implement any "transactional" support, and
+ * therefore concurrent editing of the same database file by multiple Database
+ * instances (or with outside programs such as MS Access) <i>will generally
+ * result in database file corruption</i>.
*
* @author James Ahlborn
* @usage _general_class_
diff --git a/src/java/com/healthmarketscience/jackcess/DatabaseBuilder.java b/src/java/com/healthmarketscience/jackcess/DatabaseBuilder.java
index e9ea26e..f046205 100644
--- a/src/java/com/healthmarketscience/jackcess/DatabaseBuilder.java
+++ b/src/java/com/healthmarketscience/jackcess/DatabaseBuilder.java
@@ -30,7 +30,19 @@ import com.healthmarketscience.jackcess.impl.CodecProvider;
import com.healthmarketscience.jackcess.util.MemFileChannel;
/**
- * Builder style class for opening/creating a Database.
+ * Builder style class for opening/creating a {@link Database}.
+ * <p/>
+ * Simple example usage:
+ * <pre>
+ * Database db = DatabaseBuilder.open(new File("test.mdb"));
+ * </pre>
+ * <p/>
+ * Advanced example usage:
+ * <pre>
+ * Database db = new DatabaseBuilder(new File("test.mdb"))
+ * .setReadOnly(true)
+ * .open();
+ * </pre>
*
* @author James Ahlborn
*/
diff --git a/src/java/com/healthmarketscience/jackcess/Index.java b/src/java/com/healthmarketscience/jackcess/Index.java
index 4054c66..9afc6eb 100644
--- a/src/java/com/healthmarketscience/jackcess/Index.java
+++ b/src/java/com/healthmarketscience/jackcess/Index.java
@@ -68,6 +68,11 @@ public interface Index
public boolean isUnique();
/**
+ * Convenience method for constructing a new CursorBuilder for this Index.
+ */
+ public CursorBuilder newCursor();
+
+ /**
* Information about a Column in an Index
*/
public interface Column {
diff --git a/src/java/com/healthmarketscience/jackcess/IndexBuilder.java b/src/java/com/healthmarketscience/jackcess/IndexBuilder.java
index 5e05e5a..3ea8443 100644
--- a/src/java/com/healthmarketscience/jackcess/IndexBuilder.java
+++ b/src/java/com/healthmarketscience/jackcess/IndexBuilder.java
@@ -28,7 +28,8 @@ import com.healthmarketscience.jackcess.impl.IndexData;
import com.healthmarketscience.jackcess.impl.IndexImpl;
/**
- * Builder style class for constructing an Index.
+ * Builder style class for constructing an {@link Index}. See {@link
+ * TableBuilder} for example usage.
*
* @author James Ahlborn
*/
diff --git a/src/java/com/healthmarketscience/jackcess/IndexCursor.java b/src/java/com/healthmarketscience/jackcess/IndexCursor.java
index 7871b65..8adff02 100644
--- a/src/java/com/healthmarketscience/jackcess/IndexCursor.java
+++ b/src/java/com/healthmarketscience/jackcess/IndexCursor.java
@@ -24,7 +24,9 @@ import java.io.IOException;
import com.healthmarketscience.jackcess.util.EntryIterableBuilder;
/**
- * Cursor backed by an index with extended traversal options.
+ * Cursor backed by an {@link Index} with extended traversal options. Table
+ * traversal will be in the order defined by the backing index. Lookups which
+ * utilize the columns of the index will be fast.
*
* @author James Ahlborn
*/
diff --git a/src/java/com/healthmarketscience/jackcess/Relationship.java b/src/java/com/healthmarketscience/jackcess/Relationship.java
index 2adb7cb..d8d82af 100644
--- a/src/java/com/healthmarketscience/jackcess/Relationship.java
+++ b/src/java/com/healthmarketscience/jackcess/Relationship.java
@@ -22,7 +22,8 @@ package com.healthmarketscience.jackcess;
import java.util.List;
/**
- * Information about a relationship between two tables in the database.
+ * Information about a relationship between two tables in the {@link
+ * Database}.
*
* @author James Ahlborn
*/
diff --git a/src/java/com/healthmarketscience/jackcess/Row.java b/src/java/com/healthmarketscience/jackcess/Row.java
index 00fa09f..ede63e2 100644
--- a/src/java/com/healthmarketscience/jackcess/Row.java
+++ b/src/java/com/healthmarketscience/jackcess/Row.java
@@ -22,7 +22,8 @@ package com.healthmarketscience.jackcess;
import java.util.Map;
/**
- * A row of data as column->value pairs.
+ * A row of data as column name->value pairs. Values are strongly typed, and
+ * column names are case sensitive.
*
* @author James Ahlborn
*/
diff --git a/src/java/com/healthmarketscience/jackcess/Table.java b/src/java/com/healthmarketscience/jackcess/Table.java
index a9fb4e7..516be6a 100644
--- a/src/java/com/healthmarketscience/jackcess/Table.java
+++ b/src/java/com/healthmarketscience/jackcess/Table.java
@@ -27,13 +27,16 @@ import java.util.Map;
import com.healthmarketscience.jackcess.util.ErrorHandler;
/**
- * A single database table. A Table instance is retrieved from a Database
- * instance. The Table instance provides access to the table metadata as well
- * as the table data. There are basic data operations on the Table interface,
- * but for advanced search and data manipulation a {@link Cursor} instance
- * should be used.
- * <p>
- * Is not thread-safe.
+ * A single database table. A Table instance is retrieved from a {@link
+ * Database} instance. The Table instance provides access to the table
+ * metadata as well as the table data. There are basic data operations on the
+ * Table interface (i.e. {@link #iterator} {@link #addRow}, {@link #updateRow}
+ * and {@link #deleteRow}), but for advanced search and data manipulation a
+ * {@link Cursor} instance should be used. New Tables can be created using a
+ * {@link TableBuilder}.
+ * <p/>
+ * A Table instance is not thread-safe (see {@link Database} for more
+ * thread-safety details).
*
* @author James Ahlborn
* @usage _general_class_
diff --git a/src/java/com/healthmarketscience/jackcess/TableBuilder.java b/src/java/com/healthmarketscience/jackcess/TableBuilder.java
index 9530f51..98c256f 100644
--- a/src/java/com/healthmarketscience/jackcess/TableBuilder.java
+++ b/src/java/com/healthmarketscience/jackcess/TableBuilder.java
@@ -38,7 +38,18 @@ import java.util.Set;
import com.healthmarketscience.jackcess.impl.DatabaseImpl;
/**
- * Builder style class for constructing a Column.
+ * Builder style class for constructing a {@link Table}.
+ * <p/>
+ * Example:
+ * <pre>
+ * Table table = new TableBuilder("Test")
+ * .addColumn(new ColumnBuilder("ID", DataType.LONG)
+ * .setAutoNumber(true))
+ * .addColumn(new ColumnBuilder("Name", DataType.TEXT))
+ * .addIndex(new IndexBuilder(IndexBuilder.PRIMARY_KEY_NAME)
+ * .addColumns("ID").setPrimaryKey())
+ * .toTable(db);
+ * </pre>
*
* @author James Ahlborn
*/
diff --git a/src/java/com/healthmarketscience/jackcess/impl/ComplexColumnSupport.java b/src/java/com/healthmarketscience/jackcess/impl/ComplexColumnSupport.java
index 9cf9b68..6a98ef0 100644
--- a/src/java/com/healthmarketscience/jackcess/impl/ComplexColumnSupport.java
+++ b/src/java/com/healthmarketscience/jackcess/impl/ComplexColumnSupport.java
@@ -77,7 +77,7 @@ public class ComplexColumnSupport
DatabaseImpl db = column.getDatabase();
TableImpl complexColumns = db.getSystemComplexColumns();
IndexCursor cursor = CursorBuilder.createCursor(
- complexColumns, complexColumns.getPrimaryKeyIndex());
+ complexColumns.getPrimaryKeyIndex());
if(!cursor.findFirstRowByEntry(complexTypeId)) {
throw new IOException(
"Could not find complex column info for complex column with id " +
diff --git a/src/java/com/healthmarketscience/jackcess/impl/DatabaseImpl.java b/src/java/com/healthmarketscience/jackcess/impl/DatabaseImpl.java
index da70cbd..5c28d36 100644
--- a/src/java/com/healthmarketscience/jackcess/impl/DatabaseImpl.java
+++ b/src/java/com/healthmarketscience/jackcess/impl/DatabaseImpl.java
@@ -1929,8 +1929,7 @@ public class DatabaseImpl implements Database
@Override
protected Cursor getTableNamesCursor() throws IOException {
- return _systemCatalog.newCursor()
- .setIndex(_systemCatalogCursor.getIndex())
+ return _systemCatalogCursor.getIndex().newCursor()
.setStartEntry(_tableParentId, IndexData.MIN_VALUE)
.setEndEntry(_tableParentId, IndexData.MAX_VALUE)
.toIndexCursor();
diff --git a/src/java/com/healthmarketscience/jackcess/impl/IndexImpl.java b/src/java/com/healthmarketscience/jackcess/impl/IndexImpl.java
index 1fd560b..db76294 100644
--- a/src/java/com/healthmarketscience/jackcess/impl/IndexImpl.java
+++ b/src/java/com/healthmarketscience/jackcess/impl/IndexImpl.java
@@ -33,11 +33,12 @@ import java.util.Collections;
import java.util.List;
import java.util.Map;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import com.healthmarketscience.jackcess.CursorBuilder;
import com.healthmarketscience.jackcess.Index;
-import com.healthmarketscience.jackcess.RowId;
import com.healthmarketscience.jackcess.IndexBuilder;
+import com.healthmarketscience.jackcess.RowId;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
/**
* Access table (logical) index. Logical indexes are backed for IndexData,
@@ -220,6 +221,10 @@ public class IndexImpl implements Index, Comparable<IndexImpl>
return getIndexData().getColumns();
}
+ public CursorBuilder newCursor() {
+ return getTable().newCursor().setIndex(this);
+ }
+
/**
* Whether or not the complete index state has been read.
*/
diff --git a/src/java/com/healthmarketscience/jackcess/util/Joiner.java b/src/java/com/healthmarketscience/jackcess/util/Joiner.java
index 02aa051..8a4b854 100644
--- a/src/java/com/healthmarketscience/jackcess/util/Joiner.java
+++ b/src/java/com/healthmarketscience/jackcess/util/Joiner.java
@@ -81,8 +81,7 @@ public class Joiner
throws IOException
{
Index toIndex = fromIndex.getReferencedIndex();
- IndexCursor toCursor = CursorBuilder.createCursor(
- toIndex.getTable(), toIndex);
+ IndexCursor toCursor = CursorBuilder.createCursor(toIndex);
// text lookups are always case-insensitive
toCursor.setColumnMatcher(CaseInsensitiveColumnMatcher.INSTANCE);
return new Joiner(fromIndex, toCursor);
diff --git a/test/src/java/com/healthmarketscience/jackcess/BigIndexTest.java b/test/src/java/com/healthmarketscience/jackcess/BigIndexTest.java
index 70d63d8..32f228e 100644
--- a/test/src/java/com/healthmarketscience/jackcess/BigIndexTest.java
+++ b/test/src/java/com/healthmarketscience/jackcess/BigIndexTest.java
@@ -125,7 +125,7 @@ public class BigIndexTest extends TestCase {
String prevValue = firstValue;
int rowCount = 0;
List<String> firstTwo = new ArrayList<String>();
- for(Map<String,Object> row : CursorBuilder.createCursor(t, index)) {
+ for(Map<String,Object> row : CursorBuilder.createCursor(index)) {
String origVal = (String)row.get("col1");
String val = origVal;
if(val == null) {
@@ -145,7 +145,7 @@ public class BigIndexTest extends TestCase {
index.getIndexData().validate();
// delete an entry in the middle
- Cursor cursor = CursorBuilder.createCursor(t, index);
+ Cursor cursor = CursorBuilder.createCursor(index);
for(int i = 0; i < (rowCount / 2); ++i) {
assertTrue(cursor.moveToNextRow());
}
@@ -162,7 +162,7 @@ public class BigIndexTest extends TestCase {
index.getIndexData().validate();
List<String> found = new ArrayList<String>();
- for(Map<String,Object> row : CursorBuilder.createCursor(t, index)) {
+ for(Map<String,Object> row : CursorBuilder.createCursor(index)) {
found.add((String)row.get("col1"));
}
@@ -193,7 +193,7 @@ public class BigIndexTest extends TestCase {
index.getIndexData().validate();
- cursor = CursorBuilder.createCursor(t, index);
+ cursor = CursorBuilder.createCursor(index);
while(cursor.moveToNextRow()) {
cursor.deleteCurrentRow();
}
diff --git a/test/src/java/com/healthmarketscience/jackcess/CursorBuilderTest.java b/test/src/java/com/healthmarketscience/jackcess/CursorBuilderTest.java
index 26d22e7..affd28c 100644
--- a/test/src/java/com/healthmarketscience/jackcess/CursorBuilderTest.java
+++ b/test/src/java/com/healthmarketscience/jackcess/CursorBuilderTest.java
@@ -67,13 +67,13 @@ public class CursorBuilderTest extends TestCase {
Cursor found = new CursorBuilder(table).toCursor();
assertCursor(expected, found);
- expected = CursorBuilder.createCursor(table, idx);
+ expected = CursorBuilder.createCursor(idx);
found = new CursorBuilder(table)
.setIndex(idx)
.toCursor();
assertCursor(expected, found);
- expected = CursorBuilder.createCursor(table, idx);
+ expected = CursorBuilder.createCursor(idx);
found = new CursorBuilder(table)
.setIndexByName("id")
.toCursor();
@@ -87,7 +87,7 @@ public class CursorBuilderTest extends TestCase {
// success
}
- expected = CursorBuilder.createCursor(table, idx);
+ expected = CursorBuilder.createCursor(idx);
found = new CursorBuilder(table)
.setIndexByColumns(table.getColumn("id"))
.toCursor();
@@ -132,7 +132,7 @@ public class CursorBuilderTest extends TestCase {
.toCursor();
assertCursor(expected, found);
- expected = CursorBuilder.createCursor(table, idx);
+ expected = CursorBuilder.createCursor(idx);
expected.moveNextRows(2);
sp = expected.getSavepoint();
found = new CursorBuilder(table)
@@ -142,7 +142,7 @@ public class CursorBuilderTest extends TestCase {
.toCursor();
assertCursor(expected, found);
- expected = CursorBuilder.createCursor(table, idx,
+ expected = CursorBuilder.createCursor(idx,
idx.constructIndexRowFromEntry(3),
null);
found = new CursorBuilder(table)
@@ -151,7 +151,7 @@ public class CursorBuilderTest extends TestCase {
.toCursor();
assertCursor(expected, found);
- expected = CursorBuilder.createCursor(table, idx,
+ expected = CursorBuilder.createCursor(idx,
idx.constructIndexRowFromEntry(3),
false,
idx.constructIndexRowFromEntry(7),
diff --git a/test/src/java/com/healthmarketscience/jackcess/CursorTest.java b/test/src/java/com/healthmarketscience/jackcess/CursorTest.java
index 59de129..d10d18b 100644
--- a/test/src/java/com/healthmarketscience/jackcess/CursorTest.java
+++ b/test/src/java/com/healthmarketscience/jackcess/CursorTest.java
@@ -397,19 +397,19 @@ public class CursorTest extends TestCase {
createExpectedRow("id", 5)));
if(index != null) {
assertEquals("data" + 5,
- CursorBuilder.findValue(table, index,
+ CursorBuilder.findValue(index,
table.getColumn("value"),
table.getColumn("id"), 5));
assertEquals(createExpectedRow("id", 5,
"value", "data" + 5),
- CursorBuilder.findRow(table, index,
+ CursorBuilder.findRow(index,
createExpectedRow("id", 5)));
- assertNull(CursorBuilder.findValue(table, index,
+ assertNull(CursorBuilder.findValue(index,
table.getColumn("value"),
table.getColumn("id"),
-17));
- assertNull(CursorBuilder.findRow(table, index,
+ assertNull(CursorBuilder.findRow(index,
createExpectedRow("id", 13)));
}
}
@@ -586,7 +586,7 @@ public class CursorTest extends TestCase {
assertTable(createUnorderedTestTableData(), table);
- Cursor cursor = CursorBuilder.createCursor(table, idx);
+ Cursor cursor = CursorBuilder.createCursor(idx);
doTestSimple(cursor, null);
db.close();
@@ -599,7 +599,7 @@ public class CursorTest extends TestCase {
Table table = db.getTable("test");
Index idx = table.getIndexes().get(0);
- Cursor cursor = CursorBuilder.createCursor(table, idx);
+ Cursor cursor = CursorBuilder.createCursor(idx);
doTestMove(cursor, null);
db.close();
@@ -612,7 +612,7 @@ public class CursorTest extends TestCase {
Table table = db.getTable("test");
Index idx = table.getIndexes().get(0);
- Cursor cursor = CursorBuilder.createCursor(table, idx);
+ Cursor cursor = CursorBuilder.createCursor(idx);
doTestReverse(cursor, null);
db.close();
@@ -625,7 +625,7 @@ public class CursorTest extends TestCase {
Table table = db.getTable("test");
Index idx = table.getIndexes().get(0);
- Cursor cursor = CursorBuilder.createCursor(table, idx);
+ Cursor cursor = CursorBuilder.createCursor(idx);
doTestSearch(table, cursor, idx, 42, -13);
db.close();
@@ -639,8 +639,8 @@ public class CursorTest extends TestCase {
Table table = db.getTable("test");
Index idx = table.getIndexes().get(0);
- Cursor cursor1 = CursorBuilder.createCursor(table, idx);
- Cursor cursor2 = CursorBuilder.createCursor(table, idx);
+ Cursor cursor1 = CursorBuilder.createCursor(idx);
+ Cursor cursor2 = CursorBuilder.createCursor(idx);
doTestLiveAddition(table, cursor1, cursor2, 11);
db.close();
@@ -654,10 +654,10 @@ public class CursorTest extends TestCase {
Table table = db.getTable("test");
Index idx = table.getIndexes().get(0);
- Cursor cursor1 = CursorBuilder.createCursor(table, idx);
- Cursor cursor2 = CursorBuilder.createCursor(table, idx);
- Cursor cursor3 = CursorBuilder.createCursor(table, idx);
- Cursor cursor4 = CursorBuilder.createCursor(table, idx);
+ Cursor cursor1 = CursorBuilder.createCursor(idx);
+ Cursor cursor2 = CursorBuilder.createCursor(idx);
+ Cursor cursor3 = CursorBuilder.createCursor(idx);
+ Cursor cursor4 = CursorBuilder.createCursor(idx);
doTestLiveDeletion(cursor1, cursor2, cursor3, cursor4, 1);
db.close();
@@ -798,7 +798,7 @@ public class CursorTest extends TestCase {
Table table = db.getTable("test");
Index idx = table.getIndexes().get(0);
- Cursor cursor = CursorBuilder.createCursor(table, idx);
+ Cursor cursor = CursorBuilder.createCursor(idx);
doTestFindAll(table, cursor, idx);
@@ -912,7 +912,7 @@ public class CursorTest extends TestCase {
Index idx = table.getIndexes().get(0);
Cursor tCursor = CursorBuilder.createCursor(table);
- Cursor iCursor = CursorBuilder.createCursor(table, idx);
+ Cursor iCursor = CursorBuilder.createCursor(idx);
Cursor.Savepoint tSave = tCursor.getSavepoint();
Cursor.Savepoint iSave = iCursor.getSavepoint();
@@ -935,7 +935,7 @@ public class CursorTest extends TestCase {
}
Cursor tCursor2 = CursorBuilder.createCursor(table);
- Cursor iCursor2 = CursorBuilder.createCursor(table, idx);
+ Cursor iCursor2 = CursorBuilder.createCursor(idx);
tCursor2.restoreSavepoint(tSave);
iCursor2.restoreSavepoint(iSave);
@@ -1072,7 +1072,7 @@ public class CursorTest extends TestCase {
Database db = open(testDB);
Table t1 = db.getTable("Table1");
Index idx = t1.getIndex(IndexBuilder.PRIMARY_KEY_NAME);
- IndexCursor cursor = CursorBuilder.createCursor(t1, idx);
+ IndexCursor cursor = CursorBuilder.createCursor(idx);
assertFalse(cursor.findFirstRowByEntry(-1));
cursor.findClosestRowByEntry(-1);
@@ -1099,7 +1099,7 @@ public class CursorTest extends TestCase {
Database db = openCopy(testDB);
Table t1 = db.getTable("Table1");
Index idx = t1.getIndex("Table2Table1");
- IndexCursor cursor = CursorBuilder.createCursor(t1, idx);
+ IndexCursor cursor = CursorBuilder.createCursor(idx);
List<String> expectedData = new ArrayList<String>();
for(Map<String,Object> row : cursor.newEntryIterable(1)
diff --git a/test/src/java/com/healthmarketscience/jackcess/IndexTest.java b/test/src/java/com/healthmarketscience/jackcess/IndexTest.java
index 8c6284a..5d1548c 100644
--- a/test/src/java/com/healthmarketscience/jackcess/IndexTest.java
+++ b/test/src/java/com/healthmarketscience/jackcess/IndexTest.java
@@ -260,8 +260,8 @@ public class IndexTest extends TestCase {
assertEquals(origI.getIndexData().getEntryCount(),
tempI.getIndexData().getEntryCount());
- Cursor origC = CursorBuilder.createCursor(orig, origI);
- Cursor tempC = CursorBuilder.createCursor(temp, tempI);
+ Cursor origC = origI.newCursor().toCursor();
+ Cursor tempC = tempI.newCursor().toCursor();
while(true) {
boolean origHasNext = origC.moveToNextRow();
diff --git a/test/src/java/com/healthmarketscience/jackcess/impl/IndexCodesTest.java b/test/src/java/com/healthmarketscience/jackcess/impl/IndexCodesTest.java
index 56f9096..62565ac 100644
--- a/test/src/java/com/healthmarketscience/jackcess/impl/IndexCodesTest.java
+++ b/test/src/java/com/healthmarketscience/jackcess/impl/IndexCodesTest.java
@@ -92,7 +92,7 @@ public class IndexCodesTest extends TestCase {
// index.initialize();
// System.out.println("Ind " + index);
- Cursor cursor = CursorBuilder.createCursor(t, index);
+ Cursor cursor = CursorBuilder.createCursor(index);
while(cursor.moveToNextRow()) {
Map<String,Object> row = cursor.getCurrentRow();
@@ -118,7 +118,7 @@ public class IndexCodesTest extends TestCase {
throws Exception
{
Object[] idxRow = ((IndexImpl)index).constructIndexRow(expectedRow);
- Cursor cursor = CursorBuilder.createCursor(t, index, idxRow, idxRow);
+ Cursor cursor = CursorBuilder.createCursor(index, idxRow, idxRow);
Cursor.Position startPos = cursor.getSavepoint().getCurrentPosition();
@@ -268,7 +268,7 @@ public class IndexCodesTest extends TestCase {
System.out.println("Ind " + ind);
- Cursor cursor = CursorBuilder.createCursor(t, ind);
+ Cursor cursor = CursorBuilder.createCursor(ind);
while(cursor.moveToNextRow()) {
System.out.println("=======");
String entryStr =
@@ -320,7 +320,7 @@ public class IndexCodesTest extends TestCase {
((IndexImpl)index).initialize();
System.out.println("Ind " + index);
- Cursor cursor = CursorBuilder.createCursor(t, index);
+ Cursor cursor = CursorBuilder.createCursor(index);
while(cursor.moveToNextRow()) {
System.out.println("=======");
System.out.println("Savepoint: " + cursor.getSavepoint());
@@ -355,7 +355,7 @@ public class IndexCodesTest extends TestCase {
Map<Character,String[]> inat2CrazyCodes = new TreeMap<Character,String[]>();
- Cursor cursor = CursorBuilder.createCursor(t, index);
+ Cursor cursor = CursorBuilder.createCursor(index);
while(cursor.moveToNextRow()) {
// System.out.println("=======");
// System.out.println("Savepoint: " + cursor.getSavepoint());
@@ -534,7 +534,7 @@ public class IndexCodesTest extends TestCase {
Map<Character,String[]> inat2CrazyCodes = new TreeMap<Character,String[]>();
- Cursor cursor = CursorBuilder.createCursor(t, index);
+ Cursor cursor = CursorBuilder.createCursor(index);
while(cursor.moveToNextRow()) {
// System.out.println("=======");
// System.out.println("Savepoint: " + cursor.getSavepoint());