aboutsummaryrefslogtreecommitdiffstats
path: root/src/site/xdoc
diff options
context:
space:
mode:
authorJames Ahlborn <jtahlborn@yahoo.com>2013-08-02 03:45:50 +0000
committerJames Ahlborn <jtahlborn@yahoo.com>2013-08-02 03:45:50 +0000
commit482ba4844a366f6d606314ad4c9dd22723bc5f8d (patch)
treef82bec36dd7a80f87109b80c6fd626a35d080cb6 /src/site/xdoc
parentc622f4dc2fea16a2f4b45e5c83c8e5df66a3a797 (diff)
downloadjackcess-482ba4844a366f6d606314ad4c9dd22723bc5f8d.tar.gz
jackcess-482ba4844a366f6d606314ad4c9dd22723bc5f8d.zip
update docs for 2.x api
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@768 f203690c-595d-4dc9-a70b-905162fa7fd2
Diffstat (limited to 'src/site/xdoc')
-rw-r--r--src/site/xdoc/cookbook.xml21
-rw-r--r--src/site/xdoc/index.xml31
2 files changed, 27 insertions, 25 deletions
diff --git a/src/site/xdoc/cookbook.xml b/src/site/xdoc/cookbook.xml
index b32e725..2d0ec1b 100644
--- a/src/site/xdoc/cookbook.xml
+++ b/src/site/xdoc/cookbook.xml
@@ -9,11 +9,11 @@
<section name="Introduction">
<p>
This cookbook will attempt to familiarize the reader with the various
- nooks and crannies of the Jackcess API. The API is large due to the
- large feature-set that an Access Database provides, so this cookbook
- will by no means be exhaustive. However, this will hopefully give the
- reader enough useful building blocks such that the rest of the API can
- be discovered and utilized as necessary.
+ nooks and crannies of the Jackcess 2.x API. The API is large due to
+ the large feature-set that an Access Database provides, so this
+ cookbook will by no means be exhaustive. However, this will hopefully
+ give the reader enough useful building blocks such that the rest of
+ the API can be discovered and utilized as necessary.
</p>
<p>
This cookbook is a cross between a tutorial and a reference, so the
@@ -48,7 +48,7 @@
<a href="apidocs/com/healthmarketscience/jackcess/Database.html">Database</a> class.
</p>
<source>
- Database db = Database.open(new File("mydb.mdb"));
+ Database db = DatabaseBuilder.open(new File("mydb.mdb"));
</source>
<p>
That's it, now you have a Database instance (maybe this isn't that
@@ -76,11 +76,12 @@
is the best way to interact with the data in a Table, for the sake
of simplicity when just getting started, we will use the simplified
iteration provided by the Table class itself. When reading row
- data, it is generally provided as a <code>Map&lt;String,Object&gt;</code> where the keys are the column
+ data, it is generally provided as a <a
+ href="apidocs/com/healthmarketscience/jackcess/Row.html">Row</a> where the keys are the column
names and the values are the strongly typed column values.
</p>
<source>
- for(Map&lt;String,Object&gt; row : table) {
+ for(Row row : table) {
System.out.prinln("Look ma, a row: " + row);
}
</source>
@@ -112,7 +113,7 @@
their values like so:
</p>
<source>
- Map&lt;String,Object&gt; row = ...;
+ Row row = ...;
for(Column column : table.getColumns()) {
String columnName = column.getName();
Object value = row.get(columnName);
@@ -191,7 +192,7 @@
is possible may be out of date).
</p>
<p>
- As of version 1.2.10, Jackcess supports:
+ As of version 2.0.0, Jackcess supports:
</p>
<ul>
<li>Creating databases for Access all versions 2000-2010</li>
diff --git a/src/site/xdoc/index.xml b/src/site/xdoc/index.xml
index 1e02162..3ed52e8 100644
--- a/src/site/xdoc/index.xml
+++ b/src/site/xdoc/index.xml
@@ -6,10 +6,11 @@
<title>Java Library for MS Access</title>
</properties>
<body>
+
<section name="Jackcess">
<p>
Jackcess is a pure Java library for reading from and writing to MS
- Access databases (currently supporting versions 2000-2007). It is part of the <a href="http://openhms.sourceforge.net/">OpenHMS</a> project from <a href="http://www.healthmarketscience.com/">Health Market Science, Inc.</a>. It is not an application. There is no GUI. It's a
+ Access databases (currently supporting versions 2000-2010). It is part of the <a href="http://openhms.sourceforge.net/">OpenHMS</a> project from <a href="http://www.healthmarketscience.com/">Health Market Science, Inc.</a>. It is not an application. There is no GUI. It's a
library, intended for other developers to use to build Java
applications. Jackcess is licensed under the
@@ -19,6 +20,7 @@
for more info.
</p>
</section>
+
<section name="Sample code">
<p>
Here are a few snippets of code to whet your appetite. For more
@@ -26,19 +28,15 @@
unit tested, you can find even more example code in the <a href="xref-test/index.html">unit tests</a>.
</p>
<ul>
- <li>Displaying the contents of a table:
- <source>System.out.println(Database.open(new File("my.mdb")).getTable("MyTable").display());
-</source>
- </li>
<li>Iterating through the rows of a table:
- <source>Table table = Database.open(new File("my.mdb")).getTable("MyTable");
-for(Map&lt;String, Object&gt; row : table) {
+ <source>Table table = DatabaseBuilder.open(new File("my.mdb")).getTable("MyTable");
+for(Row row : table) {
System.out.println("Column 'a' has value: " + row.get("a"));
}
</source>
</li>
<li>Searching for a row with a specific column value:
- <source>Map&lt;String, Object&gt; row = Cursor.findRow(table, Collections.singletonMap("a", "foo"));
+ <source>Row row = CursorBuilder.findRow(table, Collections.singletonMap("a", "foo"));
if(row != null) {
System.out.println("Found row where 'a' == 'foo': " + row);
} else {
@@ -47,14 +45,12 @@ if(row != null) {
</source>
</li>
<li>Creating a new table and writing data into it:
- <source>Database db = Database.create(new File("new.mdb"));
+ <source>Database db = DatabaseBuilder.create(Database.FileFormat.V2000, new File("new.mdb"));
Table newTable = new TableBuilder("NewTable")
.addColumn(new ColumnBuilder("a")
- .setSQLType(Types.INTEGER)
- .toColumn())
+ .setSQLType(Types.INTEGER))
.addColumn(new ColumnBuilder("b")
- .setSQLType(Types.VARCHAR)
- .toColumn())
+ .setSQLType(Types.VARCHAR))
.toTable(db);
newTable.addRow(1, "foo");
</source>
@@ -62,13 +58,18 @@ newTable.addRow(1, "foo");
<li>Copying the contents of a JDBC ResultSet (e.g. from an
external database) into a new table:
- <source>Database.open(new File("my.mdb")).copyTable("Imported", resultSet);</source>
+ <source>Database db = DatabaseBuilder.open(new File("my.mdb"));
+new ImportUtil.Builder(db, "Imported").importResultSet(resultSet);
+db.close();</source>
</li>
<li>Copying the contents of a CSV file into a new table:
- <source>Database.open(new File("my.mdb")).importFile("Imported2", new File("my.csv"), ",");</source>
+ <source>Database db = DatabaseBuilder.open(new File("my.mdb"));
+new ImportUtil.Builder(db, "Imported2").setDelimiter(",").importFile(new File("my.csv"));
+db.close();</source>
</li>
</ul>
</section>
+
<section name="Other Resources">
Some other jackcess related projects:
<ul>