diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2012-12-03 10:48:12 +0100 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2012-12-06 20:30:32 +0100 |
commit | 93de41a911d54b018b4d6d52728de6661562f79a (patch) | |
tree | 7de96a722ce8af91187e21f10c84e58b5466c98e | |
parent | d504a4ebb37a9a2f1ea607880e7e4ff052b63d23 (diff) | |
download | msitools-93de41a911d54b018b4d6d52728de6661562f79a.tar.gz msitools-93de41a911d54b018b4d6d52728de6661562f79a.tar.xz msitools-93de41a911d54b018b4d6d52728de6661562f79a.zip |
do not use _libmsi_query_modify
-rw-r--r-- | libmsi/database.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/libmsi/database.c b/libmsi/database.c index 1f8fc3e..7b2f440 100644 --- a/libmsi/database.c +++ b/libmsi/database.c @@ -812,24 +812,22 @@ static unsigned msi_add_records_to_table(LibmsiDatabase *db, WCHAR **columns, WC int num_columns, int num_records, const char *path) { - unsigned r; + unsigned r, num_rows, num_cols; int i; - LibmsiQuery *view; + LibmsiView *view; LibmsiRecord *rec; - static const WCHAR select[] = { - 'S','E','L','E','C','T',' ','*',' ', - 'F','R','O','M',' ','`','%','s','`',0 - }; + r = table_view_create(db, labels[0], &view); + if (r != LIBMSI_RESULT_SUCCESS) + return r; - r = _libmsi_query_open(db, &view, select, labels[0]); + r = view->ops->get_dimensions( view, &num_rows, &num_cols ); if (r != LIBMSI_RESULT_SUCCESS) return r; - while (_libmsi_query_fetch(view, &rec) != LIBMSI_RESULT_NO_MORE_ITEMS) + while (num_rows > 0) { - r = _libmsi_query_modify(view, LIBMSI_MODIFY_DELETE, rec); - msiobj_release(&rec->hdr); + r = view->ops->delete_row(view, --num_rows); if (r != LIBMSI_RESULT_SUCCESS) goto done; } @@ -840,7 +838,7 @@ static unsigned msi_add_records_to_table(LibmsiDatabase *db, WCHAR **columns, WC if (r != LIBMSI_RESULT_SUCCESS) goto done; - r = _libmsi_query_modify(view, LIBMSI_MODIFY_INSERT, rec); + r = view->ops->insert_row(view, rec, -1, false); if (r != LIBMSI_RESULT_SUCCESS) { msiobj_release(&rec->hdr); |