com.healthmarketscience.jackcess.Table.getPrimaryKeyIndex()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(3.6k)|赞(0)|评价(0)|浏览(227)

本文整理了Java中com.healthmarketscience.jackcess.Table.getPrimaryKeyIndex()方法的一些代码示例,展示了Table.getPrimaryKeyIndex()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Table.getPrimaryKeyIndex()方法的具体详情如下:
包路径:com.healthmarketscience.jackcess.Table
类名称:Table
方法名:getPrimaryKeyIndex

Table.getPrimaryKeyIndex介绍

暂无

代码示例

代码示例来源:origin: net.sf.ucanaccess/ucanaccess

@Override
public Index getPrimaryKeyIndex() {
  return wrapped.getPrimaryKeyIndex();
}

代码示例来源:origin: com.healthmarketscience.jackcess/jackcess

/**
 * Creates an indexed cursor for the primary key cursor of the given table.
 * @param table the table over which this cursor will traverse
 */
public static IndexCursor createPrimaryKeyCursor(Table table)
 throws IOException
{
 return createCursor(table.getPrimaryKeyIndex());
}

代码示例来源:origin: com.healthmarketscience.jackcess/jackcess

/**
 * Convenience method for finding a specific row by the primary key of the
 * table.  See {@link IndexCursor#findRowByEntry(Object...)} for details on
 * the entryValues.
 * 
 * @param table the table to search
 * @param entryValues the column values for the table's primary key columns.
 * @return the matching row or {@code null} if a match could not be found.
 */
public static Row findRowByPrimaryKey(Table table, Object... entryValues)
 throws IOException
{
 return findRowByEntry(table.getPrimaryKeyIndex(), entryValues);
}

代码示例来源:origin: net.sf.ucanaccess/ucanaccess

public BlobKey(Table _table, String _columnName, Row _row) {
  this.tableName = _table.getName();
  this.columnName = _columnName;
  if (hasPrimaryKey(_table)) {
    List<? extends Index.Column> cl = _table.getPrimaryKeyIndex().getColumns();
    HashMap<String, Object> keyMap = new HashMap<String, Object>();
    for (Index.Column c : cl) {
      keyMap.put(c.getName(), _row.get(c.getName()));
    }
    this.key = keyMap;
  }
}

代码示例来源:origin: net.sf.ucanaccess/ucanaccess

public BlobAction(Table _table, Object[] newValues) throws SQLException {
  this.table = _table;
  if (!BlobKey.hasPrimaryKey(_table)) {
    return;
  }
  Index pk = _table.getPrimaryKeyIndex();
  HashSet<String> hsKey = new HashSet<String>();
  for (Index.Column icl : pk.getColumns()) {
    hsKey.add(icl.getName());
  }
  HashSet<String> hsBlob = new HashSet<String>();
  int i = 0;
  HashMap<String, Object> keyMap = new HashMap<String, Object>();
  for (Column cl : _table.getColumns()) {
    if (cl.getType().equals(DataType.OLE) && newValues[i] != null) {
      containsBlob = true;
      hsBlob.add(cl.getName());
    }
    if (hsKey.contains(cl.getName())) {
      keyMap.put(cl.getName(), newValues[i]);
    }
    ++i;
  }
  for (String cln : hsBlob) {
    keys.add(new BlobKey(keyMap, table.getName(), cln));
  }
}

代码示例来源:origin: org.eobjects.metamodel/MetaModel-access

@Override
protected Schema getMainSchema() throws MetaModelException {
  MutableSchema schema = new MutableSchema(_file.getName());
  Database db = getDatabase();
  for (com.healthmarketscience.jackcess.Table mdbTable : db) {
    final MutableTable table = new MutableTable(mdbTable.getName(), TableType.TABLE, schema);
    try {
      int i = 0;
      for (com.healthmarketscience.jackcess.Column mdbColumn : mdbTable.getColumns()) {
        final ColumnType columnType = ColumnType.convertColumnType(mdbColumn.getSQLType());
        final MutableColumn column = new MutableColumn(mdbColumn.getName(), columnType, table, i, null);
        column.setColumnSize((int) mdbColumn.getLength());
        column.setNativeType(mdbColumn.getType().name());
        table.addColumn(column);
        i++;
      }
      final Index primaryKeyIndex = mdbTable.getPrimaryKeyIndex();
      final List<ColumnDescriptor> columnDescriptors = primaryKeyIndex.getColumns();
      for (ColumnDescriptor columnDescriptor : columnDescriptors) {
        final String name = columnDescriptor.getColumn().getName();
        final MutableColumn column = (MutableColumn) table.getColumnByName(name);
        column.setPrimaryKey(true);
      }
      schema.addTable(table);
    } catch (Exception e) {
      throw new MetaModelException(e);
    }
  }
  return schema;
}

相关文章