@Override public Database getDatabase() { return wrapped.getDatabase(); }
private boolean matchesLinkedTable(Table table, String linkedTableName, String linkedDbName) { return (table.getName().equalsIgnoreCase(linkedTableName) && (_linkedDbs != null) && (_linkedDbs.get(linkedDbName) == table.getDatabase())); }
.append(((DatabaseImpl)getFromTable().getDatabase()).getName()) .append(")");
@Override public boolean matches(Table table, String columnName, Object value1, Object value2) { if(equals(value1, value2)) { return true; } if((value1 != null) && (value2 != null) && (value1.getClass() != value2.getClass())) { // the values aren't the same type, try coercing them to "internal" // values and try again DataType dataType = table.getColumn(columnName).getType(); try { DatabaseImpl db = (DatabaseImpl)table.getDatabase(); Object internalV1 = ColumnImpl.toInternalValue(dataType, value1, db); Object internalV2 = ColumnImpl.toInternalValue(dataType, value2, db); return equals(internalV1, internalV2); } catch(IOException e) { // ignored, just go with the original result } } return false; }
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); }
@Override public boolean isLinkedTable(Table table) throws IOException { if((table == null) || (this == table.getDatabase())) { // if the table is null or this db owns the table, not linked return false; } // common case, local table name == remote table name TableInfo tableInfo = lookupTable(table.getName()); if((tableInfo != null) && tableInfo.isLinked() && matchesLinkedTable(table, ((LinkedTableInfo)tableInfo).linkedTableName, ((LinkedTableInfo)tableInfo).linkedDbName)) { return true; } // but, the local table name may not match the remote table name, so we // need to do a search if the common case fails return _tableFinder.isLinkedTable(table); }
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); } }
int j = 0; List<? extends Column> lc = table.getColumns(); if (table.getDatabase().getColumnOrder().equals(ColumnOrder.DISPLAY)) { Object[] newRowReorded = new Object[newRow.length]; Column[] cllReorded = new Column[newRow.length];