instance method
prepare_statement
Ruby on Rails 7.0.10
Since v3.1.12 PrivateSignature
prepare_statement(sql, binds)
Prepare the statement if it hasn’t been prepared, return the statement key.
Parameters
-
sqlreq -
bindsreq
Source
# File activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb, line 831
def prepare_statement(sql, binds)
@lock.synchronize do
sql_key = sql_key(sql)
unless @statements.key? sql_key
nextkey = @statements.next_key
begin
@connection.prepare nextkey, sql
rescue => e
raise translate_exception_class(e, sql, binds)
end
# Clear the queue
@connection.get_last_result
@statements[sql_key] = nextkey
end
@statements[sql_key]
end
end
Defined in activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb line 831
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::ConnectionAdapters::PostgreSQLAdapter