]> source.dussan.org Git - jackcess.git/commitdiff
add some more examples
authorJames Ahlborn <jtahlborn@yahoo.com>
Wed, 22 Sep 2010 01:34:46 +0000 (01:34 +0000)
committerJames Ahlborn <jtahlborn@yahoo.com>
Wed, 22 Sep 2010 01:34:46 +0000 (01:34 +0000)
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@484 f203690c-595d-4dc9-a70b-905162fa7fd2

src/site/xdoc/index.xml

index 7dabdae50afce63c271986a1b69fd0e1c020854c..d42542a1d147b63dadef909d30d6ffbf1546eee0 100644 (file)
         <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>