Exemplo n.º 1
0
static int
doall()
{
  int ret = 0;
  do
  {
    CHK2(doconnect() == 0, "connect to NDB");

    int loop = 0;
    while (++loop <= _loops)
    {
      g_info << "loop " << loop << " of " << _loops << endl;
      if (!_sys_any)
      {
        if (loop == 1)
        {
          CHK1(checkobjs() == 0);
        }
        CHK2(dostats() == 0, "at loop " << loop);
      }
      else
      {
        CHK2(dosys() == 0, "at loop " << loop);
      }
    }
    CHK1(ret == 0);
  }
  while (0);

  dodisconnect();
  return ret;
}
Exemplo n.º 2
0
static int
doall()
{
  int ret = 0;
  do
  {
    if (opt_dump_file)
    {
      g_dump_file = fopen(opt_dump_file, "w");
      CHK2(g_dump_file != 0, opt_dump_file << ": " << strerror(errno));
      g_dump_out = new FileOutputStream(g_dump_file);
      new (&g_dump) NdbOut(*g_dump_out);

      const char* action = 0;
      if (opt_check_orphans)
        action = "check";
      if (opt_delete_orphans)
        action = "delete";

      g_dump << "table: " << g_tabname << endl;
      g_dump << "action: " << action << endl;
    }
    CHK1(doconnect() == 0);
    CHK1(getobjs() == 0);
    if (g_blobcount == 0)
    {
      g_err << g_tabname << ": no blob columns" << endl;
      break;
    }
    CHK1(doorphans() == 0);
  }
  while (0);

  dodisconnect();
  if (g_dump_file != 0)
  {
    g_dump << "result: "<< (ret == 0 ? "ok" : "failed") << endl;
    flush(g_dump);
    if (fclose(g_dump_file) != 0)
    {
      g_err << opt_dump_file << ": write failed: " << strerror(errno) << endl;
    }
    g_dump_file = 0;
  }
  return ret;
}