Sha256: 2da46fe20464f50c6918f709b2230283bf80c3d282285f1f2b78eeccc75db79f
Contents?: true
Size: 1.1 KB
Versions: 73
Compression:
Stored size: 1.1 KB
Contents
class KnjDB_mysql::Indexes def initialize(args) @args = args end end class KnjDB_mysql::Indexes::Index attr_reader :columns def initialize(args) @args = args @columns = [] end #Used to validate in Knj::Wrap_map. def __object_unique_id__ return @args[:data][:Key_name] end def name return @args[:data][:Key_name] end def table return @args[:db].tables[@args[:table_name]] end def drop sql = "DROP INDEX `#{self.name}` ON `#{self.table.name}`" begin @args[:db].query(sql) rescue => e #The index has already been dropped - ignore. if e.message.index("check that column/key exists") != nil #ignore. else raise e end end end def data return { "name" => name, "columns" => @columns } end #Returns true if the index is a unique-index. def unique? if @args[:data][:Index_type] == "UNIQUE" return true else return false end end #Inspect crashes if this is not present? - knj. def to_s return "#<#{self.class.name}>" end end
Version data entries
73 entries across 73 versions & 1 rubygems