bugfix
This commit is contained in:
parent
f94373e715
commit
20791b0d71
16
sqlor/sor.py
16
sqlor/sor.py
@ -230,15 +230,14 @@ class SQLor(object):
|
|||||||
datas = self.dataConvert(datas)
|
datas = self.dataConvert(datas)
|
||||||
try:
|
try:
|
||||||
if self.async_mode:
|
if self.async_mode:
|
||||||
await cursor.execute(markedSQL,datas)
|
return await cursor.execute(markedSQL,datas)
|
||||||
else:
|
else:
|
||||||
cursor.execute(markedSQL,datas)
|
return cursor.execute(markedSQL,datas)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print( "markedSQL=",markedSQL,':',datas,':',e)
|
print( "markedSQL=",markedSQL,':',datas,':',e)
|
||||||
print_exc()
|
print_exc()
|
||||||
raise e
|
raise e
|
||||||
return
|
|
||||||
|
|
||||||
def maskingSQL(self,org_sql,NS):
|
def maskingSQL(self,org_sql,NS):
|
||||||
"""
|
"""
|
||||||
@ -286,7 +285,7 @@ class SQLor(object):
|
|||||||
async def execute(self,sql,value,callback,**kwargs):
|
async def execute(self,sql,value,callback,**kwargs):
|
||||||
sqltype = self.getSqlType(sql)
|
sqltype = self.getSqlType(sql)
|
||||||
cur = self.cursor()
|
cur = self.cursor()
|
||||||
await self.runVarSQL(cur,sql,value)
|
ret = await self.runVarSQL(cur,sql,value)
|
||||||
if sqltype == 'qry' and callback is not None:
|
if sqltype == 'qry' and callback is not None:
|
||||||
fields = [ i[0].lower() for i in cur.description ]
|
fields = [ i[0].lower() for i in cur.description ]
|
||||||
rec = None
|
rec = None
|
||||||
@ -306,6 +305,7 @@ class SQLor(object):
|
|||||||
rec = cur.fetchone()
|
rec = cur.fetchone()
|
||||||
if sqltype == 'dml':
|
if sqltype == 'dml':
|
||||||
self.dataChanged = True
|
self.dataChanged = True
|
||||||
|
return ret
|
||||||
|
|
||||||
async def executemany(self,sql,values):
|
async def executemany(self,sql,values):
|
||||||
cur = self.cursor()
|
cur = self.cursor()
|
||||||
@ -466,12 +466,16 @@ class SQLor(object):
|
|||||||
await self.execute(sql,NS,callback)
|
await self.execute(sql,NS,callback)
|
||||||
|
|
||||||
async def sqlExecute(self,desc,NS):
|
async def sqlExecute(self,desc,NS):
|
||||||
await self.execute(desc,NS,None)
|
return await self.execute(desc,NS,None)
|
||||||
|
|
||||||
async def sqlExe(self,sql,ns):
|
async def sqlExe(self,sql,ns):
|
||||||
ret = []
|
ret = []
|
||||||
await self.execute(sql,ns,
|
r = await self.execute(sql,ns,
|
||||||
callback=lambda x:ret.append(x))
|
callback=lambda x:ret.append(x))
|
||||||
|
sqltype = self.getSqlType(sql)
|
||||||
|
if sqltype == 'dml':
|
||||||
|
return r
|
||||||
|
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
async def sqlPaging(self,sql,ns):
|
async def sqlPaging(self,sql,ns):
|
||||||
|
Loading…
Reference in New Issue
Block a user