Class/Module Index [+]

Quicksearch

Sequel::SQLite::DatasetMethods

Instance methods for datasets that connect to an SQLite database

Public Instance Methods

complex_expression_sql(op, args) click to toggle source

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

# File lib/sequel/adapters/shared/sqlite.rb, line 292
def complex_expression_sql(op, args)
  case op
  when :~, :'!~', :'~*', :'!~*'
    raise Error, "SQLite does not support pattern matching via regular expressions"
  when :LIKE, :'NOT LIKE', :ILIKE, :'NOT ILIKE'
    # SQLite is case insensitive for ASCII, and non case sensitive for other character sets
    "#{'NOT ' if [:'NOT LIKE', :'NOT ILIKE'].include?(op)}(#{literal(args.at(0))} LIKE #{literal(args.at(1))})"
  else
    super(op, args)
  end
end
constant_sql(constant) click to toggle source

MSSQL doesn't support the SQL standard CURRENT_DATE or CURRENT_TIME

# File lib/sequel/adapters/shared/sqlite.rb, line 305
def constant_sql(constant)
  CONSTANT_MAP[constant] || super
end
delete() click to toggle source

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.

# File lib/sequel/adapters/shared/sqlite.rb, line 312
def delete
  @opts[:where] ? super : filter(1=>1).delete
end
explain() click to toggle source

Return an array of strings specifying a query explanation for a SELECT of the current dataset.

# File lib/sequel/adapters/shared/sqlite.rb, line 318
def explain
  db.send(:metadata_dataset).clone(:sql=>"EXPLAIN #{select_sql}").
    map{|x| "#{x[:addr]}|#{x[:opcode]}|#{(1..5).map{|i| x[:"p#{i}"]}.join('|')}|#{x[:comment]}"}
end
having(*cond, &block) click to toggle source

HAVING requires GROUP BY on SQLite

# File lib/sequel/adapters/shared/sqlite.rb, line 324
def having(*cond, &block)
  raise(InvalidOperation, "Can only specify a HAVING clause on a grouped dataset") unless @opts[:group]
  super
end
quoted_identifier(c) click to toggle source

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

# File lib/sequel/adapters/shared/sqlite.rb, line 330
def quoted_identifier(c)
  "`#{c}`"
end
supports_intersect_except_all?() click to toggle source

SQLite does not support INTERSECT ALL or EXCEPT ALL

# File lib/sequel/adapters/shared/sqlite.rb, line 335
def supports_intersect_except_all?
  false
end
supports_is_true?() click to toggle source

SQLite does not support IS TRUE

# File lib/sequel/adapters/shared/sqlite.rb, line 340
def supports_is_true?
  false
end
supports_multiple_column_in?() click to toggle source

SQLite does not support multiple columns for the IN/NOT IN operators

# File lib/sequel/adapters/shared/sqlite.rb, line 345
def supports_multiple_column_in?
  false
end
supports_timestamp_timezones?() click to toggle source

SQLite supports timezones in literal timestamps, since it stores them as text.

# File lib/sequel/adapters/shared/sqlite.rb, line 351
def supports_timestamp_timezones?
  true
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.