Execute the request containing dbms_output
(self,request,addLineBreak=False)
| 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 | ''' |
no test coverage detected