[Add]MainEngine增加dbDelete功能
This commit is contained in:
parent
19f559f36a
commit
b92eea8978
@ -137,3 +137,4 @@ DATABASE_CONNECTING_FAILED = u'MongoDB连接失败'
|
||||
DATA_INSERT_FAILED = u'数据插入失败,MongoDB没有连接'
|
||||
DATA_QUERY_FAILED = u'数据查询失败,MongoDB没有连接'
|
||||
DATA_UPDATE_FAILED = u'数据更新失败,MongoDB没有连接'
|
||||
DATA_DELETE_FAILED = u'数据删除失败,MongoDB没有连接'
|
@ -137,4 +137,5 @@ DATABASE_CONNECTING_COMPLETED = u'MongoDB is connected.'
|
||||
DATABASE_CONNECTING_FAILED = u'Failed to connect to MongoDB.'
|
||||
DATA_INSERT_FAILED = u'Data insert failed,please connect MongoDB first.'
|
||||
DATA_QUERY_FAILED = u'Data query failed, please connect MongoDB first.'
|
||||
DATA_UPDATE_FAILED = u'Data update failed, please connect MongoDB first.'
|
||||
DATA_UPDATE_FAILED = u'Data update failed, please connect MongoDB first.'
|
||||
DATA_DELETE_FAILED = u'Data delete failed, please connect MongoDB first.'
|
@ -251,7 +251,17 @@ class MainEngine(object):
|
||||
collection = db[collectionName]
|
||||
collection.replace_one(flt, d, upsert)
|
||||
else:
|
||||
self.writeLog(text.DATA_UPDATE_FAILED)
|
||||
self.writeLog(text.DATA_UPDATE_FAILED)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def dbDelete(self, dbName, collectionName, flt):
|
||||
"""从数据库中删除数据,flt是过滤条件"""
|
||||
if self.dbClient:
|
||||
db = self.dbClient[dbName]
|
||||
collection = db[collectionName]
|
||||
collection.delete_one(flt)
|
||||
else:
|
||||
self.writeLog(text.DATA_DELETE_FAILED)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def dbLogging(self, event):
|
||||
@ -735,7 +745,7 @@ class LogEngine(object):
|
||||
function = self.levelFunctionDict[log.logLevel] # 获取日志级别对应的处理函数
|
||||
msg = '\t'.join([log.gatewayName, log.logContent])
|
||||
function(msg)
|
||||
|
||||
|
||||
|
||||
########################################################################
|
||||
class PositionDetail(object):
|
||||
|
Loading…
Reference in New Issue
Block a user