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


Python DBApiModule.selectFrom方法代码示例

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


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

示例1: testInsertion

# 需要导入模块: from app.db import DBApiModule [as 别名]
# 或者: from app.db.DBApiModule import selectFrom [as 别名]
    def testInsertion(self):
        self.insertMetaData(self.linkId, self.key, self.value)
        rows = db.selectFrom(self.conn, {"meta_data"}, "*", link_id=self.linkId)

        self.assertEqual(self.linkId, rows[0][0])
        self.assertEqual(self.key, rows[0][1])
        self.assertEqual(self.value, rows[0][2])
开发者ID:lutzer,项目名称:sahabe,代码行数:9,代码来源:MetaData.py

示例2: testDropPWByUser

# 需要导入模块: from app.db import DBApiModule [as 别名]
# 或者: from app.db.DBApiModule import selectFrom [as 别名]
 def testDropPWByUser(self):
     self.insertUser(self.id, self.name, self.email)
     self.insertPW(self.pw.userId, self.pw.value, self.pw.salt)
     
     db.deleteFromTable(self.conn, "user", id=self.id) 
     row = db.selectFrom(self.conn, {"pw_hash"}, "*", user_id=self.id)
     self.assertEqual(row, [])
开发者ID:lutzer,项目名称:sahabe,代码行数:9,代码来源:User.py

示例3: getUserByName

# 需要导入模块: from app.db import DBApiModule [as 别名]
# 或者: from app.db.DBApiModule import selectFrom [as 别名]
def getUserByName(name):
    conn = db.connect()
    rows = db.selectFrom(conn, {"user"}, "*", name = name)
    if rows == []:
        #raise Exception("user not found")
        return None
    return User(rows)
开发者ID:lutzer,项目名称:sahabe,代码行数:9,代码来源:User.py

示例4: testInsertion

# 需要导入模块: from app.db import DBApiModule [as 别名]
# 或者: from app.db.DBApiModule import selectFrom [as 别名]
 def testInsertion(self):
     self.insertLinkTagMap(self.tagId, self.linkId)
     
     rows = db.selectFrom(self.conn, {"link_tag_map"}, "*", tag_id=self.tagId, link_id=self.linkId)
     
     self.assertEqual(self.tag.id, rows[0][0])
     self.assertEqual(self.link.id, rows[0][1])
开发者ID:lutzer,项目名称:sahabe,代码行数:9,代码来源:LinkTagMap.py

示例5: testInsertion

# 需要导入模块: from app.db import DBApiModule [as 别名]
# 或者: from app.db.DBApiModule import selectFrom [as 别名]
 def testInsertion(self):
     self.insertTag(self.id, self.name)
     
     rows = db.selectFrom(self.conn, {"tag"}, "*", id=self.id)
     
     self.assertEqual(self.id, rows[0][0])
     self.assertEqual(self.name, rows[0][1])
开发者ID:lutzer,项目名称:sahabe,代码行数:9,代码来源:Tag.py

示例6: testInsertion

# 需要导入模块: from app.db import DBApiModule [as 别名]
# 或者: from app.db.DBApiModule import selectFrom [as 别名]
 def testInsertion(self):
     self.insertLinkGroupMap(self.groupId, self.linkId)
     
     rows = db.selectFrom(self.conn, {"link_group_map"}, "*", group_id=self.groupId, link_id=self.linkId)
     
     self.assertEqual(self.group.id, rows[0][0])
     self.assertEqual(self.link.id, rows[0][1])
开发者ID:lutzer,项目名称:sahabe,代码行数:9,代码来源:LinkGroupMap.py

示例7: testDropGroupByUser

# 需要导入模块: from app.db import DBApiModule [as 别名]
# 或者: from app.db.DBApiModule import selectFrom [as 别名]
 def testDropGroupByUser(self):
     self.insertUser(self.id, self.name, self.email)
     self.insertGroup(self.group.id, self.group.name, self.group.public)
     
     db.deleteFromTable(self.conn, "user", id=self.id)
     row = db.selectFrom(self.conn, {"link_group"}, "*" , id=self.group.id)
     # FIXME: when a user is deleted all of his groups must be removed
     self.assertEqual(row, [])
开发者ID:lutzer,项目名称:sahabe,代码行数:10,代码来源:User.py

示例8: testDropTagByUser

# 需要导入模块: from app.db import DBApiModule [as 别名]
# 或者: from app.db.DBApiModule import selectFrom [as 别名]
 def testDropTagByUser(self):
     self.insertUser(self.id, self.name, self.email)
     self.insertTag(self.tag.id, self.tag.name)
     
     db.deleteFromTable(self.conn, "user", id=self.id)
     row = db.selectFrom(self.conn, {"tag"}, "*" , id=self.tag.id)
     # FIXME: when a user is deleted all of his tags must be removed 
     self.assertEqual(row, [])
开发者ID:lutzer,项目名称:sahabe,代码行数:10,代码来源:User.py

示例9: testInsertion

# 需要导入模块: from app.db import DBApiModule [as 别名]
# 或者: from app.db.DBApiModule import selectFrom [as 别名]
 def testInsertion(self):
     self.insertUser(self.id, self.name, self.email)
     
     rows = db.selectFrom(self.conn, {"user"}, "*", id=self.id)
     
     self.assertEqual(self.id, rows[0][0])
     self.assertEqual(self.name, rows[0][1])
     self.assertEqual(self.email, rows[0][2])
开发者ID:lutzer,项目名称:sahabe,代码行数:10,代码来源:User.py

示例10: testDropMetaDataByLink

# 需要导入模块: from app.db import DBApiModule [as 别名]
# 或者: from app.db.DBApiModule import selectFrom [as 别名]
 def testDropMetaDataByLink(self):
     self.insertLink(self.id, self.userId, self.url, self.urlHash, self.title,
                     self.desc, self.typeName , self.modifiedAt)
     self.insertMetaData(self.metaData.linkId, self.metaData.key, self.metaData.value)
     
     db.deleteFromTable(self.conn, "link", id=self.id)
     row = db.selectFrom(self.conn, {"meta_data"}, "*", link_id=self.metaData.linkId)
     self.assertEqual(row, []) 
开发者ID:lutzer,项目名称:sahabe,代码行数:10,代码来源:Link.py

示例11: testInsertion

# 需要导入模块: from app.db import DBApiModule [as 别名]
# 或者: from app.db.DBApiModule import selectFrom [as 别名]
 def testInsertion(self):
     self.insertPW(self.userId, self.value, self.salt)
     
     rows = db.selectFrom(self.conn, {"pw_hash"}, "*", user_id=self.userId)
     
     self.assertEqual(self.user.id, rows[0][0])
     self.assertEqual(self.value, rows[0][1])
     self.assertEqual(self.salt, rows[0][2])
开发者ID:lutzer,项目名称:sahabe,代码行数:10,代码来源:PassWord.py

示例12: testInsertion

# 需要导入模块: from app.db import DBApiModule [as 别名]
# 或者: from app.db.DBApiModule import selectFrom [as 别名]
 def testInsertion(self):
     self.insertGroup(self.id, self.name, self.public)
     
     rows = db.selectFrom(self.conn, {"link_group"}, "*", id=self.id)
     
     self.assertEqual(self.id, rows[0][0])
     self.assertEqual(self.name, rows[0][1])
     self.assertEqual(int(self.public), rows[0][2])
开发者ID:lutzer,项目名称:sahabe,代码行数:10,代码来源:Group.py

示例13: testDropLinkTagMapByLink

# 需要导入模块: from app.db import DBApiModule [as 别名]
# 或者: from app.db.DBApiModule import selectFrom [as 别名]
 def testDropLinkTagMapByLink(self):
     self.insertLink(self.id, self.userId, self.url, self.urlHash, self.title,
                     self.desc, self.typeName , self.modifiedAt)
     self.insertTag(self.tag.id, self.tag.name)
     self.insertLinkTagMap(self.linkTagMap.tagId, self.linkTagMap.linkId)
     
     db.deleteFromTable(self.conn, "link", id=self.id)
     row = db.selectFrom(self.conn, {"link_tag_map"}, "*", link_id=self.linkTagMap.linkId)
     self.assertEqual(row, [])
开发者ID:lutzer,项目名称:sahabe,代码行数:11,代码来源:Link.py

示例14: testUpdateId

# 需要导入模块: from app.db import DBApiModule [as 别名]
# 或者: from app.db.DBApiModule import selectFrom [as 别名]
 def testUpdateId(self):
     self.insertTag(self.id, self.name)
     _id = mock.uuid()
     db.updateInTable(self.conn, {"id":_id}, "tag", id=self.id)
     
     rows = db.selectFrom(self.conn, {"tag"}, "*", id=_id)
     
     self.assertEqual(_id, rows[0][0])
     self.assertEqual(self.name, rows[0][1])
开发者ID:lutzer,项目名称:sahabe,代码行数:11,代码来源:Tag.py

示例15: testUpdatePublic

# 需要导入模块: from app.db import DBApiModule [as 别名]
# 或者: from app.db.DBApiModule import selectFrom [as 别名]
 def testUpdatePublic(self):
     self.insertGroup(self.id, self.name, self.public)
     db.updateInTable(self.conn, {"public":"1"}, "link_group", id=self.id)
     
     rows = db.selectFrom(self.conn, {"link_group"}, "*", id=self.id)
     
     self.assertEqual(self.id, rows[0][0])
     self.assertEqual(self.name, rows[0][1])
     self.assertEqual(1, rows[0][2])
开发者ID:lutzer,项目名称:sahabe,代码行数:11,代码来源:Group.py


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