Skip to content

Commit

Permalink
Merge pull request #221 from LabKey/fb_merge_24.7_to_develop
Browse files Browse the repository at this point in the history
Merge discvr-24.7 to develop
  • Loading branch information
bbimber authored Oct 30, 2024
2 parents 18c629c + 5348f01 commit c570a60
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions LDK/api-src/org/labkey/api/ldk/table/ContainerScopedTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,17 @@ protected Map<String, Object> updateRow(User user, Container container, Map<Stri
Object oldValue = oldRow.get(_pseudoPk);
Object newValue = row.get(_pseudoPk);

if (oldRow != null && newValue != null && !oldValue.equals(newValue) && _keyManager.rowExists(container, newValue))
throw new ValidationException("There is already a record where " + _pseudoPk + " equals " + newValue);
if (newValue != null && !oldValue.equals(newValue) && _keyManager.rowExists(container, newValue))
{
if (!getSqlDialect().isCaseSensitive() & String.valueOf(newValue).equalsIgnoreCase(String.valueOf(oldValue)) & !String.valueOf(newValue).equals(String.valueOf(oldValue)))
{
// Changing case of the PK is allowable. If the DB is case-insensitive, then our DB test should tell us if this would create a violation
}
else
{
throw new ValidationException("There is already a record where " + _pseudoPk + " equals " + newValue);
}
}

return super.updateRow(user, container, row, oldRow, configParameters);
}
Expand Down

0 comments on commit c570a60

Please sign in to comment.