Package com.alvazan.orm.api.z3api

Examples of com.alvazan.orm.api.z3api.QueryResult


   
    DboTableMeta meta = mgr.find(DboTableMeta.class, cf);
    if (meta == null) {
      System.out.println("Column family meta not found for " + cf);
      System.out.println("You can select from following tables:");
      QueryResult result = mgr.getTypedSession().createQueryCursor("select * from DboTableMeta", 100);
      Cursor<List<TypedRow>> cursor = result.getAllViewsCursor();
      while (cursor.next()) {
        List<TypedRow> joinedRow = cursor.getCurrent();
        for (TypedRow r : joinedRow) {
          System.out.println(r.getRowKeyString());
        }
View Full Code Here


  }

  @Override
  public int executeQuery(String query) {
    int batchSize = 250;
    QueryResult result = createQueryCursor(query, batchSize);
    Cursor<List<TypedRow>> cursor = result.getAllViewsCursor();
    return updateBatch(cursor, result);
  }
View Full Code Here

        valueString = ""+ (((Float)value).floatValue());
    }
    else
      valueString = null;
    int batchSize = 250;
    QueryResult result = createQueryCursor(query+valueString,batchSize);
    Cursor<IndexColumnInfo> cursor = result.getCursor();
    int rowCount = 0;
    while(cursor.next())
      rowCount++;
    return rowCount;
  }
View Full Code Here

     *
     * Process the SQL query which is inserted as an command line arguments
     */
  private static void processSQL(String[] args){
    NoSqlTypedSession ntsession = mgr.getTypedSession();
        QueryResult result = ntsession.createQueryCursor(args[0], 50);
        Cursor<List<TypedRow>> cursor = result.getAllViewsCursor();
        processBatch(cursor);
  }
View Full Code Here

          Assert.assertEquals(rowId.toString(), fkcomposite);
        }
      }
    //}

    QueryResult qResult = s2.createQueryCursor("select * from MyRaceCar", 50);
    Cursor<KeyValue<TypedRow>> primView = qResult.getPrimaryViewCursor();
    Assert.assertTrue(primView.next());
    KeyValue<TypedRow> current = primView.getCurrent();
    TypedRow resultRow = current.getValue();
    Assert.assertEquals(row.getRowKey(), resultRow.getRowKey());
   
    Cursor<List<TypedRow>> cursor = qResult.getAllViewsCursor();
    Assert.assertTrue(cursor.next());
    List<TypedRow> theRow = cursor.getCurrent();
    Assert.assertEquals(1, theRow.size());
    TypedRow myRow = theRow.get(0);
    Assert.assertEquals(row.getRowKey(), myRow.getRowKey());
   
    QueryResult rResult = s2.createQueryCursor("select * from Owner", 50);
    Assert.assertFalse(rResult.getCursor().next());
  }
View Full Code Here

   
    mgr.flush();
   
    String sql = "select a from Email as a";
    NoSqlTypedSession s = mgr.getTypedSession();
    QueryResult result = s.createQueryCursor(sql, 10); // only need last
    Cursor<KeyValue<TypedRow>> cursor = result.getPrimaryViewCursor();
    cursor.afterLast();
    Assert.assertTrue(cursor.previous());
    Assert.assertEquals("email3", cursor.getCurrent().getKey());
  }
View Full Code Here

   
    mgr.flush();
   
    String sql = "select a from Email as a";
    NoSqlTypedSession s = mgr.getTypedSession();
    QueryResult result = s.createQueryCursor(sql, 10); // only need last
    Cursor<KeyValue<TypedRow>> cursor = result.getPrimaryViewCursor();
    cursor.beforeFirst();
    List<TypedRow> list = new ArrayList<TypedRow>();
    TypedRow myRow = null;
    while(cursor.next()) {
      list.add(cursor.getCurrent().getValue());
View Full Code Here

 
  @Test
  public void testInnerJoin() throws InterruptedException {
    NoSqlTypedSession s = mgr.getTypedSession();

    QueryResult result = s.createQueryCursor("select * FROM Activity as e INNER JOIN e.account  as a WHERE e.numTimes < 15 and a.isActive = false", 50);
    List<ViewInfo> views = result.getViews();
    Cursor<IndexColumnInfo> cursor = result.getCursor();

    ViewInfo viewAct = views.get(0);
    ViewInfo viewAcc = views.get(1);
    String alias1 = viewAct.getAlias();
    String alias2 = viewAcc.getAlias();
    Assert.assertEquals("e", alias1);
    Assert.assertEquals("a", alias2);   
   
    Assert.assertTrue(cursor.next());
    compareKeys(cursor, viewAct, viewAcc, "act1", "acc1");
    Assert.assertTrue(cursor.next());
    compareKeys(cursor, viewAct, viewAcc, "act7", "acc1");
    Assert.assertFalse(cursor.next());
   
    Cursor<List<TypedRow>> rows = result.getAllViewsCursor();
   
    rows.next();
    List<TypedRow> joinedRow = rows.getCurrent();
   
    TypedRow typedRow = joinedRow.get(0);
View Full Code Here

 
  @Test
  public void testInnerJoinParts() throws InterruptedException {
    NoSqlTypedSession s = mgr.getTypedSession();

    QueryResult result = s.createQueryCursor("select * FROM Activity as e WHERE e.numTimes < 15", 50);
   
    Cursor<IndexColumnInfo> cursor = result.getCursor();
    List<ViewInfo> views = result.getViews();
   
    ViewInfo viewAct = views.get(0);
    String alias1 = viewAct.getAlias();
    Assert.assertEquals("e", alias1);
   
View Full Code Here

 
  @Test
  public void testInnerJoinPartsBackward() throws InterruptedException {
    NoSqlTypedSession s = mgr.getTypedSession();

    QueryResult result = s.createQueryCursor("select * FROM Activity as e WHERE e.numTimes < 15", 50);
   
    Cursor<IndexColumnInfo> cursor = result.getCursor();
    cursor.afterLast();
    List<ViewInfo> views = result.getViews();
   
    ViewInfo viewAct = views.get(0);
    String alias1 = viewAct.getAlias();
    Assert.assertEquals("e", alias1);
   
View Full Code Here

TOP

Related Classes of com.alvazan.orm.api.z3api.QueryResult

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.