SOL9 Sample: ADOXCatalogWithPasswordApplet
|
1 Screenshot
2 Source code
/*
* ADOXCatalogWithPasswordApplet.cpp
* Copyright (c) 2015 Antillia.com TOSHIYUKI ARAI. ALL RIGHTS RESERVED.
*/
// SOL9
// 2009/06/03
// Assume that environment of SQL Server 2008
#include <sol/sql/ADOXApplet.h>
#include <sol/Locale.h>
namespace SOL {
class ADOXCatalogWithPasswordApplet: public ADOXApplet {
public:
/**
* Constructor
*/
ADOXCatalogWithPasswordApplet(int argc, const TCHAR** argv)
:ADOXApplet(argc, argv)
{
}
public:
~ADOXCatalogWithPasswordApplet()
{
}
public:
/**
* ADOXTablesApplet 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);
//tables.dump();
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)
{
Locale locale;
try {
ADOXCatalogWithPasswordApplet 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.