Class: RailsRedshiftReplicator::Adapters::Mysql2
- Defined in:
- lib/rails_redshift_replicator/adapters/mysql2.rb
Instance Method Summary collapse
-
#connection ⇒ Object
Returns mysql2 driver so that we may perform query with the stream option.
- #last_record_query_command(sql) ⇒ Object
-
#query_command(sql) ⇒ Object
Executes query in stream mode to optimize memory usage, using Mysql2 driver.
Methods inherited from Generic
Constructor Details
This class inherits a constructor from RailsRedshiftReplicator::Adapters::Generic
Instance Method Details
#connection ⇒ Object
Returns mysql2 driver so that we may perform query with the stream option
17 18 19 |
# File 'lib/rails_redshift_replicator/adapters/mysql2.rb', line 17 def connection @connection ||= @ar_client.instance_variable_get("@connection") end |
#last_record_query_command(sql) ⇒ Object
12 13 14 |
# File 'lib/rails_redshift_replicator/adapters/mysql2.rb', line 12 def last_record_query_command(sql) connection.query(sql, cast: false).first[0] rescue nil end |
#query_command(sql) ⇒ Object
Executes query in stream mode to optimize memory usage, using Mysql2 driver.
7 8 9 |
# File 'lib/rails_redshift_replicator/adapters/mysql2.rb', line 7 def query_command(sql) connection.query(sql, stream: true) end |