| OLD | NEW | 
|---|
| 1 /** | 1 /** | 
| 2 * \file database.h MSI database | 2 * \file database.h MSI database | 
| 3 */ | 3 */ | 
| 4 | 4 | 
| 5 #include "database.h" | 5 #include "database.h" | 
| 6 #include "msiquery.h" | 6 #include "msiquery.h" | 
| 7 | 7 | 
| 8 //------------------------------------------------------------------------------
    ----------- | 8 //------------------------------------------------------------------------------
    ----------- | 
| 9 // Database | 9 // Database | 
| 10 //------------------------------------------------------------------------------
    ----------- | 10 //------------------------------------------------------------------------------
    ----------- | 
| 11 msi_handle Database::open_view( const wchar_t * query ) | 11 MsiHandle Database::OpenView( const wchar_t * query ) | 
| 12 { | 12 { | 
| 13   MSIHANDLE view_handle ; | 13   MSIHANDLE viewHandle ; | 
| 14   UINT x = MsiDatabaseOpenView( handle, query, & view_handle ) ; | 14   UINT x = MsiDatabaseOpenView( handle, query, & viewHandle ) ; | 
| 15   if ( x == ERROR_BAD_QUERY_SYNTAX ) | 15   if ( x == ERROR_BAD_QUERY_SYNTAX ) | 
| 16   { | 16   { | 
| 17     throw windows_api_error( "MsiDatabaseOpenView", "ERROR_BAD_QUERY_SYNTAX" ) ; | 17     throw WindowsApiError( "MsiDatabaseOpenView", "ERROR_BAD_QUERY_SYNTAX" ) ; | 
| 18   } | 18   } | 
| 19   else if ( x == ERROR_INVALID_HANDLE ) | 19   else if ( x == ERROR_INVALID_HANDLE ) | 
| 20   { | 20   { | 
| 21     throw windows_api_error( "MsiDatabaseOpenView", "ERROR_INVALID_HANDLE" ) ; | 21     throw WindowsApiError( "MsiDatabaseOpenView", "ERROR_INVALID_HANDLE" ) ; | 
| 22   } | 22   } | 
| 23   return msi_handle( view_handle ) ; | 23   return MsiHandle( viewHandle ) ; | 
| 24 } | 24 } | 
| 25 | 25 | 
| 26 //------------------------------------------------------------------------------
    ----------- | 26 //------------------------------------------------------------------------------
    ----------- | 
| 27 // InstallationDatabase | 27 // InstallationDatabase | 
| 28 //------------------------------------------------------------------------------
    ----------- | 28 //------------------------------------------------------------------------------
    ----------- | 
| 29 | 29 | 
| 30 /** | 30 /** | 
| 31 * Helper function for InstallationDatabase constructor. | 31 * Helper function for InstallationDatabase constructor. | 
| 32 * | 32 * | 
| 33 * \par Resource Allocator | 33 * \par Resource Allocator | 
| 34 *    Return value of this function, a handle, must be released in order to avoid
     a resource leak. | 34 *    Return value of this function, a handle, must be released in order to avoid
     a resource leak. | 
| 35 *    Passing it as an argument to the Database constructor is adequate. | 35 *    Passing it as an argument to the Database constructor is adequate. | 
| 36 */ | 36 */ | 
| 37 msi_handle get_active_database( ImmediateSession & session ) | 37 MsiHandle GetActiveDatabase( ImmediateSession & session ) | 
| 38 { | 38 { | 
| 39   MSIHANDLE h( MsiGetActiveDatabase( session.handle ) ) ; | 39   MSIHANDLE h( MsiGetActiveDatabase( session.handle ) ) ; | 
| 40   if ( h == 0 ) | 40   if ( h == 0 ) | 
| 41   { | 41   { | 
| 42     throw windows_api_error( "MsiGetActiveDatabase", 0 ) ; | 42     throw WindowsApiError( "MsiGetActiveDatabase", 0 ) ; | 
| 43   } | 43   } | 
| 44   return msi_handle( h ) ; | 44   return MsiHandle( h ) ; | 
| 45 } | 45 } | 
| 46 | 46 | 
| 47 /** | 47 /** | 
| 48 * \par Implementation Notes | 48 * \par Implementation Notes | 
| 49 *    The only thing this constructor needs to do is to initialize the base class
    . | 49 *    The only thing this constructor needs to do is to initialize the base class
    . | 
| 50 */ | 50 */ | 
| 51 InstallationDatabase::InstallationDatabase( ImmediateSession & session ) | 51 InstallationDatabase::InstallationDatabase( ImmediateSession & session ) | 
| 52   : Database( get_active_database( session ) ) | 52   : Database( GetActiveDatabase( session ) ) | 
| 53 { | 53 { | 
| 54   // empty body | 54   // empty body | 
| 55 } ; | 55 } ; | 
| 56 | 56 | 
| 57 //------------------------------------------------------------------------------
    ----------- | 57 //------------------------------------------------------------------------------
    ----------- | 
| 58 // View | 58 // View | 
| 59 //------------------------------------------------------------------------------
    ----------- | 59 //------------------------------------------------------------------------------
    ----------- | 
| 60 /** | 60 /** | 
| 61 * Implementation function for View::first(). | 61 * Implementation function for View::First(). | 
| 62 */ | 62 */ | 
| 63 void view_first_body( UINT x ) | 63 void ViewFirstBody( UINT x ) | 
| 64 { | 64 { | 
| 65   if ( x != ERROR_SUCCESS ) | 65   if ( x != ERROR_SUCCESS ) | 
| 66   { | 66   { | 
| 67     throw windows_api_error( "MsiViewExecute", x ) ; | 67     throw WindowsApiError( "MsiViewExecute", x ) ; | 
| 68   } | 68   } | 
| 69 } | 69 } | 
| 70 | 70 | 
| 71 Record View::first() | 71 Record View::First() | 
| 72 { | 72 { | 
| 73   view_first_body( MsiViewExecute( _handle, 0 ) ) ; | 73   ViewFirstBody( MsiViewExecute( handle, 0 ) ) ; | 
| 74   return next() ; | 74   return Next() ; | 
| 75 } | 75 } | 
| 76 | 76 | 
| 77 Record View::first( Record & arguments ) | 77 Record View::First( Record & arguments ) | 
| 78 { | 78 { | 
| 79   view_first_body( MsiViewExecute( _handle, arguments._handle ) ) ; | 79   ViewFirstBody( MsiViewExecute( handle, arguments.handle ) ) ; | 
| 80   return next() ; | 80   return Next() ; | 
| 81 } | 81 } | 
| 82 | 82 | 
| 83 Record View::next() | 83 Record View::Next() | 
| 84 { | 84 { | 
| 85   MSIHANDLE h ; | 85   MSIHANDLE h ; | 
| 86   UINT x = MsiViewFetch( _handle, & h ) ; | 86   UINT x = MsiViewFetch( handle, & h ) ; | 
| 87   if ( x == ERROR_NO_MORE_ITEMS ) | 87   if ( x == ERROR_NO_MORE_ITEMS ) | 
| 88   { | 88   { | 
| 89     return Record( Record::null_t() ) ; | 89     return Record( Record::NullType() ) ; | 
| 90   } | 90   } | 
| 91   else if ( x == ERROR_SUCCESS ) | 91   else if ( x == ERROR_SUCCESS ) | 
| 92   { | 92   { | 
| 93     return Record( msi_handle( h ) ) ; | 93     return Record( MsiHandle( h ) ) ; | 
| 94   } | 94   } | 
| 95   throw windows_api_error( "MsiViewFetch", x ) ; | 95   throw WindowsApiError( "MsiViewFetch", x ) ; | 
| 96 } | 96 } | 
| 97 | 97 | 
| OLD | NEW | 
|---|