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