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


Python Db.delete方法代码示例

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


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

示例1: import_static_dependencies

# 需要导入模块: from db import Db [as 别名]
# 或者: from db.Db import delete [as 别名]
def import_static_dependencies(db_entities, classes, coarse_grained):
	db = Db()

	table_suffix = ""
	if coarse_grained:
		table_suffix = "_coarse_grained"

	if not args.dont_store:
		db.delete("""
			delete from dependencias{} 
			where entidade1 in (select id from entidades where repositorio=%s)""".format(table_suffix),
			(constants.repository_map[args.repository],))

	dep_map = {}

	for c in classes.values():
		if coarse_grained:
			if c['name'] in db_entities:
				caller_id = db_entities[c['name']]['id']
				for d in c['dependencies']:
					if d in db_entities and not args.dont_store:
						calle_id = db_entities[d]['id']
						db.insert('insert into dependencias_coarse_grained values (%s,%s)', (caller_id, calle_id))
				if args.verbose and not args.not_found:
					print(c['name'])
			else:
				anonymous_inner_class = re.search('\$\d+$', c['name'])
				if args.verbose and args.not_found and not anonymous_inner_class:
					print(c['name'])
		else:
			for e in c['entities']:
				if e['name'] in db_entities:
					caller_id = db_entities[e['name']]['id']
					for d in e['dependencies']:
						calle_id = find_id_in_class_or_superclasses(d, classes, db_entities, e)
						if calle_id:
							#print(db_entities[e['name']]['id'], db_entities[d]['id'])
							if not args.dont_store and '{}-{}'.format(caller_id, calle_id) not in dep_map:
								db.insert('insert into dependencias values (%s,%s)', (caller_id, calle_id))
								dep_map['{}-{}'.format(caller_id, calle_id)] = True
						#else:
						#	if args.verbose: print(d)
					if args.verbose and not args.not_found:
						print(e['name'])
				else:
					# ignore entities not supported by historage
					anonymous_inner_class = re.search('\$\d+\.', e['name'])
					compiler_generated_element = re.search('access\$\d+\(', e['name']) or re.search('\.this\$\d+', e['name'])
					default_constructor = is_default_constructor(e['name'])
					# prints feature names not found in db
					if args.verbose and args.not_found and not anonymous_inner_class and not compiler_generated_element and not default_constructor:
					 	print(e['name'])

	db.commit()
	db.close()
开发者ID:mcesar,项目名称:mpca,代码行数:57,代码来源:dependencias_estaticas.py

示例2: len

# 需要导入模块: from db import Db [as 别名]
# 或者: from db.Db import delete [as 别名]
		graphs = db.query("""select id 
			from grafos_de 
			where repositorio=%s 
				and source=%s 
				and max_entities=%s 
				and min_confidence=%s 
				and min_support=%s 
				and min_date=%s 
				and types=%s""",
				(repository_id,args.source,args.max_entities,args.min_confidence,args.min_support,args.min_date,args.types), cursor=False)
		if len(graphs) == 0:
			graph_id = db.insert("insert into grafos_de(repositorio,source,max_entities,min_confidence,min_support,min_date,types) values (%s,%s,%s,%s,%s,%s,%s)",
				(repository_id,args.source,args.max_entities,args.min_confidence,args.min_support,args.min_date,args.types))
		else:
			graph_id = graphs[0][0]
			db.delete("delete from dependencias_evolucionarias where grafo = %s", (graph_id,))

	cursor = db.query(sql[args.source].replace('?in?', s), (repository_id, args.min_date) + types)

	for (id, entity) in cursor:
		if previous_id != id:
			increment_support(graph, entities, args.max_entities)
			previous_id = id
			entities.clear()
		entities.append(entity)
	increment_support(graph, entities, args.max_entities)
	calculate_confidence(graph)

	for e1 in graph.keys():
		for e2 in graph[e1].keys():
			if e1 != e2 and graph[e1][e2][0] >= args.min_support and graph[e1][e2][1] >= args.min_confidence:
开发者ID:mcesar,项目名称:mpca,代码行数:33,代码来源:construtor_grafo.py


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