# File lib/rubyrep/connection_extenders/mysql_extender.rb, line 10 def primary_key_names(table) row = self.select_one("select table_name from information_schema.tables\nwhere table_schema = database() and table_name = '\#{table}'\n") if row.nil? raise "table '#{table}' does not exist" end rows = self.select_all("select column_name from information_schema.key_column_usage\nwhere table_schema = database() and table_name = '\#{table}'\nand constraint_name = 'PRIMARY'\norder by ordinal_position\n") columns = rows.map {|_row| _row['column_name']} columns end