Class: SimpleMySQLPartitioning::BasePartitioning
- Inherits:
-
Object
- Object
- SimpleMySQLPartitioning::BasePartitioning
- Defined in:
- lib/simple_mysql_partitioning/base_partitioning.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#klass ⇒ Object
readonly
Returns the value of attribute klass.
-
#table_name ⇒ Object
readonly
Returns the value of attribute table_name.
Instance Method Summary collapse
- #drop(partition_name) ⇒ Object
- #exists?(partition_name) ⇒ Boolean
-
#initialize(klass) ⇒ BasePartitioning
constructor
A new instance of BasePartitioning.
Constructor Details
#initialize(klass) ⇒ BasePartitioning
Returns a new instance of BasePartitioning.
8 9 10 11 |
# File 'lib/simple_mysql_partitioning/base_partitioning.rb', line 8 def initialize(klass) @klass = klass @table_name = klass.table_name end |
Instance Attribute Details
#klass ⇒ Object (readonly)
Returns the value of attribute klass.
6 7 8 |
# File 'lib/simple_mysql_partitioning/base_partitioning.rb', line 6 def klass @klass end |
#table_name ⇒ Object (readonly)
Returns the value of attribute table_name.
6 7 8 |
# File 'lib/simple_mysql_partitioning/base_partitioning.rb', line 6 def table_name @table_name end |
Instance Method Details
#drop(partition_name) ⇒ Object
19 20 21 |
# File 'lib/simple_mysql_partitioning/base_partitioning.rb', line 19 def drop(partition_name) klass.connection.execute(SQL.parge_sql(table_name, partition_name)) end |
#exists?(partition_name) ⇒ Boolean
13 14 15 16 17 |
# File 'lib/simple_mysql_partitioning/base_partitioning.rb', line 13 def exists?(partition_name) klass.connection.select_all( SQL.exists_sql(table_name, partition_name) ).to_hash.present? end |