This commit is contained in:
yumoqing 2025-10-19 17:25:14 +08:00
parent 9166698797
commit 42d799bb49

View File

@ -239,11 +239,11 @@ class SQLor(object):
async def cur_execute(self, cur, sql, ns): async def cur_execute(self, cur, sql, ns):
if inspect.iscoroutinefunction(cur.execute): if inspect.iscoroutinefunction(cur.execute):
ret = await cur.execute(sql, ns) ret = await cur.execute(sql, ns)
debug(f'-------coroutine--{ret}-{cur}----') # debug(f'-------coroutine--{ret}-{cur}----')
return ret return ret
f = awaitify(cur.execute) f = awaitify(cur.execute)
ret = await f(sql, ns) ret = await f(sql, ns)
debug(f'------function--{ret}------') # debug(f'------function--{ret}------')
return ret return ret
async def runVarSQL(self, cursor, sql, NS): async def runVarSQL(self, cursor, sql, NS):
@ -309,10 +309,10 @@ class SQLor(object):
async def fetchone(self, cur): async def fetchone(self, cur):
if inspect.iscoroutinefunction(cur.fetchone): if inspect.iscoroutinefunction(cur.fetchone):
ret = await cur.fetchone() ret = await cur.fetchone()
debug(f'coro:sor.fetchone()={ret}, {type(ret)}') # debug(f'coro:sor.fetchone()={ret}, {type(ret)}')
return ret return ret
ret = await cur.fetchone() ret = await cur.fetchone()
debug(f'func:sor.fetchone()={ret}, {type(ret)}') # debug(f'func:sor.fetchone()={ret}, {type(ret)}')
if isinstance(ret, asyncio.Future): if isinstance(ret, asyncio.Future):
ret = ret.result() ret = ret.result()
return ret return ret
@ -334,7 +334,8 @@ class SQLor(object):
fields = [i[0].lower() for i in cur.description] fields = [i[0].lower() for i in cur.description]
while True: while True:
rec = await self.fetchone(cur) rec = await self.fetchone(cur)
debug(f'{rec=}, {type(rec)}') if rec is None:
break
if rec is None: if rec is None:
break break
if isinstance(rec, dict): if isinstance(rec, dict):