home *** CD-ROM | disk | FTP | other *** search
- Save Format v1.3
- @begin ClassFile "ODBCAdmin"
- Exported 0;
-
- @begin-code BaseClassList
-
- public WObject
-
- @end-code;
-
- @begin UserFunction "ODBCAdmin()"
- GencodeSrcLine 15;
- FunctionName "ODBCAdmin::ODBCAdmin()";
- @end;
-
- @begin UserFunction "Prototype for ODBCAdmin()"
- Private 1;
- GencodeSrcLine 26;
- FunctionName "ODBCAdmin::Prototype for ODBCAdmin()";
- @end;
-
- @begin UserFunction "~ODBCAdmin()"
- GencodeSrcLine 19;
- FunctionName "ODBCAdmin::~ODBCAdmin()";
- @end;
-
- @begin UserFunction "Prototype for ~ODBCAdmin()"
- Private 1;
- GencodeSrcLine 28;
- FunctionName "ODBCAdmin::Prototype for ~ODBCAdmin()";
- @end;
-
- @begin UserFunction "DriverExists( const WString& , WString& )"
- GencodeSrcLine 23;
- FunctionName "ODBCAdmin::DriverExists( const WString& , WString& )";
- @end;
-
- @begin UserFunction "Prototype for DriverExists( const WString& , WString& )"
- Private 1;
- GencodeSrcLine 30;
- FunctionName "ODBCAdmin::Prototype for DriverExists( const WString& , WString& )";
- @end;
-
- @begin UserFunction "AddDataSource( const WString &ds_name, const WString &driver_name, const WStringArray &keys )"
- @end;
-
- @begin UserFunction "Prototype for AddDataSource( const WString &ds_name, const WString &driver_name, const WStringArray &keys )"
- Private 1;
- GencodeSrcLine 32;
- FunctionName "ODBCAdmin::Prototype for AddDataSource( const WString &ds_name, const WString &driver_name, const WStringArray &keys )";
- @end;
-
- @begin HPPPrefixBlock
- @begin-code HPPPrefix
-
- // Declarations added here will be included at the top of the .HPP file
-
- @end-code;
- GencodeSrcLine 11;
- @end;
-
- @begin CPPPrefixBlock
- @begin-code CPPPrefix
-
- // Code added here will be included at the top of the .CPP file
-
- // Include definitions for resources.
- #include "WRes.h"
-
- @end-code;
- GencodeSrcLine 11;
- @end;
-
- @begin ClassContentsBlock
- @begin-code ClassContents
-
-
- public:
- static WBool DriverExists( const WString &driver, WString &driver_dll );
- public:
- static WBool AddDataSource( const WString &ds_name, const WString &driver_name, const WStringArray &keys );
-
- private:
- // add your private instance data here
- protected:
- // add your protected instance data here
-
- @end-code;
- GencodeSrcLine 16;
- @end;
-
- @begin-code GeneratedClassContents
-
-
- @end-code;
-
- @begin-code Code "ODBCAdmin::ODBCAdmin()"
-
- ODBCAdmin::ODBCAdmin()
- {
-
- }
-
- @end-code;
-
- @begin-code Code "ODBCAdmin::Prototype for ODBCAdmin()"
-
- public:
- ODBCAdmin();
-
- @end-code;
-
- @begin-code Code "ODBCAdmin::~ODBCAdmin()"
-
- ODBCAdmin::~ODBCAdmin()
- {
-
- }
-
- @end-code;
-
- @begin-code Code "ODBCAdmin::Prototype for ~ODBCAdmin()"
-
- public:
- ~ODBCAdmin();
-
- @end-code;
-
- @begin-code Code "ODBCAdmin::DriverExists( const WString& , WString& )"
-
- static WBool ODBCAdmin::DriverExists( const WString& driver, WString& driver_dll)
- {
- WRegistryKey registry;
- WString key;
-
- key.Clear();
- key.Sprintf( "Software\\ODBC\\ODBCINST.INI\\%s", driver.GetText() );
- if( registry.Open( WRKeyLocalMachine, key ) ) {
- driver_dll = registry.GetStringValue( "Driver" );
- registry.Close();
- if( !driver_dll.GetNull() ) {
- return( TRUE );
- }
- }
-
- return( FALSE );
- }
-
- static WBool ODBCAdmin::AddDataSource( const WString &ds_name, const WString &driver_name, const WStringArray &keys )
- {
- WRegistryKey registry;
- WString key;
- int i;
-
- key = "Software\\ODBC\\ODBC.INI\\ODBC Data Sources";
- if( registry.Open( WRKeyCurrentUser, key ) ) {
- if( registry.HasValue( ds_name, WRegDataString ) ) {
- return( TRUE );
- }
- } else {
- return( FALSE );
- }
-
- registry.SetStringValue( ds_name, driver_name );
- registry.Close();
-
- key.Sprintf( "Software\\ODBC\\ODBC.INI\\%s", ds_name.GetText() );
- if( registry.Create( WRKeyCurrentUser, key ) ) {
- for( i = 0; i * 2 < keys.GetCount(); ++i ) {
- registry.SetStringValue( keys[i * 2], keys[i * 2 + 1] );
- }
- }
- registry.Close();
-
- return( TRUE );
- }
-
- @end-code;
-
- @begin-code Code "ODBCAdmin::Prototype for DriverExists( const WString& , WString& )"
-
- public:
- static WBool DriverExists( const WString& , WString& );
-
- @end-code;
-
- @begin-code Code "ODBCAdmin::AddDataSource( const WString &ds_name, const WString &driver_name, const WStringArray &keys )"
-
-
- @end-code;
-
- @begin-code Code "ODBCAdmin::Prototype for AddDataSource( const WString &ds_name, const WString &driver_name, const WStringArray &keys )"
-
- public:
- static WBool AddDataSource( const WString &ds_name, const WString &driver_name, const WStringArray &keys );
-
- @end-code;
- @end;
-