Module: EnhancedSQLite3::SupportsInsertReturning::Adapter

Defined in:
lib/enhanced_sqlite3/supports_insert_returning.rb

Instance Method Summary collapse

Instance Method Details

#build_insert_sql(insert) ⇒ Object

:nodoc:



24
25
26
27
28
# File 'lib/enhanced_sqlite3/supports_insert_returning.rb', line 24

def build_insert_sql(insert) # :nodoc:
  sql = super(insert)
  sql << " RETURNING #{insert.returning}" if insert.returning
  sql
end

#return_value_after_insert?(column) ⇒ Boolean

:nodoc:

Returns:

  • (Boolean)


16
17
18
# File 'lib/enhanced_sqlite3/supports_insert_returning.rb', line 16

def return_value_after_insert?(column) # :nodoc:
  column.auto_populated?
end

#supports_insert_returning?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/enhanced_sqlite3/supports_insert_returning.rb', line 12

def supports_insert_returning?
  database_version >= "3.35.0"
end

#use_insert_returning?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/enhanced_sqlite3/supports_insert_returning.rb', line 20

def use_insert_returning?
  @use_insert_returning ||= @config.key?(:insert_returning) ? self.class.type_cast_config_to_boolean(@config[:insert_returning]) : true
end