SOL9 Sample: AccessADOXCatalogApplet

SOL9 2.0 Samples

1 Screenshot


2 Source code

/*
 * AccessADOXCatalogApplet.cpp 
 * Copyright (c) 2015 Antillia.com TOSHIYUKI ARAI. ALL RIGHTS RESERVED. 
 */


// SOL9
// 2009/06/03
// Assume that environment of Access2007

#include <sol/sql/ADOXApplet.h>

namespace SOL {

class AccessADOXCatalogApple: public ADOXApplet {

public:
  /**
   * Constructor
   */
  AccessADOXCatalogApple(int argc, const TCHAR** argv)
    :ADOXApplet(argc, argv)
  {
  }

public:
  ~AccessADOXCatalogApple()
  {
  }

public:
  /**
   * AccessADOXCatalogApplet main procedure
   */
  virtual void run()
  {
    printf("1 Start\n");

    ADOXCatalog& catalog = getCatalog();
    printf("2 OK, getCatalog()\n");

    printf("3 Show important connectionProperties\n");
    showConnectionProperties();
    printf("\n");

    try {
      printf("4 Try to catalog.getTables()\n");
      ADOXTables tables;
      catalog.getTables(tables);
      printf("5 OK catalog.getTables()\n");
  
      long c = tables.getCount();
      printf("Tables Count=%ld\n", c);

      printf("6 Try to catalog.getViews()\n");

      ADOXViews  views;
      catalog.getViews(views);
      printf("7 OK catalog.getViews()\n");

      c = views.getCount();
      printf("Views Count=%ld\n", c);


      printf("8 Try to catalog.getProcedures()\n");

      ADOXProcedures  procs;
      catalog.getProcedures(procs);
      printf("9 OK catalog.getProcedures()\n");

      c = procs.getCount();
      printf("Procedures Count=%ld\n", c);

      try {
        printf("11 Try to catalog.getUsers()\n");

        ADOXUsers  users;
        catalog.getUsers(users);
        printf("12 OK catalog.getUsers()\n");
        c = users.getCount();
        printf("Users Count=%ld\n", c);
      } catch (_com_error& ex) {
        COMError error(ex);
        error.dump();
      }

      try {
        printf("13 Try to catalog.getGroups()\n");

        ADOXGroups  groups;
        catalog.getGroups(groups);
        printf("14 OK catalog.getGroups()\n");
        c = groups.getCount();

        printf("Groups Count=%ld\n", c);
      } catch (_com_error& ex) {
        COMError error(ex);
        error.dump();
      }

    } catch (Exception& ex) {
      ex.dump();
    } catch (_com_error& ex) {
      COMError error(ex);
      error.dump();
    } catch (...) {
      printf("Exception: Unknown\n");
    }
  }
};

}

// Console application starts here.
void _tmain(int argc, const TCHAR** argv)
{
  try {
    AccessADOXCatalogApple applet(argc, argv);

    applet.start();

  } catch(Exception& ex){
    ex.dump();
  } catch(...){
    printf("Exception:Unknown\n");
  }
}


Last modified: 2 May 2016

Copyright (c) 2016 Antillia.com ALL RIGHTS RESERVED.