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


Python DBManager.deleteLocByLID方法代码示例

本文整理汇总了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()
开发者ID:haidark,项目名称:rahat,代码行数:27,代码来源:NodeHandler.py

示例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()
开发者ID:haidark,项目名称:rahat,代码行数:35,代码来源:NodeHandler.py


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