当前位置: 首页>>代码示例>>Java>>正文


Java Table.getColumns方法代码示例

本文整理汇总了Java中com.healthmarketscience.jackcess.Table.getColumns方法的典型用法代码示例。如果您正苦于以下问题:Java Table.getColumns方法的具体用法?Java Table.getColumns怎么用?Java Table.getColumns使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.healthmarketscience.jackcess.Table的用法示例。


在下文中一共展示了Table.getColumns方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testImportFromFileWithOnlyHeaders

import com.healthmarketscience.jackcess.Table; //导入方法依赖的package包/类
public void testImportFromFileWithOnlyHeaders() throws Exception
{
  for (final FileFormat fileFormat : JetFormatTest.SUPPORTED_FILEFORMATS) {
    Database db = create(fileFormat);
    String tableName = new ImportUtil.Builder(db, "test")
      .setDelimiter("\\t")
      .importFile(new File("src/test/data/sample-input-only-headers.tab"));

    Table t = db.getTable(tableName);

    List<String> colNames = new ArrayList<String>();
    for(Column c : t.getColumns()) {
      colNames.add(c.getName());
    }
    assertEquals(Arrays.asList(
                     "RESULT_PHYS_ID", "FIRST", "MIDDLE", "LAST", "OUTLIER",
                     "RANK", "CLAIM_COUNT", "PROCEDURE_COUNT",
                     "WEIGHTED_CLAIM_COUNT", "WEIGHTED_PROCEDURE_COUNT"), 
                 colNames);

    db.close();
  }
}
 
开发者ID:jahlborn,项目名称:jackcess,代码行数:24,代码来源:ImportTest.java

示例2: escapeIdentifiers

import com.healthmarketscience.jackcess.Table; //导入方法依赖的package包/类
private LinkedHashMap<String, Object> escapeIdentifiers(
		LinkedHashMap<String, Object> map, Table t) {
	List<? extends Column> colums = t.getColumns();
	LinkedHashMap<String, Object> vl = new LinkedHashMap<String, Object>();
	for (Column cl : colums) {
		String key = cl.getName();
		String ekey=SQLConverter.escapeIdentifier(key)
				.toUpperCase();
		if( !map.containsKey(ekey)&&
			map.containsKey(ekey.substring(1, ekey.length()-1))){
			ekey=ekey.substring(1, ekey.length()-1);
		}
		vl.put(key, map.get(ekey));
	}
	return vl;
}
 
开发者ID:andrew-nguyen,项目名称:ucanaccess,代码行数:17,代码来源:Persist2Jet.java

示例3: saveColumnsDefaults

import com.healthmarketscience.jackcess.Table; //导入方法依赖的package包/类
private void saveColumnsDefaults(String[] defaults,Boolean[] required,Table table) throws IOException{
	List<? extends Column> cols=table.getColumns();
	int j=0;
	if(defaults!=null||required!=null)
	for(Column cl:cols){
		PropertyMap map=cl.getProperties();
		if(defaults!=null&&defaults[j]!=null){
			map.put(PropertyMap.DEFAULT_VALUE_PROP,DataType.TEXT,defaults[j]);
		}
		if(required!=null&&required[j]!=null &&required[j]){
				map.put(PropertyMap.REQUIRED_PROP,DataType.BOOLEAN,required[j]);
		}
		map.save();
		
		j++;
	}
	
}
 
开发者ID:andrew-nguyen,项目名称:ucanaccess,代码行数:19,代码来源:Persist2Jet.java

示例4: loadData

import com.healthmarketscience.jackcess.Table; //导入方法依赖的package包/类
@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();
  }
}
 
开发者ID:HuygensING,项目名称:timbuctoo,代码行数:26,代码来源:MdbLoader.java

示例5: 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++;
		}
	}
 
开发者ID:ansell,项目名称:csvsum,代码行数:38,代码来源:AccessMapper.java

示例6: diffFlatColumns

import com.healthmarketscience.jackcess.Table; //导入方法依赖的package包/类
protected static void diffFlatColumns(Table typeObjTable, 
                                      Table flatTable,
                                      List<Column> typeCols,
                                      List<Column> otherCols)
{
  // each "flat"" table has the columns from the "type" table, plus some
  // others.  separate the "flat" columns into these 2 buckets
  for(Column col : flatTable.getColumns()) {
    if(((TableImpl)typeObjTable).hasColumn(col.getName())) {
      typeCols.add(col);
    } else {
      otherCols.add(col);
    }  
  } 
}
 
开发者ID:jahlborn,项目名称:jackcess,代码行数:16,代码来源:ComplexColumnInfoImpl.java

示例7: isMultiValueColumn

import com.healthmarketscience.jackcess.Table; //导入方法依赖的package包/类
public static boolean isMultiValueColumn(Table typeObjTable) {
  // if we found a single value of a "simple" type, then we are dealing with
  // a multi-value column
  List<? extends Column> typeCols = typeObjTable.getColumns();
  return ((typeCols.size() == 1) &&
          MULTI_VALUE_TYPES.contains(typeCols.get(0).getType()));
}
 
开发者ID:jahlborn,项目名称:jackcess,代码行数:8,代码来源:ComplexColumnSupport.java

示例8: isVersionHistoryColumn

import com.healthmarketscience.jackcess.Table; //导入方法依赖的package包/类
public static boolean isVersionHistoryColumn(Table typeObjTable) {
  // version history data has these columns <value>(MEMO),
  // <modified>(SHORT_DATE_TIME)
  List<? extends Column> typeCols = typeObjTable.getColumns();
  if(typeCols.size() < 2) {
    return false;
  }

  int numMemo = 0;
  int numDate = 0;
  
  for(Column col : typeCols) {
    switch(col.getType()) {
    case SHORT_DATE_TIME:
      ++numDate;
      break;
    case MEMO:
      ++numMemo;
      break;
    default:
      // ignore
    }
  }

  // be flexible, allow for extra columns...
  return((numMemo >= 1) && (numDate >= 1));
}
 
开发者ID:jahlborn,项目名称:jackcess,代码行数:28,代码来源:ComplexColumnSupport.java

示例9: insertIntoTable

import com.healthmarketscience.jackcess.Table; //导入方法依赖的package包/类
@Override
public String insertIntoTable(Table table) {
    final StringBuilder stmtBuilder = new StringBuilder();

    stmtBuilder.append("INSERT INTO ");
    stmtBuilder.append(createStringConstant(table.getName()));
    stmtBuilder.append(" (");

    final List<? extends Column> columns = table.getColumns();

    for (Iterator<? extends Column> iterator = columns.iterator(); iterator.hasNext(); ) {
        Column column = iterator.next();
        stmtBuilder.append(createStringConstant(column.getName()));
        if (iterator.hasNext()) {
            stmtBuilder.append(", ");
        }
    }

    stmtBuilder.append(") VALUES (");

    for (Iterator<? extends Column> iterator = columns.iterator(); iterator.hasNext(); ) {
        iterator.next();
        stmtBuilder.append("?");
        if (iterator.hasNext()) {
            stmtBuilder.append(", ");
        }
    }

    stmtBuilder.append(")");

    return stmtBuilder.toString();
}
 
开发者ID:hzpz,项目名称:access-export,代码行数:33,代码来源:SQLiteSQLGenerator.java

示例10: toTuple

import com.healthmarketscience.jackcess.Table; //导入方法依赖的package包/类
private ValueTuple toTuple(Table table, Row row) {
	Value[] rowData = new Value[table.getColumnCount()];
	int columnIndex = 0;
	for (Column column: table.getColumns()) {
		String columnName = column.getName();
	    Object value = row.get(columnName);
	    rowData[columnIndex++] = ValueCharacter.select(generator, (value == null) ? "" : value.toString());
	}
	return new ValueTuple(generator, rowData);
}
 
开发者ID:DaveVoorhis,项目名称:Rel,代码行数:11,代码来源:TableACCDB.java

示例11: AutoNumberAction

import com.healthmarketscience.jackcess.Table; //导入方法依赖的package包/类
public AutoNumberAction(Table table, Object[] memento,Object[] byAccess) throws SQLException {
	super();
	this.table = table;
	int i = 0;
	PreparedStatement ps = null;
	for (Column cl : table.getColumns()) {
		if (cl.isAutoNumber()) {
			UcanaccessConnection conn = UcanaccessConnection
					.getCtxConnection();
			Connection connHsqldb = conn.getHSQLDBConnection();
			String cn = SQLConverter.escapeIdentifier(cl.getName());
			Object cnOld = memento[i];
			Object cnNew = byAccess[i];
			oldAutoValues.put(cl.getName(), cnOld);
			newAutoValues.put(cl.getName(), cnNew);
			try {
				conn.setFeedbackState(true);
				String stmt = "UPDATE "
						+ SQLConverter.escapeIdentifier(table.getName())
						+ " SET " + cn + "=? WHERE " + cn + "=?";
				ps = connHsqldb.prepareStatement(stmt);
				ps.setObject(1, cnNew);
				ps.setObject(2, cnOld);
				ps.executeUpdate();
				UcanaccessConnection.getCtxConnection()
						.setFeedbackState(false);
			} finally {
				if (ps != null)
					ps.close();
			}
		}
		++i;
	}
}
 
开发者ID:andrew-nguyen,项目名称:ucanaccess,代码行数:35,代码来源:AutoNumberAction.java

示例12: UpdateCommand

import com.healthmarketscience.jackcess.Table; //导入方法依赖的package包/类
public UpdateCommand(Table table, Map<String, Object> map, Object[] modifiedRow,
		String execId) {
	super();
	this.tableColumns = table.getColumns();
	this.indexSelector = new IndexSelector(table);
	this.rowPattern = map;
	this.modifiedRow = modifiedRow;
	this.execId = execId;
	checkBlob(modifiedRow);
	this.table=table;
}
 
开发者ID:andrew-nguyen,项目名称:ucanaccess,代码行数:12,代码来源:UpdateCommand.java

示例13: createSyncrTable

import com.healthmarketscience.jackcess.Table; //导入方法依赖的package包/类
private void createSyncrTable(Table t,boolean systemTable) throws SQLException, IOException {
	String tn = t.getName();
	String ntn =schema( SQLConverter.escapeIdentifier(tn),systemTable);
	StringBuffer sbC = new StringBuffer("CREATE  CACHED TABLE ").append(
			ntn).append("(");
	List<? extends Column> lc = t.getColumns();
	String comma = "";
	ArrayList<String> arTrigger = new ArrayList<String>();
	for (Column cl : lc) {
		String htype = cl.getType().equals(DataType.TEXT) ? "VARCHAR("
				+ cl.getLengthInUnits() + ")" : TypesMap.map2hsqldb(cl
				.getType());
		sbC.append(comma)
				.append(SQLConverter.escapeIdentifier(cl.getName()))
				.append(" ").append(htype);
		PropertyMap pm = cl.getProperties();
		Object required = pm.getValue(PropertyMap.REQUIRED_PROP);
		if (required != null && ((Boolean) required)) {
			sbC.append(" NOT NULL ");
		}
		comma = ",";
	}
	sbC.append(")");
	execCreate(sbC.toString(),true);
	for (String trigger : arTrigger) {
		execCreate(trigger,true);
	}
}
 
开发者ID:andrew-nguyen,项目名称:ucanaccess,代码行数:29,代码来源:LoadJet.java

示例14: hasAppendOnly

import com.healthmarketscience.jackcess.Table; //导入方法依赖的package包/类
private boolean hasAppendOnly(Table t) {
	for (Column c:t.getColumns()){
		if(c.isAppendOnly()){
			return true;
		}
	}
	return false;
}
 
开发者ID:andrew-nguyen,项目名称:ucanaccess,代码行数:9,代码来源:LoadJet.java

示例15: hasAutoNumberColumn

import com.healthmarketscience.jackcess.Table; //导入方法依赖的package包/类
private static boolean hasAutoNumberColumn(Table t) {
	List<? extends Column> lc = t.getColumns();
	for (Column cl : lc) {
		if (cl.isAutoNumber()) {
			return true;
		}
	}
	return false;
}
 
开发者ID:andrew-nguyen,项目名称:ucanaccess,代码行数:10,代码来源:LoadJet.java


注:本文中的com.healthmarketscience.jackcess.Table.getColumns方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。