Esempio n. 1
0
  @Test
  public void test() throws Exception {
    Logger.getLogger("com.almworks.sqlite4java").setLevel(Level.SEVERE);
    final RelationKey tuplesKey = RelationKey.of("test", "test", "my_tuples");

    final TupleSource source = new TupleSource(data);
    final DbInsert insert =
        new DbInsert(source, tuplesKey, SQLiteInfo.of(tempFile.getAbsolutePath()));
    insert.open(null);
    while (!insert.eos()) {
      insert.nextReady();
    }
    insert.close();

    final SQLiteConnection sqliteConnection = new SQLiteConnection(tempFile);
    sqliteConnection.open(false);
    final SQLiteStatement statement =
        sqliteConnection.prepare(
            "SELECT COUNT(*) FROM "
                + tuplesKey.toString(MyriaConstants.STORAGE_SYSTEM_SQLITE)
                + ";");
    assertTrue(statement.step());
    final int inserted = statement.columnInt(0);
    assertEquals(NUM_TUPLES, inserted);
    sqliteConnection.dispose();
  }