msi: Get rid of the find_matching_rows() view operation.
It was introduced in9f487ba1d
as part of an optimization, but ceased to be used ina52c2bf94
. Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Hans Leidekker <hans@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
fe23e01527
commit
ced768f2ec
|
@ -221,14 +221,6 @@ static UINT ALTER_delete( struct tagMSIVIEW *view )
|
|||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
static UINT ALTER_find_matching_rows( struct tagMSIVIEW *view, UINT col,
|
||||
UINT val, UINT *row, MSIITERHANDLE *handle )
|
||||
{
|
||||
TRACE("%p, %d, %u, %p\n", view, col, val, *handle);
|
||||
|
||||
return ERROR_FUNCTION_FAILED;
|
||||
}
|
||||
|
||||
static const MSIVIEWOPS alter_ops =
|
||||
{
|
||||
ALTER_fetch_int,
|
||||
|
@ -243,7 +235,6 @@ static const MSIVIEWOPS alter_ops =
|
|||
ALTER_get_column_info,
|
||||
ALTER_modify,
|
||||
ALTER_delete,
|
||||
ALTER_find_matching_rows,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
|
|
|
@ -142,7 +142,6 @@ static const MSIVIEWOPS create_ops =
|
|||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static UINT check_columns( const column_info *col_info )
|
||||
|
|
|
@ -164,15 +164,6 @@ static UINT DELETE_delete( struct tagMSIVIEW *view )
|
|||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
static UINT DELETE_find_matching_rows( struct tagMSIVIEW *view, UINT col,
|
||||
UINT val, UINT *row, MSIITERHANDLE *handle )
|
||||
{
|
||||
TRACE("%p, %d, %u, %p\n", view, col, val, *handle);
|
||||
|
||||
return ERROR_FUNCTION_FAILED;
|
||||
}
|
||||
|
||||
|
||||
static const MSIVIEWOPS delete_ops =
|
||||
{
|
||||
DELETE_fetch_int,
|
||||
|
@ -187,7 +178,6 @@ static const MSIVIEWOPS delete_ops =
|
|||
DELETE_get_column_info,
|
||||
DELETE_modify,
|
||||
DELETE_delete,
|
||||
DELETE_find_matching_rows,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
|
|
|
@ -247,27 +247,6 @@ static UINT DISTINCT_delete( struct tagMSIVIEW *view )
|
|||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
static UINT DISTINCT_find_matching_rows( struct tagMSIVIEW *view, UINT col,
|
||||
UINT val, UINT *row, MSIITERHANDLE *handle )
|
||||
{
|
||||
MSIDISTINCTVIEW *dv = (MSIDISTINCTVIEW*)view;
|
||||
UINT r;
|
||||
|
||||
TRACE("%p, %d, %u, %p\n", view, col, val, *handle);
|
||||
|
||||
if( !dv->table )
|
||||
return ERROR_FUNCTION_FAILED;
|
||||
|
||||
r = dv->table->ops->find_matching_rows( dv->table, col, val, row, handle );
|
||||
|
||||
if( *row > dv->row_count )
|
||||
return ERROR_NO_MORE_ITEMS;
|
||||
|
||||
*row = dv->translation[ *row ];
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
static const MSIVIEWOPS distinct_ops =
|
||||
{
|
||||
DISTINCT_fetch_int,
|
||||
|
@ -282,7 +261,6 @@ static const MSIVIEWOPS distinct_ops =
|
|||
DISTINCT_get_column_info,
|
||||
DISTINCT_modify,
|
||||
DISTINCT_delete,
|
||||
DISTINCT_find_matching_rows,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
|
|
|
@ -112,7 +112,6 @@ static const MSIVIEWOPS drop_ops =
|
|||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
|
||||
UINT DROP_CreateView(MSIDATABASE *db, MSIVIEW **view, LPCWSTR name)
|
||||
|
|
|
@ -318,15 +318,6 @@ static UINT INSERT_delete( struct tagMSIVIEW *view )
|
|||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
static UINT INSERT_find_matching_rows( struct tagMSIVIEW *view, UINT col,
|
||||
UINT val, UINT *row, MSIITERHANDLE *handle )
|
||||
{
|
||||
TRACE("%p, %d, %u, %p\n", view, col, val, *handle);
|
||||
|
||||
return ERROR_FUNCTION_FAILED;
|
||||
}
|
||||
|
||||
|
||||
static const MSIVIEWOPS insert_ops =
|
||||
{
|
||||
INSERT_fetch_int,
|
||||
|
@ -341,7 +332,6 @@ static const MSIVIEWOPS insert_ops =
|
|||
INSERT_get_column_info,
|
||||
INSERT_modify,
|
||||
INSERT_delete,
|
||||
INSERT_find_matching_rows,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
|
|
|
@ -301,19 +301,6 @@ typedef struct tagMSIVIEWOPS
|
|||
*/
|
||||
UINT (*delete)( struct tagMSIVIEW * );
|
||||
|
||||
/*
|
||||
* find_matching_rows - iterates through rows that match a value
|
||||
*
|
||||
* If the column type is a string then a string ID should be passed in.
|
||||
* If the value to be looked up is an integer then no transformation of
|
||||
* the input value is required, except if the column is a string, in which
|
||||
* case a string ID should be passed in.
|
||||
* The handle is an input/output parameter that keeps track of the current
|
||||
* position in the iteration. It must be initialised to zero before the
|
||||
* first call and continued to be passed in to subsequent calls.
|
||||
*/
|
||||
UINT (*find_matching_rows)( struct tagMSIVIEW *view, UINT col, UINT val, UINT *row, MSIITERHANDLE *handle );
|
||||
|
||||
/*
|
||||
* add_ref - increases the reference count of the table
|
||||
*/
|
||||
|
|
|
@ -331,25 +331,6 @@ static UINT SELECT_delete( struct tagMSIVIEW *view )
|
|||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
static UINT SELECT_find_matching_rows( struct tagMSIVIEW *view, UINT col,
|
||||
UINT val, UINT *row, MSIITERHANDLE *handle )
|
||||
{
|
||||
MSISELECTVIEW *sv = (MSISELECTVIEW*)view;
|
||||
|
||||
TRACE("%p, %d, %u, %p\n", view, col, val, *handle);
|
||||
|
||||
if( !sv->table )
|
||||
return ERROR_FUNCTION_FAILED;
|
||||
|
||||
if( (col==0) || (col>sv->num_cols) )
|
||||
return ERROR_FUNCTION_FAILED;
|
||||
|
||||
col = sv->cols[ col - 1 ];
|
||||
|
||||
return sv->table->ops->find_matching_rows( sv->table, col, val, row, handle );
|
||||
}
|
||||
|
||||
|
||||
static const MSIVIEWOPS select_ops =
|
||||
{
|
||||
SELECT_fetch_int,
|
||||
|
@ -364,7 +345,6 @@ static const MSIVIEWOPS select_ops =
|
|||
SELECT_get_column_info,
|
||||
SELECT_modify,
|
||||
SELECT_delete,
|
||||
SELECT_find_matching_rows,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
|
|
|
@ -415,35 +415,6 @@ static UINT STORAGES_delete(struct tagMSIVIEW *view)
|
|||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
static UINT STORAGES_find_matching_rows(struct tagMSIVIEW *view, UINT col,
|
||||
UINT val, UINT *row, MSIITERHANDLE *handle)
|
||||
{
|
||||
MSISTORAGESVIEW *sv = (MSISTORAGESVIEW *)view;
|
||||
UINT index = PtrToUlong(*handle);
|
||||
|
||||
TRACE("(%d, %d): %d\n", *row, col, val);
|
||||
|
||||
if (col == 0 || col > NUM_STORAGES_COLS)
|
||||
return ERROR_INVALID_PARAMETER;
|
||||
|
||||
while (index < sv->num_rows)
|
||||
{
|
||||
if (sv->storages[index]->str_index == val)
|
||||
{
|
||||
*row = index;
|
||||
break;
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
*handle = UlongToPtr(++index);
|
||||
if (index >= sv->num_rows)
|
||||
return ERROR_NO_MORE_ITEMS;
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
static const MSIVIEWOPS storages_ops =
|
||||
{
|
||||
STORAGES_fetch_int,
|
||||
|
@ -458,7 +429,6 @@ static const MSIVIEWOPS storages_ops =
|
|||
STORAGES_get_column_info,
|
||||
STORAGES_modify,
|
||||
STORAGES_delete,
|
||||
STORAGES_find_matching_rows,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
|
|
|
@ -337,35 +337,6 @@ static UINT STREAMS_delete(struct tagMSIVIEW *view)
|
|||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
static UINT STREAMS_find_matching_rows(struct tagMSIVIEW *view, UINT col,
|
||||
UINT val, UINT *row, MSIITERHANDLE *handle)
|
||||
{
|
||||
MSISTREAMSVIEW *sv = (MSISTREAMSVIEW *)view;
|
||||
UINT index = PtrToUlong(*handle);
|
||||
|
||||
TRACE("(%p, %d, %d, %p, %p)\n", view, col, val, row, handle);
|
||||
|
||||
if (!col || col > sv->num_cols)
|
||||
return ERROR_INVALID_PARAMETER;
|
||||
|
||||
while (index < sv->db->num_streams)
|
||||
{
|
||||
if (sv->db->streams[index].str_index == val)
|
||||
{
|
||||
*row = index;
|
||||
break;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
|
||||
*handle = UlongToPtr(++index);
|
||||
|
||||
if (index > sv->db->num_streams)
|
||||
return ERROR_NO_MORE_ITEMS;
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
static const MSIVIEWOPS streams_ops =
|
||||
{
|
||||
STREAMS_fetch_int,
|
||||
|
@ -380,7 +351,6 @@ static const MSIVIEWOPS streams_ops =
|
|||
STREAMS_get_column_info,
|
||||
STREAMS_modify,
|
||||
STREAMS_delete,
|
||||
STREAMS_find_matching_rows,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
|
|
|
@ -1875,85 +1875,6 @@ static UINT TABLE_delete( struct tagMSIVIEW *view )
|
|||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
static UINT TABLE_find_matching_rows( struct tagMSIVIEW *view, UINT col,
|
||||
UINT val, UINT *row, MSIITERHANDLE *handle )
|
||||
{
|
||||
MSITABLEVIEW *tv = (MSITABLEVIEW*)view;
|
||||
const MSICOLUMNHASHENTRY *entry;
|
||||
|
||||
TRACE("%p, %d, %u, %p\n", view, col, val, *handle);
|
||||
|
||||
if( !tv->table )
|
||||
return ERROR_INVALID_PARAMETER;
|
||||
|
||||
if( (col==0) || (col > tv->num_cols) )
|
||||
return ERROR_INVALID_PARAMETER;
|
||||
|
||||
if( !tv->columns[col-1].hash_table )
|
||||
{
|
||||
UINT i;
|
||||
UINT num_rows = tv->table->row_count;
|
||||
MSICOLUMNHASHENTRY **hash_table;
|
||||
MSICOLUMNHASHENTRY *new_entry;
|
||||
|
||||
if( tv->columns[col-1].offset >= tv->row_size )
|
||||
{
|
||||
ERR("Stuffed up %d >= %d\n", tv->columns[col-1].offset, tv->row_size );
|
||||
ERR("%p %p\n", tv, tv->columns );
|
||||
return ERROR_FUNCTION_FAILED;
|
||||
}
|
||||
|
||||
/* allocate contiguous memory for the table and its entries so we
|
||||
* don't have to do an expensive cleanup */
|
||||
hash_table = msi_alloc(MSITABLE_HASH_TABLE_SIZE * sizeof(MSICOLUMNHASHENTRY*) +
|
||||
num_rows * sizeof(MSICOLUMNHASHENTRY));
|
||||
if (!hash_table)
|
||||
return ERROR_OUTOFMEMORY;
|
||||
|
||||
memset(hash_table, 0, MSITABLE_HASH_TABLE_SIZE * sizeof(MSICOLUMNHASHENTRY*));
|
||||
tv->columns[col-1].hash_table = hash_table;
|
||||
|
||||
new_entry = (MSICOLUMNHASHENTRY *)(hash_table + MSITABLE_HASH_TABLE_SIZE);
|
||||
|
||||
for (i = 0; i < num_rows; i++, new_entry++)
|
||||
{
|
||||
UINT row_value;
|
||||
|
||||
if (view->ops->fetch_int( view, i, col, &row_value ) != ERROR_SUCCESS)
|
||||
continue;
|
||||
|
||||
new_entry->next = NULL;
|
||||
new_entry->value = row_value;
|
||||
new_entry->row = i;
|
||||
if (hash_table[row_value % MSITABLE_HASH_TABLE_SIZE])
|
||||
{
|
||||
MSICOLUMNHASHENTRY *prev_entry = hash_table[row_value % MSITABLE_HASH_TABLE_SIZE];
|
||||
while (prev_entry->next)
|
||||
prev_entry = prev_entry->next;
|
||||
prev_entry->next = new_entry;
|
||||
}
|
||||
else
|
||||
hash_table[row_value % MSITABLE_HASH_TABLE_SIZE] = new_entry;
|
||||
}
|
||||
}
|
||||
|
||||
if( !*handle )
|
||||
entry = tv->columns[col-1].hash_table[val % MSITABLE_HASH_TABLE_SIZE];
|
||||
else
|
||||
entry = (*handle)->next;
|
||||
|
||||
while (entry && entry->value != val)
|
||||
entry = entry->next;
|
||||
|
||||
*handle = entry;
|
||||
if (!entry)
|
||||
return ERROR_NO_MORE_ITEMS;
|
||||
|
||||
*row = entry->row;
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
static UINT TABLE_add_ref(struct tagMSIVIEW *view)
|
||||
{
|
||||
MSITABLEVIEW *tv = (MSITABLEVIEW*)view;
|
||||
|
@ -2148,7 +2069,6 @@ static const MSIVIEWOPS table_ops =
|
|||
TABLE_get_column_info,
|
||||
TABLE_modify,
|
||||
TABLE_delete,
|
||||
TABLE_find_matching_rows,
|
||||
TABLE_add_ref,
|
||||
TABLE_release,
|
||||
TABLE_add_column,
|
||||
|
|
|
@ -195,14 +195,6 @@ static UINT UPDATE_delete( struct tagMSIVIEW *view )
|
|||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
static UINT UPDATE_find_matching_rows( struct tagMSIVIEW *view, UINT col, UINT val, UINT *row, MSIITERHANDLE *handle )
|
||||
{
|
||||
TRACE("%p %d %d %p\n", view, col, val, *handle );
|
||||
|
||||
return ERROR_FUNCTION_FAILED;
|
||||
}
|
||||
|
||||
|
||||
static const MSIVIEWOPS update_ops =
|
||||
{
|
||||
UPDATE_fetch_int,
|
||||
|
@ -217,7 +209,6 @@ static const MSIVIEWOPS update_ops =
|
|||
UPDATE_get_column_info,
|
||||
UPDATE_modify,
|
||||
UPDATE_delete,
|
||||
UPDATE_find_matching_rows,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
|
|
|
@ -1015,36 +1015,6 @@ static UINT WHERE_delete( struct tagMSIVIEW *view )
|
|||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
static UINT WHERE_find_matching_rows( struct tagMSIVIEW *view, UINT col,
|
||||
UINT val, UINT *row, MSIITERHANDLE *handle )
|
||||
{
|
||||
MSIWHEREVIEW *wv = (MSIWHEREVIEW*)view;
|
||||
UINT i, row_value;
|
||||
|
||||
TRACE("%p, %d, %u, %p\n", view, col, val, *handle);
|
||||
|
||||
if (!wv->tables)
|
||||
return ERROR_FUNCTION_FAILED;
|
||||
|
||||
if (col == 0 || col > wv->col_count)
|
||||
return ERROR_INVALID_PARAMETER;
|
||||
|
||||
for (i = PtrToUlong(*handle); i < wv->row_count; i++)
|
||||
{
|
||||
if (view->ops->fetch_int( view, i, col, &row_value ) != ERROR_SUCCESS)
|
||||
continue;
|
||||
|
||||
if (row_value == val)
|
||||
{
|
||||
*row = i;
|
||||
*handle = UlongToPtr(i + 1);
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
return ERROR_NO_MORE_ITEMS;
|
||||
}
|
||||
|
||||
static UINT WHERE_sort(struct tagMSIVIEW *view, column_info *columns)
|
||||
{
|
||||
MSIWHEREVIEW *wv = (MSIWHEREVIEW *)view;
|
||||
|
@ -1108,7 +1078,6 @@ static const MSIVIEWOPS where_ops =
|
|||
WHERE_get_column_info,
|
||||
WHERE_modify,
|
||||
WHERE_delete,
|
||||
WHERE_find_matching_rows,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
|
|
Loading…
Reference in New Issue