@ tefigel ## # This routine gets called on entering XML tag nodes containing # metadata information about the dataset represented in the XML # model. # Depending on the tag identifier (i.e., the XML element identifier) # different data lists get initialized or updated with the node's # relevant attributes. ## case TAG_ID when=DataSet # Save attribute "name" of element DataSet as the current dataset id # then create a list to store this dataset tables' metadata globset CUR_DATASET=tp_name new_list(CUR_DATASET) when=DataTable # Save attribute "name" of element DataTable as the current table id. # Add it to the dataset's list of tables. # Then create a list to store this table columns' metadata globset CUR_TABLE=tp_name add_item(CUR_DATASET,CUR_TABLE) new_list(CUR_TABLE) when=DataColumn # Use reasonable defaults for missing attribute # values of element DataColumn if tp_AllowDBNulls= set tp_AllowDBNulls=true endif if tp_AutoIncrement#true set tp_AutoIncrement=false endif if tp_ReadOnly#true set tp_ReadOnly=false endif # Verify if current DataColumn is part of the primary key list # Cool trick with list_contents prefix "<" and suffix ">" and # regular expression check in subsequent if. set CTABLE_PKEY=~list_contents(CUR_TABLE&_PKEY,<,>) if CTABLE_PKEY~ set tp_ispkey=true else set tp_ispkey=false endif # Verify if current DataColumn is part of a relationship set tp_relation= for METARELATION=~list_contents(CUR_RELATIONS) set C_TABLE=MetaRelInfo(METARELATION,child_table) if C_TABLE=CUR_TABLE set RELATION_ID=MetaRelInfo(METARELATION,id) set C_KEY=MetaRelInfo(METARELATION,child_key) set P_TABLE=MetaRelInfo(METARELATION,parent_table) if C_KEY=tp_name set tp_relation=RELATION_ID.C_KEY.P_TABLE endif endif endfor if tp_relation= set tp_relation=void endif # Add all relevant info about this column (mostly from attributes) # as a new slash-separated record in the current list of columns add_item(CUR_TABLE,tp_name/tp_origname/tp_type/tp_VBType/tp_AllowDBNulls/tp_ReadOnly/tp_AutoIncrement/tp_ispkey/tp_relation) endcase