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

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

本文整理了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

  1. @Override
  2. public Index getPrimaryKeyIndex() {
  3. return wrapped.getPrimaryKeyIndex();
  4. }

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

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

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

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

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

  1. public BlobKey(Table _table, String _columnName, Row _row) {
  2. this.tableName = _table.getName();
  3. this.columnName = _columnName;
  4. if (hasPrimaryKey(_table)) {
  5. List<? extends Index.Column> cl = _table.getPrimaryKeyIndex().getColumns();
  6. HashMap<String, Object> keyMap = new HashMap<String, Object>();
  7. for (Index.Column c : cl) {
  8. keyMap.put(c.getName(), _row.get(c.getName()));
  9. }
  10. this.key = keyMap;
  11. }
  12. }

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

  1. public BlobAction(Table _table, Object[] newValues) throws SQLException {
  2. this.table = _table;
  3. if (!BlobKey.hasPrimaryKey(_table)) {
  4. return;
  5. }
  6. Index pk = _table.getPrimaryKeyIndex();
  7. HashSet<String> hsKey = new HashSet<String>();
  8. for (Index.Column icl : pk.getColumns()) {
  9. hsKey.add(icl.getName());
  10. }
  11. HashSet<String> hsBlob = new HashSet<String>();
  12. int i = 0;
  13. HashMap<String, Object> keyMap = new HashMap<String, Object>();
  14. for (Column cl : _table.getColumns()) {
  15. if (cl.getType().equals(DataType.OLE) && newValues[i] != null) {
  16. containsBlob = true;
  17. hsBlob.add(cl.getName());
  18. }
  19. if (hsKey.contains(cl.getName())) {
  20. keyMap.put(cl.getName(), newValues[i]);
  21. }
  22. ++i;
  23. }
  24. for (String cln : hsBlob) {
  25. keys.add(new BlobKey(keyMap, table.getName(), cln));
  26. }
  27. }

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

  1. @Override
  2. protected Schema getMainSchema() throws MetaModelException {
  3. MutableSchema schema = new MutableSchema(_file.getName());
  4. Database db = getDatabase();
  5. for (com.healthmarketscience.jackcess.Table mdbTable : db) {
  6. final MutableTable table = new MutableTable(mdbTable.getName(), TableType.TABLE, schema);
  7. try {
  8. int i = 0;
  9. for (com.healthmarketscience.jackcess.Column mdbColumn : mdbTable.getColumns()) {
  10. final ColumnType columnType = ColumnType.convertColumnType(mdbColumn.getSQLType());
  11. final MutableColumn column = new MutableColumn(mdbColumn.getName(), columnType, table, i, null);
  12. column.setColumnSize((int) mdbColumn.getLength());
  13. column.setNativeType(mdbColumn.getType().name());
  14. table.addColumn(column);
  15. i++;
  16. }
  17. final Index primaryKeyIndex = mdbTable.getPrimaryKeyIndex();
  18. final List<ColumnDescriptor> columnDescriptors = primaryKeyIndex.getColumns();
  19. for (ColumnDescriptor columnDescriptor : columnDescriptors) {
  20. final String name = columnDescriptor.getColumn().getName();
  21. final MutableColumn column = (MutableColumn) table.getColumnByName(name);
  22. column.setPrimaryKey(true);
  23. }
  24. schema.addTable(table);
  25. } catch (Exception e) {
  26. throw new MetaModelException(e);
  27. }
  28. }
  29. return schema;
  30. }

相关文章