module Sequel::Postgres::DatasetMethods::PreparedStatementMethods

Shared methods for prepared statements when used with PostgreSQL databases.

Public Instance Methods

prepared_sql() click to toggle source
Calls superclass method
# File lib/sequel/adapters/shared/postgres.rb, line 1285
def prepared_sql
  return @prepared_sql if @prepared_sql
  if @prepared_type == :insert && !opts[:returning]
    @opts[:returning] = insert_pk
    @opts[:returning_pk] = true
  end
  super
  @prepared_sql
end
run() click to toggle source

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

Calls superclass method
# File lib/sequel/adapters/shared/postgres.rb, line 1277
def run
  if @prepared_type == :insert && (opts[:returning_pk] || !opts[:returning])
    fetch_rows(prepared_sql){|r| return r.values.first}
  else
    super
  end
end