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 );
List<Column> col = t.getColumns(); int nr = col.size(); for ( int i = 0; i < nr; i++ ) {
@Override public List<? extends Column> getColumns() { return wrapped.getColumns(); }
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())); }
private boolean hasAppendOnly(Table t) { for (Column c : t.getColumns()) { if (c.isAppendOnly()) { return true; } } return false; }
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) { saveColumnsDefaults(defaults, required, cl, j); j++; } } }
@SuppressWarnings("unchecked") private List<com.healthmarketscience.jackcess.Column> getColumns(String tableName) throws IOException { return (List<com.healthmarketscience.jackcess.Column>) jackcessDatabase.getTable(tableName).getColumns(); }
private Map<String, Object> escapeIdentifiers(Map<String, Object> map, Table t) { List<? extends Column> colums = t.getColumns(); Map<String, Object> vl = new LinkedHashMap<String, Object>(); for (Column cl : colums) { String key = cl.getName(); String keyu = key.toUpperCase(); String ekey = map.containsKey(keyu) ? keyu : 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; }
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)); } }
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); } }
Table table = it.next(); String tableName = table.getName(); List<? extends Column> columns = table.getColumns(); xhtml.startElement("table", "name", tableName); addHeaders(columns, xhtml);
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); } } }
@Override public Collection<IColumn> getColumns() { ArrayList<IColumn> ret = new ArrayList<IColumn>(); try { for (com.healthmarketscience.jackcess.Column cc : getTable().getColumns()) { ret.add(new Column(cc.getName())); } } catch (KlabIOException e) { ret.clear(); } return ret; }
public UpdateCommand(Table _table, Map<String, Object> _map, Object[] _modifiedRow, String _execId) { this.tableColumns = _table.getColumns(); this.indexSelector = new IndexSelector(_table); this.rowPattern = _map; this.modifiedRow = _modifiedRow; this.execId = _execId; checkBlob(_modifiedRow); this.table = _table; }
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(); } }
@Override public IColumn getColumn(String columnName) { boolean ok = false; try { for (com.healthmarketscience.jackcess.Column cc : getTable().getColumns()) { if (cc.getName().equals(columnName)) { ok = true; break; } } } catch (KlabIOException e) { } return ok ? new Column(columnName) : null; }
private static boolean hasAutoNumberColumn(Table t) { List<? extends Column> lc = t.getColumns(); for (Column cl : lc) { if (cl.isAutoNumber() || DataType.BOOLEAN.equals(cl.getType())) { return true; } } return false; }
private String getExpression(Column cl) throws IOException { PropertyMap map = cl.getProperties(); Property exprp = map.get(PropertyMap.EXPRESSION_PROP); if (exprp != null) { Table tl = cl.getTable(); String expr = SQLConverter.convertPowOperator((String) exprp.getValue()); for (Column cl1 : tl.getColumns()) { expr = expr.replaceAll("\\[(?i)(" + Pattern.quote(cl1.getName()) + ")\\]", "newrow.$0"); } return expr; } return null; }
public JackcessDenseObjectMatrix2D(File file, String tablename) throws IOException { super(0, 0); database = DatabaseBuilder.open(file); VerifyUtil.verifyNotNull(database, "database could not be opened"); table = database.getTable(tablename); VerifyUtil.verifyNotNull(table, "table not found in database"); columns = table.getColumns(); cursor = CursorBuilder.createCursor(table); for (int i = 0; i < columns.size(); i++) { setColumnLabel(i, columns.get(i).getName()); } setLabel(tablename); }
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); }