本文整理汇总了Python中app.backend.commons.database.Database.executeWriteQuery方法的典型用法代码示例。如果您正苦于以下问题:Python Database.executeWriteQuery方法的具体用法?Python Database.executeWriteQuery怎么用?Python Database.executeWriteQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app.backend.commons.database.Database
的用法示例。
在下文中一共展示了Database.executeWriteQuery方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: store
# 需要导入模块: from app.backend.commons.database import Database [as 别名]
# 或者: from app.backend.commons.database.Database import executeWriteQuery [as 别名]
def store(self):
database = Database()
database.open()
if self.id:
query = "SELECT COUNT(id) FROM appliances_network WHERE id = '@@[email protected]@';"
query = self.__replaceSqlQueryToken(query)
queryResult = database.executeReadQuery(query)
if int(queryResult[0][0]) > 0:
query = "UPDATE appliances_network SET name = '@@[email protected]@', label = '@@[email protected]@', brand = '@@[email protected]@', model = '@@[email protected]@', smart_appliance = '@@[email protected]@', protocol = '@@[email protected]@', address = '@@[email protected]@', timeslots = '@@[email protected]@' WHERE id = '@@[email protected]@';"
else:
query = "SELECT COUNT(id) FROM appliances_network WHERE name = '@@[email protected]@';"
query = self.__replaceSqlQueryToken(query)
queryResult = database.executeReadQuery(query)
if int(queryResult[0][0]) > 0:
query = "UPDATE appliances_network SET name = '@@[email protected]@', label = '@@[email protected]@', brand = '@@[email protected]@', model = '@@[email protected]@', smart_appliance = '@@[email protected]@', protocol = '@@[email protected]@', address = '@@[email protected]@', timeslots = '@@[email protected]@' WHERE name = '@@[email protected]@';"
else:
query = "INSERT INTO appliances_network (name, label, brand, model, smart_appliance, protocol, address, timeslots) VALUES ('@@[email protected]@', '@@[email protected]@', '@@[email protected]@', '@@[email protected]@', '@@[email protected]@', '@@[email protected]@', '@@[email protected]@', '@@[email protected]@');"
query = self.__replaceSqlQueryToken(query)
database.executeWriteQuery(query)
database.close()
示例2: delete
# 需要导入模块: from app.backend.commons.database import Database [as 别名]
# 或者: from app.backend.commons.database.Database import executeWriteQuery [as 别名]
def delete(self):
database = Database()
database.open()
query = "DELETE FROM settings WHERE s_key = '@@[email protected]@';"
query = self.__replaceSqlQueryToken(query)
database.executeWriteQuery(query)
database.close()
示例3: delete
# 需要导入模块: from app.backend.commons.database import Database [as 别名]
# 或者: from app.backend.commons.database.Database import executeWriteQuery [as 别名]
def delete(self):
database = Database()
database.open()
query = "DELETE FROM feedbacks WHERE id = '@@[email protected]@';"
query = self.__replaceSqlQueryToken(query)
database.executeWriteQuery(query)
database.close()
示例4: deleteRoom
# 需要导入模块: from app.backend.commons.database import Database [as 别名]
# 或者: from app.backend.commons.database.Database import executeWriteQuery [as 别名]
def deleteRoom(self, room):
database = Database()
database.open()
query = "DELETE FROM rooms_groups WHERE room_name = '@@[email protected]@' AND building_name = '@@[email protected]@' AND group_id = '@@[email protected]@';"
query = self.__replaceSqlQueryToken(query)
query = query.replace("@@[email protected]@", str(room.roomName))
database.executeWriteQuery(query)
database.close()
示例5: store
# 需要导入模块: from app.backend.commons.database import Database [as 别名]
# 或者: from app.backend.commons.database.Database import executeWriteQuery [as 别名]
def store(self):
database = Database()
database.open()
query = "INSERT INTO sessions (session_key, user_uuid, expire_timestamp) VALUES ('@@[email protected]@', '@@[email protected]@', '@@[email protected]@');"
query = self.__replaceSqlQueryToken(query)
database.executeWriteQuery(query)
database.close()
示例6: addRoom
# 需要导入模块: from app.backend.commons.database import Database [as 别名]
# 或者: from app.backend.commons.database.Database import executeWriteQuery [as 别名]
def addRoom(self, room):
database = Database()
database.open()
query = "INSERT INTO rooms_groups (group_id, building_name, room_name) VALUES ('@@[email protected]@', '@@[email protected]@', '@@[email protected]@');"
query = self.__replaceSqlQueryToken(query)
query = query.replace("@@[email protected]@", str(room.roomName))
database.executeWriteQuery(query)
database.close()
示例7: delete
# 需要导入模块: from app.backend.commons.database import Database [as 别名]
# 或者: from app.backend.commons.database.Database import executeWriteQuery [as 别名]
def delete(self):
database = Database()
database.open()
query = "DELETE FROM appliances_network WHERE id = '@@[email protected]@';"
query = self.__replaceSqlQueryToken(query)
database.executeWriteQuery(query)
database.close()
示例8: delete
# 需要导入模块: from app.backend.commons.database import Database [as 别名]
# 或者: from app.backend.commons.database.Database import executeWriteQuery [as 别名]
def delete(self):
print "\t\t\t\t\t\t\t\tTODO (" + self.__class__.__name__ + ":" + sys._getframe().f_code.co_name + ") : Consistency check not performed - class Building"
database = Database()
database.open()
query = "DELETE FROM buildings WHERE building_name = '@@[email protected]@';"
query = self.__replaceSqlQueryToken(query)
database.executeWriteQuery(query)
database.close()
示例9: delete
# 需要导入模块: from app.backend.commons.database import Database [as 别名]
# 或者: from app.backend.commons.database.Database import executeWriteQuery [as 别名]
def delete(self):
print "\t\t\t\t\t\t\t\tTODO (" + self.__class__.__name__ + ":" + sys._getframe().f_code.co_name + ") : Consistency check not performed - Trigger class"
database = Database()
database.open()
query = "DELETE FROM notifications WHERE id = '@@[email protected]@';"
query = self.__replaceSqlQueryToken(query)
database.executeWriteQuery(query)
database.close()
示例10: addUser
# 需要导入模块: from app.backend.commons.database import Database [as 别名]
# 或者: from app.backend.commons.database.Database import executeWriteQuery [as 别名]
def addUser(self, user):
self.isClassInitialized()
database = Database()
database.open()
query = "INSERT INTO users_rooms (room_name, building_name, user_uuid) VALUES ('@@[email protected]@', '@@[email protected]@', '@@[email protected]@');"
query = self.__replaceSqlQueryToken(query)
query = query.replace("@@[email protected]@", str(user.uuid))
database.executeWriteQuery(query)
database.close()
示例11: delete
# 需要导入模块: from app.backend.commons.database import Database [as 别名]
# 或者: from app.backend.commons.database.Database import executeWriteQuery [as 别名]
def delete(self):
print "\t\t\t\t\t\t\t\tTODO (" + self.__class__.__name__ + ":" + sys._getframe().f_code.co_name + ") : Consistency check not performed into table users_rooms"
database = Database()
database.open()
query = "DELETE FROM users WHERE uuid = '@@[email protected]@'"
query = self.__replaceSqlQueryToken(query)
database.executeWriteQuery(query)
database.close()
示例12: deleteUser
# 需要导入模块: from app.backend.commons.database import Database [as 别名]
# 或者: from app.backend.commons.database.Database import executeWriteQuery [as 别名]
def deleteUser(self, user):
self.isClassInitialized()
database = Database()
database.open()
query = "DELETE FROM users_rooms WHERE room_name = '@@[email protected]@' AND building_name = '@@[email protected]@' AND user_uuid = '@@[email protected]@';"
query = self.__replaceSqlQueryToken(query)
query = query.replace("@@[email protected]@", str(user.uuid))
database.executeWriteQuery(query)
database.close()
示例13: delete
# 需要导入模块: from app.backend.commons.database import Database [as 别名]
# 或者: from app.backend.commons.database.Database import executeWriteQuery [as 别名]
def delete(self):
if not (self.buildingName and self.roomName and self.ruleId): raise MissingInputDataError("Missing input to get a rule priority")
print "\t\t\t\t\t\t\t\tTODO (" + self.__class__.__name__ + ":" + sys._getframe().f_code.co_name + ") : Consistency check not performed - RulePriority class"
database = Database()
database.open()
query = "DELETE FROM rules_priority WHERE building_name = '@@[email protected]@' AND room_name = '@@[email protected]@' AND rule_id = '@@[email protected]@';"
query = self.__replaceSqlQueryToken(query)
database.executeWriteQuery(query)
database.close()
示例14: addTrigger
# 需要导入模块: from app.backend.commons.database import Database [as 别名]
# 或者: from app.backend.commons.database.Database import executeWriteQuery [as 别名]
def addTrigger(self, trigger):
print "\t\t\t\t\t\t\t\tTODO (" + self.__class__.__name__ + ":" + sys._getframe().f_code.co_name + ") : non yet tested"
self.isClassInitialized()
database = Database()
database.open()
query = "INSERT INTO rooms_triggers (room_name, building_name, trigger_id) VALUES ('@@[email protected]@', '@@[email protected]@', '@@[email protected]@');"
query = self.__replaceSqlQueryToken(query)
query = query.replace("@@[email protected]@", str(trigger.id))
database.executeWriteQuery(query)
database.close()
示例15: delete
# 需要导入模块: from app.backend.commons.database import Database [as 别名]
# 或者: from app.backend.commons.database.Database import executeWriteQuery [as 别名]
def delete(self):
print "\t\t\t\t\t\t\t\tTODO (" + self.__class__.__name__ + ":" + sys._getframe().f_code.co_name + ") : Consistency check not performed into table users_rooms"
self.isClassInitialized()
database = Database()
database.open()
query = "DELETE FROM rooms WHERE room_name = '@@[email protected]@' AND building_name = '@@[email protected]@';"
query = self.__replaceSqlQueryToken(query)
database.executeWriteQuery(query)
database.close()