diff options
author | James Ahlborn <jtahlborn@yahoo.com> | 2007-07-13 01:19:09 +0000 |
---|---|---|
committer | James Ahlborn <jtahlborn@yahoo.com> | 2007-07-13 01:19:09 +0000 |
commit | c06862149bc2c2e09db8a1912abb625e3bb60463 (patch) | |
tree | 9a7385b3d1a96a6e714daa429cf85ac36a56b457 /test | |
parent | d7d03c513ce0a30dd2270c6d129345f7d4b30f15 (diff) | |
download | jackcess-c06862149bc2c2e09db8a1912abb625e3bb60463.tar.gz jackcess-c06862149bc2c2e09db8a1912abb625e3bb60463.zip |
add support for writing large table definitions; move table definition code into Table (out of Database)
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@159 f203690c-595d-4dc9-a70b-905162fa7fd2
Diffstat (limited to 'test')
-rw-r--r-- | test/src/java/com/healthmarketscience/jackcess/DatabaseTest.java | 38 | ||||
-rw-r--r-- | test/src/java/com/healthmarketscience/jackcess/TableTest.java | 8 |
2 files changed, 41 insertions, 5 deletions
diff --git a/test/src/java/com/healthmarketscience/jackcess/DatabaseTest.java b/test/src/java/com/healthmarketscience/jackcess/DatabaseTest.java index 5083577..c46ee00 100644 --- a/test/src/java/com/healthmarketscience/jackcess/DatabaseTest.java +++ b/test/src/java/com/healthmarketscience/jackcess/DatabaseTest.java @@ -663,6 +663,42 @@ public class DatabaseTest extends TestCase { db.close(); } + + + public void testLargeTableDef() throws Exception { + final int numColumns = 90; + Database db = create(); + + List<Column> columns = new ArrayList<Column>(); + List<String> colNames = new ArrayList<String>(); + for(int i = 0; i < numColumns; ++i) { + String colName = "MyColumnName" + i; + colNames.add(colName); + Column col = new Column(); + col.setName(colName); + col.setType(DataType.TEXT); + columns.add(col); + } + + db.createTable("test", columns); + + Table t = db.getTable("test"); + + List<String> row = new ArrayList<String>(); + Map<String,Object> expectedRowData = new HashMap<String, Object>(); + for(int i = 0; i < numColumns; ++i) { + String value = "" + i + " some row data"; + row.add(value); + expectedRowData.put(colNames.get(i), value); + } + + t.addRow(row.toArray()); + + t.reset(); + assertEquals(expectedRowData, t.getNextRow()); + + db.close(); + } static Object[] createTestRow(String col1Val) { return new Object[] {col1Val, "R", "McCune", 1234, (byte) 0xad, 555.66d, @@ -713,7 +749,7 @@ public class DatabaseTest extends TestCase { columns.add(col); db.createTable("test", columns); } - + static String createString(int len) { StringBuilder builder = new StringBuilder(len); for(int i = 0; i < len; ++i) { diff --git a/test/src/java/com/healthmarketscience/jackcess/TableTest.java b/test/src/java/com/healthmarketscience/jackcess/TableTest.java index 96d33fa..041600a 100644 --- a/test/src/java/com/healthmarketscience/jackcess/TableTest.java +++ b/test/src/java/com/healthmarketscience/jackcess/TableTest.java @@ -19,15 +19,15 @@ public class TableTest extends TestCase { public void testCreateRow() throws Exception { JetFormat format = JetFormat.VERSION_4; - Table table = new Table(); + Table table = new Table(true); List<Column> columns = new ArrayList<Column>(); - Column col = new Column(); + Column col = new Column(true); col.setType(DataType.INT); columns.add(col); - col = new Column(); + col = new Column(true); col.setType(DataType.TEXT); columns.add(col); - col = new Column(); + col = new Column(true); col.setType(DataType.TEXT); columns.add(col); table.setColumns(columns); |