Ticket #1624: executemany_arguments.2.diff

File executemany_arguments.2.diff, 1.6 KB (added by Antti Kaihola, 19 years ago)

unifies executemany arguments and fixes a crash-causing bug in sqlite's executemany

  • django/db/backends/sqlite3/base.py

     
    7070        return Database.Cursor.execute(self, query, params)
    7171
    7272    def executemany(self, query, params=[]):
    73         query = self.convert_query(query, len(params[0]))
     73        query = self.convert_query(query, len(params))
    7474        return Database.Cursor.executemany(self, query, params)
    7575
    7676    def convert_query(self, query, num_params):
  • django/db/backends/util.py

     
    1717                'time': "%.3f" % (stop - start),
    1818            })
    1919
    20     def executemany(self, sql, param_list):
     20    def executemany(self, sql, param_list=[]):
    2121        start = time()
    2222        try:
    2323            return self.cursor.executemany(sql, param_list)
  • django/db/backends/mysql/base.py

     
    3333            self.cursor.execute("SHOW WARNINGS")
    3434            raise Database.Warning, "%s: %s" % (w, self.cursor.fetchall())
    3535
    36     def executemany(self, sql, param_list):
     36    def executemany(self, sql, param_list=[]):
    3737        try:
    3838            return self.cursor.executemany(sql, param_list)
    3939        except Database.Warning:
Back to Top