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
- #prepared_sql ⇒ Object
-
#run ⇒ Object
Override insert action to use RETURNING if the server supports it.
Instance Method Details
#prepared_sql ⇒ Object
1209 1210 1211 1212 1213 1214 |
# File 'lib/sequel/adapters/shared/postgres.rb', line 1209 def prepared_sql return @prepared_sql if @prepared_sql @opts[:returning] = insert_pk if @prepared_type == :insert super @prepared_sql end |
#run ⇒ Object
Override insert action to use RETURNING if the server supports it.
1201 1202 1203 1204 1205 1206 1207 |
# File 'lib/sequel/adapters/shared/postgres.rb', line 1201 def run if @prepared_type == :insert fetch_rows(prepared_sql){|r| return r.values.first} else super end end |