Module: Sequel::Postgres::DatasetMethods::PreparedStatementMethods

Included in:
Sequel::Postgres::Dataset::PreparedStatementMethods
Defined in:
lib/sequel_core/adapters/shared/postgres.rb

Overview

Shared methods for prepared statements when used with PostgreSQL databases.

Instance Method Summary collapse

Instance Method Details

#prepared_sqlObject

Override insert action to use RETURNING if the server supports it.



563
564
565
566
567
568
569
570
571
# File 'lib/sequel_core/adapters/shared/postgres.rb', line 563

def prepared_sql
  return @prepared_sql if @prepared_sql
  super
  if @prepared_type == :insert and server_version >= 80200
    @prepared_sql = insert_returning_pk_sql(@prepared_modify_values)
    meta_def(:insert_returning_pk_sql){|*args| prepared_sql}
  end
  @prepared_sql
end