Package com.splout.db.engine

Examples of com.splout.db.engine.SQLite4JavaClient.query()


    for(int i = 0; i < N_DNODES; i++) {
      File dbData = new File(deployData, i + ".db");
      SQLite4JavaClient manager = new SQLite4JavaClient(dbData + "", null);
      // We create a foo database with one integer and one text
      manager.query("CREATE TABLE foo (intCol INT, strCol TEXT);", 100);
      // We insert as many values as the ones we defined in the partition map
      for(int j = i * 10; j < (i * 10 + 10); j++) {
        manager.query("INSERT INTO foo VALUES (" + j + ", " + "'" + randomStr + "');", 100);
      }
      manager.close();
View Full Code Here


      SQLite4JavaClient manager = new SQLite4JavaClient(dbData + "", null);
      // We create a foo database with one integer and one text
      manager.query("CREATE TABLE foo (intCol INT, strCol TEXT);", 100);
      // We insert as many values as the ones we defined in the partition map
      for(int j = i * 10; j < (i * 10 + 10); j++) {
        manager.query("INSERT INTO foo VALUES (" + j + ", " + "'" + randomStr + "');", 100);
      }
      manager.close();
    }

    SploutConfiguration config = SploutConfiguration.getTestConfig();
View Full Code Here

    List<String> jsonGeoData = new ArrayList<String>();
   
    for(int i = 0; i < 3; i++) {
      SQLite4JavaClient manager = new SQLite4JavaClient(TEST_OUTPUT + "/store/" + i + ".db", null);
      List list;
      list = JSONSerDe.deSer(manager.query("SELECT * FROM payments;", 100), ArrayList.class);
      totalPayments.addAll(list);
      System.out.println(list);
      assertEquals(1, list.size()); // There is one payment per each person
      list = JSONSerDe.deSer(manager.query("SELECT * FROM logs;", 100), ArrayList.class);
      totalLogs.addAll(list);
View Full Code Here

      List list;
      list = JSONSerDe.deSer(manager.query("SELECT * FROM payments;", 100), ArrayList.class);
      totalPayments.addAll(list);
      System.out.println(list);
      assertEquals(1, list.size()); // There is one payment per each person
      list = JSONSerDe.deSer(manager.query("SELECT * FROM logs;", 100), ArrayList.class);
      totalLogs.addAll(list);
      assertEquals(2, list.size()); // There are two log events per each person
      String geoDataStr = manager.query("SELECT * FROM geodata;", 100);
      jsonGeoData.add(geoDataStr);
      list = JSONSerDe.deSer(geoDataStr, ArrayList.class);
View Full Code Here

      System.out.println(list);
      assertEquals(1, list.size()); // There is one payment per each person
      list = JSONSerDe.deSer(manager.query("SELECT * FROM logs;", 100), ArrayList.class);
      totalLogs.addAll(list);
      assertEquals(2, list.size()); // There are two log events per each person
      String geoDataStr = manager.query("SELECT * FROM geodata;", 100);
      jsonGeoData.add(geoDataStr);
      list = JSONSerDe.deSer(geoDataStr, ArrayList.class);
      assertEquals(3, list.size()); // There are 3 countries in the replicated geo data file
      manager.close();
    }
View Full Code Here

    List distinctKeys = new ArrayList();
   
    for(int i = 0; i < 3; i++) {
      SQLite4JavaClient manager = new SQLite4JavaClient(TEST_OUTPUT + "/store/" + i + ".db", null);
      List list;
      list = JSONSerDe.deSer(manager.query("SELECT * FROM payments;", 100), ArrayList.class);
      totalPayments.addAll(list);
      Set<String> uniqueKeysInPartition = new HashSet<String>();
      for(Object obj: list) {
        uniqueKeysInPartition.add(((Map)obj).get("name") + "" + ((Map)obj).get("commerce"));
      }
View Full Code Here

      Set<String> uniqueKeysInPartition = new HashSet<String>();
      for(Object obj: list) {
        uniqueKeysInPartition.add(((Map)obj).get("name") + "" + ((Map)obj).get("commerce"));
      }
      distinctKeys.addAll(uniqueKeysInPartition);
      list = JSONSerDe.deSer(manager.query("SELECT * FROM logs;", 100), ArrayList.class);
      totalLogs.addAll(list);
      manager.close();
    }

    String keys = StringUtils.join(distinctKeys.toArray(), ", ");
View Full Code Here

    // Assert that the DB has been created successfully
   
    assertTrue(new File(OUTPUT + "/0.db").exists());
    SQLite4JavaClient manager = new SQLite4JavaClient(OUTPUT + "/0.db", null);
    @SuppressWarnings("rawtypes")
    List list = JSONSerDe.deSer(manager.query("SELECT * FROM schema1;", 100), ArrayList.class);
    assertEquals(6, list.size());
   
    manager.close();
  }
}
View Full Code Here

    for(int i = 0; i < N_DNODES; i++) {
      File dbData = new File(deployData, i + ".db");
      SQLite4JavaClient manager = new SQLite4JavaClient(dbData + "", null);
      // We create a foo database with one integer and one text
      manager.query("CREATE TABLE " + TABLE + " (iteration INT, dnode INT);", 100);
      // We insert as many values as the ones we defined in the partition map
      manager.query("INSERT INTO " + TABLE + " VALUES (" + iteration + ", " + i + ");", 100);
      manager.close();
    }
View Full Code Here

      File dbData = new File(deployData, i + ".db");
      SQLite4JavaClient manager = new SQLite4JavaClient(dbData + "", null);
      // We create a foo database with one integer and one text
      manager.query("CREATE TABLE " + TABLE + " (iteration INT, dnode INT);", 100);
      // We insert as many values as the ones we defined in the partition map
      manager.query("INSERT INTO " + TABLE + " VALUES (" + iteration + ", " + i + ");", 100);
      manager.close();
    }

    log.info("Deploying deploy iteration [" + iteration + "]");
    client.deploy(TABLESPACE, testTablespace.getPartitionMap(), testTablespace.getReplicationMap(),
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.