public Row getObjectRow(Integer parentId, String name, Collection<String> columns) throws IOException { Cursor cur = findRow(parentId, name); return ((cur != null) ? cur.getCurrentRow(columns) : null); }
public boolean moveToNextRow(Cursor cur, Set<String> columnNames) throws IOException { boolean hasNext = cur.moveToNextRow(); if (hasNext) { this.currentRow = cur.getCurrentRow(columnNames); } return hasNext; }
public Row getObjectRow( Integer objectId, Collection<String> columns) throws IOException { Cursor cur = findRow(objectId); return ((cur != null) ? cur.getCurrentRow(columns) : null); }
Table table = DatabaseBuilder.open(new File("my.mdb")).getTable("MyTable"); Cursor cursor = CursorBuilder.createCursor(table); while (cursor.findNextRow(Collections.singletonMap("a", "foo"))) { Row row = cursor.getCurrentRow(); System.out.println(String.format( "a='%s', SomeFieldName='%s'.", row.get("a"), row.get("SomeFieldName"))); }
Database db = DatabaseBuilder.open(new File("C:/Users/Public/mdbTest.mdb")); Table tbl = db.getSystemTable("MSysObjects"); Cursor crsr = tbl.getDefaultCursor(); Map<String, Object> findCriteria = new HashMap<String, Object>(); findCriteria.put("Name", "refNum"); findCriteria.put("Type", (short)1); String status = ""; if (crsr.findFirstRow(findCriteria)) { tbl.deleteRow(crsr.getCurrentRow()); status = "table dropped (row deleted from MSysObjects)"; } else { status = "row not found in MSysObjects"; } System.out.println(status); db.close();
/** * Convenience method for finding a specific row in a table which matches a * given row "pattern". See {@link Cursor#findFirstRow(Map)} for details on * the rowPattern. * <p> * 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 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, Map<String,?> rowPattern) throws IOException { Cursor cursor = createCursor(table); if(cursor.findFirstRow(rowPattern)) { return cursor.getCurrentRow(); } return null; }
/** * Convenience method for finding a specific row in an indexed table which * matches a given row "pattern". See {@link Cursor#findFirstRow(Map)} for * details on the rowPattern. * <p> * Warning, this method <i>always</i> starts searching from the beginning of * the Table (you cannot use it to find successive matches). * * @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(Index index, Map<String,?> rowPattern) throws IOException { Cursor cursor = createCursor(index); if(cursor.findFirstRow(rowPattern)) { return cursor.getCurrentRow(); } return null; }
public OleBlob getOleBlob(Database db) throws UcanaccessSQLException { try { Table t = db.getTable(tableName); Cursor c = CursorBuilder.createPrimaryKeyCursor(t); return c.findFirstRow(key) ? c.getCurrentRow().getBlob(columnName) : null; } catch (IOException e) { throw new UcanaccessSQLException(e); } }
Map<String, Object> rowtsa = new HashMap<String, Object>(); rowtsa.put("ObjectId", id); Row r = catc.getCurrentRow(); r.put("Name", tn); catc.updateCurrentRowFromMap(r);
ComplexValueForeignKey rowFk = (ComplexValueForeignKey) cl.getRowValue(cur.getCurrentRow());