本文整理汇总了Python中analytics.databaseinterface.DatabaseInterface类的典型用法代码示例。如果您正苦于以下问题:Python DatabaseInterface类的具体用法?Python DatabaseInterface怎么用?Python DatabaseInterface使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DatabaseInterface类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add
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
def remove_comment(cls, usr, content):
dbi.execute(
"UPDATE analytics_content SET comments=comments-1 WHERE content=%s"
,(content,)
)
示例3: add_invite
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
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
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
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
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
def add(cls, usr, content):
dbi.execute(
"INSERT INTO analytics_usr_seen (usr,content) VALUES(%s,%s) "
,(usr, content)
)
示例9: remove_invite
def remove_invite(cls, usr, tabloid):
dbi.execute(
"UPDATE analytics_tabloid SET invites=invites-1 WHERE tabloid=%s"
,(tabloid,)
)
示例10: add_invite
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
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
def remove_view(cls, usr, tabloid):
dbi.execute(
"UPDATE analytics_tabloid SET views=views+1 WHERE tabloid=%s"
,(tabloid,)
)
示例13: add_view
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
def add(cls, usr, tabloid):
dbi.execute(
"INSERT INTO analytics_tabloid (tabloid,usr) VALUES(%s,%s)"
,(tabloid,usr)
)
示例15: add_time_spent
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)
)