本文整理汇总了Java中com.healthmarketscience.jackcess.Table.getIndexes方法的典型用法代码示例。如果您正苦于以下问题:Java Table.getIndexes方法的具体用法?Java Table.getIndexes怎么用?Java Table.getIndexes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.healthmarketscience.jackcess.Table
的用法示例。
在下文中一共展示了Table.getIndexes方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createTables
import com.healthmarketscience.jackcess.Table; //导入方法依赖的package包/类
/**
* Iterate over the MDB database and create SQLite tables for every table
* defined in the MS Access database.
*
* @param jdbc The SQLite database JDBC connection
*/
@SuppressWarnings("unchecked")
private static void createTables(Database mdb, SqlJetDb sqlite) throws Exception {
for (String tableName : mdb.getTableNames()) {
Table table = mdb.getTable(tableName);
sqlite.beginTransaction(SqlJetTransactionMode.WRITE);
try {
sqlite.createTable(MDB2SQLite.createTableStatement(table));
for (Index index : (List<Index>) table.getIndexes()) {
sqlite.createIndex(MDB2SQLite.createIndexStatement(index));
}
} finally {
sqlite.commit();
}
}
}
示例2: loadTableFKs
import com.healthmarketscience.jackcess.Table; //导入方法依赖的package包/类
private void loadTableFKs(String tableName) throws IOException,
SQLException {
Table table = dbIO.getTable(tableName);
for (Index idxi : table.getIndexes()) {
//riw
IndexImpl idx=(IndexImpl)idxi;
if (idx.isForeignKey() && !idx.getReference().isPrimaryTable())
loadForeignKey(idx);
}
}
示例3: loadTableIndexes
import com.healthmarketscience.jackcess.Table; //导入方法依赖的package包/类
private void loadTableIndexes(String tableName) throws IOException,
SQLException {
Table table = dbIO.getTable(tableName);
for (Index idx : table.getIndexes()) {
if (!idx.isForeignKey())
loadIndex(idx);
}
}
示例4: debugTable
import com.healthmarketscience.jackcess.Table; //导入方法依赖的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++;
}
}
示例5: getPrimaryKeys
import com.healthmarketscience.jackcess.Table; //导入方法依赖的package包/类
/**
* Get all primary keys for the table
*
* @param table
* @return a list of primary keys
*/
private List<String> getPrimaryKeys(Table table) {
log.debug("getPrimaryKeys");
List<String> primaryKeyList = new ArrayList<String>();
for (Index index : table.getIndexes()) {
for (Index.Column column : index.getColumns()) {
if (index.isPrimaryKey()) {
primaryKeyList.add(column.getName());
}
}
}
return primaryKeyList;
}
示例6: testIndexCodes
import com.healthmarketscience.jackcess.Table; //导入方法依赖的package包/类
public void testIndexCodes() throws Exception
{
for (final TestDB testDB : TestDB.getSupportedForBasename(Basename.INDEX_CODES)) {
Database db = openMem(testDB);
for(Table t : db) {
for(Index index : t.getIndexes()) {
// System.out.println("Checking " + t.getName() + "." + index.getName());
checkIndexEntries(testDB, t, index);
}
}
db.close();
}
}
示例7: getPrimaryKeyColumns
import com.healthmarketscience.jackcess.Table; //导入方法依赖的package包/类
/**
* Searches for a primary key index on the given table and returns the columns that were used for the index key.
* If the table does not have a primary key index the returned list will be empty.
*
* @param table the table on which to search for a primary key index
* @return the list of columns used for the index key or an empty list, if no primary key index exists
*/
private List<? extends Index.Column> getPrimaryKeyColumns(Table table) {
for (Index index : table.getIndexes()) {
if (index.isPrimaryKey()) {
return index.getColumns();
}
}
return Collections.emptyList();
}
示例8: createIndexes
import com.healthmarketscience.jackcess.Table; //导入方法依赖的package包/类
/**
* Iterate over and create SQLite indeces for every index defined
* in the MS Access table.
*
* @param table MS Access table
* @param jdbc The SQLite database JDBC connection
* @throws SQLException
*/
private void createIndexes(final Table table, final Connection jdbc) throws SQLException {
final List<Index> indexes = table.getIndexes();
for (Index index : indexes) {
createIndex(index, jdbc);
}
}