Example #1
0
 def execute(self,query, vars=None, arraysize=100, comment=''):
     self.checkThread(pmUtils.lineInfo())
     if comment == None or comment == '': comment = 'pmOracle.pmDb.execute:333' 
     query += " /* %s */ " % comment
     print 'Oracle execute: ', query
     self.cursor().arraysize = arraysize
     if vars==None:
        res = self.cursor().execute(query)
     else:
        print vars
        res = self.cursor().execute(query,vars)
     return res
Example #2
0
 def execute(self, query, vars=None, arraysize=100, comment=''):
     self.checkThread(pmUtils.lineInfo())
     if comment == None or comment == '':
         comment = 'pmOracle.pmDb.execute:333'
     query += " /* %s */ " % comment
     print 'Oracle execute: ', query
     self.cursor().arraysize = arraysize
     if vars == None:
         res = self.cursor().execute(query)
     else:
         print vars
         res = self.cursor().execute(query, vars)
     return res
Example #3
0
 def fetchall(self, query=None, vars=None, arraysize=1000, comment=''):
     self.checkThread(pmUtils.lineInfo())
     if query != None: self.execute(query, vars, arraysize, comment)
     desc = self.cursor().description
     rdlist = []
     for r in self.cursor():
         rdict = {}
         for i, col in enumerate(r):
             nm = desc[i][0]
             if isinstance(col, cx_Oracle.LOB):
                 rdict[nm] = col.read()
             else:
                 rdict[nm] = col
         rdlist.append(rdict)
     return rdlist
Example #4
0
 def fetchall(self,query=None, vars=None,arraysize=1000, comment=''):
     self.checkThread(pmUtils.lineInfo())
     if query !=None: self.execute(query,vars,arraysize,comment)
     desc = self.cursor().description
     rdlist = []
     for r in self.cursor():
         rdict = {}
         for  i,col in enumerate(r):
             nm = desc[i][0]
             if isinstance(col, cx_Oracle.LOB):
                 rdict[nm] = col.read()
             else:
                 rdict[nm] = col
         rdlist.append(rdict)
     return rdlist
Example #5
0
 def fetchallh(self,query=None, vars=None, arraysize=1000, comment='',one=False):
     if one: return self.fetchone(query,vars,arraysize, comment);
     self.checkThread(pmUtils.lineInfo())
     if query !=None: self.execute(query,vars,arraysize,comment)
     header = []
     desc = self.cursor().description
     rows = self.cursor().fetchall()
     for h in desc: header.append(h[0])
     fullRows = []
     for r in rows: 
         row = []
         for col in r:
             if isinstance(col, cx_Oracle.LOB):
                 row.append(col.read())
             else:
                 row.append(col)
         fullRows.append(row)
     return { 'header' : header,'rows' : fullRows }
Example #6
0
 def fetchallh(self,
               query=None,
               vars=None,
               arraysize=1000,
               comment='',
               one=False):
     if one: return self.fetchone(query, vars, arraysize, comment)
     self.checkThread(pmUtils.lineInfo())
     if query != None: self.execute(query, vars, arraysize, comment)
     header = []
     desc = self.cursor().description
     rows = self.cursor().fetchall()
     for h in desc:
         header.append(h[0])
     fullRows = []
     for r in rows:
         row = []
         for col in r:
             if isinstance(col, cx_Oracle.LOB):
                 row.append(col.read())
             else:
                 row.append(col)
         fullRows.append(row)
     return {'header': header, 'rows': fullRows}
Example #7
0
 def checkThread(self, msg=pmUtils.lineInfo()):
     if self._theadId != threading.currentThread():
         raise ValueError("wrong thread from: %s" % msg)
Example #8
0
 def checkThread(self, msg=pmUtils.lineInfo()):
    if self._theadId != threading.currentThread(): raise ValueError("wrong thread from: %s" % msg)