Package javax.jdo

Examples of javax.jdo.Query.executeWithArray()


    Query query = pm.newQuery("javax.jdo.query.SQL", queryText);
    if (max != null) {
      query.setRange(0, max.shortValue());
    }
    @SuppressWarnings("unchecked")
    List<Object> sqlResult = (List<Object>)query.executeWithArray(params);
    long queryTime = doTrace ? System.nanoTime() : 0;
    if (sqlResult.isEmpty()) {
      timingTrace(doTrace, queryText, start, queryTime);
      return new ArrayList<Partition>(); // no partitions, bail early.
    }
View Full Code Here


    + "  left outer join \"SERDES\" on \"SDS\".\"SERDE_ID\" = \"SERDES\".\"SERDE_ID\" "
    + "where \"PART_ID\" in (" + partIds + ") order by \"PART_NAME\" asc";
    start = doTrace ? System.nanoTime() : 0;
    query = pm.newQuery("javax.jdo.query.SQL", queryText);
    @SuppressWarnings("unchecked")
    List<Object[]> sqlResult2 = (List<Object[]>)query.executeWithArray(params);
    queryTime = doTrace ? System.nanoTime() : 0;

    // Read all the fields and create partitions, SDs and serdes.
    TreeMap<Long, Partition> partitions = new TreeMap<Long, Partition>();
    TreeMap<Long, StorageDescriptor> sds = new TreeMap<Long, StorageDescriptor>();
View Full Code Here

    params[0] = dbName;
    params[1] = tableName;
    for (int i = 0; i < colNames.size(); ++i) {
      params[i + 2] = colNames.get(i);
    }
    Object qResult = query.executeWithArray(params);
    long queryTime = doTrace ? System.nanoTime() : 0;
    if (qResult == null) {
      query.closeAll();
      return null;
    }
View Full Code Here

      params[paramI++] = colName;
    }
    for (String partName : partNames) {
      params[paramI++] = partName;
    }
    Object qResult = query.executeWithArray(params);
    long queryTime = doTrace ? System.nanoTime() : 0;
    if (qResult == null) {
      query.closeAll();
      return Lists.newArrayList();
    }
View Full Code Here

        arg = readLine();
        if (!"".equals(arg)) args.add(arg);
    } while (!"".equals(arg));
   
      }
      Collection results = (Collection) query.executeWithArray(args.toArray());

      System.out.println("Query returned " + results.size() + " results");

      Action action = new EditCollectionAction(mgr, results);
      return action.go();
View Full Code Here

  // Execute each query
  for (int i = 0; i < queries.length; i++) {
      q = CodeQuery.parseCodeQuery(mgr, queries[i]);
      System.out.println(q);
      // Force the query to execute
      ((Collection) q.executeWithArray((Object[]) params[i]))
    .iterator().hasNext();
  }

  q = mgr.newQuery(TestInterface.class, "collection.contains(employee) && employee.firstName != \"Bob\"");
  q.declareVariables("Employee employee");
View Full Code Here

    Query query = pm.newQuery(Employee.class);
    query.declareParameters("long idMin, long idMax");
    query.setFilter("((empid>=idMin) && (empid<=idMax))");
    query.setOrdering("empid descending");
    try {
            Collection col = (Collection) query.executeWithArray(param);
        Iterator iter = col.iterator();
        if (!iter.hasNext())
          throw new RuntimeException("Query on employee does not return any row");
        Employee e = (Employee) iter.next();
        outStr.append("\n\tEmployee name (").append(e.getEmpid());
View Full Code Here

      query.setFilter(filter);

            Collection expectedNames = new ArrayList(2);
            expectedNames.add(POBuilder.names[1]);
            expectedNames.add(POBuilder.names[2]);
      Collection col = (Collection) query.executeWithArray(expectedNames.toArray());
            Iterator iter = col.iterator();

            Collection foundNames = new ArrayList(2);
            Assert.assertTrue("The query result is empty", iter.hasNext());
            Employee e = (Employee) iter.next();
View Full Code Here

        query.declareParameters("String p1,CataloguePersistantImpl p2");
        query.setFilter("(nom.startsWith(p1) && (catalogue == p2))");
        query.setResult("count(*)");
    query.setUnique(true);
    query.setRange(0,2);
        Long l = (Long) query.executeWithArray(new Object[] { "article", cat });
        assertTrue("", l.longValue() > 0);
        query.closeAll();
    pm.currentTransaction().commit();
   
    pm.currentTransaction().begin();
View Full Code Here

        query.declareParameters("String p1,CataloguePersistantImpl p2");
        query.setFilter("(nom.startsWith(p1) && (catalogue == p2))");
        query.setResult("count(*)");
    query.setUnique(true);
    query.setRange(0,5);
        l = (Long) query.executeWithArray(new Object[] { "article", cat });
        query.closeAll();
        assertTrue("", l.longValue() > 0);
        pm.currentTransaction().commit();

    pm.currentTransaction().begin();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.