diff options
Diffstat (limited to 'libmsi/alter.c')
-rw-r--r-- | libmsi/alter.c | 35 |
1 files changed, 11 insertions, 24 deletions
diff --git a/libmsi/alter.c b/libmsi/alter.c index bd99dc2..c4ae96b 100644 --- a/libmsi/alter.c +++ b/libmsi/alter.c @@ -20,13 +20,8 @@ #include <stdarg.h> -#include "windef.h" -#include "winbase.h" -#include "winerror.h" #include "debug.h" #include "libmsi.h" -#include "objbase.h" -#include "objidl.h" #include "msipriv.h" #include "query.h" @@ -50,7 +45,7 @@ static unsigned alter_view_fetch_int( LibmsiView *view, unsigned row, unsigned c return LIBMSI_RESULT_FUNCTION_FAILED; } -static unsigned alter_view_fetch_stream( LibmsiView *view, unsigned row, unsigned col, IStream **stm) +static unsigned alter_view_fetch_stream( LibmsiView *view, unsigned row, unsigned col, GsfInput **stm) { LibmsiAlterView *av = (LibmsiAlterView*)view; @@ -74,18 +69,14 @@ static unsigned count_iter(LibmsiRecord *row, void *param) return LIBMSI_RESULT_SUCCESS; } -static bool check_column_exists(LibmsiDatabase *db, const WCHAR *table, const WCHAR *column) +static bool check_column_exists(LibmsiDatabase *db, const char *table, const char *column) { LibmsiQuery *view; LibmsiRecord *rec; unsigned r; - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - '`','_','C','o','l','u','m','n','s','`',' ','W','H','E','R','E',' ', - '`','T','a','b','l','e','`','=','\'','%','s','\'',' ','A','N','D',' ', - '`','N','a','m','e','`','=','\'','%','s','\'',0 - }; + static const char query[] = + "SELECT * FROM `_Columns` WHERE `Table`='%s' AND `Name`='%s'"; r = _libmsi_query_open(db, &view, query, table, column); if (r != LIBMSI_RESULT_SUCCESS) @@ -110,13 +101,9 @@ static unsigned alter_add_column(LibmsiAlterView *av) LibmsiQuery *view; LibmsiView *columns; - static const WCHAR szColumns[] = {'_','C','o','l','u','m','n','s',0}; - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - '`','_','C','o','l','u','m','n','s','`',' ','W','H','E','R','E',' ', - '`','T','a','b','l','e','`','=','\'','%','s','\'',' ','O','R','D','E','R',' ', - 'B','Y',' ','`','N','u','m','b','e','r','`',0 - }; + static const char szColumns[] = "_Columns"; + static const char query[] = + "SELECT * FROM `_Columns` WHERE `Table`='%s' ORDER BY `Number`"; r = table_view_create(av->db, szColumns, &columns); if (r != LIBMSI_RESULT_SUCCESS) @@ -187,8 +174,8 @@ static unsigned alter_view_get_dimensions( LibmsiView *view, unsigned *rows, uns return LIBMSI_RESULT_FUNCTION_FAILED; } -static unsigned alter_view_get_column_info( LibmsiView *view, unsigned n, const WCHAR **name, - unsigned *type, bool *temporary, const WCHAR **table_name ) +static unsigned alter_view_get_column_info( LibmsiView *view, unsigned n, const char **name, + unsigned *type, bool *temporary, const char **table_name ) { LibmsiAlterView *av = (LibmsiAlterView*)view; @@ -239,12 +226,12 @@ static const LibmsiViewOps alter_ops = NULL, }; -unsigned alter_view_create( LibmsiDatabase *db, LibmsiView **view, const WCHAR *name, column_info *colinfo, int hold ) +unsigned alter_view_create( LibmsiDatabase *db, LibmsiView **view, const char *name, column_info *colinfo, int hold ) { LibmsiAlterView *av; unsigned r; - TRACE("%p %p %s %d\n", view, colinfo, debugstr_w(name), hold ); + TRACE("%p %p %s %d\n", view, colinfo, debugstr_a(name), hold ); av = msi_alloc_zero( sizeof *av ); if( !av ) |