From a0e434c556d6048288c0ed9036b7f4a2d80f355e Mon Sep 17 00:00:00 2001 From: MinalSoni Date: Mon, 11 Jun 2018 14:45:15 +0530 Subject: [PATCH 1/3] arel gem added in active_record in rails --- lib/active_record/connection_adapters/odbc_adapter.rb | 1 - lib/odbc_adapter/adapters/mysql_odbc_adapter.rb | 1 - lib/odbc_adapter/adapters/null_odbc_adapter.rb | 1 - 3 files changed, 3 deletions(-) diff --git a/lib/active_record/connection_adapters/odbc_adapter.rb b/lib/active_record/connection_adapters/odbc_adapter.rb index 672c5db1..8f4beec1 100644 --- a/lib/active_record/connection_adapters/odbc_adapter.rb +++ b/lib/active_record/connection_adapters/odbc_adapter.rb @@ -1,5 +1,4 @@ require 'active_record' -require 'arel/visitors/bind_visitor' require 'odbc' require 'odbc_adapter/database_limits' diff --git a/lib/odbc_adapter/adapters/mysql_odbc_adapter.rb b/lib/odbc_adapter/adapters/mysql_odbc_adapter.rb index eaa690ef..3a158504 100644 --- a/lib/odbc_adapter/adapters/mysql_odbc_adapter.rb +++ b/lib/odbc_adapter/adapters/mysql_odbc_adapter.rb @@ -6,7 +6,6 @@ class MySQLODBCAdapter < ActiveRecord::ConnectionAdapters::ODBCAdapter PRIMARY_KEY = 'INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY'.freeze class BindSubstitution < Arel::Visitors::MySQL - include Arel::Visitors::BindVisitor end def arel_visitor diff --git a/lib/odbc_adapter/adapters/null_odbc_adapter.rb b/lib/odbc_adapter/adapters/null_odbc_adapter.rb index 1a179905..e68e7faf 100644 --- a/lib/odbc_adapter/adapters/null_odbc_adapter.rb +++ b/lib/odbc_adapter/adapters/null_odbc_adapter.rb @@ -5,7 +5,6 @@ module Adapters # have an explicit adapter. class NullODBCAdapter < ActiveRecord::ConnectionAdapters::ODBCAdapter class BindSubstitution < Arel::Visitors::ToSql - include Arel::Visitors::BindVisitor end # Using a BindVisitor so that the SQL string gets substituted before it is From 1c6b895e49fa5926d092aabd84ba905117f380cc Mon Sep 17 00:00:00 2001 From: Pankaj Kumar Date: Mon, 18 Mar 2024 18:08:30 +0530 Subject: [PATCH 2/3] upgrading gem to be compatible with rails 7 fix connection variable issue --- lib/active_record/connection_adapters/odbc_adapter.rb | 1 + lib/odbc_adapter/database_statements.rb | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/lib/active_record/connection_adapters/odbc_adapter.rb b/lib/active_record/connection_adapters/odbc_adapter.rb index 8f4beec1..7d5d2372 100644 --- a/lib/active_record/connection_adapters/odbc_adapter.rb +++ b/lib/active_record/connection_adapters/odbc_adapter.rb @@ -80,6 +80,7 @@ def initialize(connection, logger, config, database_metadata) configure_time_options(connection) super(connection, logger, config) @database_metadata = database_metadata + @connection = connection end # Returns the human-readable name of the adapter. diff --git a/lib/odbc_adapter/database_statements.rb b/lib/odbc_adapter/database_statements.rb index cac31682..14327837 100644 --- a/lib/odbc_adapter/database_statements.rb +++ b/lib/odbc_adapter/database_statements.rb @@ -17,6 +17,10 @@ def execute(sql, name = nil, binds = []) end end + def internal_exec_query(sql, name = "SQL", binds = [], prepare: false, async: false) # :nodoc: + exec_query(sql, name, binds, prepare: prepare) + end + # Executes +sql+ statement in the context of this connection using # +binds+ as the bind substitutes. +name+ is logged along with # the executed +sql+ statement. From 6e9eb79cd58cb7fe0308eaeca700e512001bbf04 Mon Sep 17 00:00:00 2001 From: Shashank Yadav Date: Tue, 13 Aug 2024 12:19:27 +0530 Subject: [PATCH 3/3] fix raw connection issue --- lib/active_record/connection_adapters/odbc_adapter.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/active_record/connection_adapters/odbc_adapter.rb b/lib/active_record/connection_adapters/odbc_adapter.rb index 7d5d2372..4628804c 100644 --- a/lib/active_record/connection_adapters/odbc_adapter.rb +++ b/lib/active_record/connection_adapters/odbc_adapter.rb @@ -81,6 +81,7 @@ def initialize(connection, logger, config, database_metadata) super(connection, logger, config) @database_metadata = database_metadata @connection = connection + @raw_connection = connection end # Returns the human-readable name of the adapter.