Show
Ignore:
Timestamp:
08/06/08 07:55:11 (1 month ago)
Author:
ron
Message:

Merge in changes from 1.3 branch: merge -r 832:1067

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/contrib/dbd2propel/dbd2propel.xsl

    r485 r1068  
    88 
    99==== Author: Jonathan Graham <jkgraham@gmail.com> 
    10 ==== Version: 0.4 (2006-11-13) (http://blog.tooleshed.com/?p=6) 
     10==== Version: 0.5 (2008-01-25) (http://blog.tooleshed.com/?p=6) 
    1111==== Description: 
    1212This XSL will transform a DB Designer 4 database model XML file into a 
     
    3333Michiel Hakvoort - onDelete 
    3434Michel D'HOOGE - FULLTEXT 
     35Oleg Marchuk <kingoleg@mail.ru> - version 0.5 
    3536 
    3637==== Software: 
     
    4647version 0.3 (2006-11-05) - added non-unique-INDEXes and onDelete 
    4748version 0.4 (2006-11-13) - added support for index names and FULLTEXT indexes, changed license to LGPL 
     49version 0.5 (2008-01-25) - added ENUM, GEOMETRY as BLOB, scale for DECIMAL; fixed size in ENUM and spaces in relation names 
    4850 
    4951--> 
     
    99101                <!-- ==== type ==== --> 
    100102                <xsl:attribute name="type"> 
    101                         <xsl:value-of select="$datatype"/> 
     103                        <xsl:choose> 
     104                                <xsl:when test="$datatype = 'ENUM'"> 
     105                                        <xsl:value-of select="'CHAR'" /> 
     106                                </xsl:when> 
     107                                <xsl:otherwise> 
     108                                        <xsl:value-of select="$datatype"/> 
     109                                </xsl:otherwise> 
     110                        </xsl:choose> 
    102111                </xsl:attribute> 
    103112 
     
    110119                                </xsl:call-template> 
    111120                        </xsl:attribute> 
    112                  
    113                         <xsl:if test="contains('FLOAT,DOUBLE',$datatype)"> 
     121 
     122                        <xsl:if test="contains('FLOAT,DOUBLE,DECIMAL',$datatype)"> 
    114123                                <!-- ==== scale ==== -->  
    115124                                <xsl:attribute name="scale"> 
     
    219228                <!-- name --> 
    220229                <xsl:attribute name="name"> 
    221                         <xsl:value-of select="$relation/@RelationName"/> 
     230                        <xsl:value-of select="translate($relation/@RelationName, ' ', '_')"/> 
    222231                </xsl:attribute> 
    223232 
     
    265274                <xsl:when test="$type = 'TEXT'" >LONGVARCHAR</xsl:when>  
    266275                <xsl:when test="$type = 'BOOL'" >BOOLEAN</xsl:when>  
     276                <xsl:when test="$type = 'GEOMETRY'" >BLOB</xsl:when>  
    267277                <xsl:otherwise>  
    268278                        <xsl:value-of select="$type"/> 
     
    279289 
    280290        <xsl:choose>  
    281                 <xsl:when test="contains('FLOAT,DOUBLE',$dtype)" >  
     291                <xsl:when test="contains('FLOAT,DOUBLE,DECIMAL',$dtype)" >  
    282292                        <xsl:value-of select="substring-before($dtpc,',')"/> 
    283                 </xsl:when>  
     293                </xsl:when> 
     294                <xsl:when test="$dtype = 'ENUM'"> 
     295                        <xsl:value-of select="''" /> 
     296                </xsl:when>      
    284297                <xsl:otherwise>  
    285298                        <xsl:value-of select="$dtpc"/>