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

x33g5p2x  于2022-01-18 转载在 其他  
字(8.2k)|赞(0)|评价(0)|浏览(182)

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

Database.getTableNames介绍

暂无

代码示例

代码示例来源:origin: pentaho/pentaho-kettle

  1. Set<String> set = database.getTableNames();
  2. String[] tablenames = set.toArray( new String[set.size()] );
  3. EnterSelectionDialog dialog =

代码示例来源:origin: pentaho/pentaho-kettle

  1. Set<String> settables = accessDatabase.getTableNames();

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

  1. private void createIndexesUK() throws SQLException, IOException {
  2. for (String tn : dbIO.getTableNames()) {
  3. if (!this.unresolvedTables.contains(tn)) {
  4. this.loadTableIndexesUK(tn);
  5. conn.commit();
  6. }
  7. }
  8. }

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

  1. private void createFKs() throws SQLException, IOException {
  2. for (String tn : dbIO.getTableNames()) {
  3. if (!this.unresolvedTables.contains(tn)) {
  4. this.loadTableFKs(tn, false);
  5. conn.commit();
  6. }
  7. }
  8. }

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

  1. private void createIndexesNotUK() throws SQLException, IOException {
  2. for (String tn : dbIO.getTableNames()) {
  3. if (!this.unresolvedTables.contains(tn)) {
  4. this.loadTableIndexesNotUK(tn);
  5. conn.commit();
  6. }
  7. }
  8. }

代码示例来源:origin: org.integratedmodelling/klab-common

  1. @Override
  2. public Collection<ITable> getTables() {
  3. ArrayList<ITable> ret = new ArrayList<ITable>();
  4. try {
  5. for (String s : getDb().getTableNames()) {
  6. ret.add(new Table(s));
  7. }
  8. } catch (Exception e) {
  9. ret.clear();
  10. }
  11. return ret;
  12. }

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

  1. /**
  2. * Copy all tables into new delimited text files <br>
  3. * Equivalent to: {@code exportFile(db, name, f, false, null, '"',
  4. * SimpleExportFilter.INSTANCE);}
  5. *
  6. * @param db
  7. * Database the table to export belongs to
  8. * @param dir
  9. * The directory where the new files will be created
  10. * @param ext
  11. * The file extension of the new files
  12. *
  13. * @see #exportFile(Database,String,File,boolean,String,char,ExportFilter)
  14. * @see Builder
  15. */
  16. public static void exportAll(Database db, File dir,
  17. String ext) throws IOException {
  18. for (String tableName : db.getTableNames()) {
  19. exportFile(db, tableName, new File(dir, tableName + "." + ext), false,
  20. DEFAULT_DELIMITER, DEFAULT_QUOTE_CHAR, SimpleExportFilter.INSTANCE);
  21. }
  22. }

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

  1. /**
  2. * Copy all tables into new delimited text files <br>
  3. * Equivalent to: {@code exportFile(db, name, f, false, null, '"',
  4. * SimpleExportFilter.INSTANCE);}
  5. *
  6. * @param db
  7. * Database the table to export belongs to
  8. * @param dir
  9. * The directory where the new files will be created
  10. * @param ext
  11. * The file extension of the new files
  12. * @param header
  13. * If <code>true</code> the first line contains the column names
  14. *
  15. * @see #exportFile(Database,String,File,boolean,String,char,ExportFilter)
  16. * @see Builder
  17. */
  18. public static void exportAll(Database db, File dir,
  19. String ext, boolean header)
  20. throws IOException {
  21. for (String tableName : db.getTableNames()) {
  22. exportFile(db, tableName, new File(dir, tableName + "." + ext), header,
  23. DEFAULT_DELIMITER, DEFAULT_QUOTE_CHAR, SimpleExportFilter.INSTANCE);
  24. }
  25. }

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

  1. char quote, ExportFilter filter)
  2. throws IOException {
  3. for (String tableName : db.getTableNames()) {
  4. exportFile(db, tableName, new File(dir, tableName + "." + ext), header,
  5. delim, quote, filter);

代码示例来源:origin: AccelerationNet/access2csv

  1. static void exportAll(File inputFile, boolean withHeader, File outputDir, String csvPrefix, boolean applyQuotesToAll, String nullText) throws IOException{
  2. Database db = DatabaseBuilder.open(inputFile);
  3. try{
  4. for(String tableName : db.getTableNames()){
  5. String csvName = csvPrefix + tableName + ".csv";
  6. File outputFile = new File(outputDir, csvName);
  7. Writer csv = new FileWriter(outputFile);
  8. try{
  9. System.out.println(String.format("Exporting '%s' to %s",
  10. tableName, outputFile.toString()));
  11. int rows = export(db, tableName, csv, withHeader, applyQuotesToAll, nullText);
  12. System.out.println(String.format("%d rows exported", rows));
  13. }finally{
  14. try{
  15. csv.flush();
  16. csv.close();
  17. }catch(IOException ex){}
  18. }
  19. }
  20. }finally{
  21. db.close();
  22. }
  23. }

代码示例来源:origin: ujmp/universal-java-matrix-package

  1. public static final JackcessDenseObjectMatrix2D toFile(File file, Object... parameters)
  2. throws IOException {
  3. Database db = DatabaseBuilder.open(file);
  4. Set<String> tables = db.getTableNames();
  5. String tablename = null;
  6. if (parameters.length != 0) {
  7. tablename = StringUtil.convert(parameters[0]);
  8. }
  9. if (tablename == null) {
  10. if (tables.size() == 1) {
  11. tablename = db.getTableNames().iterator().next();
  12. }
  13. }
  14. db.close();
  15. if (tablename == null) {
  16. throw new IllegalArgumentException(
  17. "please append the table name, i.e. one of these tables: " + tables);
  18. }
  19. return new JackcessDenseObjectMatrix2D(file, tablename);
  20. }

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

  1. private void createAutoFKs() throws SQLException, IOException {
  2. for (String tn : dbIO.getTableNames()) {
  3. if (!this.unresolvedTables.contains(tn)) {
  4. try {
  5. this.loadTableFKs(tn, true);
  6. } catch (SQLException e) {
  7. UcanaccessTable t = new UcanaccessTable(dbIO.getTable(tn), tn);
  8. makeTableReadOnly(t, false);
  9. }
  10. conn.commit();
  11. }
  12. }
  13. }

代码示例来源:origin: AccelerationNet/access2csv

  1. static void schema(File inputFile) throws IOException{
  2. Database db = DatabaseBuilder.open(inputFile);
  3. try{
  4. for(String tableName : db.getTableNames()){
  5. Table table = db.getTable(tableName);
  6. System.out.println(String.format("CREATE TABLE %s (", tableName));
  7. for(Column col : table.getColumns()){
  8. System.out.println(String.format(" %s %s,",
  9. col.getName(), col.getType()));
  10. }
  11. System.out.println(")");
  12. }
  13. }finally{
  14. db.close();
  15. }
  16. }

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

  1. private void createTables() throws SQLException, IOException {
  2. metadata.createMetadata();
  3. for (String tn : dbIO.getTableNames()) {
  4. UcanaccessTable t = null;
  5. Table t2 = null;
  6. try {
  7. t2 = dbIO.getTable(tn);
  8. t = new UcanaccessTable(t2, tn);
  9. } catch (Exception e) {
  10. Logger.logWarning(e.getMessage());
  11. this.unresolvedTables.add(tn);
  12. }
  13. if (t2 != null && t != null && !tn.startsWith("~")) {
  14. createTable(t);
  15. this.loadingOrder.add(t.getName());
  16. }
  17. }
  18. }

代码示例来源:origin: fr.ifremer.congo/access-tool

  1. Set<String> tableNames = database.getTableNames();
  2. buffer.append("Detect ").append(tableNames.size()).append(" tables.");
  3. for (String tableName : tableNames) {

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

  1. protected Table getTable(String tableName, UcanaccessConnection conn) throws IOException {
  2. Table t = conn.getDbIO().getTable(tableName);
  3. if (t == null && tableName.startsWith(ESCAPE_PREFIX) && SQLConverter.isXescaped(tableName.substring(1))) {
  4. t = conn.getDbIO().getTable(tableName.substring(1));
  5. if (t != null) {
  6. return new UcanaccessTable(t, tableName.substring(1));
  7. }
  8. }
  9. if (t == null) {
  10. Database db = conn.getDbIO();
  11. for (String cand : db.getTableNames()) {
  12. if (SQLConverter.preEscapingIdentifier(cand).equals(tableName)
  13. || SQLConverter.escapeIdentifier(cand).equals(tableName)) {
  14. t = new UcanaccessTable(db.getTable(cand), cand);
  15. break;
  16. }
  17. }
  18. }
  19. return new UcanaccessTable(t, tableName);
  20. }

代码示例来源:origin: HuygensING/timbuctoo

  1. @Override
  2. public void loadData(List<Tuple<String, File>> files, Importer importer) throws InvalidFileException, IOException {
  3. Database database = DatabaseBuilder.open(files.get(0).getRight());
  4. for (String tableName : database.getTableNames()) {
  5. importer.startCollection(tableName);
  6. Table table = database.getTable(tableName);
  7. List<? extends Column> columns = table.getColumns();
  8. for (int i = 0; i < columns.size(); i++) {
  9. importer.registerPropertyName(i, columns.get(i).getName());
  10. }
  11. for (Row row : table) {
  12. importer.startEntity();
  13. for (int colNum = 0 ; colNum < columns.size(); colNum++) {
  14. Object cellValue = row.get(columns.get(colNum).getName());
  15. if (cellValue == null) {
  16. cellValue = "";
  17. }
  18. importer.setValue(colNum, "" + cellValue);
  19. }
  20. importer.finishEntity();
  21. }
  22. importer.finishCollection();
  23. }
  24. }
  25. }

代码示例来源:origin: io.github.codemumbler/mdb-oracle-converter

  1. private void readTables() throws IOException, SQLException {
  2. for (String tableName : jackcessDatabase.getTableNames()) {
  3. Table table = new Table();
  4. table.setName(tableName);
  5. table.addAllColumns(readTableColumns(tableName));
  6. readTableData(table);
  7. if (table.hasPrimaryKey() && table.getPrimaryColumn().getDataType() instanceof NumberDataType)
  8. table.setNextValue(findMaxPrimaryKeyValue(table) + 1);
  9. database.addTable(table);
  10. }
  11. }

代码示例来源:origin: io.github.codemumbler/mdb-oracle-converter

  1. private void buildForeignKeys() throws IOException {
  2. for (String tableName : jackcessDatabase.getTableNames()) {
  3. List<com.healthmarketscience.jackcess.Column> originalColumns = getColumns(tableName);
  4. for (com.healthmarketscience.jackcess.Column column : originalColumns) {

相关文章