sequel 4.13.0 → 4.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG +24 -0
- data/doc/active_record.rdoc +4 -4
- data/doc/advanced_associations.rdoc +2 -2
- data/doc/association_basics.rdoc +11 -11
- data/doc/cheat_sheet.rdoc +7 -7
- data/doc/core_extensions.rdoc +1 -1
- data/doc/dataset_filtering.rdoc +1 -1
- data/doc/extensions.rdoc +1 -1
- data/doc/migration.rdoc +3 -3
- data/doc/model_hooks.rdoc +1 -1
- data/doc/opening_databases.rdoc +4 -0
- data/doc/postgresql.rdoc +2 -2
- data/doc/prepared_statements.rdoc +1 -1
- data/doc/querying.rdoc +31 -31
- data/doc/release_notes/4.13.0.txt +1 -1
- data/doc/release_notes/4.14.0.txt +68 -0
- data/doc/schema_modification.rdoc +1 -1
- data/doc/sharding.rdoc +2 -2
- data/doc/sql.rdoc +1 -1
- data/doc/virtual_rows.rdoc +2 -2
- data/lib/sequel/adapters/jdbc/jtds.rb +4 -0
- data/lib/sequel/adapters/mysql.rb +18 -18
- data/lib/sequel/adapters/mysql2.rb +7 -7
- data/lib/sequel/adapters/shared/mysql.rb +15 -5
- data/lib/sequel/adapters/shared/postgres.rb +71 -58
- data/lib/sequel/adapters/shared/sqlite.rb +2 -2
- data/lib/sequel/ast_transformer.rb +1 -1
- data/lib/sequel/connection_pool/sharded_single.rb +8 -8
- data/lib/sequel/connection_pool/sharded_threaded.rb +8 -8
- data/lib/sequel/database/connecting.rb +1 -1
- data/lib/sequel/database/schema_generator.rb +12 -0
- data/lib/sequel/database/schema_methods.rb +8 -7
- data/lib/sequel/database/transactions.rb +1 -2
- data/lib/sequel/dataset/actions.rb +4 -4
- data/lib/sequel/dataset/graph.rb +4 -0
- data/lib/sequel/dataset/query.rb +18 -18
- data/lib/sequel/dataset/sql.rb +3 -3
- data/lib/sequel/extensions/_pretty_table.rb +1 -0
- data/lib/sequel/extensions/arbitrary_servers.rb +3 -2
- data/lib/sequel/extensions/columns_introspection.rb +1 -0
- data/lib/sequel/extensions/connection_validator.rb +1 -0
- data/lib/sequel/extensions/constraint_validations.rb +1 -0
- data/lib/sequel/extensions/current_datetime_timestamp.rb +1 -0
- data/lib/sequel/extensions/dataset_source_alias.rb +1 -0
- data/lib/sequel/extensions/date_arithmetic.rb +1 -0
- data/lib/sequel/extensions/empty_array_ignore_nulls.rb +1 -0
- data/lib/sequel/extensions/error_sql.rb +1 -0
- data/lib/sequel/extensions/eval_inspect.rb +1 -0
- data/lib/sequel/extensions/filter_having.rb +1 -0
- data/lib/sequel/extensions/from_block.rb +1 -0
- data/lib/sequel/extensions/graph_each.rb +1 -0
- data/lib/sequel/extensions/hash_aliases.rb +1 -0
- data/lib/sequel/extensions/looser_typecasting.rb +1 -0
- data/lib/sequel/extensions/meta_def.rb +1 -0
- data/lib/sequel/extensions/migration.rb +1 -0
- data/lib/sequel/extensions/mssql_emulate_lateral_with_apply.rb +1 -0
- data/lib/sequel/extensions/named_timezones.rb +1 -0
- data/lib/sequel/extensions/null_dataset.rb +1 -0
- data/lib/sequel/extensions/pagination.rb +1 -0
- data/lib/sequel/extensions/pg_array.rb +2 -2
- data/lib/sequel/extensions/pg_array_ops.rb +1 -0
- data/lib/sequel/extensions/pg_enum.rb +1 -0
- data/lib/sequel/extensions/pg_hstore_ops.rb +1 -0
- data/lib/sequel/extensions/pg_json_ops.rb +1 -0
- data/lib/sequel/extensions/pg_loose_count.rb +1 -0
- data/lib/sequel/extensions/pg_range_ops.rb +1 -0
- data/lib/sequel/extensions/pg_row_ops.rb +1 -0
- data/lib/sequel/extensions/pg_static_cache_updater.rb +1 -0
- data/lib/sequel/extensions/pretty_table.rb +1 -0
- data/lib/sequel/extensions/query.rb +1 -0
- data/lib/sequel/extensions/query_literals.rb +1 -0
- data/lib/sequel/extensions/schema_caching.rb +1 -0
- data/lib/sequel/extensions/schema_dumper.rb +1 -1
- data/lib/sequel/extensions/select_remove.rb +1 -0
- data/lib/sequel/extensions/sequel_3_dataset_methods.rb +1 -0
- data/lib/sequel/extensions/server_block.rb +1 -0
- data/lib/sequel/extensions/set_overrides.rb +1 -0
- data/lib/sequel/extensions/split_array_nil.rb +1 -0
- data/lib/sequel/extensions/thread_local_timezones.rb +1 -0
- data/lib/sequel/extensions/to_dot.rb +1 -0
- data/lib/sequel/model/associations.rb +5 -5
- data/lib/sequel/model/base.rb +3 -3
- data/lib/sequel/plugins/association_proxies.rb +1 -1
- data/lib/sequel/plugins/caching.rb +8 -3
- data/lib/sequel/plugins/class_table_inheritance.rb +20 -11
- data/lib/sequel/plugins/composition.rb +18 -18
- data/lib/sequel/plugins/json_serializer.rb +3 -3
- data/lib/sequel/plugins/lazy_attributes.rb +23 -9
- data/lib/sequel/plugins/many_through_many.rb +21 -21
- data/lib/sequel/plugins/nested_attributes.rb +7 -3
- data/lib/sequel/plugins/pg_row.rb +1 -1
- data/lib/sequel/plugins/rcte_tree.rb +13 -13
- data/lib/sequel/plugins/sharding.rb +6 -6
- data/lib/sequel/plugins/timestamps.rb +4 -4
- data/lib/sequel/plugins/touch.rb +7 -7
- data/lib/sequel/plugins/tree.rb +1 -1
- data/lib/sequel/plugins/validation_class_methods.rb +36 -36
- data/lib/sequel/plugins/validation_helpers.rb +3 -4
- data/lib/sequel/plugins/xml_serializer.rb +29 -29
- data/lib/sequel/sql.rb +22 -11
- data/lib/sequel/version.rb +1 -1
- data/spec/adapters/postgres_spec.rb +10 -0
- data/spec/core/database_spec.rb +3 -4
- data/spec/core/dataset_spec.rb +16 -1
- data/spec/core/expression_filters_spec.rb +12 -0
- data/spec/core/object_graph_spec.rb +5 -0
- data/spec/core/placeholder_literalizer_spec.rb +8 -0
- data/spec/extensions/caching_spec.rb +18 -0
- data/spec/extensions/class_table_inheritance_spec.rb +34 -0
- data/spec/extensions/many_through_many_spec.rb +4 -0
- data/spec/extensions/nested_attributes_spec.rb +59 -4
- data/spec/extensions/pg_array_associations_spec.rb +5 -0
- data/spec/extensions/single_table_inheritance_spec.rb +23 -1
- data/spec/integration/plugin_test.rb +17 -0
- data/spec/model/eager_loading_spec.rb +8 -0
- metadata +4 -2
|
@@ -187,7 +187,7 @@ module Sequel
|
|
|
187
187
|
# Array of symbols specifying the table names in the current database.
|
|
188
188
|
#
|
|
189
189
|
# Options:
|
|
190
|
-
#
|
|
190
|
+
# :server :: Set the server to use.
|
|
191
191
|
def tables(opts=OPTS)
|
|
192
192
|
tables_and_views(TABLES_FILTER, opts)
|
|
193
193
|
end
|
|
@@ -207,7 +207,7 @@ module Sequel
|
|
|
207
207
|
# Array of symbols specifying the view names in the current database.
|
|
208
208
|
#
|
|
209
209
|
# Options:
|
|
210
|
-
#
|
|
210
|
+
# :server :: Set the server to use.
|
|
211
211
|
def views(opts=OPTS)
|
|
212
212
|
tables_and_views(VIEWS_FILTER, opts)
|
|
213
213
|
end
|
|
@@ -69,7 +69,7 @@ module Sequel
|
|
|
69
69
|
when SQL::JoinClause
|
|
70
70
|
SQL::JoinClause.new(o.join_type, v(o.table_expr))
|
|
71
71
|
when SQL::DelayedEvaluation
|
|
72
|
-
SQL::DelayedEvaluation.new(lambda{v(o.
|
|
72
|
+
SQL::DelayedEvaluation.new(lambda{|ds| v(o.call(ds))})
|
|
73
73
|
when SQL::Wrapper
|
|
74
74
|
SQL::Wrapper.new(v(o.value))
|
|
75
75
|
else
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
class Sequel::ShardedSingleConnectionPool < Sequel::ConnectionPool
|
|
4
4
|
# The single threaded pool takes the following options:
|
|
5
5
|
#
|
|
6
|
-
#
|
|
7
|
-
#
|
|
8
|
-
#
|
|
9
|
-
#
|
|
10
|
-
#
|
|
11
|
-
#
|
|
6
|
+
# :servers :: A hash of servers to use. Keys should be symbols. If not
|
|
7
|
+
# present, will use a single :default server.
|
|
8
|
+
# :servers_hash :: The base hash to use for the servers. By default,
|
|
9
|
+
# Sequel uses Hash.new(:default). You can use a hash with a default proc
|
|
10
|
+
# that raises an error if you want to catch all cases where a nonexistent
|
|
11
|
+
# server is used.
|
|
12
12
|
def initialize(db, opts=OPTS)
|
|
13
13
|
super
|
|
14
14
|
@conns = {}
|
|
@@ -36,8 +36,8 @@ class Sequel::ShardedSingleConnectionPool < Sequel::ConnectionPool
|
|
|
36
36
|
|
|
37
37
|
# Disconnects from the database. Once a connection is requested using
|
|
38
38
|
# #hold, the connection is reestablished. Options:
|
|
39
|
-
#
|
|
40
|
-
#
|
|
39
|
+
# :server :: Should be a symbol specifing the server to disconnect from,
|
|
40
|
+
# or an array of symbols to specify multiple servers.
|
|
41
41
|
def disconnect(opts=OPTS)
|
|
42
42
|
(opts[:server] ? Array(opts[:server]) : servers).each{|s| disconnect_server(s)}
|
|
43
43
|
end
|
|
@@ -7,12 +7,12 @@ Sequel.require 'connection_pool/threaded'
|
|
|
7
7
|
# to be removed from the pool when they are returned to it.
|
|
8
8
|
class Sequel::ShardedThreadedConnectionPool < Sequel::ThreadedConnectionPool
|
|
9
9
|
# The following additional options are respected:
|
|
10
|
-
#
|
|
11
|
-
#
|
|
12
|
-
#
|
|
13
|
-
#
|
|
14
|
-
#
|
|
15
|
-
#
|
|
10
|
+
# :servers :: A hash of servers to use. Keys should be symbols. If not
|
|
11
|
+
# present, will use a single :default server.
|
|
12
|
+
# :servers_hash :: The base hash to use for the servers. By default,
|
|
13
|
+
# Sequel uses Hash.new(:default). You can use a hash with a default proc
|
|
14
|
+
# that raises an error if you want to catch all cases where a nonexistent
|
|
15
|
+
# server is used.
|
|
16
16
|
def initialize(db, opts = OPTS)
|
|
17
17
|
super
|
|
18
18
|
@available_connections = {}
|
|
@@ -84,8 +84,8 @@ class Sequel::ShardedThreadedConnectionPool < Sequel::ThreadedConnectionPool
|
|
|
84
84
|
#
|
|
85
85
|
# Once a connection is requested using #hold, the connection pool
|
|
86
86
|
# creates new connections to the database. Options:
|
|
87
|
-
#
|
|
88
|
-
#
|
|
87
|
+
# :server :: Should be a symbol specifing the server to disconnect from,
|
|
88
|
+
# or an array of symbols to specify multiple servers.
|
|
89
89
|
def disconnect(opts=OPTS)
|
|
90
90
|
sync do
|
|
91
91
|
(opts[:server] ? Array(opts[:server]) : @servers.keys).each do |s|
|
|
@@ -462,6 +462,9 @@ module Sequel
|
|
|
462
462
|
# Modify a column's default value in the DDL for the table.
|
|
463
463
|
#
|
|
464
464
|
# set_column_default(:artist_name, 'a') # ALTER COLUMN artist_name SET DEFAULT 'a'
|
|
465
|
+
#
|
|
466
|
+
# On MySQL, make sure to use a symbol for the name of the column, as otherwise you
|
|
467
|
+
# can lose the type and NULL/NOT NULL setting for the column.
|
|
465
468
|
def set_column_default(name, default)
|
|
466
469
|
@operations << {:op => :set_column_default, :name => name, :default => default}
|
|
467
470
|
end
|
|
@@ -473,6 +476,9 @@ module Sequel
|
|
|
473
476
|
# PostgreSQL specific options:
|
|
474
477
|
#
|
|
475
478
|
# :using :: Add a USING clause that specifies how to convert existing values to new values.
|
|
479
|
+
#
|
|
480
|
+
# On MySQL, make sure to use a symbol for the name of the column, as otherwise you
|
|
481
|
+
# can lose the default and NULL/NOT NULL setting for the column.
|
|
476
482
|
def set_column_type(name, type, opts=OPTS)
|
|
477
483
|
@operations << {:op => :set_column_type, :name => name, :type => type}.merge(opts)
|
|
478
484
|
end
|
|
@@ -480,6 +486,9 @@ module Sequel
|
|
|
480
486
|
# Set a given column as allowing NULL values.
|
|
481
487
|
#
|
|
482
488
|
# set_column_allow_null(:artist_name) # ALTER COLUMN artist_name DROP NOT NULL
|
|
489
|
+
#
|
|
490
|
+
# On MySQL, make sure to use a symbol for the name of the column, as otherwise you
|
|
491
|
+
# can lose the default and type for the column.
|
|
483
492
|
def set_column_allow_null(name, allow_null=true)
|
|
484
493
|
@operations << {:op => :set_column_null, :name => name, :null => allow_null}
|
|
485
494
|
end
|
|
@@ -487,6 +496,9 @@ module Sequel
|
|
|
487
496
|
# Set a given column as not allowing NULL values.
|
|
488
497
|
#
|
|
489
498
|
# set_column_not_null(:artist_name) # ALTER COLUMN artist_name SET NOT NULL
|
|
499
|
+
#
|
|
500
|
+
# On MySQL, make sure to use a symbol for the name of the column, as otherwise you
|
|
501
|
+
# can lose the default and type for the column.
|
|
490
502
|
def set_column_not_null(name)
|
|
491
503
|
set_column_allow_null(name, false)
|
|
492
504
|
end
|
|
@@ -792,13 +792,14 @@ module Sequel
|
|
|
792
792
|
# SQL DDL ON DELETE fragment to use, based on the given action.
|
|
793
793
|
# The following actions are recognized:
|
|
794
794
|
#
|
|
795
|
-
#
|
|
796
|
-
#
|
|
797
|
-
#
|
|
798
|
-
#
|
|
799
|
-
#
|
|
800
|
-
#
|
|
801
|
-
#
|
|
795
|
+
# :cascade :: Delete rows referencing this row.
|
|
796
|
+
# :no_action :: Raise an error if other rows reference this
|
|
797
|
+
# row, allow deferring of the integrity check.
|
|
798
|
+
# This is the default.
|
|
799
|
+
# :restrict :: Raise an error if other rows reference this row,
|
|
800
|
+
# but do not allow deferring the integrity check.
|
|
801
|
+
# :set_default :: Set columns referencing this row to their default value.
|
|
802
|
+
# :set_null :: Set columns referencing this row to NULL.
|
|
802
803
|
#
|
|
803
804
|
# Any other object given is just converted to a string, with "_" converted to " " and upcased.
|
|
804
805
|
def on_delete_clause(action)
|
|
@@ -128,8 +128,7 @@ module Sequel
|
|
|
128
128
|
rescue Exception => e
|
|
129
129
|
begin
|
|
130
130
|
rollback_transaction(conn, opts)
|
|
131
|
-
rescue Exception
|
|
132
|
-
raise_error(e3, :classes=>database_error_classes, :conn=>conn)
|
|
131
|
+
rescue Exception
|
|
133
132
|
end
|
|
134
133
|
transaction_error(e, :conn=>conn, :rollback=>rollback)
|
|
135
134
|
ensure
|
|
@@ -461,23 +461,23 @@ module Sequel
|
|
|
461
461
|
#
|
|
462
462
|
# Examples:
|
|
463
463
|
#
|
|
464
|
-
# DB[:table].order(:id).paged_each{|row|
|
|
464
|
+
# DB[:table].order(:id).paged_each{|row| }
|
|
465
465
|
# # SELECT * FROM table ORDER BY id LIMIT 1000
|
|
466
466
|
# # SELECT * FROM table ORDER BY id LIMIT 1000 OFFSET 1000
|
|
467
467
|
# # ...
|
|
468
468
|
#
|
|
469
|
-
# DB[:table].order(:id).paged_each(:rows_per_fetch=>100){|row|
|
|
469
|
+
# DB[:table].order(:id).paged_each(:rows_per_fetch=>100){|row| }
|
|
470
470
|
# # SELECT * FROM table ORDER BY id LIMIT 100
|
|
471
471
|
# # SELECT * FROM table ORDER BY id LIMIT 100 OFFSET 100
|
|
472
472
|
# # ...
|
|
473
473
|
#
|
|
474
|
-
# DB[:table].order(:id).paged_each(:strategy=>:filter){|row|
|
|
474
|
+
# DB[:table].order(:id).paged_each(:strategy=>:filter){|row| }
|
|
475
475
|
# # SELECT * FROM table ORDER BY id LIMIT 1000
|
|
476
476
|
# # SELECT * FROM table WHERE id > 1001 ORDER BY id LIMIT 1000
|
|
477
477
|
# # ...
|
|
478
478
|
#
|
|
479
479
|
# DB[:table].order(:table__id).paged_each(:strategy=>:filter,
|
|
480
|
-
# :filter_values=>proc{|row, exprs| [row[:id]]}){|row|
|
|
480
|
+
# :filter_values=>proc{|row, exprs| [row[:id]]}){|row| }
|
|
481
481
|
# # SELECT * FROM table ORDER BY id LIMIT 1000
|
|
482
482
|
# # SELECT * FROM table WHERE id > 1001 ORDER BY id LIMIT 1000
|
|
483
483
|
# # ...
|
data/lib/sequel/dataset/graph.rb
CHANGED
|
@@ -36,6 +36,7 @@ module Sequel
|
|
|
36
36
|
# the receiver is wrapped in a from_self before graphing, and this option
|
|
37
37
|
# determines the alias to use.
|
|
38
38
|
# :implicit_qualifier :: The qualifier of implicit conditions, see #join_table.
|
|
39
|
+
# :join_only :: Only join the tables, do not change the selected columns.
|
|
39
40
|
# :join_type :: The type of join to use (passed to +join_table+). Defaults to :left_outer.
|
|
40
41
|
# :qualify:: The type of qualification to do, see #join_table.
|
|
41
42
|
# :select :: An array of columns to select. When not used, selects
|
|
@@ -103,6 +104,9 @@ module Sequel
|
|
|
103
104
|
|
|
104
105
|
# Join the table early in order to avoid cloning the dataset twice
|
|
105
106
|
ds = ds.join_table(options[:join_type] || :left_outer, table, join_conditions, :table_alias=>table_alias_qualifier, :implicit_qualifier=>implicit_qualifier, :qualify=>options[:qualify], &block)
|
|
107
|
+
|
|
108
|
+
return ds if options[:join_only]
|
|
109
|
+
|
|
106
110
|
opts = ds.opts
|
|
107
111
|
|
|
108
112
|
# Whether to include the table in the result set
|
data/lib/sequel/dataset/query.rb
CHANGED
|
@@ -67,7 +67,7 @@ module Sequel
|
|
|
67
67
|
where(*cond, &block)
|
|
68
68
|
end
|
|
69
69
|
|
|
70
|
-
# Returns a new clone of the dataset with
|
|
70
|
+
# Returns a new clone of the dataset with the given options merged.
|
|
71
71
|
# If the options changed include options in COLUMN_CHANGE_OPTS, the cached
|
|
72
72
|
# columns are deleted. This method should generally not be called
|
|
73
73
|
# directly by user code.
|
|
@@ -862,18 +862,18 @@ module Sequel
|
|
|
862
862
|
#
|
|
863
863
|
# Accepts the following argument types:
|
|
864
864
|
#
|
|
865
|
-
#
|
|
866
|
-
#
|
|
867
|
-
#
|
|
868
|
-
#
|
|
869
|
-
#
|
|
870
|
-
#
|
|
871
|
-
#
|
|
872
|
-
#
|
|
873
|
-
#
|
|
874
|
-
#
|
|
875
|
-
#
|
|
876
|
-
#
|
|
865
|
+
# Hash :: list of equality/inclusion expressions
|
|
866
|
+
# Array :: depends:
|
|
867
|
+
# * If first member is a string, assumes the rest of the arguments
|
|
868
|
+
# are parameters and interpolates them into the string.
|
|
869
|
+
# * If all members are arrays of length two, treats the same way
|
|
870
|
+
# as a hash, except it allows for duplicate keys to be
|
|
871
|
+
# specified.
|
|
872
|
+
# * Otherwise, treats each argument as a separate condition.
|
|
873
|
+
# String :: taken literally
|
|
874
|
+
# Symbol :: taken as a boolean column argument (e.g. WHERE active)
|
|
875
|
+
# Sequel::SQL::BooleanExpression :: an existing condition expression,
|
|
876
|
+
# probably created using the Sequel expression filter DSL.
|
|
877
877
|
#
|
|
878
878
|
# where also accepts a block, which should return one of the above argument
|
|
879
879
|
# types, and is treated the same way. This block yields a virtual row object,
|
|
@@ -1046,11 +1046,13 @@ module Sequel
|
|
|
1046
1046
|
# SQL expression object based on the expr type. See +where+.
|
|
1047
1047
|
def filter_expr(expr = nil, &block)
|
|
1048
1048
|
expr = nil if expr == []
|
|
1049
|
+
|
|
1049
1050
|
if expr && block
|
|
1050
1051
|
return SQL::BooleanExpression.new(:AND, filter_expr(expr), filter_expr(block))
|
|
1051
1052
|
elsif block
|
|
1052
1053
|
expr = block
|
|
1053
1054
|
end
|
|
1055
|
+
|
|
1054
1056
|
case expr
|
|
1055
1057
|
when Hash
|
|
1056
1058
|
SQL::BooleanExpression.from_value_pairs(expr)
|
|
@@ -1064,10 +1066,8 @@ module Sequel
|
|
|
1064
1066
|
end
|
|
1065
1067
|
when Proc
|
|
1066
1068
|
filter_expr(Sequel.virtual_row(&expr))
|
|
1067
|
-
when SQL::NumericExpression, SQL::StringExpression
|
|
1068
|
-
raise(Error, "Invalid
|
|
1069
|
-
when Symbol, SQL::Expression
|
|
1070
|
-
expr
|
|
1069
|
+
when Numeric, SQL::NumericExpression, SQL::StringExpression
|
|
1070
|
+
raise(Error, "Invalid filter expression: #{expr.inspect}")
|
|
1071
1071
|
when TrueClass, FalseClass
|
|
1072
1072
|
if supports_where_true?
|
|
1073
1073
|
SQL::BooleanExpression.new(:NOOP, expr)
|
|
@@ -1081,7 +1081,7 @@ module Sequel
|
|
|
1081
1081
|
when PlaceholderLiteralizer::Argument
|
|
1082
1082
|
expr.transform{|v| filter_expr(v)}
|
|
1083
1083
|
else
|
|
1084
|
-
|
|
1084
|
+
expr
|
|
1085
1085
|
end
|
|
1086
1086
|
end
|
|
1087
1087
|
|
data/lib/sequel/dataset/sql.rb
CHANGED
|
@@ -517,11 +517,11 @@ module Sequel
|
|
|
517
517
|
|
|
518
518
|
# Append literalization of delayed evaluation to SQL string,
|
|
519
519
|
# causing the delayed evaluation proc to be evaluated.
|
|
520
|
-
def delayed_evaluation_sql_append(sql,
|
|
520
|
+
def delayed_evaluation_sql_append(sql, delay)
|
|
521
521
|
if recorder = @opts[:placeholder_literalizer]
|
|
522
|
-
recorder.use(sql,
|
|
522
|
+
recorder.use(sql, lambda{delay.call(self)}, nil)
|
|
523
523
|
else
|
|
524
|
-
literal_append(sql,
|
|
524
|
+
literal_append(sql, delay.call(self))
|
|
525
525
|
end
|
|
526
526
|
end
|
|
527
527
|
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
# DB.with_server(:host=>'...', :database=>'...') do
|
|
34
34
|
# DB.synchronize do
|
|
35
35
|
# # All of these use the host/database given to with_server
|
|
36
|
-
# DB[:table].insert(
|
|
37
|
-
# DB[:table].update(
|
|
36
|
+
# DB[:table].insert(:c=>1)
|
|
37
|
+
# DB[:table].update(:c=>2)
|
|
38
38
|
# DB.tables
|
|
39
39
|
# DB[:table].all
|
|
40
40
|
# end
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
# to switch to the sharded threaded connection pool before using this
|
|
54
54
|
# extension.
|
|
55
55
|
|
|
56
|
+
#
|
|
56
57
|
module Sequel
|
|
57
58
|
module ArbitraryServers
|
|
58
59
|
private
|
|
@@ -122,6 +122,7 @@
|
|
|
122
122
|
# readd all constraints you want to use inside the alter table block,
|
|
123
123
|
# making no other changes inside the alter_table block.
|
|
124
124
|
|
|
125
|
+
#
|
|
125
126
|
module Sequel
|
|
126
127
|
module ConstraintValidations
|
|
127
128
|
# The default table name used for the validation metadata.
|