public TreeParserRootSymbolScope getRootScope() { if (parentScope == null) { return (TreeParserRootSymbolScope) this; } else { return parentScope.getRootScope(); } }
public TreeParserRootSymbolScope getRootScope() { if (parentScope == null) { return (TreeParserRootSymbolScope) this; } else { return parentScope.getRootScope(); } }
/** Get or create the unnamed buffer for a schema table. */ public TableBuffer getUnnamedBuffer(ITable table) { assert table.getStoretype() == IConstants.ST_DBTABLE; // Check this and parents for the unnamed buffer. Table triggers // can scope an unnamed buffer - that's why we don't go straight to // the root scope. TreeParserSymbolScope nextScope = this; while (nextScope != null) { TableBuffer buffer = nextScope.unnamedBuffers.get(table); if (buffer != null) return buffer; nextScope = nextScope.parentScope; } return getRootScope().defineBuffer("", table); }
/** Get or create the unnamed buffer for a schema table. */ public TableBuffer getUnnamedBuffer(ITable table) { assert table.getStoretype() == IConstants.ST_DBTABLE; // Check this and parents for the unnamed buffer. Table triggers // can scope an unnamed buffer - that's why we don't go straight to // the root scope. TreeParserSymbolScope nextScope = this; while (nextScope != null) { TableBuffer buffer = nextScope.unnamedBuffers.get(table); if (buffer != null) return buffer; nextScope = nextScope.parentScope; } return getRootScope().defineBuffer("", table); }
/** * Add a TableBuffer for names lookup. This is called when copying a SymbolScopeSuper's symbols for inheritance * purposes. */ private void add(TableBuffer tableBuffer) { ITable table = tableBuffer.getTable(); addTableBuffer(tableBuffer.getName(), table, tableBuffer); getRootScope().addTableDefinitionIfNew(table); }
/** * Add a TableBuffer for names lookup. This is called when copying a SymbolScopeSuper's symbols for inheritance * purposes. */ private void add(TableBuffer tableBuffer) { ITable table = tableBuffer.getTable(); addTableBuffer(tableBuffer.getName(), table, tableBuffer); getRootScope().addTableDefinitionIfNew(table); }
/** * Lookup a Table or a BufferSymbol, schema table first. It seems to work like this: unabbreviated schema name, then * buffer/temp/work name, then abbreviated schema names. Sheesh. */ public TableBuffer lookupTableOrBufferSymbol(String inName) { String tblName = inName.indexOf('.') == -1 ? inName : inName.substring(inName.indexOf('.') + 1); ITable table = getRootScope().getRefactorSession().getSchema().lookupTable(tblName); if ((table != null) && tblName.equalsIgnoreCase(table.getName())) return getUnnamedBuffer(table); TableBuffer ret2 = lookupBuffer(tblName); if (ret2 != null) return ret2; if (table != null) return getUnnamedBuffer(table); if (parentScope == null) return null; return parentScope.lookupTableOrBufferSymbol(inName); }
/** * Lookup a Table or a BufferSymbol, schema table first. It seems to work like this: unabbreviated schema name, then * buffer/temp/work name, then abbreviated schema names. Sheesh. */ public TableBuffer lookupTableOrBufferSymbol(String inName) { String tblName = inName.indexOf('.') == -1 ? inName : inName.substring(inName.indexOf('.') + 1); ITable table = getRootScope().getRefactorSession().getSchema().lookupTable(tblName); if ((table != null) && tblName.equalsIgnoreCase(table.getName())) return getUnnamedBuffer(table); TableBuffer ret2 = lookupBuffer(tblName); if (ret2 != null) return ret2; if (table != null) return getUnnamedBuffer(table); if (parentScope == null) return null; return parentScope.lookupTableOrBufferSymbol(inName); }
/** Given a name, find a BufferSymbol (or create if necessary for unnamed buffer). */ public TableBuffer getBufferSymbol(String inName) { TableBuffer symbol = lookupBuffer(inName); if (symbol != null) return symbol; // The default buffer for temp and work tables was defined at // the time that the table was defined. So, lookupBuffer() would have found // temp/work table references, and all we have to search now is schema. ITable table = getRootScope().getRefactorSession().getSchema().lookupTable(inName); if (table == null) return null; return getUnnamedBuffer(table); }
/** Given a name, find a BufferSymbol (or create if necessary for unnamed buffer). */ public TableBuffer getBufferSymbol(String inName) { TableBuffer symbol = lookupBuffer(inName); if (symbol != null) return symbol; // The default buffer for temp and work tables was defined at // the time that the table was defined. So, lookupBuffer() would have found // temp/work table references, and all we have to search now is schema. ITable table = getRootScope().getRefactorSession().getSchema().lookupTable(inName); if (table == null) return null; return getUnnamedBuffer(table); }
IField field; result = new FieldLookupResult(); field = symbolScope.getRootScope().lookupUnqualifiedField(name); if (field != null) { tableBuff = symbolScope.getRootScope().getLocalTableBuffer(field.getTable()); } else { field = symbolScope.getRootScope().getRefactorSession().getSchema().lookupUnqualifiedField(name); if (field == null) return null;
/** * Could this FieldBuffer be referenced by the input name? Input Field.Name must already be all lowercase. Deals with * abbreviations, unqualified table/database, and db aliases. */ public boolean canMatch(Field.Name input) { // Assert that the input name is already lowercase. assert input.generateName().equalsIgnoreCase(input.generateName()); Field.Name self = new Field.Name(this.fullName().toLowerCase()); if (input.getDb() != null) { ISchema schema = getScope().getRootScope().getRefactorSession().getSchema(); if (this.buffer.getTable().getDatabase() != schema.lookupDatabase(input.getDb())) return false; } if (input.getTable() != null) { if (buffer.isDefaultSchema()) { if (!self.getTable().startsWith(input.getTable())) return false; } else { // Temp/work/buffer names can't be abbreviated. if (!self.getTable().equals(input.getTable())) return false; } } if (!self.getField().startsWith(input.getField())) return false; return true; }
/** * Could this FieldBuffer be referenced by the input name? Input Field.Name must already be all lowercase. Deals with * abbreviations, unqualified table/database, and db aliases. */ public boolean canMatch(Field.Name input) { // Assert that the input name is already lowercase. assert input.generateName().equalsIgnoreCase(input.generateName()); Field.Name self = new Field.Name(this.fullName().toLowerCase()); if (input.getDb() != null) { ISchema schema = getScope().getRootScope().getRefactorSession().getSchema(); if (this.buffer.getTable().getDatabase() != schema.lookupDatabase(input.getDb())) return false; } if (input.getTable() != null) { if (buffer.isDefaultSchema()) { if (!self.getTable().startsWith(input.getTable())) return false; } else { // Temp/work/buffer names can't be abbreviated. if (!self.getTable().equals(input.getTable())) return false; } } if (!self.getField().startsWith(input.getField())) return false; return true; }
IField field; result = new FieldLookupResult.Builder(); field = symbolScope.getRootScope().lookupUnqualifiedField(name); if (field != null) { tableBuff = symbolScope.getRootScope().getLocalTableBuffer(field.getTable()); } else { field = symbolScope.getRootScope().getRefactorSession().getSchema().lookupUnqualifiedField(name); if (field == null) return null;