コード例 #1
0
def makeSaveProcBody( table ):
        template = Template( file=templatesPath()+"save.func.tmpl" )
        template.procedureHeader = makeSaveProcHeader( table, CONNECTION_STRING, ' is' )
        template.allCriteria = makeCriterionList( table, 'c', 'all', True )
        primaryKey = makePrimaryKeySubmitFields( table )
        template.tmpVariable = table.adaInstanceName + "_tmp"
        template.existsCheck = 'if( not is_Null( '+table.adaInstanceName + '_tmp )) then'
        template.updateCall = 'Update( '+ table.adaInstanceName + ', local_connection )'
        template.tmpVariableWithAssignment = table.adaInstanceName + "_tmp : " + table.adaQualifiedOutputRecord;
        template.has_pk = table.hasPrimaryKey()
        template.retrieveByPK = table.adaInstanceName + '_tmp := retrieve_By_PK( ' + primaryKey + ' )'
        s = str(template) 
        return s        
コード例 #2
0
def makeSaveProcBody( table ):
        instanceName = table.makeName( Format.ada, Qualification.unqualified, ItemType.instanceName )
        outputRecord = table.makeName( Format.ada, Qualification.full, ItemType.table )
        template = Template( file=templatesPath()+"save.func.tmpl" )
        template.procedureHeader = makeSaveProcHeader( table, CONNECTION_STRING, ' is' )
        template.allCriteria = makeCriterionList( table, 'c', 'all', True )
        primaryKey = makePrimaryKeySubmitFields( table )
        # template.tmpVariable = instanceName + "_tmp"
        pkFields = table.getPrimaryKeyVariables()
        template.insertStrings = makeAliasedStrings( instanceName, table.variables )
        template.existsCheck = 'Exists( ' + primaryKey + ' ) then'
        template.updateCall = 'Update( '+ instanceName + ', local_connection )'
        # template.tmpVariableWithAssignment = instanceName + "_tmp : " + outputRecord;
        template.has_pk = table.hasPrimaryKey()
        # template.retrieveByPK = instanceName + '_tmp := retrieve_By_PK( ' + primaryKey + ' )'
        
        template.allParams = makeParamsBindings( instanceName, table.variables )
        s = str(template) 
        return s