MCPcopy Index your code
hub / github.com/quentinhardy/odat / __execPLSQLwithDbmsOutput__

Method __execPLSQLwithDbmsOutput__

OracleDatabase.py:295–324  ·  view source on GitHub ↗

Execute the request containing dbms_output

(self,request,addLineBreak=False)

Source from the content-addressed store, hash-verified

293 return True
294
295 def __execPLSQLwithDbmsOutput__(self,request,addLineBreak=False):
296 '''
297 Execute the request containing dbms_output
298 '''
299 responsedata = ""
300 cursor = cx_Oracle.Cursor(self.args['dbcon'])
301 try :
302 cursor.callproc("dbms_output.enable")
303 try:
304 cursor.execute(request)
305 except Exception as e:
306 logging.info("Impossible to execute the query `{0}`: {1}".format(request, self.cleanError(e)))
307 return ErrorSQLRequest(e)
308 else :
309 statusVar = cursor.var(cx_Oracle.NUMBER)
310 lineVar = cursor.var(cx_Oracle.STRING)
311 while True:
312 cursor.callproc("dbms_output.get_line", (lineVar, statusVar))
313 if statusVar.getvalue() != 0:
314 break
315 line = lineVar.getvalue()
316 if line == None :
317 line = ''
318 responsedata += line
319 if addLineBreak == True : responsedata +='\n'
320 cursor.close()
321 except Exception as e:
322 logging.info("Error with the request: {0}".format(str(e)))
323 return ErrorSQLRequest(e)
324 return responsedata
325
326 def __generateRandomString__(self, nb=20):
327 '''

Callers 2

sendPacketMethod · 0.80
sendRequestMethod · 0.80

Calls 4

cleanErrorMethod · 0.95
ErrorSQLRequestClass · 0.90
executeMethod · 0.80
closeMethod · 0.80

Tested by

no test coverage detected