contains relevant info, plus a list of "fields",
or column objects */
var node = oilsIDL[cls];
+ var pkey = oilsRptFindField(node.pkey);
/* a "field" is a parsed version of a column from the IDL,
contains datatype, column name, etc. */
if( i == (parts.length - 2) ) break;
/* we still have columns left in the path, keep adding join's */
+ var path_col = col;
+ if(field.reltype != 'has_a')
+ col = pkey.name + '-' + col;
+
tobj.join = {};
tobj = tobj.join;
+
tobj[col] = {};
tobj = tobj[col];
if( field.type == 'link' )
tobj.key = field.key;
- newpath = newpath + '-'+ col;
+ newpath = newpath + '-'+ path_col;
}
_debug("built 'from' clause: path="+path+"\n"+formatJSON(js2JSON(obj)));
for( var i = 0; i < classes.length; i++ ) {
var node = classes[i];
var id = node.getAttribute('id');
+ var fields = node.getElementsByTagName('fields')[0];
var obj = {
fields : oilsRptParseFields(node),
name : node.getAttribute('id'),
table : node.getAttributeNS(oilsIDLPersistNS, 'tablename'),
core : node.getAttributeNS(oilsIDLReportsNS, 'core'),
- label : node.getAttributeNS(oilsIDLReportsNS, 'label')
+ label : node.getAttributeNS(oilsIDLReportsNS, 'label'),
+ pkey : fields.getAttributeNS(oilsIDLPersistNS, 'primary')
};
if( obj.core == 'true' ) obj.core = true;
obj.key = link.getAttribute('key');
obj['class'] = link.getAttribute('class');
obj.reltype = link.getAttribute('reltype');
- if( obj.reltype == 'might_have' ) continue;
} else {
if( fields[i].getAttributeNS(oilsIDLPersistNS, 'virtual') == 'true' )
continue;