本文整理了Java中com.healthmarketscience.jackcess.Table
类的一些代码示例,展示了Table
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Table
类的具体详情如下:
包路径:com.healthmarketscience.jackcess.Table
类名称:Table
[英]A single database table. A Table instance is retrieved from a Database instance. The Table instance provides access to the table metadata as well as the table data. There are basic data operations on the Table interface (i.e. #iterator #addRow, #updateRowand #deleteRow), but for advanced search and data manipulation a Cursor instance should be used. New Tables can be created using a TableBuilder. The com.healthmarketscience.jackcess.util.Joiner utility can be used to traverse table relationships (e.g. find rows in another table based on a foreign-key relationship).
A Table instance is not thread-safe (see Database for more thread-safety details).
[中]一个数据库表。从数据库实例检索表实例。表实例提供对表元数据和表数据的访问。表接口上有一些基本的数据操作(即#迭代器#addRow、#UpdateRow和#deleteRow),但对于高级搜索和数据操作,应该使用游标实例。可以使用TableBuilder创建新表。通讯。健康市场科学。杰克塞斯。util。Joiner实用程序可用于遍历表关系(例如,基于外键关系查找另一个表中的行)。
表实例不是线程安全的(有关线程安全的详细信息,请参阅数据库)。
代码示例来源:origin: pentaho/pentaho-kettle
public static final RowMetaInterface getLayout( Table table ) throws SQLException, KettleStepException {
RowMetaInterface row = new RowMeta();
List<Column> columns = table.getColumns();
for ( int i = 0; i < columns.size(); i++ ) {
Column column = columns.get( i );
代码示例来源:origin: pentaho/pentaho-kettle
private Object[] getOneRow() throws KettleException {
try {
if ( meta.isFileField() ) {
while ( ( data.readrow == null || ( ( data.rw = data.t.getNextRow() ) == null ) ) ) {
if ( !openNextFile() ) {
return null;
while ( ( data.file == null || ( ( data.rw = data.t.getNextRow() ) == null ) ) ) {
if ( !openNextFile() ) {
return null;
if ( meta.isIncludeTablename() && !Utils.isEmpty( data.t.getName() ) ) {
r[rowIndex++] = data.t.getName();
代码示例来源:origin: pentaho/pentaho-kettle
void addRowToTable( Object... row ) throws IOException {
table.addRow( row );
}
代码示例来源:origin: apache/tika
String tableName = table.getName();
List<? extends Column> columns = table.getColumns();
xhtml.startElement("table", "name", tableName);
addHeaders(columns, xhtml);
xhtml.startElement("tbody");
Row r = table.getNextRow();
r = table.getNextRow();
代码示例来源:origin: net.sf.ucanaccess/ucanaccess
private void setDefaultValues(Table t) throws SQLException, IOException {
String tn = t.getName();
String ntn = escapeIdentifier(tn);
List<? extends Column> lc = t.getColumns();
List<String> arTrigger = new ArrayList<String>();
for (Column cl : lc) {
setDefaultValue(cl, ntn, arTrigger);
}
for (String trigger : arTrigger) {
exec(trigger, true);
}
}
代码示例来源:origin: net.sf.ucanaccess/ucanaccess
public InsertCommand(Table _table, Object[] _newRow, String _execId) {
this.table = _table;
this.tableName = _table.getName();
this.newRow = _newRow;
this.execId = _execId;
}
代码示例来源:origin: net.sf.ucanaccess/ucanaccess
public BlobAction(Table _table, Object[] newValues) throws SQLException {
this.table = _table;
if (!BlobKey.hasPrimaryKey(_table)) {
return;
}
Index pk = _table.getPrimaryKeyIndex();
HashSet<String> hsKey = new HashSet<String>();
for (Index.Column icl : pk.getColumns()) {
hsKey.add(icl.getName());
}
HashSet<String> hsBlob = new HashSet<String>();
int i = 0;
HashMap<String, Object> keyMap = new HashMap<String, Object>();
for (Column cl : _table.getColumns()) {
if (cl.getType().equals(DataType.OLE) && newValues[i] != null) {
containsBlob = true;
hsBlob.add(cl.getName());
}
if (hsKey.contains(cl.getName())) {
keyMap.put(cl.getName(), newValues[i]);
}
++i;
}
for (String cln : hsBlob) {
keys.add(new BlobKey(keyMap, table.getName(), cln));
}
}
代码示例来源:origin: net.sf.ucanaccess/ucanaccess
private void persist(Cursor cur) throws IOException, SQLException {
Object[] mr = this.modifiedRow;
if (table.getDatabase().getColumnOrder().equals(ColumnOrder.DISPLAY)) {
Object[] newRowReorded = new Object[this.modifiedRow.length];
int j = 0;
for (Column cli : table.getColumns()) {
newRowReorded[cli.getColumnIndex()] = this.modifiedRow[j];
j++;
}
mr = newRowReorded;
}
cur.updateCurrentRow(mr);
}
代码示例来源:origin: net.sf.ucanaccess/ucanaccess
public void insertRow(Table _table, Object[] _row) throws IOException {
try {
_table.addRow(newRow);
} catch (ConstraintViolationException e) {
List<? extends Column> lc = _table.getColumns();
boolean retry = false;
for (Column cl : lc) {
if (cl.isAutoNumber()) {
retry = true;
break;
}
}
if (!retry) {
throw e;
}
Database db = _table.getDatabase();
File fl = db.getFile();
DBReferenceSingleton dbsin = DBReferenceSingleton.getInstance();
DBReference ref = dbsin.getReference(fl);
ref.reloadDbIO();
this.dbIO = ref.getDbIO();
_table = this.dbIO.getTable(this.tableName);
_table.addRow(newRow);
}
}
代码示例来源:origin: AccelerationNet/access2csv
static int export(Database db, String tableName, Writer csv, boolean withHeader, boolean applyQuotesToAll, String nullText) throws IOException{
Table table = db.getTable(tableName);
String[] buffer = new String[table.getColumnCount()];
CSVWriter writer = new CSVWriter(new BufferedWriter(csv), CSVWriter.DEFAULT_SEPARATOR, CSVWriter.DEFAULT_QUOTE_CHARACTER);
int rows = 0;
try{
if (withHeader) {
int x = 0;
for(Column col : table.getColumns()){
buffer[x++] = col.getName();
}
writer.writeNext(buffer, applyQuotesToAll);
}
for(Row row : table){
int i = 0;
for (Object object : row.values()) {
buffer[i++] = object == null ? nullText : object.toString();
}
writer.writeNext(buffer, applyQuotesToAll);
rows++;
}
}finally{
writer.close();
}
return rows;
}
代码示例来源:origin: com.healthmarketscience.jackcess/jackcess
private boolean matchesLinkedTable(Table table, String linkedTableName,
String linkedDbName) {
return (table.getName().equalsIgnoreCase(linkedTableName) &&
(_linkedDbs != null) &&
(_linkedDbs.get(linkedDbName) == table.getDatabase()));
}
代码示例来源:origin: net.sf.ucanaccess/ucanaccess
try {
int i = 0;
Iterator<Row> it = t.iterator();
if (i != t.getRowCount() && step != 1) {
Logger.logParametricWarning(Messages.ROW_COUNT, t.getName(), String.valueOf(t.getRowCount()),
String.valueOf(i));
代码示例来源:origin: net.sf.ucanaccess/ucanaccess
for (Column cli : t.getColumns()) {
ColumnImpl cl = (ColumnImpl) cli;
if (cli.getType().equals(DataType.COMPLEX_TYPE) && (newR[i] == null || "".equals(newR[i]))) {
if (type == Trigger.INSERT_BEFORE_ROW) {
if (t.isAllowAutoNumberInsert()) {
if (cl.getAutoNumberGenerator().getType().equals(DataType.LONG) && newR[i] != null) {
AutoNumberManager.bump(cl, (Integer) newR[i]);
代码示例来源:origin: stackoverflow.com
Table RESOURCES = Database.open(new File("TargetFile.mdb")).getTable("RESOURCES");
int pcount = RESOURCES.getRowCount();
String csvFilename = "C:\\STATS\\APEX\\report.csv";
CSVReader csvReader = new CSVReader(new FileReader(csvFilename));
List<String[]> content = csvReader.readAll();
Map<ValueKey, Integer> csvValuesCount = new HashMap<ValueKey, Integer>();
for (String[] rowcsv : content) {
ValueKey key = new ValueKey(rowcsv[6], rowcsv[1]);
Integer count = csvValuesCount.get(key);
csvValuesCount.put(key,count == null ? 1: count + 1);
}
int count = 0;
// Taking 1st resource data
for (int i = 0; i < pcount; i++) {
Map<String, Object> row = RESOURCES.getNextRow();
TEAM = row.get("TEAM").toString();
MDMID = row.get("MDM ID").toString();
NAME = row.get("RESOURCE NAME").toString();
PGNAME = row.get("PG NAME").toString();
PGTARGET = row.get("PG TARGET").toString();
int PGTARGETI = Integer.parseInt(PGTARGET);
Integer countInteger = csvValuesCount.get(new ValueKey(MDMID, PGNAME));
count = countInteger == null ? 0: countInteger;
}
代码示例来源:origin: com.healthmarketscience.jackcess/jackcess
int numColumns = table.getColumnCount();
table.addRows(rows);
rows.clear();
table.addRows(rows);
return table.getName();
代码示例来源:origin: net.sf.ucanaccess/ucanaccess
mt.dropTable(t.getName());
if (!HibernateSupport.isActive()) {
Cursor c = t.getDefaultCursor();
while (c.getNextRow() != null) {
c.deleteCurrentRow();
Table cat = dbi.getSystemCatalog();
Map<String, Object> row;
Cursor catc = cat.getDefaultCursor();
while ((row = catc.getNextRow()) != null) {
String name = (String) row.get("Name");
Map<String, Object> rowtsa = new HashMap<String, Object>();
rowtsa.put("ObjectId", id);
Cursor cur = tsa.getDefaultCursor();
if (cur.findNextRow(rowtsa)) {
cur.deleteCurrentRow();
Cursor srsc = srs.getDefaultCursor();
while ((row = srsc.getNextRow()) != null) {
String szObject = (String) row.get("szObject");
代码示例来源:origin: net.sf.ucanaccess/ucanaccess
public BlobKey(Table _table, String _columnName, Row _row) {
this.tableName = _table.getName();
this.columnName = _columnName;
if (hasPrimaryKey(_table)) {
List<? extends Index.Column> cl = _table.getPrimaryKeyIndex().getColumns();
HashMap<String, Object> keyMap = new HashMap<String, Object>();
for (Index.Column c : cl) {
keyMap.put(c.getName(), _row.get(c.getName()));
}
this.key = keyMap;
}
}
代码示例来源:origin: com.healthmarketscience.jackcess/jackcess
table.addRows(rows);
rows.clear();
table.addRows(rows);
return table.getName();
代码示例来源:origin: ujmp/universal-java-matrix-package
public long[] getSize() {
size[ROW] = table.getRowCount();
size[COLUMN] = table.getColumnCount();
return size;
}
代码示例来源:origin: org.integratedmodelling/klab-common
@Override
public int getValueCount() {
try {
return getTable().getRowCount();
} catch (KlabIOException e) {
// shouldn't happen
}
return 0;
}
内容来源于网络,如有侵权,请联系作者删除!