Your problem is with this line:
<field ColumnName="parentid" CF_DataType="CF_SQL_INTEGER">
<relation type="label" table="parent" join-field="parentid" field="parentid" />
</field>
That is creating a relation field that is attempting to use itself as
the join field because both ColumnName and join-field have the same
value. So, DataMgr is recursively trying to determine that information
and getting locked in an infinite loop (eventually resulting in a
Stack Overflow error).
DataMgr should have noticed the problem before it went off to an
infinite loop. I will work on that for the next build.
Let me know if you have any more questions or run into any more trouble,
Steve
Sorry, I should have provided more information before. DataMgr doesn't
really have a concept of a foreign key as it is all about what
information you want to save into and get out of your database.
I would probably use the following XML:
<tables>
<table name="parent">
<field ColumnName="parentid" CF_DataType="CF_SQL_INTEGER"
PrimaryKey="true" Increment="true" />
<field ColumnName="parentname" CF_DataType="CF_SQL_VARCHAR" Length="255" />
<data table="parent">
<row parentname="Dad" />
<row parentname="Mom" />
</data>
</table>
<table name="child">
<field ColumnName="childid" CF_DataType="CF_SQL_INTEGER"
PrimaryKey="true" Increment="true" />
<field ColumnName="childname" CF_DataType="CF_SQL_VARCHAR" Length="255" />
<field ColumnName="parentid" CF_DataType="CF_SQL_INTEGER" />
<field ColumnName="parentname">
<relation type="label" table="parent" field="parentname"
join-field="parentid" />
</field>
<data table="child">
<row childname="Son" parentname="Dad" />
<row childname="Daughter" parentname="Mom" />
</data>
</table>
</tables>
Note that this won't actually establish the "parentid" field of the
"child" table as a foreign key, but does create a relation field named
"parentname" that holds the value of the "parentname" field from the
"parent" table where the "parentid" fields of each table match.
That "parentname" relation field is also used in the "data" element
for the "child" table obviating the need to use a relfield (though you
could certainly still use that if you prefer).
Does that make sense?
Steve
I am planning on adding that feature in the future.
In fact, this got me thinking. I could add an "ftable" attribute to a
field that would indicate it as a foreign key.
For example:
<field ColumnName="parentid" CF_DataType="CF_SQL_INTEGER" ftable="parent" />
If that exists, DataMgr could create the foreign key constraint (if it
doesn't already exist) and also use the foreign key and primary key
information for join fields, if the join fields are not indicated.
Any thoughts?
Steve