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

Included in:
Sequel::Postgres::Dataset::BindArgumentMethods
Defined in:
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



1129
1130
1131
1132
1133
1134
# File 'lib/sequel/adapters/shared/postgres.rb', line 1129

def prepared_sql
  return @prepared_sql if @prepared_sql
  @opts[:returning] = insert_pk if @prepared_type == :insert
  super
  @prepared_sql
end

#runObject

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



1121
1122
1123
1124
1125
1126
1127
# File 'lib/sequel/adapters/shared/postgres.rb', line 1121

def run
  if @prepared_type == :insert
    fetch_rows(prepared_sql){|r| return r.values.first}
  else
    super
  end
end