方法
实例公共方法
build_explain_clause(options = []) 链接
源代码: 显示 | 在 GitHub 上
# File activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb, line 96 def build_explain_clause(options = []) return "EXPLAIN" if options.empty? "EXPLAIN (#{options.join(", ").upcase})" end
explain(arel, binds = [], options = []) 链接
源代码: 显示 | 在 GitHub 上
# File activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb, line 7 def explain(arel, binds = [], options = []) sql = build_explain_clause(options) + " " + to_sql(arel, binds) result = internal_exec_query(sql, "EXPLAIN", binds) PostgreSQL::ExplainPrettyPrinter.new.pp(result) end
high_precision_current_timestamp() 链接
源代码: 显示 | 在 GitHub 上
# File activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb, line 92 def high_precision_current_timestamp HIGH_PRECISION_CURRENT_TIMESTAMP end
set_constraints(deferred, *constraints) 链接
设置当前事务中何时检查约束。
不传递任何特定约束名称将为所有可延迟约束设置值。
deferred
-
有效值为
:deferred
或:immediate
。
请参阅 www.postgresql.org/docs/current/sql-set-constraints.html
源代码: 显示 | 在 GitHub 上
# File activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb, line 110 def set_constraints(deferred, *constraints) unless %i[deferred immediate].include?(deferred) raise ArgumentError, "deferred must be :deferred or :immediate" end constraints = if constraints.empty? "ALL" else constraints.map { |c| quote_table_name(c) }.join(", ") end execute("SET CONSTRAINTS #{constraints} #{deferred.to_s.upcase}") end