Click here to Skip to main content
15,886,518 members
Articles / Desktop Programming / MFC

The Win32 Foundation Classes (WFC) - Version 45

Rate me:
Please Sign up or sign in to vote.
4.93/5 (40 votes)
16 May 2000 468.2K   12.7K   280  
The Win32 Foundation Classes (WFC) are a library of C++ classes that extend Microsoft Foundation Classes (MFC) beyond mere GUI applications, and provide extensive support for system and NT specific applications
#include "ado2xml.h"
#pragma hdrstop

/*
** Author: Samuel R. Blackburn
** Internet: wfc@pobox.com
**
** You can use it any way you like as long as you don't try to sell it.
**
** Any attempt to sell WFC in source code form must have the permission
** of the original author. You can produce commercial executables with
** WFC but you can't sell WFC.
**
** Copyright, 2000, Samuel R. Blackburn
**
** $Workfile: convert_desired_tables.cpp $
** $Revision: 2 $
** $Modtime: 3/21/00 4:25a $
** $Reuse Tracing Code: 1 $
*/

#if ! defined( WFC_STL )

#if defined( _DEBUG )
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#define new DEBUG_NEW
#endif // _DEBUG

#endif // WFC_STL

void convert_desired_tables( const CExtensibleMarkupLanguageElement * settings, const CDatabaseParameters& database_parameters )
{
   WFCTRACEINIT( TEXT( "convert_desired_tables()" ) );

   _ConnectionPtr connection_p = NULL;

   if ( open_connection_to_database( database_parameters, connection_p ) == false )
   {
      WFCTRACE( TEXT( "Can't open connection to database." ) );
      _tprintf( TEXT( "Can't open connection to database.\n" ) );
      return;
   }

   // Get the names of the tables in that database

   CStringArray table_names;

	if ( get_table_names( connection_p, table_names ) == false )
	{
      WFCTRACE( TEXT( "Can't get table names." ) );
      _tprintf( TEXT( "Can't get table names.\n" ) );
	   return;
	}

   WFCTRACEVAL( TEXT( "Number of tables " ), table_names.GetSize() );

   //CString desired_table_name( TEXT( "Categories" ) );
   CString desired_table_name;

   if ( table_names.GetSize() > 0 )
   {
      int loop_index = 0;

      CString table_name;
      CString where_clause; // Get this from the XML configuration data

      while( loop_index < table_names.GetSize() )
      {
         table_name = table_names.GetAt( loop_index );

         WFCTRACEVAL( TEXT( "Table " ), table_name );

         if (  desired_table_name.GetLength() == 0 ||
               desired_table_name.Compare( table_name ) == 0 )
         {
            convert_table( connection_p, table_name, where_clause );
         }

         loop_index++;
      }
   }

   try
   {
      connection_p->Close();
   }
   catch( _com_error &exception )
   {
      WFCTRACEVAL( TEXT( "COM exception caught at line " ), __LINE__ );
      print_COM_error( exception );
   }
   catch( ... )
   {
      WFCTRACEVAL( TEXT( "Exception caught at line " ), __LINE__ );
   }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
United States United States
I'm just a simple little NT programmer. Most of the work I do is remote controlling equipment in real time. I started out using Windows 3.0. Then came 3.1 and then NT. I started using NT but unfortunately, Microsoft didn't. I started using MFC but unfortunately, Microsoft didn't (and still doesn't) put any real support for NT into MFC so I wrote a bunch of C++ classes to make my life easier. Like all class libraries, mine grew. Now I'm giving it away, I call it Win32 Foundation Classes.

Check out Sam's homepage at www.SamBlackburn.com/wfc/.

Comments and Discussions