dumper.add_lines(backup) dumper.append(line) elif INSERT_INTO_RE.match(line): re_dict = INSERT_INTO_RE.match(line).groupdict() start_line = re_dict['insert_into'] + '\n' data = re_dict['data'] if not data_handler: data_handler = _DataHandler(args.chunk_size, start_line, table_name, counter) data_handler.add_line(data) elif data_handler and line == '\n': pass elif data_handler: data_handler.flush_data(dumper) data_handler = None else: dumper.append(line) #foreach line if data_handler: data_handler.flush_data(dumper) data_handler = None dumper.flush() # def __do_split if __name__ == '__main__': importer.split_sql_file(importer.create_argsparser(), __do_split=__do_split)
dumper.append(line) elif INSERT_INTO_RE.match(line): re_dict = INSERT_INTO_RE.match(line).groupdict() start_line = re_dict['insert_into'] + '\n' data = re_dict['data'] if not data_handler: data_handler = _DataHandler(args.chunk_size, start_line, table_name, counter) data_handler.add_line(data) elif data_handler and line == '\n': pass elif data_handler: data_handler.flush_data(dumper) data_handler = None else: dumper.append(line) #foreach line if data_handler: data_handler.flush_data(dumper) data_handler = None dumper.flush() # def __do_split if __name__ == '__main__': importer.split_sql_file(importer.create_argsparser(), __do_split=__do_split)