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 msi_handle Database::open_view( const wchar_t * query ) |
12 { | 12 { |
13 MSIHANDLE view_handle ; | 13 MSIHANDLE view_handle ; |
14 UINT x = MsiDatabaseOpenView( handle, query, & view_handle ) ; | 14 UINT x = MsiDatabaseOpenView( handle, query, & view_handle ) ; |
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 windows_api_error( "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 windows_api_error( "MsiDatabaseOpenView", "ERROR_INVALID_HANDLE" ) ; |
22 } | 22 } |
23 return msi_handle( view_handle ) ; | 23 return msi_handle( view_handle ) ; |
24 } | 24 } |
25 | 25 |
26 //------------------------------------------------------------------------------
----------- | 26 //------------------------------------------------------------------------------
----------- |
27 // Installation_Database | 27 // InstallationDatabase |
28 //------------------------------------------------------------------------------
----------- | 28 //------------------------------------------------------------------------------
----------- |
29 | 29 |
30 /** | 30 /** |
31 * Helper function for Installation_Database 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( Immediate_Session & session ) | 37 msi_handle get_active_database( 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 windows_api_error( "MsiGetActiveDatabase", 0 ) ; |
43 } | 43 } |
44 return msi_handle( h ) ; | 44 return msi_handle( 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 Installation_Database::Installation_Database( Immediate_Session & session ) | 51 InstallationDatabase::InstallationDatabase( ImmediateSession & session ) |
52 : Database( get_active_database( session ) ) | 52 : Database( get_active_database( 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(). |
(...skipping 26 matching lines...) Expand all Loading... |
88 { | 88 { |
89 return Record( Record::null_t() ) ; | 89 return Record( Record::null_t() ) ; |
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( msi_handle( h ) ) ; |
94 } | 94 } |
95 throw windows_api_error( "MsiViewFetch", x ) ; | 95 throw windows_api_error( "MsiViewFetch", x ) ; |
96 } | 96 } |
97 | 97 |
OLD | NEW |