本文整理汇总了Python中analytics.databaseinterface.DatabaseInterface.execute方法的典型用法代码示例。如果您正苦于以下问题:Python DatabaseInterface.execute方法的具体用法?Python DatabaseInterface.execute怎么用?Python DatabaseInterface.execute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类analytics.databaseinterface.DatabaseInterface
的用法示例。
在下文中一共展示了DatabaseInterface.execute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add
# 需要导入模块: from analytics.databaseinterface import DatabaseInterface [as 别名]
# 或者: from analytics.databaseinterface.DatabaseInterface import execute [as 别名]
def add(cls, follower, following, weight=1):
""" Returns 0 if it """
cursor = dbi.execute(
"INSERT IGNORE INTO analytics_follow (follower,following,weight) VALUES(%s,%s,%s)"
,(follower,following,weight)
)
return (cursor.lastrowid!=0)
示例2: remove_comment
# 需要导入模块: from analytics.databaseinterface import DatabaseInterface [as 别名]
# 或者: from analytics.databaseinterface.DatabaseInterface import execute [as 别名]
def remove_comment(cls, usr, content):
dbi.execute(
"UPDATE analytics_content SET comments=comments-1 WHERE content=%s"
,(content,)
)
示例3: add_invite
# 需要导入模块: from analytics.databaseinterface import DatabaseInterface [as 别名]
# 或者: from analytics.databaseinterface.DatabaseInterface import execute [as 别名]
def add_invite(cls, follower, following):
cls.assert_exists(follower, following)
dbi.execute(
"UPDATE analytics_follow SET invites = invites+1 WHERE follower=%s and following=%s"
,(follower, following)
)
示例4: remove_comment
# 需要导入模块: from analytics.databaseinterface import DatabaseInterface [as 别名]
# 或者: from analytics.databaseinterface.DatabaseInterface import execute [as 别名]
def remove_comment(cls, follower, following):
dbi.execute(
"UPDATE analytics_follow SET comments = comments-1 WHERE follower=%s and following=%s"
,(follower, following)
)
示例5: remove
# 需要导入模块: from analytics.databaseinterface import DatabaseInterface [as 别名]
# 或者: from analytics.databaseinterface.DatabaseInterface import execute [as 别名]
def remove(cls, follower, following):
cursor = dbi.execute(
"DELETE FROM analytics_follow WHERE follower=%s and following=%s"
,(follower,following)
)
return (cursor.rowcount!=0)
示例6: remove_comment
# 需要导入模块: from analytics.databaseinterface import DatabaseInterface [as 别名]
# 或者: from analytics.databaseinterface.DatabaseInterface import execute [as 别名]
def remove_comment(cls, usr, content, tabloid):
dbi.execute(
"UPDATE analytics_tabloidentry SET comments=comments-1 WHERE tabloid=%s and content=%s"(tabloid, content)
)
示例7: remove_view
# 需要导入模块: from analytics.databaseinterface import DatabaseInterface [as 别名]
# 或者: from analytics.databaseinterface.DatabaseInterface import execute [as 别名]
def remove_view(cls, usr, content, tabloid):
dbi.execute("UPDATE analytics_tabloidentry SET views=views-1 WHERE tabloid=%s and content=%s"(tabloid, content))
示例8: add
# 需要导入模块: from analytics.databaseinterface import DatabaseInterface [as 别名]
# 或者: from analytics.databaseinterface.DatabaseInterface import execute [as 别名]
def add(cls, usr, content):
dbi.execute(
"INSERT INTO analytics_usr_seen (usr,content) VALUES(%s,%s) "
,(usr, content)
)
示例9: remove_invite
# 需要导入模块: from analytics.databaseinterface import DatabaseInterface [as 别名]
# 或者: from analytics.databaseinterface.DatabaseInterface import execute [as 别名]
def remove_invite(cls, usr, tabloid):
dbi.execute(
"UPDATE analytics_tabloid SET invites=invites-1 WHERE tabloid=%s"
,(tabloid,)
)
示例10: add_invite
# 需要导入模块: from analytics.databaseinterface import DatabaseInterface [as 别名]
# 或者: from analytics.databaseinterface.DatabaseInterface import execute [as 别名]
def add_invite(cls, usr, tabloid):
cls.assert_exists(tabloid)
dbi.execute(
"UPDATE analytics_tabloid SET invites=invites+1 WHERE tabloid=%s"
,(tabloid,)
)
示例11: get_owner
# 需要导入模块: from analytics.databaseinterface import DatabaseInterface [as 别名]
# 或者: from analytics.databaseinterface.DatabaseInterface import execute [as 别名]
def get_owner(cls, tabloid):
row = dbi.execute("SELECT usr FROM analytics_tabloid WHERE tabloid=%s",(tabloid,)).fetchone()
if row is not None:
return row["usr"]
else:
return None
示例12: remove_view
# 需要导入模块: from analytics.databaseinterface import DatabaseInterface [as 别名]
# 或者: from analytics.databaseinterface.DatabaseInterface import execute [as 别名]
def remove_view(cls, usr, tabloid):
dbi.execute(
"UPDATE analytics_tabloid SET views=views+1 WHERE tabloid=%s"
,(tabloid,)
)
示例13: add_view
# 需要导入模块: from analytics.databaseinterface import DatabaseInterface [as 别名]
# 或者: from analytics.databaseinterface.DatabaseInterface import execute [as 别名]
def add_view(cls, usr, tabloid):
cls.assert_exists(tabloid)
dbi.execute(
"UPDATE analytics_tabloid SET views=views+1 WHERE tabloid=%s"
,(tabloid,)
)
示例14: add
# 需要导入模块: from analytics.databaseinterface import DatabaseInterface [as 别名]
# 或者: from analytics.databaseinterface.DatabaseInterface import execute [as 别名]
def add(cls, usr, tabloid):
dbi.execute(
"INSERT INTO analytics_tabloid (tabloid,usr) VALUES(%s,%s)"
,(tabloid,usr)
)
示例15: add_time_spent
# 需要导入模块: from analytics.databaseinterface import DatabaseInterface [as 别名]
# 或者: from analytics.databaseinterface.DatabaseInterface import execute [as 别名]
def add_time_spent(cls, usr, content):
cls.assert_exists(content)
dbi.execute(
"UPDATE analytics_content SET time_spent=time_spent+%s WHERE content=%s"
,(content,time_spent)
)