• 对于where 1=1 这种条件传入需要'%s'


     /api/exportoraceldata/?dbservice=tlyy&dbip=10.5.100.232&dbuser=tlcbuser&dbpass=tlcbuser&exporttable=DJANGO&tiaojian=where+1%3D1
    -------------------
    where 1=1
    -------------------
    STIME
    NAME
    ID
    SELECT  trim(ID), 
    SELECT  trim(ID),  trim(NAME), 
    SELECT  trim(ID),  trim(NAME),  trim(STIME)
    SELECT  trim(ID),  trim(NAME),  trim(STIME) from tlcbuser.DJANGO where 1=1 
    
    
    def exportoraceldata(req):
        print req.get_full_path()
        dbservice= req.GET['dbservice']
        dbip= req.GET['dbip']
        dbuser= req.GET['dbuser']
        dbpass= req.GET['dbpass']
        exporttable= req.GET['exporttable']
        if req.GET['tiaojian']:
          tiaojian=req.GET['tiaojian']
        else:
          tiaojian=''
        print '-------------------'
        print tiaojian
        print '-------------------'
        String=random.randint(0,99999999)
        code=str(String)
        output=commands.getoutput("perl /root/sbin/unload_fulltable.pl %s %s %s %s %s '%s' %s "  %(dbservice,dbip,dbuser,dbpass,exporttable,tiaojian,code) )
        print output
        file=exporttable+'.'+str(String)+'.txt'
        commands.getoutput("gzip /ftp/download/%s" % file)
        url='http://10.5.100.232/download/'+exporttable+'.'+str(String)+'.txt'+'.gz'
        return HttpResponse(url)
    	
    	这里传入的where 1=1 需要对%s 加上''引号
     

  • 相关阅读:
    修改sqlserver2008中表的schema
    MongoDB学习笔记06
    MongoDB学习笔记05
    MongoDB学习笔记04
    在IIS Express中调试时无法读取配置文件
    Spring 集成Redis
    Java操作Redis(代码演示)
    Redis的一些常用命令操作
    Redis安装步骤
    如何彻底删除电脑安装的软件程序?
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13349327.html
Copyright © 2020-2023  润新知