public void testStatistics_Initiator() throws Exception {
   Client client = getClient();
   VoltTable results[] = null;
   results = client.callProcedure("@Statistics", "INITIATOR", 0).getResults();
   results = client.callProcedure("@Statistics", "INITIATOR", 0).getResults();
   // one aggregate table returned
   assertTrue(results.length == 1);
   System.out.println("Test initiators table: " + results[0].toString());
   assertEquals(1, results[0].getRowCount());
   VoltTableRow resultRow = results[0].fetchRow(0);
   assertNotNull(resultRow);
   assertEquals("@Statistics", resultRow.getString("PROCEDURE_NAME"));
   assertEquals(1, resultRow.getLong("INVOCATIONS"));
 }
Ejemplo n.º 2
0
  /**
   * Queries all the tables present in default database and load them into 'tables' map.
   *
   * @param theTables the tables
   */
  @Override
  protected void openInternal(final Map<Base36, VoltDBTable> theTables) {

    theTables.clear();
    final VoltTable[] results;
    try {
      results = backend.client().callProcedure("@SystemCatalog", "TABLES").getResults();
      for (final VoltTable node : results) {
        int count = 0;
        while (node.advanceRow()) {
          final VoltTableRow row = node.fetchRow(count++);
          final String tName = row.getString("TABLE_NAME");
          theTables.put(Base36.get(tName.toLowerCase()), new VoltDBTable(this, tName));
        }
      }
    } catch (final Exception e) {
      throw new DBException("Error Opening Database: " + theTables, e);
    }
  }