Module: Imparcial::Driver::AbstractExpression::Delete

Included in:
Imparcial::Driver::AbstractExpression
Defined in:
lib/imparcial/driver/abstract/expression/delete.rb

Instance Method Summary collapse

Instance Method Details

#delete(options = {}) ⇒ Object

Description

Delete some records. Besides, this function demands deleting with some conditions.

Usage

abstract_adapter.delete :table_name => ‘person’, :conditions =>

‘id = ?’,1

Options

  • :table_name

  • :conditions

Returning

nothing



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/imparcial/driver/abstract/expression/delete.rb', line 31

def delete ( options = {} )
          
  check_options expected_options_for_deleting, options        
          
  sql = sql_for_deleting( options )
  
  logger.warn sql if @delete_logging
  
  query sql
  
rescue adapter_specific_exception => ex

  raise DeleteError.new(ex.message)                       
      
end

#delete_all(options = {}) ⇒ Object

Description

Delete some records. Besides, this function demands no conditions.

Usage

abstract_adapter.delete_all :table_name => ‘person’

Options

  • :table_name

Returning

nothing



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/imparcial/driver/abstract/expression/delete.rb', line 69

def delete_all ( options = {} )
      
  check_options expected_options_for_deleting_all, options
       
  sql = sql_for_deleting( options )
  
  logger.warn sql if @delete_logging
  
  query sql 
  
rescue adapter_specific_exception => ex

  raise DeleteError.new(ex.message)
 
end