• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Cursor类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.healthmarketscience.jackcess.Cursor的典型用法代码示例。如果您正苦于以下问题:Java Cursor类的具体用法?Java Cursor怎么用?Java Cursor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Cursor类属于com.healthmarketscience.jackcess包,在下文中一共展示了Cursor类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getRelationshipsImpl

import com.healthmarketscience.jackcess.Cursor; //导入依赖的package包/类
private List<Relationship> getRelationshipsImpl(
    TableImpl table1, TableImpl table2, boolean includeSystemTables)
  throws IOException
{
  initRelationships();
  
  List<Relationship> relationships = new ArrayList<Relationship>();

  if(table1 != null) {
    Cursor cursor = createCursorWithOptionalIndex(
        _relationships, REL_COL_FROM_TABLE, table1.getName());
    collectRelationships(cursor, table1, table2, relationships,
                         includeSystemTables);
    cursor = createCursorWithOptionalIndex(
        _relationships, REL_COL_TO_TABLE, table1.getName());
    collectRelationships(cursor, table2, table1, relationships,
                         includeSystemTables);
  } else {
    collectRelationships(new CursorBuilder(_relationships).toCursor(),
                         null, null, relationships, includeSystemTables);
  }
  
  return relationships;
}
 
开发者ID:jahlborn,项目名称:jackcess,代码行数:25,代码来源:DatabaseImpl.java


示例2: collectNewObjectSIDs

import com.healthmarketscience.jackcess.Cursor; //导入依赖的package包/类
/**
 * Find collection of SIDs for the given parent id.
 */
private void collectNewObjectSIDs(Integer parentId, List<byte[]> sids) 
  throws IOException
{
  // search for ACEs matching the given parentId.  use the index on the
  // objectId column if found (should be there)
  Cursor cursor = createCursorWithOptionalIndex(
      getAccessControlEntries(), ACE_COL_OBJECT_ID, parentId);
  
  for(Row row : cursor) {
    Integer objId = row.getInt(ACE_COL_OBJECT_ID);
    if(parentId.equals(objId)) {
      sids.add(row.getBytes(ACE_COL_SID));
    }
  }

  if(sids.isEmpty()) {
    // if all else fails, use the hard-coded default
    sids.add(SYS_DEFAULT_SID);
  }
}
 
开发者ID:jahlborn,项目名称:jackcess,代码行数:24,代码来源:DatabaseImpl.java


示例3: createCursorWithOptionalIndex

import com.healthmarketscience.jackcess.Cursor; //导入依赖的package包/类
/**
 * Creates a Cursor restricted to the given column value if possible (using
 * an existing index), otherwise a simple table cursor.
 */
private Cursor createCursorWithOptionalIndex(
    TableImpl table, String colName, Object colValue)
  throws IOException
{
  try {
    return table.newCursor()
      .setIndexByColumnNames(colName)
      .setSpecificEntry(colValue)
      .toCursor();
  } catch(IllegalArgumentException e) {
    if(LOG.isDebugEnabled()) {
      LOG.debug(withErrorContext(
          "Could not find expected index on table " + table.getName()));
    } 
  }
  // use table scan instead
  return CursorImpl.createCursor(table);
}
 
开发者ID:jahlborn,项目名称:jackcess,代码行数:23,代码来源:DatabaseImpl.java


示例4: checkIndexEntries

import com.healthmarketscience.jackcess.Cursor; //导入依赖的package包/类
private static void checkIndexEntries(final TestDB testDB, Table t, Index index) throws Exception
  {
//         index.initialize();
//         System.out.println("Ind " + index);

    Cursor cursor = CursorBuilder.createCursor(index);
    while(cursor.moveToNextRow()) {

      Row row = cursor.getCurrentRow();
      Cursor.Position curPos = cursor.getSavepoint().getCurrentPosition();
      boolean success = false;
      try {
        findRow(testDB, t, index, row, curPos);
        success = true;
      } finally {
        if(!success) {
          System.out.println("CurPos: " + curPos);
          System.out.println("Value: " + row + ": " + 
                             toUnicodeStr(row.get("data")));
        }          
      }
    }
    
  }
 
开发者ID:jahlborn,项目名称:jackcess,代码行数:25,代码来源:IndexCodesTest.java


示例5: x_testReadAllCodesMdb

import com.healthmarketscience.jackcess.Cursor; //导入依赖的package包/类
public void x_testReadAllCodesMdb() throws Exception
  {
//     Database db = openCopy(new File("/data2/jackcess_test/testAllIndexCodes.mdb"));
//     Database db = openCopy(new File("/data2/jackcess_test/testAllIndexCodes_orig.mdb"));
//     Database db = openCopy(new File("/data2/jackcess_test/testSomeMoreCodes.mdb"));
    Database db = openCopy(Database.FileFormat.V2000, new File("/data2/jackcess_test/testStillMoreCodes.mdb"));
    Table t = db.getTable("Table5");

    Index ind = t.getIndexes().iterator().next();
    ((IndexImpl)ind).initialize();
    
    System.out.println("Ind " + ind);

    Cursor cursor = CursorBuilder.createCursor(ind);
    while(cursor.moveToNextRow()) {
      System.out.println("=======");
      String entryStr = 
        entryToString(cursor.getSavepoint().getCurrentPosition());
      System.out.println("Entry Bytes: " + entryStr);
      System.out.println("Value: " + cursor.getCurrentRow() + "; " +
                         toUnicodeStr(cursor.getCurrentRow().get("data")));
    }

    db.close();
  }
 
开发者ID:jahlborn,项目名称:jackcess,代码行数:26,代码来源:IndexCodesTest.java


示例6: x_testReadIsoMdb

import com.healthmarketscience.jackcess.Cursor; //导入依赖的package包/类
public void x_testReadIsoMdb() throws Exception
  {
//     Database db = open(new File("/tmp/test_ind.mdb"));
//     Database db = open(new File("/tmp/test_ind2.mdb"));
    Database db = open(Database.FileFormat.V2000, new File("/tmp/test_ind3.mdb"));
//     Database db = open(new File("/tmp/test_ind4.mdb"));

    Table t = db.getTable("Table1");
    Index index = t.getIndex("B");
    ((IndexImpl)index).initialize();
    System.out.println("Ind " + index);

    Cursor cursor = CursorBuilder.createCursor(index);
    while(cursor.moveToNextRow()) {
      System.out.println("=======");
      System.out.println("Savepoint: " + cursor.getSavepoint());
      System.out.println("Value: " + cursor.getCurrentRow());
    }
    
    db.close();
  }
 
开发者ID:jahlborn,项目名称:jackcess,代码行数:22,代码来源:IndexCodesTest.java


示例7: testNoEnforceForeignKeys

import com.healthmarketscience.jackcess.Cursor; //导入依赖的package包/类
public void testNoEnforceForeignKeys() throws Exception {
  for (final TestDB testDB : TestDB.getSupportedForBasename(Basename.INDEX)) {

    Database db = openCopy(testDB);
    db.setEnforceForeignKeys(false);
    Table t1 = db.getTable("Table1");
    Table t2 = db.getTable("Table2");
    Table t3 = db.getTable("Table3");

    t1.addRow(20, 0, 20, "some data", 20);

    Cursor c = CursorBuilder.createCursor(t2);
    c.moveToNextRow();
    c.updateCurrentRow(30, "foo30");

    c = CursorBuilder.createCursor(t3);
    c.moveToNextRow();
    c.deleteCurrentRow();

    db.close();
  }
  
}
 
开发者ID:jahlborn,项目名称:jackcess,代码行数:24,代码来源:FKEnforcerTest.java


示例8: persist

import com.healthmarketscience.jackcess.Cursor; //导入依赖的package包/类
public IFeedbackAction  persist() throws SQLException {
	try {
		Cursor cur = indexSelector.getCursor();
		cur.beforeFirst();
		Collection<String> columnNames = composite.get(0).getRowPattern()
				.keySet();
		while (composite.size() > 0 && moveToNextRow(cur, columnNames)) {
			Iterator<ICursorCommand> it = composite.iterator();
			while (it.hasNext()) {
				ICursorCommand comm = it.next();
				if (comm.currentRowMatches(cur, this.currentRow)) {
					comm.persistCurrentRow(cur);
					it. remove();
					rollbackCache.add(comm);
					break;
				}
			}
		}
		return null;
	} catch (IOException e) {
		throw new UcanaccessSQLException(e);
	}
}
 
开发者ID:andrew-nguyen,项目名称:ucanaccess,代码行数:24,代码来源:CompositeCommand.java


示例9: persist

import com.healthmarketscience.jackcess.Cursor; //导入依赖的package包/类
public IFeedbackAction  persist() throws SQLException {
	try {
		Cursor cur = indexSelector.getCursor();
		if (cur.findNextRow(rowPattern)) {
			if (this.blobColumns != null) {
				for (Column col : this.blobColumns) {
					Object val = cur.getCurrentRowValue(col);
					modifiedRow[tableColumns.indexOf(col)] = val;
				}
			}
			updateComplex(cur );
			cur.updateCurrentRow(modifiedRow);
			
		}
	} catch (IOException e) {
		throw new UcanaccessSQLException(e);
	}
	return null;
}
 
开发者ID:andrew-nguyen,项目名称:ucanaccess,代码行数:20,代码来源:UpdateCommand.java


示例10: getCursor

import com.healthmarketscience.jackcess.Cursor; //导入依赖的package包/类
public Cursor getCursor() throws IOException {
	Index idx = getBestIndex();
	Cursor cursor;
	CursorBuilder cb=table.newCursor();
	if (idx == null)
		cursor = cb.toCursor();
	else
		cursor = cb.setIndex(idx).toCursor();
	cursor.setColumnMatcher(new ColumnMatcher());
	return cursor;
}
 
开发者ID:andrew-nguyen,项目名称:ucanaccess,代码行数:12,代码来源:IndexSelector.java


示例11: debugTable

import com.healthmarketscience.jackcess.Cursor; //导入依赖的package包/类
private static void debugTable(Table table, SequenceWriter columnCsv) throws IOException {

		System.out.println("\tTable columns for " + table.getName());

		try {
			for (Column nextColumn : table.getColumns()) {
				System.out.println("\t\t" + nextColumn.getName());
				columnCsv.write(Arrays.asList(table.getName() + "." + nextColumn.getName(),
						table.getName() + "." + nextColumn.getName(), "", ""));
			}

			Index primaryKeyIndex = table.getPrimaryKeyIndex();
			System.out.println(
					"\tFound primary key index for table: " + table.getName() + " named " + primaryKeyIndex.getName());
			debugIndex(primaryKeyIndex, new HashSet<>(), columnCsv);

			for (Index nextIndex : table.getIndexes()) {
				if (!nextIndex.getName().equals(primaryKeyIndex.getName())) {
					System.out.println("\tFound non-primary key index for table: " + table.getName() + " named "
							+ nextIndex.getName());
					debugIndex(nextIndex, new HashSet<>(), null);
				}
			}
		} catch (IllegalArgumentException e) {
			System.out.println("No primary key index found for table: " + table.getName());
		}

		Cursor cursor = table.getDefaultCursor();
		int i = 0;
		while (cursor.moveToNextRow()) {
			if (i >= 5) {
				break;
			}
			System.out.println(cursor.getCurrentRow().toString());
			i++;
		}
	}
 
开发者ID:ansell,项目名称:csvsum,代码行数:38,代码来源:AccessMapper.java


示例12: findObjectId

import com.healthmarketscience.jackcess.Cursor; //导入依赖的package包/类
public Integer findObjectId(Integer parentId, String name) 
  throws IOException 
{
  Cursor cur = findRow(parentId, name);
  if(cur == null) {  
    return null;
  }
  ColumnImpl idCol = _systemCatalog.getColumn(CAT_COL_ID);
  return (Integer)cur.getCurrentRowValue(idCol);
}
 
开发者ID:jahlborn,项目名称:jackcess,代码行数:11,代码来源:DatabaseImpl.java


示例13: getObjectRow

import com.healthmarketscience.jackcess.Cursor; //导入依赖的package包/类
public Row getObjectRow(Integer parentId, String name,
                        Collection<String> columns) 
  throws IOException 
{
  Cursor cur = findRow(parentId, name);
  return ((cur != null) ? cur.getCurrentRow(columns) : null);
}
 
开发者ID:jahlborn,项目名称:jackcess,代码行数:8,代码来源:DatabaseImpl.java


示例14: findRow

import com.healthmarketscience.jackcess.Cursor; //导入依赖的package包/类
@Override
protected Cursor findRow(Integer parentId, String name) 
  throws IOException 
{
  return (_systemCatalogCursor.findFirstRowByEntry(parentId, name) ?
          _systemCatalogCursor : null);
}
 
开发者ID:jahlborn,项目名称:jackcess,代码行数:8,代码来源:DatabaseImpl.java


示例15: getTableNamesCursor

import com.healthmarketscience.jackcess.Cursor; //导入依赖的package包/类
@Override
protected Cursor getTableNamesCursor() throws IOException {
  return _systemCatalogCursor.getIndex().newCursor()
    .setStartEntry(_tableParentId, IndexData.MIN_VALUE)
    .setEndEntry(_tableParentId, IndexData.MAX_VALUE)
    .toIndexCursor();
}
 
开发者ID:jahlborn,项目名称:jackcess,代码行数:8,代码来源:DatabaseImpl.java


示例16: findRow

import com.healthmarketscience.jackcess.Cursor; //导入依赖的package包/类
private static void findRow(final TestDB testDB, Table t, Index index,
                            Row expectedRow,
                            Cursor.Position expectedPos)
  throws Exception
{
  Object[] idxRow = ((IndexImpl)index).constructIndexRow(expectedRow);
  Cursor cursor = CursorBuilder.createCursor(index, idxRow, idxRow);

  Cursor.Position startPos = cursor.getSavepoint().getCurrentPosition();
  
  cursor.beforeFirst();
  while(cursor.moveToNextRow()) {
    Row row = cursor.getCurrentRow();
    if(expectedRow.equals(row)) {
      // verify that the entries are indeed equal
      Cursor.Position curPos = cursor.getSavepoint().getCurrentPosition();
      assertEquals(entryToString(expectedPos), entryToString(curPos));
      return;
    }
  }

  // TODO long rows not handled completely yet in V2010
  // seems to truncate entry at 508 bytes with some trailing 2 byte seq
  if(testDB.getExpectedFileFormat() == Database.FileFormat.V2010) {
    String rowId = expectedRow.getString("name");
    String tName = t.getName();
    if(("Table11".equals(tName) || "Table11_desc".equals(tName)) &&
       ("row10".equals(rowId) || "row11".equals(rowId) || 
        "row12".equals(rowId))) {
      System.out.println(
          "TODO long rows not handled completely yet in V2010: " + tName +
                         ", " + rowId);
      return;
    }
  }

  fail("testDB: " + testDB + ";\nCould not find expected row " + expectedRow + " starting at " +
       entryToString(startPos));
}
 
开发者ID:jahlborn,项目名称:jackcess,代码行数:40,代码来源:IndexCodesTest.java


示例17: entryToString

import com.healthmarketscience.jackcess.Cursor; //导入依赖的package包/类
public static String entryToString(Cursor.Position curPos)
  throws Exception
{
  Field eField = curPos.getClass().getDeclaredField("_entry");
  eField.setAccessible(true);
  IndexData.Entry entry = (IndexData.Entry)eField.get(curPos);
  Field ebField = entry.getClass().getDeclaredField("_entryBytes");
  ebField.setAccessible(true);
  byte[] entryBytes = (byte[])ebField.get(entry);

  return ByteUtil.toHexString(ByteBuffer.wrap(entryBytes),
                              0, entryBytes.length, false);
}
 
开发者ID:jahlborn,项目名称:jackcess,代码行数:14,代码来源:IndexCodesTest.java


示例18: moveToNextRow

import com.healthmarketscience.jackcess.Cursor; //导入依赖的package包/类
public boolean moveToNextRow(Cursor cur, Collection<String> columnNames)
		throws IOException {
	boolean hasNext = cur.moveToNextRow();
	if (hasNext) {
		this.currentRow = cur.getCurrentRow(columnNames);
	}
	return hasNext;
}
 
开发者ID:andrew-nguyen,项目名称:ucanaccess,代码行数:9,代码来源:CompositeCommand.java


示例19: persist

import com.healthmarketscience.jackcess.Cursor; //导入依赖的package包/类
public IFeedbackAction  persist() throws SQLException {
	try {
		Cursor cur = indexSelector.getCursor();
		if (cur.findNextRow(rowPattern)) {
			cur.deleteCurrentRow();
		}
	} catch (IOException e) {
		throw new UcanaccessSQLException(e);
	}
	return null;
}
 
开发者ID:andrew-nguyen,项目名称:ucanaccess,代码行数:12,代码来源:DeleteCommand.java


示例20: persistCurrentRow

import com.healthmarketscience.jackcess.Cursor; //导入依赖的package包/类
public void persistCurrentRow(Cursor cur) throws IOException {
	if (this.blobColumns != null) {
		for (Column col : this.blobColumns) {
			Object val = cur.getCurrentRowValue(col);
			modifiedRow[tableColumns.indexOf(col)] = val;
			
		}
	}
	updateComplex(cur);
	cur.updateCurrentRow(modifiedRow);
}
 
开发者ID:andrew-nguyen,项目名称:ucanaccess,代码行数:12,代码来源:UpdateCommand.java



注:本文中的com.healthmarketscience.jackcess.Cursor类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java OServerAdmin类代码示例发布时间:2022-05-23
下一篇:
Java CategoricalLabel类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap