msi: Count the number of columns requested and allocate that many,
as columns may be select more than once in from a table.
This commit is contained in:
parent
aa81e4fa68
commit
f69d7bf0f3
@ -245,20 +245,23 @@ static UINT SELECT_AddColumn( MSISELECTVIEW *sv, LPCWSTR name )
|
|||||||
return ERROR_SUCCESS;
|
return ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int select_count_columns( column_info *col )
|
||||||
|
{
|
||||||
|
int n;
|
||||||
|
for (n = 0; col; col = col->next)
|
||||||
|
n++;
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
UINT SELECT_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table,
|
UINT SELECT_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table,
|
||||||
column_info *columns )
|
column_info *columns )
|
||||||
{
|
{
|
||||||
MSISELECTVIEW *sv = NULL;
|
MSISELECTVIEW *sv = NULL;
|
||||||
UINT count = 0, r;
|
UINT count = 0, r = ERROR_SUCCESS;
|
||||||
|
|
||||||
TRACE("%p\n", sv );
|
TRACE("%p\n", sv );
|
||||||
|
|
||||||
r = table->ops->get_dimensions( table, NULL, &count );
|
count = select_count_columns( columns );
|
||||||
if( r != ERROR_SUCCESS )
|
|
||||||
{
|
|
||||||
ERR("can't get table dimensions\n");
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
sv = msi_alloc_zero( sizeof *sv + count*sizeof (UINT) );
|
sv = msi_alloc_zero( sizeof *sv + count*sizeof (UINT) );
|
||||||
if( !sv )
|
if( !sv )
|
||||||
|
Loading…
x
Reference in New Issue
Block a user