mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-17 15:03:18 +00:00
Fixed SF bug #1727034 Method MetadataField.unique() is incorrect for null values
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1994 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
@@ -512,16 +512,31 @@ public class MetadataField
|
|||||||
Connection con = context.getDBConnection();
|
Connection con = context.getDBConnection();
|
||||||
TableRow reg = DatabaseManager.row("MetadataFieldRegistry");
|
TableRow reg = DatabaseManager.row("MetadataFieldRegistry");
|
||||||
|
|
||||||
|
String qualifierClause = "";
|
||||||
|
|
||||||
|
if (qualifier == null)
|
||||||
|
{
|
||||||
|
qualifierClause = "and qualifier is null";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qualifierClause = "and qualifier = ?";
|
||||||
|
}
|
||||||
|
|
||||||
String query = "SELECT COUNT(*) FROM " + reg.getTable()
|
String query = "SELECT COUNT(*) FROM " + reg.getTable()
|
||||||
+ " WHERE metadata_schema_id= ? "
|
+ " WHERE metadata_schema_id= ? "
|
||||||
+ " and metadata_field_id != ? "
|
+ " and metadata_field_id != ? "
|
||||||
+ " and element= ? and qualifier= ? ";
|
+ " and element= ? " + qualifierClause;
|
||||||
|
|
||||||
PreparedStatement statement = con.prepareStatement(query);
|
PreparedStatement statement = con.prepareStatement(query);
|
||||||
statement.setInt(1,schemaID);
|
statement.setInt(1,schemaID);
|
||||||
statement.setInt(2,fieldID);
|
statement.setInt(2,fieldID);
|
||||||
statement.setString(3,element);
|
statement.setString(3,element);
|
||||||
statement.setString(4,qualifier);
|
|
||||||
|
if (qualifier != null)
|
||||||
|
{
|
||||||
|
statement.setString(4,qualifier);
|
||||||
|
}
|
||||||
|
|
||||||
ResultSet rs = statement.executeQuery();
|
ResultSet rs = statement.executeQuery();
|
||||||
|
|
||||||
|
@@ -6,6 +6,9 @@
|
|||||||
- SF Patch #1722557 for SF Bug #1549290 Suggest Features uses hard coded strings
|
- SF Patch #1722557 for SF Bug #1549290 Suggest Features uses hard coded strings
|
||||||
- SF Patch #1450491 i18n configurable multilingualism support
|
- SF Patch #1450491 i18n configurable multilingualism support
|
||||||
|
|
||||||
|
(James Rutherford)
|
||||||
|
- Fixed SF bug #1727034 Method MetadataField.unique() is incorrect for null values
|
||||||
|
|
||||||
1.4.2 beta
|
1.4.2 beta
|
||||||
===========
|
===========
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user