Sha256: b0d4843150c9c2ae882f5d3af1791f7f6c79317571f35d70c7a15fb040647494
Contents?: true
Size: 1013 Bytes
Versions: 2
Compression:
Stored size: 1013 Bytes
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 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
knjrbfw-0.0.23 | lib/knj/knjdb/drivers/mysql/knjdb_mysql_indexes.rb |
knjrbfw-0.0.22 | lib/knj/knjdb/drivers/mysql/knjdb_mysql_indexes.rb |