Class Index [+]

Quicksearch

Sequel::Plugins::PreparedStatementsSafe::ClassMethods

Attributes

prepared_statements_column_defaults[R]

A hash with column symbol keys and default values. Instance’s values are merged into this hash before creating to reduce the number of free columns (columns that may or may not be present in the INSERT statement), as the number of prepared statements that can be created is 2^N (where N is the number of free columns).

Public Instance Methods

inherited(subclass) click to toggle source
    # File lib/sequel/plugins/prepared_statements_safe.rb, line 36
36:         def inherited(subclass)
37:           super
38:           subclass.instance_variable_set(:@prepared_statements_column_defaults, @prepared_statements_column_defaults) if @prepared_statements_column_defaults && !subclass.prepared_statements_column_defaults
39:         end
set_dataset(*) click to toggle source

Set the column defaults to use when creating on the subclass.

    # File lib/sequel/plugins/prepared_statements_safe.rb, line 42
42:         def set_dataset(*)
43:           x = super
44:           set_prepared_statements_column_defaults
45:           x
46:         end

Private Instance Methods

set_prepared_statements_column_defaults() click to toggle source

Set the column defaults based on the database schema. All columns are set to a default value unless they are a primary key column or they don’t have a parseable default.

    # File lib/sequel/plugins/prepared_statements_safe.rb, line 53
53:         def set_prepared_statements_column_defaults
54:           if db_schema
55:             h = {}
56:             db_schema.each do |k, v|
57:               h[k] = v[:ruby_default] if (v[:ruby_default] || !v[:default]) && !v[:primary_key]
58:             end
59:             @prepared_statements_column_defaults = h
60:           end
61:         end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.