Module: Sequel::Fdbsql::DatasetMethods
- Included in:
- Dataset, JDBC::Fdbsql::Dataset
- Defined in:
- lib/sequel/adapters/shared/fdbsql.rb
Overview
Instance methods for datasets that connect to the FoundationDB SQL Layer.
Defined Under Namespace
Modules: PreparedStatementMethods
Instance Method Summary collapse
-
#complex_expression_sql_append(sql, op, args) ⇒ Object
Emulate the bitwise operators.
-
#insert(*values) ⇒ Object
Insert given values into the database.
-
#insert_select(*values) ⇒ Object
Insert a record returning the record inserted.
-
#insert_select_sql(*values) ⇒ Object
The SQL to use for an insert_select, adds a RETURNING clause to the insert unless the RETURNING clause is already present.
-
#supports_quoted_function_names? ⇒ Boolean
FDBSQL supports quoted function names.
-
#supports_regexp? ⇒ Boolean
FDBSQL has functions to support regular expression pattern matching.
-
#supports_returning?(type) ⇒ Boolean
Returning is always supported.
-
#supports_timestamp_usecs? ⇒ Boolean
FDBSQL truncates all seconds.
Instance Method Details
#complex_expression_sql_append(sql, op, args) ⇒ Object
Emulate the bitwise operators.
426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 |
# File 'lib/sequel/adapters/shared/fdbsql.rb', line 426 def complex_expression_sql_append(sql, op, args) case op when :&, :|, :^, :<<, :>>, :'B~' complex_expression_emulate_append(sql, op, args) # REGEXP_OPERATORS = [:~, :'!~', :'~*', :'!~*'] when :'~' function_sql_append(sql, SQL::Function.new(:REGEX, args.at(0), args.at(1))) when :'!~' sql << Sequel::Dataset::NOT_SPACE function_sql_append(sql, SQL::Function.new(:REGEX, args.at(0), args.at(1))) when :'~*' function_sql_append(sql, SQL::Function.new(:IREGEX, args.at(0), args.at(1))) when :'!~*' sql << Sequel::Dataset::NOT_SPACE function_sql_append(sql, SQL::Function.new(:IREGEX, args.at(0), args.at(1))) else super end end |
#insert(*values) ⇒ Object
Insert given values into the database.
447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 |
# File 'lib/sequel/adapters/shared/fdbsql.rb', line 447 def insert(*values) if @opts[:returning] # Already know which columns to return, let the standard code handle it super elsif @opts[:sql] || @opts[:disable_insert_returning] # Raw SQL used or RETURNING disabled, just use the default behavior # and return nil since sequence is not known. super nil else # Force the use of RETURNING with the primary key value, # unless it has been disabled. returning(*insert_pk).insert(*values){|r| return r.values.first} end end |
#insert_select(*values) ⇒ Object
Insert a record returning the record inserted. Always returns nil without inserting a query if disable_insert_returning is used.
465 466 467 468 469 470 |
# File 'lib/sequel/adapters/shared/fdbsql.rb', line 465 def insert_select(*values) unless @opts[:disable_insert_returning] ds = opts[:returning] ? self : returning ds.insert(*values){|r| return r} end end |
#insert_select_sql(*values) ⇒ Object
The SQL to use for an insert_select, adds a RETURNING clause to the insert unless the RETURNING clause is already present.
474 475 476 477 |
# File 'lib/sequel/adapters/shared/fdbsql.rb', line 474 def insert_select_sql(*values) ds = opts[:returning] ? self : returning ds.insert_sql(*values) end |
#supports_quoted_function_names? ⇒ Boolean
FDBSQL supports quoted function names
495 496 497 |
# File 'lib/sequel/adapters/shared/fdbsql.rb', line 495 def supports_quoted_function_names? true end |
#supports_regexp? ⇒ Boolean
FDBSQL has functions to support regular expression pattern matching.
480 481 482 |
# File 'lib/sequel/adapters/shared/fdbsql.rb', line 480 def supports_regexp? true end |
#supports_returning?(type) ⇒ Boolean
Returning is always supported.
485 486 487 |
# File 'lib/sequel/adapters/shared/fdbsql.rb', line 485 def supports_returning?(type) true end |
#supports_timestamp_usecs? ⇒ Boolean
FDBSQL truncates all seconds
490 491 492 |
# File 'lib/sequel/adapters/shared/fdbsql.rb', line 490 def false end |