-
Notifications
You must be signed in to change notification settings - Fork 386
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1165 from JesseChavez/rails_71_fixes
More Postgres fixes to support AR 7.1
- Loading branch information
Showing
4 changed files
with
190 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# frozen_string_literal: true | ||
|
||
module ArJdbc | ||
module PostgreSQL | ||
module DatabaseStatements | ||
def explain(arel, binds = [], options = []) | ||
sql = build_explain_clause(options) + " " + to_sql(arel, binds) | ||
result = internal_exec_query(sql, "EXPLAIN", binds) | ||
ActiveRecord::ConnectionAdapters::PostgreSQL::ExplainPrettyPrinter.new.pp(result) | ||
end | ||
|
||
def build_explain_clause(options = []) | ||
return "EXPLAIN" if options.empty? | ||
|
||
"EXPLAIN (#{options.join(", ").upcase})" | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters