Module: OQGraph::EdgeClassMethods
- Defined in:
- lib/oqgraph/edge_class_methods.rb
Instance Method Summary collapse
-
#create_graph_table ⇒ Object
Creates the OQGraph table for the edge model.
- #node_table ⇒ Object
- #update_graph_table ⇒ Object
Instance Method Details
#create_graph_table ⇒ Object
Creates the OQGraph table for the edge model. This table exists in memory only and needs to be updated on every database restart.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/oqgraph/edge_class_methods.rb', line 8 def create_graph_table connection.execute <<-EOS CREATE TABLE IF NOT EXISTS #{oqgraph_table_name} ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH; EOS # if the DB server has restarted then there will be no records in the oqgraph table. update_graph_table end |
#node_table ⇒ Object
30 31 32 |
# File 'lib/oqgraph/edge_class_methods.rb', line 30 def node_table node_class.table_name end |
#update_graph_table ⇒ Object
26 27 28 |
# File 'lib/oqgraph/edge_class_methods.rb', line 26 def update_graph_table update_oqgraph unless up_to_date? end |