This commit is contained in:
yumoqing 2023-05-11 20:27:38 +08:00
parent 7903c00196
commit 4bd0130759

View File

@ -14,7 +14,7 @@ class CBObject:
async def handle(self,ws): async def handle(self,ws):
db = DBPools() db = DBPools()
async with db.sqlorContext(self.db) as sor: async with db.sqlorContext(self.db) as sor:
delete_sql = "delete from %s" % self.tbl delete_sql = "TRUNCATE TABLE %s" % self.tbl
await sor.sqlExe(delete_sql, {}) await sor.sqlExe(delete_sql, {})
info = await sor.I(self.tbl) info = await sor.I(self.tbl)
for rec in getRecord(ws): for rec in getRecord(ws):
@ -24,12 +24,6 @@ class CBObject:
rec = convrec(info, rec) rec = convrec(info, rec)
await sor.C(self.tbl, rec) await sor.C(self.tbl, rec)
typesconv = {
"int":int,
"float":float,
"str":str,
}
def getRecord(ws): def getRecord(ws):
names = [] names = []
types = [] types = []
@ -45,7 +39,6 @@ def getRecord(ws):
else: else:
dic = {} dic = {}
for j,c in enumerate(r): for j,c in enumerate(r):
# tf = typesconv.get(types[j],None)
v = c.value v = c.value
dic[names[j]] = v dic[names[j]] = v
yield dic yield dic