instance method
prepare_statement
Ruby on Rails 4.1.16
Since v3.1.12 PrivateSignature
prepare_statement(sql)
Prepare the statement if it hasn’t been prepared, return the statement key.
Parameters
-
sqlreq
Source
# File activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb, line 864
def prepare_statement(sql)
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)
end
# Clear the queue
@connection.get_last_result
@statements[sql_key] = nextkey
end
@statements[sql_key]
end
Defined in activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb line 864
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::ConnectionAdapters::PostgreSQLAdapter