<commit_before>class KnjDB_mysql::Tables
	attr_reader :db, :driver
	attr_accessor :list
	
	def initialize(args)
		@args = args
		@db = @args[:db]
		@driver = @args[:driver]
	end
	
	def [](table_name)
		list = self.list
		return list[table_name.to_s] if list[table_name.to_s]
		raise Knj::Errors::NotFound.new("Table was not found: #{table_name}.")
	end
	
	def list
		if !@list
			@list = {}
			q_tables = @db.query("SHOW TABLE STATUS")
			while d_tables = q_tables.fetch
				@list[d_tables[:Name]] = KnjDB_mysql::Tables::Table.new(
					:db => @db,
					:driver => @driver,
					:data => d_tables,
					:tables => self
				)
			end
		end
		
		return @list
	end
	
	def create(name, data)
		raise "No columns was given." if !data["columns"] or data["columns"].empty?
		
		sql = "CREATE TABLE `#{name}` ("
		
		first = true
		data["columns"].each do |col_data|
			sql += ", " if !first
			first = false if first
			sql += @db.cols.data_sql(col_data)
		end
		
		sql += ")"
		@db.query(sql)
		@list = nil
		<commit_msg>Fixes.<commit_after>class KnjDB_mysql::Tables
	attr_reader :db, :driver
	attr_accessor :list
	
	def initialize(args)
		@args = args
		@db = @args[:db]
		@driver = @args[:driver]
	end
	
	def [](table_name)
		list = self.list
		return list[table_name.to_s] if list[table_name.to_s]
		raise Knj::Errors::NotFound.new("Table was not found: #{table_name}.")
	end
	
	def list
		if !@list
			@list = {}
			q_tables = @db.query("SHOW TABLE STATUS")
			while d_tables = q_tables.fetch
				@list[d_tables[:Name]] = KnjDB_mysql::Tables::Table.new(
					:db => @db,
					:driver => @driver,
					:data => d_tables,
					:tables => self
				)
			end
		end
		
		return @list
	end
	
	def create(name, data)
		raise "No columns was given." if !data["columns"] or data["columns"].empty?
		
		sql = "CREATE TABLE `#{name}` ("
		
		first = true
		data["columns"].each do |col_data|
			sql += ", " if !first
			first = false if first
			col_data.delete("after") if col_data["after"]
			sql += @db.cols.data_sql(col_data)
		end
		
		sql += ")"
		@db.query(sql)
		@list = nil
		
{'fraction_non_alphanumeric': 0.1565217391304348, 'fraction_numerical': 0.0, 'mean_word_length': 3.13373253493014, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '661147', 'n_tokens_mistral': 915, 'n_tokens_neox': 767, 'n_words': 189}