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
Classes and Modules
Constants
MUTEX | = | Mutex.new |
Synchronize access to the integer sequence so that no two calls get the same integer. |
|
NEXT | = | lambda{MUTEX.synchronize{i += 1}} |
This plugin names prepared statements uniquely using an integer sequence, this lambda returns the next integer to use. |