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):
db = DBPools()
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, {})
info = await sor.I(self.tbl)
for rec in getRecord(ws):
@ -24,12 +24,6 @@ class CBObject:
rec = convrec(info, rec)
await sor.C(self.tbl, rec)
typesconv = {
"int":int,
"float":float,
"str":str,
}
def getRecord(ws):
names = []
types = []
@ -45,7 +39,6 @@ def getRecord(ws):
else:
dic = {}
for j,c in enumerate(r):
# tf = typesconv.get(types[j],None)
v = c.value
dic[names[j]] = v
yield dic