@Override public boolean equals( Object obj ) { if ( !( obj instanceof KeyPropagation ) ) { return false; } KeyPropagation that = (KeyPropagation) obj; if ( !this.source.equals( that.source ) || !this.target.equals( that.target ) ) { return false; } for ( int i = 0; i < pkColumns.size(); i++ ) { if ( !this.pkColumns.get( i ).equals( that.pkColumns.get( i ) ) ) { return false; } if ( !this.fkColumns.get( i ).equals( that.fkColumns.get( i ) ) ) { return false; } } return true; }
private JoinRow buildJoinRow( InsertRow row, TableJoin join ) throws FeatureStoreException { JoinRow newRow = new JoinRow( this, join ); delayedRows.add( newRow ); KeyPropagation keyPropagation = tableDeps.findKeyPropagation( join.getFromTable(), join.getFromColumns(), join.getToTable(), join.getToColumns() ); if ( keyPropagation == null ) { String msg = "Internal error: table dependencies don't contain join " + join; throw new FeatureStoreException( msg ); } if ( keyPropagation.getSourceTable().equals( join.getFromTable() ) ) { ParentRowReference ref = new ParentRowReference( row, keyPropagation ); newRow.addParent( ref ); List<InsertRow> children = rowToChildRows.get( row ); if ( children == null ) { children = new ArrayList<InsertRow>(); rowToChildRows.put( row, children ); } children.add( newRow ); } else { ParentRowReference ref = new ParentRowReference( newRow, keyPropagation ); row.addParent( ref ); List<InsertRow> children = new ArrayList<InsertRow>(); rowToChildRows.put( newRow, children ); children.add( row ); } return newRow; }
private String retrieveTypeOfPrimaryKey( TableName fromTable, SQLIdentifier toColumn, FIDMapping fidMapping ) { if ( fidMapping != null ) { for ( Pair<SQLIdentifier, BaseType> column : fidMapping.getColumns() ) { if ( toColumn.equals( column.getFirst() ) ) { return getDBType( column.getSecond() ); } } } // in joins not connected to the main feature type table 'integer' is used by default if ( !fromTable.equals( currentFtTable ) ) { return "integer"; } return "varchar(2000)"; }
private String retrieveTypeOfPrimaryKey( TableName fromTable, SQLIdentifier toColumn, FIDMapping fidMapping ) { if ( fidMapping != null ) { for ( Pair<SQLIdentifier, BaseType> column : fidMapping.getColumns() ) { if ( toColumn.equals( column.getFirst() ) ) { return getDBType( column.getSecond() ); } } } // TODO implement this correctly // in joins not connected to the main feature type table 'integer' is used by default if ( !fromTable.equals( currentFtTable ) ) { return "integer"; } return "varchar(2000)"; }
private String retrieveTypeOfPrimaryKey( TableName fromTable, SQLIdentifier toColumn, FIDMapping fidMapping ) { if ( fidMapping != null ) { for ( Pair<SQLIdentifier, BaseType> column : fidMapping.getColumns() ) { if ( toColumn.equals( column.getFirst() ) ) { return getDBType( column.getSecond() ); } } } // TODO implement this correctly // in joins not connected to the main feature type table 'integer' is used by default if ( !fromTable.equals( currentFtTable ) ) { return "integer"; } return "text"; }