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.
9 10 11 12 |
# File 'lib/simple_mysql_partitioning/base_partitioning.rb', line 9 def initialize(klass) @klass = klass @table_name = klass.table_name end |
Instance Attribute Details
#klass ⇒ Object (readonly)
Returns the value of attribute klass.
7 8 9 |
# File 'lib/simple_mysql_partitioning/base_partitioning.rb', line 7 def klass @klass end |
#table_name ⇒ Object (readonly)
Returns the value of attribute table_name.
7 8 9 |
# File 'lib/simple_mysql_partitioning/base_partitioning.rb', line 7 def table_name @table_name end |
Instance Method Details
#drop(partition_name) ⇒ Object
20 21 22 |
# File 'lib/simple_mysql_partitioning/base_partitioning.rb', line 20 def drop(partition_name) klass.connection.execute(SQL.parge_sql(table_name, partition_name)) end |
#exists?(partition_name) ⇒ Boolean
14 15 16 17 18 |
# File 'lib/simple_mysql_partitioning/base_partitioning.rb', line 14 def exists?(partition_name) klass.connection.select_all( SQL.exists_sql(table_name, partition_name) ).any? end |