Package de.iritgo.aktera.query

Examples of de.iritgo.aktera.query.QueryException


      myConnection = dataSource.getConnection();
      log.debug("[CONNECTION] instantiated: " + myConnection.toString());
    }
    catch (SQLException e)
    {
      throw new QueryException(e, "Obtaining database connection failed");
    }

    //     modified by aleks
    try
    {
      // ===================================================
      // We are building a tabular report which analyzes the objects
      // named in ObjectKeys.  So if ObjectKeys collection is not empty we
      // store ObjectKeys info the id cache table called queryJoin. myQueryId identifies the cache.
      // Warning: If ObjectKeys is empty the method polymorphism
      // getQueryResults with no parameter should be used instead
      // ===================================================
      if (objectKeys != null)
      {
        myQueryId = cacheObjectKeys(objectKeys, myQueryId, myConnection);
      } //end if
      else
      {
        log.warn("\n\n\n getQueryResults(objectKeys) has been called"
                + " with objectKeys == null, but getQueryResults() without parameters should be used");
      }

      // ===================================================
      // now run the query and get tabular report
      // ===================================================
      queryResult = runQuery(myConnection, myQueryId);

      // ===================================================
      // Eliminate the object Keys cache: no longer needed
      // ===================================================
      deCacheObjectKeys(myQueryId, myConnection);
    }
    catch (QueryException qe)
    {
      throw new QueryException(qe);
    }
    finally
    {
      try
      {
        myConnection.close();
        myConnection = null;
      }
      catch (SQLException e1)
      {
        throw new QueryException(e1);
      }
    }

    // modified by aleks
    return queryResult;
View Full Code Here


      myConnection = dataSource.getConnection();
      log.debug("[CONNECTION2] instantiated: " + myConnection.toString());
    }
    catch (SQLException e)
    {
      throw new QueryException(e, "Obtaining database connection failed");
    }

    // ===================================================
    // now run the query and get tabular report
    // There is no queryId, so we pass 0 as a dummy parameter
    // ===================================================
    //       modified by aleks
    try
    {
      queryResult = runQuery(myConnection, 0);
    }
    catch (QueryException qe)
    {
      throw new QueryException(qe);
    }
    finally
    {
      try
      {
        myConnection.close();
        myConnection = null;
      }
      catch (SQLException e1)
      {
        throw new QueryException(e1);
      }
    }

    // modified by aleks
    return queryResult;
View Full Code Here

      {
        myQueryId = myIdGenerator.getNextIntegerId();
      }
      catch (IdException ie)
      {
        throw new QueryException("Unable to get myQueryId. ");
      }

      // ===================================================
      // Add each ObjectKey to sql batch insert statement
      // ===================================================
      ObjectKey oneKey = null;
      String insertStatement = null;

      // modified by aleks
      aStatement = myConnection.createStatement();

      // modified by aleks
      for (Iterator i = objectKeys.iterator(); i.hasNext();)
      {
        ObjectKey oneObj = (ObjectKey) i.next();

        if (oneObj != null)
        {
          oneKey = oneObj;
          log.info("UniqueId of ObjectKey: " + oneKey.getUniqueId().toString());
          insertStatement = "INSERT INTO QueryJoin (ObjectId, QueryId, name, alias) VALUES ('"
                  + oneKey.getUniqueId().toString() + "', " + myQueryId + ", '" + oneKey.getName()
                  + "', '" + oneKey.getAlias() + "')";
          log.debug("Running statement '" + insertStatement.toString() + "'");
          aStatement.addBatch(insertStatement);
        }
      } //end for loop

      aStatement.executeBatch();

      //        int [] updateCounts = aStatement.executeBatch();
      //     for (int i = 0; i < updateCounts.length; i++)
      //     {
      //     System.out.println("sresult of batch statement number " + i + ": " + updateCounts[i]);
      //     }
    }
    catch (java.sql.BatchUpdateException be)
    {
      throw new QueryException(be, "Cacheing of objectKeys in SQL table failed");
    }
    catch (SQLException se)
    {
      throw new QueryException(se, "Cacheing of objectKeys in SQL table failed");
    }
    catch (ServiceException svce)
    {
      throw new QueryException(svce);
    }

    // modified by aleks
    finally
    {
      try
      {
        aStatement.close();
        aStatement = null;
      }
      catch (SQLException se)
      {
        throw new QueryException(se);
      }
    }

    // modified by aleks
    return myQueryId;
View Full Code Here

      // modified by aleks
      cleanupStatement.execute("DELETE FROM queryJoin   " + "WHERE QueryId = '" + myQueryId + "'");
    }
    catch (SQLException se)
    {
      throw new QueryException(se, "Failed to remove Cache of objectKeys in table queryJoin");
    }

    // modified by aleks
    finally
    {
      try
      {
        cleanupStatement.close();
        cleanupStatement = null;
      }
      catch (SQLException se)
      {
        throw new QueryException(se);
      }
    }

    // modified by aleks
  }
View Full Code Here

        // BUEROBYTE
      }
    }
    catch (ConfigurationException ce)
    {
      throw new QueryException(ce);
    }

    myStatement = new SuperString(myStatement.replace("$orderByClause", "queryJoin.name"));
    myStatement = new SuperString(myStatement.replace("$queryid", (new Integer(myQueryId)).toString()));
View Full Code Here

        queryResultRows.add(resultMap);
      }
    }
    catch (Exception de)
    {
      throw new QueryException(de);
    }
    finally
    {
      try
      {
        if (myResultSet != null)
        {
          myResultSet.close();
          myResultSet = null;
        }

        if (sqlStatement != null)
        {
          sqlStatement.close();
          sqlStatement = null;
        }

        //        if(myConnection!=null)
        //        {
        //          myConnection.close();
        //        }
      }
      catch (SQLException se)
      {
        throw new QueryException(se);
      }
    }

    return queryResultRows;
  }
View Full Code Here

      // Get a reference to a data source
      dataSource = (DataSourceComponent) getService(DataSourceComponent.ROLE, dataSourceName);
    }
    catch (ServiceException se)
    {
      throw new QueryException(se);
    }
  }
View Full Code Here

TOP

Related Classes of de.iritgo.aktera.query.QueryException

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.