Commit 8a8c561c authored by Mike McCormack's avatar Mike McCormack Committed by Alexandre Julliard

- the combination of all table keys must be unique, not each key

- MsiViewExecute may not be called before MsiModifyView
parent 9a03000e
...@@ -1326,6 +1326,7 @@ static UINT table_validate_new( MSITABLEVIEW *tv, MSIRECORD *rec ) ...@@ -1326,6 +1326,7 @@ static UINT table_validate_new( MSITABLEVIEW *tv, MSIRECORD *rec )
{ {
LPCWSTR str; LPCWSTR str;
UINT i, val, r, row; UINT i, val, r, row;
BOOL has_key = FALSE;
/* FIXME: set the MsiViewGetError value */ /* FIXME: set the MsiViewGetError value */
...@@ -1335,6 +1336,8 @@ static UINT table_validate_new( MSITABLEVIEW *tv, MSIRECORD *rec ) ...@@ -1335,6 +1336,8 @@ static UINT table_validate_new( MSITABLEVIEW *tv, MSIRECORD *rec )
if( !( tv->columns[i].type & MSITYPE_KEY ) ) if( !( tv->columns[i].type & MSITYPE_KEY ) )
continue; continue;
has_key = TRUE;
TRACE("column %d (%s.%s)is a key\n", i, TRACE("column %d (%s.%s)is a key\n", i,
debugstr_w(tv->columns[i].tablename), debugstr_w(tv->columns[i].tablename),
debugstr_w(tv->columns[i].colname) ); debugstr_w(tv->columns[i].colname) );
...@@ -1350,7 +1353,7 @@ static UINT table_validate_new( MSITABLEVIEW *tv, MSIRECORD *rec ) ...@@ -1350,7 +1353,7 @@ static UINT table_validate_new( MSITABLEVIEW *tv, MSIRECORD *rec )
/* if the string doesn't exist in the string table yet, it's OK */ /* if the string doesn't exist in the string table yet, it's OK */
r = msi_string2idW( tv->db->strings, str, &val ); r = msi_string2idW( tv->db->strings, str, &val );
if( ERROR_SUCCESS != r ) if( ERROR_SUCCESS != r )
continue; return ERROR_SUCCESS;
} }
else else
{ {
...@@ -1361,13 +1364,15 @@ static UINT table_validate_new( MSITABLEVIEW *tv, MSIRECORD *rec ) ...@@ -1361,13 +1364,15 @@ static UINT table_validate_new( MSITABLEVIEW *tv, MSIRECORD *rec )
/* if we find the same value in the table, it's a duplicate */ /* if we find the same value in the table, it's a duplicate */
row = 0; row = 0;
r = table_find_in_column( tv, i+1, val, &row ); r = table_find_in_column( tv, i+1, val, &row );
if( ERROR_SUCCESS == r ) if( ERROR_SUCCESS != r )
{ return ERROR_SUCCESS;
TRACE("found in row %d\n", row ); TRACE("found in row %d\n", row );
return ERROR_INVALID_DATA;
}
} }
if (has_key)
return ERROR_INVALID_DATA;
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
...@@ -1418,6 +1423,13 @@ static UINT TABLE_modify( struct tagMSIVIEW *view, MSIMODIFY eModifyMode, ...@@ -1418,6 +1423,13 @@ static UINT TABLE_modify( struct tagMSIVIEW *view, MSIMODIFY eModifyMode,
TRACE("%p %d %p\n", view, eModifyMode, rec ); TRACE("%p %d %p\n", view, eModifyMode, rec );
if (!tv->table)
{
r = TABLE_execute( view, NULL );
if( r )
return r;
}
switch (eModifyMode) switch (eModifyMode)
{ {
case MSIMODIFY_VALIDATE_NEW: case MSIMODIFY_VALIDATE_NEW:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment