/* test_db.C */
/* test ap database stuff */

#include <cstdio>
#include <cstdlib>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <algorithm>

#include "parse.h"
#include "xml_util.h"
#include "db_table.h"
#include "ap_schema.h"

int main(int argc, char *argv[]) {
  tape t;
  workunit w;

  // Make up phony values.
  strcpy(t.name, "name!");
  t.start_time = 123.45;
  t.last_block_time = 555.666;
  t.last_block_done = 23;
  t.wu_count = 10;
  t.id = 0;

  
  // insert
  if (!t.insert()) {
    printf("ap_tape.insert() failed\n");
    exit(1);
  }

  // read out values...
  if (t.open_query()) {
    while (t.get_next()) {
      std::cout << t;
    }
  }
  t.close_query();

  printf("\n");

  if (w.open_query()) {
    while (w.get_next()) {
      std::cout << w;
    }
  }
}
