本文整理汇总了Python中MysqlObj.insert方法的典型用法代码示例。如果您正苦于以下问题:Python MysqlObj.insert方法的具体用法?Python MysqlObj.insert怎么用?Python MysqlObj.insert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MysqlObj
的用法示例。
在下文中一共展示了MysqlObj.insert方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: insertTags
# 需要导入模块: import MysqlObj [as 别名]
# 或者: from MysqlObj import insert [as 别名]
def insertTags(tags):
db = MysqlObj(host=MYSQL_HOST, db=MYSQL_DB, user=MYSQL_USER, passwd=MYSQL_PASS, port=int(MYSQL_PORT))
for id in tags:
try:
db.insert('tags', {'id': id, 'name': tags[id]})
except Exception, e:
print "tag exists"
示例2: insertAction
# 需要导入模块: import MysqlObj [as 别名]
# 或者: from MysqlObj import insert [as 别名]
def insertAction(uid, statdate, stattime, action):
db = MysqlObj(host=MYSQL_HOST, db=MYSQL_DB, user=MYSQL_USER, passwd=MYSQL_PASS, port=int(MYSQL_PORT))
db.insert('action', {'uid': uid, 'statdate': statdate, 'stattime': stattime, 'action': action})
示例3: insertMedicine
# 需要导入模块: import MysqlObj [as 别名]
# 或者: from MysqlObj import insert [as 别名]
def insertMedicine(uid, statdate, stattype, medicine=0):
db = MysqlObj(host=MYSQL_HOST, db=MYSQL_DB, user=MYSQL_USER, passwd=MYSQL_PASS, port=int(MYSQL_PORT))
db.insert('medicine', {'uid': uid, 'statdate': statdate, 'stattype': stattype, 'medicine': medicine})
示例4: insertPasswd
# 需要导入模块: import MysqlObj [as 别名]
# 或者: from MysqlObj import insert [as 别名]
def insertPasswd(uid, project, idno, passwd):
db = MysqlObj(host=MYSQL_HOST, db=MYSQL_DB, user=MYSQL_USER, passwd=MYSQL_PASS, port=int(MYSQL_PORT))
db.insert('passwd', {'uid': uid, 'project': project, 'idno': idno, 'passwd': passwd})
示例5: insertTvshow
# 需要导入模块: import MysqlObj [as 别名]
# 或者: from MysqlObj import insert [as 别名]
def insertTvshow(uid, name, season, episode):
db = MysqlObj(host=MYSQL_HOST, db=MYSQL_DB, user=MYSQL_USER, passwd=MYSQL_PASS, port=int(MYSQL_PORT))
db.insert('tvshow', {'uid': uid, 'name': name, 'season': season, 'episode': episode})
示例6: insertSleep
# 需要导入模块: import MysqlObj [as 别名]
# 或者: from MysqlObj import insert [as 别名]
def insertSleep(uid, statdate, longmins, shortmins):
db = MysqlObj(host=MYSQL_HOST, db=MYSQL_DB, user=MYSQL_USER, passwd=MYSQL_PASS, port=int(MYSQL_PORT))
db.insert('sleeps', {'uid': uid, 'statdate': statdate, 'longmins': longmins, 'shortmins': shortmins})
示例7: insertPost
# 需要导入模块: import MysqlObj [as 别名]
# 或者: from MysqlObj import insert [as 别名]
def insertPost(post):
db = MysqlObj(host=MYSQL_HOST, db=MYSQL_DB, user=MYSQL_USER, passwd=MYSQL_PASS, port=int(MYSQL_PORT))
return db.insert('posts', post).lastrowid
示例8: insertPostsTags
# 需要导入模块: import MysqlObj [as 别名]
# 或者: from MysqlObj import insert [as 别名]
def insertPostsTags(posts_tags, uid):
db = MysqlObj(host=MYSQL_HOST, db=MYSQL_DB, user=MYSQL_USER, passwd=MYSQL_PASS, port=int(MYSQL_PORT))
for pid in posts_tags:
for tid in posts_tags[pid]:
db.insert('posts_tags', {'pid': pid, 'tid': tid, 'uid': uid})
示例9: insertPosts
# 需要导入模块: import MysqlObj [as 别名]
# 或者: from MysqlObj import insert [as 别名]
def insertPosts(posts):
db = MysqlObj(host=MYSQL_HOST, db=MYSQL_DB, user=MYSQL_USER, passwd=MYSQL_PASS, port=int(MYSQL_PORT))
for post in posts:
db.insert('posts', post)
示例10: insertUniqRawPosts
# 需要导入模块: import MysqlObj [as 别名]
# 或者: from MysqlObj import insert [as 别名]
def insertUniqRawPosts(favorites):
db = MysqlObj(host=MYSQL_HOST, db=MYSQL_DB, user=MYSQL_USER, passwd=MYSQL_PASS, port=int(MYSQL_PORT))
for id in favorites:
db.insert('uniq_raw_posts', {'id': id, 'content': favorites[id]})
示例11: insertRawPosts
# 需要导入模块: import MysqlObj [as 别名]
# 或者: from MysqlObj import insert [as 别名]
def insertRawPosts(favorites):
db = MysqlObj(host=MYSQL_HOST, db=MYSQL_DB, user=MYSQL_USER, passwd=MYSQL_PASS, port=int(MYSQL_PORT))
for fav in favorites:
db.insert('raw_posts', {'content': json.dumps(fav)})