Included modules
Classes and Modules
Constants
BindArgumentMethods | = | prepared_statements_module(:bind, ArgumentMapper) | ||
PreparedStatementMethods | = | prepared_statements_module(:prepare, BindArgumentMethods) |
Public Instance methods
complex_expression_sql_append(sql, op, args)
Support regexp functions if using :setup_regexp_function Database
option.
[show source]
# File lib/sequel/adapters/sqlite.rb 385 def complex_expression_sql_append(sql, op, args) 386 case op 387 when :~, :'!~', :'~*', :'!~*' 388 return super unless supports_regexp? 389 390 case_insensitive = [:'~*', :'!~*'].include?(op) 391 sql << 'NOT ' if [:'!~', :'!~*'].include?(op) 392 sql << '(' 393 sql << 'LOWER(' if case_insensitive 394 literal_append(sql, args[0]) 395 sql << ')' if case_insensitive 396 sql << ' REGEXP ' 397 sql << 'LOWER(' if case_insensitive 398 literal_append(sql, args[1]) 399 sql << ')' if case_insensitive 400 sql << ')' 401 else 402 super 403 end 404 end
fetch_rows(sql)
[show source]
# File lib/sequel/adapters/sqlite.rb 406 def fetch_rows(sql) 407 execute(sql) do |result| 408 cps = db.conversion_procs 409 type_procs = result.types.map{|t| cps[base_type_name(t)]} 410 j = -1 411 cols = result.columns.map{|c| [output_identifier(c), type_procs[(j+=1)]]} 412 self.columns = cols.map(&:first) 413 max = cols.length 414 result.each do |values| 415 row = {} 416 i = -1 417 while (i += 1) < max 418 name, type_proc = cols[i] 419 v = values[i] 420 if type_proc && v 421 v = type_proc.call(v) 422 end 423 row[name] = v 424 end 425 yield row 426 end 427 end 428 end
supports_regexp?()
Support regexp if using :setup_regexp_function Database
option.
[show source]
# File lib/sequel/adapters/sqlite.rb 431 def supports_regexp? 432 db.allow_regexp? 433 end