module Sequel::Plugins::PreparedStatementsWithPk

  1. lib/sequel/plugins/prepared_statements_with_pk.rb

The prepared_statements_with_pk plugin allows Dataset#with_pk for model datasets to use prepared statements by extract the values of previously bound variables using Dataset#unbind, and attempting to use a prepared statement if the variables can be unbound correctly. See Unbinder for details about what types of dataset filters can be unbound correctly.

This plugin depends on the prepared_statements plugin and should be considered unsafe. Unbinding dataset values cannot be done correctly in all cases, and use of this plugin in cases where not there are variables that are not unbound can lead to an denial of service attack by allocating an arbitrary number of prepared statements. You have been warned.

Note that in most cases, this plugin will probably make things slower, so you should only use it if you really want to use prepared statements for Dataset#with_pk.


# Make all model subclasses use prepared statements for Dataset#with_pk (called before loading subclasses)
Sequel::Model.plugin :prepared_statements_with_pk

# Make the Album class use prepared statements for Dataset#with_pk
Album.plugin :prepared_statements_with_pk


Public Class

  1. apply

Public Class methods

apply (model)

Depend on the prepared_statements plugin

[show source]
# File lib/sequel/plugins/prepared_statements_with_pk.rb, line 31
def self.apply(model)