Added new DbColumn class that encapsulates column name, SQL type and the
relation associated with the column. This helps us fix a bug where no column info is available because a column has no relation associated with it. It also helps us streamline the Relation lookup when creating a Node from a ResultSet. Use StringBuffers instead of + for query string composition where possible.
This commit is contained in:
parent
3d7af041bd
commit
f2bfe5b9cf
4 changed files with 176 additions and 63 deletions
46
src/helma/objectmodel/db/DbColumn.java
Normal file
46
src/helma/objectmodel/db/DbColumn.java
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
// DbColumn.java
|
||||||
|
// Copyright 2002 Hannes Wallnoefer, Helma.org
|
||||||
|
|
||||||
|
package helma.objectmodel.db;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A class that encapsulates the Column name and data type of a
|
||||||
|
* column in a relational table.
|
||||||
|
*/
|
||||||
|
public final class DbColumn {
|
||||||
|
|
||||||
|
private final String name;
|
||||||
|
private final int type;
|
||||||
|
private final Relation relation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*/
|
||||||
|
public DbColumn (String name, int type, Relation rel) {
|
||||||
|
this.name = name;
|
||||||
|
this.type = type;
|
||||||
|
this.relation = rel;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the column name.
|
||||||
|
*/
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get this columns SQL data type.
|
||||||
|
*/
|
||||||
|
public int getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the relation associated with this column. May be null.
|
||||||
|
*/
|
||||||
|
public Relation getRelation() {
|
||||||
|
return relation;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -43,15 +43,21 @@ public final class DbMapping implements Updatable {
|
||||||
Relation subRelation;
|
Relation subRelation;
|
||||||
Relation propRelation;
|
Relation propRelation;
|
||||||
|
|
||||||
// if this defines a subnode mapping with groupby layer, we need a DbMapping for those groupby nodes
|
// if this defines a subnode mapping with groupby layer,
|
||||||
|
// we need a DbMapping for those groupby nodes
|
||||||
DbMapping groupbyMapping;
|
DbMapping groupbyMapping;
|
||||||
|
|
||||||
// Map of property names to Relations objects
|
// Map of property names to Relations objects
|
||||||
HashMap prop2db;
|
HashMap prop2db;
|
||||||
// Map of db columns to Relations objects
|
// Map of db columns to Relations objects.
|
||||||
|
// Case insensitive, keys are stored in upper case so
|
||||||
|
// lookups must do a toUpperCase().
|
||||||
HashMap db2prop;
|
HashMap db2prop;
|
||||||
|
|
||||||
// list of columns to fetch from db
|
// list of columns to fetch from db
|
||||||
String[] columns = null;
|
DbColumn[] columns = null;
|
||||||
|
// Map of db columns by name
|
||||||
|
HashMap columnMap;
|
||||||
// pre-rendered select statement
|
// pre-rendered select statement
|
||||||
String select = null;
|
String select = null;
|
||||||
|
|
||||||
|
@ -116,6 +122,8 @@ public final class DbMapping implements Updatable {
|
||||||
prop2db = new HashMap ();
|
prop2db = new HashMap ();
|
||||||
db2prop = new HashMap ();
|
db2prop = new HashMap ();
|
||||||
|
|
||||||
|
columnMap = new HashMap ();
|
||||||
|
|
||||||
parent = null;
|
parent = null;
|
||||||
|
|
||||||
idField = null;
|
idField = null;
|
||||||
|
@ -185,6 +193,7 @@ public final class DbMapping implements Updatable {
|
||||||
keydef = null;
|
keydef = null;
|
||||||
// same with columns and select string
|
// same with columns and select string
|
||||||
columns = null;
|
columns = null;
|
||||||
|
columnMap.clear();
|
||||||
select = null;
|
select = null;
|
||||||
|
|
||||||
|
|
||||||
|
@ -211,8 +220,8 @@ public final class DbMapping implements Updatable {
|
||||||
rel.update (dbField, props);
|
rel.update (dbField, props);
|
||||||
p2d.put (propName, rel);
|
p2d.put (propName, rel);
|
||||||
if (rel.columnName != null &&
|
if (rel.columnName != null &&
|
||||||
(rel.reftype == Relation.PRIMITIVE ||
|
(rel.reftype == Relation.PRIMITIVE ||
|
||||||
rel.reftype == Relation.REFERENCE))
|
rel.reftype == Relation.REFERENCE))
|
||||||
d2p.put (rel.columnName.toUpperCase (), rel);
|
d2p.put (rel.columnName.toUpperCase (), rel);
|
||||||
// app.logEvent ("Mapping "+propName+" -> "+dbField);
|
// app.logEvent ("Mapping "+propName+" -> "+dbField);
|
||||||
}
|
}
|
||||||
|
@ -567,11 +576,11 @@ public final class DbMapping implements Updatable {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a Village Schema object for this DbMapping.
|
* Return an array of DbColumns for the relational table mapped by this DbMapping.
|
||||||
*/
|
*/
|
||||||
public synchronized String[] getColumns() throws ClassNotFoundException, SQLException {
|
public synchronized DbColumn[] getColumns() throws ClassNotFoundException, SQLException {
|
||||||
if (!isRelational ())
|
if (!isRelational ())
|
||||||
throw new SQLException ("Can't get Schema for non-relational data mapping");
|
throw new SQLException ("Can't get columns for non-relational data mapping "+this);
|
||||||
if (source == null && parentMapping != null)
|
if (source == null && parentMapping != null)
|
||||||
return parentMapping.getColumns ();
|
return parentMapping.getColumns ();
|
||||||
// Use local variable cols to avoid synchronization (schema may be nulled elsewhere)
|
// Use local variable cols to avoid synchronization (schema may be nulled elsewhere)
|
||||||
|
@ -580,25 +589,46 @@ public final class DbMapping implements Updatable {
|
||||||
// and build a string of column names.
|
// and build a string of column names.
|
||||||
Connection con = getConnection ();
|
Connection con = getConnection ();
|
||||||
Statement stmt = con.createStatement ();
|
Statement stmt = con.createStatement ();
|
||||||
ResultSet rs = stmt.executeQuery ("select * from "+getTableName()+" where 1 = 0");
|
String t = getTableName();
|
||||||
|
if (t == null)
|
||||||
|
throw new SQLException ("Table name is null in getColumns() for "+this);
|
||||||
|
ResultSet rs = stmt.executeQuery (
|
||||||
|
new StringBuffer("SELECT * FROM ")
|
||||||
|
.append(t).append(" WHERE 1 = 0").toString());
|
||||||
if (rs == null)
|
if (rs == null)
|
||||||
throw new SQLException ("Error retrieving DB scheme for "+this);
|
throw new SQLException ("Error retrieving columns for "+this);
|
||||||
ResultSetMetaData meta = rs.getMetaData ();
|
ResultSetMetaData meta = rs.getMetaData ();
|
||||||
// ok, we have the meta data, now loop through mapping...
|
// ok, we have the meta data, now loop through mapping...
|
||||||
int ncols = meta.getColumnCount ();
|
int ncols = meta.getColumnCount ();
|
||||||
columns = new String[ncols];
|
columns = new DbColumn[ncols];
|
||||||
for (int i=0; i<ncols; i++) {
|
for (int i=0; i<ncols; i++) {
|
||||||
columns[i] = meta.getColumnName (i+1);
|
String colName = meta.getColumnName (i+1);
|
||||||
Relation rel = columnNameToRelation (columns[i]);
|
Relation rel = columnNameToRelation (colName);
|
||||||
if (rel == null || (rel.reftype != Relation.PRIMITIVE &&
|
columns[i] = new DbColumn (colName, meta.getColumnType (i+1), rel);
|
||||||
rel.reftype != Relation.REFERENCE))
|
|
||||||
continue;
|
|
||||||
rel.setColumnType (meta.getColumnType (i+1));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return columns;
|
return columns;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DbColumn getColumn (String columnName) throws ClassNotFoundException, SQLException {
|
||||||
|
DbColumn col = (DbColumn) columnMap.get(columnName);
|
||||||
|
if (col == null) {
|
||||||
|
DbColumn[] cols = columns;
|
||||||
|
if (cols == null)
|
||||||
|
cols = getColumns();
|
||||||
|
for (int i=0; i<cols.length; i++) {
|
||||||
|
if (columnName.equalsIgnoreCase (cols[i].getName())) {
|
||||||
|
col = cols[i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (col == null)
|
||||||
|
throw new SQLException ("Column "+columnName+" not found in "+this);
|
||||||
|
columnMap.put (columnName, col);
|
||||||
|
}
|
||||||
|
return col;
|
||||||
|
}
|
||||||
|
|
||||||
public StringBuffer getSelect () throws SQLException, ClassNotFoundException {
|
public StringBuffer getSelect () throws SQLException, ClassNotFoundException {
|
||||||
String sel = select;
|
String sel = select;
|
||||||
if (sel != null)
|
if (sel != null)
|
||||||
|
@ -619,13 +649,8 @@ public final class DbMapping implements Updatable {
|
||||||
if (table == null && parentMapping != null)
|
if (table == null && parentMapping != null)
|
||||||
return parentMapping.needsQuotes (columnName);
|
return parentMapping.needsQuotes (columnName);
|
||||||
try {
|
try {
|
||||||
Relation rel = (Relation) db2prop.get (columnName.toUpperCase());
|
DbColumn col = getColumn (columnName);
|
||||||
if (rel == null)
|
switch (col.getType()) {
|
||||||
throw new SQLException ("Error retrieving relational schema for "+this);
|
|
||||||
// make sure columns are initialized and up to date
|
|
||||||
if (columns == null)
|
|
||||||
getColumns();
|
|
||||||
switch (rel.getColumnType()) {
|
|
||||||
case Types.CHAR:
|
case Types.CHAR:
|
||||||
case Types.VARCHAR:
|
case Types.VARCHAR:
|
||||||
case Types.LONGVARCHAR:
|
case Types.LONGVARCHAR:
|
||||||
|
|
|
@ -234,7 +234,7 @@ public final class Node implements INode, Serializable {
|
||||||
/**
|
/**
|
||||||
* Constructor used for nodes being stored in a relational database table.
|
* Constructor used for nodes being stored in a relational database table.
|
||||||
*/
|
*/
|
||||||
public Node (DbMapping dbm, ResultSet rs, String[] columns, WrappedNodeManager nmgr)
|
public Node (DbMapping dbm, ResultSet rs, DbColumn[] columns, WrappedNodeManager nmgr)
|
||||||
throws SQLException {
|
throws SQLException {
|
||||||
|
|
||||||
this.nmgr = nmgr;
|
this.nmgr = nmgr;
|
||||||
|
@ -265,35 +265,35 @@ public final class Node implements INode, Serializable {
|
||||||
|
|
||||||
for (int i=0; i<columns.length; i++) {
|
for (int i=0; i<columns.length; i++) {
|
||||||
|
|
||||||
Relation rel = dbm.columnNameToRelation (columns[i]);
|
Relation rel = columns[i].getRelation();
|
||||||
if (rel == null || (rel.reftype != Relation.PRIMITIVE &&
|
if (rel == null || (rel.reftype != Relation.PRIMITIVE &&
|
||||||
rel.reftype != Relation.REFERENCE))
|
rel.reftype != Relation.REFERENCE))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Property newprop = new Property (rel.propName, this);
|
Property newprop = new Property (rel.propName, this);
|
||||||
|
|
||||||
switch (rel.getColumnType()) {
|
switch (columns[i].getType()) {
|
||||||
|
|
||||||
case Types.BIT:
|
case Types.BIT:
|
||||||
newprop.setBooleanValue (rs.getBoolean(columns[i]));
|
newprop.setBooleanValue (rs.getBoolean(columns[i].getName()));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Types.TINYINT:
|
case Types.TINYINT:
|
||||||
case Types.BIGINT:
|
case Types.BIGINT:
|
||||||
case Types.SMALLINT:
|
case Types.SMALLINT:
|
||||||
case Types.INTEGER:
|
case Types.INTEGER:
|
||||||
newprop.setIntegerValue (rs.getLong(columns[i]));
|
newprop.setIntegerValue (rs.getLong(columns[i].getName()));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Types.REAL:
|
case Types.REAL:
|
||||||
case Types.FLOAT:
|
case Types.FLOAT:
|
||||||
case Types.DOUBLE:
|
case Types.DOUBLE:
|
||||||
newprop.setFloatValue (rs.getDouble(columns[i]));
|
newprop.setFloatValue (rs.getDouble(columns[i].getName()));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Types.DECIMAL:
|
case Types.DECIMAL:
|
||||||
case Types.NUMERIC:
|
case Types.NUMERIC:
|
||||||
BigDecimal num = rs.getBigDecimal (columns[i]);
|
BigDecimal num = rs.getBigDecimal (columns[i].getName());
|
||||||
if (num == null)
|
if (num == null)
|
||||||
break;
|
break;
|
||||||
if (num.scale() > 0)
|
if (num.scale() > 0)
|
||||||
|
@ -305,20 +305,20 @@ public final class Node implements INode, Serializable {
|
||||||
case Types.LONGVARBINARY:
|
case Types.LONGVARBINARY:
|
||||||
case Types.VARBINARY:
|
case Types.VARBINARY:
|
||||||
case Types.BINARY:
|
case Types.BINARY:
|
||||||
newprop.setStringValue (rs.getString(columns[i]));
|
newprop.setStringValue (rs.getString(columns[i].getName()));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Types.LONGVARCHAR:
|
case Types.LONGVARCHAR:
|
||||||
case Types.CHAR:
|
case Types.CHAR:
|
||||||
case Types.VARCHAR:
|
case Types.VARCHAR:
|
||||||
case Types.OTHER:
|
case Types.OTHER:
|
||||||
newprop.setStringValue (rs.getString(columns[i]));
|
newprop.setStringValue (rs.getString(columns[i].getName()));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Types.DATE:
|
case Types.DATE:
|
||||||
case Types.TIME:
|
case Types.TIME:
|
||||||
case Types.TIMESTAMP:
|
case Types.TIMESTAMP:
|
||||||
newprop.setDateValue (rs.getTimestamp(columns[i]));
|
newprop.setDateValue (rs.getTimestamp(columns[i].getName()));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Types.NULL:
|
case Types.NULL:
|
||||||
|
@ -327,7 +327,7 @@ public final class Node implements INode, Serializable {
|
||||||
// continue;
|
// continue;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
newprop.setStringValue (rs.getString(columns[i]));
|
newprop.setStringValue (rs.getString(columns[i].getName()));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -580,7 +580,13 @@ public final class NodeManager {
|
||||||
try {
|
try {
|
||||||
Connection con = dbm.getConnection ();
|
Connection con = dbm.getConnection ();
|
||||||
st = con.createStatement ();
|
st = con.createStatement ();
|
||||||
st.executeUpdate ("DELETE FROM "+dbm.getTableName ()+" WHERE "+dbm.getIDField ()+" = "+node.getID ());
|
st.executeUpdate (new StringBuffer ("DELETE FROM ")
|
||||||
|
.append(dbm.getTableName ())
|
||||||
|
.append(" WHERE ")
|
||||||
|
.append(dbm.getIDField())
|
||||||
|
.append(" = ")
|
||||||
|
.append(node.getID())
|
||||||
|
.toString());
|
||||||
} finally {
|
} finally {
|
||||||
if (st != null) try {
|
if (st != null) try {
|
||||||
st.close ();
|
st.close ();
|
||||||
|
@ -605,7 +611,11 @@ public final class NodeManager {
|
||||||
Statement stmt = null;
|
Statement stmt = null;
|
||||||
try {
|
try {
|
||||||
Connection con = map.getConnection ();
|
Connection con = map.getConnection ();
|
||||||
String q = "SELECT MAX("+map.getIDField()+") FROM "+map.getTableName();
|
String q = new StringBuffer("SELECT MAX(")
|
||||||
|
.append(map.getIDField())
|
||||||
|
.append(") FROM ")
|
||||||
|
.append(map.getTableName())
|
||||||
|
.toString();
|
||||||
stmt = con.createStatement ();
|
stmt = con.createStatement ();
|
||||||
ResultSet rs = stmt.executeQuery (q);
|
ResultSet rs = stmt.executeQuery (q);
|
||||||
// check for empty table
|
// check for empty table
|
||||||
|
@ -639,7 +649,10 @@ public final class NodeManager {
|
||||||
String retval = null;
|
String retval = null;
|
||||||
try {
|
try {
|
||||||
Connection con = map.getConnection ();
|
Connection con = map.getConnection ();
|
||||||
String q = "SELECT "+map.getIDgen()+".nextval FROM dual";
|
String q = new StringBuffer("SELECT ")
|
||||||
|
.append(map.getIDgen())
|
||||||
|
.append(".nextval FROM dual")
|
||||||
|
.toString();
|
||||||
stmt = con.createStatement();
|
stmt = con.createStatement();
|
||||||
ResultSet rs = stmt.executeQuery (q);
|
ResultSet rs = stmt.executeQuery (q);
|
||||||
if (!rs.next ())
|
if (!rs.next ())
|
||||||
|
@ -682,10 +695,23 @@ public final class NodeManager {
|
||||||
|
|
||||||
if (home.getSubnodeRelation() != null) {
|
if (home.getSubnodeRelation() != null) {
|
||||||
// subnode relation was explicitly set
|
// subnode relation was explicitly set
|
||||||
q = "SELECT "+idfield+" FROM "+table+" "+home.getSubnodeRelation();
|
q = new StringBuffer("SELECT ")
|
||||||
|
.append(idfield)
|
||||||
|
.append(" FROM ")
|
||||||
|
.append(table)
|
||||||
|
.append(" ")
|
||||||
|
.append(home.getSubnodeRelation())
|
||||||
|
.toString();
|
||||||
} else {
|
} else {
|
||||||
// let relation object build the query
|
// let relation object build the query
|
||||||
q = "SELECT "+idfield+" FROM "+table + rel.buildQuery (home, home.getNonVirtualParent (), null, " WHERE ", true);
|
q = new StringBuffer("SELECT ")
|
||||||
|
.append(idfield)
|
||||||
|
.append(" FROM ")
|
||||||
|
.append(table)
|
||||||
|
.append(rel.buildQuery (home,
|
||||||
|
home.getNonVirtualParent (), null,
|
||||||
|
" WHERE ", true))
|
||||||
|
.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (logSql)
|
if (logSql)
|
||||||
|
@ -706,8 +732,8 @@ public final class NodeManager {
|
||||||
continue;
|
continue;
|
||||||
// make the proper key for the object, either a generic DB key or a groupby key
|
// make the proper key for the object, either a generic DB key or a groupby key
|
||||||
Key key = rel.groupby == null ?
|
Key key = rel.groupby == null ?
|
||||||
(Key) new DbKey (rel.otherType, kstr) :
|
(Key) new DbKey (rel.otherType, kstr) :
|
||||||
(Key) new SyntheticKey (k, kstr);
|
(Key) new SyntheticKey (k, kstr);
|
||||||
retval.add (new NodeHandle (key));
|
retval.add (new NodeHandle (key));
|
||||||
// if these are groupby nodes, evict nullNode keys
|
// if these are groupby nodes, evict nullNode keys
|
||||||
if (rel.groupby != null) {
|
if (rel.groupby != null) {
|
||||||
|
@ -750,7 +776,7 @@ public final class NodeManager {
|
||||||
|
|
||||||
Connection con = dbm.getConnection ();
|
Connection con = dbm.getConnection ();
|
||||||
Statement stmt = con.createStatement ();
|
Statement stmt = con.createStatement ();
|
||||||
String[] columns = dbm.getColumns ();
|
DbColumn[] columns = dbm.getColumns ();
|
||||||
StringBuffer q = dbm.getSelect ();
|
StringBuffer q = dbm.getSelect ();
|
||||||
try {
|
try {
|
||||||
if (home.getSubnodeRelation() != null) {
|
if (home.getSubnodeRelation() != null) {
|
||||||
|
@ -808,7 +834,7 @@ public final class NodeManager {
|
||||||
if (missing > 0) {
|
if (missing > 0) {
|
||||||
Connection con = dbm.getConnection ();
|
Connection con = dbm.getConnection ();
|
||||||
Statement stmt = con.createStatement ();
|
Statement stmt = con.createStatement ();
|
||||||
String[] columns = dbm.getColumns ();
|
DbColumn[] columns = dbm.getColumns ();
|
||||||
StringBuffer q = dbm.getSelect ();
|
StringBuffer q = dbm.getSelect ();
|
||||||
try {
|
try {
|
||||||
String idfield = rel.groupby != null ? rel.groupby : dbm.getIDField ();
|
String idfield = rel.groupby != null ? rel.groupby : dbm.getIDField ();
|
||||||
|
@ -835,8 +861,10 @@ public final class NodeManager {
|
||||||
q.append (") ");
|
q.append (") ");
|
||||||
if (rel.groupby != null) {
|
if (rel.groupby != null) {
|
||||||
q.append (rel.renderConstraints (home, home.getNonVirtualParent ()));
|
q.append (rel.renderConstraints (home, home.getNonVirtualParent ()));
|
||||||
if (rel.order != null)
|
if (rel.order != null) {
|
||||||
q.append (" ORDER BY "+rel.order);
|
q.append (" ORDER BY ");
|
||||||
|
q.append (rel.order);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (logSql)
|
if (logSql)
|
||||||
|
@ -941,10 +969,18 @@ public final class NodeManager {
|
||||||
String q = null;
|
String q = null;
|
||||||
if (home.getSubnodeRelation() != null) {
|
if (home.getSubnodeRelation() != null) {
|
||||||
// use the manually set subnoderelation of the home node
|
// use the manually set subnoderelation of the home node
|
||||||
q = "SELECT count(*) FROM "+table+" "+home.getSubnodeRelation();
|
q = new StringBuffer("SELECT count(*) FROM ")
|
||||||
|
.append(table)
|
||||||
|
.append(" ")
|
||||||
|
.append(home.getSubnodeRelation())
|
||||||
|
.toString();
|
||||||
} else {
|
} else {
|
||||||
// let relation object build the query
|
// let relation object build the query
|
||||||
q = "SELECT count(*) FROM "+table + rel.buildQuery (home, home.getNonVirtualParent (), null, " WHERE ", false);
|
q = new StringBuffer("SELECT count(*) FROM ")
|
||||||
|
.append(table)
|
||||||
|
.append(rel.buildQuery (home, home.getNonVirtualParent(),
|
||||||
|
null, " WHERE ", false))
|
||||||
|
.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (logSql)
|
if (logSql)
|
||||||
|
@ -990,7 +1026,13 @@ public final class NodeManager {
|
||||||
Statement stmt = null;
|
Statement stmt = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String q = "SELECT "+namefield+" FROM "+table+" ORDER BY "+namefield;
|
String q = new StringBuffer("SELECT ")
|
||||||
|
.append(namefield)
|
||||||
|
.append(" FROM ")
|
||||||
|
.append(table)
|
||||||
|
.append(" ORDER BY ")
|
||||||
|
.append(namefield)
|
||||||
|
.toString();
|
||||||
stmt = con.createStatement ();
|
stmt = con.createStatement ();
|
||||||
|
|
||||||
if (logSql)
|
if (logSql)
|
||||||
|
@ -1037,7 +1079,7 @@ public final class NodeManager {
|
||||||
Connection con = dbm.getConnection ();
|
Connection con = dbm.getConnection ();
|
||||||
stmt = con.createStatement ();
|
stmt = con.createStatement ();
|
||||||
|
|
||||||
String[] columns = dbm.getColumns ();
|
DbColumn[] columns = dbm.getColumns ();
|
||||||
StringBuffer q = dbm.getSelect ();
|
StringBuffer q = dbm.getSelect ();
|
||||||
q.append ("WHERE ");
|
q.append ("WHERE ");
|
||||||
q.append (idfield);
|
q.append (idfield);
|
||||||
|
@ -1099,7 +1141,7 @@ public final class NodeManager {
|
||||||
DbMapping dbm = rel.otherType;
|
DbMapping dbm = rel.otherType;
|
||||||
|
|
||||||
Connection con = dbm.getConnection ();
|
Connection con = dbm.getConnection ();
|
||||||
String[] columns = dbm.getColumns ();
|
DbColumn[] columns = dbm.getColumns ();
|
||||||
StringBuffer q = dbm.getSelect ();
|
StringBuffer q = dbm.getSelect ();
|
||||||
if (home.getSubnodeRelation () != null) {
|
if (home.getSubnodeRelation () != null) {
|
||||||
// combine our key with the constraints in the manually set subnode relation
|
// combine our key with the constraints in the manually set subnode relation
|
||||||
|
|
Loading…
Add table
Reference in a new issue