Ejemplo n.º 1
0
def findStringOrderbyAttributes(queryobj):
    orderbyAttr = ""
    if(queryobj is not None):
        orderbyIdent = queryobj.getOrderbyIdent()
        if (orderbyIdent is  not None):
            for oid in orderbyIdent:
#                print oid
                if (myhelper.isAggregate(oid)):
#                    print"agg"
                    orderbyAttr+= str(oid)
                elif (myhelper.isOrderbyOperator(oid)):
#                    print "ops"
                    orderbyAttr = orderbyAttr.strip(", ")
                    orderbyAttr+= " " + myhelper.remAggregate(str(oid)) + ", "
                elif(myhelper.isMathOperator(str(oid))):
#                    print "myops %s" %oid
                    orderbyAttr+=str(oid)
                else:
#                    print "else"
                    orderbyAttr+= str(oid) + ", "
    
        orderbyAttr = orderbyAttr.strip("_")
        orderbyAttr = orderbyAttr.strip(", ")
    
#    print "orderbyAttr: %s" %orderbyAttr
    return orderbyAttr
Ejemplo n.º 2
0
def findStringSelectAttributes(queryobj):
    selectAttr = ""
    selectIdent = queryobj.getSelectIdent()
    
    if (selectIdent is  not None):
        if (myhelper.checkIfList(selectIdent)):
            for sid in selectIdent:
                if (myhelper.isAggregate(sid)):
                    selectAttr+=str(sid)
                    selectAttr= selectAttr.strip()
                elif(myhelper.isMathOperator(sid)):
                    selectAttr = selectAttr.rstrip(", ")
                    selectAttr+=str(sid)
                    selectAttr= selectAttr.strip()
                else:
                    selectAttr+= str(sid) + ", "
                    selectAttr= selectAttr.strip()
        else:
            selectAttr+= str(selectIdent)
            selectAttr= selectAttr.strip()
    selectAttr = selectAttr.strip(", ")
    
    
    return selectAttr