コード例 #1
0
 def data_as_cursor_list_multiple_rs(self):
     """
     :Description: This creates the cursorObject from the cursor and returns to the callee with list of cursor objects
                   This should be used for the multiple result set always
     :return: list of dictionary, which contains the CursorObject
     """
     cursor_list = []
     while 1:
         data = self.cursor.fetchall()
         if len(data) > 0:
             cursor_obj = CursorObject()
             cursor_obj.columns = [x[0] for x in self.cursor.description]
             cursor_obj.data = data
             cursor_list.append(cursor_obj)
             if self.cursor.nextset() is None:
                 break
             if self.cursor.description is None:
                 break
         else:
             break
     return cursor_list
コード例 #2
0
 def data_as_cursor_dict_multiple_rs(self):
     """
     :Description: This creates the cursorObject from the cursor and returns to the callee
                   This should be used for the multiple result set always
     :return: list of dictionary, which contains the CursorObject
     """
     count = 1
     dict_ = {}
     while 1:
         data = self.cursor.fetchall()
         if len(data) > 0:
             cursor_obj = CursorObject()
             cursor_obj.columns = [x[0] for x in self.cursor.description]
             cursor_obj.data = data
             dict_[str(count)] = cursor_obj
             count = count + 1
             if self.cursor.nextset() is None:
                 break
             if self.cursor.description is None:
                 break
         else:
             break
     self.data.append(dict_)
     return self.data