Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Adapter#select_all to be performed asynchronously from a background thread pool #2146

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ module DatabaseStatements
# see: abstract/database_statements.rb

# Executes a SQL statement
def execute(sql, name = nil)
log(sql, name) { @connection.exec(sql) }
def execute(sql, name = nil, async: false)
log(sql, name, async: async) { @connection.exec(sql) }
end

def clear_cache! # :nodoc:
reload_type_map
super
end

def exec_query(sql, name = "SQL", binds = [], prepare: false)
def exec_query(sql, name = "SQL", binds = [], prepare: false, async: false)
type_casted_binds = type_casted_binds(binds)

log(sql, name, binds, type_casted_binds) do
log(sql, name, binds, type_casted_binds, async: async) do
cursor = nil
cached = false
with_retry do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def dbms_output_enabled?
end

private
def log(sql, name = "SQL", binds = [], type_casted_binds = [], statement_name = nil)
def log(sql, name = "SQL", binds = [], type_casted_binds = [], statement_name = nil, async: false)
super
ensure
log_dbms_output if dbms_output_enabled?
Expand Down