Browse Source

add some more examples

git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@484 f203690c-595d-4dc9-a70b-905162fa7fd2
tags/jackcess-1.2.2
James Ahlborn 13 years ago
parent
commit
d540734522
1 changed files with 17 additions and 0 deletions
  1. 17
    0
      src/site/xdoc/index.xml

+ 17
- 0
src/site/xdoc/index.xml View File

@@ -23,6 +23,22 @@
<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) {
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"));
if(row != null) {
System.out.println("Found row where 'a' == 'foo': " + row);
} else {
System.out.println("Could not find row where 'a' == 'foo'");
}
</source>
</li>
<li>Creating a new table and writing data into it:
@@ -38,6 +54,7 @@ Table newTable = new TableBuilder("NewTable")
newTable.addRow(1, "foo");
</source>
</li>

<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>

Loading…
Cancel
Save