CATALOG2: ODBC Data Source Schema Browser

Click to open or copy the CATALOG2 project files.

The CATALOG2 sample program is an ODBC data source schema browser. In response to selecting a data source, it shows all the tables in that data source. You can then select a table and it will show all the columns in that table, along with information about them. There is also a settings property sheet that gives you some control over the types of tables that are included in the display as well as what column information is displayed.

CATALOG2 primarily demonstrates how to wrap the ODBC API catalog functions in CRecordset objects. Although it doesn't use them all, CATALOG2 includes a header and .cpp file that does this for all the ODBC API catalog functions. Those functions are:

  SQLColumnPrivileges
SQLColumns
SQLForeignKeys
SQLGetTypeInfo
SQLPrimaryKeys
SQLProcedureColumns
SQLProcedures
SQLSpecialColumns
SQLStatistics
SQLTablePrivileges
SQLTables

CATALOG2 also shows how to use a CListView as an application's main view, and how to make properties persistent across program invocations by saving them in the application's initialization file.

This sample demonstrates the following keywords:

AfxGetApp; CControlBar::EnableDocking; CControlBar::GetBarStyle; CControlBar::SetBarStyle; CDatabase::Close; CDatabase::IsOpen; CDatabase::Open; CDialog::DoModal; CDocument::OnCloseDocument; CDocument::OnNewDocument; CDocument::OnOpenDocument; CDocument::SetTitle; CDocument::UpdateAllViews; CFrameWnd::DockControlBar; CFrameWnd::EnableDocking; CObject::AssertValid; CObject::Dump; CObject::Serialize; CRecordset::Close; CRecordset::DoFieldExchange; CRecordset::GetDefaultConnect; CRecordset::GetDefaultSQL; CRecordset::IsEOF; CRecordset::IsFieldNull; CRecordset::IsOpen; CRecordset::MoveFirst; CRecordset::MoveNext; CRecordset::OnSetOptions; CRecordset::Open; CStatusBar::Create; CStatusBar::SetIndicators; CString::Find; CString::Format; CString::GetLength; CString::Left; CString::Right; CToolBar::Create; CWinApp::Enable3dControls; CWinApp::InitInstance; CWinApp::LoadStdProfileSettings; CWnd::DoDataExchange; CWnd::OnCreate; CWnd::PreCreateWindow; GetProfileInt; WideCharToMultiByte; strcat; strcpy