当前位置: 首页>>代码示例>>Python>>正文


Python DB.fetchone方法代码示例

本文整理汇总了Python中webp.utils.db.DB.fetchone方法的典型用法代码示例。如果您正苦于以下问题:Python DB.fetchone方法的具体用法?Python DB.fetchone怎么用?Python DB.fetchone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在webp.utils.db.DB的用法示例。


在下文中一共展示了DB.fetchone方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: from_db_by_func_tac_id

# 需要导入模块: from webp.utils.db import DB [as 别名]
# 或者: from webp.utils.db.DB import fetchone [as 别名]
    def from_db_by_func_tac_id(tac='taca_id', func_tac_id=-1):
        db = DB()
        sql = "select id,name,key_1,value_1,key_2,value_2,key_3,value_3,key_4,value_4,key_5,value_5 from tac where id=(select %s from func_tac_rel where id=%d)" % (tac, func_tac_id)
        db.execute(sql)

        res = db.fetchone()
        tac = Tac()

        if res:
            (id, name, 
                key_1, value_1,
                key_2, value_2,
                key_3, value_3,
                key_4, value_4,
                key_5, value_5,) = res

            tac = Tac( id = id, name = name)

            for (key, value) in [
                    (key_1, value_1),
                    (key_2, value_2),
                    (key_3, value_3),
                    (key_4, value_4),
                    (key_5, value_5),]:

                if key or value:
                    tac.map[key] = value
            return tac
开发者ID:Superjom,项目名称:webp,代码行数:30,代码来源:Tac.py

示例2: from_db

# 需要导入模块: from webp.utils.db import DB [as 别名]
# 或者: from webp.utils.db.DB import fetchone [as 别名]
    def from_db(id):
        db = DB()
        sql = "select id,name,key_1,value_1,key_2,value_2,key_3,value_3,key_4,value_4,key_5,value_5 from tac where id=%d" % id
        db.execute(sql)

        res = db.fetchone()
        tac = Tac()
        if res:
            (id, name, key_1, value_1, 
                key_2, value_2, key_3, value_3, 
                key_4, value_4, key_5, value_5) = res

            tac.id = id
            tac.name = name

            for (key, value) in [
                    (key_1, value_1),
                    (key_2, value_2),
                    (key_3, value_3),
                    (key_4, value_4),
                    (key_5, value_5),]:
                key = key.strip()
                value = value.strip()
                if  key or value:
                    tac.map[key] = value
        return tac
开发者ID:Superjom,项目名称:webp,代码行数:28,代码来源:Tac.py

示例3: has

# 需要导入模块: from webp.utils.db import DB [as 别名]
# 或者: from webp.utils.db.DB import fetchone [as 别名]
 def has( tac_id):
     db = DB()
     sql = "select count(*) from func_tac_rel where taca_id=%d or tacb_id=%d" % (tac_id, tac_id)
     db.execute(sql)
     res = db.fetchone()
     print 'count', res
     count = res[0]
     return count > 0
开发者ID:Superjom,项目名称:webp,代码行数:10,代码来源:tac.py

示例4: get_id

# 需要导入模块: from webp.utils.db import DB [as 别名]
# 或者: from webp.utils.db.DB import fetchone [as 别名]
 def get_id(flag):
     db = DB()
     sql = "select id from module where flag='%s'" % flag
     print 'sql:', sql
     db.execute(sql)
     res = db.fetchone()
     id = res[0]
     return id
开发者ID:Superjom,项目名称:webp,代码行数:10,代码来源:module.py

示例5: create_schedule

# 需要导入模块: from webp.utils.db import DB [as 别名]
# 或者: from webp.utils.db.DB import fetchone [as 别名]
def create_schedule(request):
    db = DB()
    func_tac_id = int(request.GET["func_tac_id"])
    db.execute("select a.path,c.name taca_name,d.name tacb_name from func_tac_log a join func_tac_rel b on a.func_tac_id=b.id left join tac c on b.taca_id=c.id left join tac d on b.tacb_id=d.id where b.id=%d" % func_tac_id)
    res = db.fetchone()
    if res: log_path, taca_name, tacb_name = res
    dic = user_utils.user_info_context(request)
    try:
        dic.update( dict(
            schedule = filetool.read(log_path) + "<br/>",
            tacName = "%s_%s"%(taca_name, tacb_name) if tacb_name != None else taca_name,
            ))
        return render_to_response("/html/nonmarked/fieldcase/createschedule.html", dic)

    except:
        return HttpResponse("日志文件不存在")
开发者ID:Superjom,项目名称:webp,代码行数:18,代码来源:fieldcase.py

示例6: show

# 需要导入模块: from webp.utils.db import DB [as 别名]
# 或者: from webp.utils.db.DB import fetchone [as 别名]
def show(request):
    db = DB()
    dic = user_utils.user_info_context(request)
    module_flag = request.GET['module_flag']
    func_flag = request.GET['func_flag']
    func_tac_id = request.GET['func_tac_id']
    sql = strtpl("select c.name from func_tac_rel a,func b,tac c where a.func_id=b.id and a.taca_id=c.id and a.id=$func_tac_id").substitute(func_tac_id = func_tac_id)
    db.execute(sql)
    tac_name = (db.fetchone()[0]).strip()

    try:
        path = os.path.join(
                Util.INVLINK_HOME,
                module_flag, func_flag,
                'display', tac_name, 'info')
        _debug_print("des_path: ", path)
        return render_to_response("html/dcg/rankla/show.html", dic)

    except:
        return HttpResponse("file does not exist!")
开发者ID:Superjom,项目名称:webp,代码行数:22,代码来源:rankla.py

示例7: show

# 需要导入模块: from webp.utils.db import DB [as 别名]
# 或者: from webp.utils.db.DB import fetchone [as 别名]
def show(request):
    db = DB()
    dic = user_utils.user_info_context(request)
    module_flag = request.GET['module_flag']
    func_flag = request.GET['func_flag']
    func_tac_id = request.GET['func_tac_id']
    sql = strtpl("select c.name from func_tac_rel a,func b,tac c where a.func_id=b.id and a.taca_id=c.id and a.id=$func_tac_id").substitute(func_tac_id = func_tac_id)
    db.execute(sql)
    tac_name = (db.fetchone()[0]).strip()

    try:
        des_path = os.path.join(
                Util.INVLINK_HOME,
                module_flag, func_flag,
                'display', tac_name, 'description')

        _debug_print("des_path: ", des_path)

        description = filetool.read(des_path)
        dic['description'] = description
    except:
        pass

    try:
        more_path = os.path.join(
                Util.INVLINK_HOME, module_flag,
                func_flag, 'display', tac_name, 'more')

        _debug_print("more_path: " + more_path)

        more = filetool.read(more_path)
        dic['more'] = more
    except: 
        pass

    data = []
    dic['data'] = data

    try:
        k = 1
        while True:
            info = []
            info = filetool.readlines(
                os.path.join(
                    Util.INVLINK_HOME,
                    module_flag, func_flag,
                    'display', tac_name,
                    'info_%d' % k))
            try:
                de = filetool.read( os.path.join(
                        Util.INVLINK_HOME, module_flag,
                        func_flag, 'display', tac_name,
                            'description_%d' % k
                    ))
            except:
                pass

            try:
                mo = filetool.read(os.path.join(
                    Util.INVLINK_HOME,
                    module_flag, func_flag,
                    'display', tac_name,
                    'more_%d' % k
                    ))
            except:
                pass

            data.append(
                    ShowEntity(de, mo, info)
                )
            k += 1
    except:
        pass

    return render_to_response("html/nonmarked/fieldstat/show.html", dic)
开发者ID:Superjom,项目名称:webp,代码行数:77,代码来源:fieldstat.py

示例8: show

# 需要导入模块: from webp.utils.db import DB [as 别名]
# 或者: from webp.utils.db.DB import fetchone [as 别名]
def show(request):
    module_flag = request.GET['module_flag']
    func_flag = request.GET['func_flag']
    func_tac_id = request.GET['func_tac_id']
    dic = user_utils.user_info_context(request)

    db = DB()
    sql = strtpl("select c.name taca_name,d.name tacb_name from func_tac_rel a join func b on a.func_id=b.id join tac c on a.taca_id=c.id left join tac d on a.tacb_id=d.id where a.id=$func_tac_id").substitute(func_tac_id = func_tac_id)
    db.execute(sql)
    taca_name, tacb_name = db.fetchone()
    tac_name = taca_name
    if tacb_name:
        tac_name += "_" + tacb_name

    try:
        des_path = os.path.join(
                Util.INVLINK_HOME,
                module_flag, func_flag,
                'display', tac_name, 'description')

        _debug_print("des_path: " + des_path)

        description = filetool.read(des_path)
        dic.update(description = description)

    except:
        pass

    try:
        more_path = os.path.join(
                Util.INVLINK_HOME, module_flag,
                func_flag, 'display', tac_name, 'more')

        _debug_print("more_path: " + more_path)

        more = filetool.read(more_path)
        dic['more'] = more
    except: 
        pass

    data = []
    dic['data'] = data
    try:
        k = 1
        while True:
            info = []
            info = filetool.readlines(
                os.path.join(
                    Util.INVLINK_HOME,
                    module_flag, func_flag,
                    'display', tac_name,
                    'info_%d' % k))
            try:
                de = filetool.read( os.path.join(
                        Util.INVLINK_HOME, module_flag,
                        func_flag, 'display', tac_name,
                            'description_%d' % k
                    ))
            except:
                pass

            try:
                mo = filetool.read(os.path.join(
                    Util.INVLINK_HOME,
                    module_flag, func_flag,
                    'display', tac_name,
                    'more_%d' % k
                    ))
            except:
                pass
            data.append(
                    ShowEntity(de, mo, info)
                )
            k += 1
    except:
        pass

    return render_to_response("html/nonmarked/googlepr/show.html", dic)
开发者ID:Superjom,项目名称:webp,代码行数:80,代码来源:googlepr.py


注:本文中的webp.utils.db.DB.fetchone方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。