Module: Sequel::Plugins::PreparedStatementsAssociations

Defined in:
lib/sequel/plugins/prepared_statements_associations.rb

Overview

The prepared_statements_associations plugin modifies the regular association load method to use a cached prepared statement to load the associations. It will not work on all associations, but it should skip the use of prepared statements for associations where it will not work, assuming you load the plugin before defining the associations.

Usage:

# Make all model subclasses more safe when using prepared statements (called before loading subclasses)
Sequel::Model.plugin :prepared_statements_associations

# Make the Album class more safe when using prepared statements
Album.plugin :prepared_statements_associations

Defined Under Namespace

Modules: InstanceMethods

Constant Summary collapse

MUTEX =

Synchronize access to the integer sequence so that no two calls get the same integer.

Mutex.new
NEXT =

This plugin names prepared statements uniquely using an integer sequence, this lambda returns the next integer to use.

lambda{MUTEX.synchronize{i += 1}}