本文整理了Java中com.healthmarketscience.jackcess.Database.getTableNames()
方法的一些代码示例,展示了Database.getTableNames()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Database.getTableNames()
方法的具体详情如下:
包路径:com.healthmarketscience.jackcess.Database
类名称:Database
方法名:getTableNames
暂无
代码示例来源:origin: pentaho/pentaho-kettle
Set<String> set = database.getTableNames();
String[] tablenames = set.toArray( new String[set.size()] );
EnterSelectionDialog dialog =
代码示例来源:origin: pentaho/pentaho-kettle
Set<String> settables = accessDatabase.getTableNames();
代码示例来源:origin: net.sf.ucanaccess/ucanaccess
private void createIndexesUK() throws SQLException, IOException {
for (String tn : dbIO.getTableNames()) {
if (!this.unresolvedTables.contains(tn)) {
this.loadTableIndexesUK(tn);
conn.commit();
}
}
}
代码示例来源:origin: net.sf.ucanaccess/ucanaccess
private void createFKs() throws SQLException, IOException {
for (String tn : dbIO.getTableNames()) {
if (!this.unresolvedTables.contains(tn)) {
this.loadTableFKs(tn, false);
conn.commit();
}
}
}
代码示例来源:origin: net.sf.ucanaccess/ucanaccess
private void createIndexesNotUK() throws SQLException, IOException {
for (String tn : dbIO.getTableNames()) {
if (!this.unresolvedTables.contains(tn)) {
this.loadTableIndexesNotUK(tn);
conn.commit();
}
}
}
代码示例来源:origin: org.integratedmodelling/klab-common
@Override
public Collection<ITable> getTables() {
ArrayList<ITable> ret = new ArrayList<ITable>();
try {
for (String s : getDb().getTableNames()) {
ret.add(new Table(s));
}
} catch (Exception e) {
ret.clear();
}
return ret;
}
代码示例来源:origin: com.healthmarketscience.jackcess/jackcess
/**
* Copy all tables into new delimited text files <br>
* Equivalent to: {@code exportFile(db, name, f, false, null, '"',
* SimpleExportFilter.INSTANCE);}
*
* @param db
* Database the table to export belongs to
* @param dir
* The directory where the new files will be created
* @param ext
* The file extension of the new files
*
* @see #exportFile(Database,String,File,boolean,String,char,ExportFilter)
* @see Builder
*/
public static void exportAll(Database db, File dir,
String ext) throws IOException {
for (String tableName : db.getTableNames()) {
exportFile(db, tableName, new File(dir, tableName + "." + ext), false,
DEFAULT_DELIMITER, DEFAULT_QUOTE_CHAR, SimpleExportFilter.INSTANCE);
}
}
代码示例来源:origin: com.healthmarketscience.jackcess/jackcess
/**
* Copy all tables into new delimited text files <br>
* Equivalent to: {@code exportFile(db, name, f, false, null, '"',
* SimpleExportFilter.INSTANCE);}
*
* @param db
* Database the table to export belongs to
* @param dir
* The directory where the new files will be created
* @param ext
* The file extension of the new files
* @param header
* If <code>true</code> the first line contains the column names
*
* @see #exportFile(Database,String,File,boolean,String,char,ExportFilter)
* @see Builder
*/
public static void exportAll(Database db, File dir,
String ext, boolean header)
throws IOException {
for (String tableName : db.getTableNames()) {
exportFile(db, tableName, new File(dir, tableName + "." + ext), header,
DEFAULT_DELIMITER, DEFAULT_QUOTE_CHAR, SimpleExportFilter.INSTANCE);
}
}
代码示例来源:origin: com.healthmarketscience.jackcess/jackcess
char quote, ExportFilter filter)
throws IOException {
for (String tableName : db.getTableNames()) {
exportFile(db, tableName, new File(dir, tableName + "." + ext), header,
delim, quote, filter);
代码示例来源:origin: AccelerationNet/access2csv
static void exportAll(File inputFile, boolean withHeader, File outputDir, String csvPrefix, boolean applyQuotesToAll, String nullText) throws IOException{
Database db = DatabaseBuilder.open(inputFile);
try{
for(String tableName : db.getTableNames()){
String csvName = csvPrefix + tableName + ".csv";
File outputFile = new File(outputDir, csvName);
Writer csv = new FileWriter(outputFile);
try{
System.out.println(String.format("Exporting '%s' to %s",
tableName, outputFile.toString()));
int rows = export(db, tableName, csv, withHeader, applyQuotesToAll, nullText);
System.out.println(String.format("%d rows exported", rows));
}finally{
try{
csv.flush();
csv.close();
}catch(IOException ex){}
}
}
}finally{
db.close();
}
}
代码示例来源:origin: ujmp/universal-java-matrix-package
public static final JackcessDenseObjectMatrix2D toFile(File file, Object... parameters)
throws IOException {
Database db = DatabaseBuilder.open(file);
Set<String> tables = db.getTableNames();
String tablename = null;
if (parameters.length != 0) {
tablename = StringUtil.convert(parameters[0]);
}
if (tablename == null) {
if (tables.size() == 1) {
tablename = db.getTableNames().iterator().next();
}
}
db.close();
if (tablename == null) {
throw new IllegalArgumentException(
"please append the table name, i.e. one of these tables: " + tables);
}
return new JackcessDenseObjectMatrix2D(file, tablename);
}
代码示例来源:origin: net.sf.ucanaccess/ucanaccess
private void createAutoFKs() throws SQLException, IOException {
for (String tn : dbIO.getTableNames()) {
if (!this.unresolvedTables.contains(tn)) {
try {
this.loadTableFKs(tn, true);
} catch (SQLException e) {
UcanaccessTable t = new UcanaccessTable(dbIO.getTable(tn), tn);
makeTableReadOnly(t, false);
}
conn.commit();
}
}
}
代码示例来源:origin: AccelerationNet/access2csv
static void schema(File inputFile) throws IOException{
Database db = DatabaseBuilder.open(inputFile);
try{
for(String tableName : db.getTableNames()){
Table table = db.getTable(tableName);
System.out.println(String.format("CREATE TABLE %s (", tableName));
for(Column col : table.getColumns()){
System.out.println(String.format(" %s %s,",
col.getName(), col.getType()));
}
System.out.println(")");
}
}finally{
db.close();
}
}
代码示例来源:origin: net.sf.ucanaccess/ucanaccess
private void createTables() throws SQLException, IOException {
metadata.createMetadata();
for (String tn : dbIO.getTableNames()) {
UcanaccessTable t = null;
Table t2 = null;
try {
t2 = dbIO.getTable(tn);
t = new UcanaccessTable(t2, tn);
} catch (Exception e) {
Logger.logWarning(e.getMessage());
this.unresolvedTables.add(tn);
}
if (t2 != null && t != null && !tn.startsWith("~")) {
createTable(t);
this.loadingOrder.add(t.getName());
}
}
}
代码示例来源:origin: fr.ifremer.congo/access-tool
Set<String> tableNames = database.getTableNames();
buffer.append("Detect ").append(tableNames.size()).append(" tables.");
for (String tableName : tableNames) {
代码示例来源:origin: net.sf.ucanaccess/ucanaccess
protected Table getTable(String tableName, UcanaccessConnection conn) throws IOException {
Table t = conn.getDbIO().getTable(tableName);
if (t == null && tableName.startsWith(ESCAPE_PREFIX) && SQLConverter.isXescaped(tableName.substring(1))) {
t = conn.getDbIO().getTable(tableName.substring(1));
if (t != null) {
return new UcanaccessTable(t, tableName.substring(1));
}
}
if (t == null) {
Database db = conn.getDbIO();
for (String cand : db.getTableNames()) {
if (SQLConverter.preEscapingIdentifier(cand).equals(tableName)
|| SQLConverter.escapeIdentifier(cand).equals(tableName)) {
t = new UcanaccessTable(db.getTable(cand), cand);
break;
}
}
}
return new UcanaccessTable(t, tableName);
}
代码示例来源:origin: HuygensING/timbuctoo
@Override
public void loadData(List<Tuple<String, File>> files, Importer importer) throws InvalidFileException, IOException {
Database database = DatabaseBuilder.open(files.get(0).getRight());
for (String tableName : database.getTableNames()) {
importer.startCollection(tableName);
Table table = database.getTable(tableName);
List<? extends Column> columns = table.getColumns();
for (int i = 0; i < columns.size(); i++) {
importer.registerPropertyName(i, columns.get(i).getName());
}
for (Row row : table) {
importer.startEntity();
for (int colNum = 0 ; colNum < columns.size(); colNum++) {
Object cellValue = row.get(columns.get(colNum).getName());
if (cellValue == null) {
cellValue = "";
}
importer.setValue(colNum, "" + cellValue);
}
importer.finishEntity();
}
importer.finishCollection();
}
}
}
代码示例来源:origin: io.github.codemumbler/mdb-oracle-converter
private void readTables() throws IOException, SQLException {
for (String tableName : jackcessDatabase.getTableNames()) {
Table table = new Table();
table.setName(tableName);
table.addAllColumns(readTableColumns(tableName));
readTableData(table);
if (table.hasPrimaryKey() && table.getPrimaryColumn().getDataType() instanceof NumberDataType)
table.setNextValue(findMaxPrimaryKeyValue(table) + 1);
database.addTable(table);
}
}
代码示例来源:origin: io.github.codemumbler/mdb-oracle-converter
private void buildForeignKeys() throws IOException {
for (String tableName : jackcessDatabase.getTableNames()) {
List<com.healthmarketscience.jackcess.Column> originalColumns = getColumns(tableName);
for (com.healthmarketscience.jackcess.Column column : originalColumns) {
内容来源于网络,如有侵权,请联系作者删除!