Package org.gdbms.engine.data

Examples of org.gdbms.engine.data.ExecutionException


        ret = dataSource;
      }

      return ret;
    } catch (DriverException e) {
      throw new ExecutionException(e);
    } catch (EvaluationException e) {
      throw new ExecutionException(e);
    } catch (IOException e) {
      throw new ExecutionException(e);
    } catch (SemanticException e) {
      throw new ExecutionException(e);
    } catch (DriverLoadException e) {
      throw new ExecutionException(e);
    } catch (NoSuchTableException e) {
      throw new ExecutionException(e);
    } catch (DataSourceCreationException e) {
      throw new ExecutionException(e);
    }
  }
View Full Code Here


  public DataSource union(UnionAdapter instr) throws ExecutionException {
    try {
      return new UnionDataSource(instr.getFirstTable(), instr
          .getSecondTable());
    } catch (DriverLoadException e) {
      throw new ExecutionException(e);
    } catch (NoSuchTableException e) {
      throw new ExecutionException(e);
    } catch (DataSourceCreationException e) {
      throw new ExecutionException(e);
    } catch (ExecutionException e) {
      throw new ExecutionException(e);
        }
  }
View Full Code Here

    }

    try {
      return query.evaluate(instr.getTables(), instr.getValues());
    } catch (DriverLoadException e) {
      throw new ExecutionException(e);
    } catch (NoSuchTableException e) {
      throw new ExecutionException(e);
    } catch (DataSourceCreationException e) {
      throw new ExecutionException(e);
    }
  }
View Full Code Here

 
          String dataSourceName = dsf.nameAndRegisterDataSource(qd);

            return dsf.getDataSource(dataSourceName);
        } catch (NoSuchTableException e) {
            throw new ExecutionException(e);
        } catch (DriverLoadException e) {
            throw new ExecutionException(e);
    } catch (DataSourceCreationException e) {
            throw new ExecutionException(e);
    } catch (DriverException e) {
      throw new ExecutionException(e);
    } catch (SemanticException e) {
      throw new ExecutionException(e);
    }
  }
View Full Code Here

  /**
   * @throws QueryException
   * @see org.gdbms.engine.customQuery.CustomQuery#evaluate(org.gdbms.engine.data.DataSource[], org.gdbms.engine.instruction.Expression[])
   */
  public OperationDataSource evaluate(DataSource[] tables, Expression[] values) throws ExecutionException {
    if (tables.length != 1) throw new ExecutionException("SUM only operates on one table");
    if (values.length != 1) throw new ExecutionException("SUM only operates with one value");
   
    ((Adapter) values[0]).getInstructionContext().setFromTables(new DataSource[]{tables[0]});
    ((Adapter) values[0]).getInstructionContext().setDs(tables[0]);

    String fieldName = values[0].getFieldName();
    if (fieldName == null) throw new ExecutionException("field not found " + Utilities.getText(((Adapter)values[0]).getEntity()));
   
    double res = 0;
    try {

      tables[0].start();
     
      int fieldIndex = tables[0].getFieldIndexByName(fieldName);
      if (fieldIndex == -1) throw new RuntimeException("we found the field name of the expression but could not find the field index?");
   
      for (int i = 0; i < tables[0].getRowCount(); i++) {
        Value v = tables[0].getFieldValue(i, fieldIndex);
        if (v instanceof NumericValue){
          res += ((NumericValue) v).doubleValue();
        }else{
          throw new ExecutionException("SUM only operates with numeric fields");
        }
      }
     
      tables[0].stop();
    } catch (DriverException e) {
      throw new ExecutionException("Error reading data", e);
    }
   
    return new SumDataSource(res);
  }
View Full Code Here

TOP

Related Classes of org.gdbms.engine.data.ExecutionException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.