diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2012-11-30 12:29:58 +0100 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2012-12-06 20:30:31 +0100 |
commit | 4f02eb34cb85a498aebf0b148a9c1e36ebe081c9 (patch) | |
tree | c27d335d9c228fb05054efe4b376c0aa5380c787 /libmsi | |
parent | 1ece2a5f8a187d4493c96aff3a1ad64eeb497bcb (diff) | |
download | msitools-4f02eb34cb85a498aebf0b148a9c1e36ebe081c9.tar.gz msitools-4f02eb34cb85a498aebf0b148a9c1e36ebe081c9.tar.xz msitools-4f02eb34cb85a498aebf0b148a9c1e36ebe081c9.zip |
abandon camelcase
Diffstat (limited to 'libmsi')
-rw-r--r-- | libmsi/Makefile.am | 4 | ||||
-rw-r--r-- | libmsi/alter.c | 60 | ||||
-rw-r--r-- | libmsi/create.c | 32 | ||||
-rw-r--r-- | libmsi/database.c | 172 | ||||
-rw-r--r-- | libmsi/delete.c | 40 | ||||
-rw-r--r-- | libmsi/distinct.c | 36 | ||||
-rw-r--r-- | libmsi/drop.c | 22 | ||||
-rw-r--r-- | libmsi/handle.c | 4 | ||||
-rw-r--r-- | libmsi/insert.c | 56 | ||||
-rw-r--r-- | libmsi/msipriv.h | 72 | ||||
-rw-r--r-- | libmsi/msiquery.c | 124 | ||||
-rw-r--r-- | libmsi/query.h | 30 | ||||
-rw-r--r-- | libmsi/record.c | 106 | ||||
-rw-r--r-- | libmsi/select.c | 78 | ||||
-rw-r--r-- | libmsi/sql-parser.y | 112 | ||||
-rw-r--r-- | libmsi/storages.c | 76 | ||||
-rw-r--r-- | libmsi/streams.c | 112 | ||||
-rw-r--r-- | libmsi/string.c | 20 | ||||
-rw-r--r-- | libmsi/suminfo.c | 24 | ||||
-rw-r--r-- | libmsi/table.c | 352 | ||||
-rw-r--r-- | libmsi/tokenize.c | 10 | ||||
-rw-r--r-- | libmsi/update.c | 48 | ||||
-rw-r--r-- | libmsi/where.c | 120 |
23 files changed, 856 insertions, 854 deletions
diff --git a/libmsi/Makefile.am b/libmsi/Makefile.am index e6d51b9..32562d7 100644 --- a/libmsi/Makefile.am +++ b/libmsi/Makefile.am @@ -21,7 +21,9 @@ libmsi_la_SOURCES = alter.c create.c database.c delete.c distinct.c \ msiserver_i.c \ utf16/snprintfW.c utf16/sprintfW.c utf16/strtolW.c -libmsi_la_LDFLAGS = -no-undefined +libmsi_la_LDFLAGS = -no-undefined -rpath $(libdir) \ + -export-symbols-regex='^libmsi_' + libmsi_la_LIBADD = \ $(libmsi_la_DEPENDENCIES) \ -lshlwapi \ diff --git a/libmsi/alter.c b/libmsi/alter.c index 4b8fcf9..8281b9e 100644 --- a/libmsi/alter.c +++ b/libmsi/alter.c @@ -41,7 +41,7 @@ typedef struct LibmsiAlterView int hold; } LibmsiAlterView; -static unsigned ALTER_fetch_int( LibmsiView *view, unsigned row, unsigned col, unsigned *val ) +static unsigned alter_view_fetch_int( LibmsiView *view, unsigned row, unsigned col, unsigned *val ) { LibmsiAlterView *av = (LibmsiAlterView*)view; @@ -50,7 +50,7 @@ static unsigned ALTER_fetch_int( LibmsiView *view, unsigned row, unsigned col, u return ERROR_FUNCTION_FAILED; } -static unsigned ALTER_fetch_stream( LibmsiView *view, unsigned row, unsigned col, IStream **stm) +static unsigned alter_view_fetch_stream( LibmsiView *view, unsigned row, unsigned col, IStream **stm) { LibmsiAlterView *av = (LibmsiAlterView*)view; @@ -59,7 +59,7 @@ static unsigned ALTER_fetch_stream( LibmsiView *view, unsigned row, unsigned col return ERROR_FUNCTION_FAILED; } -static unsigned ALTER_get_row( LibmsiView *view, unsigned row, LibmsiRecord **rec ) +static unsigned alter_view_get_row( LibmsiView *view, unsigned row, LibmsiRecord **rec ) { LibmsiAlterView *av = (LibmsiAlterView*)view; @@ -68,7 +68,7 @@ static unsigned ALTER_get_row( LibmsiView *view, unsigned row, LibmsiRecord **re return av->table->ops->get_row(av->table, row, rec); } -static unsigned ITERATE_columns(LibmsiRecord *row, void *param) +static unsigned count_iter(LibmsiRecord *row, void *param) { (*(unsigned *)param)++; return ERROR_SUCCESS; @@ -87,15 +87,15 @@ static bool check_column_exists(LibmsiDatabase *db, const WCHAR *table, const WC '`','N','a','m','e','`','=','\'','%','s','\'',0 }; - r = MSI_OpenQuery(db, &view, query, table, column); + r = _libmsi_query_open(db, &view, query, table, column); if (r != ERROR_SUCCESS) return false; - r = MSI_QueryExecute(view, NULL); + r = _libmsi_query_execute(view, NULL); if (r != ERROR_SUCCESS) goto done; - r = MSI_QueryFetch(view, &rec); + r = _libmsi_query_fetch(view, &rec); if (r == ERROR_SUCCESS) msiobj_release(&rec->hdr); @@ -118,7 +118,7 @@ static unsigned alter_add_column(LibmsiAlterView *av) 'B','Y',' ','`','N','u','m','b','e','r','`',0 }; - r = TABLE_CreateView(av->db, szColumns, &columns); + r = table_view_create(av->db, szColumns, &columns); if (r != ERROR_SUCCESS) return r; @@ -128,10 +128,10 @@ static unsigned alter_add_column(LibmsiAlterView *av) return ERROR_BAD_QUERY_SYNTAX; } - r = MSI_OpenQuery(av->db, &view, query, av->colinfo->table, av->colinfo->column); + r = _libmsi_query_open(av->db, &view, query, av->colinfo->table, av->colinfo->column); if (r == ERROR_SUCCESS) { - r = MSI_IterateRecords(view, NULL, ITERATE_columns, &colnum); + r = _libmsi_query_iterate_records(view, NULL, count_iter, &colnum); msiobj_release(&view->hdr); if (r != ERROR_SUCCESS) { @@ -147,7 +147,7 @@ static unsigned alter_add_column(LibmsiAlterView *av) return r; } -static unsigned ALTER_execute( LibmsiView *view, LibmsiRecord *record ) +static unsigned alter_view_execute( LibmsiView *view, LibmsiRecord *record ) { LibmsiAlterView *av = (LibmsiAlterView*)view; unsigned ref; @@ -169,7 +169,7 @@ static unsigned ALTER_execute( LibmsiView *view, LibmsiRecord *record ) return ERROR_SUCCESS; } -static unsigned ALTER_close( LibmsiView *view ) +static unsigned alter_view_close( LibmsiView *view ) { LibmsiAlterView *av = (LibmsiAlterView*)view; @@ -178,7 +178,7 @@ static unsigned ALTER_close( LibmsiView *view ) return ERROR_SUCCESS; } -static unsigned ALTER_get_dimensions( LibmsiView *view, unsigned *rows, unsigned *cols ) +static unsigned alter_view_get_dimensions( LibmsiView *view, unsigned *rows, unsigned *cols ) { LibmsiAlterView *av = (LibmsiAlterView*)view; @@ -187,7 +187,7 @@ static unsigned ALTER_get_dimensions( LibmsiView *view, unsigned *rows, unsigned return ERROR_FUNCTION_FAILED; } -static unsigned ALTER_get_column_info( LibmsiView *view, unsigned n, const WCHAR **name, +static unsigned alter_view_get_column_info( LibmsiView *view, unsigned n, const WCHAR **name, unsigned *type, bool *temporary, const WCHAR **table_name ) { LibmsiAlterView *av = (LibmsiAlterView*)view; @@ -197,7 +197,7 @@ static unsigned ALTER_get_column_info( LibmsiView *view, unsigned n, const WCHAR return ERROR_FUNCTION_FAILED; } -static unsigned ALTER_modify( LibmsiView *view, LibmsiModify eModifyMode, +static unsigned alter_view_modify( LibmsiView *view, LibmsiModify eModifyMode, LibmsiRecord *rec, unsigned row ) { LibmsiAlterView *av = (LibmsiAlterView*)view; @@ -207,7 +207,7 @@ static unsigned ALTER_modify( LibmsiView *view, LibmsiModify eModifyMode, return ERROR_FUNCTION_FAILED; } -static unsigned ALTER_delete( LibmsiView *view ) +static unsigned alter_view_delete( LibmsiView *view ) { LibmsiAlterView *av = (LibmsiAlterView*)view; @@ -219,7 +219,7 @@ static unsigned ALTER_delete( LibmsiView *view ) return ERROR_SUCCESS; } -static unsigned ALTER_find_matching_rows( LibmsiView *view, unsigned col, +static unsigned alter_view_find_matching_rows( LibmsiView *view, unsigned col, unsigned val, unsigned *row, MSIITERHANDLE *handle ) { TRACE("%p, %d, %u, %p\n", view, col, val, *handle); @@ -227,21 +227,21 @@ static unsigned ALTER_find_matching_rows( LibmsiView *view, unsigned col, return ERROR_FUNCTION_FAILED; } -static const LibmsiViewOPS alter_ops = +static const LibmsiViewOps alter_ops = { - ALTER_fetch_int, - ALTER_fetch_stream, - ALTER_get_row, + alter_view_fetch_int, + alter_view_fetch_stream, + alter_view_get_row, NULL, NULL, NULL, - ALTER_execute, - ALTER_close, - ALTER_get_dimensions, - ALTER_get_column_info, - ALTER_modify, - ALTER_delete, - ALTER_find_matching_rows, + alter_view_execute, + alter_view_close, + alter_view_get_dimensions, + alter_view_get_column_info, + alter_view_modify, + alter_view_delete, + alter_view_find_matching_rows, NULL, NULL, NULL, @@ -250,7 +250,7 @@ static const LibmsiViewOPS alter_ops = NULL, }; -unsigned ALTER_CreateView( LibmsiDatabase *db, LibmsiView **view, const WCHAR *name, column_info *colinfo, int hold ) +unsigned alter_view_create( LibmsiDatabase *db, LibmsiView **view, const WCHAR *name, column_info *colinfo, int hold ) { LibmsiAlterView *av; unsigned r; @@ -261,7 +261,7 @@ unsigned ALTER_CreateView( LibmsiDatabase *db, LibmsiView **view, const WCHAR *n if( !av ) return ERROR_FUNCTION_FAILED; - r = TABLE_CreateView( db, name, &av->table ); + r = table_view_create( db, name, &av->table ); if (r != ERROR_SUCCESS) { msi_free( av ); diff --git a/libmsi/create.c b/libmsi/create.c index a42084a..66a20f5 100644 --- a/libmsi/create.c +++ b/libmsi/create.c @@ -47,7 +47,7 @@ typedef struct LibmsiCreateView column_info *col_info; } LibmsiCreateView; -static unsigned CREATE_fetch_int( LibmsiView *view, unsigned row, unsigned col, unsigned *val ) +static unsigned create_view_fetch_int( LibmsiView *view, unsigned row, unsigned col, unsigned *val ) { LibmsiCreateView *cv = (LibmsiCreateView*)view; @@ -56,7 +56,7 @@ static unsigned CREATE_fetch_int( LibmsiView *view, unsigned row, unsigned col, return ERROR_FUNCTION_FAILED; } -static unsigned CREATE_execute( LibmsiView *view, LibmsiRecord *record ) +static unsigned create_view_execute( LibmsiView *view, LibmsiRecord *record ) { LibmsiCreateView *cv = (LibmsiCreateView*)view; bool persist = (cv->bIsTemp) ? LIBMSI_CONDITION_FALSE : LIBMSI_CONDITION_TRUE; @@ -70,7 +70,7 @@ static unsigned CREATE_execute( LibmsiView *view, LibmsiRecord *record ) return msi_create_table( cv->db, cv->name, cv->col_info, persist ); } -static unsigned CREATE_close( LibmsiView *view ) +static unsigned create_view_close( LibmsiView *view ) { LibmsiCreateView *cv = (LibmsiCreateView*)view; @@ -79,7 +79,7 @@ static unsigned CREATE_close( LibmsiView *view ) return ERROR_SUCCESS; } -static unsigned CREATE_get_dimensions( LibmsiView *view, unsigned *rows, unsigned *cols ) +static unsigned create_view_get_dimensions( LibmsiView *view, unsigned *rows, unsigned *cols ) { LibmsiCreateView *cv = (LibmsiCreateView*)view; @@ -88,7 +88,7 @@ static unsigned CREATE_get_dimensions( LibmsiView *view, unsigned *rows, unsigne return ERROR_FUNCTION_FAILED; } -static unsigned CREATE_get_column_info( LibmsiView *view, unsigned n, const WCHAR **name, +static unsigned create_view_get_column_info( LibmsiView *view, unsigned n, const WCHAR **name, unsigned *type, bool *temporary, const WCHAR **table_name ) { LibmsiCreateView *cv = (LibmsiCreateView*)view; @@ -98,7 +98,7 @@ static unsigned CREATE_get_column_info( LibmsiView *view, unsigned n, const WCHA return ERROR_FUNCTION_FAILED; } -static unsigned CREATE_modify( LibmsiView *view, LibmsiModify eModifyMode, +static unsigned create_view_modify( LibmsiView *view, LibmsiModify eModifyMode, LibmsiRecord *rec, unsigned row) { LibmsiCreateView *cv = (LibmsiCreateView*)view; @@ -108,7 +108,7 @@ static unsigned CREATE_modify( LibmsiView *view, LibmsiModify eModifyMode, return ERROR_FUNCTION_FAILED; } -static unsigned CREATE_delete( LibmsiView *view ) +static unsigned create_view_delete( LibmsiView *view ) { LibmsiCreateView *cv = (LibmsiCreateView*)view; @@ -120,20 +120,20 @@ static unsigned CREATE_delete( LibmsiView *view ) return ERROR_SUCCESS; } -static const LibmsiViewOPS create_ops = +static const LibmsiViewOps create_ops = { - CREATE_fetch_int, + create_view_fetch_int, NULL, NULL, NULL, NULL, NULL, - CREATE_execute, - CREATE_close, - CREATE_get_dimensions, - CREATE_get_column_info, - CREATE_modify, - CREATE_delete, + create_view_execute, + create_view_close, + create_view_get_dimensions, + create_view_get_column_info, + create_view_modify, + create_view_delete, NULL, NULL, NULL, @@ -156,7 +156,7 @@ static unsigned check_columns( const column_info *col_info ) return ERROR_SUCCESS; } -unsigned CREATE_CreateView( LibmsiDatabase *db, LibmsiView **view, const WCHAR *table, +unsigned create_view_create( LibmsiDatabase *db, LibmsiView **view, const WCHAR *table, column_info *col_info, bool hold ) { LibmsiCreateView *cv = NULL; diff --git a/libmsi/database.c b/libmsi/database.c index eaeeb1f..824d263 100644 --- a/libmsi/database.c +++ b/libmsi/database.c @@ -242,7 +242,7 @@ void append_storage_to_db( LibmsiDatabase *db, IStorage *stg ) free_streams( db ); } -static VOID MSI_CloseDatabase( LibmsiObject *arg ) +static VOID _libmsi_database_destroy( LibmsiObject *arg ) { LibmsiDatabase *db = (LibmsiDatabase *) arg; @@ -296,7 +296,7 @@ static HRESULT db_initialize( IStorage *stg, const GUID *clsid ) return S_OK; } -unsigned MsiOpenDatabase(const char *szDBPath, const char *szPersist, LibmsiDatabase **pdb) +unsigned libmsi_database_open(const char *szDBPath, const char *szPersist, LibmsiDatabase **pdb) { IStorage *stg = NULL; HRESULT r; @@ -403,7 +403,7 @@ unsigned MsiOpenDatabase(const char *szDBPath, const char *szPersist, LibmsiData goto end; } - db = alloc_msiobject( sizeof (LibmsiDatabase), MSI_CloseDatabase ); + db = alloc_msiobject( sizeof (LibmsiDatabase), _libmsi_database_destroy ); if( !db ) { FIXME("Failed to allocate a handle\n"); @@ -734,12 +734,12 @@ static unsigned msi_add_table_to_db(LibmsiDatabase *db, WCHAR **columns, WCHAR * strcatW(create_sql, columns_sql); strcatW(create_sql, postlude); - r = MSI_DatabaseOpenQueryW( db, create_sql, &view ); + r = _libmsi_database_open_query( db, create_sql, &view ); if (r != ERROR_SUCCESS) goto done; - r = MSI_QueryExecute(view, NULL); - MsiQueryClose(view); + r = _libmsi_query_execute(view, NULL); + libmsi_query_close(view); msiobj_release(&view->hdr); done: @@ -782,7 +782,7 @@ static unsigned construct_record(unsigned num_columns, WCHAR **types, { unsigned i; - *rec = MsiCreateRecord(num_columns); + *rec = libmsi_record_create(num_columns); if (!*rec) return ERROR_OUTOFMEMORY; @@ -791,11 +791,11 @@ static unsigned construct_record(unsigned num_columns, WCHAR **types, switch (types[i][0]) { case 'L': case 'l': case 'S': case 's': - MSI_RecordSetStringW(*rec, i + 1, data[i]); + _libmsi_record_set_stringW(*rec, i + 1, data[i]); break; case 'I': case 'i': if (*data[i]) - MsiRecordSetInteger(*rec, i + 1, atoiW(data[i])); + libmsi_record_set_int(*rec, i + 1, atoiW(data[i])); break; case 'V': case 'v': if (*data[i]) @@ -805,7 +805,7 @@ static unsigned construct_record(unsigned num_columns, WCHAR **types, if (!file) return ERROR_FUNCTION_FAILED; - r = MSI_RecordSetStreamFromFile(*rec, i + 1, file); + r = _libmsi_record_load_stream_from_file(*rec, i + 1, file); msi_free (file); if (r != ERROR_SUCCESS) return ERROR_FUNCTION_FAILED; @@ -836,13 +836,13 @@ static unsigned msi_add_records_to_table(LibmsiDatabase *db, WCHAR **columns, WC 'F','R','O','M',' ','`','%','s','`',0 }; - r = MSI_OpenQuery(db, &view, select, labels[0]); + r = _libmsi_query_open(db, &view, select, labels[0]); if (r != ERROR_SUCCESS) return r; - while (MSI_QueryFetch(view, &rec) != ERROR_NO_MORE_ITEMS) + while (_libmsi_query_fetch(view, &rec) != ERROR_NO_MORE_ITEMS) { - r = MSI_QueryModify(view, LIBMSI_MODIFY_DELETE, rec); + r = _libmsi_query_modify(view, LIBMSI_MODIFY_DELETE, rec); msiobj_release(&rec->hdr); if (r != ERROR_SUCCESS) goto done; @@ -854,7 +854,7 @@ static unsigned msi_add_records_to_table(LibmsiDatabase *db, WCHAR **columns, WC if (r != ERROR_SUCCESS) goto done; - r = MSI_QueryModify(view, LIBMSI_MODIFY_INSERT, rec); + r = _libmsi_query_modify(view, LIBMSI_MODIFY_INSERT, rec); if (r != ERROR_SUCCESS) { msiobj_release(&rec->hdr); @@ -869,7 +869,7 @@ done: return r; } -static unsigned MSI_DatabaseImport(LibmsiDatabase *db, const char *folder, const char *file) +static unsigned _libmsi_database_import(LibmsiDatabase *db, const char *folder, const char *file) { unsigned r = ERROR_OUTOFMEMORY; unsigned len, i; @@ -958,7 +958,7 @@ static unsigned MSI_DatabaseImport(LibmsiDatabase *db, const char *folder, const } else { - if (!TABLE_Exists(db, labels[0])) + if (!table_view_exists(db, labels[0])) { r = msi_add_table_to_db( db, columns, types, labels, num_labels, num_columns ); if (r != ERROR_SUCCESS) @@ -986,7 +986,7 @@ done: return r; } -unsigned MsiDatabaseImport(LibmsiDatabase *db, const char *szFolder, const char *szFilename) +unsigned libmsi_database_import(LibmsiDatabase *db, const char *szFolder, const char *szFilename) { unsigned r; @@ -996,7 +996,7 @@ unsigned MsiDatabaseImport(LibmsiDatabase *db, const char *szFolder, const char return ERROR_INVALID_HANDLE; msiobj_addref( &db->hdr ); - r = MSI_DatabaseImport( db, szFolder, szFilename ); + r = _libmsi_database_import( db, szFolder, szFilename ); msiobj_release( &db->hdr ); return r; } @@ -1013,11 +1013,11 @@ static unsigned msi_export_record( int fd, LibmsiRecord *row, unsigned start ) if ( !buffer ) return ERROR_OUTOFMEMORY; - count = MsiRecordGetFieldCount( row ); + count = libmsi_record_get_field_count( row ); for ( i=start; i<=count; i++ ) { sz = len; - r = MsiRecordGetString( row, i, buffer, &sz ); + r = libmsi_record_get_string( row, i, buffer, &sz ); if (r == ERROR_MORE_DATA) { char *p = msi_realloc( buffer, sz + 1 ); @@ -1027,7 +1027,7 @@ static unsigned msi_export_record( int fd, LibmsiRecord *row, unsigned start ) buffer = p; } sz = len; - r = MsiRecordGetString( row, i, buffer, &sz ); + r = libmsi_record_get_string( row, i, buffer, &sz ); if (r != ERROR_SUCCESS) break; @@ -1069,7 +1069,7 @@ static unsigned msi_export_forcecodepage( int fd, unsigned codepage ) return ERROR_SUCCESS; } -static unsigned MSI_DatabaseExport( LibmsiDatabase *db, const WCHAR *table, +static unsigned _libmsi_database_export( LibmsiDatabase *db, const WCHAR *table, int fd) { static const WCHAR query[] = { @@ -1089,11 +1089,11 @@ static unsigned MSI_DatabaseExport( LibmsiDatabase *db, const WCHAR *table, goto done; } - r = MSI_OpenQuery( db, &view, query, table ); + r = _libmsi_query_open( db, &view, query, table ); if (r == ERROR_SUCCESS) { /* write out row 1, the column names */ - r = MSI_QueryGetColumnInfo(view, LIBMSI_COL_INFO_NAMES, &rec); + r = _libmsi_query_get_column_info(view, LIBMSI_COL_INFO_NAMES, &rec); if (r == ERROR_SUCCESS) { msi_export_record( fd, rec, 1 ); @@ -1101,7 +1101,7 @@ static unsigned MSI_DatabaseExport( LibmsiDatabase *db, const WCHAR *table, } /* write out row 2, the column types */ - r = MSI_QueryGetColumnInfo(view, LIBMSI_COL_INFO_TYPES, &rec); + r = _libmsi_query_get_column_info(view, LIBMSI_COL_INFO_TYPES, &rec); if (r == ERROR_SUCCESS) { msi_export_record( fd, rec, 1 ); @@ -1109,16 +1109,16 @@ static unsigned MSI_DatabaseExport( LibmsiDatabase *db, const WCHAR *table, } /* write out row 3, the table name + keys */ - r = MSI_DatabaseGetPrimaryKeys( db, table, &rec ); + r = _libmsi_database_get_primary_keys( db, table, &rec ); if (r == ERROR_SUCCESS) { - MSI_RecordSetStringW( rec, 0, table ); + _libmsi_record_set_stringW( rec, 0, table ); msi_export_record( fd, rec, 0 ); msiobj_release( &rec->hdr ); } /* write out row 4 onwards, the data */ - r = MSI_IterateRecords( view, 0, msi_export_row, (void *)(intptr_t) fd ); + r = _libmsi_query_iterate_records( view, 0, msi_export_row, (void *)(intptr_t) fd ); msiobj_release( &view->hdr ); } @@ -1141,7 +1141,7 @@ done: * * row4 : data <tab> data <tab> data <tab> ... data <cr> <lf> */ -unsigned MsiDatabaseExport( LibmsiDatabase *db, const char *szTable, +unsigned libmsi_database_export( LibmsiDatabase *db, const char *szTable, int fd ) { WCHAR *path = NULL; @@ -1162,7 +1162,7 @@ unsigned MsiDatabaseExport( LibmsiDatabase *db, const char *szTable, return ERROR_INVALID_HANDLE; msiobj_addref ( &db->hdr ); - r = MSI_DatabaseExport( db, table, fd ); + r = _libmsi_database_export( db, table, fd ); msiobj_release( &db->hdr ); end: @@ -1220,21 +1220,21 @@ static unsigned merge_verify_colnames(LibmsiQuery *dbview, LibmsiQuery *mergevie LibmsiRecord *dbrec, *mergerec; unsigned r, i, count; - r = MSI_QueryGetColumnInfo(dbview, LIBMSI_COL_INFO_NAMES, &dbrec); + r = _libmsi_query_get_column_info(dbview, LIBMSI_COL_INFO_NAMES, &dbrec); if (r != ERROR_SUCCESS) return r; - r = MSI_QueryGetColumnInfo(mergeview, LIBMSI_COL_INFO_NAMES, &mergerec); + r = _libmsi_query_get_column_info(mergeview, LIBMSI_COL_INFO_NAMES, &mergerec); if (r != ERROR_SUCCESS) return r; - count = MsiRecordGetFieldCount(dbrec); + count = libmsi_record_get_field_count(dbrec); for (i = 1; i <= count; i++) { - if (!MSI_RecordGetStringRaw(mergerec, i)) + if (!_libmsi_record_get_string_raw(mergerec, i)) break; - if (strcmpW( MSI_RecordGetStringRaw( dbrec, i ), MSI_RecordGetStringRaw( mergerec, i ) )) + if (strcmpW( _libmsi_record_get_string_raw( dbrec, i ), _libmsi_record_get_string_raw( mergerec, i ) )) { r = ERROR_DATATYPE_MISMATCH; goto done; @@ -1245,22 +1245,22 @@ static unsigned merge_verify_colnames(LibmsiQuery *dbview, LibmsiQuery *mergevie msiobj_release(&mergerec->hdr); dbrec = mergerec = NULL; - r = MSI_QueryGetColumnInfo(dbview, LIBMSI_COL_INFO_TYPES, &dbrec); + r = _libmsi_query_get_column_info(dbview, LIBMSI_COL_INFO_TYPES, &dbrec); if (r != ERROR_SUCCESS) return r; - r = MSI_QueryGetColumnInfo(mergeview, LIBMSI_COL_INFO_TYPES, &mergerec); + r = _libmsi_query_get_column_info(mergeview, LIBMSI_COL_INFO_TYPES, &mergerec); if (r != ERROR_SUCCESS) return r; - count = MsiRecordGetFieldCount(dbrec); + count = libmsi_record_get_field_count(dbrec); for (i = 1; i <= count; i++) { - if (!MSI_RecordGetStringRaw(mergerec, i)) + if (!_libmsi_record_get_string_raw(mergerec, i)) break; - if (!merge_type_match(MSI_RecordGetStringRaw(dbrec, i), - MSI_RecordGetStringRaw(mergerec, i))) + if (!merge_type_match(_libmsi_record_get_string_raw(dbrec, i), + _libmsi_record_get_string_raw(mergerec, i))) { r = ERROR_DATATYPE_MISMATCH; break; @@ -1280,16 +1280,16 @@ static unsigned merge_verify_primary_keys(LibmsiDatabase *db, LibmsiDatabase *me LibmsiRecord *dbrec, *mergerec = NULL; unsigned r, i, count; - r = MSI_DatabaseGetPrimaryKeys(db, table, &dbrec); + r = _libmsi_database_get_primary_keys(db, table, &dbrec); if (r != ERROR_SUCCESS) return r; - r = MSI_DatabaseGetPrimaryKeys(mergedb, table, &mergerec); + r = _libmsi_database_get_primary_keys(mergedb, table, &mergerec); if (r != ERROR_SUCCESS) goto done; - count = MsiRecordGetFieldCount(dbrec); - if (count != MsiRecordGetFieldCount(mergerec)) + count = libmsi_record_get_field_count(dbrec); + if (count != libmsi_record_get_field_count(mergerec)) { r = ERROR_DATATYPE_MISMATCH; goto done; @@ -1297,7 +1297,7 @@ static unsigned merge_verify_primary_keys(LibmsiDatabase *db, LibmsiDatabase *me for (i = 1; i <= count; i++) { - if (strcmpW( MSI_RecordGetStringRaw( dbrec, i ), MSI_RecordGetStringRaw( mergerec, i ) )) + if (strcmpW( _libmsi_record_get_string_raw( dbrec, i ), _libmsi_record_get_string_raw( mergerec, i ) )) { r = ERROR_DATATYPE_MISMATCH; goto done; @@ -1319,7 +1319,7 @@ static WCHAR *get_key_value(LibmsiQuery *view, const WCHAR *key, LibmsiRecord *r unsigned r, i = 0, sz = 0; int cmp; - r = MSI_QueryGetColumnInfo(view, LIBMSI_COL_INFO_NAMES, &colnames); + r = _libmsi_query_get_column_info(view, LIBMSI_COL_INFO_NAMES, &colnames); if (r != ERROR_SUCCESS) return NULL; @@ -1332,12 +1332,12 @@ static WCHAR *get_key_value(LibmsiQuery *view, const WCHAR *key, LibmsiRecord *r msiobj_release(&colnames->hdr); - r = MSI_RecordGetStringW(rec, i, NULL, &sz); + r = _libmsi_record_get_stringW(rec, i, NULL, &sz); if (r != ERROR_SUCCESS) return NULL; sz++; - if (MSI_RecordGetStringRaw(rec, i)) /* check record field is a string */ + if (_libmsi_record_get_string_raw(rec, i)) /* check record field is a string */ { /* quote string record fields */ const WCHAR szQuote[] = {'\'', 0}; @@ -1347,7 +1347,7 @@ static WCHAR *get_key_value(LibmsiQuery *view, const WCHAR *key, LibmsiRecord *r return NULL; strcpyW(val, szQuote); - r = MSI_RecordGetStringW(rec, i, val+1, &sz); + r = _libmsi_record_get_stringW(rec, i, val+1, &sz); strcpyW(val+1+sz, szQuote); } else @@ -1357,7 +1357,7 @@ static WCHAR *get_key_value(LibmsiQuery *view, const WCHAR *key, LibmsiRecord *r if (!val) return NULL; - r = MSI_RecordGetStringW(rec, i, val, &sz); + r = _libmsi_record_get_stringW(rec, i, val, &sz); } if (r != ERROR_SUCCESS) @@ -1390,7 +1390,7 @@ static WCHAR *create_diff_row_query(LibmsiDatabase *merge, LibmsiQuery *view, 'F','R','O','M',' ','`','%','s','`',' ', 'W','H','E','R','E',' ','%','s',0}; - r = MSI_DatabaseGetPrimaryKeys(merge, table, &keys); + r = _libmsi_database_get_primary_keys(merge, table, &keys); if (r != ERROR_SUCCESS) return NULL; @@ -1399,10 +1399,10 @@ static WCHAR *create_diff_row_query(LibmsiDatabase *merge, LibmsiQuery *view, goto done; size = 1; - count = MsiRecordGetFieldCount(keys); + count = libmsi_record_get_field_count(keys); for (i = 1; i <= count; i++) { - key = MSI_RecordGetStringRaw(keys, i); + key = _libmsi_record_get_string_raw(keys, i); val = get_key_value(view, key, rec); if (i == count) @@ -1446,22 +1446,22 @@ static unsigned merge_diff_row(LibmsiRecord *rec, void *param) WCHAR *query = NULL; unsigned r = ERROR_SUCCESS; - if (TABLE_Exists(data->db, table->name)) + if (table_view_exists(data->db, table->name)) { query = create_diff_row_query(data->merge, data->curview, table->name, rec); if (!query) return ERROR_OUTOFMEMORY; - r = MSI_DatabaseOpenQueryW(data->db, query, &dbview); + r = _libmsi_database_open_query(data->db, query, &dbview); if (r != ERROR_SUCCESS) goto done; - r = MSI_QueryExecute(dbview, NULL); + r = _libmsi_query_execute(dbview, NULL); if (r != ERROR_SUCCESS) goto done; - r = MSI_QueryFetch(dbview, &row); - if (r == ERROR_SUCCESS && !MSI_RecordsAreEqual(rec, row)) + r = _libmsi_query_fetch(dbview, &row); + if (r == ERROR_SUCCESS && !_libmsi_record_compare(rec, row)) { table->numconflicts++; goto done; @@ -1479,7 +1479,7 @@ static unsigned merge_diff_row(LibmsiRecord *rec, void *param) goto done; } - mergerow->data = MSI_CloneRecord(rec); + mergerow->data = _libmsi_record_clone(rec); if (!mergerow->data) { r = ERROR_OUTOFMEMORY; @@ -1501,11 +1501,11 @@ static unsigned msi_get_table_labels(LibmsiDatabase *db, const WCHAR *table, WCH unsigned r, i, count; LibmsiRecord *prec = NULL; - r = MSI_DatabaseGetPrimaryKeys(db, table, &prec); + r = _libmsi_database_get_primary_keys(db, table, &prec); if (r != ERROR_SUCCESS) return r; - count = MsiRecordGetFieldCount(prec); + count = libmsi_record_get_field_count(prec); *numlabels = count + 1; *labels = msi_alloc((*numlabels)*sizeof(WCHAR *)); if (!*labels) @@ -1517,7 +1517,7 @@ static unsigned msi_get_table_labels(LibmsiDatabase *db, const WCHAR *table, WCH (*labels)[0] = strdupW(table); for (i=1; i<=count; i++ ) { - (*labels)[i] = strdupW(MSI_RecordGetStringRaw(prec, i)); + (*labels)[i] = strdupW(_libmsi_record_get_string_raw(prec, i)); } end: @@ -1530,11 +1530,11 @@ static unsigned msi_get_query_columns(LibmsiQuery *query, WCHAR ***columns, unsi unsigned r, i, count; LibmsiRecord *prec = NULL; - r = MSI_QueryGetColumnInfo(query, LIBMSI_COL_INFO_NAMES, &prec); + r = _libmsi_query_get_column_info(query, LIBMSI_COL_INFO_NAMES, &prec); if (r != ERROR_SUCCESS) return r; - count = MsiRecordGetFieldCount(prec); + count = libmsi_record_get_field_count(prec); *columns = msi_alloc(count*sizeof(WCHAR *)); if (!*columns) { @@ -1544,7 +1544,7 @@ static unsigned msi_get_query_columns(LibmsiQuery *query, WCHAR ***columns, unsi for (i=1; i<=count; i++ ) { - (*columns)[i-1] = strdupW(MSI_RecordGetStringRaw(prec, i)); + (*columns)[i-1] = strdupW(_libmsi_record_get_string_raw(prec, i)); } *numcolumns = count; @@ -1559,11 +1559,11 @@ static unsigned msi_get_query_types(LibmsiQuery *query, WCHAR ***types, unsigned unsigned r, i, count; LibmsiRecord *prec = NULL; - r = MSI_QueryGetColumnInfo(query, LIBMSI_COL_INFO_TYPES, &prec); + r = _libmsi_query_get_column_info(query, LIBMSI_COL_INFO_TYPES, &prec); if (r != ERROR_SUCCESS) return r; - count = MsiRecordGetFieldCount(prec); + count = libmsi_record_get_field_count(prec); *types = msi_alloc(count*sizeof(WCHAR *)); if (!*types) { @@ -1574,7 +1574,7 @@ static unsigned msi_get_query_types(LibmsiQuery *query, WCHAR ***types, unsigned *numtypes = count; for (i=1; i<=count; i++ ) { - (*types)[i-1] = strdupW(MSI_RecordGetStringRaw(prec, i)); + (*types)[i-1] = strdupW(_libmsi_record_get_string_raw(prec, i)); } end: @@ -1650,7 +1650,7 @@ static unsigned msi_get_merge_table (LibmsiDatabase *db, const WCHAR *name, MERG if (r != ERROR_SUCCESS) goto err; - r = MSI_OpenQuery(db, &mergeview, query, name); + r = _libmsi_query_open(db, &mergeview, query, name); if (r != ERROR_SUCCESS) goto err; @@ -1690,15 +1690,15 @@ static unsigned merge_diff_tables(LibmsiRecord *rec, void *param) static const WCHAR query[] = {'S','E','L','E','C','T',' ','*',' ', 'F','R','O','M',' ','`','%','s','`',0}; - name = MSI_RecordGetStringRaw(rec, 1); + name = _libmsi_record_get_string_raw(rec, 1); - r = MSI_OpenQuery(data->merge, &mergeview, query, name); + r = _libmsi_query_open(data->merge, &mergeview, query, name); if (r != ERROR_SUCCESS) goto done; - if (TABLE_Exists(data->db, name)) + if (table_view_exists(data->db, name)) { - r = MSI_OpenQuery(data->db, &dbview, query, name); + r = _libmsi_query_open(data->db, &dbview, query, name); if (r != ERROR_SUCCESS) goto done; @@ -1717,7 +1717,7 @@ static unsigned merge_diff_tables(LibmsiRecord *rec, void *param) data->curtable = table; data->curview = mergeview; - r = MSI_IterateRecords(mergeview, NULL, merge_diff_row, data); + r = _libmsi_query_iterate_records(mergeview, NULL, merge_diff_row, data); if (r != ERROR_SUCCESS) { free_merge_table(table); @@ -1742,14 +1742,14 @@ static unsigned gather_merge_data(LibmsiDatabase *db, LibmsiDatabase *merge, MERGEDATA data; unsigned r; - r = MSI_DatabaseOpenQueryW(merge, query, &view); + r = _libmsi_database_open_query(merge, query, &view); if (r != ERROR_SUCCESS) return r; data.db = db; data.merge = merge; data.tabledata = tabledata; - r = MSI_IterateRecords(view, NULL, merge_diff_tables, &data); + r = _libmsi_query_iterate_records(view, NULL, merge_diff_tables, &data); msiobj_release(&view->hdr); return r; } @@ -1760,7 +1760,7 @@ static unsigned merge_table(LibmsiDatabase *db, MERGETABLE *table) MERGEROW *row; LibmsiView *tv; - if (!TABLE_Exists(db, table->name)) + if (!table_view_exists(db, table->name)) { r = msi_add_table_to_db(db, table->columns, table->types, table->labels, table->numlabels, table->numcolumns); @@ -1770,7 +1770,7 @@ static unsigned merge_table(LibmsiDatabase *db, MERGETABLE *table) LIST_FOR_EACH_ENTRY(row, &table->rows, MERGEROW, entry) { - r = TABLE_CreateView(db, table->name, &tv); + r = table_view_create(db, table->name, &tv); if (r != ERROR_SUCCESS) return r; @@ -1805,28 +1805,28 @@ static unsigned update_merge_errors(LibmsiDatabase *db, const WCHAR *error, 'C','o','n','f','l','i','c','t','s','`',')',' ','V','A','L','U','E','S', ' ','(','\'','%','s','\'',',',' ','%','d',')',0}; - if (!TABLE_Exists(db, error)) + if (!table_view_exists(db, error)) { - r = MSI_OpenQuery(db, &view, create, error); + r = _libmsi_query_open(db, &view, create, error); if (r != ERROR_SUCCESS) return r; - r = MSI_QueryExecute(view, NULL); + r = _libmsi_query_execute(view, NULL); msiobj_release(&view->hdr); if (r != ERROR_SUCCESS) return r; } - r = MSI_OpenQuery(db, &view, insert, error, table, numconflicts); + r = _libmsi_query_open(db, &view, insert, error, table, numconflicts); if (r != ERROR_SUCCESS) return r; - r = MSI_QueryExecute(view, NULL); + r = _libmsi_query_execute(view, NULL); msiobj_release(&view->hdr); return r; } -unsigned MsiDatabaseMerge(LibmsiDatabase *db, LibmsiDatabase *merge, +unsigned libmsi_database_merge(LibmsiDatabase *db, LibmsiDatabase *merge, const char *szTableName) { struct list tabledata = LIST_INIT(tabledata); @@ -1888,7 +1888,7 @@ done: return r; } -LibmsiDBState MsiGetDatabaseState( LibmsiDatabase *db ) +LibmsiDBState libmsi_database_get_state( LibmsiDatabase *db ) { LibmsiDBState ret = LIBMSI_DB_STATE_READ; diff --git a/libmsi/delete.c b/libmsi/delete.c index 47845b6..5bb1e29 100644 --- a/libmsi/delete.c +++ b/libmsi/delete.c @@ -53,7 +53,7 @@ typedef struct LibmsiDeleteView LibmsiView *table; } LibmsiDeleteView; -static unsigned DELETE_fetch_int( LibmsiView *view, unsigned row, unsigned col, unsigned *val ) +static unsigned delete_view_fetch_int( LibmsiView *view, unsigned row, unsigned col, unsigned *val ) { LibmsiDeleteView *dv = (LibmsiDeleteView*)view; @@ -62,7 +62,7 @@ static unsigned DELETE_fetch_int( LibmsiView *view, unsigned row, unsigned col, return ERROR_FUNCTION_FAILED; } -static unsigned DELETE_fetch_stream( LibmsiView *view, unsigned row, unsigned col, IStream **stm) +static unsigned delete_view_fetch_stream( LibmsiView *view, unsigned row, unsigned col, IStream **stm) { LibmsiDeleteView *dv = (LibmsiDeleteView*)view; @@ -71,7 +71,7 @@ static unsigned DELETE_fetch_stream( LibmsiView *view, unsigned row, unsigned co return ERROR_FUNCTION_FAILED; } -static unsigned DELETE_execute( LibmsiView *view, LibmsiRecord *record ) +static unsigned delete_view_execute( LibmsiView *view, LibmsiRecord *record ) { LibmsiDeleteView *dv = (LibmsiDeleteView*)view; unsigned r, i, rows = 0, cols = 0; @@ -98,7 +98,7 @@ static unsigned DELETE_execute( LibmsiView *view, LibmsiRecord *record ) return ERROR_SUCCESS; } -static unsigned DELETE_close( LibmsiView *view ) +static unsigned delete_view_close( LibmsiView *view ) { LibmsiDeleteView *dv = (LibmsiDeleteView*)view; @@ -110,7 +110,7 @@ static unsigned DELETE_close( LibmsiView *view ) return dv->table->ops->close( dv->table ); } -static unsigned DELETE_get_dimensions( LibmsiView *view, unsigned *rows, unsigned *cols ) +static unsigned delete_view_get_dimensions( LibmsiView *view, unsigned *rows, unsigned *cols ) { LibmsiDeleteView *dv = (LibmsiDeleteView*)view; @@ -124,7 +124,7 @@ static unsigned DELETE_get_dimensions( LibmsiView *view, unsigned *rows, unsigne return dv->table->ops->get_dimensions( dv->table, NULL, cols ); } -static unsigned DELETE_get_column_info( LibmsiView *view, unsigned n, const WCHAR **name, +static unsigned delete_view_get_column_info( LibmsiView *view, unsigned n, const WCHAR **name, unsigned *type, bool *temporary, const WCHAR **table_name ) { LibmsiDeleteView *dv = (LibmsiDeleteView*)view; @@ -138,7 +138,7 @@ static unsigned DELETE_get_column_info( LibmsiView *view, unsigned n, const WCHA type, temporary, table_name); } -static unsigned DELETE_modify( LibmsiView *view, LibmsiModify eModifyMode, +static unsigned delete_view_modify( LibmsiView *view, LibmsiModify eModifyMode, LibmsiRecord *rec, unsigned row ) { LibmsiDeleteView *dv = (LibmsiDeleteView*)view; @@ -148,7 +148,7 @@ static unsigned DELETE_modify( LibmsiView *view, LibmsiModify eModifyMode, return ERROR_FUNCTION_FAILED; } -static unsigned DELETE_delete( LibmsiView *view ) +static unsigned delete_view_delete( LibmsiView *view ) { LibmsiDeleteView *dv = (LibmsiDeleteView*)view; @@ -162,7 +162,7 @@ static unsigned DELETE_delete( LibmsiView *view ) return ERROR_SUCCESS; } -static unsigned DELETE_find_matching_rows( LibmsiView *view, unsigned col, +static unsigned delete_view_find_matching_rows( LibmsiView *view, unsigned col, unsigned val, unsigned *row, MSIITERHANDLE *handle ) { TRACE("%p, %d, %u, %p\n", view, col, val, *handle); @@ -171,21 +171,21 @@ static unsigned DELETE_find_matching_rows( LibmsiView *view, unsigned col, } -static const LibmsiViewOPS delete_ops = +static const LibmsiViewOps delete_ops = { - DELETE_fetch_int, - DELETE_fetch_stream, + delete_view_fetch_int, + delete_view_fetch_stream, NULL, NULL, NULL, NULL, - DELETE_execute, - DELETE_close, - DELETE_get_dimensions, - DELETE_get_column_info, - DELETE_modify, - DELETE_delete, - DELETE_find_matching_rows, + delete_view_execute, + delete_view_close, + delete_view_get_dimensions, + delete_view_get_column_info, + delete_view_modify, + delete_view_delete, + delete_view_find_matching_rows, NULL, NULL, NULL, @@ -194,7 +194,7 @@ static const LibmsiViewOPS delete_ops = NULL, }; -unsigned DELETE_CreateView( LibmsiDatabase *db, LibmsiView **view, LibmsiView *table ) +unsigned delete_view_create( LibmsiDatabase *db, LibmsiView **view, LibmsiView *table ) { LibmsiDeleteView *dv = NULL; diff --git a/libmsi/distinct.c b/libmsi/distinct.c index b8d71e4..b0cbf44 100644 --- a/libmsi/distinct.c +++ b/libmsi/distinct.c @@ -88,7 +88,7 @@ static void distinct_free( LibmsiDistinctSet *x ) } } -static unsigned DISTINCT_fetch_int( LibmsiView *view, unsigned row, unsigned col, unsigned *val ) +static unsigned distinct_view_fetch_int( LibmsiView *view, unsigned row, unsigned col, unsigned *val ) { LibmsiDistinctView *dv = (LibmsiDistinctView*)view; @@ -105,7 +105,7 @@ static unsigned DISTINCT_fetch_int( LibmsiView *view, unsigned row, unsigned col return dv->table->ops->fetch_int( dv->table, row, col, val ); } -static unsigned DISTINCT_execute( LibmsiView *view, LibmsiRecord *record ) +static unsigned distinct_view_execute( LibmsiView *view, LibmsiRecord *record ) { LibmsiDistinctView *dv = (LibmsiDistinctView*)view; unsigned r, i, j, r_count, c_count; @@ -167,7 +167,7 @@ static unsigned DISTINCT_execute( LibmsiView *view, LibmsiRecord *record ) return ERROR_SUCCESS; } -static unsigned DISTINCT_close( LibmsiView *view ) +static unsigned distinct_view_close( LibmsiView *view ) { LibmsiDistinctView *dv = (LibmsiDistinctView*)view; @@ -183,7 +183,7 @@ static unsigned DISTINCT_close( LibmsiView *view ) return dv->table->ops->close( dv->table ); } -static unsigned DISTINCT_get_dimensions( LibmsiView *view, unsigned *rows, unsigned *cols ) +static unsigned distinct_view_get_dimensions( LibmsiView *view, unsigned *rows, unsigned *cols ) { LibmsiDistinctView *dv = (LibmsiDistinctView*)view; @@ -202,7 +202,7 @@ static unsigned DISTINCT_get_dimensions( LibmsiView *view, unsigned *rows, unsig return dv->table->ops->get_dimensions( dv->table, NULL, cols ); } -static unsigned DISTINCT_get_column_info( LibmsiView *view, unsigned n, const WCHAR **name, +static unsigned distinct_view_get_column_info( LibmsiView *view, unsigned n, const WCHAR **name, unsigned *type, bool *temporary, const WCHAR **table_name ) { LibmsiDistinctView *dv = (LibmsiDistinctView*)view; @@ -216,7 +216,7 @@ static unsigned DISTINCT_get_column_info( LibmsiView *view, unsigned n, const WC type, temporary, table_name ); } -static unsigned DISTINCT_modify( LibmsiView *view, LibmsiModify eModifyMode, +static unsigned distinct_view_modify( LibmsiView *view, LibmsiModify eModifyMode, LibmsiRecord *rec, unsigned row ) { LibmsiDistinctView *dv = (LibmsiDistinctView*)view; @@ -229,7 +229,7 @@ static unsigned DISTINCT_modify( LibmsiView *view, LibmsiModify eModifyMode, return dv->table->ops->modify( dv->table, eModifyMode, rec, row ); } -static unsigned DISTINCT_delete( LibmsiView *view ) +static unsigned distinct_view_delete( LibmsiView *view ) { LibmsiDistinctView *dv = (LibmsiDistinctView*)view; @@ -245,7 +245,7 @@ static unsigned DISTINCT_delete( LibmsiView *view ) return ERROR_SUCCESS; } -static unsigned DISTINCT_find_matching_rows( LibmsiView *view, unsigned col, +static unsigned distinct_view_find_matching_rows( LibmsiView *view, unsigned col, unsigned val, unsigned *row, MSIITERHANDLE *handle ) { LibmsiDistinctView *dv = (LibmsiDistinctView*)view; @@ -266,21 +266,21 @@ static unsigned DISTINCT_find_matching_rows( LibmsiView *view, unsigned col, return r; } -static const LibmsiViewOPS distinct_ops = +static const LibmsiViewOps distinct_ops = { - DISTINCT_fetch_int, + distinct_view_fetch_int, NULL, NULL, NULL, NULL, NULL, - DISTINCT_execute, - DISTINCT_close, - DISTINCT_get_dimensions, - DISTINCT_get_column_info, - DISTINCT_modify, - DISTINCT_delete, - DISTINCT_find_matching_rows, + distinct_view_execute, + distinct_view_close, + distinct_view_get_dimensions, + distinct_view_get_column_info, + distinct_view_modify, + distinct_view_delete, + distinct_view_find_matching_rows, NULL, NULL, NULL, @@ -289,7 +289,7 @@ static const LibmsiViewOPS distinct_ops = NULL, }; -unsigned DISTINCT_CreateView( LibmsiDatabase *db, LibmsiView **view, LibmsiView *table ) +unsigned distinct_view_create( LibmsiDatabase *db, LibmsiView **view, LibmsiView *table ) { LibmsiDistinctView *dv = NULL; unsigned count = 0, r; diff --git a/libmsi/drop.c b/libmsi/drop.c index 15c5454..59a057d 100644 --- a/libmsi/drop.c +++ b/libmsi/drop.c @@ -41,7 +41,7 @@ typedef struct LibmsiDropView int hold; } LibmsiDropView; -static unsigned DROP_execute(LibmsiView *view, LibmsiRecord *record) +static unsigned drop_view_execute(LibmsiView *view, LibmsiRecord *record) { LibmsiDropView *dv = (LibmsiDropView*)view; unsigned r; @@ -58,7 +58,7 @@ static unsigned DROP_execute(LibmsiView *view, LibmsiRecord *record) return dv->table->ops->drop(dv->table); } -static unsigned DROP_close(LibmsiView *view) +static unsigned drop_view_close(LibmsiView *view) { LibmsiDropView *dv = (LibmsiDropView*)view; @@ -67,7 +67,7 @@ static unsigned DROP_close(LibmsiView *view) return ERROR_SUCCESS; } -static unsigned DROP_get_dimensions(LibmsiView *view, unsigned *rows, unsigned *cols) +static unsigned drop_view_get_dimensions(LibmsiView *view, unsigned *rows, unsigned *cols) { LibmsiDropView *dv = (LibmsiDropView*)view; @@ -76,7 +76,7 @@ static unsigned DROP_get_dimensions(LibmsiView *view, unsigned *rows, unsigned * return ERROR_FUNCTION_FAILED; } -static unsigned DROP_delete( LibmsiView *view ) +static unsigned drop_view_delete( LibmsiView *view ) { LibmsiDropView *dv = (LibmsiDropView*)view; @@ -90,7 +90,7 @@ static unsigned DROP_delete( LibmsiView *view ) return ERROR_SUCCESS; } -static const LibmsiViewOPS drop_ops = +static const LibmsiViewOps drop_ops = { NULL, NULL, @@ -98,12 +98,12 @@ static const LibmsiViewOPS drop_ops = NULL, NULL, NULL, - DROP_execute, - DROP_close, - DROP_get_dimensions, + drop_view_execute, + drop_view_close, + drop_view_get_dimensions, NULL, NULL, - DROP_delete, + drop_view_delete, NULL, NULL, NULL, @@ -113,7 +113,7 @@ static const LibmsiViewOPS drop_ops = NULL, }; -unsigned DROP_CreateView(LibmsiDatabase *db, LibmsiView **view, const WCHAR *name) +unsigned drop_view_create(LibmsiDatabase *db, LibmsiView **view, const WCHAR *name) { LibmsiDropView *dv; unsigned r; @@ -124,7 +124,7 @@ unsigned DROP_CreateView(LibmsiDatabase *db, LibmsiView **view, const WCHAR *nam if(!dv) return ERROR_FUNCTION_FAILED; - r = TABLE_CreateView(db, name, &dv->table); + r = table_view_create(db, name, &dv->table); if (r != ERROR_SUCCESS) { msi_free( dv ); diff --git a/libmsi/handle.c b/libmsi/handle.c index b80ebdf..77cf782 100644 --- a/libmsi/handle.c +++ b/libmsi/handle.c @@ -78,9 +78,9 @@ int msiobj_release( LibmsiObject *obj ) } /*********************************************************** - * MsiCloseHandle [MSI.@] + * libmsi_unref [MSI.@] */ -unsigned MsiCloseHandle(void *obj) +unsigned libmsi_unref(void *obj) { TRACE("%x\n",obj); diff --git a/libmsi/insert.c b/libmsi/insert.c index 8ccb124..be1d13a 100644 --- a/libmsi/insert.c +++ b/libmsi/insert.c @@ -47,7 +47,7 @@ typedef struct LibmsiInsertView column_info *vals; } LibmsiInsertView; -static unsigned INSERT_fetch_int( LibmsiView *view, unsigned row, unsigned col, unsigned *val ) +static unsigned insert_view_fetch_int( LibmsiView *view, unsigned row, unsigned col, unsigned *val ) { LibmsiInsertView *iv = (LibmsiInsertView*)view; @@ -67,7 +67,7 @@ LibmsiRecord *msi_query_merge_record( unsigned fields, const column_info *vl, Li LibmsiRecord *merged; unsigned wildcard_count = 1, i; - merged = MsiCreateRecord( fields ); + merged = libmsi_record_create( fields ); for( i=1; i <= fields; i++ ) { if( !vl ) @@ -79,15 +79,15 @@ LibmsiRecord *msi_query_merge_record( unsigned fields, const column_info *vl, Li { case EXPR_SVAL: TRACE("field %d -> %s\n", i, debugstr_w(vl->val->u.sval)); - MSI_RecordSetStringW( merged, i, vl->val->u.sval ); + _libmsi_record_set_stringW( merged, i, vl->val->u.sval ); break; case EXPR_IVAL: - MsiRecordSetInteger( merged, i, vl->val->u.ival ); + libmsi_record_set_int( merged, i, vl->val->u.ival ); break; case EXPR_WILDCARD: if( !rec ) goto err; - MSI_RecordCopyField( rec, wildcard_count, merged, i ); + _libmsi_record_copy_field( rec, wildcard_count, merged, i ); wildcard_count++; break; default: @@ -136,7 +136,7 @@ static unsigned msi_arrange_record(LibmsiInsertView *iv, LibmsiRecord **values) if (r != ERROR_SUCCESS) return r; - val_count = MsiRecordGetFieldCount(*values); + val_count = libmsi_record_get_field_count(*values); /* check to see if the columns are arranged already * to avoid unnecessary copying @@ -144,7 +144,7 @@ static unsigned msi_arrange_record(LibmsiInsertView *iv, LibmsiRecord **values) if (col_count == val_count && msi_columns_in_order(iv, col_count)) return ERROR_SUCCESS; - padded = MsiCreateRecord(col_count); + padded = libmsi_record_create(col_count); if (!padded) return ERROR_OUTOFMEMORY; @@ -163,7 +163,7 @@ static unsigned msi_arrange_record(LibmsiInsertView *iv, LibmsiRecord **values) if (!strcmpW( a, b )) { - MSI_RecordCopyField(*values, colidx, padded, i); + _libmsi_record_copy_field(*values, colidx, padded, i); break; } } @@ -195,14 +195,14 @@ static bool row_has_null_primary_keys(LibmsiInsertView *iv, LibmsiRecord *row) if (!(type & MSITYPE_KEY)) continue; - if (MsiRecordIsNull(row, i)) + if (libmsi_record_is_null(row, i)) return true; } return false; } -static unsigned INSERT_execute( LibmsiView *view, LibmsiRecord *record ) +static unsigned insert_view_execute( LibmsiView *view, LibmsiRecord *record ) { LibmsiInsertView *iv = (LibmsiInsertView*)view; unsigned r, row = -1, col_count = 0; @@ -250,7 +250,7 @@ err: } -static unsigned INSERT_close( LibmsiView *view ) +static unsigned insert_view_close( LibmsiView *view ) { LibmsiInsertView *iv = (LibmsiInsertView*)view; LibmsiView *sv; @@ -264,7 +264,7 @@ static unsigned INSERT_close( LibmsiView *view ) return sv->ops->close( sv ); } -static unsigned INSERT_get_dimensions( LibmsiView *view, unsigned *rows, unsigned *cols ) +static unsigned insert_view_get_dimensions( LibmsiView *view, unsigned *rows, unsigned *cols ) { LibmsiInsertView *iv = (LibmsiInsertView*)view; LibmsiView *sv; @@ -278,7 +278,7 @@ static unsigned INSERT_get_dimensions( LibmsiView *view, unsigned *rows, unsigne return sv->ops->get_dimensions( sv, rows, cols ); } -static unsigned INSERT_get_column_info( LibmsiView *view, unsigned n, const WCHAR **name, +static unsigned insert_view_get_column_info( LibmsiView *view, unsigned n, const WCHAR **name, unsigned *type, bool *temporary, const WCHAR **table_name ) { LibmsiInsertView *iv = (LibmsiInsertView*)view; @@ -293,7 +293,7 @@ static unsigned INSERT_get_column_info( LibmsiView *view, unsigned n, const WCHA return sv->ops->get_column_info( sv, n, name, type, temporary, table_name ); } -static unsigned INSERT_modify( LibmsiView *view, LibmsiModify eModifyMode, LibmsiRecord *rec, unsigned row) +static unsigned insert_view_modify( LibmsiView *view, LibmsiModify eModifyMode, LibmsiRecord *rec, unsigned row) { LibmsiInsertView *iv = (LibmsiInsertView*)view; @@ -302,7 +302,7 @@ static unsigned INSERT_modify( LibmsiView *view, LibmsiModify eModifyMode, Libms return ERROR_FUNCTION_FAILED; } -static unsigned INSERT_delete( LibmsiView *view ) +static unsigned insert_view_delete( LibmsiView *view ) { LibmsiInsertView *iv = (LibmsiInsertView*)view; LibmsiView *sv; @@ -318,7 +318,7 @@ static unsigned INSERT_delete( LibmsiView *view ) return ERROR_SUCCESS; } -static unsigned INSERT_find_matching_rows( LibmsiView *view, unsigned col, +static unsigned insert_view_find_matching_rows( LibmsiView *view, unsigned col, unsigned val, unsigned *row, MSIITERHANDLE *handle ) { TRACE("%p, %d, %u, %p\n", view, col, val, *handle); @@ -327,21 +327,21 @@ static unsigned INSERT_find_matching_rows( LibmsiView *view, unsigned col, } -static const LibmsiViewOPS insert_ops = +static const LibmsiViewOps insert_ops = { - INSERT_fetch_int, + insert_view_fetch_int, NULL, NULL, NULL, NULL, NULL, - INSERT_execute, - INSERT_close, - INSERT_get_dimensions, - INSERT_get_column_info, - INSERT_modify, - INSERT_delete, - INSERT_find_matching_rows, + insert_view_execute, + insert_view_close, + insert_view_get_dimensions, + insert_view_get_column_info, + insert_view_modify, + insert_view_delete, + insert_view_find_matching_rows, NULL, NULL, NULL, @@ -358,7 +358,7 @@ static unsigned count_column_info( const column_info *ci ) return n; } -unsigned INSERT_CreateView( LibmsiDatabase *db, LibmsiView **view, const WCHAR *table, +unsigned insert_view_create( LibmsiDatabase *db, LibmsiView **view, const WCHAR *table, column_info *columns, column_info *values, bool temp ) { LibmsiInsertView *iv = NULL; @@ -371,11 +371,11 @@ unsigned INSERT_CreateView( LibmsiDatabase *db, LibmsiView **view, const WCHAR * if ( count_column_info( columns ) != count_column_info(values) ) return ERROR_BAD_QUERY_SYNTAX; - r = TABLE_CreateView( db, table, &tv ); + r = table_view_create( db, table, &tv ); if( r != ERROR_SUCCESS ) return r; - r = SELECT_CreateView( db, &sv, tv, columns ); + r = select_view_create( db, &sv, tv, columns ); if( r != ERROR_SUCCESS ) { if( tv ) diff --git a/libmsi/msipriv.h b/libmsi/msipriv.h index 84f78e9..2a131d8 100644 --- a/libmsi/msipriv.h +++ b/libmsi/msipriv.h @@ -113,7 +113,7 @@ typedef struct LibmsiField typedef struct LibmsiRecord { LibmsiObject hdr; - unsigned count; /* as passed to MsiCreateRecord */ + unsigned count; /* as passed to libmsi_record_create */ LibmsiField fields[1]; /* nb. array size is count+1 */ } LibmsiRecord; @@ -129,7 +129,7 @@ typedef struct _column_info typedef const struct LibmsiColumnHashEntry *MSIITERHANDLE; -typedef struct LibmsiViewOPS +typedef struct LibmsiViewOps { /* * fetch_int - reads one integer from {row,col} in the table @@ -251,12 +251,12 @@ typedef struct LibmsiViewOPS * drop - drops the table from the database */ unsigned (*drop)( LibmsiView *view ); -} LibmsiViewOPS; +} LibmsiViewOps; struct LibmsiView { LibmsiObject hdr; - const LibmsiViewOPS *ops; + const LibmsiViewOps *ops; LibmsiDBError error; const WCHAR *error_column; }; @@ -296,7 +296,7 @@ extern void msiobj_addref(LibmsiObject *); extern int msiobj_release(LibmsiObject *); extern void free_cached_tables( LibmsiDatabase *db ); -extern unsigned MSI_CommitTables( LibmsiDatabase *db ); +extern unsigned _libmsi_database_commit_tables( LibmsiDatabase *db ); /* string table functions */ @@ -306,8 +306,8 @@ enum StringPersistence StringNonPersistent = 1 }; -extern int msi_addstringW( string_table *st, const WCHAR *data, int len, uint16_t refcount, enum StringPersistence persistence ); -extern unsigned msi_string2idW( const string_table *st, const WCHAR *buffer, unsigned *id ); +extern int _libmsi_add_string( string_table *st, const WCHAR *data, int len, uint16_t refcount, enum StringPersistence persistence ); +extern unsigned _libmsi_id_from_stringW( const string_table *st, const WCHAR *buffer, unsigned *id ); extern VOID msi_destroy_stringtable( string_table *st ); extern const WCHAR *msi_string_lookup_id( const string_table *st, unsigned id ); extern HRESULT msi_init_string_table( IStorage *stg ); @@ -316,8 +316,8 @@ extern unsigned msi_save_string_table( const string_table *st, IStorage *storage extern unsigned msi_get_string_table_codepage( const string_table *st ); extern unsigned msi_set_string_table_codepage( string_table *st, unsigned codepage ); -extern bool TABLE_Exists( LibmsiDatabase *db, const WCHAR *name ); -extern LibmsiCondition MSI_DatabaseIsTablePersistent( LibmsiDatabase *db, const WCHAR *table ); +extern bool table_view_exists( LibmsiDatabase *db, const WCHAR *name ); +extern LibmsiCondition _libmsi_database_is_table_persistent( LibmsiDatabase *db, const WCHAR *table ); extern unsigned read_stream_data( IStorage *stg, const WCHAR *stname, bool table, uint8_t **pdata, unsigned *psz ); @@ -326,27 +326,27 @@ extern unsigned write_stream_data( IStorage *stg, const WCHAR *stname, /* transform functions */ extern unsigned msi_table_apply_transform( LibmsiDatabase *db, IStorage *stg ); -extern unsigned MSI_DatabaseApplyTransform( LibmsiDatabase *db, +extern unsigned _libmsi_database_apply_transform( LibmsiDatabase *db, const char *szTransformFile, int iErrorCond ); extern void append_storage_to_db( LibmsiDatabase *db, IStorage *stg ); /* record internals */ -extern void MSI_CloseRecord( LibmsiObject * ); -extern unsigned MSI_RecordSetIStream( LibmsiRecord *, unsigned, IStream *); -extern unsigned MSI_RecordGetIStream( const LibmsiRecord *, unsigned, IStream **); -extern const WCHAR *MSI_RecordGetStringRaw( const LibmsiRecord *, unsigned ); -extern unsigned MSI_RecordSetIntPtr( LibmsiRecord *, unsigned, intptr_t ); -extern unsigned MSI_RecordSetStringW( LibmsiRecord *, unsigned, const WCHAR *); -extern unsigned MSI_RecordGetStringW( const LibmsiRecord *, unsigned, WCHAR *, unsigned *); -extern intptr_t MSI_RecordGetIntPtr( const LibmsiRecord *, unsigned ); -extern unsigned MSI_RecordReadStream( const LibmsiRecord *, unsigned, char *, unsigned *); -extern unsigned MSI_RecordSetStream(LibmsiRecord *, unsigned, IStream *); -extern unsigned MSI_RecordStreamToFile( const LibmsiRecord *, unsigned, const WCHAR *); -extern unsigned MSI_RecordSetStreamFromFile( LibmsiRecord *, unsigned, const char *); -extern unsigned MSI_RecordCopyField( LibmsiRecord *, unsigned, LibmsiRecord *, unsigned ); -extern LibmsiRecord *MSI_CloneRecord( LibmsiRecord * ); -extern bool MSI_RecordsAreEqual( const LibmsiRecord *, const LibmsiRecord * ); -extern bool MSI_RecordsAreFieldsEqual(const LibmsiRecord *a, const LibmsiRecord *b, unsigned field); +extern void _libmsi_record_destroy( LibmsiObject * ); +extern unsigned _libmsi_record_set_IStream( LibmsiRecord *, unsigned, IStream *); +extern unsigned _libmsi_record_get_IStream( const LibmsiRecord *, unsigned, IStream **); +extern const WCHAR *_libmsi_record_get_string_raw( const LibmsiRecord *, unsigned ); +extern unsigned _libmsi_record_set_int_ptr( LibmsiRecord *, unsigned, intptr_t ); +extern unsigned _libmsi_record_set_stringW( LibmsiRecord *, unsigned, const WCHAR *); +extern unsigned _libmsi_record_get_stringW( const LibmsiRecord *, unsigned, WCHAR *, unsigned *); +extern intptr_t _libmsi_record_get_int_ptr( const LibmsiRecord *, unsigned ); +extern unsigned _libmsi_record_save_stream( const LibmsiRecord *, unsigned, char *, unsigned *); +extern unsigned _libmsi_record_load_stream(LibmsiRecord *, unsigned, IStream *); +extern unsigned _libmsi_record_save_stream_to_file( const LibmsiRecord *, unsigned, const WCHAR *); +extern unsigned _libmsi_record_load_stream_from_file( LibmsiRecord *, unsigned, const char *); +extern unsigned _libmsi_record_copy_field( LibmsiRecord *, unsigned, LibmsiRecord *, unsigned ); +extern LibmsiRecord *_libmsi_record_clone( LibmsiRecord * ); +extern bool _libmsi_record_compare( const LibmsiRecord *, const LibmsiRecord * ); +extern bool _libmsi_record_compare_fields(const LibmsiRecord *a, const LibmsiRecord *b, unsigned field); /* stream internals */ extern void enum_stream_names( IStorage *stg ); @@ -357,19 +357,19 @@ extern void decode_streamname(const WCHAR *in, WCHAR *out); extern unsigned msi_get_raw_stream( LibmsiDatabase *, const WCHAR *, IStream **); extern unsigned msi_clone_open_stream( LibmsiDatabase *, IStorage *, const WCHAR *, IStream ** ); void msi_destroy_stream( LibmsiDatabase *, const WCHAR * ); -extern unsigned MSI_DatabaseOpenQueryW(LibmsiDatabase *, const WCHAR *, LibmsiQuery **); -extern unsigned MSI_OpenQuery( LibmsiDatabase *, LibmsiQuery **, const WCHAR *, ... ); +extern unsigned _libmsi_database_open_query(LibmsiDatabase *, const WCHAR *, LibmsiQuery **); +extern unsigned _libmsi_query_open( LibmsiDatabase *, LibmsiQuery **, const WCHAR *, ... ); typedef unsigned (*record_func)( LibmsiRecord *, void *); -extern unsigned MSI_IterateRecords( LibmsiQuery *, unsigned *, record_func, void *); -extern LibmsiRecord *MSI_QueryGetRecord( LibmsiDatabase *db, const WCHAR *query, ... ); -extern unsigned MSI_DatabaseGetPrimaryKeys( LibmsiDatabase *, const WCHAR *, LibmsiRecord **); +extern unsigned _libmsi_query_iterate_records( LibmsiQuery *, unsigned *, record_func, void *); +extern LibmsiRecord *_libmsi_query_get_record( LibmsiDatabase *db, const WCHAR *query, ... ); +extern unsigned _libmsi_database_get_primary_keys( LibmsiDatabase *, const WCHAR *, LibmsiRecord **); /* view internals */ -extern unsigned MSI_QueryExecute( LibmsiQuery*, LibmsiRecord * ); -extern unsigned MSI_QueryFetch( LibmsiQuery*, LibmsiRecord ** ); -extern unsigned MSI_QueryGetColumnInfo(LibmsiQuery *, LibmsiColInfo, LibmsiRecord **); -extern unsigned MSI_QueryModify( LibmsiQuery *, LibmsiModify, LibmsiRecord * ); -extern unsigned VIEW_find_column( LibmsiView *, const WCHAR *, const WCHAR *, unsigned *); +extern unsigned _libmsi_query_execute( LibmsiQuery*, LibmsiRecord * ); +extern unsigned _libmsi_query_fetch( LibmsiQuery*, LibmsiRecord ** ); +extern unsigned _libmsi_query_get_column_info(LibmsiQuery *, LibmsiColInfo, LibmsiRecord **); +extern unsigned _libmsi_query_modify( LibmsiQuery *, LibmsiModify, LibmsiRecord * ); +extern unsigned _libmsi_view_find_column( LibmsiView *, const WCHAR *, const WCHAR *, unsigned *); extern unsigned msi_view_get_row(LibmsiDatabase *, LibmsiView *, unsigned, LibmsiRecord **); /* summary information */ diff --git a/libmsi/msiquery.c b/libmsi/msiquery.c index 3b23c0e..c1dfb27 100644 --- a/libmsi/msiquery.c +++ b/libmsi/msiquery.c @@ -39,7 +39,7 @@ #include "initguid.h" -static void MSI_CloseQuery( LibmsiObject *arg ) +static void _libmsi_query_destroy( LibmsiObject *arg ) { LibmsiQuery *query = (LibmsiQuery*) arg; struct list *ptr, *t; @@ -54,7 +54,7 @@ static void MSI_CloseQuery( LibmsiObject *arg ) } } -unsigned VIEW_find_column( LibmsiView *table, const WCHAR *name, const WCHAR *table_name, unsigned *n ) +unsigned _libmsi_view_find_column( LibmsiView *table, const WCHAR *name, const WCHAR *table_name, unsigned *n ) { const WCHAR *col_name; const WCHAR *haystack_table_name; @@ -84,7 +84,7 @@ unsigned VIEW_find_column( LibmsiView *table, const WCHAR *name, const WCHAR *ta return ERROR_INVALID_PARAMETER; } -unsigned MsiDatabaseOpenQuery(LibmsiDatabase *db, +unsigned libmsi_database_open_query(LibmsiDatabase *db, const char *szQuery, LibmsiQuery **pQuery) { unsigned r; @@ -105,14 +105,14 @@ unsigned MsiDatabaseOpenQuery(LibmsiDatabase *db, return ERROR_INVALID_HANDLE; msiobj_addref( &db->hdr); - r = MSI_DatabaseOpenQueryW( db, szwQuery, pQuery ); + r = _libmsi_database_open_query( db, szwQuery, pQuery ); msiobj_release( &db->hdr ); msi_free( szwQuery ); return r; } -unsigned MSI_DatabaseOpenQueryW(LibmsiDatabase *db, +unsigned _libmsi_database_open_query(LibmsiDatabase *db, const WCHAR *szQuery, LibmsiQuery **pView) { LibmsiQuery *query; @@ -124,7 +124,7 @@ unsigned MSI_DatabaseOpenQueryW(LibmsiDatabase *db, return ERROR_INVALID_PARAMETER; /* pre allocate a handle to hold a pointer to the view */ - query = alloc_msiobject( sizeof (LibmsiQuery), MSI_CloseQuery ); + query = alloc_msiobject( sizeof (LibmsiQuery), _libmsi_query_destroy ); if( !query ) return ERROR_FUNCTION_FAILED; @@ -132,7 +132,7 @@ unsigned MSI_DatabaseOpenQueryW(LibmsiDatabase *db, query->db = db; list_init( &query->mem ); - r = MSI_ParseSQL( db, szQuery, &query->view, &query->mem ); + r = _libmsi_parse_sql( db, szQuery, &query->view, &query->mem ); if( r == ERROR_SUCCESS ) { msiobj_addref( &query->hdr ); @@ -143,7 +143,7 @@ unsigned MSI_DatabaseOpenQueryW(LibmsiDatabase *db, return r; } -unsigned MSI_OpenQuery( LibmsiDatabase *db, LibmsiQuery **view, const WCHAR *fmt, ... ) +unsigned _libmsi_query_open( LibmsiDatabase *db, LibmsiQuery **view, const WCHAR *fmt, ... ) { unsigned r; int size = 100, res; @@ -163,18 +163,18 @@ unsigned MSI_OpenQuery( LibmsiDatabase *db, LibmsiQuery **view, const WCHAR *fmt msi_free( query ); } /* perform the query */ - r = MSI_DatabaseOpenQueryW(db, query, view); + r = _libmsi_database_open_query(db, query, view); msi_free(query); return r; } -unsigned MSI_IterateRecords( LibmsiQuery *view, unsigned *count, +unsigned _libmsi_query_iterate_records( LibmsiQuery *view, unsigned *count, record_func func, void *param ) { LibmsiRecord *rec = NULL; unsigned r, n = 0, max = 0; - r = MSI_QueryExecute( view, NULL ); + r = _libmsi_query_execute( view, NULL ); if( r != ERROR_SUCCESS ) return r; @@ -184,7 +184,7 @@ unsigned MSI_IterateRecords( LibmsiQuery *view, unsigned *count, /* iterate a query */ for( n = 0; (max == 0) || (n < max); n++ ) { - r = MSI_QueryFetch( view, &rec ); + r = _libmsi_query_fetch( view, &rec ); if( r != ERROR_SUCCESS ) break; if (func) @@ -194,7 +194,7 @@ unsigned MSI_IterateRecords( LibmsiQuery *view, unsigned *count, break; } - MsiQueryClose( view ); + libmsi_query_close( view ); if( count ) *count = n; @@ -206,7 +206,7 @@ unsigned MSI_IterateRecords( LibmsiQuery *view, unsigned *count, } /* return a single record from a query */ -LibmsiRecord *MSI_QueryGetRecord( LibmsiDatabase *db, const WCHAR *fmt, ... ) +LibmsiRecord *_libmsi_query_get_record( LibmsiDatabase *db, const WCHAR *fmt, ... ) { LibmsiRecord *rec = NULL; LibmsiQuery *view = NULL; @@ -228,14 +228,14 @@ LibmsiRecord *MSI_QueryGetRecord( LibmsiDatabase *db, const WCHAR *fmt, ... ) msi_free( query ); } /* perform the query */ - r = MSI_DatabaseOpenQueryW(db, query, &view); + r = _libmsi_database_open_query(db, query, &view); msi_free(query); if( r == ERROR_SUCCESS ) { - MSI_QueryExecute( view, NULL ); - MSI_QueryFetch( view, &rec ); - MsiQueryClose( view ); + _libmsi_query_execute( view, NULL ); + _libmsi_query_fetch( view, &rec ); + libmsi_query_close( view ); msiobj_release( &view->hdr ); } return rec; @@ -257,7 +257,7 @@ unsigned msi_view_get_row(LibmsiDatabase *db, LibmsiView *view, unsigned row, Li if (row >= row_count) return ERROR_NO_MORE_ITEMS; - *rec = MsiCreateRecord(col_count); + *rec = libmsi_record_create(col_count); if (!*rec) return ERROR_FUNCTION_FAILED; @@ -277,7 +277,7 @@ unsigned msi_view_get_row(LibmsiDatabase *db, LibmsiView *view, unsigned row, Li ret = view->ops->fetch_stream(view, row, i, &stm); if ((ret == ERROR_SUCCESS) && stm) { - MSI_RecordSetIStream(*rec, i, stm); + _libmsi_record_set_IStream(*rec, i, stm); IStream_Release(stm); } else @@ -305,21 +305,21 @@ unsigned msi_view_get_row(LibmsiDatabase *db, LibmsiView *view, unsigned row, Li const WCHAR *sval; sval = msi_string_lookup_id(db->strings, ival); - MSI_RecordSetStringW(*rec, i, sval); + _libmsi_record_set_stringW(*rec, i, sval); } else { if ((type & MSI_DATASIZEMASK) == 2) - MsiRecordSetInteger(*rec, i, ival - (1<<15)); + libmsi_record_set_int(*rec, i, ival - (1<<15)); else - MsiRecordSetInteger(*rec, i, ival - (1<<31)); + libmsi_record_set_int(*rec, i, ival - (1<<31)); } } return ERROR_SUCCESS; } -unsigned MSI_QueryFetch(LibmsiQuery *query, LibmsiRecord **prec) +unsigned _libmsi_query_fetch(LibmsiQuery *query, LibmsiRecord **prec) { LibmsiView *view; unsigned r; @@ -334,13 +334,13 @@ unsigned MSI_QueryFetch(LibmsiQuery *query, LibmsiRecord **prec) if (r == ERROR_SUCCESS) { query->row ++; - MSI_RecordSetIntPtr(*prec, 0, (intptr_t)query); + _libmsi_record_set_int_ptr(*prec, 0, (intptr_t)query); } return r; } -unsigned MsiQueryFetch(LibmsiQuery *query, LibmsiRecord **record) +unsigned libmsi_query_fetch(LibmsiQuery *query, LibmsiRecord **record) { unsigned ret; @@ -353,12 +353,12 @@ unsigned MsiQueryFetch(LibmsiQuery *query, LibmsiRecord **record) if( !query ) return ERROR_INVALID_HANDLE; msiobj_addref( &query->hdr); - ret = MSI_QueryFetch( query, record ); + ret = _libmsi_query_fetch( query, record ); msiobj_release( &query->hdr ); return ret; } -unsigned MsiQueryClose(LibmsiQuery *query) +unsigned libmsi_query_close(LibmsiQuery *query) { LibmsiView *view; unsigned ret; @@ -380,7 +380,7 @@ unsigned MsiQueryClose(LibmsiQuery *query) return ret; } -unsigned MSI_QueryExecute(LibmsiQuery *query, LibmsiRecord *rec ) +unsigned _libmsi_query_execute(LibmsiQuery *query, LibmsiRecord *rec ) { LibmsiView *view; @@ -396,7 +396,7 @@ unsigned MSI_QueryExecute(LibmsiQuery *query, LibmsiRecord *rec ) return view->ops->execute( view, rec ); } -unsigned MsiQueryExecute(LibmsiQuery *query, LibmsiRecord *rec) +unsigned libmsi_query_execute(LibmsiQuery *query, LibmsiRecord *rec) { unsigned ret; @@ -409,7 +409,7 @@ unsigned MsiQueryExecute(LibmsiQuery *query, LibmsiRecord *rec) if( rec ) msiobj_addref( &rec->hdr ); - ret = MSI_QueryExecute( query, rec ); + ret = _libmsi_query_execute( query, rec ); msiobj_release( &query->hdr ); if( rec ) @@ -452,10 +452,10 @@ static unsigned msi_set_record_type_string( LibmsiRecord *rec, unsigned field, TRACE("type %04x -> %s\n", type, debugstr_w(szType) ); - return MSI_RecordSetStringW( rec, field, szType ); + return _libmsi_record_set_stringW( rec, field, szType ); } -unsigned MSI_QueryGetColumnInfo( LibmsiQuery *query, LibmsiColInfo info, LibmsiRecord **prec ) +unsigned _libmsi_query_get_column_info( LibmsiQuery *query, LibmsiColInfo info, LibmsiRecord **prec ) { unsigned r = ERROR_FUNCTION_FAILED, i, count = 0, type; LibmsiRecord *rec; @@ -475,7 +475,7 @@ unsigned MSI_QueryGetColumnInfo( LibmsiQuery *query, LibmsiColInfo info, LibmsiR if( !count ) return ERROR_INVALID_PARAMETER; - rec = MsiCreateRecord( count ); + rec = libmsi_record_create( count ); if( !rec ) return ERROR_FUNCTION_FAILED; @@ -486,7 +486,7 @@ unsigned MSI_QueryGetColumnInfo( LibmsiQuery *query, LibmsiColInfo info, LibmsiR if( r != ERROR_SUCCESS ) continue; if (info == LIBMSI_COL_INFO_NAMES) - MSI_RecordSetStringW( rec, i+1, name ); + _libmsi_record_set_stringW( rec, i+1, name ); else msi_set_record_type_string( rec, i+1, type, temporary ); } @@ -494,7 +494,7 @@ unsigned MSI_QueryGetColumnInfo( LibmsiQuery *query, LibmsiColInfo info, LibmsiR return ERROR_SUCCESS; } -unsigned MsiQueryGetColumnInfo(LibmsiQuery *query, LibmsiColInfo info, LibmsiRecord **prec) +unsigned libmsi_query_get_column_info(LibmsiQuery *query, LibmsiColInfo info, LibmsiRecord **prec) { unsigned r; @@ -510,13 +510,13 @@ unsigned MsiQueryGetColumnInfo(LibmsiQuery *query, LibmsiColInfo info, LibmsiRec return ERROR_INVALID_HANDLE; msiobj_addref ( &query->hdr ); - r = MSI_QueryGetColumnInfo( query, info, prec ); + r = _libmsi_query_get_column_info( query, info, prec ); msiobj_release( &query->hdr ); return r; } -unsigned MSI_QueryModify( LibmsiQuery *query, LibmsiModify mode, LibmsiRecord *rec ) +unsigned _libmsi_query_modify( LibmsiQuery *query, LibmsiModify mode, LibmsiRecord *rec ) { LibmsiView *view = NULL; unsigned r; @@ -528,7 +528,7 @@ unsigned MSI_QueryModify( LibmsiQuery *query, LibmsiModify mode, LibmsiRecord *r if ( !view || !view->ops->modify) return ERROR_FUNCTION_FAILED; - if ( mode == LIBMSI_MODIFY_UPDATE && MSI_RecordGetIntPtr( rec, 0 ) != (intptr_t)query ) + if ( mode == LIBMSI_MODIFY_UPDATE && _libmsi_record_get_int_ptr( rec, 0 ) != (intptr_t)query ) return ERROR_FUNCTION_FAILED; r = view->ops->modify( view, mode, rec, query->row ); @@ -538,7 +538,7 @@ unsigned MSI_QueryModify( LibmsiQuery *query, LibmsiModify mode, LibmsiRecord *r return r; } -unsigned MsiQueryModify( LibmsiQuery *query, LibmsiModify eModifyMode, +unsigned libmsi_query_modify( LibmsiQuery *query, LibmsiModify eModifyMode, LibmsiRecord *rec) { unsigned r = ERROR_FUNCTION_FAILED; @@ -553,7 +553,7 @@ unsigned MsiQueryModify( LibmsiQuery *query, LibmsiModify eModifyMode, if (rec) msiobj_addref( &rec->hdr); - r = MSI_QueryModify( query, eModifyMode, rec ); + r = _libmsi_query_modify( query, eModifyMode, rec ); msiobj_release( &query->hdr ); if( rec ) @@ -562,7 +562,7 @@ unsigned MsiQueryModify( LibmsiQuery *query, LibmsiModify eModifyMode, return r; } -LibmsiDBError MsiQueryGetError( LibmsiQuery *query, char *buffer, unsigned *buflen ) +LibmsiDBError libmsi_query_get_error( LibmsiQuery *query, char *buffer, unsigned *buflen ) { const WCHAR *column; LibmsiDBError r; @@ -593,7 +593,7 @@ LibmsiDBError MsiQueryGetError( LibmsiQuery *query, char *buffer, unsigned *bufl return r; } -unsigned MSI_DatabaseApplyTransform( LibmsiDatabase *db, +unsigned _libmsi_database_apply_transform( LibmsiDatabase *db, const char *szTransformFile, int iErrorCond ) { HRESULT r; @@ -633,7 +633,7 @@ end: return ret; } -unsigned MsiDatabaseApplyTransform( LibmsiDatabase *db, +unsigned libmsi_database_apply_transform( LibmsiDatabase *db, const char *szTransformFile, int iErrorCond) { unsigned r; @@ -641,12 +641,12 @@ unsigned MsiDatabaseApplyTransform( LibmsiDatabase *db, msiobj_addref( &db->hdr ); if( !db ) return ERROR_INVALID_HANDLE; - r = MSI_DatabaseApplyTransform( db, szTransformFile, iErrorCond ); + r = _libmsi_database_apply_transform( db, szTransformFile, iErrorCond ); msiobj_release( &db->hdr ); return r; } -unsigned MsiDatabaseCommit( LibmsiDatabase *db ) +unsigned libmsi_database_commit( LibmsiDatabase *db ) { unsigned r; @@ -664,7 +664,7 @@ unsigned MsiDatabaseCommit( LibmsiDatabase *db ) /* FIXME: lock the database */ - r = MSI_CommitTables( db ); + r = _libmsi_database_commit_tables( db ); if (r != ERROR_SUCCESS) ERR("Failed to commit tables!\n"); /* FIXME: unlock the database */ @@ -693,7 +693,7 @@ static unsigned msi_primary_key_iterator( LibmsiRecord *rec, void *param ) const WCHAR *table; unsigned type; - type = MsiRecordGetInteger( rec, 4 ); + type = libmsi_record_get_integer( rec, 4 ); if( type & MSITYPE_KEY ) { info->n++; @@ -701,19 +701,19 @@ static unsigned msi_primary_key_iterator( LibmsiRecord *rec, void *param ) { if ( info->n == 1 ) { - table = MSI_RecordGetStringRaw( rec, 1 ); - MSI_RecordSetStringW( info->rec, 0, table); + table = _libmsi_record_get_string_raw( rec, 1 ); + _libmsi_record_set_stringW( info->rec, 0, table); } - name = MSI_RecordGetStringRaw( rec, 3 ); - MSI_RecordSetStringW( info->rec, info->n, name ); + name = _libmsi_record_get_string_raw( rec, 3 ); + _libmsi_record_set_stringW( info->rec, info->n, name ); } } return ERROR_SUCCESS; } -unsigned MSI_DatabaseGetPrimaryKeys( LibmsiDatabase *db, +unsigned _libmsi_database_get_primary_keys( LibmsiDatabase *db, const WCHAR *table, LibmsiRecord **prec ) { static const WCHAR sql[] = { @@ -725,25 +725,25 @@ unsigned MSI_DatabaseGetPrimaryKeys( LibmsiDatabase *db, LibmsiQuery *query = NULL; unsigned r; - if (!TABLE_Exists( db, table )) + if (!table_view_exists( db, table )) return ERROR_INVALID_TABLE; - r = MSI_OpenQuery( db, &query, sql, table ); + r = _libmsi_query_open( db, &query, sql, table ); if( r != ERROR_SUCCESS ) return r; /* count the number of primary key records */ info.n = 0; info.rec = 0; - r = MSI_IterateRecords( query, 0, msi_primary_key_iterator, &info ); + r = _libmsi_query_iterate_records( query, 0, msi_primary_key_iterator, &info ); if( r == ERROR_SUCCESS ) { TRACE("Found %d primary keys\n", info.n ); /* allocate a record and fill in the names of the tables */ - info.rec = MsiCreateRecord( info.n ); + info.rec = libmsi_record_create( info.n ); info.n = 0; - r = MSI_IterateRecords( query, 0, msi_primary_key_iterator, &info ); + r = _libmsi_query_iterate_records( query, 0, msi_primary_key_iterator, &info ); if( r == ERROR_SUCCESS ) *prec = info.rec; else @@ -754,7 +754,7 @@ unsigned MSI_DatabaseGetPrimaryKeys( LibmsiDatabase *db, return r; } -unsigned MsiDatabaseGetPrimaryKeys(LibmsiDatabase *db, +unsigned libmsi_database_get_primary_keys(LibmsiDatabase *db, const char *table, LibmsiRecord **prec) { WCHAR *szwTable = NULL; @@ -773,14 +773,14 @@ unsigned MsiDatabaseGetPrimaryKeys(LibmsiDatabase *db, return ERROR_INVALID_HANDLE; msiobj_addref( &db->hdr ); - r = MSI_DatabaseGetPrimaryKeys( db, szwTable, prec ); + r = _libmsi_database_get_primary_keys( db, szwTable, prec ); msiobj_release( &db->hdr ); msi_free( szwTable ); return r; } -LibmsiCondition MsiDatabaseIsTablePersistent( +LibmsiCondition libmsi_database_is_table_persistent( LibmsiDatabase *db, const char *szTableName) { WCHAR *szwTableName = NULL; @@ -799,7 +799,7 @@ LibmsiCondition MsiDatabaseIsTablePersistent( if( !db ) return LIBMSI_CONDITION_ERROR; - r = MSI_DatabaseIsTablePersistent( db, szwTableName ); + r = _libmsi_database_is_table_persistent( db, szwTableName ); msiobj_release( &db->hdr ); msi_free( szwTableName ); diff --git a/libmsi/query.h b/libmsi/query.h index 18a53f0..48e4ebc 100644 --- a/libmsi/query.h +++ b/libmsi/query.h @@ -97,42 +97,42 @@ struct expr } u; }; -unsigned MSI_ParseSQL( LibmsiDatabase *db, const WCHAR *command, LibmsiView **phview, +unsigned _libmsi_parse_sql( LibmsiDatabase *db, const WCHAR *command, LibmsiView **phview, struct list *mem ); -unsigned TABLE_CreateView( LibmsiDatabase *db, const WCHAR *name, LibmsiView **view ); +unsigned table_view_create( LibmsiDatabase *db, const WCHAR *name, LibmsiView **view ); -unsigned SELECT_CreateView( LibmsiDatabase *db, LibmsiView **view, LibmsiView *table, +unsigned select_view_create( LibmsiDatabase *db, LibmsiView **view, LibmsiView *table, const column_info *columns ); -unsigned DISTINCT_CreateView( LibmsiDatabase *db, LibmsiView **view, LibmsiView *table ); +unsigned distinct_view_create( LibmsiDatabase *db, LibmsiView **view, LibmsiView *table ); -unsigned ORDER_CreateView( LibmsiDatabase *db, LibmsiView **view, LibmsiView *table, +unsigned order_view_create( LibmsiDatabase *db, LibmsiView **view, LibmsiView *table, column_info *columns ); -unsigned WHERE_CreateView( LibmsiDatabase *db, LibmsiView **view, WCHAR *tables, +unsigned where_view_create( LibmsiDatabase *db, LibmsiView **view, WCHAR *tables, struct expr *cond ); -unsigned CREATE_CreateView( LibmsiDatabase *db, LibmsiView **view, const WCHAR *table, +unsigned create_view_create( LibmsiDatabase *db, LibmsiView **view, const WCHAR *table, column_info *col_info, bool hold ); -unsigned INSERT_CreateView( LibmsiDatabase *db, LibmsiView **view, const WCHAR *table, +unsigned insert_view_create( LibmsiDatabase *db, LibmsiView **view, const WCHAR *table, column_info *columns, column_info *values, bool temp ); -unsigned UPDATE_CreateView( LibmsiDatabase *db, LibmsiView **view, WCHAR *table, +unsigned update_view_create( LibmsiDatabase *db, LibmsiView **view, WCHAR *table, column_info *list, struct expr *expr ); -unsigned DELETE_CreateView( LibmsiDatabase *db, LibmsiView **view, LibmsiView *table ); +unsigned delete_view_create( LibmsiDatabase *db, LibmsiView **view, LibmsiView *table ); -unsigned ALTER_CreateView( LibmsiDatabase *db, LibmsiView **view, const WCHAR *name, column_info *colinfo, int hold ); +unsigned alter_view_create( LibmsiDatabase *db, LibmsiView **view, const WCHAR *name, column_info *colinfo, int hold ); -unsigned STREAMS_CreateView( LibmsiDatabase *db, LibmsiView **view ); +unsigned streams_view_create( LibmsiDatabase *db, LibmsiView **view ); -unsigned STORAGES_CreateView( LibmsiDatabase *db, LibmsiView **view ); +unsigned storages_view_create( LibmsiDatabase *db, LibmsiView **view ); -unsigned DROP_CreateView( LibmsiDatabase *db, LibmsiView **view, const WCHAR *name ); +unsigned drop_view_create( LibmsiDatabase *db, LibmsiView **view, const WCHAR *name ); -int sqliteGetToken(const WCHAR *z, int *tokenType, int *skip); +int sql_get_token(const WCHAR *z, int *tokenType, int *skip); LibmsiRecord *msi_query_merge_record( unsigned fields, const column_info *vl, LibmsiRecord *rec ); diff --git a/libmsi/record.c b/libmsi/record.c index 0d3405f..046df72 100644 --- a/libmsi/record.c +++ b/libmsi/record.c @@ -44,7 +44,7 @@ #define LIBMSI_FIELD_TYPE_STREAM 4 #define LIBMSI_FIELD_TYPE_INTPTR 5 -static void MSI_FreeField( LibmsiField *field ) +static void _libmsi_free_field( LibmsiField *field ) { switch( field->type ) { @@ -63,16 +63,16 @@ static void MSI_FreeField( LibmsiField *field ) } } -void MSI_CloseRecord( LibmsiObject *arg ) +void _libmsi_record_destroy( LibmsiObject *arg ) { LibmsiRecord *rec = (LibmsiRecord *) arg; unsigned i; for( i=0; i<=rec->count; i++ ) - MSI_FreeField( &rec->fields[i] ); + _libmsi_free_field( &rec->fields[i] ); } -LibmsiRecord *MsiCreateRecord( unsigned cParams ) +LibmsiRecord *libmsi_record_create( unsigned cParams ) { LibmsiRecord *rec; unsigned len; @@ -83,13 +83,13 @@ LibmsiRecord *MsiCreateRecord( unsigned cParams ) return NULL; len = sizeof (LibmsiRecord) + sizeof (LibmsiField)*cParams; - rec = alloc_msiobject( len, MSI_CloseRecord ); + rec = alloc_msiobject( len, _libmsi_record_destroy ); if( rec ) rec->count = cParams; return rec; } -unsigned MsiRecordGetFieldCount( const LibmsiRecord *rec ) +unsigned libmsi_record_get_field_count( const LibmsiRecord *rec ) { if( !rec ) return -1; @@ -97,7 +97,7 @@ unsigned MsiRecordGetFieldCount( const LibmsiRecord *rec ) return rec->count; } -static bool string2intW( const WCHAR *str, int *out ) +static bool expr_int_from_string( const WCHAR *str, int *out ) { int x = 0; const WCHAR *p = str; @@ -120,7 +120,7 @@ static bool string2intW( const WCHAR *str, int *out ) return true; } -unsigned MSI_RecordCopyField( LibmsiRecord *in_rec, unsigned in_n, +unsigned _libmsi_record_copy_field( LibmsiRecord *in_rec, unsigned in_n, LibmsiRecord *out_rec, unsigned out_n ) { unsigned r = ERROR_SUCCESS; @@ -166,7 +166,7 @@ unsigned MSI_RecordCopyField( LibmsiRecord *in_rec, unsigned in_n, return r; } -intptr_t MSI_RecordGetIntPtr( const LibmsiRecord *rec, unsigned iField ) +intptr_t _libmsi_record_get_int_ptr( const LibmsiRecord *rec, unsigned iField ) { int ret; @@ -182,7 +182,7 @@ intptr_t MSI_RecordGetIntPtr( const LibmsiRecord *rec, unsigned iField ) case LIBMSI_FIELD_TYPE_INTPTR: return rec->fields[iField].u.pVal; case LIBMSI_FIELD_TYPE_WSTR: - if( string2intW( rec->fields[iField].u.szwVal, &ret ) ) + if( expr_int_from_string( rec->fields[iField].u.szwVal, &ret ) ) return ret; return INTPTR_MIN; default: @@ -192,7 +192,7 @@ intptr_t MSI_RecordGetIntPtr( const LibmsiRecord *rec, unsigned iField ) return INTPTR_MIN; } -int MsiRecordGetInteger( const LibmsiRecord *rec, unsigned iField) +int libmsi_record_get_integer( const LibmsiRecord *rec, unsigned iField) { int ret = 0; @@ -211,7 +211,7 @@ int MsiRecordGetInteger( const LibmsiRecord *rec, unsigned iField) case LIBMSI_FIELD_TYPE_INTPTR: return rec->fields[iField].u.pVal; case LIBMSI_FIELD_TYPE_WSTR: - if( string2intW( rec->fields[iField].u.szwVal, &ret ) ) + if( expr_int_from_string( rec->fields[iField].u.szwVal, &ret ) ) return ret; return MSI_NULL_INTEGER; default: @@ -221,7 +221,7 @@ int MsiRecordGetInteger( const LibmsiRecord *rec, unsigned iField) return MSI_NULL_INTEGER; } -unsigned MsiRecordClearData( LibmsiRecord *rec ) +unsigned libmsi_record_clear_data( LibmsiRecord *rec ) { unsigned i; @@ -233,7 +233,7 @@ unsigned MsiRecordClearData( LibmsiRecord *rec ) msiobj_addref( &rec->hdr ); for( i=0; i<=rec->count; i++) { - MSI_FreeField( &rec->fields[i] ); + _libmsi_free_field( &rec->fields[i] ); rec->fields[i].type = LIBMSI_FIELD_TYPE_NULL; rec->fields[i].u.iVal = 0; } @@ -242,21 +242,21 @@ unsigned MsiRecordClearData( LibmsiRecord *rec ) return ERROR_SUCCESS; } -unsigned MSI_RecordSetIntPtr( LibmsiRecord *rec, unsigned iField, intptr_t pVal ) +unsigned _libmsi_record_set_int_ptr( LibmsiRecord *rec, unsigned iField, intptr_t pVal ) { TRACE("%p %u %ld\n", rec, iField, pVal); if( iField > rec->count ) return ERROR_INVALID_PARAMETER; - MSI_FreeField( &rec->fields[iField] ); + _libmsi_free_field( &rec->fields[iField] ); rec->fields[iField].type = LIBMSI_FIELD_TYPE_INTPTR; rec->fields[iField].u.pVal = pVal; return ERROR_SUCCESS; } -unsigned MsiRecordSetInteger( LibmsiRecord *rec, unsigned iField, int iVal ) +unsigned libmsi_record_set_int( LibmsiRecord *rec, unsigned iField, int iVal ) { TRACE("%p %u %d\n", rec, iField, iVal); @@ -266,14 +266,14 @@ unsigned MsiRecordSetInteger( LibmsiRecord *rec, unsigned iField, int iVal ) if( iField > rec->count ) return ERROR_INVALID_PARAMETER; - MSI_FreeField( &rec->fields[iField] ); + _libmsi_free_field( &rec->fields[iField] ); rec->fields[iField].type = LIBMSI_FIELD_TYPE_INT; rec->fields[iField].u.iVal = iVal; return ERROR_SUCCESS; } -bool MsiRecordIsNull( const LibmsiRecord *rec, unsigned iField ) +bool libmsi_record_is_null( const LibmsiRecord *rec, unsigned iField ) { bool r = true; @@ -288,7 +288,7 @@ bool MsiRecordIsNull( const LibmsiRecord *rec, unsigned iField ) return r; } -unsigned MsiRecordGetString(const LibmsiRecord *rec, unsigned iField, +unsigned libmsi_record_get_string(const LibmsiRecord *rec, unsigned iField, char *szValue, unsigned *pcchValue) { unsigned len=0, ret; @@ -344,7 +344,7 @@ unsigned MsiRecordGetString(const LibmsiRecord *rec, unsigned iField, return ret; } -const WCHAR *MSI_RecordGetStringRaw( const LibmsiRecord *rec, unsigned iField ) +const WCHAR *_libmsi_record_get_string_raw( const LibmsiRecord *rec, unsigned iField ) { if( iField > rec->count ) return NULL; @@ -355,7 +355,7 @@ const WCHAR *MSI_RecordGetStringRaw( const LibmsiRecord *rec, unsigned iField ) return rec->fields[iField].u.szwVal; } -unsigned MSI_RecordGetStringW(const LibmsiRecord *rec, unsigned iField, +unsigned _libmsi_record_get_stringW(const LibmsiRecord *rec, unsigned iField, WCHAR *szValue, unsigned *pcchValue) { unsigned len=0, ret; @@ -413,7 +413,7 @@ static unsigned msi_get_stream_size( IStream *stm ) return stat.cbSize.QuadPart; } -unsigned MsiRecordDataSize(const LibmsiRecord *rec, unsigned iField) +unsigned libmsi_record_get_field_size(const LibmsiRecord *rec, unsigned iField) { TRACE("%p %d\n", rec, iField); @@ -437,7 +437,7 @@ unsigned MsiRecordDataSize(const LibmsiRecord *rec, unsigned iField) return 0; } -unsigned MsiRecordSetString( LibmsiRecord *rec, unsigned iField, const char *szValue ) +unsigned libmsi_record_set_string( LibmsiRecord *rec, unsigned iField, const char *szValue ) { WCHAR *str; @@ -447,10 +447,10 @@ unsigned MsiRecordSetString( LibmsiRecord *rec, unsigned iField, const char *szV return ERROR_INVALID_HANDLE; str = strdupAtoW( szValue ); - return MSI_RecordSetStringW( rec, iField, str ); + return _libmsi_record_set_stringW( rec, iField, str ); } -unsigned MSI_RecordSetStringW( LibmsiRecord *rec, unsigned iField, const WCHAR *szValue ) +unsigned _libmsi_record_set_stringW( LibmsiRecord *rec, unsigned iField, const WCHAR *szValue ) { WCHAR *str; @@ -459,7 +459,7 @@ unsigned MSI_RecordSetStringW( LibmsiRecord *rec, unsigned iField, const WCHAR * if( iField > rec->count ) return ERROR_INVALID_FIELD; - MSI_FreeField( &rec->fields[iField] ); + _libmsi_free_field( &rec->fields[iField] ); if( szValue && szValue[0] ) { @@ -477,7 +477,7 @@ unsigned MSI_RecordSetStringW( LibmsiRecord *rec, unsigned iField, const WCHAR * } /* read the data in a file into an IStream */ -static unsigned RECORD_StreamFromFile(const char *szFile, IStream **pstm) +static unsigned _libmsi_addstream_from_file(const char *szFile, IStream **pstm) { unsigned sz, szHighWord = 0, read; HANDLE handle; @@ -526,19 +526,19 @@ static unsigned RECORD_StreamFromFile(const char *szFile, IStream **pstm) return ERROR_SUCCESS; } -unsigned MSI_RecordSetStream(LibmsiRecord *rec, unsigned iField, IStream *stream) +unsigned _libmsi_record_load_stream(LibmsiRecord *rec, unsigned iField, IStream *stream) { if ( (iField == 0) || (iField > rec->count) ) return ERROR_INVALID_PARAMETER; - MSI_FreeField( &rec->fields[iField] ); + _libmsi_free_field( &rec->fields[iField] ); rec->fields[iField].type = LIBMSI_FIELD_TYPE_STREAM; rec->fields[iField].u.stream = stream; return ERROR_SUCCESS; } -unsigned MSI_RecordSetStreamFromFile(LibmsiRecord *rec, unsigned iField, const char *szFilename) +unsigned _libmsi_record_load_stream_from_file(LibmsiRecord *rec, unsigned iField, const char *szFilename) { IStream *stm = NULL; HRESULT r; @@ -567,18 +567,18 @@ unsigned MSI_RecordSetStreamFromFile(LibmsiRecord *rec, unsigned iField, const c else { /* read the file into a stream and save the stream in the record */ - r = RECORD_StreamFromFile(szFilename, &stm); + r = _libmsi_addstream_from_file(szFilename, &stm); if( r != ERROR_SUCCESS ) return r; /* if all's good, store it in the record */ - MSI_RecordSetStream(rec, iField, stm); + _libmsi_record_load_stream(rec, iField, stm); } return ERROR_SUCCESS; } -unsigned MsiRecordSetStream(LibmsiRecord *rec, unsigned iField, const char *szFilename) +unsigned libmsi_record_load_stream(LibmsiRecord *rec, unsigned iField, const char *szFilename) { unsigned ret; @@ -588,12 +588,12 @@ unsigned MsiRecordSetStream(LibmsiRecord *rec, unsigned iField, const char *szFi return ERROR_INVALID_HANDLE; msiobj_addref( &rec->hdr ); - ret = MSI_RecordSetStreamFromFile( rec, iField, szFilename ); + ret = _libmsi_record_load_stream_from_file( rec, iField, szFilename ); msiobj_release( &rec->hdr ); return ret; } -unsigned MSI_RecordReadStream(const LibmsiRecord *rec, unsigned iField, char *buf, unsigned *sz) +unsigned _libmsi_record_save_stream(const LibmsiRecord *rec, unsigned iField, char *buf, unsigned *sz) { unsigned count; HRESULT r; @@ -651,7 +651,7 @@ unsigned MSI_RecordReadStream(const LibmsiRecord *rec, unsigned iField, char *bu return ERROR_SUCCESS; } -unsigned MsiRecordReadStream(LibmsiRecord *rec, unsigned iField, char *buf, unsigned *sz) +unsigned libmsi_record_save_stream(LibmsiRecord *rec, unsigned iField, char *buf, unsigned *sz) { unsigned ret; @@ -661,19 +661,19 @@ unsigned MsiRecordReadStream(LibmsiRecord *rec, unsigned iField, char *buf, unsi return ERROR_INVALID_HANDLE; msiobj_addref( &rec->hdr ); - ret = MSI_RecordReadStream( rec, iField, buf, sz ); + ret = _libmsi_record_save_stream( rec, iField, buf, sz ); msiobj_release( &rec->hdr ); return ret; } -unsigned MSI_RecordSetIStream( LibmsiRecord *rec, unsigned iField, IStream *stm ) +unsigned _libmsi_record_set_IStream( LibmsiRecord *rec, unsigned iField, IStream *stm ) { TRACE("%p %d %p\n", rec, iField, stm); if( iField > rec->count ) return ERROR_INVALID_FIELD; - MSI_FreeField( &rec->fields[iField] ); + _libmsi_free_field( &rec->fields[iField] ); rec->fields[iField].type = LIBMSI_FIELD_TYPE_STREAM; rec->fields[iField].u.stream = stm; @@ -682,7 +682,7 @@ unsigned MSI_RecordSetIStream( LibmsiRecord *rec, unsigned iField, IStream *stm return ERROR_SUCCESS; } -unsigned MSI_RecordGetIStream( const LibmsiRecord *rec, unsigned iField, IStream **pstm) +unsigned _libmsi_record_get_IStream( const LibmsiRecord *rec, unsigned iField, IStream **pstm) { TRACE("%p %d %p\n", rec, iField, pstm); @@ -730,14 +730,14 @@ end: return ERROR_SUCCESS; } -unsigned MSI_RecordStreamToFile( const LibmsiRecord *rec, unsigned iField, const WCHAR *name ) +unsigned _libmsi_record_save_stream_to_file( const LibmsiRecord *rec, unsigned iField, const WCHAR *name ) { IStream *stm = NULL; unsigned r; TRACE("%p %u %s\n", rec, iField, debugstr_w(name)); - r = MSI_RecordGetIStream( rec, iField, &stm ); + r = _libmsi_record_get_IStream( rec, iField, &stm ); if( r == ERROR_SUCCESS ) { r = msi_dump_stream_to_file( stm, name ); @@ -747,13 +747,13 @@ unsigned MSI_RecordStreamToFile( const LibmsiRecord *rec, unsigned iField, const return r; } -LibmsiRecord *MSI_CloneRecord(LibmsiRecord *rec) +LibmsiRecord *_libmsi_record_clone(LibmsiRecord *rec) { LibmsiRecord *clone; unsigned r, i, count; - count = MsiRecordGetFieldCount(rec); - clone = MsiCreateRecord(count); + count = libmsi_record_get_field_count(rec); + clone = libmsi_record_create(count); if (!clone) return NULL; @@ -771,7 +771,7 @@ LibmsiRecord *MSI_CloneRecord(LibmsiRecord *rec) } else { - r = MSI_RecordCopyField(rec, i, clone, i); + r = _libmsi_record_copy_field(rec, i, clone, i); if (r != ERROR_SUCCESS) { msiobj_release(&clone->hdr); @@ -783,7 +783,7 @@ LibmsiRecord *MSI_CloneRecord(LibmsiRecord *rec) return clone; } -bool MSI_RecordsAreFieldsEqual(const LibmsiRecord *a, const LibmsiRecord *b, unsigned field) +bool _libmsi_record_compare_fields(const LibmsiRecord *a, const LibmsiRecord *b, unsigned field) { if (a->fields[field].type != b->fields[field].type) return false; @@ -811,7 +811,7 @@ bool MSI_RecordsAreFieldsEqual(const LibmsiRecord *a, const LibmsiRecord *b, uns } -bool MSI_RecordsAreEqual(const LibmsiRecord *a, const LibmsiRecord *b) +bool _libmsi_record_compare(const LibmsiRecord *a, const LibmsiRecord *b) { unsigned i; @@ -820,7 +820,7 @@ bool MSI_RecordsAreEqual(const LibmsiRecord *a, const LibmsiRecord *b) for (i = 0; i <= a->count; i++) { - if (!MSI_RecordsAreFieldsEqual( a, b, i )) + if (!_libmsi_record_compare_fields( a, b, i )) return false; } @@ -833,9 +833,9 @@ WCHAR *msi_dup_record_field( LibmsiRecord *rec, int field ) WCHAR *str; unsigned r; - if (MsiRecordIsNull( rec, field )) return NULL; + if (libmsi_record_is_null( rec, field )) return NULL; - r = MSI_RecordGetStringW( rec, field, NULL, &sz ); + r = _libmsi_record_get_stringW( rec, field, NULL, &sz ); if (r != ERROR_SUCCESS) return NULL; @@ -843,7 +843,7 @@ WCHAR *msi_dup_record_field( LibmsiRecord *rec, int field ) str = msi_alloc( sz * sizeof(WCHAR) ); if (!str) return NULL; str[0] = 0; - r = MSI_RecordGetStringW( rec, field, str, &sz ); + r = _libmsi_record_get_stringW( rec, field, str, &sz ); if (r != ERROR_SUCCESS) { ERR("failed to get string!\n"); diff --git a/libmsi/select.c b/libmsi/select.c index 2cff2d7..641faa9 100644 --- a/libmsi/select.c +++ b/libmsi/select.c @@ -46,7 +46,7 @@ typedef struct LibmsiSelectView unsigned cols[1]; } LibmsiSelectView; -static unsigned SELECT_fetch_int( LibmsiView *view, unsigned row, unsigned col, unsigned *val ) +static unsigned select_view_fetch_int( LibmsiView *view, unsigned row, unsigned col, unsigned *val ) { LibmsiSelectView *sv = (LibmsiSelectView*)view; @@ -67,7 +67,7 @@ static unsigned SELECT_fetch_int( LibmsiView *view, unsigned row, unsigned col, return sv->table->ops->fetch_int( sv->table, row, col, val ); } -static unsigned SELECT_fetch_stream( LibmsiView *view, unsigned row, unsigned col, IStream **stm) +static unsigned select_view_fetch_stream( LibmsiView *view, unsigned row, unsigned col, IStream **stm) { LibmsiSelectView *sv = (LibmsiSelectView*)view; @@ -88,7 +88,7 @@ static unsigned SELECT_fetch_stream( LibmsiView *view, unsigned row, unsigned co return sv->table->ops->fetch_stream( sv->table, row, col, stm ); } -static unsigned SELECT_get_row( LibmsiView *view, unsigned row, LibmsiRecord **rec ) +static unsigned select_view_get_row( LibmsiView *view, unsigned row, LibmsiRecord **rec ) { LibmsiSelectView *sv = (LibmsiSelectView *)view; @@ -100,7 +100,7 @@ static unsigned SELECT_get_row( LibmsiView *view, unsigned row, LibmsiRecord **r return msi_view_get_row(sv->db, view, row, rec); } -static unsigned SELECT_set_row( LibmsiView *view, unsigned row, LibmsiRecord *rec, unsigned mask ) +static unsigned select_view_set_row( LibmsiView *view, unsigned row, LibmsiRecord *rec, unsigned mask ) { LibmsiSelectView *sv = (LibmsiSelectView*)view; unsigned i, expanded_mask = 0, r = ERROR_SUCCESS, col_count = 0; @@ -121,14 +121,14 @@ static unsigned SELECT_set_row( LibmsiView *view, unsigned row, LibmsiRecord *re return r; /* expand the record to the right size for the underlying table */ - expanded = MsiCreateRecord( col_count ); + expanded = libmsi_record_create( col_count ); if ( !expanded ) return ERROR_FUNCTION_FAILED; /* move the right fields across */ for ( i=0; i<sv->num_cols; i++ ) { - r = MSI_RecordCopyField( rec, i+1, expanded, sv->cols[ i ] ); + r = _libmsi_record_copy_field( rec, i+1, expanded, sv->cols[ i ] ); if (r != ERROR_SUCCESS) break; expanded_mask |= (1<<(sv->cols[i]-1)); @@ -142,7 +142,7 @@ static unsigned SELECT_set_row( LibmsiView *view, unsigned row, LibmsiRecord *re return r; } -static unsigned SELECT_insert_row( LibmsiView *view, LibmsiRecord *record, unsigned row, bool temporary ) +static unsigned select_view_insert_row( LibmsiView *view, LibmsiRecord *record, unsigned row, bool temporary ) { LibmsiSelectView *sv = (LibmsiSelectView*)view; unsigned i, table_cols, r; @@ -158,11 +158,11 @@ static unsigned SELECT_insert_row( LibmsiView *view, LibmsiRecord *record, unsig if (r != ERROR_SUCCESS) return r; - outrec = MsiCreateRecord( table_cols + 1 ); + outrec = libmsi_record_create( table_cols + 1 ); for (i=0; i<sv->num_cols; i++) { - r = MSI_RecordCopyField( record, i+1, outrec, sv->cols[i] ); + r = _libmsi_record_copy_field( record, i+1, outrec, sv->cols[i] ); if (r != ERROR_SUCCESS) goto fail; } @@ -175,7 +175,7 @@ fail: return r; } -static unsigned SELECT_execute( LibmsiView *view, LibmsiRecord *record ) +static unsigned select_view_execute( LibmsiView *view, LibmsiRecord *record ) { LibmsiSelectView *sv = (LibmsiSelectView*)view; @@ -187,7 +187,7 @@ static unsigned SELECT_execute( LibmsiView *view, LibmsiRecord *record ) return sv->table->ops->execute( sv->table, record ); } -static unsigned SELECT_close( LibmsiView *view ) +static unsigned select_view_close( LibmsiView *view ) { LibmsiSelectView *sv = (LibmsiSelectView*)view; @@ -199,7 +199,7 @@ static unsigned SELECT_close( LibmsiView *view ) return sv->table->ops->close( sv->table ); } -static unsigned SELECT_get_dimensions( LibmsiView *view, unsigned *rows, unsigned *cols ) +static unsigned select_view_get_dimensions( LibmsiView *view, unsigned *rows, unsigned *cols ) { LibmsiSelectView *sv = (LibmsiSelectView*)view; @@ -214,7 +214,7 @@ static unsigned SELECT_get_dimensions( LibmsiView *view, unsigned *rows, unsigne return sv->table->ops->get_dimensions( sv->table, rows, NULL ); } -static unsigned SELECT_get_column_info( LibmsiView *view, unsigned n, const WCHAR **name, +static unsigned select_view_get_column_info( LibmsiView *view, unsigned n, const WCHAR **name, unsigned *type, bool *temporary, const WCHAR **table_name ) { LibmsiSelectView *sv = (LibmsiSelectView*)view; @@ -247,7 +247,7 @@ static unsigned msi_select_update(LibmsiView *view, LibmsiRecord *rec, unsigned const WCHAR *str; LibmsiRecord *mod; - r = SELECT_get_dimensions(view, NULL, &num_columns); + r = select_view_get_dimensions(view, NULL, &num_columns); if (r != ERROR_SUCCESS) return r; @@ -259,7 +259,7 @@ static unsigned msi_select_update(LibmsiView *view, LibmsiRecord *rec, unsigned { col = sv->cols[i]; - r = SELECT_get_column_info(view, i + 1, NULL, &type, NULL, NULL); + r = select_view_get_column_info(view, i + 1, NULL, &type, NULL, NULL); if (r != ERROR_SUCCESS) { ERR("Failed to get column information: %d\n", r); @@ -274,13 +274,13 @@ static unsigned msi_select_update(LibmsiView *view, LibmsiRecord *rec, unsigned } else if (type & MSITYPE_STRING) { - str = MSI_RecordGetStringRaw(rec, i + 1); - r = MSI_RecordSetStringW(mod, col, str); + str = _libmsi_record_get_string_raw(rec, i + 1); + r = _libmsi_record_set_stringW(mod, col, str); } else { - val = MsiRecordGetInteger(rec, i + 1); - r = MsiRecordSetInteger(mod, col, val); + val = libmsi_record_get_integer(rec, i + 1); + r = libmsi_record_set_int(mod, col, val); } if (r != ERROR_SUCCESS) @@ -297,7 +297,7 @@ done: return r; } -static unsigned SELECT_modify( LibmsiView *view, LibmsiModify eModifyMode, +static unsigned select_view_modify( LibmsiView *view, LibmsiModify eModifyMode, LibmsiRecord *rec, unsigned row ) { LibmsiSelectView *sv = (LibmsiSelectView*)view; @@ -313,7 +313,7 @@ static unsigned SELECT_modify( LibmsiView *view, LibmsiModify eModifyMode, return sv->table->ops->modify( sv->table, eModifyMode, rec, row ); } -static unsigned SELECT_delete( LibmsiView *view ) +static unsigned select_view_delete( LibmsiView *view ) { LibmsiSelectView *sv = (LibmsiSelectView*)view; @@ -328,7 +328,7 @@ static unsigned SELECT_delete( LibmsiView *view ) return ERROR_SUCCESS; } -static unsigned SELECT_find_matching_rows( LibmsiView *view, unsigned col, +static unsigned select_view_find_matching_rows( LibmsiView *view, unsigned col, unsigned val, unsigned *row, MSIITERHANDLE *handle ) { LibmsiSelectView *sv = (LibmsiSelectView*)view; @@ -347,21 +347,21 @@ static unsigned SELECT_find_matching_rows( LibmsiView *view, unsigned col, } -static const LibmsiViewOPS select_ops = +static const LibmsiViewOps select_ops = { - SELECT_fetch_int, - SELECT_fetch_stream, - SELECT_get_row, - SELECT_set_row, - SELECT_insert_row, + select_view_fetch_int, + select_view_fetch_stream, + select_view_get_row, + select_view_set_row, + select_view_insert_row, NULL, - SELECT_execute, - SELECT_close, - SELECT_get_dimensions, - SELECT_get_column_info, - SELECT_modify, - SELECT_delete, - SELECT_find_matching_rows, + select_view_execute, + select_view_close, + select_view_get_dimensions, + select_view_get_column_info, + select_view_modify, + select_view_delete, + select_view_find_matching_rows, NULL, NULL, NULL, @@ -370,7 +370,7 @@ static const LibmsiViewOPS select_ops = NULL, }; -static unsigned SELECT_AddColumn( LibmsiSelectView *sv, const WCHAR *name, +static unsigned select_view_add_column( LibmsiSelectView *sv, const WCHAR *name, const WCHAR *table_name ) { unsigned r, n; @@ -396,7 +396,7 @@ static unsigned SELECT_AddColumn( LibmsiSelectView *sv, const WCHAR *name, if ( !name[0] ) n = 0; else { - r = VIEW_find_column( table, name, table_name, &n ); + r = _libmsi_view_find_column( table, name, table_name, &n ); if( r != ERROR_SUCCESS ) return r; } @@ -418,7 +418,7 @@ static int select_count_columns( const column_info *col ) return n; } -unsigned SELECT_CreateView( LibmsiDatabase *db, LibmsiView **view, LibmsiView *table, +unsigned select_view_create( LibmsiDatabase *db, LibmsiView **view, LibmsiView *table, const column_info *columns ) { LibmsiSelectView *sv = NULL; @@ -441,7 +441,7 @@ unsigned SELECT_CreateView( LibmsiDatabase *db, LibmsiView **view, LibmsiView *t while( columns ) { - r = SELECT_AddColumn( sv, columns->column, columns->table ); + r = select_view_add_column( sv, columns->column, columns->table ); if( r ) break; columns = columns->next; diff --git a/libmsi/sql-parser.y b/libmsi/sql-parser.y index 531caf9..9fef336 100644 --- a/libmsi/sql-parser.y +++ b/libmsi/sql-parser.y @@ -53,22 +53,22 @@ typedef struct LibmsiSQLInput struct list *mem; } SQL_input; -static unsigned SQL_getstring( void *info, const struct sql_str *strdata, WCHAR **str ); -static INT SQL_getint( void *info ); +static unsigned sql_unescape_string( void *info, const struct sql_str *strdata, WCHAR **str ); +static INT sql_atoi( void *info ); static int sql_lex( void *SQL_lval, SQL_input *info ); static WCHAR *parser_add_table( void *info, const WCHAR *list, const WCHAR *table ); static void *parser_alloc( void *info, unsigned int sz ); static column_info *parser_alloc_column( void *info, const WCHAR *table, const WCHAR *column ); -static bool SQL_MarkPrimaryKeys( column_info **cols, column_info *keys); +static bool sql_mark_primary_keys( column_info **cols, column_info *keys); -static struct expr * EXPR_complex( void *info, struct expr *l, unsigned op, struct expr *r ); -static struct expr * EXPR_unary( void *info, struct expr *l, unsigned op ); -static struct expr * EXPR_column( void *info, const column_info *column ); -static struct expr * EXPR_ival( void *info, int val ); -static struct expr * EXPR_sval( void *info, const struct sql_str *str ); -static struct expr * EXPR_wildcard( void *info ); +static struct expr * build_expr_complex( void *info, struct expr *l, unsigned op, struct expr *r ); +static struct expr * build_expr_unary( void *info, struct expr *l, unsigned op ); +static struct expr * build_expr_column( void *info, const column_info *column ); +static struct expr * build_expr_ival( void *info, int val ); +static struct expr * build_expr_sval( void *info, const struct sql_str *str ); +static struct expr * build_expr_wildcard( void *info ); #define PARSER_BUBBLE_UP_VIEW( sql, result, current_view ) \ *sql->view = current_view; \ @@ -152,7 +152,7 @@ oneinsert: SQL_input *sql = (SQL_input*) info; LibmsiView *insert = NULL; - INSERT_CreateView( sql->db, &insert, $3, $5, $9, false ); + insert_view_create( sql->db, &insert, $3, $5, $9, false ); if( !insert ) YYABORT; @@ -163,7 +163,7 @@ oneinsert: SQL_input *sql = (SQL_input*) info; LibmsiView *insert = NULL; - INSERT_CreateView( sql->db, &insert, $3, $5, $9, true ); + insert_view_create( sql->db, &insert, $3, $5, $9, true ); if( !insert ) YYABORT; @@ -180,7 +180,7 @@ onecreate: if( !$5 ) YYABORT; - r = CREATE_CreateView( sql->db, &create, $3, $5, false ); + r = create_view_create( sql->db, &create, $3, $5, false ); if( !create ) { sql->r = r; @@ -196,7 +196,7 @@ onecreate: if( !$5 ) YYABORT; - CREATE_CreateView( sql->db, &create, $3, $5, true ); + create_view_create( sql->db, &create, $3, $5, true ); if( !create ) YYABORT; @@ -210,7 +210,7 @@ oneupdate: SQL_input* sql = (SQL_input*) info; LibmsiView *update = NULL; - UPDATE_CreateView( sql->db, &update, $2, $4, $6 ); + update_view_create( sql->db, &update, $2, $4, $6 ); if( !update ) YYABORT; @@ -221,7 +221,7 @@ oneupdate: SQL_input* sql = (SQL_input*) info; LibmsiView *update = NULL; - UPDATE_CreateView( sql->db, &update, $2, $4, NULL ); + update_view_create( sql->db, &update, $2, $4, NULL ); if( !update ) YYABORT; @@ -235,7 +235,7 @@ onedelete: SQL_input* sql = (SQL_input*) info; LibmsiView *delete = NULL; - DELETE_CreateView( sql->db, &delete, $2 ); + delete_view_create( sql->db, &delete, $2 ); if( !delete ) YYABORT; @@ -249,7 +249,7 @@ onealter: SQL_input* sql = (SQL_input*) info; LibmsiView *alter = NULL; - ALTER_CreateView( sql->db, &alter, $3, NULL, $4 ); + alter_view_create( sql->db, &alter, $3, NULL, $4 ); if( !alter ) YYABORT; @@ -260,7 +260,7 @@ onealter: SQL_input *sql = (SQL_input *)info; LibmsiView *alter = NULL; - ALTER_CreateView( sql->db, &alter, $3, $5, 0 ); + alter_view_create( sql->db, &alter, $3, $5, 0 ); if (!alter) YYABORT; @@ -271,7 +271,7 @@ onealter: SQL_input *sql = (SQL_input *)info; LibmsiView *alter = NULL; - ALTER_CreateView( sql->db, &alter, $3, $5, 1 ); + alter_view_create( sql->db, &alter, $3, $5, 1 ); if (!alter) YYABORT; @@ -297,7 +297,7 @@ onedrop: LibmsiView* drop = NULL; unsigned r; - r = DROP_CreateView( sql->db, &drop, $3 ); + r = drop_view_create( sql->db, &drop, $3 ); if( r != ERROR_SUCCESS || !$$ ) YYABORT; @@ -308,7 +308,7 @@ onedrop: table_def: column_def TK_PRIMARY TK_KEY collist { - if( SQL_MarkPrimaryKeys( &$1, $4 ) ) + if( sql_mark_primary_keys( &$1, $4 ) ) $$ = $1; else $$ = NULL; @@ -418,7 +418,7 @@ oneselect: LibmsiView* distinct = NULL; unsigned r; - r = DISTINCT_CreateView( sql->db, &distinct, $3 ); + r = distinct_view_create( sql->db, &distinct, $3 ); if (r != ERROR_SUCCESS) YYABORT; @@ -435,7 +435,7 @@ selectfrom: if( $1 ) { - r = SELECT_CreateView( sql->db, &select, $2, $1 ); + r = select_view_create( sql->db, &select, $2, $1 ); if (r != ERROR_SUCCESS) YYABORT; @@ -477,7 +477,7 @@ from: LibmsiView* table = NULL; unsigned r; - r = TABLE_CreateView( sql->db, $2, &table ); + r = table_view_create( sql->db, $2, &table ); if( r != ERROR_SUCCESS || !$$ ) YYABORT; @@ -506,7 +506,7 @@ unorderdfrom: LibmsiView* where = NULL; unsigned r; - r = WHERE_CreateView( sql->db, &where, $2, NULL ); + r = where_view_create( sql->db, &where, $2, NULL ); if( r != ERROR_SUCCESS ) YYABORT; @@ -518,7 +518,7 @@ unorderdfrom: LibmsiView* where = NULL; unsigned r; - r = WHERE_CreateView( sql->db, &where, $2, $4 ); + r = where_view_create( sql->db, &where, $2, $4 ); if( r != ERROR_SUCCESS ) YYABORT; @@ -548,61 +548,61 @@ expr: } | expr TK_AND expr { - $$ = EXPR_complex( info, $1, OP_AND, $3 ); + $$ = build_expr_complex( info, $1, OP_AND, $3 ); if( !$$ ) YYABORT; } | expr TK_OR expr { - $$ = EXPR_complex( info, $1, OP_OR, $3 ); + $$ = build_expr_complex( info, $1, OP_OR, $3 ); if( !$$ ) YYABORT; } | column_val TK_EQ val { - $$ = EXPR_complex( info, $1, OP_EQ, $3 ); + $$ = build_expr_complex( info, $1, OP_EQ, $3 ); if( !$$ ) YYABORT; } | column_val TK_GT val { - $$ = EXPR_complex( info, $1, OP_GT, $3 ); + $$ = build_expr_complex( info, $1, OP_GT, $3 ); if( !$$ ) YYABORT; } | column_val TK_LT val { - $$ = EXPR_complex( info, $1, OP_LT, $3 ); + $$ = build_expr_complex( info, $1, OP_LT, $3 ); if( !$$ ) YYABORT; } | column_val TK_LE val { - $$ = EXPR_complex( info, $1, OP_LE, $3 ); + $$ = build_expr_complex( info, $1, OP_LE, $3 ); if( !$$ ) YYABORT; } | column_val TK_GE val { - $$ = EXPR_complex( info, $1, OP_GE, $3 ); + $$ = build_expr_complex( info, $1, OP_GE, $3 ); if( !$$ ) YYABORT; } | column_val TK_NE val { - $$ = EXPR_complex( info, $1, OP_NE, $3 ); + $$ = build_expr_complex( info, $1, OP_NE, $3 ); if( !$$ ) YYABORT; } | column_val TK_IS TK_NULL { - $$ = EXPR_unary( info, $1, OP_ISNULL ); + $$ = build_expr_unary( info, $1, OP_ISNULL ); if( !$$ ) YYABORT; } | column_val TK_IS TK_NOT TK_NULL { - $$ = EXPR_unary( info, $1, OP_NOTNULL ); + $$ = build_expr_unary( info, $1, OP_NOTNULL ); if( !$$ ) YYABORT; } @@ -651,25 +651,25 @@ column_assignment: const_val: number { - $$ = EXPR_ival( info, $1 ); + $$ = build_expr_ival( info, $1 ); if( !$$ ) YYABORT; } | TK_MINUS number %prec TK_NEGATION { - $$ = EXPR_ival( info, -$2 ); + $$ = build_expr_ival( info, -$2 ); if( !$$ ) YYABORT; } | TK_STRING { - $$ = EXPR_sval( info, &$1 ); + $$ = build_expr_sval( info, &$1 ); if( !$$ ) YYABORT; } | TK_WILDCARD { - $$ = EXPR_wildcard( info ); + $$ = build_expr_wildcard( info ); if( !$$ ) YYABORT; } @@ -678,7 +678,7 @@ const_val: column_val: column { - $$ = EXPR_column( info, $1 ); + $$ = build_expr_column( info, $1 ); if( !$$ ) YYABORT; } @@ -730,7 +730,7 @@ table: id: TK_ID { - if ( SQL_getstring( info, &$1, &$$ ) != ERROR_SUCCESS || !$$ ) + if ( sql_unescape_string( info, &$1, &$$ ) != ERROR_SUCCESS || !$$ ) YYABORT; } ; @@ -738,7 +738,7 @@ id: string: TK_STRING { - if ( SQL_getstring( info, &$1, &$$ ) != ERROR_SUCCESS || !$$ ) + if ( sql_unescape_string( info, &$1, &$$ ) != ERROR_SUCCESS || !$$ ) YYABORT; } ; @@ -746,7 +746,7 @@ string: number: TK_INTEGER { - $$ = SQL_getint( info ); + $$ = sql_atoi( info ); } ; @@ -807,7 +807,7 @@ static int sql_lex( void *SQL_lval, SQL_input *sql ) return 0; /* end of input */ /* TRACE("string : %s\n", debugstr_w(&sql->command[sql->n])); */ - sql->len = sqliteGetToken( &sql->command[sql->n], &token, &skip ); + sql->len = sql_get_token( &sql->command[sql->n], &token, &skip ); if( sql->len==0 ) break; str->data = &sql->command[sql->n]; @@ -821,7 +821,7 @@ static int sql_lex( void *SQL_lval, SQL_input *sql ) return token; } -unsigned SQL_getstring( void *info, const struct sql_str *strdata, WCHAR **str ) +unsigned sql_unescape_string( void *info, const struct sql_str *strdata, WCHAR **str ) { const WCHAR *p = strdata->data; unsigned len = strdata->len; @@ -847,7 +847,7 @@ unsigned SQL_getstring( void *info, const struct sql_str *strdata, WCHAR **str ) return ERROR_SUCCESS; } -INT SQL_getint( void *info ) +INT sql_atoi( void *info ) { SQL_input* sql = (SQL_input*) info; const WCHAR *p = &sql->command[sql->n]; @@ -871,7 +871,7 @@ static int sql_error( const char *str ) return 0; } -static struct expr * EXPR_wildcard( void *info ) +static struct expr * build_expr_wildcard( void *info ) { struct expr *e = parser_alloc( info, sizeof *e ); if( e ) @@ -881,7 +881,7 @@ static struct expr * EXPR_wildcard( void *info ) return e; } -static struct expr * EXPR_complex( void *info, struct expr *l, unsigned op, struct expr *r ) +static struct expr * build_expr_complex( void *info, struct expr *l, unsigned op, struct expr *r ) { struct expr *e = parser_alloc( info, sizeof *e ); if( e ) @@ -894,7 +894,7 @@ static struct expr * EXPR_complex( void *info, struct expr *l, unsigned op, stru return e; } -static struct expr * EXPR_unary( void *info, struct expr *l, unsigned op ) +static struct expr * build_expr_unary( void *info, struct expr *l, unsigned op ) { struct expr *e = parser_alloc( info, sizeof *e ); if( e ) @@ -907,7 +907,7 @@ static struct expr * EXPR_unary( void *info, struct expr *l, unsigned op ) return e; } -static struct expr * EXPR_column( void *info, const column_info *column ) +static struct expr * build_expr_column( void *info, const column_info *column ) { struct expr *e = parser_alloc( info, sizeof *e ); if( e ) @@ -919,7 +919,7 @@ static struct expr * EXPR_column( void *info, const column_info *column ) return e; } -static struct expr * EXPR_ival( void *info, int val ) +static struct expr * build_expr_ival( void *info, int val ) { struct expr *e = parser_alloc( info, sizeof *e ); if( e ) @@ -930,13 +930,13 @@ static struct expr * EXPR_ival( void *info, int val ) return e; } -static struct expr * EXPR_sval( void *info, const struct sql_str *str ) +static struct expr * build_expr_sval( void *info, const struct sql_str *str ) { struct expr *e = parser_alloc( info, sizeof *e ); if( e ) { e->type = EXPR_SVAL; - if( SQL_getstring( info, str, (WCHAR **)&e->u.sval ) != ERROR_SUCCESS ) + if( sql_unescape_string( info, str, (WCHAR **)&e->u.sval ) != ERROR_SUCCESS ) return NULL; /* e will be freed by query destructor */ } return e; @@ -971,7 +971,7 @@ static void swap_columns( column_info **cols, column_info *A, int idx ) *cols = A; } -static bool SQL_MarkPrimaryKeys( column_info **cols, +static bool sql_mark_primary_keys( column_info **cols, column_info *keys ) { column_info *k; @@ -998,7 +998,7 @@ static bool SQL_MarkPrimaryKeys( column_info **cols, return found; } -unsigned MSI_ParseSQL( LibmsiDatabase *db, const WCHAR *command, LibmsiView **phview, +unsigned _libmsi_parse_sql( LibmsiDatabase *db, const WCHAR *command, LibmsiView **phview, struct list *mem ) { SQL_input sql; diff --git a/libmsi/storages.c b/libmsi/storages.c index f89e516..a6dc32f 100644 --- a/libmsi/storages.c +++ b/libmsi/storages.c @@ -74,7 +74,7 @@ static STORAGE *create_storage(LibmsiStorageView *sv, const WCHAR *name, IStorag if (!storage) return NULL; - storage->str_index = msi_addstringW(sv->db->strings, name, -1, 1, StringNonPersistent); + storage->str_index = _libmsi_add_string(sv->db->strings, name, -1, 1, StringNonPersistent); storage->storage = stg; if (storage->storage) @@ -83,7 +83,7 @@ static STORAGE *create_storage(LibmsiStorageView *sv, const WCHAR *name, IStorag return storage; } -static unsigned STORAGES_fetch_int(LibmsiView *view, unsigned row, unsigned col, unsigned *val) +static unsigned storages_view_fetch_int(LibmsiView *view, unsigned row, unsigned col, unsigned *val) { LibmsiStorageView *sv = (LibmsiStorageView *)view; @@ -100,7 +100,7 @@ static unsigned STORAGES_fetch_int(LibmsiView *view, unsigned row, unsigned col, return ERROR_SUCCESS; } -static unsigned STORAGES_fetch_stream(LibmsiView *view, unsigned row, unsigned col, IStream **stm) +static unsigned storages_view_fetch_stream(LibmsiView *view, unsigned row, unsigned col, IStream **stm) { LibmsiStorageView *sv = (LibmsiStorageView *)view; @@ -112,7 +112,7 @@ static unsigned STORAGES_fetch_stream(LibmsiView *view, unsigned row, unsigned c return ERROR_INVALID_DATA; } -static unsigned STORAGES_get_row( LibmsiView *view, unsigned row, LibmsiRecord **rec ) +static unsigned storages_view_get_row( LibmsiView *view, unsigned row, LibmsiRecord **rec ) { LibmsiStorageView *sv = (LibmsiStorageView *)view; @@ -170,7 +170,7 @@ done: return hr; } -static unsigned STORAGES_set_row(LibmsiView *view, unsigned row, LibmsiRecord *rec, unsigned mask) +static unsigned storages_view_set_row(LibmsiView *view, unsigned row, LibmsiRecord *rec, unsigned mask) { LibmsiStorageView *sv = (LibmsiStorageView *)view; IStorage *stg, *substg = NULL; @@ -184,7 +184,7 @@ static unsigned STORAGES_set_row(LibmsiView *view, unsigned row, LibmsiRecord *r if (row > sv->num_rows) return ERROR_FUNCTION_FAILED; - r = MSI_RecordGetIStream(rec, 2, &stm); + r = _libmsi_record_get_IStream(rec, 2, &stm); if (r != ERROR_SUCCESS) return r; @@ -195,7 +195,7 @@ static unsigned STORAGES_set_row(LibmsiView *view, unsigned row, LibmsiRecord *r return r; } - name = strdupW(MSI_RecordGetStringRaw(rec, 1)); + name = strdupW(_libmsi_record_get_string_raw(rec, 1)); if (!name) { r = ERROR_OUTOFMEMORY; @@ -232,7 +232,7 @@ done: return r; } -static unsigned STORAGES_insert_row(LibmsiView *view, LibmsiRecord *rec, unsigned row, bool temporary) +static unsigned storages_view_insert_row(LibmsiView *view, LibmsiRecord *rec, unsigned row, bool temporary) { LibmsiStorageView *sv = (LibmsiStorageView *)view; @@ -244,28 +244,28 @@ static unsigned STORAGES_insert_row(LibmsiView *view, LibmsiRecord *rec, unsigne /* FIXME have to readjust rows */ - return STORAGES_set_row(view, row, rec, 0); + return storages_view_set_row(view, row, rec, 0); } -static unsigned STORAGES_delete_row(LibmsiView *view, unsigned row) +static unsigned storages_view_delete_row(LibmsiView *view, unsigned row) { FIXME("(%p %d): stub!\n", view, row); return ERROR_SUCCESS; } -static unsigned STORAGES_execute(LibmsiView *view, LibmsiRecord *record) +static unsigned storages_view_execute(LibmsiView *view, LibmsiRecord *record) { TRACE("(%p, %p)\n", view, record); return ERROR_SUCCESS; } -static unsigned STORAGES_close(LibmsiView *view) +static unsigned storages_view_close(LibmsiView *view) { TRACE("(%p)\n", view); return ERROR_SUCCESS; } -static unsigned STORAGES_get_dimensions(LibmsiView *view, unsigned *rows, unsigned *cols) +static unsigned storages_view_get_dimensions(LibmsiView *view, unsigned *rows, unsigned *cols) { LibmsiStorageView *sv = (LibmsiStorageView *)view; @@ -277,7 +277,7 @@ static unsigned STORAGES_get_dimensions(LibmsiView *view, unsigned *rows, unsign return ERROR_SUCCESS; } -static unsigned STORAGES_get_column_info( LibmsiView *view, unsigned n, const WCHAR **name, +static unsigned storages_view_get_column_info( LibmsiView *view, unsigned n, const WCHAR **name, unsigned *type, bool *temporary, const WCHAR **table_name ) { TRACE("(%p, %d, %p, %p, %p, %p)\n", view, n, name, type, temporary, @@ -308,14 +308,14 @@ static unsigned storages_find_row(LibmsiStorageView *sv, LibmsiRecord *rec, unsi const WCHAR *str; unsigned r, i, id, data; - str = MSI_RecordGetStringRaw(rec, 1); - r = msi_string2idW(sv->db->strings, str, &id); + str = _libmsi_record_get_string_raw(rec, 1); + r = _libmsi_id_from_stringW(sv->db->strings, str, &id); if (r != ERROR_SUCCESS) return r; for (i = 0; i < sv->num_rows; i++) { - STORAGES_fetch_int(&sv->view, i, 1, &data); + storages_view_fetch_int(&sv->view, i, 1, &data); if (data == id) { @@ -336,7 +336,7 @@ static unsigned storages_modify_update(LibmsiView *view, LibmsiRecord *rec) if (r != ERROR_SUCCESS) return ERROR_FUNCTION_FAILED; - return STORAGES_set_row(view, row, rec, 0); + return storages_view_set_row(view, row, rec, 0); } static unsigned storages_modify_assign(LibmsiView *view, LibmsiRecord *rec) @@ -348,10 +348,10 @@ static unsigned storages_modify_assign(LibmsiView *view, LibmsiRecord *rec) if (r == ERROR_SUCCESS) return storages_modify_update(view, rec); - return STORAGES_insert_row(view, rec, -1, false); + return storages_view_insert_row(view, rec, -1, false); } -static unsigned STORAGES_modify(LibmsiView *view, LibmsiModify eModifyMode, LibmsiRecord *rec, unsigned row) +static unsigned storages_view_modify(LibmsiView *view, LibmsiModify eModifyMode, LibmsiRecord *rec, unsigned row) { unsigned r; @@ -364,7 +364,7 @@ static unsigned STORAGES_modify(LibmsiView *view, LibmsiModify eModifyMode, Libm break; case LIBMSI_MODIFY_INSERT: - r = STORAGES_insert_row(view, rec, -1, false); + r = storages_view_insert_row(view, rec, -1, false); break; case LIBMSI_MODIFY_UPDATE: @@ -391,7 +391,7 @@ static unsigned STORAGES_modify(LibmsiView *view, LibmsiModify eModifyMode, Libm return r; } -static unsigned STORAGES_delete(LibmsiView *view) +static unsigned storages_view_delete(LibmsiView *view) { LibmsiStorageView *sv = (LibmsiStorageView *)view; unsigned i; @@ -412,7 +412,7 @@ static unsigned STORAGES_delete(LibmsiView *view) return ERROR_SUCCESS; } -static unsigned STORAGES_find_matching_rows(LibmsiView *view, unsigned col, +static unsigned storages_view_find_matching_rows(LibmsiView *view, unsigned col, unsigned val, unsigned *row, MSIITERHANDLE *handle) { LibmsiStorageView *sv = (LibmsiStorageView *)view; @@ -441,21 +441,21 @@ static unsigned STORAGES_find_matching_rows(LibmsiView *view, unsigned col, return ERROR_SUCCESS; } -static const LibmsiViewOPS storages_ops = +static const LibmsiViewOps storages_ops = { - STORAGES_fetch_int, - STORAGES_fetch_stream, - STORAGES_get_row, - STORAGES_set_row, - STORAGES_insert_row, - STORAGES_delete_row, - STORAGES_execute, - STORAGES_close, - STORAGES_get_dimensions, - STORAGES_get_column_info, - STORAGES_modify, - STORAGES_delete, - STORAGES_find_matching_rows, + storages_view_fetch_int, + storages_view_fetch_stream, + storages_view_get_row, + storages_view_set_row, + storages_view_insert_row, + storages_view_delete_row, + storages_view_execute, + storages_view_close, + storages_view_get_dimensions, + storages_view_get_column_info, + storages_view_modify, + storages_view_delete, + storages_view_find_matching_rows, NULL, NULL, NULL, @@ -522,7 +522,7 @@ static int add_storages_to_table(LibmsiStorageView *sv) return count; } -unsigned STORAGES_CreateView(LibmsiDatabase *db, LibmsiView **view) +unsigned storages_view_create(LibmsiDatabase *db, LibmsiView **view) { LibmsiStorageView *sv; int rows; diff --git a/libmsi/streams.c b/libmsi/streams.c index e909afe..aee73e1 100644 --- a/libmsi/streams.c +++ b/libmsi/streams.c @@ -42,7 +42,7 @@ typedef struct tabSTREAM IStream *stream; } STREAM; -typedef struct LibmsiStreamSVIEW +typedef struct LibmsiStreamsView { LibmsiView view; LibmsiDatabase *db; @@ -50,9 +50,9 @@ typedef struct LibmsiStreamSVIEW unsigned max_streams; unsigned num_rows; unsigned row_size; -} LibmsiStreamSVIEW; +} LibmsiStreamsView; -static bool streams_set_table_size(LibmsiStreamSVIEW *sv, unsigned size) +static bool streams_set_table_size(LibmsiStreamsView *sv, unsigned size) { if (size >= sv->max_streams) { @@ -66,7 +66,7 @@ static bool streams_set_table_size(LibmsiStreamSVIEW *sv, unsigned size) return true; } -static STREAM *create_stream(LibmsiStreamSVIEW *sv, const WCHAR *name, bool encoded, IStream *stm) +static STREAM *create_stream(LibmsiStreamsView *sv, const WCHAR *name, bool encoded, IStream *stm) { STREAM *stream; WCHAR decoded[MAX_STREAM_NAME_LEN]; @@ -82,14 +82,14 @@ static STREAM *create_stream(LibmsiStreamSVIEW *sv, const WCHAR *name, bool enco name = decoded; } - stream->str_index = msi_addstringW(sv->db->strings, name, -1, 1, StringNonPersistent); + stream->str_index = _libmsi_add_string(sv->db->strings, name, -1, 1, StringNonPersistent); stream->stream = stm; return stream; } -static unsigned STREAMS_fetch_int(LibmsiView *view, unsigned row, unsigned col, unsigned *val) +static unsigned streams_view_fetch_int(LibmsiView *view, unsigned row, unsigned col, unsigned *val) { - LibmsiStreamSVIEW *sv = (LibmsiStreamSVIEW *)view; + LibmsiStreamsView *sv = (LibmsiStreamsView *)view; TRACE("(%p, %d, %d, %p)\n", view, row, col, val); @@ -104,9 +104,9 @@ static unsigned STREAMS_fetch_int(LibmsiView *view, unsigned row, unsigned col, return ERROR_SUCCESS; } -static unsigned STREAMS_fetch_stream(LibmsiView *view, unsigned row, unsigned col, IStream **stm) +static unsigned streams_view_fetch_stream(LibmsiView *view, unsigned row, unsigned col, IStream **stm) { - LibmsiStreamSVIEW *sv = (LibmsiStreamSVIEW *)view; + LibmsiStreamsView *sv = (LibmsiStreamsView *)view; TRACE("(%p, %d, %d, %p)\n", view, row, col, stm); @@ -119,18 +119,18 @@ static unsigned STREAMS_fetch_stream(LibmsiView *view, unsigned row, unsigned co return ERROR_SUCCESS; } -static unsigned STREAMS_get_row( LibmsiView *view, unsigned row, LibmsiRecord **rec ) +static unsigned streams_view_get_row( LibmsiView *view, unsigned row, LibmsiRecord **rec ) { - LibmsiStreamSVIEW *sv = (LibmsiStreamSVIEW *)view; + LibmsiStreamsView *sv = (LibmsiStreamsView *)view; TRACE("%p %d %p\n", sv, row, rec); return msi_view_get_row( sv->db, view, row, rec ); } -static unsigned STREAMS_set_row(LibmsiView *view, unsigned row, LibmsiRecord *rec, unsigned mask) +static unsigned streams_view_set_row(LibmsiView *view, unsigned row, LibmsiRecord *rec, unsigned mask) { - LibmsiStreamSVIEW *sv = (LibmsiStreamSVIEW *)view; + LibmsiStreamsView *sv = (LibmsiStreamsView *)view; STREAM *stream; IStream *stm; STATSTG stat; @@ -146,7 +146,7 @@ static unsigned STREAMS_set_row(LibmsiView *view, unsigned row, LibmsiRecord *re if (row > sv->num_rows) return ERROR_FUNCTION_FAILED; - r = MSI_RecordGetIStream(rec, 2, &stm); + r = _libmsi_record_get_IStream(rec, 2, &stm); if (r != ERROR_SUCCESS) return r; @@ -174,7 +174,7 @@ static unsigned STREAMS_set_row(LibmsiView *view, unsigned row, LibmsiRecord *re goto done; } - name = strdupW(MSI_RecordGetStringRaw(rec, 1)); + name = strdupW(_libmsi_record_get_string_raw(rec, 1)); if (!name) { WARN("failed to retrieve stream name\n"); @@ -215,9 +215,9 @@ done: return r; } -static unsigned STREAMS_insert_row(LibmsiView *view, LibmsiRecord *rec, unsigned row, bool temporary) +static unsigned streams_view_insert_row(LibmsiView *view, LibmsiRecord *rec, unsigned row, bool temporary) { - LibmsiStreamSVIEW *sv = (LibmsiStreamSVIEW *)view; + LibmsiStreamsView *sv = (LibmsiStreamsView *)view; unsigned i; TRACE("(%p, %p, %d, %d)\n", view, rec, row, temporary); @@ -234,30 +234,30 @@ static unsigned STREAMS_insert_row(LibmsiView *view, LibmsiRecord *rec, unsigned sv->streams[i] = sv->streams[i - 1]; } - return STREAMS_set_row(view, row, rec, 0); + return streams_view_set_row(view, row, rec, 0); } -static unsigned STREAMS_delete_row(LibmsiView *view, unsigned row) +static unsigned streams_view_delete_row(LibmsiView *view, unsigned row) { FIXME("(%p %d): stub!\n", view, row); return ERROR_SUCCESS; } -static unsigned STREAMS_execute(LibmsiView *view, LibmsiRecord *record) +static unsigned streams_view_execute(LibmsiView *view, LibmsiRecord *record) { TRACE("(%p, %p)\n", view, record); return ERROR_SUCCESS; } -static unsigned STREAMS_close(LibmsiView *view) +static unsigned streams_view_close(LibmsiView *view) { TRACE("(%p)\n", view); return ERROR_SUCCESS; } -static unsigned STREAMS_get_dimensions(LibmsiView *view, unsigned *rows, unsigned *cols) +static unsigned streams_view_get_dimensions(LibmsiView *view, unsigned *rows, unsigned *cols) { - LibmsiStreamSVIEW *sv = (LibmsiStreamSVIEW *)view; + LibmsiStreamsView *sv = (LibmsiStreamsView *)view; TRACE("(%p, %p, %p)\n", view, rows, cols); @@ -267,7 +267,7 @@ static unsigned STREAMS_get_dimensions(LibmsiView *view, unsigned *rows, unsigne return ERROR_SUCCESS; } -static unsigned STREAMS_get_column_info( LibmsiView *view, unsigned n, const WCHAR **name, +static unsigned streams_view_get_column_info( LibmsiView *view, unsigned n, const WCHAR **name, unsigned *type, bool *temporary, const WCHAR **table_name ) { TRACE("(%p, %d, %p, %p, %p, %p)\n", view, n, name, type, temporary, @@ -293,19 +293,19 @@ static unsigned STREAMS_get_column_info( LibmsiView *view, unsigned n, const WCH return ERROR_SUCCESS; } -static unsigned streams_find_row(LibmsiStreamSVIEW *sv, LibmsiRecord *rec, unsigned *row) +static unsigned streams_find_row(LibmsiStreamsView *sv, LibmsiRecord *rec, unsigned *row) { const WCHAR *str; unsigned r, i, id, data; - str = MSI_RecordGetStringRaw(rec, 1); - r = msi_string2idW(sv->db->strings, str, &id); + str = _libmsi_record_get_string_raw(rec, 1); + r = _libmsi_id_from_stringW(sv->db->strings, str, &id); if (r != ERROR_SUCCESS) return r; for (i = 0; i < sv->num_rows; i++) { - STREAMS_fetch_int(&sv->view, i, 1, &data); + streams_view_fetch_int(&sv->view, i, 1, &data); if (data == id) { @@ -319,29 +319,29 @@ static unsigned streams_find_row(LibmsiStreamSVIEW *sv, LibmsiRecord *rec, unsig static unsigned streams_modify_update(LibmsiView *view, LibmsiRecord *rec) { - LibmsiStreamSVIEW *sv = (LibmsiStreamSVIEW *)view; + LibmsiStreamsView *sv = (LibmsiStreamsView *)view; unsigned r, row; r = streams_find_row(sv, rec, &row); if (r != ERROR_SUCCESS) return ERROR_FUNCTION_FAILED; - return STREAMS_set_row(view, row, rec, 0); + return streams_view_set_row(view, row, rec, 0); } static unsigned streams_modify_assign(LibmsiView *view, LibmsiRecord *rec) { - LibmsiStreamSVIEW *sv = (LibmsiStreamSVIEW *)view; + LibmsiStreamsView *sv = (LibmsiStreamsView *)view; unsigned r, row; r = streams_find_row(sv, rec, &row); if (r == ERROR_SUCCESS) return streams_modify_update(view, rec); - return STREAMS_insert_row(view, rec, -1, false); + return streams_view_insert_row(view, rec, -1, false); } -static unsigned STREAMS_modify(LibmsiView *view, LibmsiModify eModifyMode, LibmsiRecord *rec, unsigned row) +static unsigned streams_view_modify(LibmsiView *view, LibmsiModify eModifyMode, LibmsiRecord *rec, unsigned row) { unsigned r; @@ -354,7 +354,7 @@ static unsigned STREAMS_modify(LibmsiView *view, LibmsiModify eModifyMode, Libms break; case LIBMSI_MODIFY_INSERT: - r = STREAMS_insert_row(view, rec, -1, false); + r = streams_view_insert_row(view, rec, -1, false); break; case LIBMSI_MODIFY_UPDATE: @@ -381,9 +381,9 @@ static unsigned STREAMS_modify(LibmsiView *view, LibmsiModify eModifyMode, Libms return r; } -static unsigned STREAMS_delete(LibmsiView *view) +static unsigned streams_view_delete(LibmsiView *view) { - LibmsiStreamSVIEW *sv = (LibmsiStreamSVIEW *)view; + LibmsiStreamsView *sv = (LibmsiStreamsView *)view; unsigned i; TRACE("(%p)\n", view); @@ -404,10 +404,10 @@ static unsigned STREAMS_delete(LibmsiView *view) return ERROR_SUCCESS; } -static unsigned STREAMS_find_matching_rows(LibmsiView *view, unsigned col, +static unsigned streams_view_find_matching_rows(LibmsiView *view, unsigned col, unsigned val, unsigned *row, MSIITERHANDLE *handle) { - LibmsiStreamSVIEW *sv = (LibmsiStreamSVIEW *)view; + LibmsiStreamsView *sv = (LibmsiStreamsView *)view; unsigned index = PtrToUlong(*handle); TRACE("(%p, %d, %d, %p, %p)\n", view, col, val, row, handle); @@ -434,21 +434,21 @@ static unsigned STREAMS_find_matching_rows(LibmsiView *view, unsigned col, return ERROR_SUCCESS; } -static const LibmsiViewOPS streams_ops = +static const LibmsiViewOps streams_ops = { - STREAMS_fetch_int, - STREAMS_fetch_stream, - STREAMS_get_row, - STREAMS_set_row, - STREAMS_insert_row, - STREAMS_delete_row, - STREAMS_execute, - STREAMS_close, - STREAMS_get_dimensions, - STREAMS_get_column_info, - STREAMS_modify, - STREAMS_delete, - STREAMS_find_matching_rows, + streams_view_fetch_int, + streams_view_fetch_stream, + streams_view_get_row, + streams_view_set_row, + streams_view_insert_row, + streams_view_delete_row, + streams_view_execute, + streams_view_close, + streams_view_get_dimensions, + streams_view_get_column_info, + streams_view_modify, + streams_view_delete, + streams_view_find_matching_rows, NULL, NULL, NULL, @@ -457,7 +457,7 @@ static const LibmsiViewOPS streams_ops = NULL, }; -static int add_streams_to_table(LibmsiStreamSVIEW *sv) +static int add_streams_to_table(LibmsiStreamsView *sv) { IEnumSTATSTG *stgenum = NULL; STATSTG stat; @@ -525,14 +525,14 @@ static int add_streams_to_table(LibmsiStreamSVIEW *sv) return count; } -unsigned STREAMS_CreateView(LibmsiDatabase *db, LibmsiView **view) +unsigned streams_view_create(LibmsiDatabase *db, LibmsiView **view) { - LibmsiStreamSVIEW *sv; + LibmsiStreamsView *sv; int rows; TRACE("(%p, %p)\n", db, view); - sv = alloc_msiobject( sizeof(LibmsiStreamSVIEW), NULL ); + sv = alloc_msiobject( sizeof(LibmsiStreamsView), NULL ); if (!sv) return ERROR_FUNCTION_FAILED; diff --git a/libmsi/string.c b/libmsi/string.c index 67bf7ae..d13d6ff 100644 --- a/libmsi/string.c +++ b/libmsi/string.c @@ -225,7 +225,7 @@ static void set_st_entry( string_table *st, unsigned n, WCHAR *str, uint16_t ref st->freeslot = n + 1; } -static unsigned msi_string2idA( const string_table *st, const char *buffer, unsigned *id ) +static unsigned _libmsi_id_from_string( const string_table *st, const char *buffer, unsigned *id ) { unsigned sz; unsigned r = ERROR_INVALID_PARAMETER; @@ -247,7 +247,7 @@ static unsigned msi_string2idA( const string_table *st, const char *buffer, unsi return ERROR_NOT_ENOUGH_MEMORY; MultiByteToWideChar( st->codepage, 0, buffer, -1, str, sz ); - r = msi_string2idW( st, str, id ); + r = _libmsi_id_from_stringW( st, str, id ); msi_free( str ); return r; @@ -270,7 +270,7 @@ static int msi_addstring( string_table *st, unsigned n, const char *data, int le } else { - if( ERROR_SUCCESS == msi_string2idA( st, data, &n ) ) + if( ERROR_SUCCESS == _libmsi_id_from_string( st, data, &n ) ) { if (persistence == StringPersistent) st->strings[n].persistent_refcount += refcount; @@ -304,7 +304,7 @@ static int msi_addstring( string_table *st, unsigned n, const char *data, int le return n; } -int msi_addstringW( string_table *st, const WCHAR *data, int len, uint16_t refcount, enum StringPersistence persistence ) +int _libmsi_add_string( string_table *st, const WCHAR *data, int len, uint16_t refcount, enum StringPersistence persistence ) { unsigned n; WCHAR *str; @@ -314,7 +314,7 @@ int msi_addstringW( string_table *st, const WCHAR *data, int len, uint16_t refco if( !data[0] ) return 0; - if( msi_string2idW( st, data, &n ) == ERROR_SUCCESS ) + if( _libmsi_id_from_stringW( st, data, &n ) == ERROR_SUCCESS ) { if (persistence == StringPersistent) st->strings[n].persistent_refcount += refcount; @@ -359,7 +359,7 @@ const WCHAR *msi_string_lookup_id( const string_table *st, unsigned id ) } /* - * msi_id2stringA + * _libmsi_string_id * * [in] st - pointer to the string table * [in] id - id of the string to retrieve @@ -369,7 +369,7 @@ const WCHAR *msi_string_lookup_id( const string_table *st, unsigned id ) * * Returned string is not nul terminated. */ -static unsigned msi_id2stringA( const string_table *st, unsigned id, char *buffer, unsigned *sz ) +static unsigned _libmsi_string_id( const string_table *st, unsigned id, char *buffer, unsigned *sz ) { unsigned len, lenW; const WCHAR *str; @@ -392,13 +392,13 @@ static unsigned msi_id2stringA( const string_table *st, unsigned id, char *buffe } /* - * msi_string2idW + * _libmsi_id_from_stringW * * [in] st - pointer to the string table * [in] str - string to find in the string table * [out] id - id of the string, if found */ -unsigned msi_string2idW( const string_table *st, const WCHAR *str, unsigned *id ) +unsigned _libmsi_id_from_stringW( const string_table *st, const WCHAR *str, unsigned *id ) { int i, c, low = 0, high = st->sortcount - 1; @@ -612,7 +612,7 @@ unsigned msi_save_string_table( const string_table *st, IStorage *storage, unsig } sz = datasize - used; - r = msi_id2stringA( st, n, data+used, &sz ); + r = _libmsi_string_id( st, n, data+used, &sz ); if( r != ERROR_SUCCESS ) { ERR("failed to fetch string\n"); diff --git a/libmsi/suminfo.c b/libmsi/suminfo.c index 7d40b0f..5e4b068 100644 --- a/libmsi/suminfo.c +++ b/libmsi/suminfo.c @@ -93,7 +93,7 @@ static void free_prop( PROPVARIANT *prop ) prop->vt = VT_EMPTY; } -static void MSI_CloseSummaryInfo( LibmsiObject *arg ) +static void _libmsi_summary_info_destroy( LibmsiObject *arg ) { LibmsiSummaryInfo *si = (LibmsiSummaryInfo *) arg; unsigned i; @@ -432,7 +432,7 @@ static unsigned save_summary_info( const LibmsiSummaryInfo * si, IStream *stm ) return ERROR_SUCCESS; } -LibmsiSummaryInfo *MSI_GetSummaryInformation( IStorage *stg, unsigned uiUpdateCount ) +LibmsiSummaryInfo *_libmsi_get_summary_information( IStorage *stg, unsigned uiUpdateCount ) { IStream *stm = NULL; LibmsiSummaryInfo *si; @@ -441,7 +441,7 @@ LibmsiSummaryInfo *MSI_GetSummaryInformation( IStorage *stg, unsigned uiUpdateCo TRACE("%p %d\n", stg, uiUpdateCount ); - si = alloc_msiobject( sizeof (LibmsiSummaryInfo), MSI_CloseSummaryInfo ); + si = alloc_msiobject( sizeof (LibmsiSummaryInfo), _libmsi_summary_info_destroy ); if( !si ) return si; @@ -461,7 +461,7 @@ LibmsiSummaryInfo *MSI_GetSummaryInformation( IStorage *stg, unsigned uiUpdateCo return si; } -unsigned MsiGetSummaryInformation( LibmsiDatabase *db, +unsigned libmsi_database_get_summary_info( LibmsiDatabase *db, unsigned uiUpdateCount, LibmsiSummaryInfo **psi ) { LibmsiSummaryInfo *si; @@ -476,7 +476,7 @@ unsigned MsiGetSummaryInformation( LibmsiDatabase *db, return ERROR_INVALID_HANDLE; msiobj_addref( &db->hdr); - si = MSI_GetSummaryInformation( db->storage, uiUpdateCount ); + si = _libmsi_get_summary_information( db->storage, uiUpdateCount ); if (si) { *psi = si; @@ -487,7 +487,7 @@ unsigned MsiGetSummaryInformation( LibmsiDatabase *db, return ret; } -unsigned MsiSummaryInfoGetPropertyCount(LibmsiSummaryInfo *si, unsigned *pCount) +unsigned libmsi_summary_info_get_property_count(LibmsiSummaryInfo *si, unsigned *pCount) { TRACE("%d %p\n", si, pCount); @@ -502,7 +502,7 @@ unsigned MsiSummaryInfoGetPropertyCount(LibmsiSummaryInfo *si, unsigned *pCount) return ERROR_SUCCESS; } -unsigned MsiSummaryInfoGetProperty( +unsigned libmsi_summary_info_get_property( LibmsiSummaryInfo *si, unsigned uiProperty, unsigned *puiDataType, int *piValue, uint64_t *pftValue, char *szValueBuf, unsigned *pcchValueBuf) { @@ -593,7 +593,7 @@ WCHAR *msi_get_suminfo_product( IStorage *stg ) LibmsiSummaryInfo *si; WCHAR *prod; - si = MSI_GetSummaryInformation( stg, 0 ); + si = _libmsi_get_summary_information( stg, 0 ); if (!si) { ERR("no summary information!\n"); @@ -604,7 +604,7 @@ WCHAR *msi_get_suminfo_product( IStorage *stg ) return prod; } -unsigned MsiSummaryInfoSetProperty( LibmsiSummaryInfo *si, unsigned uiProperty, +unsigned libmsi_summary_info_set_property( LibmsiSummaryInfo *si, unsigned uiProperty, unsigned uiDataType, int iValue, uint64_t* pftValue, const char *szValue ) { PROPVARIANT *prop; @@ -780,7 +780,7 @@ unsigned msi_add_suminfo( LibmsiDatabase *db, WCHAR ***records, int num_records, unsigned i, j; LibmsiSummaryInfo *si; - si = MSI_GetSummaryInformation( db->storage, num_records * (num_columns / 2) ); + si = _libmsi_get_summary_information( db->storage, num_records * (num_columns / 2) ); if (!si) { ERR("no summary information!\n"); @@ -800,7 +800,7 @@ unsigned msi_add_suminfo( LibmsiDatabase *db, WCHAR ***records, int num_records, if (r != ERROR_SUCCESS) goto end; - r = MsiSummaryInfoSetProperty( si, pid, get_type(pid), int_value, &ft_value, str_value ); + r = libmsi_summary_info_set_property( si, pid, get_type(pid), int_value, &ft_value, str_value ); if (r != ERROR_SUCCESS) goto end; @@ -816,7 +816,7 @@ end: return r; } -unsigned MsiSummaryInfoPersist( LibmsiSummaryInfo *si ) +unsigned libmsi_summary_info_persist( LibmsiSummaryInfo *si ) { unsigned ret; diff --git a/libmsi/table.c b/libmsi/table.c index dab2d5f..ef04aaf 100644 --- a/libmsi/table.c +++ b/libmsi/table.c @@ -699,7 +699,7 @@ static unsigned get_tablecolumns( LibmsiDatabase *db, const WCHAR *szTableName, } /* convert table and column names to IDs from the string table */ - r = msi_string2idW( db->strings, szTableName, &table_id ); + r = _libmsi_id_from_stringW( db->strings, szTableName, &table_id ); if (r != ERROR_SUCCESS) { WARN("Couldn't find id for %s\n", debugstr_w(szTableName)); @@ -768,7 +768,7 @@ unsigned msi_create_table( LibmsiDatabase *db, const WCHAR *name, column_info *c unsigned i; /* only add tables that don't exist already */ - if( TABLE_Exists(db, name ) ) + if( table_view_exists(db, name ) ) { WARN("table %s exists\n", debugstr_w(name)); return ERROR_BAD_QUERY_SYNTAX; @@ -799,8 +799,8 @@ unsigned msi_create_table( LibmsiDatabase *db, const WCHAR *name, column_info *c for( i = 0, col = col_info; col; i++, col = col->next ) { - unsigned table_id = msi_addstringW( db->strings, col->table, -1, 1, string_persistence ); - unsigned col_id = msi_addstringW( db->strings, col->column, -1, 1, string_persistence ); + unsigned table_id = _libmsi_add_string( db->strings, col->table, -1, 1, string_persistence ); + unsigned col_id = _libmsi_add_string( db->strings, col->column, -1, 1, string_persistence ); table->colinfo[ i ].tablename = msi_string_lookup_id( db->strings, table_id ); table->colinfo[ i ].number = i + 1; @@ -813,7 +813,7 @@ unsigned msi_create_table( LibmsiDatabase *db, const WCHAR *name, column_info *c } table_calc_column_offsets( db, table->colinfo, table->col_count); - r = TABLE_CreateView( db, szTables, &tv ); + r = table_view_create( db, szTables, &tv ); TRACE("CreateView returned %x\n", r); if( r ) { @@ -826,11 +826,11 @@ unsigned msi_create_table( LibmsiDatabase *db, const WCHAR *name, column_info *c if( r ) goto err; - rec = MsiCreateRecord( 1 ); + rec = libmsi_record_create( 1 ); if( !rec ) goto err; - r = MSI_RecordSetStringW( rec, 1, name ); + r = _libmsi_record_set_stringW( rec, 1, name ); if( r ) goto err; @@ -848,7 +848,7 @@ unsigned msi_create_table( LibmsiDatabase *db, const WCHAR *name, column_info *c if( persistent != LIBMSI_CONDITION_FALSE ) { /* add each column to the _Columns table */ - r = TABLE_CreateView( db, szColumns, &tv ); + r = table_view_create( db, szColumns, &tv ); if( r ) return r; @@ -857,11 +857,11 @@ unsigned msi_create_table( LibmsiDatabase *db, const WCHAR *name, column_info *c if( r ) goto err; - rec = MsiCreateRecord( 4 ); + rec = libmsi_record_create( 4 ); if( !rec ) goto err; - r = MSI_RecordSetStringW( rec, 1, name ); + r = _libmsi_record_set_stringW( rec, 1, name ); if( r ) goto err; @@ -872,15 +872,15 @@ unsigned msi_create_table( LibmsiDatabase *db, const WCHAR *name, column_info *c nField = 1; for( col = col_info; col; col = col->next ) { - r = MsiRecordSetInteger( rec, 2, nField ); + r = libmsi_record_set_int( rec, 2, nField ); if( r ) goto err; - r = MSI_RecordSetStringW( rec, 3, col->column ); + r = _libmsi_record_set_stringW( rec, 3, col->column ); if( r ) goto err; - r = MsiRecordSetInteger( rec, 4, col->type ); + r = libmsi_record_set_int( rec, 4, col->type ); if( r ) goto err; @@ -1011,7 +1011,7 @@ static void msi_update_table_columns( LibmsiDatabase *db, const WCHAR *name ) } /* try to find the table name in the _Tables table */ -bool TABLE_Exists( LibmsiDatabase *db, const WCHAR *name ) +bool table_view_exists( LibmsiDatabase *db, const WCHAR *name ) { unsigned r, table_id, i; LibmsiTable *table; @@ -1020,7 +1020,7 @@ bool TABLE_Exists( LibmsiDatabase *db, const WCHAR *name ) !strcmpW( name, szStreams ) || !strcmpW( name, szStorages ) ) return true; - r = msi_string2idW( db->strings, name, &table_id ); + r = _libmsi_id_from_stringW( db->strings, name, &table_id ); if( r != ERROR_SUCCESS ) { TRACE("Couldn't find id for %s\n", debugstr_w(name)); @@ -1045,7 +1045,7 @@ bool TABLE_Exists( LibmsiDatabase *db, const WCHAR *name ) /* below is the query interface to a table */ -typedef struct LibmsiTableVIEW +typedef struct LibmsiTableView { LibmsiView view; LibmsiDatabase *db; @@ -1054,11 +1054,11 @@ typedef struct LibmsiTableVIEW unsigned num_cols; unsigned row_size; WCHAR name[1]; -} LibmsiTableVIEW; +} LibmsiTableView; -static unsigned TABLE_fetch_int( LibmsiView *view, unsigned row, unsigned col, unsigned *val ) +static unsigned table_view_fetch_int( LibmsiView *view, unsigned row, unsigned col, unsigned *val ) { - LibmsiTableVIEW *tv = (LibmsiTableVIEW*)view; + LibmsiTableView *tv = (LibmsiTableView*)view; unsigned offset, n; if( !tv->table ) @@ -1093,7 +1093,7 @@ static unsigned TABLE_fetch_int( LibmsiView *view, unsigned row, unsigned col, u return ERROR_SUCCESS; } -static unsigned msi_stream_name( const LibmsiTableVIEW *tv, unsigned row, WCHAR **pstname ) +static unsigned msi_stream_name( const LibmsiTableView *tv, unsigned row, WCHAR **pstname ) { WCHAR *p; WCHAR *stname = NULL; @@ -1121,7 +1121,7 @@ static unsigned msi_stream_name( const LibmsiTableVIEW *tv, unsigned row, WCHAR { WCHAR number[0x20]; - r = TABLE_fetch_int( view, row, i+1, &ival ); + r = table_view_fetch_int( view, row, i+1, &ival ); if ( r != ERROR_SUCCESS ) goto err; @@ -1185,9 +1185,9 @@ err: * the name of the stream in the same table, and the table name * which may not be available at higher levels of the query */ -static unsigned TABLE_fetch_stream( LibmsiView *view, unsigned row, unsigned col, IStream **stm ) +static unsigned table_view_fetch_stream( LibmsiView *view, unsigned row, unsigned col, IStream **stm ) { - LibmsiTableVIEW *tv = (LibmsiTableVIEW*)view; + LibmsiTableView *tv = (LibmsiTableView*)view; unsigned r; WCHAR *encname; WCHAR *full_name = NULL; @@ -1212,7 +1212,7 @@ static unsigned TABLE_fetch_stream( LibmsiView *view, unsigned row, unsigned col return r; } -static unsigned TABLE_set_int( LibmsiTableVIEW *tv, unsigned row, unsigned col, unsigned val ) +static unsigned table_view_set_int( LibmsiTableView *tv, unsigned row, unsigned col, unsigned val ) { unsigned offset, n, i; @@ -1249,9 +1249,9 @@ static unsigned TABLE_set_int( LibmsiTableVIEW *tv, unsigned row, unsigned col, return ERROR_SUCCESS; } -static unsigned TABLE_get_row( LibmsiView *view, unsigned row, LibmsiRecord **rec ) +static unsigned table_view_get_row( LibmsiView *view, unsigned row, LibmsiRecord **rec ) { - LibmsiTableVIEW *tv = (LibmsiTableVIEW *)view; + LibmsiTableView *tv = (LibmsiTableView *)view; if (!tv->table) return ERROR_INVALID_PARAMETER; @@ -1259,7 +1259,7 @@ static unsigned TABLE_get_row( LibmsiView *view, unsigned row, LibmsiRecord **re return msi_view_get_row(tv->db, view, row, rec); } -static unsigned msi_addstreamW( LibmsiDatabase *db, const WCHAR *name, IStream *data ) +static unsigned _libmsi_add_stream( LibmsiDatabase *db, const WCHAR *name, IStream *data ) { static const WCHAR insert[] = { 'I','N','S','E','R','T',' ','I','N','T','O',' ', @@ -1272,23 +1272,23 @@ static unsigned msi_addstreamW( LibmsiDatabase *db, const WCHAR *name, IStream * TRACE("%p %s %p\n", db, debugstr_w(name), data); - rec = MsiCreateRecord( 2 ); + rec = libmsi_record_create( 2 ); if ( !rec ) return ERROR_OUTOFMEMORY; - r = MSI_RecordSetStringW( rec, 1, name ); + r = _libmsi_record_set_stringW( rec, 1, name ); if ( r != ERROR_SUCCESS ) goto err; - r = MSI_RecordSetIStream( rec, 2, data ); + r = _libmsi_record_set_IStream( rec, 2, data ); if ( r != ERROR_SUCCESS ) goto err; - r = MSI_DatabaseOpenQueryW( db, insert, &query ); + r = _libmsi_database_open_query( db, insert, &query ); if ( r != ERROR_SUCCESS ) goto err; - r = MSI_QueryExecute( query, rec ); + r = _libmsi_query_execute( query, rec ); err: msiobj_release( &query->hdr ); @@ -1296,14 +1296,14 @@ err: return r; } -static unsigned get_table_value_from_record( LibmsiTableVIEW *tv, LibmsiRecord *rec, unsigned iField, unsigned *pvalue ) +static unsigned get_table_value_from_record( LibmsiTableView *tv, LibmsiRecord *rec, unsigned iField, unsigned *pvalue ) { LibmsiColumnInfo columninfo; unsigned r; if ( (iField <= 0) || (iField > tv->num_cols) || - MsiRecordIsNull( rec, iField ) ) + libmsi_record_is_null( rec, iField ) ) return ERROR_FUNCTION_FAILED; columninfo = tv->columns[ iField - 1 ]; @@ -1314,10 +1314,10 @@ static unsigned get_table_value_from_record( LibmsiTableVIEW *tv, LibmsiRecord * } else if ( columninfo.type & MSITYPE_STRING ) { - const WCHAR *sval = MSI_RecordGetStringRaw( rec, iField ); + const WCHAR *sval = _libmsi_record_get_string_raw( rec, iField ); if (sval) { - r = msi_string2idW(tv->db->strings, sval, pvalue); + r = _libmsi_id_from_stringW(tv->db->strings, sval, pvalue); if (r != ERROR_SUCCESS) return ERROR_NOT_FOUND; } @@ -1325,7 +1325,7 @@ static unsigned get_table_value_from_record( LibmsiTableVIEW *tv, LibmsiRecord * } else if ( bytes_per_column( tv->db, &columninfo, LONG_STR_BYTES ) == 2 ) { - *pvalue = 0x8000 + MsiRecordGetInteger( rec, iField ); + *pvalue = 0x8000 + libmsi_record_get_integer( rec, iField ); if ( *pvalue & 0xffff0000 ) { ERR("field %u value %d out of range\n", iField, *pvalue - 0x8000); @@ -1334,16 +1334,16 @@ static unsigned get_table_value_from_record( LibmsiTableVIEW *tv, LibmsiRecord * } else { - int ival = MsiRecordGetInteger( rec, iField ); + int ival = libmsi_record_get_integer( rec, iField ); *pvalue = ival ^ 0x80000000; } return ERROR_SUCCESS; } -static unsigned TABLE_set_row( LibmsiView *view, unsigned row, LibmsiRecord *rec, unsigned mask ) +static unsigned table_view_set_row( LibmsiView *view, unsigned row, LibmsiRecord *rec, unsigned mask ) { - LibmsiTableVIEW *tv = (LibmsiTableVIEW*)view; + LibmsiTableView *tv = (LibmsiTableView*)view; unsigned i, val, r = ERROR_SUCCESS; if ( !tv->table ) @@ -1366,7 +1366,7 @@ static unsigned TABLE_set_row( LibmsiView *view, unsigned row, LibmsiRecord *rec /* FIXME: should we allow updating keys? */ val = 0; - if ( !MsiRecordIsNull( rec, i + 1 ) ) + if ( !libmsi_record_is_null( rec, i + 1 ) ) { r = get_table_value_from_record (tv, rec, i + 1, &val); if ( MSITYPE_IS_BINARY(tv->columns[ i ].type) ) @@ -1377,7 +1377,7 @@ static unsigned TABLE_set_row( LibmsiView *view, unsigned row, LibmsiRecord *rec if ( r != ERROR_SUCCESS ) return ERROR_FUNCTION_FAILED; - r = MSI_RecordGetIStream( rec, i + 1, &stm ); + r = _libmsi_record_get_IStream( rec, i + 1, &stm ); if ( r != ERROR_SUCCESS ) return r; @@ -1388,7 +1388,7 @@ static unsigned TABLE_set_row( LibmsiView *view, unsigned row, LibmsiRecord *rec return r; } - r = msi_addstreamW( tv->db, stname, stm ); + r = _libmsi_add_stream( tv->db, stname, stm ); IStream_Release( stm ); msi_free ( stname ); @@ -1401,13 +1401,13 @@ static unsigned TABLE_set_row( LibmsiView *view, unsigned row, LibmsiRecord *rec if ( r != ERROR_SUCCESS ) { - const WCHAR *sval = MSI_RecordGetStringRaw( rec, i + 1 ); - val = msi_addstringW( tv->db->strings, sval, -1, 1, + const WCHAR *sval = _libmsi_record_get_string_raw( rec, i + 1 ); + val = _libmsi_add_string( tv->db->strings, sval, -1, 1, persistent ? StringPersistent : StringNonPersistent ); } else { - TABLE_fetch_int(&tv->view, row, i + 1, &x); + table_view_fetch_int(&tv->view, row, i + 1, &x); if (val == x) continue; } @@ -1419,7 +1419,7 @@ static unsigned TABLE_set_row( LibmsiView *view, unsigned row, LibmsiRecord *rec } } - r = TABLE_set_int( tv, row, i+1, val ); + r = table_view_set_int( tv, row, i+1, val ); if ( r != ERROR_SUCCESS ) break; } @@ -1428,7 +1428,7 @@ static unsigned TABLE_set_row( LibmsiView *view, unsigned row, LibmsiRecord *rec static unsigned table_create_new_row( LibmsiView *view, unsigned *num, bool temporary ) { - LibmsiTableVIEW *tv = (LibmsiTableVIEW*)view; + LibmsiTableView *tv = (LibmsiTableView*)view; uint8_t **p, *row; bool *b; unsigned sz; @@ -1485,9 +1485,9 @@ static unsigned table_create_new_row( LibmsiView *view, unsigned *num, bool temp return ERROR_SUCCESS; } -static unsigned TABLE_execute( LibmsiView *view, LibmsiRecord *record ) +static unsigned table_view_execute( LibmsiView *view, LibmsiRecord *record ) { - LibmsiTableVIEW *tv = (LibmsiTableVIEW*)view; + LibmsiTableView *tv = (LibmsiTableView*)view; TRACE("%p %p\n", tv, record); @@ -1496,16 +1496,16 @@ static unsigned TABLE_execute( LibmsiView *view, LibmsiRecord *record ) return ERROR_SUCCESS; } -static unsigned TABLE_close( LibmsiView *view ) +static unsigned table_view_close( LibmsiView *view ) { TRACE("%p\n", view ); return ERROR_SUCCESS; } -static unsigned TABLE_get_dimensions( LibmsiView *view, unsigned *rows, unsigned *cols) +static unsigned table_view_get_dimensions( LibmsiView *view, unsigned *rows, unsigned *cols) { - LibmsiTableVIEW *tv = (LibmsiTableVIEW*)view; + LibmsiTableView *tv = (LibmsiTableView*)view; TRACE("%p %p %p\n", view, rows, cols ); @@ -1521,11 +1521,11 @@ static unsigned TABLE_get_dimensions( LibmsiView *view, unsigned *rows, unsigned return ERROR_SUCCESS; } -static unsigned TABLE_get_column_info( LibmsiView *view, +static unsigned table_view_get_column_info( LibmsiView *view, unsigned n, const WCHAR **name, unsigned *type, bool *temporary, const WCHAR **table_name ) { - LibmsiTableVIEW *tv = (LibmsiTableVIEW*)view; + LibmsiTableView *tv = (LibmsiTableView*)view; TRACE("%p %d %p %p\n", tv, n, name, type ); @@ -1555,9 +1555,9 @@ static unsigned TABLE_get_column_info( LibmsiView *view, return ERROR_SUCCESS; } -static unsigned msi_table_find_row( LibmsiTableVIEW *tv, LibmsiRecord *rec, unsigned *row, unsigned *column ); +static unsigned msi_table_find_row( LibmsiTableView *tv, LibmsiRecord *rec, unsigned *row, unsigned *column ); -static unsigned table_validate_new( LibmsiTableVIEW *tv, LibmsiRecord *rec, unsigned *column ) +static unsigned table_validate_new( LibmsiTableView *tv, LibmsiRecord *rec, unsigned *column ) { unsigned r, row, i; @@ -1573,7 +1573,7 @@ static unsigned table_validate_new( LibmsiTableVIEW *tv, LibmsiRecord *rec, unsi { const WCHAR *str; - str = MSI_RecordGetStringRaw( rec, i+1 ); + str = _libmsi_record_get_string_raw( rec, i+1 ); if (str == NULL || str[0] == 0) { if (column) *column = i; @@ -1584,7 +1584,7 @@ static unsigned table_validate_new( LibmsiTableVIEW *tv, LibmsiRecord *rec, unsi { unsigned n; - n = MsiRecordGetInteger( rec, i+1 ); + n = libmsi_record_get_integer( rec, i+1 ); if (n == MSI_NULL_INTEGER) { if (column) *column = i; @@ -1601,7 +1601,7 @@ static unsigned table_validate_new( LibmsiTableVIEW *tv, LibmsiRecord *rec, unsi return ERROR_SUCCESS; } -static int compare_record( LibmsiTableVIEW *tv, unsigned row, LibmsiRecord *rec ) +static int compare_record( LibmsiTableView *tv, unsigned row, LibmsiRecord *rec ) { unsigned r, i, ivalue, x; @@ -1613,10 +1613,10 @@ static int compare_record( LibmsiTableVIEW *tv, unsigned row, LibmsiRecord *rec if (r != ERROR_SUCCESS) return 1; - r = TABLE_fetch_int( &tv->view, row, i + 1, &x ); + r = table_view_fetch_int( &tv->view, row, i + 1, &x ); if (r != ERROR_SUCCESS) { - WARN("TABLE_fetch_int should not fail here %u\n", r); + WARN("table_view_fetch_int should not fail here %u\n", r); return -1; } if (ivalue > x) @@ -1634,7 +1634,7 @@ static int compare_record( LibmsiTableVIEW *tv, unsigned row, LibmsiRecord *rec return 1; } -static int find_insert_index( LibmsiTableVIEW *tv, LibmsiRecord *rec ) +static int find_insert_index( LibmsiTableView *tv, LibmsiRecord *rec ) { int idx, c, low = 0, high = tv->table->row_count - 1; @@ -1659,9 +1659,9 @@ static int find_insert_index( LibmsiTableVIEW *tv, LibmsiRecord *rec ) return high + 1; } -static unsigned TABLE_insert_row( LibmsiView *view, LibmsiRecord *rec, unsigned row, bool temporary ) +static unsigned table_view_insert_row( LibmsiView *view, LibmsiRecord *rec, unsigned row, bool temporary ) { - LibmsiTableVIEW *tv = (LibmsiTableVIEW*)view; + LibmsiTableView *tv = (LibmsiTableView*)view; unsigned i, r; TRACE("%p %p %s\n", tv, rec, temporary ? "true" : "false" ); @@ -1689,12 +1689,12 @@ static unsigned TABLE_insert_row( LibmsiView *view, LibmsiRecord *rec, unsigned /* Re-set the persistence flag */ tv->table->data_persistent[row] = !temporary; - return TABLE_set_row( view, row, rec, (1<<tv->num_cols) - 1 ); + return table_view_set_row( view, row, rec, (1<<tv->num_cols) - 1 ); } -static unsigned TABLE_delete_row( LibmsiView *view, unsigned row ) +static unsigned table_view_delete_row( LibmsiView *view, unsigned row ) { - LibmsiTableVIEW *tv = (LibmsiTableVIEW*)view; + LibmsiTableView *tv = (LibmsiTableView*)view; unsigned r, num_rows, num_cols, i; TRACE("%p %d\n", tv, row); @@ -1702,7 +1702,7 @@ static unsigned TABLE_delete_row( LibmsiView *view, unsigned row ) if ( !tv->table ) return ERROR_INVALID_PARAMETER; - r = TABLE_get_dimensions( view, &num_rows, &num_cols ); + r = table_view_get_dimensions( view, &num_rows, &num_cols ); if ( r != ERROR_SUCCESS ) return r; @@ -1732,10 +1732,10 @@ static unsigned TABLE_delete_row( LibmsiView *view, unsigned row ) static unsigned msi_table_update(LibmsiView *view, LibmsiRecord *rec, unsigned row) { - LibmsiTableVIEW *tv = (LibmsiTableVIEW *)view; + LibmsiTableView *tv = (LibmsiTableView *)view; unsigned r, new_row; - /* FIXME: MsiQueryFetch should set rec index 0 to some ID that + /* FIXME: libmsi_query_fetch should set rec index 0 to some ID that * sets the fetched record apart from other records */ @@ -1753,12 +1753,12 @@ static unsigned msi_table_update(LibmsiView *view, LibmsiRecord *rec, unsigned r if (row != new_row + 1) return ERROR_FUNCTION_FAILED; - return TABLE_set_row(view, new_row, rec, (1 << tv->num_cols) - 1); + return table_view_set_row(view, new_row, rec, (1 << tv->num_cols) - 1); } static unsigned msi_table_assign(LibmsiView *view, LibmsiRecord *rec) { - LibmsiTableVIEW *tv = (LibmsiTableVIEW *)view; + LibmsiTableView *tv = (LibmsiTableView *)view; unsigned r, row; if (!tv->table) @@ -1766,21 +1766,21 @@ static unsigned msi_table_assign(LibmsiView *view, LibmsiRecord *rec) r = msi_table_find_row(tv, rec, &row, NULL); if (r == ERROR_SUCCESS) - return TABLE_set_row(view, row, rec, (1 << tv->num_cols) - 1); + return table_view_set_row(view, row, rec, (1 << tv->num_cols) - 1); else - return TABLE_insert_row( view, rec, -1, false ); + return table_view_insert_row( view, rec, -1, false ); } static unsigned modify_delete_row( LibmsiView *view, LibmsiRecord *rec ) { - LibmsiTableVIEW *tv = (LibmsiTableVIEW *)view; + LibmsiTableView *tv = (LibmsiTableView *)view; unsigned row, r; r = msi_table_find_row(tv, rec, &row, NULL); if (r != ERROR_SUCCESS) return r; - return TABLE_delete_row(view, row); + return table_view_delete_row(view, row); } static unsigned msi_refresh_record( LibmsiView *view, LibmsiRecord *rec, unsigned row ) @@ -1788,25 +1788,25 @@ static unsigned msi_refresh_record( LibmsiView *view, LibmsiRecord *rec, unsigne LibmsiRecord *curr; unsigned r, i, count; - r = TABLE_get_row(view, row - 1, &curr); + r = table_view_get_row(view, row - 1, &curr); if (r != ERROR_SUCCESS) return r; /* Close the original record */ - MSI_CloseRecord(&rec->hdr); + _libmsi_record_destroy(&rec->hdr); - count = MsiRecordGetFieldCount(rec); + count = libmsi_record_get_field_count(rec); for (i = 0; i < count; i++) - MSI_RecordCopyField(curr, i + 1, rec, i + 1); + _libmsi_record_copy_field(curr, i + 1, rec, i + 1); msiobj_release(&curr->hdr); return ERROR_SUCCESS; } -static unsigned TABLE_modify( LibmsiView *view, LibmsiModify eModifyMode, +static unsigned table_view_modify( LibmsiView *view, LibmsiModify eModifyMode, LibmsiRecord *rec, unsigned row) { - LibmsiTableVIEW *tv = (LibmsiTableVIEW*)view; + LibmsiTableView *tv = (LibmsiTableView*)view; unsigned r, frow, column; TRACE("%p %d %p\n", view, eModifyMode, rec ); @@ -1830,14 +1830,14 @@ static unsigned TABLE_modify( LibmsiView *view, LibmsiModify eModifyMode, r = table_validate_new( tv, rec, NULL ); if (r != ERROR_SUCCESS) break; - r = TABLE_insert_row( view, rec, -1, false ); + r = table_view_insert_row( view, rec, -1, false ); break; case LIBMSI_MODIFY_INSERT_TEMPORARY: r = table_validate_new( tv, rec, NULL ); if (r != ERROR_SUCCESS) break; - r = TABLE_insert_row( view, rec, -1, true ); + r = table_view_insert_row( view, rec, -1, true ); break; case LIBMSI_MODIFY_REFRESH: @@ -1859,7 +1859,7 @@ static unsigned TABLE_modify( LibmsiView *view, LibmsiModify eModifyMode, { r = table_validate_new( tv, rec, NULL ); if (r == ERROR_SUCCESS) - r = TABLE_insert_row( view, rec, -1, false ); + r = table_view_insert_row( view, rec, -1, false ); } break; @@ -1878,9 +1878,9 @@ static unsigned TABLE_modify( LibmsiView *view, LibmsiModify eModifyMode, return r; } -static unsigned TABLE_delete( LibmsiView *view ) +static unsigned table_view_delete( LibmsiView *view ) { - LibmsiTableVIEW *tv = (LibmsiTableVIEW*)view; + LibmsiTableView *tv = (LibmsiTableView*)view; TRACE("%p\n", view ); @@ -1892,10 +1892,10 @@ static unsigned TABLE_delete( LibmsiView *view ) return ERROR_SUCCESS; } -static unsigned TABLE_find_matching_rows( LibmsiView *view, unsigned col, +static unsigned table_view_find_matching_rows( LibmsiView *view, unsigned col, unsigned val, unsigned *row, MSIITERHANDLE *handle ) { - LibmsiTableVIEW *tv = (LibmsiTableVIEW*)view; + LibmsiTableView *tv = (LibmsiTableView*)view; const LibmsiColumnHashEntry *entry; TRACE("%p, %d, %u, %p\n", view, col, val, *handle); @@ -1971,9 +1971,9 @@ static unsigned TABLE_find_matching_rows( LibmsiView *view, unsigned col, return ERROR_SUCCESS; } -static unsigned TABLE_add_ref(LibmsiView *view) +static unsigned table_view_add_ref(LibmsiView *view) { - LibmsiTableVIEW *tv = (LibmsiTableVIEW*)view; + LibmsiTableView *tv = (LibmsiTableView*)view; unsigned i; TRACE("%p %d\n", view, tv->table->ref_count); @@ -1987,29 +1987,29 @@ static unsigned TABLE_add_ref(LibmsiView *view) return InterlockedIncrement(&tv->table->ref_count); } -static unsigned TABLE_remove_column(LibmsiView *view, const WCHAR *table, unsigned number) +static unsigned table_view_remove_column(LibmsiView *view, const WCHAR *table, unsigned number) { - LibmsiTableVIEW *tv = (LibmsiTableVIEW*)view; + LibmsiTableView *tv = (LibmsiTableView*)view; LibmsiRecord *rec = NULL; LibmsiView *columns = NULL; unsigned row, r; - rec = MsiCreateRecord(2); + rec = libmsi_record_create(2); if (!rec) return ERROR_OUTOFMEMORY; - MSI_RecordSetStringW(rec, 1, table); - MsiRecordSetInteger(rec, 2, number); + _libmsi_record_set_stringW(rec, 1, table); + libmsi_record_set_int(rec, 2, number); - r = TABLE_CreateView(tv->db, szColumns, &columns); + r = table_view_create(tv->db, szColumns, &columns); if (r != ERROR_SUCCESS) return r; - r = msi_table_find_row((LibmsiTableVIEW *)columns, rec, &row, NULL); + r = msi_table_find_row((LibmsiTableView *)columns, rec, &row, NULL); if (r != ERROR_SUCCESS) goto done; - r = TABLE_delete_row(columns, row); + r = table_view_delete_row(columns, row); if (r != ERROR_SUCCESS) goto done; @@ -2021,9 +2021,9 @@ done: return r; } -static unsigned TABLE_release(LibmsiView *view) +static unsigned table_view_release(LibmsiView *view) { - LibmsiTableVIEW *tv = (LibmsiTableVIEW*)view; + LibmsiTableView *tv = (LibmsiTableView*)view; int ref = tv->table->ref_count; unsigned i, r; @@ -2036,7 +2036,7 @@ static unsigned TABLE_release(LibmsiView *view) ref = InterlockedDecrement(&tv->table->colinfo[i].ref_count); if (ref == 0) { - r = TABLE_remove_column(view, tv->table->colinfo[i].tablename, + r = table_view_remove_column(view, tv->table->colinfo[i].tablename, tv->table->colinfo[i].number); if (r != ERROR_SUCCESS) break; @@ -2051,31 +2051,31 @@ static unsigned TABLE_release(LibmsiView *view) { list_remove(&tv->table->entry); free_table(tv->table); - TABLE_delete(view); + table_view_delete(view); } } return ref; } -static unsigned TABLE_add_column(LibmsiView *view, const WCHAR *table, unsigned number, +static unsigned table_view_add_column(LibmsiView *view, const WCHAR *table, unsigned number, const WCHAR *column, unsigned type, bool hold) { - LibmsiTableVIEW *tv = (LibmsiTableVIEW*)view; + LibmsiTableView *tv = (LibmsiTableView*)view; LibmsiTable *msitable; LibmsiRecord *rec; unsigned r, i; - rec = MsiCreateRecord(4); + rec = libmsi_record_create(4); if (!rec) return ERROR_OUTOFMEMORY; - MSI_RecordSetStringW(rec, 1, table); - MsiRecordSetInteger(rec, 2, number); - MSI_RecordSetStringW(rec, 3, column); - MsiRecordSetInteger(rec, 4, type); + _libmsi_record_set_stringW(rec, 1, table); + libmsi_record_set_int(rec, 2, number); + _libmsi_record_set_stringW(rec, 3, column); + libmsi_record_set_int(rec, 4, type); - r = TABLE_insert_row(&tv->view, rec, -1, false); + r = table_view_insert_row(&tv->view, rec, -1, false); if (r != ERROR_SUCCESS) goto done; @@ -2099,9 +2099,9 @@ done: return r; } -static unsigned TABLE_drop(LibmsiView *view) +static unsigned table_view_drop(LibmsiView *view) { - LibmsiTableVIEW *tv = (LibmsiTableVIEW*)view; + LibmsiTableView *tv = (LibmsiTableView*)view; LibmsiView *tables = NULL; LibmsiRecord *rec = NULL; unsigned r, row; @@ -2111,27 +2111,27 @@ static unsigned TABLE_drop(LibmsiView *view) for (i = tv->table->col_count - 1; i >= 0; i--) { - r = TABLE_remove_column(view, tv->table->colinfo[i].tablename, + r = table_view_remove_column(view, tv->table->colinfo[i].tablename, tv->table->colinfo[i].number); if (r != ERROR_SUCCESS) return r; } - rec = MsiCreateRecord(1); + rec = libmsi_record_create(1); if (!rec) return ERROR_OUTOFMEMORY; - MSI_RecordSetStringW(rec, 1, tv->name); + _libmsi_record_set_stringW(rec, 1, tv->name); - r = TABLE_CreateView(tv->db, szTables, &tables); + r = table_view_create(tv->db, szTables, &tables); if (r != ERROR_SUCCESS) return r; - r = msi_table_find_row((LibmsiTableVIEW *)tables, rec, &row, NULL); + r = msi_table_find_row((LibmsiTableView *)tables, rec, &row, NULL); if (r != ERROR_SUCCESS) goto done; - r = TABLE_delete_row(tables, row); + r = table_view_delete_row(tables, row); if (r != ERROR_SUCCESS) goto done; @@ -2145,40 +2145,40 @@ done: return r; } -static const LibmsiViewOPS table_ops = -{ - TABLE_fetch_int, - TABLE_fetch_stream, - TABLE_get_row, - TABLE_set_row, - TABLE_insert_row, - TABLE_delete_row, - TABLE_execute, - TABLE_close, - TABLE_get_dimensions, - TABLE_get_column_info, - TABLE_modify, - TABLE_delete, - TABLE_find_matching_rows, - TABLE_add_ref, - TABLE_release, - TABLE_add_column, - TABLE_remove_column, +static const LibmsiViewOps table_ops = +{ + table_view_fetch_int, + table_view_fetch_stream, + table_view_get_row, + table_view_set_row, + table_view_insert_row, + table_view_delete_row, + table_view_execute, + table_view_close, + table_view_get_dimensions, + table_view_get_column_info, + table_view_modify, + table_view_delete, + table_view_find_matching_rows, + table_view_add_ref, + table_view_release, + table_view_add_column, + table_view_remove_column, NULL, - TABLE_drop, + table_view_drop, }; -unsigned TABLE_CreateView( LibmsiDatabase *db, const WCHAR *name, LibmsiView **view ) +unsigned table_view_create( LibmsiDatabase *db, const WCHAR *name, LibmsiView **view ) { - LibmsiTableVIEW *tv ; + LibmsiTableView *tv ; unsigned r, sz; TRACE("%p %s %p\n", db, debugstr_w(name), view ); if ( !strcmpW( name, szStreams ) ) - return STREAMS_CreateView( db, view ); + return streams_view_create( db, view ); else if ( !strcmpW( name, szStorages ) ) - return STORAGES_CreateView( db, view ); + return storages_view_create( db, view ); sz = sizeof *tv + strlenW(name)*sizeof name[0] ; tv = alloc_msiobject( sz, NULL ); @@ -2210,7 +2210,7 @@ unsigned TABLE_CreateView( LibmsiDatabase *db, const WCHAR *name, LibmsiView **v return ERROR_SUCCESS; } -unsigned MSI_CommitTables( LibmsiDatabase *db ) +unsigned _libmsi_database_commit_tables( LibmsiDatabase *db ) { unsigned r, bytes_per_strref; HRESULT hr; @@ -2245,7 +2245,7 @@ unsigned MSI_CommitTables( LibmsiDatabase *db ) return r; } -LibmsiCondition MSI_DatabaseIsTablePersistent( LibmsiDatabase *db, const WCHAR *table ) +LibmsiCondition _libmsi_database_is_table_persistent( LibmsiDatabase *db, const WCHAR *table ) { LibmsiTable *t; unsigned r; @@ -2272,7 +2272,7 @@ static unsigned read_raw_int(const uint8_t *data, unsigned col, unsigned bytes) return ret; } -static unsigned msi_record_encoded_stream_name( const LibmsiTableVIEW *tv, LibmsiRecord *rec, WCHAR **pstname ) +static unsigned msi_record_encoded_stream_name( const LibmsiTableView *tv, LibmsiRecord *rec, WCHAR **pstname ) { WCHAR *stname = NULL; WCHAR *sval; @@ -2332,7 +2332,7 @@ err: return r; } -static LibmsiRecord *msi_get_transform_record( const LibmsiTableVIEW *tv, const string_table *st, +static LibmsiRecord *msi_get_transform_record( const LibmsiTableView *tv, const string_table *st, IStorage *stg, const uint8_t *rawdata, unsigned bytes_per_strref ) { @@ -2344,7 +2344,7 @@ static LibmsiRecord *msi_get_transform_record( const LibmsiTableVIEW *tv, const mask = rawdata[0] | (rawdata[1] << 8); rawdata += 2; - rec = MsiCreateRecord( tv->num_cols ); + rec = libmsi_record_create( tv->num_cols ); if( !rec ) return rec; @@ -2377,7 +2377,7 @@ static LibmsiRecord *msi_get_transform_record( const LibmsiTableVIEW *tv, const return NULL; } - MSI_RecordSetStream( rec, i+1, stm ); + _libmsi_record_load_stream( rec, i+1, stm ); TRACE(" field %d [%s]\n", i+1, debugstr_w(encname)); msi_free( encname ); } @@ -2387,7 +2387,7 @@ static LibmsiRecord *msi_get_transform_record( const LibmsiTableVIEW *tv, const val = read_raw_int(rawdata, ofs, bytes_per_strref); sval = msi_string_lookup_id( st, val ); - MSI_RecordSetStringW( rec, i+1, sval ); + _libmsi_record_set_stringW( rec, i+1, sval ); TRACE(" field %d [%s]\n", i+1, debugstr_w(sval)); ofs += bytes_per_strref; } @@ -2399,13 +2399,13 @@ static LibmsiRecord *msi_get_transform_record( const LibmsiTableVIEW *tv, const case 2: val = read_raw_int(rawdata, ofs, n); if (val) - MsiRecordSetInteger( rec, i+1, val-0x8000 ); + libmsi_record_set_int( rec, i+1, val-0x8000 ); TRACE(" field %d [0x%04x]\n", i+1, val ); break; case 4: val = read_raw_int(rawdata, ofs, n); if (val) - MsiRecordSetInteger( rec, i+1, val^0x80000000 ); + libmsi_record_set_int( rec, i+1, val^0x80000000 ); TRACE(" field %d [0x%08x]\n", i+1, val ); break; default: @@ -2422,17 +2422,17 @@ static void dump_record( LibmsiRecord *rec ) { unsigned i, n; - n = MsiRecordGetFieldCount( rec ); + n = libmsi_record_get_field_count( rec ); for( i=1; i<=n; i++ ) { const WCHAR *sval; - if( MsiRecordIsNull( rec, i ) ) + if( libmsi_record_is_null( rec, i ) ) TRACE("row -> []\n"); - else if( (sval = MSI_RecordGetStringRaw( rec, i )) ) + else if( (sval = _libmsi_record_get_string_raw( rec, i )) ) TRACE("row -> [%s]\n", debugstr_w(sval)); else - TRACE("row -> [0x%08x]\n", MsiRecordGetInteger( rec, i ) ); + TRACE("row -> [0x%08x]\n", libmsi_record_get_integer( rec, i ) ); } } @@ -2448,7 +2448,7 @@ static void dump_table( const string_table *st, const uint16_t *rawdata, unsigne } } -static unsigned* msi_record_to_row( const LibmsiTableVIEW *tv, LibmsiRecord *rec ) +static unsigned* msi_record_to_row( const LibmsiTableView *tv, LibmsiRecord *rec ) { const WCHAR *str; unsigned i, r, *data; @@ -2465,10 +2465,10 @@ static unsigned* msi_record_to_row( const LibmsiTableVIEW *tv, LibmsiRecord *rec if ( ( tv->columns[i].type & MSITYPE_STRING ) && ! MSITYPE_IS_BINARY(tv->columns[i].type) ) { - str = MSI_RecordGetStringRaw( rec, i+1 ); + str = _libmsi_record_get_string_raw( rec, i+1 ); if (str) { - r = msi_string2idW( tv->db->strings, str, &data[i] ); + r = _libmsi_id_from_stringW( tv->db->strings, str, &data[i] ); /* if there's no matching string in the string table, these keys can't match any record, so fail now. */ @@ -2482,7 +2482,7 @@ static unsigned* msi_record_to_row( const LibmsiTableVIEW *tv, LibmsiRecord *rec } else { - data[i] = MsiRecordGetInteger( rec, i+1 ); + data[i] = libmsi_record_get_integer( rec, i+1 ); if (data[i] == MSI_NULL_INTEGER) data[i] = 0; @@ -2495,7 +2495,7 @@ static unsigned* msi_record_to_row( const LibmsiTableVIEW *tv, LibmsiRecord *rec return data; } -static unsigned msi_row_matches( LibmsiTableVIEW *tv, unsigned row, const unsigned *data, unsigned *column ) +static unsigned msi_row_matches( LibmsiTableView *tv, unsigned row, const unsigned *data, unsigned *column ) { unsigned i, r, x, ret = ERROR_FUNCTION_FAILED; @@ -2505,10 +2505,10 @@ static unsigned msi_row_matches( LibmsiTableVIEW *tv, unsigned row, const unsign continue; /* turn the transform column value into a row value */ - r = TABLE_fetch_int( &tv->view, row, i+1, &x ); + r = table_view_fetch_int( &tv->view, row, i+1, &x ); if ( r != ERROR_SUCCESS ) { - ERR("TABLE_fetch_int shouldn't fail here\n"); + ERR("table_view_fetch_int shouldn't fail here\n"); break; } @@ -2524,7 +2524,7 @@ static unsigned msi_row_matches( LibmsiTableVIEW *tv, unsigned row, const unsign return ret; } -static unsigned msi_table_find_row( LibmsiTableVIEW *tv, LibmsiRecord *rec, unsigned *row, unsigned *column ) +static unsigned msi_table_find_row( LibmsiTableView *tv, LibmsiRecord *rec, unsigned *row, unsigned *column ) { unsigned i, r = ERROR_FUNCTION_FAILED, *data; @@ -2555,7 +2555,7 @@ static unsigned msi_table_load_transform( LibmsiDatabase *db, IStorage *stg, unsigned bytes_per_strref ) { uint8_t *rawdata = NULL; - LibmsiTableVIEW *tv = NULL; + LibmsiTableView *tv = NULL; unsigned r, n, sz, i, mask, num_cols, colcol = 0, rawsize = 0; LibmsiRecord *rec = NULL; WCHAR coltable[32]; @@ -2578,7 +2578,7 @@ static unsigned msi_table_load_transform( LibmsiDatabase *db, IStorage *stg, } /* create a table view */ - r = TABLE_CreateView( db, name, (LibmsiView**) &tv ); + r = table_view_create( db, name, (LibmsiView**) &tv ); if( r != ERROR_SUCCESS ) goto err; @@ -2653,8 +2653,8 @@ static unsigned msi_table_load_transform( LibmsiDatabase *db, IStorage *stg, if (!strcmpW( name, szColumns )) { - MSI_RecordGetStringW( rec, 1, table, &sz ); - number = MsiRecordGetInteger( rec, 2 ); + _libmsi_record_get_stringW( rec, 1, table, &sz ); + number = libmsi_record_get_integer( rec, 2 ); /* * Native msi seems writes nul into the Number (2nd) column of @@ -2670,7 +2670,7 @@ static unsigned msi_table_load_transform( LibmsiDatabase *db, IStorage *stg, } /* fix nul column numbers */ - MsiRecordSetInteger( rec, 2, ++colcol ); + libmsi_record_set_int( rec, 2, ++colcol ); } } @@ -2682,21 +2682,21 @@ static unsigned msi_table_load_transform( LibmsiDatabase *db, IStorage *stg, if (!mask) { TRACE("deleting row [%d]:\n", row); - r = TABLE_delete_row( &tv->view, row ); + r = table_view_delete_row( &tv->view, row ); if (r != ERROR_SUCCESS) WARN("failed to delete row %u\n", r); } else if (mask & 1) { TRACE("modifying full row [%d]:\n", row); - r = TABLE_set_row( &tv->view, row, rec, (1 << tv->num_cols) - 1 ); + r = table_view_set_row( &tv->view, row, rec, (1 << tv->num_cols) - 1 ); if (r != ERROR_SUCCESS) WARN("failed to modify row %u\n", r); } else { TRACE("modifying masked row [%d]:\n", row); - r = TABLE_set_row( &tv->view, row, rec, mask ); + r = table_view_set_row( &tv->view, row, rec, mask ); if (r != ERROR_SUCCESS) WARN("failed to modify row %u\n", r); } @@ -2704,7 +2704,7 @@ static unsigned msi_table_load_transform( LibmsiDatabase *db, IStorage *stg, else { TRACE("inserting row\n"); - r = TABLE_insert_row( &tv->view, rec, -1, false ); + r = table_view_insert_row( &tv->view, rec, -1, false ); if (r != ERROR_SUCCESS) WARN("failed to insert row %u\n", r); } @@ -2758,7 +2758,7 @@ unsigned msi_table_apply_transform( LibmsiDatabase *db, IStorage *stg ) while ( true ) { - LibmsiTableVIEW *tv = NULL; + LibmsiTableView *tv = NULL; WCHAR name[0x40]; unsigned count = 0; @@ -2791,7 +2791,7 @@ unsigned msi_table_apply_transform( LibmsiDatabase *db, IStorage *stg ) TRACE("transform contains stream %s\n", debugstr_w(name)); /* load the table */ - r = TABLE_CreateView( db, transform->name, (LibmsiView**) &tv ); + r = table_view_create( db, transform->name, (LibmsiView**) &tv ); if( r != ERROR_SUCCESS ) continue; diff --git a/libmsi/tokenize.c b/libmsi/tokenize.c index 0ddf14e..007411e 100644 --- a/libmsi/tokenize.c +++ b/libmsi/tokenize.c @@ -87,7 +87,7 @@ static const Keyword aKeywordTable[] = { /* ** Comparison function for binary search. */ -static int compKeyword(const void *m1, const void *m2){ +static int sql_compare_keyword(const void *m1, const void *m2){ const WCHAR *p = m1; const Keyword *k = m2; const char *q = k->zName; @@ -111,7 +111,7 @@ static int compKeyword(const void *m1, const void *m2){ ** keyword. If it is a keyword, the token code of that keyword is ** returned. If the input is not a keyword, TK_ID is returned. */ -static int sqliteKeywordCode(const WCHAR *z, int n){ +static int sqlite_find_keyword(const WCHAR *z, int n){ WCHAR str[MAX_TOKEN_LEN+1]; Keyword *r; @@ -120,7 +120,7 @@ static int sqliteKeywordCode(const WCHAR *z, int n){ memcpy( str, z, n*sizeof (WCHAR) ); str[n] = 0; - r = bsearch( str, aKeywordTable, KEYWORD_COUNT, sizeof (Keyword), compKeyword ); + r = bsearch( str, aKeywordTable, KEYWORD_COUNT, sizeof (Keyword), sql_compare_keyword ); if( r ) return r->tokenType; return TK_ID; @@ -163,7 +163,7 @@ static const char isIdChar[] = { ** -1 if the token is (or might be) incomplete. Store the token ** type in *tokenType before returning. */ -int sqliteGetToken(const WCHAR *z, int *tokenType, int *skip){ +int sql_get_token(const WCHAR *z, int *tokenType, int *skip){ int i; *skip = 0; @@ -254,7 +254,7 @@ int sqliteGetToken(const WCHAR *z, int *tokenType, int *skip){ break; } for(i=1; isIdChar[z[i]]; i++){} - *tokenType = sqliteKeywordCode(z, i); + *tokenType = sqlite_find_keyword(z, i); if( *tokenType == TK_ID && z[i] == '`' ) *skip = 1; return i; } diff --git a/libmsi/update.c b/libmsi/update.c index 2b57ebd..0f9979d 100644 --- a/libmsi/update.c +++ b/libmsi/update.c @@ -44,7 +44,7 @@ typedef struct LibmsiUpdateView column_info *vals; } LibmsiUpdateView; -static unsigned UPDATE_fetch_int( LibmsiView *view, unsigned row, unsigned col, unsigned *val ) +static unsigned update_view_fetch_int( LibmsiView *view, unsigned row, unsigned col, unsigned *val ) { LibmsiUpdateView *uv = (LibmsiUpdateView*)view; @@ -53,7 +53,7 @@ static unsigned UPDATE_fetch_int( LibmsiView *view, unsigned row, unsigned col, return ERROR_FUNCTION_FAILED; } -static unsigned UPDATE_execute( LibmsiView *view, LibmsiRecord *record ) +static unsigned update_view_execute( LibmsiView *view, LibmsiRecord *record ) { LibmsiUpdateView *uv = (LibmsiUpdateView*)view; unsigned i, r, col_count = 0, row_count = 0; @@ -68,7 +68,7 @@ static unsigned UPDATE_execute( LibmsiView *view, LibmsiRecord *record ) /* extract the where markers from the record */ if (record) { - r = MsiRecordGetFieldCount(record); + r = libmsi_record_get_field_count(record); for (i = 0; col; col = col->next) i++; @@ -78,11 +78,11 @@ static unsigned UPDATE_execute( LibmsiView *view, LibmsiRecord *record ) if (where_count > 0) { - where = MsiCreateRecord(where_count); + where = libmsi_record_create(where_count); if (where) for (i = 1; i <= where_count; i++) - MSI_RecordCopyField(record, cols_count + i, where, i); + _libmsi_record_copy_field(record, cols_count + i, where, i); } } @@ -124,7 +124,7 @@ done: } -static unsigned UPDATE_close( LibmsiView *view ) +static unsigned update_view_close( LibmsiView *view ) { LibmsiUpdateView *uv = (LibmsiUpdateView*)view; LibmsiView *wv; @@ -138,7 +138,7 @@ static unsigned UPDATE_close( LibmsiView *view ) return wv->ops->close( wv ); } -static unsigned UPDATE_get_dimensions( LibmsiView *view, unsigned *rows, unsigned *cols ) +static unsigned update_view_get_dimensions( LibmsiView *view, unsigned *rows, unsigned *cols ) { LibmsiUpdateView *uv = (LibmsiUpdateView*)view; LibmsiView *wv; @@ -152,7 +152,7 @@ static unsigned UPDATE_get_dimensions( LibmsiView *view, unsigned *rows, unsigne return wv->ops->get_dimensions( wv, rows, cols ); } -static unsigned UPDATE_get_column_info( LibmsiView *view, unsigned n, const WCHAR **name, +static unsigned update_view_get_column_info( LibmsiView *view, unsigned n, const WCHAR **name, unsigned *type, bool *temporary, const WCHAR **table_name ) { LibmsiUpdateView *uv = (LibmsiUpdateView*)view; @@ -167,7 +167,7 @@ static unsigned UPDATE_get_column_info( LibmsiView *view, unsigned n, const WCHA return wv->ops->get_column_info( wv, n, name, type, temporary, table_name ); } -static unsigned UPDATE_modify( LibmsiView *view, LibmsiModify eModifyMode, +static unsigned update_view_modify( LibmsiView *view, LibmsiModify eModifyMode, LibmsiRecord *rec, unsigned row ) { LibmsiUpdateView *uv = (LibmsiUpdateView*)view; @@ -177,7 +177,7 @@ static unsigned UPDATE_modify( LibmsiView *view, LibmsiModify eModifyMode, return ERROR_FUNCTION_FAILED; } -static unsigned UPDATE_delete( LibmsiView *view ) +static unsigned update_view_delete( LibmsiView *view ) { LibmsiUpdateView *uv = (LibmsiUpdateView*)view; LibmsiView *wv; @@ -193,7 +193,7 @@ static unsigned UPDATE_delete( LibmsiView *view ) return ERROR_SUCCESS; } -static unsigned UPDATE_find_matching_rows( LibmsiView *view, unsigned col, unsigned val, unsigned *row, MSIITERHANDLE *handle ) +static unsigned update_view_find_matching_rows( LibmsiView *view, unsigned col, unsigned val, unsigned *row, MSIITERHANDLE *handle ) { TRACE("%p %d %d %p\n", view, col, val, *handle ); @@ -201,21 +201,21 @@ static unsigned UPDATE_find_matching_rows( LibmsiView *view, unsigned col, unsig } -static const LibmsiViewOPS update_ops = +static const LibmsiViewOps update_ops = { - UPDATE_fetch_int, + update_view_fetch_int, NULL, NULL, NULL, NULL, NULL, - UPDATE_execute, - UPDATE_close, - UPDATE_get_dimensions, - UPDATE_get_column_info, - UPDATE_modify, - UPDATE_delete, - UPDATE_find_matching_rows, + update_view_execute, + update_view_close, + update_view_get_dimensions, + update_view_get_column_info, + update_view_modify, + update_view_delete, + update_view_find_matching_rows, NULL, NULL, NULL, @@ -223,7 +223,7 @@ static const LibmsiViewOPS update_ops = NULL, }; -unsigned UPDATE_CreateView( LibmsiDatabase *db, LibmsiView **view, WCHAR *table, +unsigned update_view_create( LibmsiDatabase *db, LibmsiView **view, WCHAR *table, column_info *columns, struct expr *expr ) { LibmsiUpdateView *uv = NULL; @@ -233,15 +233,15 @@ unsigned UPDATE_CreateView( LibmsiDatabase *db, LibmsiView **view, WCHAR *table, TRACE("%p\n", uv ); if (expr) - r = WHERE_CreateView( db, &wv, table, expr ); + r = where_view_create( db, &wv, table, expr ); else - r = TABLE_CreateView( db, table, &wv ); + r = table_view_create( db, table, &wv ); if( r != ERROR_SUCCESS ) return r; /* then select the columns we want */ - r = SELECT_CreateView( db, &sv, wv, columns ); + r = select_view_create( db, &sv, wv, columns ); if( r != ERROR_SUCCESS ) { wv->ops->delete( wv ); diff --git a/libmsi/where.c b/libmsi/where.c index b8989d5..2689e6b 100644 --- a/libmsi/where.c +++ b/libmsi/where.c @@ -74,7 +74,7 @@ typedef struct LibmsiWhereView LibmsiOrderInfo *order_info; } LibmsiWhereView; -static unsigned WHERE_evaluate( LibmsiWhereView *wv, const unsigned rows[], +static unsigned where_view_evaluate( LibmsiWhereView *wv, const unsigned rows[], struct expr *cond, int *val, LibmsiRecord *record ); #define INITIAL_REORDER_SIZE 16 @@ -212,7 +212,7 @@ static unsigned parse_column(LibmsiWhereView *wv, union ext_column *column, return ERROR_BAD_QUERY_SYNTAX; } -static unsigned WHERE_fetch_int( LibmsiView *view, unsigned row, unsigned col, unsigned *val ) +static unsigned where_view_fetch_int( LibmsiView *view, unsigned row, unsigned col, unsigned *val ) { LibmsiWhereView *wv = (LibmsiWhereView*)view; JOINTABLE *table; @@ -235,7 +235,7 @@ static unsigned WHERE_fetch_int( LibmsiView *view, unsigned row, unsigned col, u return table->view->ops->fetch_int(table->view, rows[table->table_index], col, val); } -static unsigned WHERE_fetch_stream( LibmsiView *view, unsigned row, unsigned col, IStream **stm ) +static unsigned where_view_fetch_stream( LibmsiView *view, unsigned row, unsigned col, IStream **stm ) { LibmsiWhereView *wv = (LibmsiWhereView*)view; JOINTABLE *table; @@ -258,7 +258,7 @@ static unsigned WHERE_fetch_stream( LibmsiView *view, unsigned row, unsigned col return table->view->ops->fetch_stream( table->view, rows[table->table_index], col, stm ); } -static unsigned WHERE_get_row( LibmsiView *view, unsigned row, LibmsiRecord **rec ) +static unsigned where_view_get_row( LibmsiView *view, unsigned row, LibmsiRecord **rec ) { LibmsiWhereView *wv = (LibmsiWhereView *)view; @@ -270,7 +270,7 @@ static unsigned WHERE_get_row( LibmsiView *view, unsigned row, LibmsiRecord **re return msi_view_get_row( wv->db, view, row, rec ); } -static unsigned WHERE_set_row( LibmsiView *view, unsigned row, LibmsiRecord *rec, unsigned mask ) +static unsigned where_view_set_row( LibmsiView *view, unsigned row, LibmsiRecord *rec, unsigned mask ) { LibmsiWhereView *wv = (LibmsiWhereView*)view; unsigned i, r, offset = 0; @@ -323,13 +323,13 @@ static unsigned WHERE_set_row( LibmsiView *view, unsigned row, LibmsiRecord *rec continue; } - reduced = MsiCreateRecord(col_count); + reduced = libmsi_record_create(col_count); if (!reduced) return ERROR_FUNCTION_FAILED; for (i = 1; i <= col_count; i++) { - r = MSI_RecordCopyField(rec, i + offset, reduced, i); + r = _libmsi_record_copy_field(rec, i + offset, reduced, i); if (r != ERROR_SUCCESS) break; } @@ -345,7 +345,7 @@ static unsigned WHERE_set_row( LibmsiView *view, unsigned row, LibmsiRecord *rec return r; } -static unsigned WHERE_delete_row(LibmsiView *view, unsigned row) +static unsigned where_view_delete_row(LibmsiView *view, unsigned row) { LibmsiWhereView *wv = (LibmsiWhereView *)view; unsigned r; @@ -366,16 +366,16 @@ static unsigned WHERE_delete_row(LibmsiView *view, unsigned row) return wv->tables->view->ops->delete_row(wv->tables->view, rows[0]); } -static int INT_evaluate_binary( LibmsiWhereView *wv, const unsigned rows[], +static int expr_eval_binary( LibmsiWhereView *wv, const unsigned rows[], const struct complex_expr *expr, int *val, LibmsiRecord *record ) { unsigned rl, rr; int lval, rval; - rl = WHERE_evaluate(wv, rows, expr->left, &lval, record); + rl = where_view_evaluate(wv, rows, expr->left, &lval, record); if (rl != ERROR_SUCCESS && rl != ERROR_CONTINUE) return rl; - rr = WHERE_evaluate(wv, rows, expr->right, &rval, record); + rr = where_view_evaluate(wv, rows, expr->right, &rval, record); if (rr != ERROR_SUCCESS && rr != ERROR_CONTINUE) return rr; @@ -456,7 +456,7 @@ static inline unsigned expr_fetch_value(const union ext_column *expr, const unsi } -static unsigned INT_evaluate_unary( LibmsiWhereView *wv, const unsigned rows[], +static unsigned expr_eval_unary( LibmsiWhereView *wv, const unsigned rows[], const struct complex_expr *expr, int *val, LibmsiRecord *record ) { unsigned r; @@ -481,7 +481,7 @@ static unsigned INT_evaluate_unary( LibmsiWhereView *wv, const unsigned rows[], return ERROR_SUCCESS; } -static unsigned STRING_evaluate( LibmsiWhereView *wv, const unsigned rows[], +static unsigned expr_eval_string( LibmsiWhereView *wv, const unsigned rows[], const struct expr *expr, const LibmsiRecord *record, const WCHAR **str ) @@ -503,7 +503,7 @@ static unsigned STRING_evaluate( LibmsiWhereView *wv, const unsigned rows[], break; case EXPR_WILDCARD: - *str = MSI_RecordGetStringRaw(record, ++wv->rec_index); + *str = _libmsi_record_get_string_raw(record, ++wv->rec_index); break; default: @@ -515,7 +515,7 @@ static unsigned STRING_evaluate( LibmsiWhereView *wv, const unsigned rows[], return r; } -static unsigned STRCMP_Evaluate( LibmsiWhereView *wv, const unsigned rows[], const struct complex_expr *expr, +static unsigned expr_eval_strcmp( LibmsiWhereView *wv, const unsigned rows[], const struct complex_expr *expr, int *val, const LibmsiRecord *record ) { int sr; @@ -523,10 +523,10 @@ static unsigned STRCMP_Evaluate( LibmsiWhereView *wv, const unsigned rows[], con unsigned r; *val = true; - r = STRING_evaluate(wv, rows, expr->left, record, &l_str); + r = expr_eval_string(wv, rows, expr->left, record, &l_str); if (r == ERROR_CONTINUE) return r; - r = STRING_evaluate(wv, rows, expr->right, record, &r_str); + r = expr_eval_string(wv, rows, expr->right, record, &r_str); if (r == ERROR_CONTINUE) return r; @@ -546,7 +546,7 @@ static unsigned STRCMP_Evaluate( LibmsiWhereView *wv, const unsigned rows[], con return ERROR_SUCCESS; } -static unsigned WHERE_evaluate( LibmsiWhereView *wv, const unsigned rows[], +static unsigned where_view_evaluate( LibmsiWhereView *wv, const unsigned rows[], struct expr *cond, int *val, LibmsiRecord *record ) { unsigned r, tval; @@ -578,16 +578,16 @@ static unsigned WHERE_evaluate( LibmsiWhereView *wv, const unsigned rows[], return ERROR_SUCCESS; case EXPR_COMPLEX: - return INT_evaluate_binary(wv, rows, &cond->u.expr, val, record); + return expr_eval_binary(wv, rows, &cond->u.expr, val, record); case EXPR_UNARY: - return INT_evaluate_unary( wv, rows, &cond->u.expr, val, record ); + return expr_eval_unary( wv, rows, &cond->u.expr, val, record ); case EXPR_STRCMP: - return STRCMP_Evaluate( wv, rows, &cond->u.expr, val, record ); + return expr_eval_strcmp( wv, rows, &cond->u.expr, val, record ); case EXPR_WILDCARD: - *val = MsiRecordGetInteger( record, ++wv->rec_index ); + *val = libmsi_record_get_integer( record, ++wv->rec_index ); return ERROR_SUCCESS; default: @@ -610,7 +610,7 @@ static unsigned check_condition( LibmsiWhereView *wv, LibmsiRecord *record, JOIN { val = 0; wv->rec_index = 0; - r = WHERE_evaluate( wv, table_rows, wv->cond, &val, record ); + r = where_view_evaluate( wv, table_rows, wv->cond, &val, record ); if (r != ERROR_SUCCESS && r != ERROR_CONTINUE) break; if (val) @@ -762,7 +762,7 @@ static JOINTABLE **ordertables( LibmsiWhereView *wv ) return tables; } -static unsigned WHERE_execute( LibmsiView *view, LibmsiRecord *record ) +static unsigned where_view_execute( LibmsiView *view, LibmsiRecord *record ) { LibmsiWhereView *wv = (LibmsiWhereView*)view; unsigned r; @@ -818,7 +818,7 @@ static unsigned WHERE_execute( LibmsiView *view, LibmsiRecord *record ) return r; } -static unsigned WHERE_close( LibmsiView *view ) +static unsigned where_view_close( LibmsiView *view ) { LibmsiWhereView *wv = (LibmsiWhereView*)view; JOINTABLE *table = wv->tables; @@ -835,7 +835,7 @@ static unsigned WHERE_close( LibmsiView *view ) return ERROR_SUCCESS; } -static unsigned WHERE_get_dimensions( LibmsiView *view, unsigned *rows, unsigned *cols ) +static unsigned where_view_get_dimensions( LibmsiView *view, unsigned *rows, unsigned *cols ) { LibmsiWhereView *wv = (LibmsiWhereView*)view; @@ -857,7 +857,7 @@ static unsigned WHERE_get_dimensions( LibmsiView *view, unsigned *rows, unsigned return ERROR_SUCCESS; } -static unsigned WHERE_get_column_info( LibmsiView *view, unsigned n, const WCHAR **name, +static unsigned where_view_get_column_info( LibmsiView *view, unsigned n, const WCHAR **name, unsigned *type, bool *temporary, const WCHAR **table_name ) { LibmsiWhereView *wv = (LibmsiWhereView*)view; @@ -881,14 +881,14 @@ static unsigned join_find_row( LibmsiWhereView *wv, LibmsiRecord *rec, unsigned const WCHAR *str; unsigned r, i, id, data; - str = MSI_RecordGetStringRaw( rec, 1 ); - r = msi_string2idW( wv->db->strings, str, &id ); + str = _libmsi_record_get_string_raw( rec, 1 ); + r = _libmsi_id_from_stringW( wv->db->strings, str, &id ); if (r != ERROR_SUCCESS) return r; for (i = 0; i < wv->row_count; i++) { - WHERE_fetch_int( &wv->view, i, 1, &data ); + where_view_fetch_int( &wv->view, i, 1, &data ); if (data == id) { @@ -915,19 +915,19 @@ static unsigned join_modify_update( LibmsiView *view, LibmsiRecord *rec ) if (r != ERROR_SUCCESS) return r; - assert(MsiRecordGetFieldCount(rec) == MsiRecordGetFieldCount(current)); + assert(libmsi_record_get_field_count(rec) == libmsi_record_get_field_count(current)); - for (i = MsiRecordGetFieldCount(rec); i > 0; i--) + for (i = libmsi_record_get_field_count(rec); i > 0; i--) { - if (!MSI_RecordsAreFieldsEqual(rec, current, i)) + if (!_libmsi_record_compare_fields(rec, current, i)) mask |= 1 << (i - 1); } msiobj_release(¤t->hdr); - return WHERE_set_row( view, row, rec, mask ); + return where_view_set_row( view, row, rec, mask ); } -static unsigned WHERE_modify( LibmsiView *view, LibmsiModify eModifyMode, +static unsigned where_view_modify( LibmsiView *view, LibmsiModify eModifyMode, LibmsiRecord *rec, unsigned row ) { LibmsiWhereView *wv = (LibmsiWhereView*)view; @@ -983,7 +983,7 @@ static unsigned WHERE_modify( LibmsiView *view, LibmsiModify eModifyMode, return r; } -static unsigned WHERE_delete( LibmsiView *view ) +static unsigned where_view_delete( LibmsiView *view ) { LibmsiWhereView *wv = (LibmsiWhereView*)view; JOINTABLE *table = wv->tables; @@ -1014,7 +1014,7 @@ static unsigned WHERE_delete( LibmsiView *view ) return ERROR_SUCCESS; } -static unsigned WHERE_find_matching_rows( LibmsiView *view, unsigned col, +static unsigned where_view_find_matching_rows( LibmsiView *view, unsigned col, unsigned val, unsigned *row, MSIITERHANDLE *handle ) { LibmsiWhereView *wv = (LibmsiWhereView*)view; @@ -1044,7 +1044,7 @@ static unsigned WHERE_find_matching_rows( LibmsiView *view, unsigned col, return ERROR_NO_MORE_ITEMS; } -static unsigned WHERE_sort(LibmsiView *view, column_info *columns) +static unsigned where_view_sort(LibmsiView *view, column_info *columns) { LibmsiWhereView *wv = (LibmsiWhereView *)view; JOINTABLE *table = wv->tables; @@ -1093,30 +1093,30 @@ error: return r; } -static const LibmsiViewOPS where_ops = +static const LibmsiViewOps where_ops = { - WHERE_fetch_int, - WHERE_fetch_stream, - WHERE_get_row, - WHERE_set_row, + where_view_fetch_int, + where_view_fetch_stream, + where_view_get_row, + where_view_set_row, NULL, - WHERE_delete_row, - WHERE_execute, - WHERE_close, - WHERE_get_dimensions, - WHERE_get_column_info, - WHERE_modify, - WHERE_delete, - WHERE_find_matching_rows, + where_view_delete_row, + where_view_execute, + where_view_close, + where_view_get_dimensions, + where_view_get_column_info, + where_view_modify, + where_view_delete, + where_view_find_matching_rows, NULL, NULL, NULL, NULL, - WHERE_sort, + where_view_sort, NULL, }; -static unsigned WHERE_VerifyCondition( LibmsiWhereView *wv, struct expr *cond, +static unsigned where_view_verify_condition( LibmsiWhereView *wv, struct expr *cond, unsigned *valid ) { unsigned r; @@ -1144,12 +1144,12 @@ static unsigned WHERE_VerifyCondition( LibmsiWhereView *wv, struct expr *cond, break; } case EXPR_COMPLEX: - r = WHERE_VerifyCondition( wv, cond->u.expr.left, valid ); + r = where_view_verify_condition( wv, cond->u.expr.left, valid ); if( r != ERROR_SUCCESS ) return r; if( !*valid ) return ERROR_SUCCESS; - r = WHERE_VerifyCondition( wv, cond->u.expr.right, valid ); + r = where_view_verify_condition( wv, cond->u.expr.right, valid ); if( r != ERROR_SUCCESS ) return r; @@ -1181,7 +1181,7 @@ static unsigned WHERE_VerifyCondition( LibmsiWhereView *wv, struct expr *cond, *valid = false; return ERROR_INVALID_PARAMETER; } - r = WHERE_VerifyCondition( wv, cond->u.expr.left, valid ); + r = where_view_verify_condition( wv, cond->u.expr.left, valid ); if( r != ERROR_SUCCESS ) return r; break; @@ -1205,7 +1205,7 @@ static unsigned WHERE_VerifyCondition( LibmsiWhereView *wv, struct expr *cond, return ERROR_SUCCESS; } -unsigned WHERE_CreateView( LibmsiDatabase *db, LibmsiView **view, WCHAR *tables, +unsigned where_view_create( LibmsiDatabase *db, LibmsiView **view, WCHAR *tables, struct expr *cond ) { LibmsiWhereView *wv = NULL; @@ -1238,7 +1238,7 @@ unsigned WHERE_CreateView( LibmsiDatabase *db, LibmsiView **view, WCHAR *tables, goto end; } - r = TABLE_CreateView(db, tables, &table->view); + r = table_view_create(db, tables, &table->view); if (r != ERROR_SUCCESS) { WARN("can't create table: %s\n", debugstr_w(tables)); @@ -1269,7 +1269,7 @@ unsigned WHERE_CreateView( LibmsiDatabase *db, LibmsiView **view, WCHAR *tables, if( cond ) { - r = WHERE_VerifyCondition( wv, cond, &valid ); + r = where_view_verify_condition( wv, cond, &valid ); if( r != ERROR_SUCCESS ) goto end; if( !valid ) { @@ -1282,7 +1282,7 @@ unsigned WHERE_CreateView( LibmsiDatabase *db, LibmsiView **view, WCHAR *tables, return ERROR_SUCCESS; end: - WHERE_delete(&wv->view); + where_view_delete(&wv->view); return r; } |