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

Included in:
Sequel::Postgres::Dataset::PreparedStatementMethods
Defined in:
lib/sequel/lib/sequel/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.


600
601
602
603
604
605
606
607
608
# File 'lib/sequel/lib/sequel/adapters/shared/postgres.rb', line 600

def prepared_sql
  return @prepared_sql if @prepared_sql
  super
  if @prepared_type == :insert and !@opts[:disable_insert_returning] 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