本文整理汇总了Python中DBManager.DBManager.deleteLocByLID方法的典型用法代码示例。如果您正苦于以下问题:Python DBManager.deleteLocByLID方法的具体用法?Python DBManager.deleteLocByLID怎么用?Python DBManager.deleteLocByLID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBManager.DBManager
的用法示例。
在下文中一共展示了DBManager.deleteLocByLID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: validateLocations
# 需要导入模块: from DBManager import DBManager [as 别名]
# 或者: from DBManager.DBManager import deleteLocByLID [as 别名]
def validateLocations(self):
#get updated location data from this nodes session table
self.updateLocations()
#initialize list to hold lID's of location rows to delete
locToDel = list()
#loop over every location
for location in self.locations:
lID = location['lID']
locTime = location['time']
locLat = location['lat']
locLon = location['lon']
# if the timestamp is invalid (in the future)
if not self.validTime(locTime):
locToDel.append(lID)
# o.w. if the location is invalid
elif not self.validLoc(locLat, locLon):
locToDel.append(lID)
#if there are locations to delete
if locToDel:
#open a connection to the DB
db = DBManager()
#delete the locations that were marked
db.deleteLocByLID(self.sessionTblName, locToDel)
#close the database connection
db.close()
示例2: compressLocations
# 需要导入模块: from DBManager import DBManager [as 别名]
# 或者: from DBManager.DBManager import deleteLocByLID [as 别名]
def compressLocations(self):
#get updated location data from this nodes session table
self.updateLocations()
#initialize list to hold location rows to delete lID's
#initialize Start and End
locToDel = list()
Start = 0
End = 0
#loop over every location
for index, location in enumerate(self.locations):
#skip the first iteration
if index == 0:
continue
lID = location['lID']
#if location is the same at self.locations[Start]
if self.sameLoc(location, self.locations[Start]):
locToDel.append(lID)
End = index
else:
if not Start == End:
locToDel.pop()
Start = index
End = index
#if there are locations to delete
if locToDel:
#open a connection to the DB
db = DBManager()
#delete the locations that were marked
db.deleteLocByLID(self.sessionTblName, locToDel)
#close the database connection
db.close()