Module: Sequel::Dataset::Replace

Included in:
MySQL::DatasetMethods
Defined in:
lib/sequel/adapters/utils/replace.rb

Instance Method Summary collapse

Instance Method Details

#multi_replace(*values) ⇒ Object

Replace multiple rows in a single query.



18
19
20
# File 'lib/sequel/adapters/utils/replace.rb', line 18

def multi_replace(*values)
  clone(:replace=>true).multi_insert(*values)
end

#replace(*values) ⇒ Object

Execute a REPLACE statement on the database (deletes any duplicate rows before inserting).



8
9
10
# File 'lib/sequel/adapters/utils/replace.rb', line 8

def replace(*values)
  execute_insert(replace_sql(*values))
end

#replace_sql(*values) ⇒ Object

SQL statement for REPLACE



13
14
15
# File 'lib/sequel/adapters/utils/replace.rb', line 13

def replace_sql(*values)
  clone(:replace=>true).insert_sql(*values)
end

#supports_replace?Boolean

Databases using this module support REPLACE.

Returns:

  • (Boolean)


23
24
25
# File 'lib/sequel/adapters/utils/replace.rb', line 23

def supports_replace?
  true
end