Always do case insensitive comparison when checking if a
column name is the primary key column of a table.
This commit is contained in:
parent
d13d2087f4
commit
b294dabc90
1 changed files with 9 additions and 7 deletions
|
@ -1,6 +1,6 @@
|
||||||
// Relation.java
|
// Relation.java
|
||||||
// Copyright (c) Hannes Wallnöfer 1997-2000
|
// Copyright (c) Hannes Wallnöfer 1997-2000
|
||||||
|
|
||||||
package helma.objectmodel.db;
|
package helma.objectmodel.db;
|
||||||
|
|
||||||
import helma.objectmodel.*;
|
import helma.objectmodel.*;
|
||||||
|
@ -301,7 +301,6 @@ public class Relation {
|
||||||
|
|
||||||
private void update_v1 (String desc, Properties props) {
|
private void update_v1 (String desc, Properties props) {
|
||||||
Application app = ownType.getApplication ();
|
Application app = ownType.getApplication ();
|
||||||
|
|
||||||
if (desc == null || "".equals (desc.trim ())) {
|
if (desc == null || "".equals (desc.trim ())) {
|
||||||
if (propName != null) {
|
if (propName != null) {
|
||||||
reftype = PRIMITIVE;
|
reftype = PRIMITIVE;
|
||||||
|
@ -476,11 +475,14 @@ public class Relation {
|
||||||
if (reftype == REFERENCE)
|
if (reftype == REFERENCE)
|
||||||
return constraints.length == 1 && constraints[0].foreignKeyIsPrimary ();
|
return constraints.length == 1 && constraints[0].foreignKeyIsPrimary ();
|
||||||
if (reftype == COLLECTION)
|
if (reftype == COLLECTION)
|
||||||
return accessor == null || accessor.equals (otherType.getIDField ());
|
return accessor == null || accessor.equalsIgnoreCase (otherType.getIDField ());
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getAccessor () {
|
||||||
|
return accessor;
|
||||||
|
}
|
||||||
|
|
||||||
public Relation getSubnodeRelation () {
|
public Relation getSubnodeRelation () {
|
||||||
// return subnoderelation;
|
// return subnoderelation;
|
||||||
|
@ -648,7 +650,7 @@ public class Relation {
|
||||||
INode home = constraints[i].isGroupby ? parent : parent.getNonVirtualParent ();
|
INode home = constraints[i].isGroupby ? parent : parent.getNonVirtualParent ();
|
||||||
String localName = constraints[i].localName;
|
String localName = constraints[i].localName;
|
||||||
String value = null;
|
String value = null;
|
||||||
if (localName == null || localName.equals (ownType.getIDField ()))
|
if (localName == null || localName.equalsIgnoreCase (ownType.getIDField ()))
|
||||||
value = home.getID ();
|
value = home.getID ();
|
||||||
else if (ownType.isRelational ())
|
else if (ownType.isRelational ())
|
||||||
value = home.getString (ownType.columnNameToProperty (localName), false);
|
value = home.getString (ownType.columnNameToProperty (localName), false);
|
||||||
|
@ -678,7 +680,7 @@ public class Relation {
|
||||||
if (crel != null) {
|
if (crel != null) {
|
||||||
// INode home = constraints[i].isGroupby ? parent : nonVirtual;
|
// INode home = constraints[i].isGroupby ? parent : nonVirtual;
|
||||||
String localName = constraints[i].localName;
|
String localName = constraints[i].localName;
|
||||||
if (localName == null || localName.equals (ownType.getIDField ())) {
|
if (localName == null || localName.equalsIgnoreCase (ownType.getIDField ())) {
|
||||||
INode currentValue = child.getNode (crel.propName, false);
|
INode currentValue = child.getNode (crel.propName, false);
|
||||||
// we set the backwards reference iff the reference is currently unset, if
|
// we set the backwards reference iff the reference is currently unset, if
|
||||||
// is set to a transient object, or if the new target is not transient. This
|
// is set to a transient object, or if the new target is not transient. This
|
||||||
|
@ -751,7 +753,7 @@ public class Relation {
|
||||||
public void addToQuery (StringBuffer q, INode home, INode nonvirtual) throws SQLException {
|
public void addToQuery (StringBuffer q, INode home, INode nonvirtual) throws SQLException {
|
||||||
String local = null;
|
String local = null;
|
||||||
INode ref = isGroupby ? home : nonvirtual;
|
INode ref = isGroupby ? home : nonvirtual;
|
||||||
if (localName == null || localName.equals (ref.getDbMapping ().getIDField ()))
|
if (localName == null || localName.equalsIgnoreCase (ref.getDbMapping ().getIDField ()))
|
||||||
local = ref.getID ();
|
local = ref.getID ();
|
||||||
else {
|
else {
|
||||||
String homeprop = ownType.columnNameToProperty (localName);
|
String homeprop = ownType.columnNameToProperty (localName);
|
||||||
|
@ -768,7 +770,7 @@ public class Relation {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean foreignKeyIsPrimary () {
|
public boolean foreignKeyIsPrimary () {
|
||||||
return foreignName == null || foreignName.equals (otherType.getIDField ());
|
return foreignName == null || foreignName.equalsIgnoreCase (otherType.getIDField ());
|
||||||
}
|
}
|
||||||
|
|
||||||
public String foreignProperty () {
|
public String foreignProperty () {
|
||||||
|
|
Loading…
Add table
Reference in a new issue