• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python store.execute函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中vilya.libs.store.store.execute函数的典型用法代码示例。如果您正苦于以下问题:Python execute函数的具体用法?Python execute怎么用?Python execute使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: update_product

 def update_product(self, product):
     store.execute("update codedouban_projects "
                   "set product=%s "
                   "where project_id=%s",
                   (product, self.id))
     store.commit()
     self.clear_mc(self.id)
开发者ID:000fan000,项目名称:code,代码行数:7,代码来源:project.py


示例2: add

 def add(
     cls,
     title,
     description,
     creator,
     number=None,
     team=None,
     project=None,
     assignee=None,
     closer=None,
     created_at=None,
     updated_at=None,
     closed_at=None,
 ):
     issue = Issue.add(
         title, description, creator, assignee=assignee, closer=closer, type=cls.target_type, target_id=project
     )
     if issue and project:
         number = PICounter.incr(project, number)
         store.execute(
             "insert into project_issues (project_id, issue_id, number) " "values (%s, %s, %s) ",
             (project, issue.id, number),
         )
         store.commit()
         mc.delete(MC_KEY_PROJECT_ISSUE_CREATOR_N % (project, creator, "open"))
         mc.delete(MC_KEY_PROJECT_ISSUE_CREATOR_N % (project, creator, "closed"))
         cls._clean_cache(project)
         return Issue.get_cached_issue(issue.id)
开发者ID:mozillazg,项目名称:code,代码行数:28,代码来源:project_issue.py


示例3: add

 def add(cls, description, owner_id, is_public, gist_names=[],
         gist_contents=[], fork_from=None):
     now = datetime.now()
     if fork_from:
         name = cls.get(fork_from).name
         id = store.execute(
             "insert into gists "
             "(`name`, `description`, `owner_id`, `created_at`, `fork_from`) "  # noqa
             "values (%s, %s, %s, %s, %s)",
             (name, description, owner_id, now, fork_from))
         store.commit()
         gist = cls.get(id)
         fork_from = cls.get(fork_from)
         fork_from.fork_repo(gist)
         gist_forked_signal.send(gist, gist_id=gist.id)
     else:
         name = cls._get_name(names=gist_names)
         id = store.execute(
             "insert into gists "
             "(`name`, `description`, `owner_id`, `is_public`, `created_at`) "  # noqa
             "values (%s, %s, %s, %s, %s)",
             (name, description, owner_id, is_public, now))
         store.commit()
         gist = cls.get(id)
         gist.create_repo()
         gist._commit_all_files(gist_names, gist_contents, create=True)
         gist_created_signal.send(gist, gist_id=gist.id)
     return gist
开发者ID:000fan000,项目名称:code,代码行数:28,代码来源:gist.py


示例4: discover

 def discover(cls, name, sort='created', direction='desc', start=0,
              limit=5):
     assert sort in SORTS
     assert direction in DIRECTIONS
     sortby = "order by %s_at %s " % (sort, direction)
     sort = '%s_at' % sort
     reverse = direction == 'desc'
     if name == 'forked':
         rs = store.execute("select distinct(fork_from) from gists "
                            "where fork_from!=0 and is_public=1 " +
                            sortby + "limit %s, %s",
                            (start, limit))
         return [cls.get(r) for r, in rs]
     elif name == 'starred':
         rs = store.execute("select distinct(gist_id) from gist_stars "
                            "order by created_at " +
                            direction + " limit %s, %s",
                            (start, limit))
         gists = filter(None, [cls.get(r) for r, in rs])
         return sorted(gists, key=lambda g: getattr(g, sort),
                       reverse=reverse)
     else:
         rs = store.execute(
             "select id, name, description, owner_id, is_public, "
             "fork_from, created_at, updated_at from gists where "
             "is_public=1 " + sortby + "limit %s, %s",
             (start, limit))
         return [cls(*r) for r in rs]
开发者ID:000fan000,项目名称:code,代码行数:28,代码来源:gist.py


示例5: update_summary

 def update_summary(self, summary):
     store.execute("update codedouban_projects "
                   "set summary=%s "
                   "where project_id=%s",
                   (summary, self.id))
     store.commit()
     self.clear_mc(self.id)
开发者ID:000fan000,项目名称:code,代码行数:7,代码来源:project.py


示例6: test_project_stat

    def test_project_stat(self):
        store.execute("delete from codedouban_projects where project_id < 5")
        project_rs = get_all_project()
        assert len(project_rs) == 0
        project_fork_count = len(filter(lambda x: x[1] is not None,
                                        project_rs))
        assert project_fork_count == 0

        project_name = "project"
        project = CodeDoubanProject.add(
            project_name, owner_id="test1", summary="test", product="fire")
        git_path = os.path.join(get_repo_root(), '%s.git' % project_name)
        ok_(os.path.exists(git_path))
        project_rs = get_all_project()
        assert len(project_rs) == 1
        project_fork_count = len(filter(lambda x: x[1] is not None,
                                        project_rs))
        assert project_fork_count == 0

        project_fork = project.fork('project_test_fork', 'test_fork')
        project_rs = get_all_project()
        assert len(project_rs) == 2
        project_fork_count = len(filter(lambda x: x[1] is not None,
                                        project_rs))
        assert project_fork_count == 1

        project.delete()
        project_fork.delete()
开发者ID:000fan000,项目名称:code,代码行数:28,代码来源:test_stat.py


示例7: add

 def add(cls, name, followed_user_name):
     time = datetime.now()
     store.execute('insert into follow_relationship '
                   '(user_name, followed_user_name, time) '
                   'values (%s, %s, %s)',
                   (name, followed_user_name, time))
     store.commit()
开发者ID:000fan000,项目名称:code,代码行数:7,代码来源:user.py


示例8: main

def main():
    rs = store.execute("select id "
                       "from codedouban_ticket")
    for r in rs:
        id, = r
        ticket = Ticket.get(id)
        # update merge
        pullreq = PullRequest.get_by_ticket(ticket)
        author = pullreq.merge_by or pullreq.to_proj.owner_id
        time = pullreq.merge_time
        ticket_id = ticket.id
        id = 0
        if not get_node(author, TICKET_NODE_TYPE_MERGE, id, ticket_id, time) and time:
            print id, author, time, ticket_id
            store.execute("insert into ticket_nodes "
                          "(author, type, type_id, ticket_id, created_at) "
                          "value (%s, %s, %s, %s, %s)",
                          (author, TICKET_NODE_TYPE_MERGE, id, ticket_id, time))
            store.commit()
        # update close
        author = ticket.close_by or ticket.author
        time = ticket.closed
        ticket_id = ticket.id
        id = 0
        if not get_node(author, TICKET_NODE_TYPE_CLOSE, id, ticket_id, time) and time:
            print id, author, time, ticket_id
            store.execute("insert into ticket_nodes "
                          "(author, type, type_id, ticket_id, created_at) "
                          "value (%s, %s, %s, %s, %s)",
                          (author, TICKET_NODE_TYPE_CLOSE, id, ticket_id, time))
            store.commit()
    print "update %s close & merge pulls" % len(rs)
开发者ID:000fan000,项目名称:code,代码行数:32,代码来源:update_ticket.py


示例9: update_intern_banned

 def update_intern_banned(self, banned):
     store.execute("update codedouban_projects "
                   "set intern_banned=%s "
                   "where project_id=%s",
                   (banned, self.id))
     store.commit()
     self.clear_mc(self.id)
开发者ID:000fan000,项目名称:code,代码行数:7,代码来源:project.py


示例10: add_committer

 def add_committer(cls, proj_id, user_id):
     try:
         store.execute("insert into codedouban_committers "
                       "(project_id, user_id) values (%s, %s)",
                       (proj_id, user_id))
     except IntegrityError:
         return None
     store.commit()
开发者ID:000fan000,项目名称:code,代码行数:8,代码来源:project.py


示例11: update

 def update(self, title, description):
     store.execute("update issues "
                   "set title=%s, updated_at=null "
                   "where id=%s", (title, self.issue_id))
     store.commit()
     bdb.set(BDB_ISSUE_DESCRIPTION_KEY % self.issue_id, description)
     self.clear_cache()
     mc.delete(MC_KEY_ISSUES_DATA_BY_TARGET % (self.type, self.target_id))
开发者ID:leeccong,项目名称:code,代码行数:8,代码来源:issue.py


示例12: delete

 def delete(self):
     store.execute('delete from issues where id=%s', (self.id,))
     store.commit()
     mc.delete(MC_KEY_ISSUE % self.id)
     mc.delete(MC_KEY_ISSUES_IDS_BY_CREATOR_ID % self.creator_id)
     mc.delete(MC_KEY_ISSUES_IDS_BY_ASSIGNEE_ID % self.assignee_id)
     mc.delete(MC_KEY_ISSUES_DATA_BY_TARGET % (type, self.target_id))
     bdb.set(BDB_ISSUE_DESCRIPTION_KEY % self.id, '')
开发者ID:000fan000,项目名称:code,代码行数:8,代码来源:issue.py


示例13: get_item_count

def get_item_count(name):
    if name == '':
        rs = store.execute("select count(1) from badge_item")
    else:
        rs = store.execute(
            "select count(1) from badge_item where item_id=%s", (name,))
    data = rs and rs[0]
    return data
开发者ID:000fan000,项目名称:code,代码行数:8,代码来源:badge_timeline.py


示例14: update_can_push

 def update_can_push(self, can_push):
     push = 1 if can_push else 0
     store.execute("update codedouban_projects "
                   "set can_push=%s "
                   "where project_id=%s",
                   (push, self.id))
     store.commit()
     self.clear_mc(self.id)
开发者ID:000fan000,项目名称:code,代码行数:8,代码来源:project.py


示例15: assign

 def assign(self, user_id):
     old_id = self.assignee_id
     store.execute("update issues "
                   "set assignee_id=%s "
                   "where id=%s", (user_id, self.issue_id))
     store.commit()
     self.clear_cache()
     mc.delete(MC_KEY_ISSUES_IDS_BY_ASSIGNEE_ID % old_id)
     mc.delete(MC_KEY_ISSUES_IDS_BY_ASSIGNEE_ID % user_id)
开发者ID:leeccong,项目名称:code,代码行数:9,代码来源:issue.py


示例16: open

 def open(self):
     store.execute("update issues "
                   "set closer_id=null, closed_at=null "
                   "where id=%s", (self.issue_id,))
     store.commit()
     self.clear_cache()
     mc.delete(MC_KEY_ISSUES_IDS_BY_CREATOR_ID % self.creator_id)
     mc.delete(MC_KEY_ISSUES_DATA_BY_TARGET % (self.type, self.target_id))
     self.closer_id = None
开发者ID:leeccong,项目名称:code,代码行数:9,代码来源:issue.py


示例17: open

 def open(self, operator):
     opened_time = datetime.now()
     store.execute("update codedouban_ticket set closed=null where id=%s",
                   (self.id,))
     store.commit()
     mc.delete(MCKEY_TICKET % self.id)
     self.close_by = None
     self.add_participant(operator)
     TicketNode.add_open(self.id, operator, opened_time)
开发者ID:leeccong,项目名称:code,代码行数:9,代码来源:ticket.py


示例18: count_user_all

 def count_user_all(self, owner_id, is_self=False):
     if is_self:
         rs = store.execute(
             "select count(1) from gists where owner_id=%s", (owner_id,))
     else:
         rs = store.execute(
             "select count(1) from gists where owner_id=%s "
             "and is_public=1", (owner_id,))
     return rs[0][0]
开发者ID:000fan000,项目名称:code,代码行数:9,代码来源:gist.py


示例19: update

 def update(self, description, gist_names=[], gist_contents=[],
            gist_oids=[]):
     name = self._get_name(gist_names)
     store.execute(
         "update gists set name=%s, description=%s, updated_at=%s where id=%s",  # noqa
         (name, description, datetime.now(), self.id))
     store.commit()
     self._commit_all_files(gist_names, gist_contents, gist_oids)
     gist_updated_signal.send(self, gist_id=self.id)
开发者ID:000fan000,项目名称:code,代码行数:9,代码来源:gist.py


示例20: transfer_to_top

 def transfer_to_top(self, user=None):
     new_user = user if user else self.owner_id
     sql = ("update codedouban_projects set project_name=%s, "
            "git_path=%s, trac_conf=%s, owner_id=%s "
            "where owner_id=%s and project_id=%s")
     store.execute(sql, (self.realname, self.realname, self.realname,
                         new_user, self.owner_id, self.id))
     store.commit()
     self.clear_mc(self.id)
开发者ID:000fan000,项目名称:code,代码行数:9,代码来源:project.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python template.st函数代码示例发布时间:2022-05-26
下一篇:
Python store.commit函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap