Changeset 4319


Ignore:
Timestamp:
01/22/14 13:03:06 (10 years ago)
Author:
mwindhouwer
Message:

M mod-ISOcat-access-data/access/dc_sql.xsl

  • we can't get the (grand)parent key using currval(<sequence>) if the current table uses the same sequence, so we now calculate how many keys have been requested from the sequence since the (grand)parent
File:
1 edited

Legend:

Unmodified
Added
Removed
  • cats/ISOcat/trunk/mod-ISOcat-access-data/access/dc_sql.xsl

    r3343 r4319  
    257257                        </xsl:choose>
    258258                        <core_account sql:sequence="core_account_id_seq" sql:type="table">
    259                                 <core_group sql:sequence="core_account_id_seq" sql:type="table">
     259                                <core_group sql:type="table">
    260260                                        <id sql:type="parent key"/>
    261                                         <core_registration_group sql:sequence="core_account_id_seq" sql:type="table">
    262                                                 <id sql:type="parent key"/>
     261                                        <core_registration_group sql:type="table">
     262                                                <id sql:type="grandparent key"/>
    263263                                                <dc sql:type="root key"/>
    264264                                        </core_registration_group>
     
    933933                                                <xsl:value-of select="$root/@sql:sequence"/>
    934934                                                <xsl:text>'::regclass)</xsl:text>
     935                                                <xsl:variable name="back" select="count(($table[@sql:sequence=$root/@sql:sequence][empty(@sql:id)],$table/preceding::*[@sql:sequence=$root/@sql:sequence][. >> $root][empty(@sql:id)]))"/>
     936                                                <xsl:if test="$back gt 0">
     937                                                        <xsl:text>-</xsl:text>
     938                                                        <xsl:value-of select="$back"/>
     939                                                </xsl:if>
    935940                                        </xsl:when>
    936941                                        <xsl:otherwise>
     
    949954                                                <xsl:value-of select="$parent/@sql:sequence"/>
    950955                                                <xsl:text>'::regclass)</xsl:text>
     956                                                <xsl:variable name="back" select="count(($table[@sql:sequence=$parent/@sql:sequence][empty(@sql:id)],$table/preceding::*[@sql:sequence=$parent/@sql:sequence][. >> $parent][empty(@sql:id)]))"/>
     957                                                <xsl:if test="$back gt 0">
     958                                                        <xsl:text>-</xsl:text>
     959                                                        <xsl:value-of select="$back"/>
     960                                                </xsl:if>
    951961                                        </xsl:when>
    952962                                        <xsl:otherwise>
     
    965975                                                <xsl:value-of select="$grandparent/@sql:sequence"/>
    966976                                                <xsl:text>'::regclass)</xsl:text>
     977                                                <xsl:variable name="back" select="count(($table[@sql:sequence=$grandparent/@sql:sequence][empty(@sql:id)],$table/preceding::*[@sql:sequence=$grandparent/@sql:sequence][. >> $grandparent][empty(@sql:id)]))"/>
     978                                                <xsl:if test="$back gt 0">
     979                                                        <xsl:text>-</xsl:text>
     980                                                        <xsl:value-of select="$back"/>
     981                                                </xsl:if>
    967982                                        </xsl:when>
    968983                                        <xsl:otherwise>
Note: See TracChangeset for help on using the changeset viewer.