當前位置: 首頁>>代碼示例>>Python>>正文


Python DB.delete方法代碼示例

本文整理匯總了Python中db.DB.delete方法的典型用法代碼示例。如果您正苦於以下問題:Python DB.delete方法的具體用法?Python DB.delete怎麽用?Python DB.delete使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在db.DB的用法示例。


在下文中一共展示了DB.delete方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: push_thread_function

# 需要導入模塊: from db import DB [as 別名]
# 或者: from db.DB import delete [as 別名]
def push_thread_function():
	from push import Push
	global _cache
	push_handle = Push()
	database = DB()
	PayLoad = {
		'aps':{
			'alert':'%s當前價格為:%s, 已經%s您設定的%s.',
			'sound':'default',
		}
	}
	data = json.dumps(PayLoad)
	while 1:
		time.sleep(10)
		platforms = ['okcoin','chbtc','btctrade','fxbtc','mtgox','btc100','btcchina']
		for platform in platforms:
			need_push_big = database.find(platform, _cache[platform], 'b')
			for one_push in need_push_big:
				msg = ((data) % (platform, ("%0.2f" % _cache[platform]), "大於", str(one_push[3])))
				push_handle.send_message(one_push[0], msg)
				database.delete(one_push[0], platform, 'high')
		for platform in platforms:
			need_push_big = database.find(platform, _cache[platform], 's')
			for one_push in need_push_big:
				msg = ((data) % (platform, ("%0.2f" % _cache[platform]), "小於", str(one_push[2])))
				push_handle.send_message(one_push[0], msg)
				database.delete(one_push[0], platform, 'low')
開發者ID:inonomori,項目名稱:CoinUp,代碼行數:29,代碼來源:server.py

示例2: History

# 需要導入模塊: from db import DB [as 別名]
# 或者: from db.DB import delete [as 別名]
class History():

    def __init__(self):
        self.db = DB()
        self.solves = self.db.load()

    def save(self, timer, scramble, mode):
        solve = Solve(timer.begin, timer.gettime(), scramble, mode)
        self.solves[mode].append(solve)
        self.db.insert(solve)
        self._last = solve

    def deletelast(self):
        self.solves[self._last.mode].pop()
        self.db.delete(self._last.rowid)
        print("Last solve deleted!\n0.00", end="\r")

    def set_dnf(self):
        self._last.dnf = True
        self.db.setflag("dnf", self._last.rowid)

    def set_plustwo(self):
        self._last.plustwo = True
        self.db.setflag("plustwo", self._last.rowid)

    def getlast(self, mode, n):
        return self.solves[mode][-n:]

    def close(self):
        self.db.close()
開發者ID:drumsen,項目名稱:pycube,代碼行數:32,代碼來源:history.py

示例3: delete

# 需要導入模塊: from db import DB [as 別名]
# 或者: from db.DB import delete [as 別名]
def delete():
    id = request.form['id']
    output = {'response':'','result':'','ID':id}
    # return json.dumps(output)
    db = DB()
    db.delete(id)
    output['response'] = 'ok'
    return json.dumps(output)  
開發者ID:paulo-sergio-softlog,項目名稱:PyFladesk-rss-reader,代碼行數:10,代碼來源:routes.py

示例4: DeleteEvent

# 需要導入模塊: from db import DB [as 別名]
# 或者: from db.DB import delete [as 別名]
class DeleteEvent(tornado.web.RequestHandler):
	def initialize(self):
		self.webdatabase = DB()

	def get(self):
		token = self.get_argument('token', None)
		platform = self.get_argument('platform', None)
		ttype = self.get_argument('type', None)
		if token and platform and ttype:
			try:
				self.webdatabase.delete(token, platform, ttype)
				self.write('success')
			except Exception as e:
				self.write(str(e))
開發者ID:inonomori,項目名稱:CoinUp,代碼行數:16,代碼來源:server.py

示例5: DB

# 需要導入模塊: from db import DB [as 別名]
# 或者: from db.DB import delete [as 別名]
from db import DB

database = DB()
try:
	if None == database.insert('hello', 'world', 12, 23, 's'):
		print("OK")
	if None == database.insert('fuck',  'uuuuu', 2, 333, 'b'):
		print("OK")
	result =  database.delete('fuck',  'uuuuu', 'b')
	print(result)
	result = database.delete('j', 'b', 'c')
	print(result)
	database.close()
except Exception as e:
	print(str(e))
開發者ID:inonomori,項目名稱:CoinUp,代碼行數:17,代碼來源:testdb.py


注:本文中的db.DB.delete方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。