Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygendelete.c
Go to the documentation of this file.
00001 /* 00002 * Implementation of the Microsoft Installer (msi.dll) 00003 * 00004 * Copyright 2002-2005 Mike McCormack for CodeWeavers 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2.1 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public 00017 * License along with this library; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 00019 */ 00020 00021 #include <stdarg.h> 00022 00023 #include "windef.h" 00024 #include "winbase.h" 00025 #include "winerror.h" 00026 #include "wine/debug.h" 00027 #include "msi.h" 00028 #include "msiquery.h" 00029 #include "objbase.h" 00030 #include "objidl.h" 00031 #include "msipriv.h" 00032 #include "winnls.h" 00033 00034 #include "query.h" 00035 00036 WINE_DEFAULT_DEBUG_CHANNEL(msidb); 00037 00038 00039 /* 00040 * Code to delete rows from a table. 00041 * 00042 * We delete rows by blanking them out rather than trying to remove the row. 00043 * This appears to be what the native MSI does (or tries to do). For the query: 00044 * 00045 * delete from Property 00046 * 00047 * some non-zero entries are left in the table by native MSI. I'm not sure if 00048 * that's a bug in the way I'm running the query, or a just a bug. 00049 */ 00050 00051 typedef struct tagMSIDELETEVIEW 00052 { 00053 MSIVIEW view; 00054 MSIDATABASE *db; 00055 MSIVIEW *table; 00056 } MSIDELETEVIEW; 00057 00058 static UINT DELETE_fetch_int( struct tagMSIVIEW *view, UINT row, UINT col, UINT *val ) 00059 { 00060 MSIDELETEVIEW *dv = (MSIDELETEVIEW*)view; 00061 00062 TRACE("%p %d %d %p\n", dv, row, col, val ); 00063 00064 return ERROR_FUNCTION_FAILED; 00065 } 00066 00067 static UINT DELETE_fetch_stream( struct tagMSIVIEW *view, UINT row, UINT col, IStream **stm) 00068 { 00069 MSIDELETEVIEW *dv = (MSIDELETEVIEW*)view; 00070 00071 TRACE("%p %d %d %p\n", dv, row, col, stm ); 00072 00073 return ERROR_FUNCTION_FAILED; 00074 } 00075 00076 static UINT DELETE_execute( struct tagMSIVIEW *view, MSIRECORD *record ) 00077 { 00078 MSIDELETEVIEW *dv = (MSIDELETEVIEW*)view; 00079 UINT r, i, rows = 0, cols = 0; 00080 00081 TRACE("%p %p\n", dv, record); 00082 00083 if( !dv->table ) 00084 return ERROR_FUNCTION_FAILED; 00085 00086 r = dv->table->ops->execute( dv->table, record ); 00087 if( r != ERROR_SUCCESS ) 00088 return r; 00089 00090 r = dv->table->ops->get_dimensions( dv->table, &rows, &cols ); 00091 if( r != ERROR_SUCCESS ) 00092 return r; 00093 00094 TRACE("deleting %d rows\n", rows); 00095 00096 /* blank out all the rows that match */ 00097 for ( i=0; i<rows; i++ ) 00098 dv->table->ops->delete_row( dv->table, i ); 00099 00100 return ERROR_SUCCESS; 00101 } 00102 00103 static UINT DELETE_close( struct tagMSIVIEW *view ) 00104 { 00105 MSIDELETEVIEW *dv = (MSIDELETEVIEW*)view; 00106 00107 TRACE("%p\n", dv ); 00108 00109 if( !dv->table ) 00110 return ERROR_FUNCTION_FAILED; 00111 00112 return dv->table->ops->close( dv->table ); 00113 } 00114 00115 static UINT DELETE_get_dimensions( struct tagMSIVIEW *view, UINT *rows, UINT *cols ) 00116 { 00117 MSIDELETEVIEW *dv = (MSIDELETEVIEW*)view; 00118 00119 TRACE("%p %p %p\n", dv, rows, cols ); 00120 00121 if( !dv->table ) 00122 return ERROR_FUNCTION_FAILED; 00123 00124 *rows = 0; 00125 00126 return dv->table->ops->get_dimensions( dv->table, NULL, cols ); 00127 } 00128 00129 static UINT DELETE_get_column_info( struct tagMSIVIEW *view, UINT n, LPCWSTR *name, 00130 UINT *type, BOOL *temporary, LPCWSTR *table_name ) 00131 { 00132 MSIDELETEVIEW *dv = (MSIDELETEVIEW*)view; 00133 00134 TRACE("%p %d %p %p %p %p\n", dv, n, name, type, temporary, table_name ); 00135 00136 if( !dv->table ) 00137 return ERROR_FUNCTION_FAILED; 00138 00139 return dv->table->ops->get_column_info( dv->table, n, name, 00140 type, temporary, table_name); 00141 } 00142 00143 static UINT DELETE_modify( struct tagMSIVIEW *view, MSIMODIFY eModifyMode, 00144 MSIRECORD *rec, UINT row ) 00145 { 00146 MSIDELETEVIEW *dv = (MSIDELETEVIEW*)view; 00147 00148 TRACE("%p %d %p\n", dv, eModifyMode, rec ); 00149 00150 return ERROR_FUNCTION_FAILED; 00151 } 00152 00153 static UINT DELETE_delete( struct tagMSIVIEW *view ) 00154 { 00155 MSIDELETEVIEW *dv = (MSIDELETEVIEW*)view; 00156 00157 TRACE("%p\n", dv ); 00158 00159 if( dv->table ) 00160 dv->table->ops->delete( dv->table ); 00161 00162 msi_free( dv ); 00163 00164 return ERROR_SUCCESS; 00165 } 00166 00167 static UINT DELETE_find_matching_rows( struct tagMSIVIEW *view, UINT col, 00168 UINT val, UINT *row, MSIITERHANDLE *handle ) 00169 { 00170 TRACE("%p, %d, %u, %p\n", view, col, val, *handle); 00171 00172 return ERROR_FUNCTION_FAILED; 00173 } 00174 00175 00176 static const MSIVIEWOPS delete_ops = 00177 { 00178 DELETE_fetch_int, 00179 DELETE_fetch_stream, 00180 NULL, 00181 NULL, 00182 NULL, 00183 NULL, 00184 DELETE_execute, 00185 DELETE_close, 00186 DELETE_get_dimensions, 00187 DELETE_get_column_info, 00188 DELETE_modify, 00189 DELETE_delete, 00190 DELETE_find_matching_rows, 00191 NULL, 00192 NULL, 00193 NULL, 00194 NULL, 00195 NULL, 00196 NULL, 00197 }; 00198 00199 UINT DELETE_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table ) 00200 { 00201 MSIDELETEVIEW *dv = NULL; 00202 00203 TRACE("%p\n", dv ); 00204 00205 dv = msi_alloc_zero( sizeof *dv ); 00206 if( !dv ) 00207 return ERROR_FUNCTION_FAILED; 00208 00209 /* fill the structure */ 00210 dv->view.ops = &delete_ops; 00211 dv->db = db; 00212 dv->table = table; 00213 00214 *view = &dv->view; 00215 00216 return ERROR_SUCCESS; 00217 } Generated on Sun May 27 2012 04:16:59 for ReactOS by
1.7.6.1
|