コード例 #1
0
 def executeSQLGroup(self, db, dbCommandList, isFetch):
     """ Executes a command consisting of multiple SELECT statements
         It returns a list of results from the SELECT statements
     """
     data = []
     # break up into bundles
     BUNDLE_SIZE = 10000
     num_commands = len(dbCommandList)
     n = 0
     while n<num_commands:
         dbCommands = dbCommandList[n:(n+BUNDLE_SIZE)]
         commandString = ''
         for prepared, values in dbCommands:
             command = prepared % \
                           db.escape(values, get_db_lib().converters.conversions)
             commandString += command
         cur = db.cursor()
         try:
             result = cur.execute(commandString)
             while True:
                 r = cur.fetchall() if isFetch else cur.lastrowid
                 data.append(r)
                 next = cur.nextset()
                 if not next:
                     break
         except Exception, e:
             raise VistrailsDBException('Command failed: %s -- """ %s """' % 
                                        (e, commandString))
         finally: