Sha256: a18abca295ad1ba05fecf70785e81315a8a9dbd758276cc12c418b04d73617be
Contents?: true
Size: 911 Bytes
Versions: 21
Compression:
Stored size: 911 Bytes
Contents
# frozen-string-literal: true module Sequel class Dataset module Replace INSERT = Dataset::INSERT REPLACE = 'REPLACE'.freeze # Execute a REPLACE statement on the database (deletes any duplicate # rows before inserting). def replace(*values) execute_insert(replace_sql(*values)) end # SQL statement for REPLACE def replace_sql(*values) clone(:replace=>true).insert_sql(*values) end # Replace multiple rows in a single query. def multi_replace(*values) clone(:replace=>true).multi_insert(*values) end # Databases using this module support REPLACE. def supports_replace? true end private # If this is an replace instead of an insert, use replace instead def insert_insert_sql(sql) sql << (@opts[:replace] ? REPLACE : INSERT) end end end end
Version data entries
21 entries across 20 versions & 2 rubygems