Module | Sequel::SQLite::DatasetMethods
In: | lib/sequel/adapters/shared/sqlite.rb

Instance methods for datasets that connect to an SQLite database

### Methods

complex_expression_sql delete insert insert_sql quoted_identifier

### Included Modules

Dataset::UnsupportedIntersectExceptAll Dataset::UnsupportedIsTrue

### Public Instance methods

complex_expression_sql(op, args)

SQLite does not support pattern matching via regular expressions. SQLite is case insensitive (depending on pragma), so use LIKE for ILIKE.

[Source]

         # File lib/sequel/adapters/shared/sqlite.rb, line 240
    240:       def complex_expression_sql(op, args)
    241:         case op
    242:         when :~, '!~''!~', '~*''~*', '!~*''!~*'
    243:           raise Error, "SQLite does not support pattern matching via regular expressions"
    244:         when :LIKE, 'NOT LIKE''NOT LIKE', :ILIKE, 'NOT ILIKE''NOT ILIKE'
    245:           # SQLite is case insensitive for ASCII, and non case sensitive for other character sets
    246:           "#{'NOT ' if [:'NOT LIKE', :'NOT ILIKE'].include?(op)}(#{literal(args.at(0))} LIKE #{literal(args.at(1))})"
    247:         else
    248:           super(op, args)
    249:         end
    250:       end

delete()

SQLite performs a TRUNCATE style DELETE if no filter is specified. Since we want to always return the count of records, add a condition that is always true and then delete.

[Source]

         # File lib/sequel/adapters/shared/sqlite.rb, line 255
    255:       def delete
    256:         @opts[:where] ? super : filter(1=>1).delete
    257:       end

insert(*values)

Insert the values into the database.

[Source]

         # File lib/sequel/adapters/shared/sqlite.rb, line 260
    260:       def insert(*values)
    261:         execute_insert(insert_sql(*values))
    262:       end

insert_sql(*values)

Allow inserting of values directly from a dataset.

[Source]

         # File lib/sequel/adapters/shared/sqlite.rb, line 265
    265:       def insert_sql(*values)
    266:         if (values.size == 1) && values.first.is_a?(Sequel::Dataset)
    267:           "INSERT INTO #{source_list(@opts[:from])} #{values.first.sql};"
    268:         else
    269:           super(*values)
    270:         end
    271:       end

quoted_identifier(c)

SQLite uses the nonstandard ` (backtick) for quoting identifiers.

[Source]

         # File lib/sequel/adapters/shared/sqlite.rb, line 274
    274:       def quoted_identifier(c)
    275:         "`#{c}`"
    276:       end

[Validate]