SOL9 Sample: ADOXProceduresApplet
|
1 Screenshot
2 Source code
/*
* ADOXProceduresApplet.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
#include <sol/sql/ADOXApplet.h>
#include <sol/Locale.h>
namespace SOL {
class ADOXProceduresApplet: public ADOXApplet {
public:
/**
* Constructor
*/
ADOXProceduresApplet(int argc, const TCHAR** argv)
:ADOXApplet(argc, argv)
{
}
public:
~ADOXProceduresApplet()
{
}
public:
/**
* ADOXProceduresApplet 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"));
ADOXProcedures procedures;
catalog.getProcedures(procedures);
_tprintf(_T("4 OK catalog.getProcedures()\n"));
long l = procedures.getCount();
_tprintf(_T("Procedures Count=%ld\n"), l);
_tprintf(_T("-->\n"));
procedures.dump();
_tprintf(_T("<!-- Initial Catalog=%s; Dumped procedures 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 {
ADOXProceduresApplet 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.