Exemplo n.º 1
0
 /* return the full column name uniquely identifying this field in a result set */
 public String getFullColumnName(Field field) {
   if (consistsOfSingleFromVariable()
       && (((FromVariable) expression.getWords().get(0))
           .getObject()
           .getTableName()
           .equals(field.getTable().getName()))) {
     return getUniqueName() + "." + field.getDescription();
   } else {
     System.err.println("Error : trying to get a field from a variable that does not know it");
     return null;
   }
 }
Exemplo n.º 2
0
 public Collection<String> getPrimaryKeyWhereClauseNames() {
   if (consistsOfSingleFromVariable()) {
     Table table = ((FromVariable) expression.getWords().get(0)).getObject().getTable();
     Collection<String> res = new ArrayList<String>();
     Iterator<Field> iter = table.getPrimaryKeyFields().iterator();
     while (iter.hasNext()) {
       Field field = iter.next();
       res.add(acceptWhereClauseFullName(DatabaseManager.getInstance().getQueryBuilder(), field));
     }
     return res;
   } else {
     System.err.println("Error : trying to get a field from a variable that does not know it");
     return null;
   }
 }
Exemplo n.º 3
0
 public Collection<String> getPrimaryKeyColumnNames() {
   if (consistsOfSingleFromVariable()) {
     Table table = ((FromVariable) expression.getWords().get(0)).getObject().getTable();
     Collection<String> res = new ArrayList<String>();
     Iterator<Field> iter = table.getPrimaryKeyFields().iterator();
     while (iter.hasNext()) {
       Field field = iter.next();
       res.add(getFullColumnName(field));
     }
     return res;
   } else {
     System.err.println("Error : trying to get a field from a variable that does not know it");
     return null;
   }
 }
Exemplo n.º 4
0
 public boolean consistsOfSingleFromVariable() {
   List<ConfigurableWord> wordList = expression.getWords();
   return ((wordList.size() == 1) && (wordList.get(0) instanceof FromVariable));
 }