SOL9 Sample: ADOXTablesApplet
|
1 Screenshot
2 Source code
/*
* ADOXTablesApplet.cpp
* Copyright (c) 2015 Antillia.com TOSHIYUKI ARAI. ALL RIGHTS RESERVED.
*/
// SOL9
// 2009/06/03
// Assumes that environment of SQL Server 2008 and SQLClient1.0 or Access2007
#include <sol/sql/ADOXApplet.h>
#include <sol/Locale.h>
namespace SOL {
class ADOXTablesApplet: public ADOXApplet {
public:
/**
* Constructor
*/
ADOXTablesApplet(int argc, const TCHAR** argv)
:ADOXApplet(argc, argv)
{
}
public:
~ADOXTablesApplet()
{
}
public:
/**
* ADOXTablesApplet main procedure
*/
virtual void run()
{
String encoding = "";
getXMLEncoding(encoding);
_tprintf(_T("<?xml version=\"1.0\" encoding=\"%s\" ?>\n"), (const TCHAR*)encoding);
_tprintf(_T("<!-- \n"));
_tprintf(_T("1 Start\n"));
try {
ADOXCatalog& catalog = getCatalog();
ADOConnectionProperties& props = getConnectionProperties();
String initialCatalog = "";
props.getInitialCatalog(initialCatalog);
_tprintf(_T("2 OK, opened a catalog %s\n"), (const TCHAR*)initialCatalog);
_tprintf(_T("3 Try to catalog.getTables()\n"));
ADOXTables tables;
catalog.getTables(tables);
_tprintf(_T("4 OK catalog.getTables()\n"));
long l = tables.getCount();
_tprintf(_T("Tables Count=%ld\n"), l);
_tprintf(_T("-->\n"));
tables.dump();
_tprintf(_T("<!-- Initial Catalog=%s; Dumped tables count=%ld -->\n"),
(const TCHAR*)initialCatalog, l);
} catch (Exception& ex) {
ex.dump();
} catch (_com_error& ex) {
COMError error(ex);
error.dump();
} catch (...) {
_tprintf(_T("Exception: Unknown\n"));
}
}
};
}
// Console application starts here.
void _tmain(int argc, const TCHAR** argv)
{
Locale locale;
try {
ADOXTablesApplet applet(argc, argv);
applet.start();
} catch(Exception& ex){
ex.dump();
} catch(...){
_tprintf(_T("Exception:Unknown\n"));
}
}
Last modified: 2 May 2016
Copyright (c) 2016 Antillia.com ALL RIGHTS RESERVED.