Module: Sequel::Postgres::DatasetMethods::PreparedStatementMethods
- Defined in:
- lib/sequel/adapters/shared/postgres.rb
Overview
Shared methods for prepared statements when used with PostgreSQL databases.
Instance Method Summary collapse
- #prepared_sql ⇒ Object
-
#run ⇒ Object
Override insert action to use RETURNING if the server supports it.
Instance Method Details
#prepared_sql ⇒ Object
1234 1235 1236 1237 1238 1239 1240 1241 1242 |
# File 'lib/sequel/adapters/shared/postgres.rb', line 1234 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 ⇒ Object
Override insert action to use RETURNING if the server supports it.
1226 1227 1228 1229 1230 1231 1232 |
# File 'lib/sequel/adapters/shared/postgres.rb', line 1226 def run if @prepared_type == :insert && (opts[:returning_pk] || !opts[:returning]) fetch_rows(prepared_sql){|r| return r.values.first} else super end end |