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


Java Column类代码示例

本文整理汇总了Java中com.healthmarketscience.jackcess.Column的典型用法代码示例。如果您正苦于以下问题:Java Column类的具体用法?Java Column怎么用?Java Column使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: updateSecondaryValues

import com.healthmarketscience.jackcess.Column; //导入依赖的package包/类
private static void updateSecondaryValues(Joiner joiner, Object[] oldFromRow,
                                          Object[] newFromRow)
  throws IOException
{
  IndexCursor toCursor = joiner.getToCursor();
  List<? extends Index.Column> fromCols = joiner.getColumns();
  List<? extends Index.Column> toCols = joiner.getToIndex().getColumns();
  Object[] toRow = new Object[joiner.getToTable().getColumnCount()];

  for(Iterator<Row> iter = joiner.findRows(oldFromRow)
        .setColumnNames(Collections.<String>emptySet())
        .iterator(); iter.hasNext(); ) {
    iter.next();

    // create update row for "to" table
    Arrays.fill(toRow, Column.KEEP_VALUE);
    for(int i = 0; i < fromCols.size(); ++i) {
      Object val = fromCols.get(i).getColumn().getRowValue(newFromRow);
      toCols.get(i).getColumn().setRowValue(toRow, val);
    }

    toCursor.updateCurrentRow(toRow);
  }
}
 
开发者ID:jahlborn,项目名称:jackcess,代码行数:25,代码来源:FKEnforcer.java

示例2: testImportFromFileWithOnlyHeaders

import com.healthmarketscience.jackcess.Column; //导入依赖的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

示例3: getObject

import com.healthmarketscience.jackcess.Column; //导入依赖的package包/类
public synchronized Object getObject(int row, int column) {
	if (columns == null || cursor == null) {
		return null;
	}
	try {
		Column c = columns.get(column);
		if (curPos == null) {
			cursor.reset();
			cursor.moveNextRows(row + 1);
		} else {
			int diff = row + 1 - curPos;
			if (diff > 0) {
				cursor.moveNextRows(diff);
			} else if (diff < 0) {
				cursor.movePreviousRows(-diff);
			}
		}
		curPos = row + 1;
		return cursor.getCurrentRowValue(c);
	} catch (IOException e) {
		throw new RuntimeException(e);
	}
}
 
开发者ID:ujmp,项目名称:universal-java-matrix-package,代码行数:24,代码来源:JackcessDenseObjectMatrix2D.java

示例4: VersionHistoryColumnInfoImpl

import com.healthmarketscience.jackcess.Column; //导入依赖的package包/类
public VersionHistoryColumnInfoImpl(Column column, int complexId,
                                    Table typeObjTable, Table flatTable) 
  throws IOException
{
  super(column, complexId, typeObjTable, flatTable);

  Column valueCol = null;
  Column modifiedCol = null;
  for(Column col : getTypeColumns()) {
    switch(col.getType()) {
    case SHORT_DATE_TIME:
      modifiedCol = col;
      break;
    case MEMO:
      valueCol = col;
      break;
    default:
      // ignore
    }
  }

  _valueCol = valueCol;
  _modifiedCol = modifiedCol;
}
 
开发者ID:jahlborn,项目名称:jackcess,代码行数:25,代码来源:VersionHistoryColumnInfoImpl.java

示例5: nullSecondaryValues

import com.healthmarketscience.jackcess.Column; //导入依赖的package包/类
private static void nullSecondaryValues(Joiner joiner, Object[] oldFromRow)
  throws IOException
{
  IndexCursor toCursor = joiner.getToCursor();
  List<? extends Index.Column> fromCols = joiner.getColumns();
  List<? extends Index.Column> toCols = joiner.getToIndex().getColumns();
  Object[] toRow = new Object[joiner.getToTable().getColumnCount()];

  for(Iterator<Row> iter = joiner.findRows(oldFromRow)
        .setColumnNames(Collections.<String>emptySet())
        .iterator(); iter.hasNext(); ) {
    iter.next();

    // create update row for "to" table
    Arrays.fill(toRow, Column.KEEP_VALUE);
    for(int i = 0; i < fromCols.size(); ++i) {
      toCols.get(i).getColumn().setRowValue(toRow, null);
    }

    toCursor.updateCurrentRow(toRow);
  }
}
 
开发者ID:jahlborn,项目名称:jackcess,代码行数:23,代码来源:FKEnforcer.java

示例6: replaceColumn

import com.healthmarketscience.jackcess.Column; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private static void replaceColumn(Table t, String colName) throws Exception
{
  Field colsField = TableImpl.class.getDeclaredField("_columns");
  colsField.setAccessible(true);
  List<Column> cols = (List<Column>)colsField.get(t);

  Column srcCol = null;
  ColumnImpl destCol = new BogusColumn(t, colName);
  for(int i = 0; i < cols.size(); ++i) {
    srcCol = cols.get(i);
    if(srcCol.getName().equals(colName)) {
      cols.set(i, destCol);
      break;
    }
  }

  // copy fields from source to dest
  for(Field f : Column.class.getDeclaredFields()) {
    if(!Modifier.isFinal(f.getModifiers())) {
      f.setAccessible(true);
      f.set(destCol, f.get(srcCol));
    }
  }
  
}
 
开发者ID:jahlborn,项目名称:jackcess,代码行数:27,代码来源:ErrorHandlerTest.java

示例7: createForeignKeyTableConstraint

import com.healthmarketscience.jackcess.Column; //导入依赖的package包/类
/**
 * Creates a foreign key table constraint, e.g.
 * <pre>
 * FOREIGN KEY('otherTableId') REFERENCES otherTable('id')
 * </pre>
 *
 * @param relationship the relationship from the Access database
 * @return a foreign key constraint
 * @see <a href="https://www.sqlite.org/syntax/table-constraint.html">SQLite table-contraint</a>
 * @see <a href="https://www.sqlite.org/syntax/foreign-key-clause.html">SQLite foreign-key-clause</a>
 */
private String createForeignKeyTableConstraint(Relationship relationship) {
    final StringBuilder stmtBuilder = new StringBuilder();

    stmtBuilder.append("FOREIGN KEY(");
    for (Iterator<Column> iterator = relationship.getToColumns().iterator(); iterator.hasNext(); ) {
        Column foreignKeyColumn = iterator.next();
        stmtBuilder.append(createStringConstant(foreignKeyColumn.getName()));
        if (iterator.hasNext()) {
            stmtBuilder.append(", ");
        }
    }
    stmtBuilder.append(") REFERENCES ");
    stmtBuilder.append(createStringConstant(relationship.getFromTable().getName()));
    stmtBuilder.append("(");
    for (Iterator<Column> iterator = relationship.getFromColumns().iterator(); iterator.hasNext(); ) {
        Column referencedColumn = iterator.next();
        stmtBuilder.append(createStringConstant(referencedColumn.getName()));
        if (iterator.hasNext()) {
            stmtBuilder.append(", ");
        }
    }
    stmtBuilder.append(")");

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

示例8: persist

import com.healthmarketscience.jackcess.Column; //导入依赖的package包/类
public IFeedbackAction  persist() throws SQLException {
	try {
		Cursor cur = indexSelector.getCursor();
		if (cur.findNextRow(rowPattern)) {
			if (this.blobColumns != null) {
				for (Column col : this.blobColumns) {
					Object val = cur.getCurrentRowValue(col);
					modifiedRow[tableColumns.indexOf(col)] = val;
				}
			}
			updateComplex(cur );
			cur.updateCurrentRow(modifiedRow);
			
		}
	} catch (IOException e) {
		throw new UcanaccessSQLException(e);
	}
	return null;
}
 
开发者ID:andrew-nguyen,项目名称:ucanaccess,代码行数:20,代码来源:UpdateCommand.java

示例9: commaSeparated

import com.healthmarketscience.jackcess.Column; //导入依赖的package包/类
private String commaSeparated(List<? extends Index.Column> columns) {
	String comma = "";
	StringBuffer sb = new StringBuffer(" (");
	for (Index.Column cd : columns) {
		sb.append(comma)
				.append(SQLConverter.escapeIdentifier(cd.getColumn()
						.getName()));
		comma = ",";
	}
	return sb.append(") ").toString();
}
 
开发者ID:andrew-nguyen,项目名称:ucanaccess,代码行数:12,代码来源:LoadJet.java

示例10: loadIndex

import com.healthmarketscience.jackcess.Column; //导入依赖的package包/类
private void loadIndex(Index idx) throws IOException, SQLException {
	String ntn = SQLConverter
			.escapeIdentifier(idx.getTable().getName());
	if(ntn==null)return;
	String nin = SQLConverter.escapeIdentifier(idx.getName());
	nin = (ntn + "_" + nin).replaceAll("\"", "").replaceAll("\\W", "_");
	boolean uk = idx.isUnique();
	boolean pk = idx.isPrimaryKey();
	StringBuffer ci = new StringBuffer("ALTER TABLE ").append(ntn);
	String colsIdx = commaSeparated(idx.getColumns());
	if (pk) {
		ci.append(" ADD PRIMARY KEY ").append(colsIdx);
	} else if (uk) {
		ci.append(" ADD CONSTRAINT ").append(nin);
		ci.append(" UNIQUE ").append(colsIdx);
	} else {
		ci = new StringBuffer("CREATE INDEX ").append(nin)
				.append(" ON ").append(ntn).append(colsIdx);
	}
	try {
		execCreate(ci.toString(),true);
	} catch (Exception e) {
		if (idx.isUnique()) {
			for (Index.Column cd : idx.getColumns()) {
				if (cd.getColumn().getType()
						.equals(DataType.COMPLEX_TYPE)) {
					return;
				}
			}
		}
		Logger.logWarning(e.getMessage());
		return;
	}
	String pre = pk ? "Primary Key " : uk ? "Index Unique " : "Index";
	loadedIndexes.add(pre + " on " + ntn + " Columns:" + colsIdx);
	
}
 
开发者ID:andrew-nguyen,项目名称:ucanaccess,代码行数:38,代码来源:LoadJet.java

示例11: escapeIdentifiers

import com.healthmarketscience.jackcess.Column; //导入依赖的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

示例12: checkPK

import com.healthmarketscience.jackcess.Column; //导入依赖的package包/类
private void checkPK(List<IndexBuilder> arcl, IndexBuilder ibpk) {
	if (ibpk == null)
		return;
	Iterator<IndexBuilder> itib = arcl.iterator();
	List<IndexBuilder.Column> clspk = ibpk.getColumns();
	ArrayList<String> columnNamesPK = new ArrayList<String>();
	for (IndexBuilder.Column clpk : clspk) {
		columnNamesPK.add(clpk.getName().toUpperCase());
	}
	while (itib.hasNext()) {
		IndexBuilder ib = itib.next();
		List<IndexBuilder.Column> cls = ib.getColumns();
		if (cls.size() != clspk.size())
			continue;
		boolean clsPK = true;
		for (IndexBuilder.Column cl : cls) {
			if (!columnNamesPK.contains(cl.getName().toUpperCase())) {
				clsPK = false;
				break;
			}
		}
		if (clsPK) {
			itib.remove();
		}
	}
}
 
开发者ID:andrew-nguyen,项目名称:ucanaccess,代码行数:27,代码来源:Persist2Jet.java

示例13: saveColumnsDefaults

import com.healthmarketscience.jackcess.Column; //导入依赖的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

示例14: loadData

import com.healthmarketscience.jackcess.Column; //导入依赖的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

示例15: floatValue

import com.healthmarketscience.jackcess.Column; //导入依赖的package包/类
public static double floatValue(Object value, Column column) {
    Byte precission = column.getPrecision();
    if(precission == 0) precission = 2;
    Double number = Double.valueOf(value.toString());
    BigDecimal bigDecimal = new BigDecimal(number);
    BigDecimal roundedWithScale = bigDecimal.setScale(precission, BigDecimal.ROUND_HALF_UP);
    return Double.valueOf(roundedWithScale.toString());
}
 
开发者ID:clytras,项目名称:AccessConverter,代码行数:9,代码来源:Globals.java


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