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


Python Model.fetchOneRow方法代码示例

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


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

示例1: getNeighbourgFromDirection

# 需要导入模块: from Model import Model [as 别名]
# 或者: from Model.Model import fetchOneRow [as 别名]
	def getNeighbourgFromDirection(idArea, direction):
		"""
		area.model.getNeighbourgFromDirection(idArea, direction) -> dict()

		Returns the neighbourg of the area given in arguments from a given
		direction.

		@param idArea integer id of the reference area
		@direction string direction (from the reference area) of the area to
		return, must be a value of area.directions.

		@return dict informations of the found area, empty dict if not found.
		"""
		if direction not in (directions):
			raise exception('Unknown direction')

		query = "\
			SELECT\
				ad.id_area,\
				ad.id_region,\
				ad.id_next_area_north,\
				ad.id_next_area_east,\
				ad.id_next_area_south,\
				ad.id_next_area_west\
			FROM\
				area AS ad\
				JOIN area AS ap ON ad.id_area = ap.id_next_area_%s\
			WHERE\
				ap.id_area = ?\
		" % direction

		return Model.fetchOneRow(query, [idArea])
开发者ID:hekevintran,项目名称:Rpg,代码行数:34,代码来源:area.py

示例2: getSurroundingAreas

# 需要导入模块: from Model import Model [as 别名]
# 或者: from Model.Model import fetchOneRow [as 别名]
	def getSurroundingAreas(idArea):
		"""
		area.getSurroundingAreas(idArea) -> dict()

		Return the available neighbourg areas of the area given in argument.

		@param idArea integer id of the reference area

		@return dict a list of directions, with for each direction, True if
			there is an area in this direction, False else.
		"""
		query = "\
			SELECT\
				id_next_area_north IS NOT NULL AS north,\
				id_next_area_south IS NOT NULL AS south,\
				id_next_area_east IS NOT NULL AS east,\
				id_next_area_west IS NOT NULL AS west\
			FROM\
				area\
			WHERE\
				id_area = ?\
		"

		return Model.fetchOneRow(query, [idArea])
开发者ID:hekevintran,项目名称:Rpg,代码行数:26,代码来源:area.py


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